Bug 6739: (follow-up) fix more issues
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 15 Jan 2014 10:08:48 +0000 (11:08 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 5 May 2014 01:51:56 +0000 (01:51 +0000)
* Hide renewal column, buttons and links
* Fixes minor bug where upper-right table links would show even if
  renewal impossible
* Cleans up some of the template formatting ( whitespace changes only )

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
opac/opac-user.pl

index 882a9ba..c8f0a3a 100644 (file)
@@ -11,8 +11,9 @@ var MSG_CONFIRM_DELETE_HOLD   = _("Are you sure you want to cancel this hold?");
 var MSG_CONFIRM_SUSPEND_HOLDS = _("Are you sure you want to suspend all holds?");
 var MSG_CONFIRM_RESUME_HOLDS  = _("Are you sure you want to resume all suspended holds?");
 
-            $(function() {
-            $('#opac-user-views').tabs();
+    $(document).ready(function(){
+
+        $('#opac-user-views').tabs();
 
         var dTables = $("#checkoutst,#holdst,#overduest");
         dTables.each(function(){
@@ -27,8 +28,10 @@ var MSG_CONFIRM_RESUME_HOLDS  = _("Are you sure you want to resume all suspended
             }));
         });
 
-[% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
-        [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]$("#renewselected").submit(function(){
+    [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
+
+    [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
+        $("#renewselected").submit(function(){
             valid = false;
             $("input[type=checkbox]").each(function(){
                 if($(this).is(':checked')){
@@ -46,9 +49,14 @@ var MSG_CONFIRM_RESUME_HOLDS  = _("Are you sure you want to resume all suspended
         $("body").on("click","#renewall_link",function(){
             $("#renewall").submit();
         });
-        $("#checkoutst caption").append("<div id=\"renewcontrols\"><a id=\"renewselected_link\" href=\"#\">"+_("Renew selected")+"</a> <a id=\"renewall_link\" href=\"#\">"+_("Renew all")+"</a></div>");[% END %]
-        $( ".suspend-until" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future
-            });
+        [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
+            $("#checkoutst caption").append("<div id=\"renewcontrols\"><a id=\"renewselected_link\" href=\"#\">"+_("Renew selected")+"</a> <a id=\"renewall_link\" href=\"#\">"+_("Renew all")+"</a></div>");
+        [% END %]
+    [% END %]
+
+    $( ".suspend-until" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future
+
+    });
 //]]>
 </script>
 </head>
@@ -105,7 +113,7 @@ var MSG_CONFIRM_RESUME_HOLDS  = _("Are you sure you want to resume all suspended
                 <string>Please note:</string>
                 <span>
                     Your account renewal failed because of the following:
-                    [% FOREACH error IN RENEW_ERROR.split('|') %]
+                    [% FOREACH error IN RENEW_ERROR.split('\|') %]
                         [% IF error == 'card_expired' %]
                             Your account has expired. Please contact the library for more information.
                         [% ELSIF error == 'too_many' %]
@@ -165,7 +173,7 @@ var MSG_CONFIRM_RESUME_HOLDS  = _("Are you sure you want to resume all suspended
         [% UNLESS ( item_level_itypes ) %]<th>Item type</th> [% END %]
         [% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
         <th>Call No.</th>
-        [% IF ( OpacRenewalAllowed ) %]
+        [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
         <th class="nosort">Renew</th>
         [% END %]
 [% IF ( OPACFinesTab ) %]
@@ -213,7 +221,7 @@ var MSG_CONFIRM_RESUME_HOLDS  = _("Are you sure you want to resume all suspended
                 [% UNLESS ( item_level_itypes ) %]<td class="itype">[% IF ( ISSUE.imageurl ) %]<img src="[% ISSUE.imageurl %]" title="[% ISSUE.description %]" alt="[% ISSUE.description %]" />[% END %] [% ISSUE.description %]</td>[% END %]
                 [% IF ( show_barcode ) %]<td class="barcode">[% ISSUE.barcode %]</td>[% END %]
                 <td class="call_no">[% ISSUE.itemcallnumber %]</td>
-                [% IF ( OpacRenewalAllowed ) %]
+                [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
                     <td class="renew">
                     [% IF ( ISSUE.status ) %]
                         [% IF ( canrenew ) %]
@@ -239,11 +247,11 @@ var MSG_CONFIRM_RESUME_HOLDS  = _("Are you sure you want to resume all suspended
             </tr>
         [% END %]</tbody>
         </table>
-       [% IF ( canrenew && !userdebarred && OpacRenewalAllowed ) %]
-        <input type="submit" value="Renew selected" />
+        [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
+        <input type="submit" value="Renew Selected" />
         [% END %]
         </form>
-        [% IF ( canrenew && !userdebarred && OpacRenewalAllowed ) %]
+        [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
         <form id="renewall" action="/cgi-bin/koha/opac-renew.pl" method="post">
             <input type="hidden" name="from" value="opac_user" />
             <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
index 935850e..9deada5 100755 (executable)
@@ -144,6 +144,7 @@ $template->param(   BORROWER_INFO     => \@bordat,
                     surname           => $borr->{surname},
                     showname          => $borr->{showname},
                     RENEW_ERROR       => $renew_error,
+                    borrower          => $borr,
                 );
 
 #get issued items ....