Bug 7413: OPAC bootstrap theme changes
authorHolger Meißner <h.meissner.82@web.de>
Fri, 14 Feb 2014 08:11:19 +0000 (09:11 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 7 Apr 2014 18:28:57 +0000 (18:28 +0000)
This patch makes opac-user.pl and the bootstrap version of opac-user.tt
handle the new renewal error "too_soon".

To test:
1) Set global syspref "opacthemes" to bootstrap.
2) Set global syspref "OpacRenewalAllowed" to Allow.
3) Test the same things as in previous patch, this time for the OPAC
    summary page.

Sponsored-by: Hochschule für Gesundheit (hsg), Germany
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
opac/opac-user.pl

index b4a337f..8fb30c1 100644 (file)
                                                 </td>
                                                 [% IF ( OpacRenewalAllowed ) %]
                                                     <td class="renew">
-                                                        [% IF ( ISSUE.status ) %]
-                                                            [% IF ( canrenew ) %]
-                                                                <input type="checkbox" name="item" value="[% ISSUE.itemnumber %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber %]&amp;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 %]
+                                                    [% IF ( ISSUE.status ) %]
+                                                        [% IF ( canrenew ) %]
+                                                            <input type="checkbox" name="item" value="[% ISSUE.itemnumber %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber %]&amp;borrowernumber=[% ISSUE.borrowernumber %]">Renew</a>
                                                         [% END %]
+                                                        <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
+                                                    [% ELSIF ( ISSUE.too_many ) %]
+                                                        Not renewable
+                                                    [% ELSIF ( ISSUE.too_soon ) %]
+                                                        No renewal before [% ISSUE.soonestrenewdate %]
+                                                        <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
+                                                    [% ELSIF ( ISSUE.on_reserve ) %]
+                                                        <span class="renewals">(On hold)</span>
+                                                    [% END %]
                                                     </td>
                                                 [% END %]
                                                 [% IF ( OPACFinesTab ) %]
index 02002a3..7ca64bd 100755 (executable)
@@ -182,8 +182,21 @@ if ($issues){
         if($status && C4::Context->preference("OpacRenewalAllowed")){
             $issue->{'status'} = $status;
         }
-        $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
-        $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
+
+        if ($renewerror) {
+            $issue->{'too_many'}   = 1 if $renewerror eq 'too_many';
+            $issue->{'on_reserve'} = 1 if $renewerror eq 'on_reserve';
+
+            if ( $renewerror eq 'too_soon' ) {
+                $issue->{'too_soon'}         = 1;
+                $issue->{'soonestrenewdate'} = output_pref(
+                    C4::Circulation::GetSoonestRenewDate(
+                        $issue->{borrowernumber},
+                        $issue->{itemnumber}
+                    )
+                );
+            }
+        }
 
         if ( $issue->{'overdue'} ) {
             push @overdues, $issue;