This patch standardizes the condition under which renewal controls
are displayed at the page (as opposed to item) level. In some
places "canrenew" was used, in others "patron_flagged" was used.
Now "canrenew" controls renew controls and "patron_flagged" only
triggers the display of user warnings.
This patch also allows for renewal information to be displayed
for each item in situations where OPAC renewals are allowed but
disabled for whatever reason. This gives the patron information
about used/available renew counts but hides renew controls.
---
koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 27 ++++++++++-----------
opac/opac-user.pl | 6 ++--
2 files changed, 16 insertions(+), 17 deletions(-)
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 9ba6c05..5a2bb61 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
@@ -58,7 +58,6 @@ $.tablesorter.addParser({
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<div id="userdetails" class="container">
-
[% IF ( bor_messages ) %]
<div class="dialog message">
<h3>Messages For You</h3>
@@ -80,7 +79,7 @@ $.tablesorter.addParser({
[% IF ( patronupdate ) %]<div class="dialog message"><h3>Thank
you!</h3><p>Your corrections have been submitted to the library, and a staff
member will update your record as soon as possible.</p></div>[% END %]
- [% IF ( BORROWER_INF.flagged ) %]
+ [% IF ( patron_flagged ) %]
<div class="dialog alert">
<ul>
[% IF ( BORROWER_INF.debarred ) %]
@@ -187,7 +186,7 @@ $.tablesorter.addParser({
[% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
<th>Call No.</th>
[% IF ( OpacRenewalAllowed ) %]
- [% UNLESS patron_flagged %]<th class="{sorter: false}">Renew</th>[%
END %]
+ <th class="{sorter: false}">Renew</th>
[% END %]
[% IF ( OPACFinesTab ) %]
<th>Fines</th>
@@ -235,12 +234,10 @@ $.tablesorter.addParser({
[% IF ( show_barcode ) %]<td>[% ISSUE.barcode %]</td>[% END %]
<td>[% ISSUE.itemcallnumber %]</td>
[% IF ( OpacRenewalAllowed ) %]
- [% UNLESS patron_flagged %]
- <td>[% IF ( ISSUE.status ) %]<input type="checkbox"
name="item" value="[% ISSUE.itemnumber %]"/> <a
href="/cgi-bin/koha/opac-renew.pl?from=opac_user&item=[% ISSUE.itemnumber
%]&borrowernumber=[% ISSUE.borrowernumber %]">Renew</a> <span
class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals
remaining)</span>
+ <td>[% IF ( ISSUE.status ) %][% IF ( canrenew ) %]<input
type="checkbox" name="item" value="[% ISSUE.itemnumber %]"/> <a
href="/cgi-bin/koha/opac-renew.pl?from=opac_user&item=[% ISSUE.itemnumber
%]&borrowernumber=[% ISSUE.borrowernumber %]">Renew</a>[% END %] <span
class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals
remaining)</span>
[% ELSE %]
Not renewable[% IF ( ISSUE.too_many ) %] <span
class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals
remaining)</span>[% ELSE %][% IF ( ISSUE.on_reserve ) %] <span
class="renewals">(On hold)</span>[% END %][% END %]
[% END %]</td>
- [% END %]
[% END %]
[% IF ( OPACFinesTab ) %]
<td>[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>
@@ -253,8 +250,10 @@ $.tablesorter.addParser({
</table>
[% IF ( canrenew ) %]
[% IF ( OpacRenewalAllowed ) %]
- <input type="submit" value="Renew Selected" />
- [% END %]
+ [% IF ( canrenew ) %]
+ <input type="submit" value="Renew Selected" />
+ [% END %]
+ [% END %]
[% END %]
</form>
[% IF ( OpacRenewalAllowed ) %]
@@ -265,7 +264,7 @@ $.tablesorter.addParser({
[% FOREACH ISSUE IN ISSUES %]
<input type="hidden" name="item" value="[%
ISSUE.itemnumber %]" />
[% END %]
- [% UNLESS patron_flagged %]<input type="submit"
value="Renew All" />[% END %]
+ <input type="submit" value="Renew All" />
</form>
[% END %]
[% END %]
@@ -288,7 +287,8 @@ $.tablesorter.addParser({
<th>Call No.</th>
<th>Due</th>
[% IF ( OpacRenewalAllowed ) %]
- [% UNLESS patron_flagged %]<th class="{sorter:
false}">Renew</th>[% END %][% END %]
+ <th class="{sorter: false}">Renew</th>
+[% END %]
[% IF ( OPACFinesTab ) %]
<th>Fines</th>
[% END %]
@@ -320,15 +320,14 @@ $.tablesorter.addParser({
<td>[% OVERDUE.itemcallnumber %]</td>
<td>[% OVERDUE.date_due %]</td>
[% IF ( OpacRenewalAllowed ) %]
- [% UNLESS patron_flagged %]
<td>
[% IF ( OVERDUE.debarred ) %]Account Frozen
[% ELSIF ( OVERDUE.status ) %]
-<a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&item=[%
OVERDUE.itemnumber %]&bornum=[% OVERDUE.borrowernumber %]">Renew</a> <span
class="renewals">([% OVERDUE.renewsleft %] of [% OVERDUE.renewsallowed %]
renewals remaining)</span>
-[% ELSIF ( OVERDUE.onreserve ) %]On Reserve
+[% IF ( canrenew ) %]<a
href="/cgi-bin/koha/opac-renew.pl?from=opac_user&item=[% OVERDUE.itemnumber
%]&bornum=[% OVERDUE.borrowernumber %]">Renew</a>[% END %] <span
class="renewals">([% OVERDUE.renewsleft %] of [% OVERDUE.renewsallowed %]
renewals remaining)</span>
+[% ELSIF ( OVERDUE.onreserve ) %]On hold
[% ELSE %]No renewals left
[% END %]
-</td>[% END %][% END %]
+</td>[% END %]
[% IF ( OPACFinesTab ) %]
<td>[% IF ( OVERDUE.charges ) %]Yes[% ELSE %]No[% END %]</td>
[% END %]
diff --git a/opac/opac-user.pl b/opac/opac-user.pl
index e99e557..ddfa071 100755
--- a/opac/opac-user.pl
+++ b/opac/opac-user.pl
@@ -60,6 +60,7 @@ my ( $template, $borrowernumber, $cookie ) =
get_template_and_user(
my $OPACDisplayRequestPriority =
(C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0;
my $patronupdate = $query->param('patronupdate');
+my $canrenew = 1;
# get borrower information ....
my ( $borr ) = GetMemberDetails( $borrowernumber );
@@ -71,6 +72,7 @@ $borr->{'ethnicity'} = fixEthnicity( $borr->{'ethnicity'} );
if ( $borr->{'debarred'} || $borr->{'gonenoaddress'} || $borr->{'lost'} ) {
$borr->{'flagged'} = 1;
+ $canrenew = 0;
}
if ( $borr->{'amountoutstanding'} > 5 ) {
@@ -84,6 +86,7 @@ $no_renewal_amt ||= 0;
if ( $borr->{amountoutstanding} > $no_renewal_amt ) {
$borr->{'flagged'} = 1;
+ $canrenew = 0;
$template->param(
renewal_blocked_fines => sprintf( '%.02f', $no_renewal_amt ),
);
@@ -108,13 +111,11 @@ $template->param( BORROWER_INFO => \@bordat,
#get issued items ....
my $count = 0;
-my $toggle = 0;
my $overdues_count = 0;
my @overdues;
my @issuedat;
my $itemtypes = GetItemTypes();
my ($issues) = GetPendingIssues($borrowernumber);
-my $canrenew = 0;
if ($issues){
foreach my $issue ( sort { $b->{'date_due'} cmp $a->{'date_due'} }
@$issues ) {
# check for reserves
@@ -145,7 +146,6 @@ if ($issues){
($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) =
GetRenewCount($borrowernumber, $issue->{'itemnumber'});
if($status && C4::Context->preference("OpacRenewalAllowed")){
$issue->{'status'} = $status;
- $canrenew = 1;
}
$issue->{'too_many'} = 1 if $renewerror and $renewerror eq
'too_many';
$issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq
'on_reserve';
--
1.7.3
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/