[Koha-patches] [PATCH] Bug 5957: Making COiNS in OPAC search results optional
Jared Camins-Esakov
jcamins at bywatersolutions.com
Wed Mar 30 18:01:34 CEST 2011
From: Ian Walls <ian.walls at bywatersolutions.com>
Adds a new system preference, COinSinOPACResults, which toggles the inclusion of
COiNS/OpenURL/Z39.88 in the search results display. Default is 'on', continuing
the current behaviour.
Disabling this feature will result in a significant increase in search speed, since
each call to GetCOinSBiblio requires a separate parsing of the MARC record, and there are
<OPACnumSearchResults> calls to this routine with each search.
Signed-off-by: Jared Camins-Esakov <jcamins at bywatersolutions.com>
---
installer/data/mysql/de-DE/mandatory/sysprefs.sql | 1 +
installer/data/mysql/en/mandatory/sysprefs.sql | 1 +
.../1-Obligatoire/unimarc_standard_systemprefs.sql | 1 +
installer/data/mysql/it-IT/necessari/sysprefs.sql | 1 +
installer/data/mysql/pl-PL/mandatory/sysprefs.sql | 1 +
...m_preferences_full_optimal_for_install_only.sql | 1 +
...m_preferences_full_optimal_for_install_only.sql | 1 +
installer/data/mysql/updatedatabase.pl | 7 +++++++
.../prog/en/modules/admin/preferences/opac.pref | 6 ++++++
.../opac-tmpl/prog/en/modules/opac-results.tmpl | 6 ++++--
opac/opac-search.pl | 11 ++++++++---
11 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/installer/data/mysql/de-DE/mandatory/sysprefs.sql b/installer/data/mysql/de-DE/mandatory/sysprefs.sql
index 2e1069e..761ecef 100644
--- a/installer/data/mysql/de-DE/mandatory/sysprefs.sql
+++ b/installer/data/mysql/de-DE/mandatory/sysprefs.sql
@@ -27,6 +27,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('casServerUrl', 'https://localhost:8443/cas', 'URL of the cas server', '', 'Free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('CataloguingLog',1,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('checkdigit','none','If ON, enable checks on patron cardnumber: none or \"Katipo\" style checks','none|katipo','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('COinSinOPACResults', 1, 'If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('delimiter',';','Define the default separator character for exporting reports',';|tabulation|,|/|\\|#|\|','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('EnhancedMessagingPreferences',0,'If ON, allows patrons to select to receive additional messages about items due or nearly due.','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('expandedSearchOption',0,'If ON, set advanced search to be expanded by default',NULL,'YesNo');
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 9f47292..ad59527 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -27,6 +27,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('casServerUrl', 'https://localhost:8443/cas', 'URL of the cas server', '', 'Free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('CataloguingLog',1,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('checkdigit','none','If ON, enable checks on patron cardnumber: none or \"Katipo\" style checks','none|katipo','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('COinSinOPACResults', 1, 'If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('delimiter',';','Define the default separator character for exporting reports',';|tabulation|,|/|\\|#|\|','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('EnhancedMessagingPreferences',0,'If ON, allows patrons to select to receive additional messages about items due or nearly due.','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('expandedSearchOption',0,'If ON, set advanced search to be expanded by default',NULL,'YesNo');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index c58f69c..2bc0d52 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -27,6 +27,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('casServerUrl', 'https://localhost:8443/cas', 'L''URL du serveur CAS', '', 'Free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('CataloguingLog', '0', 'Activer ce paramètre pour enregistrer les actions sur le catalogage', '', 'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('checkdigit','none','Active la vérification des cartes adhérents sur aucun ou selon la méthode \"Katipo\"','none|katipo','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('COinSinOPACResults', 1, 'If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('dateformat', 'us', 'Ce paramètre définit le format d''affichage des dates (us mm/jj/aaaa, metric jj/mm/aaaa, ISO aaaa/mm/jj)', 'metric|us|iso', 'Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('delimiter', ';', 'Ce paramètre définit le séparateur par défaut lors des exports (au format csv) de données (Rapports, statistiques...)', ';|tabulation|,|/|\\|#', 'Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('EnhancedMessagingPreferences',0,'Si ce paramètre est activé, permet aux adhérents de choisir de recevoir des messages supplémentaires pour les documents dûs ou bientôt dûsIf ON.','','YesNo');
diff --git a/installer/data/mysql/it-IT/necessari/sysprefs.sql b/installer/data/mysql/it-IT/necessari/sysprefs.sql
index 3c3d3c8..91a3d3d 100644
--- a/installer/data/mysql/it-IT/necessari/sysprefs.sql
+++ b/installer/data/mysql/it-IT/necessari/sysprefs.sql
@@ -43,6 +43,7 @@ insert into `systempreferences` (`variable`, `value`, `options`, `explanation`,
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('checkdigit','none','none|katipo','Se ON, abilita i controlli sulle tessere utenti: gli stili di controllo tra cui scegliere sono none o \"Katipo\".','Choice');
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('CircAutocompl','1','','Se ON, si abilita l\'autocompletamento per l\'inserimento dei dati nella circolazione ','YesNo');
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specifica la biblioteca che definisce le politiche di prestito; se ItemLoanLibrary si userà la sottobiblioteca collegata alla copia. Se PatronLibrary la sottobiblioteca a cui e’ iscritto l’utente; se PickupLibrary la sottobiblioteca dove si prende la copia','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('COinSinOPACResults', 1, 'If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','','YesNo');
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('dateformat','metric','metric|us|iso','Definisce il formato data (ovvero us mm/gg/aaaa, metric gg/mm/aaaa o ISO aaaa/mm/gg)','Choice');
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('DebugLevel','2','0|1|2','Definisce il livello delle informazioni di debug da mandare al browser qualora dovessero verificarsi degli errori (in produzione impostare sempre il valore 0): 0=nessuno 1=medio 2=massimo','Choice');
insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('DefaultClassificationSource','ddc','','Per indicare il sistema di classificazione usato di default dalla bilbioteca. Ad es. Dewey, LCC, ecc.','ClassSources');
diff --git a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
index 70ad079..02158ee 100644
--- a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
+++ b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
@@ -27,6 +27,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('casServerUrl', 'https://localhost:8443/cas', 'URL of the cas server', '', 'Free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('CataloguingLog',1,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('checkdigit','none','If ON, enable checks on patron cardnumber: none or \"Katipo\" style checks','none|katipo','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('COinSinOPACResults', 1, 'If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('delimiter',';','Define the default separator character for exporting reports',';|tabulation|,|/|\\|#|\|','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('EnhancedMessagingPreferences',0,'If ON, allows patrons to select to receive additional messages about items due or nearly due.','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('expandedSearchOption',0,'If ON, set advanced search to be expanded by default',NULL,'YesNo');
diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
index 448e617..ccef0f9 100644
--- a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
+++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
@@ -39,6 +39,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowersLog',1,'If ON, log edit/create/delete actions on patron data',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('CataloguingLog',1,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('checkdigit','none','If ON, enable checks on patron cardnumber: none or \"Katipo\" style checks','none|katipo','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('COinSinOPACResults', 1, 'If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('delimiter',';','Define the default separator character for exporting reports',';|tabulation|,|/|\\|#|\|','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('EnhancedMessagingPreferences',0,'If ON, allows patrons to select to receive additional messages about items due or nearly due.','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('expandedSearchOption',0,'If ON, set advanced search to be expanded by default',NULL,'YesNo');
diff --git a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
index f8b1ea0..963b2dc 100644
--- a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
+++ b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
@@ -38,6 +38,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowersLog',1,'If ON, log edit/create/delete actions on patron data',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('CataloguingLog',1,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('checkdigit','none','If ON, enable checks on patron cardnumber: none or \"Katipo\" style checks','none|katipo','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('COinSinOPACResults', 1, 'If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('delimiter',';','Define the default separator character for exporting reports',';|tabulation|,|/|\\|#|\|','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('EnhancedMessagingPreferences',0,'If ON, allows patrons to select to receive additional messages about items due or nearly due.','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('expandedSearchOption',0,'If ON, set advanced search to be expanded by default',NULL,'YesNo');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index f2d6776..38eed7a 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4166,6 +4166,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = '3.03.00.XXX';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('COinSinOPACResults', 1, 'If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','','YesNo')");
+ print "Upgrade to $DBversion done ( Make COinS optional in OPAC search results )\n";
+ SetVersion ($DBversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
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 b9411b1..70afa82 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
@@ -67,6 +67,12 @@ OPAC:
no: "don't show"
- icons for itemtype and authorized values.
-
+ - pref: COinSinOPACResults
+ choices:
+ yes: Include
+ no: "Don't include"
+ - "COinS / OpenURL / Z39.88 in OPAC search results. <br/>Warning: Enabling this feature will slow OPAC search response times."
+ -
- pref: OPACDisplayRequestPriority
choices:
yes: Show
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
index d7aff2e..62f6467 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
@@ -394,8 +394,10 @@ $(document).ready(function(){
<!-- /TMPL_IF -->
<td>
- <!-- TMPL_IF NAME="coins" -->
- <!-- COinS / OpenURL --><span class="Z3988" title="<!-- TMPL_VAR NAME="coins" -->"></span>
+ <!-- TMPL_IF NAME="COinSinOPACResults" -->
+ <!-- TMPL_IF NAME="coins" -->
+ <!-- COinS / OpenURL --><span class="Z3988" title="<!-- TMPL_VAR NAME="coins" -->"></span>
+ <!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="OPACXSLTResultsDisplay" -->
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index c145729..a439dda 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -84,6 +84,9 @@ else {
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
}
);
+if ($template_name = 'opac-results.tmpl') {
+ $template->param('COinSinOPACResults' => C4::Context->preference('COinSinOPACResults'));
+}
if ($format eq 'rss2' or $format eq 'opensearchdescription' or $format eq 'atom') {
$template->param($format => 1);
@@ -468,9 +471,11 @@ for (my $i=0;$i<@servers;$i++) {
limit=>$tag_quantity });
}
}
- foreach (@newresults) {
- $_->{coins} = GetCOinSBiblio($_->{'biblionumber'});
- }
+ if (C4::Context->preference('COinSinOPACResults')) {
+ foreach (@newresults) {
+ $_->{coins} = GetCOinSBiblio($_->{'biblionumber'});
+ }
+ }
if ($results_hashref->{$server}->{"hits"}){
$total = $total + $results_hashref->{$server}->{"hits"};
--
1.7.2.3
More information about the Koha-patches
mailing list