From fccf5bf17fc5c30fb62c536b5ab38332266053e9 Mon Sep 17 00:00:00 2001 From: Maksim Sen Date: Tue, 13 Mar 2018 14:56:28 -0400 Subject: [PATCH] Bug 11361 - Add a Z39.50 search page in the OPAC to let members search for records on remote Koha instances Made changes wanted in the code review. --- C4/Auth.pm | 4 ---- installer/data/mysql/atomicupdate/bug11361.perl | 8 ++++++++ installer/data/mysql/sysprefs.sql | 4 ++-- installer/data/mysql/updatedatabase.pl | 8 -------- koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-z3950-search.tt | 6 +++--- opac/opac-z3950-search.pl | 5 ++--- 7 files changed, 16 insertions(+), 21 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug11361.perl diff --git a/C4/Auth.pm b/C4/Auth.pm index cddeb55..7fd62bd 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -526,10 +526,6 @@ sub get_template_and_user { OPACFRBRizeEditions => C4::Context->preference("OPACFRBRizeEditions"), OpacHighlightedWords => C4::Context->preference("OpacHighlightedWords"), OPACShelfBrowser => "" . C4::Context->preference("OPACShelfBrowser"), - 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, diff --git a/installer/data/mysql/atomicupdate/bug11361.perl b/installer/data/mysql/atomicupdate/bug11361.perl new file mode 100644 index 0000000..95a49b8 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug11361.perl @@ -0,0 +1,8 @@ +$DBversion = "XXX"; +if( CheckVersion( $DBversion ) ) { + $dbh->do("ALTER TABLE z3950servers ADD COLUMN opac TINYINT(1) AFTER attributes;"); + $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."; + print "Add OPACZ3950 preference".; + SetVersion($DBversion); +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index e4c69d9..a291c99 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -405,6 +405,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACXSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on OPAC','Free'), ('OPACXSLTListsDisplay','default','','Enable XSLT stylesheet control over lists pages display on OPAC','Free'), ('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'), +('OPACZ3950','0','','Allow patrons to search for bibliographic records in other libraries via Z39.50.','YesNo'), ('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'), ('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'), ('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'), @@ -603,6 +604,5 @@ 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'), -('OPACZ3950','0','','Allow patrons to search for bibliographic records in other libraries via Z39.50.','YesNo') +('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo') ; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 86ff057..7f5c479 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -15613,14 +15613,6 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 13287 - Add system preference PurgeSuggestionsOlderThan)\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 diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index fe266a0..da64efe 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -278,7 +278,7 @@ [% IF ( Koha.Preference( 'UseCourseReserves' ) == 1 ) %]
  • Course reserves
  • [% END %] [% IF Koha.Preference( 'OpacBrowser' ) == 1 %]
  • Browse by hierarchy
  • [% END %] [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
  • Authority search
  • [% END %] - [% IF Koha.Preference( 'OpacZ3950' ) %]
  • Z39.50 Search
  • [% END %] + [% IF Koha.Preference( 'OpacZ3950' ) %]
  • Search other catalogs
  • [% END %] [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'reviewson' ) == 1 ) && ( Koha.Preference( 'OpacShowRecentComments' ) == 1 ) ) %]
  • Recent comments
  • [% END %] [% IF Koha.Preference( 'TagsEnabled' ) == 1 %]
  • Tag cloud
  • [% END %] [% IF Koha.Preference( 'OpacCloud' ) == 1 %]
  • Subject cloud
  • [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-z3950-search.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-z3950-search.tt index eda770d..acd6a9e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-z3950-search.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-z3950-search.tt @@ -65,7 +65,7 @@ Koha › Z39.50/SRU search results
    -

    Search Parameters

    +

    Search parameters

    [% FOREACH field IN search_fields %]
    @@ -181,11 +181,11 @@ Koha › Z39.50/SRU search results
    [% IF ( show_prevbutton ) %] - + [% END %] Page [% current_page %] / [% total_pages %] [% IF ( show_nextbutton ) %] - + [% END %]
    diff --git a/opac/opac-z3950-search.pl b/opac/opac-z3950-search.pl index d049e9d..7ff68d7 100755 --- a/opac/opac-z3950-search.pl +++ b/opac/opac-z3950-search.pl @@ -18,8 +18,7 @@ # with Koha; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -use strict; -use warnings; +use Modern::Perl; use CGI; use C4::Auth; @@ -52,7 +51,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ template_name => "opac-z3950-search.tt", query => $input, type => "opac", - authnotrequired => 1, + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), debug => 1, }); -- 2.7.4