many bugfixes from Dombes Abbey tests
authortipaul <tipaul>
Tue, 10 Dec 2002 13:29:32 +0000 (13:29 +0000)
committertipaul <tipaul>
Tue, 10 Dec 2002 13:29:32 +0000 (13:29 +0000)
admin/authorised_values.pl
admin/marc_subfields_structure.pl
admin/thesaurus.pl

index 528c92f..baaa41a 100755 (executable)
@@ -32,7 +32,7 @@ sub StringSearch  {
        $searchstring=~ s/\'/\\\'/g;
        my @data=split(' ',$searchstring);
        my $count=@data;
-       my $query="Select id,category,authorised_value from authorised_values where (category like \"$data[0]%\") order by category,authorised_value";
+       my $query="Select id,category,authorised_value,lib from authorised_values where (category like \"$data[0]%\") order by category,authorised_value";
        my $sth=$dbh->prepare($query);
        $sth->execute;
        my @results;
@@ -49,7 +49,7 @@ my $input = new CGI;
 my $searchfield=$input->param('searchfield');
 $searchfield=~ s/\,//g;
 my $id = $input->param('id');
-my $reqsel="select category,authorised_value from authorised_values where id='$id'";
+my $reqsel="select category,authorised_value,lib from authorised_values where id='$id'";
 my $reqdel="delete from authorised_values where id='$id'";
 my $offset=$input->param('offset');
 my $script_name="/cgi-bin/koha/admin/authorised_values.pl";
@@ -72,7 +72,7 @@ if ($op eq 'add_form') {
        my $data;
        if ($id) {
                my $dbh = C4::Context->dbh;
-               my $sth=$dbh->prepare("select id,category,authorised_value from authorised_values where id='$id'");
+               my $sth=$dbh->prepare("select id,category,authorised_value,lib from authorised_values where id='$id'");
                $sth->execute;
                $data=$sth->fetchrow_hashref;
                $sth->finish;
@@ -86,6 +86,7 @@ if ($op eq 'add_form') {
        }
        $template->param(category => $data->{'category'},
                                                        authorised_value => $data->{'authorised_value'},
+                                                       lib => $data->{'lib'},
                                                        id => $data->{'id'}
                                                        );
        if ($data->{'category'}) {
@@ -97,9 +98,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 authorised_values (id,category,authorised_value) values (?,?,?)");
-       warn "TOTO : ".$input->param('id'), $input->param('category'), $input->param('authorised_value');
-       $sth->execute($input->param('id'), $input->param('category'), $input->param('authorised_value'));
+       my $sth=$dbh->prepare("replace authorised_values (id,category,authorised_value,lib) values (?,?,?,?)");
+       $sth->execute($input->param('id'), $input->param('category'), $input->param('authorised_value'),$input->param('lib'));
        $sth->finish;
        print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=authorised_values.pl?searchfield=".$input->param('category')."\"></html>";
        exit;
@@ -161,6 +161,7 @@ if ($op eq 'add_form') {
                my %row_data;  # get a fresh hash for the row data
                $row_data{category} = $results->[$i]{'category'};
                $row_data{authorised_value} = $results->[$i]{'authorised_value'};
+               $row_data{lib} = $results->[$i]{'lib'};
                $row_data{edit} = "$script_name?op=add_form&id=".$results->[$i]{'id'};
                $row_data{delete} = "$script_name?op=delete_confirm&searchfield=$searchfield&id=".$results->[$i]{'id'};
                push(@loop_data, \%row_data);
index 59970a4..39c4129 100755 (executable)
@@ -166,7 +166,7 @@ if ($op eq 'add_form') {
                                        );
                $row_data{value_builder}  = CGI::scrolling_list(-name=>'value_builder',
                                        -values=> \@value_builder,
-                                       -default=>$data->{'thesaurus_category'},
+                                       -default=>$data->{'value_builder'},
                                        -size=>1,
                                        -multiple=>0,
                                        );
index 0bfbef9..c16ad14 100755 (executable)
@@ -73,9 +73,9 @@ if ($op eq 'add_form') {
                $data->{'stdlib'} = $input->param('stdlib');
        }
        if ($search_category) {
-               $template->param(action => "Modify authorised value");
+               $template->param(action => "Modify thesaurus");
        } else {
-               $template->param(action => "Add authorised value");
+               $template->param(action => "Add thesaurus");
        }
        $template->param(category => $data->{'category'},
                                                        stdlib => $data->{'stdlib'},
@@ -97,7 +97,9 @@ 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;
-       newauthority($dbh,$input->param('category'),$input->param('stdlib'), $input->param('freelib'),'',1,'');
+       my $freelib = $input->param('freelib');
+       $freelib = $input->param('stdlib') unless ($input->param('freelib'));
+       newauthority($dbh,$input->param('category'),$input->param('father')." ".$input->param('stdlib'), $freelib,'',1,'');
        print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=thesaurus.pl?branch=$branch&search_category=$search_category&searchstring=$searchstring&offset=$offset\"></html>";
        exit;
 ################## DELETE_CONFIRM ##################################
@@ -117,10 +119,6 @@ if ($op eq 'add_form') {
 ################## DELETE_CONFIRMED ##################################
 # called by delete_confirm, used to effectively confirm deletion of data in DB
 } elsif ($op eq 'delete_confirmed') {
-#      my $dbh = C4::Context->dbh;
-#      my $sth=$dbh->prepare($reqdel);
-#      $sth->execute;
-#      $sth->finish;
        &delauthority($id);
        print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=thesaurus.pl?search_category=$search_category&searchstring=$searchstring\"></html>";
        exit;