Bug 13261 - Better check in message for patrons with indefinite restricition
authorMarc Véron <veron@veron.ch>
Sat, 15 Nov 2014 16:14:10 +0000 (17:14 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 20 Nov 2014 00:41:24 +0000 (21:41 -0300)
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 <f.demians@tamil.fr>
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.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Circulation.pm
circ/returns.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt

index f087924..062b165 100644 (file)
@@ -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'};
+                  }
              }
         }
     }
index eeb0fe3..14997a1 100755 (executable)
@@ -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};
     }
index 0872043..b938724 100644 (file)
@@ -440,7 +440,7 @@ $(document).ready(function() {
         [% END %]
 
         [% IF ( USERBLOCKEDNOENDDATE ) %]
-            <li>Patron has a restriction (no expiry date).</li>
+            <li>Patron has an indefinite restriction.</li>
         [% END %]
 
         [% IF ( USERBLOCKEDOVERDUE ) %]
@@ -449,7 +449,7 @@ $(document).ready(function() {
         </ul>
 
         [% IF (forceallow) %]
-            <li>Restriction overridden temporarily</li>
+            <li>Restriction overridden temporarily.</li>
         [% END %]
 
 </div></div>
index 8a12b8b..15f45a1 100644 (file)
@@ -423,6 +423,10 @@ $(document).ready(function () {
                     [% IF ( errmsgloo.prevdebarred ) %]
                         <p class="problem"><b>Reminder: </b>Patron was earlier restricted until [% errmsgloo.prevdebarred | $KohaDates %]</p>
                     [% END %]
+                    [% IF ( errmsgloo.foreverdebarred ) %]
+                        <p class="problem"><b>Reminder: </b>Patron has an indefinite restriction</p>
+                    [% END %]
+
             [% END %]
 [% IF ( soundon ) %]
 <audio src="[% interface %]/[% theme %]/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>