From c7525e707b19a9b203af78f5c943e97bd0b46781 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 22 Dec 2022 15:22:24 +0000 Subject: [PATCH] Bug 32373: Show patron restriction date When viewing a patron account with a restriction there is no way to see when the restriction was placed. This is available in the borrower_debarrments table and has now been added to the UI and matched to the 'dateformat' syspref. (Previous commit missed the moremember.tt render and the syspref formatting - this is now being done with the KohaDates template filter) 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: Lucas Gass --- circ/circulation.pl | 5 ++++- koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc | 2 +- members/moremember.pl | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index b7270bfe56a..894b2a184d2 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -45,7 +45,7 @@ use Koha::AuthorisedValues; use Koha::CsvProfiles; use Koha::Patrons; use Koha::Patron::Debarments qw( GetDebarments ); -use Koha::DateUtils qw( dt_from_string ); +use Koha::DateUtils qw( dt_from_string format_sqldatetime ); use Koha::Patron::Restriction::Types; use Koha::Plugins; use Koha::Database; @@ -265,10 +265,13 @@ if ($patron) { finetotal => $balance, ); + my $debarment = @{ GetDebarments( { borrowernumber => $borrowernumber } ) }[0] || undef; + if ( $patron and $patron->is_debarred ) { $template->param( 'userdebarred' => $patron->debarred, 'debarredcomment' => $patron->debarredcomment, + 'debarredsince' => $debarment->{created} ); if ( $patron->debarred ne "9999-12-31" ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc index db9c3430fcf..19ba6cee807 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -58,7 +58,7 @@ [% IF ( userdebarred ) %]
  • - Restricted: Patron's account is restricted + Restricted since [% debarredsince | $KohaDates %]: Patron's account is restricted [% IF ( userdebarreddate ) %] until [% userdebarreddate | $KohaDates %] diff --git a/members/moremember.pl b/members/moremember.pl index 0523d02831a..38d973c7dcf 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -85,10 +85,12 @@ $template->param( ); if ( $patron->is_debarred ) { + my $debarments = GetDebarments({ borrowernumber => $borrowernumber }); $template->param( - 'debarments' => scalar GetDebarments({ borrowernumber => $borrowernumber }), + 'debarments' => $debarments, 'userdebarred' => $patron->debarred, 'debarredcomment' => $patron->debarredcomment, + 'debarredsince' => @{ $debarments }[0]->{created} ); if ( $patron->debarred ne "9999-12-31" ) { -- 2.30.2