From 1dc2bc04951d6a825948846e229755439a7dac49 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 31 Jul 2014 11:26:28 +0200 Subject: [PATCH] Bug 8995: Change meaning and name of syspref OPACHideOpenURLForItemTypes OPACHideOpenURLForItemTypes is now named OPACOpenURLItemTypes and do the exact opposite as before: it shows OpenURL link only if the biblio itemtype is in the syspref. --- C4/XSLT.pm | 4 ++-- installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 2 +- .../intranet-tmpl/prog/en/modules/admin/preferences/opac.pref | 4 ++-- opac/opac-detail.pl | 4 ++-- opac/opac-search.pl | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 63316fc..a578127 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -219,8 +219,8 @@ sub XSLTParse4Display { $variables ||= {}; if (C4::Context->preference('OPACShowOpenURL')) { my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber); - my @itypes = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') ); - if (not grep /^$biblio->{itemtype}$/, @itypes) { + my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') ); + if (grep /^$biblio->{itemtype}$/, @itypes) { $variables->{COinS} = C4::Biblio::GetCOinSBiblio($orig_record); } } diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 507884e..ba0d83c 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -447,5 +447,5 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free') ('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free') ('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo') -('OPACHideOpenURLForItemTypes', '', NULL, 'Allow hiding the OpenURL link for some item types', 'Free') +('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free') ; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index c61457c..58df454 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8609,7 +8609,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { "); $dbh->do(" INSERT INTO systempreferences (variable,value,explanation,options,type) - VALUES('OPACHideOpenURLForItemTypes', '', 'Allow hiding the OpenURL link for some item types', NULL, 'Free'); + VALUES('OPACOpenURLItemTypes', '', 'Show the OpenURL link only for these item types', NULL, 'Free'); "); print "Upgrade to $DBversion done (Bug 8995 - Add sysprefs for OpenURL)\n"; SetVersion($DBversion); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index ca4f044..ab116cc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -335,8 +335,8 @@ OPAC: no: Disable - 'display of OpenURL link in OPAC search results and detail page.' - - - 'List of item type codes (separated by spaces) for those you do not want to show the OpenURL link:' - - pref: OPACHideOpenURLForItemTypes + - 'List of item type codes (separated by spaces) for those you want to show the OpenURL link:' + - pref: OPACOpenURLItemTypes - '
' - 'It uses biblioitems.itemtype field, so if you map a MARC field to it, and link this MARC field to a list of authorised values (for example CCODE), you can use these values for system preference value.' Features: diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index f4046d0..fa9c896 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -1139,8 +1139,8 @@ $template->param( # OpenURL if (C4::Context->preference('OPACShowOpenURL')) { my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber); - my @itypes = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') ); - if (not grep /^$biblio->{itemtype}$/, @itypes) { + my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') ); + if (grep /^$biblio->{itemtype}$/, @itypes) { $template->param( OPACShowOpenURL => 1, OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'), diff --git a/opac/opac-search.pl b/opac/opac-search.pl index ace05dd..572cc19 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -490,9 +490,9 @@ if (C4::Context->preference('OpacSuppression')) { } # OpenURL -my @OpenURL_itypes_to_hide; +my @OpenURL_itypes; if (C4::Context->preference('OPACShowOpenURL')) { - @OpenURL_itypes_to_hide = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') ); + @OpenURL_itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') ); $template->param( OPACShowOpenURL => 1, OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'), @@ -585,7 +585,7 @@ for (my $i=0;$i<@servers;$i++) { if (C4::Context->preference('COinSinOPACResults') or C4::Context->preference('OPACShowOpenURL')) { - if (not grep /^$res->{itemtype}$/, @OpenURL_itypes_to_hide) { + if (grep /^$res->{itemtype}$/, @OpenURL_itypes) { $res->{ShowOpenURL} = 1; } my $record = GetMarcBiblio($res->{'biblionumber'}); -- 1.7.10.4