Bug 10802: make Debian package install history.txt
[koha.git] / admin / z3950servers.pl
index d6044fc..87711c1 100755 (executable)
@@ -53,13 +53,12 @@ sub StringSearch  {
         $sth->execute;
     }
 
-       my @results;
-       while (my $data=$sth->fetchrow_hashref) {
-           push(@results,$data);
-       }
-       $sth->finish;
-       $dbh->disconnect;
-       return (scalar(@results),\@results);
+    my @results;
+    while (my $data=$sth->fetchrow_hashref) {
+        push(@results,$data);
+    }
+    $sth->finish;
+    return (scalar(@results),\@results);
 }
 
 my $input = new CGI;
@@ -98,19 +97,19 @@ if ($op eq 'add_form') {
                $sth->finish;
        }
     $template->param( $_ => $data->{$_} ) 
-        for ( qw( host port db userid password checked rank timeout ) );
+        for ( qw( host port db userid password checked rank timeout encoding ) );
     $template->param( $_ . $data->{$_} => 1)
-        for ( qw( syntax encoding ) );
+        for ( qw( syntax ) );
                                                                                                        # END $OP eq ADD_FORM
 ################## ADD_VALIDATE ##################################
 # called by add_form, used to insert/modify data in DB
 } elsif ($op eq 'add_validate') {
-       $template->param(add_validate => 1);
        my $dbh=C4::Context->dbh;
        my $sth=$dbh->prepare("select * from z3950servers where name=?");
        $sth->execute($input->param('searchfield'));
        my $checked = $input->param('checked') ? 1 : 0;
        if ($sth->rows) {
+        $template->param(confirm_update => 1);
                $sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=?,timeout=? where name=?");
                $sth->execute($input->param('host'),
                      $input->param('port'),
@@ -127,6 +126,7 @@ if ($op eq 'add_form') {
                      );
        } 
        else {
+        $template->param(confirm_add => 1);
                $sth=$dbh->prepare(
                  "INSERT INTO z3950servers " .
                  "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout) " .