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

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Sat Dec 10 01:05:36 NZDT 2011


From: Owen Leonard <oleonard at myacpl.org>
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
Content-Type: text/plain; charset="utf-8"

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.
---
 .../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 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..b78fc03 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("<div id=\"renewcontrols\"><a id=\"renewselected_link\" href=\"#\">"+_("Renew selected")+"</a> <a id=\"renewall_link\" href=\"#\">"+_("Renew all")+"</a></div>");[% END %][% END %]
+        $("#checkoutst caption").append("<div id=\"renewcontrols\"><a id=\"renewselected_link\" href=\"#\">"+_("Renew selected")+"</a> <a id=\"renewall_link\" href=\"#\">"+_("Renew all")+"</a></div>");[% END %]
             });
 //]]>
 </script>
@@ -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 ( 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>
@@ -260,14 +260,11 @@ $.tablesorter.addParser({
             </tr>
         [% END %]</tbody>
         </table>
-	   [% IF ( canrenew ) %]
-		[% IF ( OpacRenewalAllowed ) %]
+	   [% IF ( canrenew && !userdebarred && OpacRenewalAllowed ) %]
 		<input type="submit" value="Renew Selected" />
 		[% END %]
-        [% END %]
 		</form>
-		[% IF ( OpacRenewalAllowed ) %]
-        [% IF ( canrenew ) %]
+        [% IF ( canrenew && !userdebarred && OpacRenewalAllowed ) %]
 		<form id="renewall" action="/cgi-bin/koha/opac-renew.pl" method="post">
 			<input type="hidden" name="from" value="opac_user" />
 			<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
@@ -277,7 +274,6 @@ $.tablesorter.addParser({
 			[% UNLESS patron_flagged %]<input type="submit" value="Renew All" />[% END %]
 		</form>
 		[% END %]
-        [% END %]
     [% ELSE %]
         <table>
             <tr><td>You have nothing checked out</td></tr>
diff --git a/opac/opac-user.pl b/opac/opac-user.pl
index 9806c9f..b94a05f 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 ....
-- 
1.7.3




More information about the Patches mailing list