Bug 9576: can now control whether max loans limit can be overriden

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

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

The new system preference is activated by default, which mean there
will be no change in behaviour on update.

The system preference is correctly added to the database and .pref
files.

Test plan and QA script passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Kyle Hall 2013-02-11 08:27:05 -05:00 committed by Galen Charlton
parent 81431fdc86
commit 835f745b55
5 changed files with 27 additions and 4 deletions

View file

@ -826,9 +826,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;
}
}
}

View file

@ -428,3 +428,4 @@ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) V
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHoldNotes',0,'Show hold notes on OPAC','','YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AcqWarnOnDuplicateInvoice','0','Warn librarians when they try to create a duplicate invoice', '', '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');

View file

@ -7036,7 +7036,6 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion = "3.13.00.012";
if ( CheckVersion($DBversion) ) {
$dbh->do("ALTER TABLE issuingrules MODIFY COLUMN overduefinescap decimal(28,6) DEFAULT NULL;");
@ -7044,6 +7043,13 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion ="3.13.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)

View file

@ -125,6 +125,12 @@ Circulation:
- (separate fields with space, e.g. 100a 200b 300c)
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:

View file

@ -520,6 +520,10 @@ function validate1(date) {
<li>Patron's card is expired</li>
[% END %]
[% IF ( TOO_MANY ) %]
<li>Too many checked out. [% current_loan_count %] checked out, only [% max_loans_allowed %] are allowed.</li>
[% END %]
[% IF ( ITEMNOTSAMEBRANCH ) %]
<li>This item belongs to [% itemhomebranch %] and cannot be issued from this location.</li>
[% END %]