Bug 32373: Show patron restriction date
authorMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Wed, 15 Feb 2023 15:48:34 +0000 (15:48 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 31 Mar 2023 10:34:13 +0000 (12:34 +0200)
This is a rebased submission following bug 31095 which removed the use of GetDebarments. This patch now uses $patron->restrictions to find the date and pass it to the template

Test plan:
1) Create a restriction on a patron and navigate to that patron in Checkouts or the patron details page
2) There should be a message with details about the restriction but the creation date of the restriction won't be included in the message
3) Apply patch
4) The message should now say "Restricted since DATE" as in the screenshot attached.
5) Change the 'dateformat' syspref and refresh, the date should change to reflect the syspref

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
circ/circulation.pl
koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc
members/moremember.pl

index 2cd85b6..61065c7 100755 (executable)
@@ -269,6 +269,7 @@ if ($patron) {
         $template->param(
             'userdebarred'    => $patron->debarred,
             'debarredcomment' => $patron->debarredcomment,
+            'debarredsince'   => $patron->restrictions->search()->single->created,
         );
 
         if ( $patron->debarred ne "9999-12-31" ) {
index db9c343..19ba6ce 100644 (file)
@@ -58,7 +58,7 @@
 
         [% IF ( userdebarred ) %]
             <li class="userdebarred blocker">
-                <span class="circ-hlt"> Restricted:</span> Patron's account is restricted
+                <span class="circ-hlt"> Restricted since [% debarredsince | $KohaDates %]:</span> Patron's account is restricted
 
                 [% IF ( userdebarreddate ) %]
                     until [% userdebarreddate | $KohaDates %]
index 767b1a7..bf422d7 100755 (executable)
@@ -87,6 +87,7 @@ if ( $patron->is_debarred ) {
     $template->param(
         'userdebarred'    => $patron->debarred,
         'debarredcomment' => $patron->debarredcomment,
+        'debarredsince'   => $patron->restrictions->search()->single->created,
     );
 
     if ( $patron->debarred ne "9999-12-31" ) {