@@ -, +, @@ members search for records on remote Koha instances --- C4/Auth.pm | 1 + C4/Breeding.pm | 11 +- Koha/Schema/Result/Z3950server.pm | 16 ++ admin/z3950servers.pl | 2 +- installer/data/mysql/sysprefs.sql | 3 +- installer/data/mysql/updatedatabase.pl | 9 + .../prog/en/modules/admin/preferences/opac.pref | 6 + .../prog/en/modules/admin/z3950servers.tt | 11 +- .../opac-tmpl/bootstrap/en/includes/masthead.inc | 1 + .../bootstrap/en/includes/opac-bottom.inc | 12 + .../bootstrap/en/modules/opac-z3950-search.tt | 298 +++++++++++++++++++++ opac/opac-z3950-search.pl | 117 ++++++++ 12 files changed, 479 insertions(+), 8 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-z3950-search.tt create mode 100755 opac/opac-z3950-search.pl --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -523,6 +523,7 @@ sub get_template_and_user { OPACURLOpenInNewWindow => "" . C4::Context->preference("OPACURLOpenInNewWindow"), OPACUserCSS => "" . C4::Context->preference("OPACUserCSS"), OpacAuthorities => C4::Context->preference("OpacAuthorities"), + OpacZ3950 => C4::Context->preference("OpacZ3950"), opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, opac_search_limit => $opac_search_limit, opac_limit_override => $opac_limit_override, --- a/C4/Breeding.pm +++ a/C4/Breeding.pm @@ -131,12 +131,11 @@ The second parameter $template is a Template object. The routine uses this param =cut sub Z3950Search { - my ($pars, $template)= @_; + my ($pars, $template, $fromopac)= @_; my @id= @{$pars->{id}}; my $page= $pars->{page}; my $biblionumber= $pars->{biblionumber}; - my $show_next = 0; my $total_pages = 0; my @results; @@ -193,7 +192,7 @@ sub Z3950Search { for ($i = ($page-1)*20; $i < (($numresults < ($page*20)) ? $numresults : ($page*20)); $i++) { if ( $oResult[$k]->record($i) ) { undef $error; - ( $res, $error ) = _handle_one_result( $oResult[$k]->record($i), $servers[$k], ++$imported, $biblionumber, $xslh ); #ignores error in sequence numbering + ( $res, $error ) = _handle_one_result( $oResult[$k]->record($i), $servers[$k], ++$imported, $biblionumber, $xslh, $fromopac ); #ignores error in sequence numbering push @breeding_loop, $res if $res; push @errconn, { server => $servers[$k]->{servername}, error => $error, seq => $i+1 } if $error; } @@ -263,7 +262,7 @@ sub _build_query { } sub _handle_one_result { - my ( $zoomrec, $servhref, $seq, $bib, $xslh )= @_; + my ( $zoomrec, $servhref, $seq, $bib, $xslh, $fromopac )= @_; my $raw= $zoomrec->raw(); my $marcrecord; @@ -275,7 +274,7 @@ sub _handle_one_result { } SetUTF8Flag($marcrecord); my $error; - ( $marcrecord, $error ) = _do_xslt_proc($marcrecord, $servhref, $xslh); + ( $marcrecord, $error ) = _do_xslt_proc($marcrecord, $servhref, $xslh) unless $fromopac; my $batch_id = GetZ3950BatchId($servhref->{servername}); my $breedingid = AddBiblioToBatch($batch_id, $seq, $marcrecord, 'UTF-8', 0, 0); @@ -291,6 +290,7 @@ sub _handle_one_result { { biblionumber => $bib, server => $servhref->{servername}, + host => $servhref->{host}, breedingid => $breedingid, }, $marcrecord) if $breedingid; return ( $row, $error ); @@ -323,6 +323,7 @@ sub _do_xslt_proc { sub _add_rowdata { my ($row, $record)=@_; my %fetch= ( + biblionumber => 'biblio.biblionumber', title => 'biblio.title', author => 'biblio.author', isbn =>'biblioitems.isbn', --- a/Koha/Schema/Result/Z3950server.pm +++ a/Koha/Schema/Result/Z3950server.pm @@ -120,6 +120,18 @@ __PACKAGE__->table("z3950servers"); data_type: 'mediumtext' is_nullable: 1 +=head2 attributes + + data_type: 'varchar' + is_nullable: 1 + size: 255 + +=head2 opac + + data_type: 'tinyint' + is_nullable: 1 + size: 1 + =cut __PACKAGE__->add_columns( @@ -167,6 +179,10 @@ __PACKAGE__->add_columns( { data_type => "mediumtext", is_nullable => 1 }, "add_xslt", { data_type => "mediumtext", is_nullable => 1 }, + "attributes", + { data_type => "varchar", is_nullable => 1, size => 255 }, + "opac", + { data_type => "tinyint", is_nullable => 1, size => 1 }, ); =head1 PRIMARY KEY --- a/admin/z3950servers.pl +++ a/admin/z3950servers.pl @@ -66,7 +66,7 @@ if( $op eq 'delete_confirmed' && $id ) { $id = 0; } elsif ( $op eq 'add_validated' ) { my @fields=qw/host port db userid password rank syntax encoding timeout - recordtype checked servername servertype sru_options sru_fields + recordtype checked servername servertype sru_options sru_fields attributes opac add_xslt/; my $formdata = _form_data_hashref( $input, \@fields ); if( $id ) { --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -569,5 +569,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('XSLTListsDisplay','default','','Enable XSLT stylesheet control over lists pages display on intranet','Free'), ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'), ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), -('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo') +('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), +('OPACZ3950','0','','Allow patrons to search for bibliographic records in other libraries via Z39.50.','YesNo') ; --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -13959,6 +13959,15 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 16530 - Add a circ sidebar navigation menu)\n"; } +$DBversion = "XXX"; +if( CheckVersion( $DBversion ) ) { + $dbh->do("ALTER TABLE z3950servers ADD COLUMN opac TINYINT(1);"); + $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('OPACZ3950','0','','Allow patrons to search for bibliographic records in other libraries via Z39.50.','YesNo')"); + print "Add opac column to z3950servers table.\nAdd OPACZ3950 preference.\n"; + SetVersion($DBversion); +} + + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -409,6 +409,12 @@ OPAC: no: "Don't allow" - patrons to search your authority records. - + - pref: OpacZ3950 + choices: + yes: Allow + no: "Don't allow" + - patrons to search for bibliographic records in other libraries via Z39.50. + - - pref: opacbookbag choices: yes: Allow --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt @@ -150,6 +150,13 @@ [% END %] +
  • + [% IF ( server.opac ) %] + + [% ELSE %] + + [% END %] +
  • @@ -228,7 +235,7 @@ You searched for [% searchfield %] [% END %] - + [% FOREACH loo IN loop %] @@ -241,6 +248,8 @@ Authority [% END %] + +
    TargetHostname/PortDatabaseUseridPasswordPreselectedRankSyntaxEncodingTimeoutRecord type
    TargetHostname/PortDatabaseUseridPasswordPreselectedRankSyntaxEncodingTimeoutRecord typeAttributesOPACOptions
    [% loo.attributes %][% IF loo.opac %]X[% END %]