From 5aa40b90a76c61fc3dcee62b6ea6d578cbe1f200 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 14 Nov 2014 17:15:57 +0100 Subject: [PATCH] Bug 13255: On-site checkout due date wrong if SpecifyDueDate is disabled If you have the SpecifyDueDate preference disabled and check something out as an on-site checkout the due date seems to follow the default circulation rule rather than restricted the checkout to that day. Test plan: 0/ Disable SpecifyDueDate and enable OnSiteCheckouts 1/ Check an item out to a patron and check the 'On-site checkout' checkbox 2/ Verify (screen and DB) that the due date is correct (today 23:59) Signed-off-by: Mirko Tietgen Signed-off-by: Katrin Fischer Works as described, passes tests and QA script. Signed-off-by: Tomas Cohen Arazi --- circ/circulation.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index bd7f821395..6e9f449292 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -104,6 +104,8 @@ if (!C4::Auth::haspermission( C4::Context->userenv->{id} , { circulate => 'force $force_allow_issue = 0; } +my $onsite_checkout = $query->param('onsite_checkout'); + my @failedrenews = $query->param('failedrenew'); # expected to be itemnumbers our %renew_failed = (); for (@failedrenews) { $renew_failed{$_} = 1; } @@ -158,7 +160,10 @@ else { my ($datedue,$invalidduedate); my $duedatespec_allow = C4::Context->preference('SpecifyDueDate'); -if($duedatespec_allow){ +if( $onsite_checkout ) { + $datedue = output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' }); + $datedue .= ' 23:59:00'; +} elsif( $duedatespec_allow ) { if ($duedatespec) { if ($duedatespec =~ C4::Dates->regexp('syspref')) { $datedue = dt_from_string($duedatespec); @@ -336,7 +341,7 @@ if ($barcode) { } } - unless( $query->param('onsite_checkout') and C4::Context->preference("OnSiteCheckoutsForce") ) { + unless( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) { delete $question->{'DEBT'} if ($debt_confirmed); foreach my $impossible ( keys %$error ) { $template->param( @@ -361,13 +366,12 @@ if ($barcode) { getTitleMessageIteminfo => $getmessageiteminfo->{'title'}, getBarcodeMessageIteminfo => $getmessageiteminfo->{'barcode'}, NEEDSCONFIRMATION => 1, - onsite_checkout => $query->param('onsite_checkout'), + onsite_checkout => $onsite_checkout, ); $confirm_required = 1; } } unless($confirm_required) { - my $onsite_checkout = $query->param('onsite_checkout'); AddIssue( $borrower, $barcode, $datedue, $cancelreserve, undef, undef, { onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew') } ); $session->clear('auto_renew'); $inprocess = 1; -- 2.39.5