Bug 8955 [Follow-up] Self checkout should degrade gracefully w/o JavaScript
authorOwen Leonard <oleonard@myacpl.org>
Tue, 6 Nov 2012 16:14:44 +0000 (11:14 -0500)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Sat, 22 Dec 2012 21:33:12 +0000 (16:33 -0500)
This follow-up fixes some instance of unnecessary JavaScript
which I missed the first time around: The renew and check-in
buttons on the list of checkouts. The functionality can be
easily accomplished without JS.

Also corrected:

- Capitalization error
- Miss-named variable causing the "too many checkouts" not
  to be displayed
- Misplaced [% END %] tags hidding "Return to account" button
  on some dialogs.
- Corrected variable scope error which prevented the "return"
  button from appearing.

To test, log into self checkout using an account which has
checkouts. Testing renewing items both by scanning barcodes
and by clicking the "renew" button in the list of checkouts.

Renew something until it reaches its limit and test checking
it out by scanning the barcode. Test the "check in" button.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt

index 066e2c3..729b2f3 100644 (file)
@@ -114,12 +114,12 @@ $(document).ready(function(){
 <div id="bd">
 
 [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
-<div class="dialog alert"><h3>Item cannot be checked out.</h3><p>Sorry, This item cannot be checked out at this station.  </p>
+<div class="dialog alert"><h3>Item cannot be checked out.</h3><p>Sorry, this item cannot be checked out at this station.  </p>
 [% IF ( title ) %]<p>Title: <em>[% title |html %]</em> </p>[% END %]
 <p>
    [% IF ( circ_error_UNKNOWN_BARCODE ) %]
     <em>MESSAGE 1:</em> The system does not recognize this barcode.
-   [% ELSIF ( circ_error_TOO_MANY ) %]
+   [% ELSIF ( circ_error_max_loans_allowed ) %]
     <em>MESSAGE 2:</em> You have checked out too many items and can't check out any more.
    [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
     <em>MESSAGE 3:</em> This item is checked out to someone else.
@@ -158,6 +158,8 @@ $(document).ready(function(){
     <input type="hidden" name="barcode" value="[% barcode %]" />
     <input type="submit" name="returnbook" value="Return this item" class="return" />
 </form>
+[% END %]
+[% END %]
 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
     <input type="hidden" name="op" value="" />
     <input type="hidden" name="patronid" value="[% patronid %]" />
@@ -165,8 +167,6 @@ $(document).ready(function(){
     <input type="submit" name= "confirm" value="Return to account summary" class="back focus" />
 </form>
 [% END %]
-[% END %]
-[% END %]
 [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
 <div class="dialog alert"><h3>Please confirm the checkout:</h3>
 <p>[% IF ( confirm_renew_issue ) %]This item is already checked out to you.[% END %]</p>
@@ -276,19 +276,21 @@ Sorry, this self-checkout station has lost authentication.  Please contact the a
        [% IF ( ISSUE.overdue ) %]<td class="overdue">[% ISSUE.date_due | $KohaDates %]</td>[% ELSE %]<td>[% ISSUE.date_due | $KohaDates %]</td>[% END %]
        <td>
     <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
-    <input type="hidden" name="op" value="checkout" />
     <input type="hidden" name="patronid" value="[% patronid %]" />
     <input type="hidden" name="barcode" value="[% ISSUE.barcode %]" />
-    <input type="hidden" name="confirmed" value=""  />
         [% IF ( ISSUE.norenew ) %]
-          [% IF ( ISSUE.AllowSelfCheckReturns ) %]
-          <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
+          [% IF ( AllowSelfCheckReturns ) %]
+            <input type="submit" value="Check in item" name="confirm" class="return" />
+            <input type="hidden" name="op" value="returnbook" />
+            <input type="hidden" name="confirmed" value=""  />
           [% ELSE %]
-          <span>No renewals allowed</span>
+            <span>No renewals allowed</span>
           [% END %]
         [% ELSE %]
-            [% UNLESS ( ISSUE.renew ) %]<input type="button" value="Renew Item"  name="confirm" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
-            [% ELSE %]<input type="button" value="Renew Item" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />[% END %]
+            <input type="hidden" name="op" value="checkout" />
+            <input type="hidden" name="confirmed" value="1" />
+            [% UNLESS ( ISSUE.renew ) %]<input type="submit" value="Renew item"  name="confirm" class="renew" />
+            [% ELSE %]<input type="submit" value="Renew item" class="renew" />[% END %]
         [% END %]
     </form>
        </td>