Bug 32431: Display expiry date on SIP checkout when patron is expired
authorMatthias Meusburger <matthias.meusburger@biblibre.com>
Thu, 8 Dec 2022 14:10:18 +0000 (14:10 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 30 Jan 2023 18:07:37 +0000 (15:07 -0300)
Test plan:

 - Set up an expired patron
 - Do a SIP checkout
 - Check that the message is "Patron expired"
 - Apply the patch
 - Check that the message is "Patron expired on <correctly_formatted_date>"
 - Prove t//db_dependent/SIP/Transaction.t

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
C4/SIP/ILS.pm
t/db_dependent/SIP/Transaction.t

index ff9ee74..bebeaf6 100644 (file)
@@ -7,6 +7,7 @@ package C4::SIP::ILS;
 use warnings;
 use strict;
 use C4::SIP::Sip qw( siplog );
+use Koha::DateUtils qw( dt_from_string output_pref );
 use Data::Dumper;
 
 use C4::SIP::ILS::Item;
@@ -137,7 +138,7 @@ sub checkout {
         if ($patron->debarred) {
             $circ->screen_msg("Patron debarred");
         } elsif ($patron->expired) {
-            $circ->screen_msg("Patron expired");
+            $circ->screen_msg("Patron expired on " . output_pref({ dt => dt_from_string( $patron->dateexpiry_iso, 'iso' ), dateonly => 1 }));
         } elsif ($patron->fine_blocked) {
             $circ->screen_msg("Patron has fines");
         } else {
index e1e15cc..ffabc83 100755 (executable)
@@ -466,12 +466,12 @@ subtest do_checkout_with_patron_blocked => sub {
             class => 'Koha::Patrons',
             value => {
                 branchcode => $library->branchcode,
-                dateexpiry => '2020/01/01',
+                dateexpiry => '2020/01/03',
             }
         }
     );
     my $circ = $ils->checkout($expired_patron->cardnumber, $item->barcode);
-    is( $circ->{screen_msg}, 'Patron expired', "Got correct expired screen message" );
+    is( $circ->{screen_msg}, 'Patron expired on 01/03/2020', "Got correct expired screen message" );
 
     my $fines_patron = $builder->build_object(
         {