[Koha-patches] [PATCH] Bug 8231: reminder when checking in for a restricted patron

Adrien Saurat adrien.saurat at biblibre.com
Mon Jun 11 15:49:57 CEST 2012


From: Lyon3 Team <koha at univ-lyon3.fr>

If a patron is restricted, a warning will appear on the return
page when checking in.
---
 C4/Circulation.pm                                  |    6 +++++-
 circ/returns.pl                                    |    4 ++++
 .../intranet-tmpl/prog/en/modules/circ/returns.tt  |    3 +++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 9b523e3..74398d6 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -1677,7 +1677,11 @@ sub AddReturn {
         
         # fix fine days
         my $debardate = _FixFineDaysOnReturn( $borrower, $item, $issue->{date_due} );
-        $messages->{'Debarred'} = $debardate if ($debardate);
+        if ($debardate) {
+            $messages->{'Debarred'} = $debardate;
+        } elsif ($borrower->{'debarred'}) {
+            $messages->{'PrevDebarred'} = $borrower->{'debarred'};
+        }
     }
 
     # find reserves.....
diff --git a/circ/returns.pl b/circ/returns.pl
index bd60d42..17b43b2 100755
--- a/circ/returns.pl
+++ b/circ/returns.pl
@@ -46,6 +46,7 @@ use C4::Koha;   # FIXME : is it still useful ?
 use C4::RotatingCollections;
 use Koha::DateUtils;
 use Koha::Calendar;
+use C4::Dates qw/format_date/;
 
 my $query = new CGI;
 
@@ -470,6 +471,9 @@ foreach my $code ( keys %$messages ) {
         $err{debarborrowernumber} = $borrower->{borrowernumber};
         $err{debarname}           = "$borrower->{firstname} $borrower->{surname}";
     }
+    elsif ( $code eq 'PrevDebarred' ) {
+        $err{prevdebarred}        = format_date( $messages->{'PrevDebarred'} );
+    }
     else {
         die "Unknown error code $code";    # note we need all the (empty) elsif's above, or we die.
         # This forces the issue of staying in sync w/ Circulation.pm
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 835724f..fded74c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
@@ -338,6 +338,9 @@ $(document).ready(function () {
                     [% IF ( errmsgloo.debarred ) %]
                         <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber %]">[% errmsgloo.debarname %]([% errmsgloo.debarcardnumber %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %] </p>
                     [% END %]
+                    [% IF ( errmsgloo.prevdebarred ) %]
+                        <p class="problem"><b>REMINDER: </b>Patron is restricted until [% errmsgloo.prevdebarred %]</p>
+                    [% END %]
             [% END %]
 [% IF ( soundon ) %]
 <audio src="/intranet-tmpl/prog/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
-- 
1.7.4.1



More information about the Koha-patches mailing list