[Koha-patches] [PATCH] Bug 7337 - "Debarred Until" display in the opac tells patrons they are debarred until the year 9999

Owen Leonard oleonard at myacpl.org
Thu Dec 8 16:24:34 CET 2011


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.
---
 .../prog/en/modules/circ/circulation.tt            |    4 ++--
 koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt   |    4 ++--
 opac/opac-user.pl                                  |   12 ++++++++++--
 3 files changed, 14 insertions(+), 6 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 5627109..e3200ca 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 <span class="ex">[% message %]</span>
 
             [% IF ( userdebarred ) %]
                <li class="blocker">
-               <span class="circ-hlt"> Restricted:</span> Patron's account is restricted [% IF (userdebarreddate ) %] until [% userdebarreddate %] [% END %] [% IF (debarredcomment ) %]([% debarredcomment %])[% END %]
+               <span class="circ-hlt"> Restricted:</span> Patron's account is restricted [% IF (userdebarreddate ) %] until [% userdebarreddate %] [% END %] [% IF (debarredcomment ) %] with the comment "[% debarredcomment %]"[% END %]
                <form class="inline compact" action="/cgi-bin/koha/members/setstatus.pl" method="post">
 	                <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
 	                <input type="hidden" name="destination" value="circ" />
 	                <input type="hidden" name="cardnumber" value="[% cardnumber %]" />
-	                <input type="submit" value="Lift Debarment" />
+	                <input type="submit" value="Lift restriction" />
                </form>
 			</li>[% 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 0971f46..b16936c 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
@@ -92,8 +92,8 @@ $.tablesorter.addParser({
         [% IF ( BORROWER_INF.flagged ) %]
 		<div class="dialog alert">
         <ul>
-            [% IF ( BORROWER_INF.debarred ) %]
-                <li><strong>Please note:</strong> 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 <a href="/cgi-bin/koha/opac-user.pl">your account page</a> shows your account to be clear, please contact the library.</li>
+            [% IF ( BORROWER_INF.userdebarred ) %]
+                <li><strong>Please note:</strong> 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 <a href="/cgi-bin/koha/opac-user.pl">your account page</a> shows your account to be clear, please contact the library.</li>
             [% END %]
             [% IF ( BORROWER_INF.gonenoaddress ) %]
                 <li><strong>Please note:</strong> According to our records, we don't have up-to-date [% UNLESS ( BORROWER_INF.OPACPatronDetails ) %]<a href="/cgi-bin/koha/opac-userupdate.pl">contact information</a>[% ELSE %]contact information[% END %] on file.  Please contact the library[% IF ( BORROWER_INF.OPACPatronDetails ) %] or use the <a href="/cgi-bin/koha/opac-userupdate.pl">online update form</a> to submit current information (<em>Please note:</em> there may be a delay in restoring your account if you submit online)[% END %].</li>
diff --git a/opac/opac-user.pl b/opac/opac-user.pl
index 9806c9f..3b9aa45 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,15 @@ for (qw(dateenrolled dateexpiry dateofbirth)) {
 }
 $borr->{'ethnicity'} = fixEthnicity( $borr->{'ethnicity'} );
 
-if ( $borr->{'debarred'} || $borr->{'gonenoaddress'} || $borr->{'lost'} ) {
+my $debar = CheckBorrowerDebarred($borrowernumber);
+if ($debar) {
+    $borr->{'userdebarred'} = 1;
+    if ( $debar ne "9999-12-31" ) {
+        $borr->{'userdebarreddate'} = C4::Dates::format_date($debar);
+    }
+}
+
+if ( $borr->{'userdebarred'} || $borr->{'gonenoaddress'} || $borr->{'lost'} ) {
     $borr->{'flagged'} = 1;
 }
 
@@ -104,7 +113,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;
-- 
1.7.3



More information about the Koha-patches mailing list