@@ -, +, @@ authority searching --- acqui/z3950_search.pl | 2 +- admin/z3950servers.pl | 22 +++++++++++-------- cataloguing/z3950_auth_search.pl | 2 +- cataloguing/z3950_search.pl | 2 +- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 ++++++ .../prog/en/modules/admin/z3950servers.tt | 19 +++++++++++++++- .../en/modules/cataloguing/z3950_auth_search.tt | 2 +- 8 files changed, 42 insertions(+), 15 deletions(-) --- a/acqui/z3950_search.pl +++ a/acqui/z3950_search.pl @@ -93,7 +93,7 @@ $template->param( ); if ( $op ne "do_search" ) { - my $sth = $dbh->prepare("select id,host,name,checked from z3950servers order by host"); + my $sth = $dbh->prepare("select id,host,name,checked from z3950servers where recordtype <> 'authority' order by host"); $sth->execute(); my $serverloop = $sth->fetchall_arrayref( {} ); $template->param( --- a/admin/z3950servers.pl +++ a/admin/z3950servers.pl @@ -40,7 +40,7 @@ sub StringSearch { $searchstring = ''; } - my $query = "SELECT host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout"; + my $query = "SELECT host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype"; $query .= " FROM z3950servers"; if ( $searchstring ne '' ) { $query .= " WHERE (name like ?)" } $query .= " ORDER BY rank,name"; @@ -91,7 +91,7 @@ if ($op eq 'add_form') { my $data; if ($searchfield) { my $dbh = C4::Context->dbh; - my $sth=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout from z3950servers where (name = ?) order by rank,name"); + my $sth=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name"); $sth->execute($searchfield); $data=$sth->fetchrow_hashref; $sth->finish; @@ -99,7 +99,7 @@ if ($op eq 'add_form') { $template->param( $_ => $data->{$_} ) for ( qw( host port db userid password checked rank timeout encoding ) ); $template->param( $_ . $data->{$_} => 1) - for ( qw( syntax ) ); + for ( qw( syntax recordtype ) ); # END $OP eq ADD_FORM ################## ADD_VALIDATE ################################## # called by add_form, used to insert/modify data in DB @@ -110,7 +110,7 @@ if ($op eq 'add_form') { $sth->execute($input->param('searchfield')); my $checked = $input->param('checked') ? 1 : 0; if ($sth->rows) { - $sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=?,timeout=? where name=?"); + $sth=$dbh->prepare("update z3950servers set host=?, port=?, db=?, userid=?, password=?, name=?, checked=?, rank=?,syntax=?,encoding=?,timeout=?,recordtype=? where name=?"); $sth->execute($input->param('host'), $input->param('port'), $input->param('db'), @@ -122,14 +122,15 @@ if ($op eq 'add_form') { $input->param('syntax'), $input->param('encoding'), $input->param('timeout'), + $input->param('recordtype'), $input->param('searchfield'), ); } else { $sth=$dbh->prepare( "INSERT INTO z3950servers " . - "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout) " . - "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ); + "(host,port,db,userid,password,name,checked,rank,syntax,encoding,timeout,recordtype) " . + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ); $sth->execute( $input->param( 'host' ), $input->param( 'port' ), @@ -141,7 +142,8 @@ if ($op eq 'add_form') { $input->param( 'rank' ), $input->param( 'syntax' ), $input->param( 'encoding' ), - $input->param( 'timeout' ) ); + $input->param( 'timeout' ), + $input->param( 'recordtype' ) ); } $sth->finish; # END $OP eq ADD_VALIDATE @@ -151,7 +153,7 @@ if ($op eq 'add_form') { $template->param(delete_confirm => 1); my $dbh = C4::Context->dbh; - my $sth2=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout from z3950servers where (name = ?) order by rank,name"); + my $sth2=$dbh->prepare("select host,port,db,userid,password,name,id,checked,rank,syntax,encoding,timeout,recordtype from z3950servers where (name = ?) order by rank,name"); $sth2->execute($searchfield); my $data=$sth2->fetchrow_hashref; $sth2->finish; @@ -165,6 +167,7 @@ if ($op eq 'add_form') { rank => $data->{'rank'}, syntax => $data->{'syntax'}, timeout => $data->{'timeout'}, + recordtype => $data->{'recordtype'}, encoding => $data->{'encoding'} ); # END $OP eq DELETE_CONFIRM @@ -196,7 +199,8 @@ if ($op eq 'add_form') { rank => $results->[$i]{'rank'}, syntax => $results->[$i]{'syntax'}, encoding => $results->[$i]{'encoding'}, - timeout => $results->[$i]{'timeout'}); + timeout => $results->[$i]{'timeout'}, + recordtype => $results->[$i]{'recordtype'}); push @loop, \%row; } --- a/cataloguing/z3950_auth_search.pl +++ a/cataloguing/z3950_auth_search.pl @@ -70,7 +70,7 @@ $template->param( ); if ( $op ne "do_search" ) { - my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers ORDER BY rank, name"); + my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers WHERE recordtype = 'authority' ORDER BY rank, name"); $sth->execute(); my $serverloop = $sth->fetchall_arrayref( {} ); $template->param( --- a/cataloguing/z3950_search.pl +++ a/cataloguing/z3950_search.pl @@ -74,7 +74,7 @@ $template->param( ); if ( $op ne "do_search" ) { - my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers ORDER BY rank, name"); + my $sth = $dbh->prepare("SELECT id,host,name,checked FROM z3950servers WHERE recordtype <> 'authority' ORDER BY rank, name"); $sth->execute(); my $serverloop = $sth->fetchall_arrayref( {} ); $template->param( --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -2179,6 +2179,7 @@ CREATE TABLE `z3950servers` ( -- connection information for the Z39.50 targets u `type` enum('zed','opensearch') NOT NULL default 'zed', `encoding` text default NULL, -- characters encoding provided by this target `description` text NOT NULL, -- unused in Koha + `recordtype` varchar(45) NOT NULL default 'biblio', -- server contains bibliographic or authority records PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -6834,6 +6834,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.11.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ALTER TABLE `z3950servers` ADD COLUMN `recordtype` VARCHAR(45) NOT NULL DEFAULT 'biblio';}); + print "Upgrade to $DBversion done (Bug 10096 - Add a Z39.50 interface for authority searching)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt @@ -237,6 +237,20 @@
  • seconds
  • +
  • + +
  • @@ -266,6 +280,7 @@
  • Syntax: [% syntax %]
  • Encoding: [% encoding %]
  • Timeout: [% timeout %]
  • +
  • Record type: [% recordtype %]
  • @@ -291,7 +306,7 @@ You searched for [% searchfield %] [% END %] - + [% FOREACH loo IN loop %] [% UNLESS ( loop.odd ) %] @@ -299,7 +314,7 @@ [% ELSE %] [% END %] - + [% END %]
    TargetHostname/PortDatabaseUseridPasswordCheckedRankSyntaxEncodingTimeout  
    TargetHostname/PortDatabaseUseridPasswordCheckedRankSyntaxEncodingTimeoutRecord type  
    [% loo.name %][% loo.host %]:[% loo.port %][% loo.db %][% loo.userid %][% loo.password %][% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %][% loo.rank %] [% loo.syntax %][% loo.encoding %][% loo.timeout %]EditDelete
    [% loo.name %][% loo.host %]:[% loo.port %][% loo.db %][% loo.userid %][% loo.password %][% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %][% loo.rank %] [% loo.syntax %][% loo.encoding %][% loo.timeout %][% loo.recordtype %]EditDelete
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt @@ -109,7 +109,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
      -
    1. +
    2. --