[Koha-patches] [PATCH] Bug 3093 add syspref to turn off multiholds button

Jane Wagner jwagner at ptfs.com
Wed Nov 11 16:50:00 CET 2009


Having the place multiple holds button at the top of the OPAC and staff search results has caused problems for some sites with tight holds policies; this syspref allows those sites to turn off the button.
---
 admin/systempreferences.pl                         |    1 +
 catalogue/search.pl                                |    2 ++
 installer/data/mysql/en/mandatory/sysprefs.sql     |    1 +
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    1 +
 .../ru-RU/mandatory/system_preferences_optimal.sql |    1 +
 installer/data/mysql/updatedatabase.pl             |    7 +++++++
 .../prog/en/modules/catalogue/results.tmpl         |    2 ++
 .../opac-tmpl/prog/en/modules/opac-results.tmpl    |    2 ++
 opac/opac-search.pl                                |    2 ++
 9 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index e96c109..d49ebbb 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -233,6 +233,7 @@ $tabsysprefs{sortbynonfiling}         = "Searching";
 $tabsysprefs{QueryAutoTruncate}       = "Searching";
 $tabsysprefs{QueryRemoveStopwords}    = "Searching";
 $tabsysprefs{AdvancedSearchTypes}     = "Searching";
+$tabsysprefs{DisplayMultiPlaceHold}   = "Searching";
 
 # EnhancedContent
 $tabsysprefs{AmazonEnabled}          = "EnhancedContent";
diff --git a/catalogue/search.pl b/catalogue/search.pl
index f9e5241..2da961a 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -147,6 +147,7 @@ use C4::Koha;
 use POSIX qw(ceil floor);
 use C4::Branch; # GetBranches
 
+my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
 # create a new CGI object
 # FIXME: no_undef_params needs to be tested
 use CGI qw('-no_undef_params');
@@ -531,6 +532,7 @@ for (my $i=0;$i<@servers;$i++) {
             $template->param(query_cgi => $query_cgi);
             $template->param(query_desc => $query_desc);
             $template->param(limit_desc => $limit_desc);
+            $template->param(DisplayMultiPlaceHold => $DisplayMultiPlaceHold);
 			$template->param (z3950_search_params => C4::Search::z3950_search_args($query_desc));
             if ($query_desc || $limit_desc) {
                 $template->param(searchdesc => 1);
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 6f60fa7..9921e35 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -262,3 +262,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'If ON, displays patron image when a patron uses web-based self-checkout', '', 'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('DisplayMultiPlaceHold', '1', 'If ON, displays the Place Hold button at the top of the search results list in staff and OPAC. Sites whose policies require tighter control over holds may want to turn this option off and limit users to placing holds one at a time.', '', '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 bee360a..cc8ac2a 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
@@ -261,3 +261,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('H
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'Si activé, affiche le format, le type de public et les icônes de type en XSLT (MARC21)).', 'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'Si activé, affiche la photo de l''adhérent lors de l''utilisation de la console de prêt auto-contrôlé', '', 'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('DisplayMultiPlaceHold', '1', 'Si Activé, affiche le bouton de réservation en hat des listes de résultats à l'intranet et à l'OPAC. Les bibliothèques dont les règles de réservations sont strictes devraient désactiver cette option et restreindre les utilisateur à ne placer qu'une réservation à la fois', .'', 'YesNo');
diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql
index 61318c0..5d8568b 100644
--- a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql
+++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql
@@ -238,3 +238,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MergeAuthoritiesOnUpdate', '1', 'if ON, Updating authorities will automatically updates biblios',NULL,'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowNotForLoanOverride', '0', 'if ON, enables the librarian to choose when they want to check out a notForLoan regular item',NULL,'YesNo');
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo');
+INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayMultiPlaceHold', '1', '', 'If ON, displays the Place Hold button at the top of the search results list in staff and OPAC. Sites whose policies require tighter control over holds may want to turn this option off and limit users to placing holds one at a time.', 'YesNo');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 10c3451..887a9db 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2675,6 +2675,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.01.00.062';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('DisplayMultiPlaceHold', '1', 'If ON, displays the Place Hold button at the top of the search results list in staff and OPAC. Sites whose policies require tighter control over holds may want to turn this option off and limit users to placing holds one at a time.', '', 'YesNo')");
+	print "Upgrade to $DBversion done ( Added ShowPatronImageInWebBasedSelfCheck system preference )\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
index 5bb82c2..ca31745 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
@@ -182,7 +182,9 @@ function GetZ3950Terms(){
                 <a href="#" class="highlight_toggle" id="highlight_toggle_off">Unhighlight</a>
                 <a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>
                 <!-- TMPL_IF NAME="CAN_user_reserveforothers" -->
+                	<!-- TMPL_IF NAME="DisplayMultiPlaceHold" -->
                   <input type="button" onclick="placeHold(); return false;" value="Place Hold"/>
+                	<!-- /TMPL_IF -->
                 <!-- /TMPL_IF -->
                 <input type="button" onclick="addToList(); return false;" value="Add to List"/>
 				<!-- TMPL_IF NAME="CAN_user_editcatalogue" --><input type="button" onclick="PopupZ3950(); return false;" value="z39.50 Search"/><!-- /TMPL_IF -->
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 eb995f1..d6aff4a 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
@@ -151,12 +151,14 @@ $(document).ready(function(){
     });
 <!-- TMPL_IF NAME="RequestOnOpac" -->
   <!-- TMPL_IF NAME="opacuserlogin" -->
+  <!-- TMPL_IF NAME="DisplayMultiPlaceHold" -->
     $("#placehold").html("<input class=\"submit\" type=\"submit\" value=\""+_("Place Hold")+"\"/>");
 	$("#placehold").find("input:submit").click(function(){
         holdMultiple();
 		return false;
 	});
   <!-- /TMPL_IF -->
+  <!-- /TMPL_IF -->
 <!-- /TMPL_IF -->
     $("#holdDetails").hide();
 
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index a7f7470..f26efbf 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -18,6 +18,7 @@ use C4::Tags qw(get_tags);
 use POSIX qw(ceil floor strftime);
 use C4::Branch; # GetBranches
 
+my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
 # create a new CGI object
 # FIXME: no_undef_params needs to be tested
 use CGI qw('-no_undef_params');
@@ -459,6 +460,7 @@ for (my $i=0;$i<=@servers;$i++) {
             $template->param(query_cgi => $query_cgi);
             $template->param(query_desc => $query_desc);
             $template->param(limit_desc => $limit_desc);
+            $template->param(DisplayMultiPlaceHold => $DisplayMultiPlaceHold);
             if ($query_desc || $limit_desc) {
                 $template->param(searchdesc => 1);
             }
-- 
1.5.6.5




More information about the Koha-patches mailing list