From 7c9ce796749c9fd08bd7699d930282c525d7e9f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Tue, 15 Dec 2015 00:11:01 +0100 Subject: [PATCH] Bug 15775 - User should know when they are blocked from checkouts on OPAC When a user has been blocked from checkouts in the staff client for having too many fines, they will now see a message about this in the OPAC To test: - This patch will be easiest to test if you keep three tabs open - system preferences, a patron detail page, and OPAC summary page - Set some system preferences: - OPACFineNoRenewals = 2 - noissuescharge = 4 - OpacRenewalAllowed = Allow - Set up a patron with fines of $3 - Log in to the OPAC and verify the message from patch from Bug 15374, saying the user cannot renew books. Confirm link to accounts page works. - Set OpacRenewalAllowed = Don't allow - Refresh OPAC Summary and confirm the message disappears - Set OpacRenewalAllowed = Allow - Give the patron total fines of $5 (add $2) - Refresh OPAC Summary and verify message appears saying user is BLOCKED from checkouts. Confirm link to accounts page works - Set OpacRenewalAllowed = Don't allow - Refresh OPAC Summary and confirm message is still there Sponsored-by: Catalyst IT --- .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 33 +++++++++++++------- opac/opac-user.pl | 17 ++++++++-- 2 files changed, 36 insertions(+), 14 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 3a8b016..00fc0fe 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -1,5 +1,6 @@ [% USE Koha %] [% USE KohaDates %] +[% USE Price %] [% INCLUDE 'doc-head-open.inc' %] [% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your library home @@ -32,7 +33,7 @@ [% FOREACH bor_messages_loo IN bor_messages_loop %]
  • [% bor_messages_loo.message %]
    -    Written on [% bor_messages_loo.message_date | $KohaDates %] by [% bor_messages_loo.branchname %] + [% bor_messages_loo.message_date | $KohaDates %] [% bor_messages_loo.branchname %]
  • [% END %] @@ -89,16 +90,26 @@
    @@ -113,9 +124,9 @@ [% IF relatives %]
  • Relatives' checkouts
  • [% END %] [% IF ( overdues_count ) %]
  • Overdue ([% overdues_count %])
  • [% END %] [% IF ( OPACFinesTab ) %] - [% IF ( BORROWER_INFO.amountoverfive ) %]
  • Fines ([% BORROWER_INFO.amountoutstanding %])
  • [% END %] - [% IF ( BORROWER_INFO.amountoverzero ) %]
  • Fines ([% BORROWER_INFO.amountoutstanding %])
  • [% END %] - [% IF ( BORROWER_INFO.amountlessthanzero ) %]
  • Credits ([% BORROWER_INFO.amountoutstanding %])
  • [% END %] + [% IF ( BORROWER_INFO.amountoverfive ) %]
  • Fines ([% BORROWER_INFO.amountoutstanding | $Price %])
  • [% END %] + [% IF ( BORROWER_INFO.amountoverzero ) %]
  • Fines ([% BORROWER_INFO.amountoutstanding | $Price %])
  • [% END %] + [% IF ( BORROWER_INFO.amountlessthanzero ) %]
  • Credits ([% BORROWER_INFO.amountoutstanding | $Price %])
  • [% END %] [% END %] [% IF ( RESERVES.count ) %]
  • Holds ([% RESERVES.count %])
  • [% END %] @@ -298,7 +309,7 @@ You currently owe fines and charges amounting to: - [% BORROWER_INFO.amountoutstanding %] + [% BORROWER_INFO.amountoutstanding | $Price %] @@ -325,7 +336,7 @@ Amount - You have a credit of:[% BORROWER_INFO.amountoutstanding %] + You have a credit of:[% BORROWER_INFO.amountoutstanding | $Price %] diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 9d1f9b2..3bb9961 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -113,8 +113,18 @@ if ( C4::Context->preference( 'OpacRenewalAllowed' ) && $borr->{amountoutstandi $borr->{'flagged'} = 1; $canrenew = 0; $template->param( - renewal_blocked_fines => sprintf( '%.02f', $no_renewal_amt ), - renewal_blocked_fines_amountoutstanding => sprintf( '%.02f', $borr->{amountoutstanding} ), + renewal_blocked_fines => $no_renewal_amt, + renewal_blocked_fines_amountoutstanding => $borr->{amountoutstanding}, + ); +} + +my $checkoutsblockedamount = C4::Context->preference( 'noissuescharge' ); +$checkoutsblockedamount ||=0; +if ( C4::Context->preference( 'noissuescharge' ) && $borr->{amountoutstanding} > $checkoutsblockedamount ) { + $borr->{'flagged'} = 1; + $canrenew = 0; + $template->param( + checkouts_blocked_amount => sprintf ( '%.02f', $checkoutsblockedamount ), ); } @@ -123,7 +133,8 @@ if ( $borr->{'amountoutstanding'} < 0 ) { $borr->{'amountoutstanding'} = -1 * ( $borr->{'amountoutstanding'} ); } -$borr->{'amountoutstanding'} = sprintf "%.02f", $borr->{'amountoutstanding'}; +my @bordat; +$bordat[0] = $borr; # Warningdate is the date that the warning starts appearing if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) { -- 1.7.10.4