Bug 23686: Check onsite checkout when the last checkout was an onsite one

Prevent from checking again and again the onsite checkout box when
doing onsite checkouts in batches. If preceding checkout was an onsite
one, the box will be checked.

Test plan:

1. enable  OnSiteCheckouts
2. make your circulation rules able to checkout onsite
3. onsite checkout a document
4. you should return to the checkout page, the box isn't checked
5. apply patch
6. updatedatabase.pl
7. redo steps 3, it should again print a checkout page with an
   unchecked onsite checkout box
8. enable  OnSiteCheckoutAutoCheck system preference
9. redo step 3
10. when returning to the checkout page, the onsite checkout box
    should be already checked

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nicolas Legrand 2019-09-27 10:14:35 +02:00 committed by Martin Renvoize
parent dca51f46aa
commit 059cc81891
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
5 changed files with 23 additions and 1 deletions

View file

@ -148,9 +148,12 @@ my $force_allow_issue = $query->param('forceallow') || 0;
if (!C4::Auth::haspermission( C4::Context->userenv->{id} , { circulate => 'force_checkout' } )) {
$force_allow_issue = 0;
}
my $onsite_checkout = $query->param('onsite_checkout');
if (C4::Context->preference("OnSiteCheckoutAutoCheck") && $onsite_checkout eq "on") {
$template->param(onsite_checkout => $onsite_checkout);
}
my @failedrenews = $query->multi_param('failedrenew'); # expected to be itemnumbers
our %renew_failed = ();
for (@failedrenews) { $renew_failed{$_} = 1; }

View file

@ -0,0 +1,8 @@
$DBversion = 'XXX';
if( CheckVersion( $DBversion ) ) {
$dbh->do(qq{
INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES
('OnSiteCheckoutAutoCheck','0','','onsite Checkout by default if last checkout was an onsite checkout box','YesNo')
});
}

View file

@ -243,6 +243,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('RecordedBooksLibraryID','','','Library ID for RecordedBooks integration','Integer'),
('OnSiteCheckouts','0','','Enable/Disable the on-site checkouts feature','YesNo'),
('OnSiteCheckoutsForce','0','','Enable/Disable the on-site for all cases (Even if a user is debarred, etc.)','YesNo'),
('OnSiteCheckoutAutoCheck','0','','onsite Checkout by default if last checkout was an onsite checkout box','YesNo'),
('INTRAdidyoumean','',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'),
('IntranetBiblioDefaultView','normal','normal|marc|isbd|labeled_marc','Choose the default detail view in the staff interface; choose between normal, labeled_marc, marc or isbd','Choice'),
('intranetbookbag','1','','If ON, enables display of Cart feature in the intranet','YesNo'),

View file

@ -159,6 +159,12 @@ Circulation:
- patrons to submit notes about checked out items.
Checkout Policy:
-
- pref: OnSiteCheckoutAutoCheck
choices:
yes: Enable
no: Don't enable
- onsite checkout by default if last checkout was an onsite one
-
- pref: AutoReturnCheckedOutItems
choices:

View file

@ -600,7 +600,11 @@
<input type="hidden" name="onsite_checkout" checked="checked" value="1" />
</div>
[% ELSE %]
[% IF Koha.Preference('OnSiteCheckoutAutoCheck') && onsite_checkout == "on" %]
<input type="checkbox" id="onsite_checkout" name="onsite_checkout" class="circ_setting" checked="checked" /> <label for="onsite_checkout">On-site checkout</label>
[% ELSE %]
<input type="checkbox" id="onsite_checkout" name="onsite_checkout" class="circ_setting" /> <label for="onsite_checkout">On-site checkout</label>
[% END %]
[% END %]
</div>
[% END %]