From 32e1669731e437ac0e6efc8fee661dea2e52f1f7 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 8 Dec 2011 10:22:07 -0500 Subject: [PATCH] Bug 7337 - "Debarred Until" display in the opac tells patrons they are debarred until the year 9999 This patch copies the debarred handling method from circulation.pl for use on opac-user.pl so that debarred dates and comments can be handled properly. I have slightly reworded the message in the OPAC and on circulation.pl to make the display of the debarred comment a little clearer. Revision adds missing handling of debarred status with regard to renewal operations. Renew links and buttons were not being hidden from debarred users. Signed-off-by: Liz Rea Renewal buttons are gone, message looks good. liz@koha-deb:~/kohaclone$ prove xt xt/permissions.t .. ok xt/tt_valid.t ..... ok All tests successful. Files=2, Tests=27, 9 wallclock secs ( 0.05 usr 0.01 sys + 8.28 cusr 0.08 csys = 8.42 CPU) Result: PASS Signed-off-by: Paul Poulain --- .../prog/en/modules/circ/circulation.tt | 4 ++-- koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 16 ++++++---------- opac/opac-user.pl | 16 ++++++++++++++-- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 56271095e4..e3200ca5dd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -565,12 +565,12 @@ No patron matched [% message %] [% IF ( userdebarred ) %]
  • - Restricted: Patron's account is restricted [% IF (userdebarreddate ) %] until [% userdebarreddate %] [% END %] [% IF (debarredcomment ) %]([% debarredcomment %])[% END %] + Restricted: Patron's account is restricted [% IF (userdebarreddate ) %] until [% userdebarreddate %] [% END %] [% IF (debarredcomment ) %] with the comment "[% debarredcomment %]"[% END %]
    - +
  • [% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt index 0971f4608b..b78fc03265 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -27,7 +27,7 @@ $.tablesorter.addParser({ }); $("#overduest").tablesorter(); [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %] - [% IF ( OpacRenewalAllowed ) %][% IF ( canrenew ) %]$("#renewselected").submit(function(){ + [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]$("#renewselected").submit(function(){ valid = false; $("input[type=checkbox]").each(function(){ if($(this).is(':checked')){ @@ -45,7 +45,7 @@ $.tablesorter.addParser({ $("#renewall_link").live('click',function(){ $("#renewall").submit(); }); - $("#checkoutst caption").append("");[% END %][% END %] + $("#checkoutst caption").append("");[% END %] }); //]]> @@ -92,8 +92,8 @@ $.tablesorter.addParser({ [% IF ( BORROWER_INF.flagged ) %]
      - [% IF ( BORROWER_INF.debarred ) %] -
    • Please note: Your account has been frozen until [% BORROWER_INF.debarred %] - [% BORROWER_INF.debarredcomment %]. Usually the reason for freezing an account is old overdues or damage fees.If your account page shows your account to be clear, please contact the library.
    • + [% IF ( userdebarred ) %] +
    • Please note: Your account has been frozen[% IF ( BORROWER_INF.userdebarreddate ) %] until [% BORROWER_INF.userdebarreddate %][% END %][% IF ( BORROWER_INF.debarredcomment ) %] with the comment "[% BORROWER_INF.debarredcomment %]"[% END %]. Usually the reason for freezing an account is old overdues or damage fees. If your account page shows your account to be clear, please contact the library.
    • [% END %] [% IF ( BORROWER_INF.gonenoaddress ) %]
    • Please note: According to our records, we don't have up-to-date [% UNLESS ( BORROWER_INF.OPACPatronDetails ) %]contact information[% ELSE %]contact information[% END %] on file. Please contact the library[% IF ( BORROWER_INF.OPACPatronDetails ) %] or use the online update form to submit current information (Please note: there may be a delay in restoring your account if you submit online)[% END %].
    • @@ -260,14 +260,11 @@ $.tablesorter.addParser({ [% END %] - [% IF ( canrenew ) %] - [% IF ( OpacRenewalAllowed ) %] + [% IF ( canrenew && !userdebarred && OpacRenewalAllowed ) %] [% END %] - [% END %] - [% IF ( OpacRenewalAllowed ) %] - [% IF ( canrenew ) %] + [% IF ( canrenew && !userdebarred && OpacRenewalAllowed ) %]
      @@ -277,7 +274,6 @@ $.tablesorter.addParser({ [% UNLESS patron_flagged %][% END %]
      [% END %] - [% END %] [% ELSE %] diff --git a/opac/opac-user.pl b/opac/opac-user.pl index e1fe27825f..f6ed484170 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -30,6 +30,7 @@ use C4::Members; use C4::Members::AttributeTypes; use C4::Members::Attributes qw/GetBorrowerAttributeValue/; use C4::Output; +use C4::Overdues qw/CheckBorrowerDebarred/; use C4::Biblio; use C4::Items; use C4::Dates qw/format_date/; @@ -78,7 +79,18 @@ for (qw(dateenrolled dateexpiry dateofbirth)) { } $borr->{'ethnicity'} = fixEthnicity( $borr->{'ethnicity'} ); -if ( $borr->{'debarred'} || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { +my $debar = CheckBorrowerDebarred($borrowernumber); +my $userdebarred; + +if ($debar) { + $userdebarred = 1; + $template->param( 'userdebarred' => $userdebarred ); + if ( $debar ne "9999-12-31" ) { + $borr->{'userdebarreddate'} = C4::Dates::format_date($debar); + } +} + +if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { $borr->{'flagged'} = 1; } @@ -104,7 +116,6 @@ if ( $borr->{'amountoutstanding'} < 0 ) { } $borr->{'amountoutstanding'} = sprintf "%.02f", $borr->{'amountoutstanding'}; -$borr->{'debarred'} = C4::Dates->new($borr->{'debarred'},'iso')->output; my @bordat; $bordat[0] = $borr; @@ -127,6 +138,7 @@ $template->param( BORROWER_INFO => \@bordat, OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0, surname => $borr->{surname}, showname => $borr->{showname}, + ); #get issued items .... -- 2.39.5
      You have nothing checked out