Merge branch 'bug_9052' into 3.12-master
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / sco / sco-main.tt
index 678fe59..3f6438f 100644 (file)
@@ -1,20 +1,29 @@
-[% INCLUDE 'doc-head-open.inc' %][% LibraryName %] &rsaquo; Self Checkout </title>
+[% USE KohaDates %]
+[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] &rsaquo; Self checkout </title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta name="generator" content="Koha [% Version %]" /> <!-- leave this for stats -->
 <link rel="shortcut icon" href="[% themelang %]/includes/favicon.ico" type="image/x-icon" />
+<!-- yui js -->
+<script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script>
+<script type="text/javascript" src="[% yuipath %]/container/container-min.js"></script>
+<script type="text/javascript" src="[% yuipath %]/menu/menu-min.js"></script>
 <script type="text/javascript" src="[% themelang %]/lib/jquery/jquery.js"></script>
+<script type="text/javascript" src="[% themelang %]/lib/jquery/jquery-ui.js"></script>
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
 <script type="text/javascript">//<![CDATA[
-function sco_init(valid_session) {
-    if (valid_session == 1) {
-        setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",[% SelfCheckTimeout %]); 
-    }
+function sco_init() {
+    setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",[% SelfCheckTimeout %]);
 }
 function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
     // alert("dofocus called");
     $(".focus:last").select();
 }
+var slip_re = /slip/;
+function printx_window(print_type) {
+  var handler = print_type.match(slip_re) ? "printslip" : "moremember";
 
+  return false;
+}
 function checkout_confirm(patronid) {
     var   barcode = $("#barcode").val();
     // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
@@ -23,16 +32,38 @@ function checkout_confirm(patronid) {
         window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
         return false;
     }
-    if (this.valid_session == 0) {
-        // probably should force logout like above ? --atz 6/09
-        if (confirm('Session has expired.  Click \'OK\' to continue processing this item.  Click Cancel if you are not ' + patronid)){
-            this.op.value='logout';
-            this.patronid.value='';
-        }
-    }
     return true;
 }
 
