From 8f51e974ed4b24c791d438116517a84ead594001 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 11 Feb 2013 08:27:05 -0500 Subject: [PATCH] Bug 9576 - Enable or disable issue limit confirmation Adds a new system preference AllowTooManyOverride to control whether a librarian can override the 'Too many checked out' message which is currently always overridable. Test Plan: 1) Apply patch 2) Run updatedatabase.pl 3) Attempt to check out 1 more item to a patron than the max issues 4) You should be allowed to override by default ( current behavior ) 5) Set AllowTooManyOverride to "Don't allow" 6) Repeat step 3 7) You should be blocked from being able to issue the item --- C4/Circulation.pm | 12 +++++++++--- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/admin/preferences/circulation.pref | 6 ++++++ .../intranet-tmpl/prog/en/modules/circ/circulation.tt | 4 ++++ 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index abd4981..1cef8d0 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -822,9 +822,15 @@ sub CanBookBeIssued { $needsconfirmation{PATRON_CANT} = 1; } else { if($max_loans_allowed){ - $needsconfirmation{TOO_MANY} = 1; - $needsconfirmation{current_loan_count} = $current_loan_count; - $needsconfirmation{max_loans_allowed} = $max_loans_allowed; + if ( C4::Context->preference("AllowTooManyOverride") ) { + $needsconfirmation{TOO_MANY} = 1; + $needsconfirmation{current_loan_count} = $current_loan_count; + $needsconfirmation{max_loans_allowed} = $max_loans_allowed; + } else { + $issuingimpossible{TOO_MANY} = 1; + $issuingimpossible{current_loan_count} = $current_loan_count; + $issuingimpossible{max_loans_allowed} = $max_loans_allowed; + } } } diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index e3966ce..23814f2 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -421,3 +421,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES( INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('PatronSelfRegistrationAdditionalInstructions','','A free text field to display additional instructions to newly self registered patrons.','','free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '0', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('FinesIncludeGracePeriod','1','If enabled, fines calculations will include the grace period.',NULL,'YesNo'); +INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('AllowTooManyOverride', '1', 'If on, allow staff to override and check out items when the patron has reached the maximum number of allowed checkouts', '', 'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index f0a9269..42e040c 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6532,6 +6532,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion ="3.11.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('AllowTooManyOverride', '1', 'If on, allow staff to override and check out items when the patron has reached the maximum number of allowed checkouts', '', 'YesNo');"); + print "Upgrade to $DBversion done (Bug 9576 - Enable or disable issue limit confirmation)\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 f88d964..16d45c0 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 @@ -126,6 +126,12 @@ Circulation: Checkout Policy: - + - pref: AllowTooManyOverride + choices: + yes: Allow + no: "Don't allow" + - staff to override and check out items when the patron has reached the maximum number of allowed checkouts. + - - pref: AllowNotForLoanOverride choices: yes: Allow 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 39548f8..1a0e06f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -489,6 +489,10 @@ function validate1(date) {
  • Patron's card is expired
  • [% END %] + [% IF ( TOO_MANY ) %] +
  • Too many checked out. [% current_loan_count %] checked out, only [% max_loans_allowed %] are allowed.
  • + [% END %] + [% IF ( ITEMNOTSAMEBRANCH ) %]
  • This item belongs to [% itemhomebranch %] and cannot be issued from this location.
  • [% END %] -- 1.7.10.4