From 7093f075a77b0c33545466301fc58ad02808ae1b 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 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. Signed-off-by: Alex Arnaud Signed-off-by: Ian Walls Signed-off-by: Chris Cormack --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 21 ++++++++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 39 +++++++++++++++++------ 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, 56 insertions(+), 12 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 b8a531f1d9..335e091b03 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 be67c8a420..9d7a2a7f6b 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -6,7 +6,7 @@ [% INCLUDE 'doc-head-close.inc' %] - @@ -155,7 +174,7 @@ $.tablesorter.addParser({ [% END %]
[% IF ( issues_count ) %] -
+ @@ -217,7 +236,7 @@ $.tablesorter.addParser({ [% IF ( OpacRenewalAllowed ) %] [% UNLESS patron_flagged %] - @@ -232,16 +251,15 @@ $.tablesorter.addParser({ [% END %]
[% ISSUE.itemcallnumber %][% 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 OpacRenewalAllowed %] - [% UNLESS patron_flagged %] - - [% END %] + [% IF ( canrenew ) %] + [% IF ( OpacRenewalAllowed ) %] + + [% END %] [% END %]
[% IF ( OpacRenewalAllowed ) %] - -
+ [% IF ( canrenew ) %] + [% FOREACH ISSUE IN ISSUES %] @@ -250,6 +268,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 97574b1939..e99e557656 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -114,6 +114,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 @@ -142,7 +143,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'; @@ -181,7 +185,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 ); -- 2.11.0
You have nothing checked out