+// build Change Language menus
+YAHOO.util.Event.onContentReady("changelanguage", function () {
+  $(".sublangs").each(function(){
+    var menuid = $(this).attr("id");
+    var menuid = menuid.replace("show","");
+
+    var oMenu = new YAHOO.widget.Menu("sub"+menuid, { zindex: 2 });
+    function positionoMenu() {
+      oMenu.align("bl", "tl");
+    }
+    oMenu.subscribe("beforeShow", function () {
+    if (this.getRoot() == this) {
+      positionoMenu();
+    }
+    });
+    oMenu.render();
+    oMenu.cfg.setProperty("context", ["show"+menuid, "bl", "tl"]);
+    function onYahooClick(p_oEvent) {
+      // Position and display the menu
+      positionoMenu();
+      oMenu.show();
+      // Stop propagation and prevent the default "click" behavior
+      YAHOO.util.Event.stopEvent(p_oEvent);
+    }
+    YAHOO.util.Event.addListener("show"+menuid, "click", onYahooClick);
+    YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu);
+  });
+});
+
 $.tablesorter.addParser({
     id: 'articles',
     is: function(s) {return false;  },
@@ -41,9 +72,8 @@ $.tablesorter.addParser({
 });
 
 $(document).ready(function() {
-    [% IF ( patronid ) %] sco_init(1);
-    [% ELSIF ( timedout ) %] sco_init(1);
-    [% END %]
+    dofocus();
+    [% IF ( patronid ) %]sco_init();[% END %]
     $("#loanTable").tablesorter({
         [% IF ( dateformat_metric ) %]
             dateFormat: 'uk',
@@ -58,25 +88,38 @@ $(document).ready(function() {
     });
 });
 //]]>
+$(document).ready(function(){
+    $("#logout_form").submit(function(){
+        if(confirm("Would you like to print a receipt?")){
+            window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber %]&amp;print=qslip");
+        }
+        return true;
+    });
+});
 </script>
+[% IF ( opacuserjs ) %]<script type="text/javascript">[% opacuserjs %]</script>[% END %]
+[% IF ( SCOUserJS ) %]<script type="text/javascript">[% SCOUserJS %]</script>[% END %]
+
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/sco.css" />
+[% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
+[% IF ( SCOUserCSS ) %]<style type="text/css">[% SCOUserCSS %]</style>[% END %]
+
 </head>
 <body onload="dofocus();">
 
 <div id="doc" class="yui-t7">
 
-<div id="masthead"><h1>[% LibraryName %] Self Checkout System</h1></div>
+<div id="masthead"><h1>[% LibraryName %] Self checkout system</h1></div>
 <div id="bd">
-    <div class="yui-g">
 
 [% 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 ) %]
-    <em>MESSAGE 2:</em> You have borrowed too many items and can't check out any more.
+   [% 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.
    [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
@@ -84,13 +127,13 @@ $(document).ready(function() {
    [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
     <em>MESSAGE 5:</em> This item is not for loan.
    [% ELSIF ( circ_error_DEBT ) %]
-    <em>MESSAGE 6:</em> You owe the library [% amount %] and cannot borrow.
+    <em>MESSAGE 6:</em> You owe the library [% amount %] and cannot check out.
    [% ELSIF ( circ_error_WTHDRAWN ) %]
     <em>MESSAGE 7:</em> This item has been withdrawn from the collection.
    [% ELSIF ( circ_error_RESTRICTED ) %]
     <em>MESSAGE 8:</em>
    [% ELSIF ( circ_error_RESERVED ) %]
-    <em>MESSAGE 9:</em> This item is reserved for another patron.
+    <em>MESSAGE 9:</em> This item is on hold for another patron.
    [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
     <em>MESSAGE 10:</em>
    [% ELSIF ( circ_error_EXPIRED ) %]
@@ -106,44 +149,68 @@ $(document).ready(function() {
    [% END %]
    Please see a member of the library staff.
 </p>
-<form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" method="post">
-<input type="hidden" name="op" value="login" />
-<input type="hidden" name="patronid" value="[% patronid %]" />
 [% IF ( returnitem ) %]
 [% IF ( AllowSelfCheckReturns ) %]
-<input type="hidden" name="barcode" value="[% barcode %]" />
-<input type="button" name="returnbook" value="Return this item" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
+<form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
+    <input type="hidden" name="op" value="returnbook" />
+    <input type="hidden" name="patronid" value="[% patronid %]" />
+    <input type="hidden" name="barcode" value="[% barcode %]" />
+    <input type="submit" name="returnbook" value="Return this item" class="return" />
+</form>
 [% END %]
 [% END %]
-<input type="submit" name= "confirm" value="Return to Account Summary" class="back focus" />
+<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 %]" />
+    <input type="hidden" name="barcode" value="[% barcode %]" />
+    <input type="submit" name= "confirm" value="Return to account summary" class="back focus" />
 </form>
 [% 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>
 
-<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" method="post">
-<input type="hidden" name="op" value="checkout" />
-<input type="hidden" name="patronid" value="[% patronid %]" />
-<input type="hidden" name="barcode" value="[% barcode %]" />
-<input type="hidden" name="confirmed" value="" />
 [% IF ( renew ) %]
 [% IF ( AllowSelfCheckReturns ) %]
-<input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
+    <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
+        <input type="hidden" name="op" value="returnbook" />
+        <input type="hidden" name="patronid" value="[% patronid %]" />
+        <input type="hidden" name="barcode" value="[% barcode %]" />
+        <input type="hidden" name="confirmed" value="" />
+        <input type="submit" value="Return item" name="confirm" class="return" />
+    </form>
 [% END %]
 [% END %]
-<input type="button" value="Renew Item" [% UNLESS ( renew ) %] name="confirm"[% END %] class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
-<input type="button" value="Cancel" class="cancel" onclick="this.form.op.value='';this.form.submit();return true;"  />
-</form>
+
+[% UNLESS ( renew ) %]
+    <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
+        <input type="hidden" name="op" value="checkout" />
+        <input type="hidden" name="patronid" value="[% patronid %]" />
+        <input type="hidden" name="barcode" value="[% barcode %]" />
+        <input type="hidden" name="confirmed" value="1" />
+        <input type="submit" value="Renew item" name="confirm" class="renew" />
+      </form>
+[% ELSE %]
+    <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
+        <input type="hidden" name="op" value="checkout" />
+        <input type="hidden" name="patronid" value="[% patronid %]" />
+        <input type="hidden" name="barcode" value="[% barcode %]" />
+        <input type="hidden" name="confirmed" value="1" />
+        <input type="submit" value="Renew item" class="renew" />
+    </form>
+[% END %]
+    <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
+      <input type="hidden" name="op" value="" />
+      <input type="hidden" name="patronid" value="[% patronid %]" />
+      <input type="submit" value="Cancel" class="cancel" />
+    </form>
 </div>
 [% END %]
 
-[% IF ( nopermission ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Access Denied</h3>
-Sorry, This Self-Checkout Station has lost authentication.  Please contact the administrator to resolve this problem. </div>
+[% IF ( nopermission ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Access denied</h3>
+Sorry, this self-checkout station has lost authentication.  Please contact the administrator to resolve this problem. </div>
 [% END %]
-[% IF ( timed_out ) %]<!-- This is what is displayed if login has timed out -->
-<div class="dialog alert"><h3>Session timed out</h3>Sorry, your session has timed out, please log in again.</div>[% END %]
-[% IF ( different_ip ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Session Lost</h3>You are accessing Self-Checkout from a different IP address! please log in again.</div>[% END %]
+[% IF ( different_ip ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Session lost</h3>You are accessing self-checkout from a different IP address! please log in again.</div>[% END %]
 [% IF ( invalid_username_or_password ) %]
 <!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Record not found</h3><p>Your userid was not found in the database.  Please try again.</p></div>[% END %]
 
@@ -151,7 +218,7 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 [% UNLESS ( hide_main ) %]
        <div class="sco_head">
        [% UNLESS ( validuser ) %] 
-       <h3>Self Checkout</h3>
+    <h3>Self checkout</h3>
        [% END %]
 
        <div id="checkouthelp">
@@ -160,70 +227,73 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 
        [% IF ( patronid ) %]
        [% IF ( validuser ) %]
-       <h3 class="warning">You are logged in as [% borrowername %].</h3>
-    [% IF ( display_patron_image ) %]
-        <img src="/cgi-bin/koha/sco/sco-patron-image.pl?cardnumber=[% cardnumber %]" alt="" />
-    [% END %]
+    <h3 class="warning">You are logged in as [% borrowername %].</h3>
        [% END %]
        </div>
        [% IF ( nouser ) %]
-       <div class="error"><h4>Sorry</h4><p>The userid <strong>[% patronid %]</strong> was not found in the database.  Please try again.</p></div>
+       <div class="dialog alert"><h4>Sorry</h4><p>The userid <strong>[% patronid %]</strong> was not found in the database.  Please try again.</p></div>
        <br />
        [% END %]
        [% END %]
 
-       [% IF ( timedout ) %]
-       <div class="error"><h4>Sorry</h4><p>Your session has timed out due to inactivity.  Please sign in.</p></div>
-       <br />
-       [% END %]
        [% IF ( validuser ) %]
+  [% IF ( display_patron_image ) %]<div class="yui-ge"><div class="yui-u first">[% END %]
        <div id="newcheckout" class="sco_entry">
        <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid %]');">
        <fieldset><legend> Check out[% IF ( AllowSelfCheckReturns ) %], return[% END %] or renew an item: </legend>
        <label for="barcode">Scan a new item or enter its barcode:</label>
-       <input id="barcode" name="barcode" size="20" class="focus" />
+    <input id="barcode" name="barcode" size="20" class="focus" autocomplete="off" />
        <input type="hidden" name="op" value="checkout" />
        <input type="hidden" name="patronid" value="[% patronid %]" />
-       <input type="hidden" name="valid_session" value="1" />
        <input type="submit" value="Submit" class="submit" /></fieldset>
        </form>
-       <div><form method="post" action="/cgi-bin/koha/sco/sco-main.pl?op=logout" ><input type="submit" value="Finish" class="finish" /></form></div>
+    <div><form method="post" action="#" id="logout_form"><input type="submit" value="Finish" class="finish" /></form></div>
        </div> <!-- sco_entry --> <!-- newcheckout -->
-
+  [% IF ( display_patron_image ) %]</div> <!-- /yui-u first -->[% END %]
+  [% IF ( display_patron_image ) %]
+  <div class="yui-u">
+        <img src="/cgi-bin/koha/sco/sco-patron-image.pl?cardnumber=[% cardnumber %]" alt="" />
+  </div>
+  [% END %]
+  </div> <!-- /yui-ge -->
+  <div class="yui-g">
        <div id="borrowerdetails">
        [% IF ( issues_count ) %]
        <table id="loanTable"><caption>Checkouts for [% borrowername %] <span class="count">([% issues_count %] total)</span></caption>
        <!-- ISSUES TABLE ROWS -->
     <thead>
-       <tr><th>Title</th><th>Call No.</th><th>Due</th><th>Renew</th>[% UNLESS ( nofines ) %]<th>Fines</th>[% END %]</tr>
+        <tr><th>Title</th><th>Call no.</th><th>Due</th><th>Renew</th>[% UNLESS ( nofines ) %]<th>Fines</th>[% END %]</tr>
     </thead>
 
     <tbody>
        [% FOREACH ISSUE IN ISSUES %]
        [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
     <!-- FIXME: yet another jacket image breakpoint -->
-       <td>[% IF ( ISSUE.amazonimages ) %] [% IF ( ISSUE.isbn ) %]<a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.biblionumber |url %]"><img src="http://images.amazon.com/images/P/[% ISSUE.isbn %].01.THUMBZZZ.jpg" alt="Book Cover Image" class="thumbnail" /></a>[% END %] [% END %][% UNLESS ( ISSUE.noitemlinks ) %]<a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.biblionumber %]">[% ISSUE.title |html %]</a>[% ELSE %]<strong>[% ISSUE.title |html %]</strong>[% END %]<span class="item-details">
+       <td>[% UNLESS ( ISSUE.noitemlinks ) %]<a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.biblionumber %]">[% ISSUE.title |html %]</a>[% ELSE %]<strong>[% ISSUE.title |html %]</strong>[% END %]<span class="item-details">
        [% ISSUE.author %]</span> ([% ISSUE.barcode %])</td>
-       <td>[% DEFAULT ISSUE.itemcallnumber="&nbsp;" %]</td>
-       [% IF ( ISSUE.overdue ) %]<td class="overdue">[% ISSUE.date_due_display %]</td>[% ELSE %]<td>[% ISSUE.date_due_display %]</td>[% END %]
+       <td>[% ISSUE.itemcallnumber %]</td>
+       [% 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="[% ISSUE.patronid %]" />
+    <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 %]
-        <input type="button" value="Renew Item" [% UNLESS ( ISSUE.renew ) %] name="confirm"[% END %] class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
+            <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>
-       [% UNLESS ( ISSUE.nofines ) %]<td>[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>[% END %]</tr>
+       [% UNLESS ( nofines ) %]<td>[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>[% END %]</tr>
        [% END %]
     </tbody>
 
@@ -231,7 +301,7 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
        [% ELSE %]
        <h3>You currently have nothing checked out.</h3>
        [% END %]
-
+</div> <!-- /yui-g -->
        [% ELSE %]<!-- not validuser -->
        <div class="sco_entry" >
        <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
@@ -244,7 +314,7 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
        <input type="password" id="patronpw" size="20" name="patronpw" />
        [% ELSE %]
        <fieldset class="checkout"><label for="patronid">Please enter your card number:</label> 
-       <input type="text" id="patronid" class="focus" size="20" name="patronid" />
+    <input type="text" id="patronid" class="focus" size="20" name="patronid" autocomplete="off" />
        [% END %]
 
        [% FOREACH INPUT IN INPUTS %]<input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]">[% END %]
@@ -255,6 +325,5 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 [% END %] <!-- ( / hide main) -->      
        
        </div>
-       </div>
 </div>
 [% INCLUDE 'opac-bottom.inc' %]