From 953d362f3823cfeca3bfa8c74855435d6299308f Mon Sep 17 00:00:00 2001 From: Bouzid Fergani Date: Thu, 15 Dec 2016 12:22:28 -0500 Subject: [PATCH] Bug14784 - Fix checkin message for debarred patrons Hi All, According to my tests, the bug exist always Before apply patch: Scenario 1: 1. Choose one borrower who have not a fines 2. Checkout one document for this borrower(Example : choose return date 10 days after) 3. Add restriction for this borrower (Example : 2 days after checkin). 4. When Checkin in "cgi-bin/koha/circ/returns.pl" this document, you see a message in red : Reminder: Patron was earlier restricted until <......>. Scenario 2: 1. Choose one borrower who have a fines 2. Checkout one document for this borrower 3. Add restriction for this borrower 4. When Checkin in "cgi-bin/koha/circ/returns.pl" this document, you haven't the message: Reminder: Patron was earlier restricted until <......> , just a message of fines. when apply patch, you have the message in all situations when borrower is debarred --- C4/Circulation.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 863b6be..026b0e4 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2010,6 +2010,14 @@ sub AddReturn { if ( $issue->{overdue} && $issue->{date_due} ) { # fix fine days $today = $dropboxdate if $dropbox; + if ($borrower->{debarred}){ + my $borrower_debar_dt = dt_from_string( $borrower->{debarred} ); + $borrower_debar_dt->truncate(to => 'day'); + my $today_dt = $today->clone()->truncate(to => 'day'); + if ( DateTime->compare( $borrower_debar_dt, $today_dt ) != -1 ) { + $messages->{'PrevDebarred'} = $borrower->{'debarred'}; + } + } my ($debardate,$reminder) = _debar_user_on_return( $borrower, $item, $issue->{date_due}, $today ); if ($reminder){ $messages->{'PrevDebarred'} = $debardate; -- 1.9.1