MARC authority management (continued)
authortipaul <tipaul>
Thu, 10 Jun 2004 08:58:34 +0000 (08:58 +0000)
committertipaul <tipaul>
Thu, 10 Jun 2004 08:58:34 +0000 (08:58 +0000)
admin/auth_subfields_structure.pl
admin/auth_tag_structure.pl
admin/authtypes.pl
admin/marc_subfields_structure.pl

index 9e8cf9e..9b639d5 100755 (executable)
@@ -119,11 +119,8 @@ if ($op eq 'add_form') {
                        $toggle="white";
                }
                $row_data{tab} = CGI::scrolling_list(-name=>'tab',
-                                       -values=>['-1','0','1','2','3','4','5','6','7','8','9'],
-                                       -labels => {'-1' =>'ignore','0'=>'0','1'=>'1',
-                                                                       '2' =>'2','3'=>'3','4'=>'4',
-                                                                       '5' =>'5','6'=>'6','7'=>'7',
-                                                                       '8' =>'8','9'=>'9',
+                                       -values=>['-1','0'],
+                                       -labels => {'-1' =>'No (ignore)','0'=>'yes'
                                                                        },
                                        -default=>$data->{'tab'},
                                        -size=>1,
@@ -155,11 +152,8 @@ if ($op eq 'add_form') {
        for (my $i=1;$i<=$more_subfields;$i++) {
                my %row_data;  # get a fresh hash for the row data
                $row_data{tab} = CGI::scrolling_list(-name=>'tab',
-                                       -values=>['-1','0','1','2','3','4','5','6','7','8','9'],
-                                       -labels => {'-1' =>'ignore','0'=>'0','1'=>'1',
-                                                                       '2' =>'2','3'=>'3','4'=>'4',
-                                                                       '5' =>'5','6'=>'6','7'=>'7',
-                                                                       '8' =>'8','9'=>'9',
+                                       -values=>['-1','0'],
+                                       -labels => {'-1' =>'no (ignore)','0'=>'yes',
                                                                        },
                                        -default=>"",
                                        -size=>1,
index 90c811b..2e8f580 100755 (executable)
@@ -286,11 +286,11 @@ sub duplicate_auth_framework {
                $sth_insert->execute($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value,$newauthtype);
        }
 
-       $sth = $dbh->prepare("select authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder,seealso from auth_subfield_structure where authtypecode=?");
+       $sth = $dbh->prepare("select authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,seealso from auth_subfield_structure where authtypecode=?");
        $sth->execute($oldauthtype);
-       $sth_insert = $dbh->prepare("insert into auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,thesaurus_category,value_builder,seealso) values (?,?,?,?,?,?,?,?,?,?,?,?,?)");
-       while ( my ($authtypecode, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $kohafield, $tab, $authorised_value, $thesaurus_category, $value_builder, $seealso) = $sth->fetchrow) {
-               $sth_insert->execute($newauthtype, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $kohafield, $tab, $authorised_value, $thesaurus_category, $value_builder, $seealso);
+       $sth_insert = $dbh->prepare("insert into auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,value_builder,seealso) values (?,?,?,?,?,?,?,?,?,?,?)");
+       while ( my ($authtypecode, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $tab, $authorised_value, $thesaurus_category, $seealso) = $sth->fetchrow) {
+               $sth_insert->execute($newauthtype, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $tab, $authorised_value, $thesaurus_category, $seealso);
        }
 }
 
index 1689654..0195190 100755 (executable)
@@ -79,14 +79,16 @@ if ($op eq 'add_form') {
        my $data;
        if ($authtypecode) {
                my $dbh = C4::Context->dbh;
-               my $sth=$dbh->prepare("select authtypecode,authtypetext,auth_tag_to_report from auth_types where authtypecode=?");
+               my $sth=$dbh->prepare("select * from auth_types where authtypecode=?");
                $sth->execute($authtypecode);
                $data=$sth->fetchrow_hashref;
                $sth->finish;
        }
+       warn "=> $data->{'authtypetext'} : ".$data->{'summary'};
        $template->param(authtypecode => $authtypecode,
                                                        authtypetext => $data->{'authtypetext'},
                                                        auth_tag_to_report => $data->{'auth_tag_to_report'},
+                                                       summary => $data->{'summary'},
                                                        );
 ;
                                                                                                        # END $OP eq ADD_FORM
@@ -94,8 +96,8 @@ if ($op eq 'add_form') {
 # called by add_form, used to insert/modify data in DB
 } elsif ($op eq 'add_validate') {
        my $dbh = C4::Context->dbh;
-       my $sth=$dbh->prepare("replace auth_types (authtypecode,authtypetext,auth_tag_to_report) values (?,?,?)");
-       $sth->execute($input->param('authtypecode'),$input->param('authtypetext'),$input->param('auth_tag_to_report'));
+       my $sth=$dbh->prepare("replace auth_types (authtypecode,authtypetext,auth_tag_to_report,summary) values (?,?,?,?)");
+       $sth->execute($input->param('authtypecode'),$input->param('authtypetext'),$input->param('auth_tag_to_report'),$input->param('summary'));
        $sth->finish;
        print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=authtypes.pl\"></html>";
        exit;
@@ -114,13 +116,14 @@ if ($op eq 'add_form') {
           $sth->finish;
        }
 
-       my $sth=$dbh->prepare("select authtypecode,authtypetext from auth_types where authtypecode=?");
+       my $sth=$dbh->prepare("select * from auth_types where authtypecode=?");
        $sth->execute($authtypecode);
        my $data=$sth->fetchrow_hashref;
        $sth->finish;
 
        $template->param(authtypecode => $authtypecode,
                                                        authtypetext => $data->{'authtypetext'},
+                                                       summary => $data->{'summary'},
                                                        total => $total);
                                                                                                        # END $OP eq DELETE_CONFIRM
 ################## DELETE_CONFIRMED ##################################
@@ -155,6 +158,7 @@ if ($op eq 'add_form') {
                $row_data{authtypecode} = $results->[$i]{'authtypecode'};
                $row_data{authtypetext} = $results->[$i]{'authtypetext'};
                $row_data{auth_tag_to_report} = $results->[$i]{'auth_tag_to_report'};
+               $row_data{summary} = $results->[$i]{'summary'};
                push(@loop_data, \%row_data);
        }
        $template->param(loop => \@loop_data);
index 8c91143..ab9e92e 100755 (executable)
@@ -121,12 +121,12 @@ if ($op eq 'add_form') {
        push (@authorised_values,"itemtypes");
        # build thesaurus categories list
        $sth2->finish;
-       $sth2 = $dbh->prepare("select distinct category from bibliothesaurus");
+       $sth2 = $dbh->prepare("select authtypecode from auth_types");
        $sth2->execute;
-       my @thesaurus_category;
-       push @thesaurus_category,"";
-       while ((my $category) = $sth2->fetchrow_array) {
-               push @thesaurus_category, $category;
+       my @authtypes;
+       push @authtypes,"";
+       while ((my $authtypecode) = $sth2->fetchrow_array) {
+               push @authtypes, $authtypecode;
        }
        # build value_builder list
        my @value_builder=('');
@@ -184,9 +184,9 @@ if ($op eq 'add_form') {
                                        -size=>1,
                                        -multiple=>0,
                                        );
-               $row_data{thesaurus_category}  = CGI::scrolling_list(-name=>'thesaurus_category',
-                                       -values=> \@thesaurus_category,
-                                       -default=>$data->{'thesaurus_category'},
+               $row_data{authtypes}  = CGI::scrolling_list(-name=>'authtypecode',
+                                       -values=> \@authtypes,
+                                       -default=>$data->{'authtypecode'},
                                        -size=>1,
                                        -multiple=>0,
                                        );
@@ -231,8 +231,8 @@ if ($op eq 'add_form') {
                                        -size=>1,
                                        -multiple=>0,
                                        );
-               $row_data{thesaurus_category}  = CGI::scrolling_list(-name=>'thesaurus_category',
-                                       -values=> \@thesaurus_category,
+               $row_data{authtypes}  = CGI::scrolling_list(-name=>'authtypecode',
+                                       -values=> \@authtypes,
                                        -size=>1,
                                        -multiple=>0,
                                        );
@@ -253,7 +253,7 @@ if ($op eq 'add_form') {
 } elsif ($op eq 'add_validate') {
        my $dbh = C4::Context->dbh;
        $template->param(tagfield => "$input->param('tagfield')");
-       my $sth=$dbh->prepare("replace marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,thesaurus_category,value_builder,hidden,isurl,frameworkcode)
+       my $sth=$dbh->prepare("replace marc_subfield_structure (tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,frameworkcode)
                                                                        values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
        my @tagsubfield = $input->param('tagsubfield');
        my @liblibrarian        = $input->param('liblibrarian');
@@ -262,7 +262,7 @@ if ($op eq 'add_form') {
        my @tab                         = $input->param('tab');
        my @seealso             = $input->param('seealso');
        my @authorised_values   = $input->param('authorised_value');
-       my @thesaurus_category  = $input->param('thesaurus_category');
+       my @authtypecodes       = $input->param('authtypecode');
        my @value_builder       =$input->param('value_builder');
        for (my $i=0; $i<= $#tagsubfield ; $i++) {
                my $tagfield                    =$input->param('tagfield');
@@ -276,7 +276,7 @@ if ($op eq 'add_form') {
                my $tab                         =$tab[$i];
                my $seealso                             =$seealso[$i];
                my $authorised_value            =$authorised_values[$i];
-               my $thesaurus_category          =$thesaurus_category[$i];
+               my $authtypecode                =$authtypecodes[$i];
                my $value_builder=$value_builder[$i];
                my $hidden = $input->param("hidden$i")?1:0;
                my $isurl = $input->param("isurl$i")?1:0;
@@ -292,7 +292,7 @@ if ($op eq 'add_form') {
                                                                        $tab,
                                                                        $seealso,
                                                                        $authorised_value,
-                                                                       $thesaurus_category,
+                                                                       $authtypecode,
                                                                        $value_builder,
                                                                        $hidden,
                                                                        $isurl,
@@ -357,7 +357,7 @@ if ($op eq 'add_form') {
                $row_data{tab} = $results->[$i]{'tab'};
                $row_data{seealso} = $results->[$i]{'seealso'};
                $row_data{authorised_value} = $results->[$i]{'authorised_value'};
-               $row_data{thesaurus_category}   = $results->[$i]{'thesaurus_category'};
+               $row_data{authtypecode} = $results->[$i]{'authtypecode'};
                $row_data{value_builder}        = $results->[$i]{'value_builder'};
                $row_data{hidden}       = $results->[$i]{'hidden'};
                $row_data{isurl}        = $results->[$i]{'isurl'};