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 <wizzyrea@gmail.com>
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 <paul.poulain@biblibre.com>
This commit is contained in:
Owen Leonard 2011-12-08 10:22:07 -05:00 committed by Paul Poulain
parent 45cb5959ca
commit 32e1669731
3 changed files with 22 additions and 14 deletions

View File

@ -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 %]

View File

@ -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>

View File

@ -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 ....