Bug 25771: Allow the user to sort checkouts by the renew column in the OPAC
authorOwen Leonard <oleonard@myacpl.org>
Tue, 16 Jun 2020 13:16:30 +0000 (13:16 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 1 Oct 2020 08:32:15 +0000 (10:32 +0200)
This patch makes it possible for the logged-in OPAC user to sort their
checkouts by the number of renewals they have remaining on their
checkouts.

To test, apply the patch and log in to the OPAC as a user with multiple
checkouts. To fully test the patch's functionality the user's checkouts
should have a varying number of renewals available.

On the "your summary" page, confirm that the "Renew" column is now
sortable and that it sorts correctly by the number of renewals left on
each checked-out item.

Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt

index 22480d1..493a59d 100644 (file)
                                                 [% END %]
                                                     <th>Call no.</th>
                                                 [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
-                                                    <th class="nosort">Renew</th>
+                                                    <th>Renew</th>
                                                 [% END %]
                                                 [% IF ( OPACFinesTab ) %]
                                                     <th>Fines</th>
                                                     [% ISSUE.itemcallnumber | html %]
                                                 </td>
                                                 [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
-                                                    <td class="renew">
-                                                    [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %]
-                                                    [% IF ( ISSUE.status ) %]
-                                                        [% IF ( canrenew ) %]
-                                                            <input type="checkbox" name="item" value="[% ISSUE.itemnumber | uri %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber | uri %]&amp;borrowernumber=[% ISSUE.borrowernumber | uri %]">Renew</a>
-                                                        [% END %]
-                                                        [% IF ISSUE.renewalfee > 0 %]
-                                                            <span class="renewalfee label label-warning">Fee for item type '[% ItemTypes.GetDescription( ISSUE.renewalitemtype) | html %]': [% ISSUE.renewalfee | $Price %]</span>
-                                                        [% END %]
-                                                        [% IF ISSUE.itemtype_object.rentalcharge_daily > 0 %]
-                                                            <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_daily | $Price %] per day</span>
-                                                        [% END %]
-                                                        [% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
-                                                            <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
-                                                        [% END %]
-                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
-                                                    [% ELSIF ( ISSUE.on_reserve ) %]
-                                                        Not renewable <span class="renewals">(on hold)</span>
-                                                    [% ELSIF ( ISSUE.too_many ) %]
-                                                        Not renewable
-                                                    [% ELSIF ( ISSUE.norenew_overdue ) %]
-                                                        Not allowed <span class="renewals">(overdue)</span>
-                                                    [% ELSIF ( ISSUE.auto_too_late ) %]
-                                                        No longer renewable
-                                                    [% ELSIF ISSUE.auto_too_much_oweing %]
-                                                        Automatic renewal failed, you have unpaid fines.
-                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
-                                                    [% ELSIF ISSUE.auto_account_expired %]
-                                                        Automatic renewal failed, your account is expired.
-                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
-                                                    [% ELSIF ( ISSUE.too_soon ) %]
-                                                        No renewal before [% ISSUE.soonestrenewdate | html %]
-                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
-                                                    [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
-                                                        Automatic renewal
-                                                        <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
-                                                    [% ELSIF ( ISSUE.item_denied_renewal ) %]
-                                                        Renewal not allowed
+                                                    [% IF ( ISSUE.status && canrenew ) %]
+                                                        <td class="renew" data-order="[% ISSUE.renewsleft | html %]">
+                                                    [% ELSE %]
+                                                        <td class="renew" data-order="0">
                                                     [% END %]
+                                                        [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %]
+                                                        [% IF ( ISSUE.status ) %]
+                                                            [% IF ( canrenew ) %]
+                                                                <input type="checkbox" name="item" value="[% ISSUE.itemnumber | uri %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber | uri %]&amp;borrowernumber=[% ISSUE.borrowernumber | uri %]">Renew</a>
+                                                            [% END %]
+                                                            [% IF ISSUE.renewalfee > 0 %]
+                                                                <span class="renewalfee label label-warning">Fee for item type '[% ItemTypes.GetDescription( ISSUE.renewalitemtype) | html %]': [% ISSUE.renewalfee | $Price %]</span>
+                                                            [% END %]
+                                                            [% IF ISSUE.itemtype_object.rentalcharge_daily > 0 %]
+                                                                <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_daily | $Price %] per day</span>
+                                                            [% END %]
+                                                            [% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
+                                                                <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
+                                                            [% END %]
+                                                            <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
+                                                        [% ELSIF ( ISSUE.on_reserve ) %]
+                                                            Not renewable <span class="renewals">(on hold)</span>
+                                                        [% ELSIF ( ISSUE.too_many ) %]
+                                                            Not renewable
+                                                        [% ELSIF ( ISSUE.norenew_overdue ) %]
+                                                            Not allowed <span class="renewals">(overdue)</span>
+                                                        [% ELSIF ( ISSUE.auto_too_late ) %]
+                                                            No longer renewable
+                                                        [% ELSIF ISSUE.auto_too_much_oweing %]
+                                                            Automatic renewal failed, you have unpaid fines.
+                                                            <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
+                                                        [% ELSIF ISSUE.auto_account_expired %]
+                                                            Automatic renewal failed, your account is expired.
+                                                            <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
+                                                        [% ELSIF ( ISSUE.too_soon ) %]
+                                                            No renewal before [% ISSUE.soonestrenewdate | html %]
+                                                            <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
+                                                        [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
+                                                            Automatic renewal
+                                                            <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
+                                                        [% ELSIF ( ISSUE.item_denied_renewal ) %]
+                                                            Renewal not allowed
+                                                        [% END %]
                                                     </td>
                                                 [% END %]
                                                 [% IF ( OPACFinesTab ) %]