Bug 5957: Making COiNS in OPAC search results optional

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@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Ian Walls 2011-03-30 12:01:34 -04:00 committed by Chris Cormack
parent fd1b757233
commit c625ff9872
11 changed files with 32 additions and 5 deletions

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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 lutente; 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');

View file

@ -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');

View file

@ -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');

View file

@ -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');

View file

@ -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)

View file

@ -66,6 +66,12 @@ OPAC:
yes: show
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:

View file

@ -401,8 +401,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" -->

View file

@ -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"};