From e7a995ed68da442fccded235c705c6e200d69ca3 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 --- 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 f24f2f7..28dc6c2 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 adc2f1e..0faf22a 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'}; -- 1.7.10.4