From 53be161d27ba360778f796091b8383a1f0154f4f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 7 Jul 2011 12:46:58 -0400 Subject: [PATCH] Fix for Bug 6534 - Duplicate opac renew buttons at the top of the checkouts list Content-Type: text/plain; charset="utf-8" This patch uses JS to add two links to the top of the checkouts table: renew selected and renew all. Clicking each one submits the respective form. Also added is a small validation routine to warn the user if they try to "renew selected" without having checked any boxes. --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 21 ++++++++++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 33 ++++++++++++++++++---- koha-tmpl/opac-tmpl/prog/images/check.png | Bin 0 -> 210 bytes koha-tmpl/opac-tmpl/prog/images/checks.png | Bin 0 -> 223 bytes opac/opac-user.pl | 8 ++++- 5 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/images/check.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/checks.png diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index b8a531f..335e091 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -2018,3 +2018,24 @@ div.ft { #opac-isbddetail #isbdcontents { margin-top: 2em; } div.bibmessage { background-color : #ffffb0; border-radius : 5px; padding : 3px; margin : 2px; } + +#renewcontrols { + float: right; + font-size: 66%; +} + +#renewcontrols a { + background-position : 3px center; + background-repeat : no-repeat; + text-decoration:none; + padding : .1em .4em; + padding-left : 18px; +} + +#renewselected_link { + background-image : url(../../images/check.png); +} + +#renewall_link { + background-image : url(../../images/checks.png); +} \ No newline at end of file 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 58c6fa5..d98d4a2 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -5,7 +5,7 @@ [% END %] [% INCLUDE 'doc-head-close.inc' %] - @@ -192,7 +211,7 @@ $.tablesorter.addParser({ [% END %]
[% IF ( issues_count ) %] -
+ @@ -254,7 +273,7 @@ $.tablesorter.addParser({ [% END %] [% IF ( OpacRenewalAllowed ) %] [% UNLESS ( ISSUE.patron_flagged ) %] - @@ -269,14 +288,15 @@ $.tablesorter.addParser({ [% END %]
[% IF ( ISSUE.status ) %]Renew ([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining) + [% IF ( ISSUE.status ) %] Renew ([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining) [% ELSE %] Not renewable[% IF ( ISSUE.too_many ) %] ([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)[% ELSE %][% IF ( ISSUE.on_reserve ) %] (On hold)[% END %][% END %] [% END %]
- + [% IF ( canrenew ) %] [% IF ( OpacRenewalAllowed ) %] [% END %] + [% END %]
[% IF ( OpacRenewalAllowed ) %] - -
+ [% IF ( canrenew ) %] + [% FOREACH ISSUE IN ISSUES %] @@ -285,6 +305,7 @@ $.tablesorter.addParser({ [% UNLESS ( patron_flagged ) %][% END %]
[% END %] + [% END %] [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/prog/images/check.png b/koha-tmpl/opac-tmpl/prog/images/check.png new file mode 100644 index 0000000000000000000000000000000000000000..249805717f1de5b22c8c1f6a7e2ea415da552ea2 GIT binary patch literal 210 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>3?#4ne^UZdEa{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i=?1^9%xns;yg|Nno0&Gg4W5vGzL zzu^B2Pq!O*0eLQ-E{-7;w~`WC7#kRp8ZI+1vZNXs7%;I2Fe@|9ICy|Vz=0=0Prw)` yFoVfZf|03%QHhm>f$<2#b$*~!!Dj|09tLg}2HUjyoo9gNF?hQAxvXoWax8 K&t;ucLK6U@T|m_U literal 0 HcmV?d00001 diff --git a/opac/opac-user.pl b/opac/opac-user.pl index a2f7d9b..3f0d6c4 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -112,6 +112,7 @@ 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 @@ -140,7 +141,10 @@ if ($issues){ # check if item is renewable my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} ); ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'}); - $issue->{'status'} = $status && C4::Context->preference("OpacRenewalAllowed"); + 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'; @@ -179,7 +183,7 @@ if ($issues){ } $template->param( ISSUES => \@issuedat ); $template->param( issues_count => $count ); - +$template->param( canrenew => $canrenew ); $template->param( OVERDUES => \@overdues ); $template->param( overdues_count => $overdues_count ); -- 1.7.3
You have nothing checked out