From c1621de8a503d5505d0bd697a4b64eacf50c095d Mon Sep 17 00:00:00 2001 From: Lyon3 Team Date: Fri, 5 Dec 2014 09:27:02 +0100 Subject: [PATCH] Bug 12895 repair dropbox mode One day late patrons were restricted even with dropbox mode activated 1) Check in the calendar (Tools/Calendar), that the previous days you are about to use as date due are really entered as opening day (never know). 2) Add a suspension in the suspension days parameter of the circulation rules (Administration/Circulation and fine rules) to the MOST specific category of borrower and MOST specific type of document among the existing rules of the LOGGED IN Site(cf explications in the circ-rules page). 3) Choose a borrower using the search by category and an item through the advanced search using the limit by type. 4) Checkout the item selecting the previous opening date in the Specify-due-date box. 5) Click on Circulation in the upper menu, then on Checkin and check the Book drop mode. The Book drop date showed should be the previous opening date. 6) Check in the item : you can see that the patron is restricted 7) apply the patch 8) Redo 1 to 5 : Now, you can see that the patron is not restricted. 9) If you redo the test with two day late, you will see that the patron is not restricted : that's ok because his restriction of one day is already finished. 10) If you redo the test with more than two day late, you see that the patron restriction is, as expected, one day shorter than it were if the item had been returned without dropbox mode. Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- C4/Circulation.pm | 5 +++-- circ/returns.pl | 14 +++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 5f7e866b33..5cd8ba3129 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1736,7 +1736,7 @@ patron who last borrowed the book. =cut sub AddReturn { - my ( $barcode, $branch, $exemptfine, $dropbox, $return_date ) = @_; + my ( $barcode, $branch, $exemptfine, $dropbox, $return_date, $dropboxdate ) = @_; if ($branch and not GetBranchDetail($branch)) { warn "AddReturn error: branch '$branch' not found. Reverting to " . C4::Context->userenv->{'branch'}; @@ -1851,7 +1851,7 @@ sub AddReturn { # FIXME: check issuedate > returndate, factoring in holidays #$circControlBranch = _GetCircControlBranch($item,$borrower) unless ( $item->{'issuedate'} eq C4::Dates->today('iso') );; $circControlBranch = _GetCircControlBranch($item,$borrower); - $issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $today ) == -1 ? 1 : 0; + $issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $dropboxdate ) == -1 ? 1 : 0; } if ($borrowernumber) { @@ -1950,6 +1950,7 @@ sub AddReturn { if ( $issue->{overdue} && $issue->{date_due} ) { # fix fine days + $today = $dropboxdate if $dropbox; my ($debardate,$reminder) = _debar_user_on_return( $borrower, $item, $issue->{date_due}, $today ); if ($reminder){ $messages->{'PrevDebarred'} = $debardate; diff --git a/circ/returns.pl b/circ/returns.pl index adc2f1ed61..0faf22ab06 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -241,7 +241,7 @@ if ($barcode) { # save the return # ( $returned, $messages, $issueinformation, $borrower ) = - AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $return_date_override ); + AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $return_date_override, $dropboxdate ); my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn'); $homeorholdingbranchreturn ||= 'homebranch'; @@ -287,7 +287,11 @@ if ($barcode) { $riduedate{0} = $duedate; $input{borrowernumber} = $borrower->{'borrowernumber'}; $input{duedate} = $duedate; - $input{return_overdue} = 1 if (DateTime->compare($issueinformation->{date_due}, $time_now) == -1); + unless ( $dropboxmode ) { + $input{return_overdue} = 1 if (DateTime->compare($issueinformation->{date_due}, DateTime->now()) == -1); + } else { + $input{return_overdue} = 1 if (DateTime->compare($issueinformation->{date_due}, $dropboxdate) == -1); + } push( @inputloop, \%input ); if ( C4::Context->preference("FineNotifyAtCheckin") ) { @@ -533,7 +537,11 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { $ri{minute} = $duedate->minute(); $ri{duedate} = output_pref($duedate); my ($b) = GetMemberDetails( $riborrowernumber{$_}, 0 ); - $ri{return_overdue} = 1 if (DateTime->compare($duedate, DateTime->now()) == -1 ); + unless ( $dropboxmode ) { + $ri{return_overdue} = 1 if (DateTime->compare($duedate, DateTime->now()) == -1); + } else { + $ri{return_overdue} = 1 if (DateTime->compare($duedate, $dropboxdate) == -1); + } $ri{borrowernumber} = $b->{'borrowernumber'}; $ri{borcnum} = $b->{'cardnumber'}; $ri{borfirstname} = $b->{'firstname'}; -- 2.39.5