From 1d86cd513f98e10d5f6e6d1775868bd711e6c84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Sat, 15 Nov 2014 17:14:10 +0100 Subject: [PATCH] Bug 13261 - Better check in message for patrons with indefinite restricition This patch adds a better check in message for patrons with indefinite restriction. To test: Check out an item to a patron. Add a manual restriction without expiry date to that patron. Check in the item. Without patch, the checkin message reads: Reminder: Patron was earlier restricted until 9999-12-31 Apply patch and repeat steps above. The message should now read: Reminder: Patron has a restriction (no expiry date) NOTE: Changed wording at two places following Owen's suggestion. New: "Patron has an indefinite restriction" Signed-off-by: Frederic Demians Thanks Marc for catching this case. I was thinking like you that the wording sounded strange while playing with bug 13242. Merge the original patch and the followup, containing a better wording, thanks to Owen comment. --- C4/Circulation.pm | 14 +++++++++----- circ/returns.pl | 3 +++ .../intranet-tmpl/prog/en/modules/circ/circulation.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt | 4 ++++ 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index f087924..062b165 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1946,11 +1946,15 @@ sub AddReturn { } # there's no overdue on the item but borrower had been previously debarred } elsif ( $issue->{date_due} and $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'}; + if ( $borrower->{debarred} eq "9999-12-31") { + $messages->{'ForeverDebarred'} = $borrower->{'debarred'}; + } else { + 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'}; + } } } } diff --git a/circ/returns.pl b/circ/returns.pl index eeb0fe3..14997a1 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -506,6 +506,9 @@ foreach my $code ( keys %$messages ) { elsif ( $code eq 'PrevDebarred' ) { $err{prevdebarred} = $messages->{'PrevDebarred'}; } + elsif ( $code eq 'ForeverDebarred' ) { + $err{foreverdebarred} = $messages->{'ForeverDebarred'}; + } elsif ( $code eq 'NotForLoanStatusUpdated' ) { $err{NotForLoanStatusUpdated} = $messages->{NotForLoanStatusUpdated}; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 0872043..b938724 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -440,7 +440,7 @@ $(document).ready(function() { [% END %] [% IF ( USERBLOCKEDNOENDDATE ) %] -
  • Patron has a restriction (no expiry date).
  • +
  • Patron has an indefinite restriction.
  • [% END %] [% IF ( USERBLOCKEDOVERDUE ) %] @@ -449,7 +449,7 @@ $(document).ready(function() { [% IF (forceallow) %] -
  • Restriction overridden temporarily
  • +
  • Restriction overridden temporarily.
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 8a12b8b..15f45a1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -423,6 +423,10 @@ $(document).ready(function () { [% IF ( errmsgloo.prevdebarred ) %]

    Reminder: Patron was earlier restricted until [% errmsgloo.prevdebarred | $KohaDates %]

    [% END %] + [% IF ( errmsgloo.foreverdebarred ) %] +

    Reminder: Patron has an indefinite restriction

    + [% END %] + [% END %] [% IF ( soundon ) %] -- 2.1.2