From 08e57b52a814655af9da649a258ee850cb6dc8a7 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 13 Apr 2012 11:12:29 -0400 Subject: [PATCH] Bug 7951 - Suspending holds needs a system preference Adds system preferences SuspendHoldsIntranet and SuspendHoldsOpac. Signed-off-by: Chris Cormack Conflicts: installer/data/mysql/sysprefs.sql Signed-off-by: Chris Cormack --- circ/circulation.pl | 6 +++--- installer/data/mysql/sysprefs.sql | 3 ++- installer/data/mysql/updatedatabase.pl | 8 ++++++++ .../en/modules/admin/preferences/circulation.pref | 12 ++++++++++++ .../prog/en/modules/circ/circulation.tt | 4 +++- .../prog/en/modules/members/moremember.tt | 3 +++ .../intranet-tmpl/prog/en/modules/reserve/request.tt | 5 ++++- koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 2 ++ members/moremember.pl | 4 +++- opac/opac-user.pl | 5 ++++- reserve/request.pl | 5 ++++- 11 files changed, 48 insertions(+), 9 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index c89abff1f8..3e3c0e2cc6 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -708,7 +708,9 @@ $template->param( soundon => C4::Context->preference("SoundOn"), fast_cataloging => $fast_cataloging, CircAutoPrintQuickSlip => C4::Context->preference("CircAutoPrintQuickSlip"), - activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), + activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), + SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), + AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), ); # save stickyduedate to session @@ -733,6 +735,4 @@ $template->param( canned_bor_notes_loop => $canned_notes, ); -$template->param( AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds') ); - output_html_with_http_headers $query, $cookie, $template->output; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 6fb4c5fea3..f76d40b5eb 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -363,4 +363,5 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'); - +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsIntranet', '1', NULL , 'Allow holds to be suspended from the intranet.', 'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsOpac', '1', NULL , 'Allow holds to be suspended from the OPAC.', 'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 7aabb2bd18..907e2d9d92 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5235,6 +5235,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.09.00.012"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsIntranet', '1', NULL , 'Allow holds to be suspended from the intranet.', 'YesNo')"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsOpac', '1', NULL , 'Allow holds to be suspended from the OPAC.', 'YesNo')"); + print "Upgrade to $DBversion done (Add system preference OpacBrowseResults ))\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 49012fdab6..cafc7d14de 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -350,6 +350,18 @@ Circulation: yes: Allow no: "Don't allow" - suspended holds to be automatically resumed by a set date. + - + - pref: SuspendHoldsIntranet + choices: + yes: Allow + no: "Don't allow" + - holds to be suspended from the intranet. + - + - pref: SuspendHoldsOpac + choices: + yes: Allow + no: "Don't allow" + - holds to be suspended from the OPAC. Fines Policy: - - Calculate fines based on days overdue diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 7c70a53fb7..f327b43716 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -990,6 +990,7 @@ No patron matched [% message %]
+ [% IF SuspendHoldsIntranet %]
@@ -1041,8 +1042,9 @@ No patron matched [% message %]
+ [% END # IF SuspendHoldsIntranet %] - [% ELSE %] +[% ELSE %]

Patron has nothing on hold.

[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 202c9d3322..9033f5c1cb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -646,6 +646,8 @@ function validate1(date) {
+ + [% IF SuspendHoldsIntranet %]
@@ -697,6 +699,7 @@ function validate1(date) {
+ [% END # IF SuspendHoldsIntranet %] [% ELSE %]

Patron has nothing on hold.

[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 959f4cbad7..a48fa70492 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -598,7 +598,7 @@ function checkMultiHold() { Toggle set to lowest priority [% END %]   -   + [% IF SuspendHoldsIntranet %] [% END %] [% FOREACH reserveloo IN biblioloo.reserveloop %] [% UNLESS ( loop.odd ) %][% ELSE %][% END %] @@ -730,6 +730,7 @@ function checkMultiHold() { + [% IF SuspendHoldsIntranet %] [% UNLESS ( reserveloo.wait ) %] @@ -768,6 +769,8 @@ function checkMultiHold() { [% END %] + [% END # IF SuspendHoldsIntranet %] + [% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt index b635aece72..99ceccbcb2 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -421,6 +421,7 @@ $.tablesorter.addParser({ + [% IF SuspendHoldsOpac %]
@@ -472,6 +473,7 @@ $.tablesorter.addParser({
+ [% END %] [% END %] diff --git a/members/moremember.pl b/members/moremember.pl index cc9afb9220..ef8cf64122 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -430,7 +430,9 @@ $template->param( samebranch => $samebranch, quickslip => $quickslip, activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), - AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds') ); + AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), + SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), +); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index ccea21c3d3..50cb5af87b 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -362,7 +362,10 @@ $template->param( ); $template->param( DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar() ); -$template->param( AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds') ); +$template->param( + SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'), + AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds') , +); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/reserve/request.pl b/reserve/request.pl index d9e5904c21..e7191a9e0d 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -633,7 +633,10 @@ if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) { $template->param( reserve_in_future => 1 ); } -$template->param( AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds') ); +$template->param( + SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'), + AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), +); # printout the page output_html_with_http_headers $input, $cookie, $template->output; -- 2.39.5