From 568e7c2fe8265cd64ddcf9997d621dc063e9cf79 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 9 Aug 2016 09:49:33 -0400 Subject: [PATCH] Bug 16464 - If a patron has been discharged, show a message in the OPAC MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch adds a message to the patron home page in the OPAC to be shown if the user is restricted because of a discharge. To test, apply the patch and log into the OPAC as a patron who has been discharged. - You should see a message which says so, including a link to the discharge notice. - Log in to the OPAC as a patron with a manual restriction and confirm that the correct notice is displayed. Signed-off-by: Claire Gravely Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit e67fc1806cbcb9fbe038b67ad0862f3f163a4313) Signed-off-by: Frédéric Demians (cherry picked from commit fa4171ce58fe7be54eb404d2e0d06edafb698954) Signed-off-by: Julian Maurice Conflicts: opac/opac-user.pl --- .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 14 ++++++++++---- opac/opac-user.pl | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index a0eec9a10a..7ee619bf18 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -104,10 +104,16 @@ Using this account is not recommended because some parts of Koha will not functi
    [% IF ( userdebarred ) %] -
  • Please note: Your account has been frozen. - [% IF ( BORROWER_INFO.debarredcomment ) %] Comment: "[% BORROWER_INFO.debarredcomment %]"[% END %] - [% IF ( BORROWER_INFO.userdebarreddate ) %] End date: [% BORROWER_INFO.userdebarreddate | $KohaDates %][% END %] - Usually the reason for freezing an account is old overdues or damage fees. If your account shows to be clear, please contact the library. Go to your account page
  • + [% IF ( discharge_available ) %] +
  • + Please note: Your account is frozen because it has been discharged. Get your discharge +
  • + [% ELSE %] +
  • Please note: Your account has been frozen. + [% IF ( BORROWER_INFO.debarredcomment ) %] Comment: "[% BORROWER_INFO.debarredcomment %]"[% END %] + [% IF ( BORROWER_INFO.userdebarreddate ) %] End date: [% BORROWER_INFO.userdebarreddate | $KohaDates %][% END %] + Usually the reason for freezing an account is old overdues or damage fees. If your account shows to be clear, please contact the library. Go to your account page
  • + [% END %] [% END %] [% IF ( BORROWER_INFO.gonenoaddress ) %]
  • Please note: According to our records, we don't have up-to-date contact information. Please contact the library. diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 0d6f089b37..e3caf1aa6d 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -36,6 +36,7 @@ use C4::Letters; use C4::Branch; # GetBranches use Koha::DateUtils; use Koha::Borrower::Debarments qw(IsDebarred); +use Koha::Borrower::Discharge; use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; @@ -96,6 +97,11 @@ if ($debar) { if ( $debar ne "9999-12-31" ) { $borr->{'userdebarreddate'} = $debar; } + my $available = Koha::Borrower::Discharge::count({ + borrowernumber => $borrowernumber, + validated => 1, + }); + $template->param( 'discharge_available' => $available && Koha::Borrower::Discharge::is_discharged({borrowernumber => $borrowernumber}) ); } if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { -- 2.39.5