Bug 2965: Allow due date in the past
[koha_gimpoz] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / circulation.tmpl
index 7515dee..fc27cfa 100644 (file)
@@ -5,20 +5,20 @@
 (<!-- TMPL_VAR NAME="cardnumber" -->)
 <!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
+<!-- TMPL_IF NAME="UseTablesortForCirc" --><script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script><!-- /TMPL_IF -->
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
 <script type="text/javascript">
 //<![CDATA[
-$.tablesorter.addParser({
+<!-- TMPL_IF NAME="UseTablesortForCirc" -->$.tablesorter.addParser({
     id: 'articles',
     is: function(s) {return false;  },
     format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
     type: 'text'
-});
+});<!-- /TMPL_IF -->
 <!-- TMPL_UNLESS NAME="borrowernumber" --><!-- TMPL_UNLESS NAME="CGIselectborrower" -->window.onload=function(){ $('#findborrower').focus(); };<!-- /TMPL_UNLESS --><!-- /TMPL_UNLESS -->
         $(document).ready(function() {
                $('#patronlists > ul').tabs();
-               $.tablesorter.defaults.widgets = ['zebra'];
+               <!-- TMPL_IF NAME="UseTablesortForCirc" -->$.tablesorter.defaults.widgets = ['zebra'];
                $("#issuest").tablesorter({<!-- TMPL_IF NAME="dateformat_metric" -->
                dateFormat: 'uk',<!-- /TMPL_IF -->
                headers: { 1: { sorter: 'articles' },5: { sorter: false },6:{sorter:false},7:{sorter:false},8:{sorter:false}}
@@ -30,8 +30,7 @@ $.tablesorter.addParser({
                dateFormat: 'uk',<!-- /TMPL_IF -->
                        sortList: [[0,0]],
                        headers: { 1: { sorter: 'articles' }}
-               });
-
+               });<!-- /TMPL_IF -->
         <!-- TMPL_IF NAME="AllowRenewalLimitOverride" -->
         $( '#override_limit' ).click( function () {
             if ( this.checked ) {
@@ -47,10 +46,6 @@ var allcheckboxes = $(".checkboxed");
                $(allcheckboxes).checkCheckboxes(":input[name*=items]"); 
                $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]");
        });
-       $("#return_all").click(function(){
-               $(allcheckboxes).checkCheckboxes(":input[name*=barcodes]");
-               $(allcheckboxes).unCheckCheckboxes(":input[name*=items]");
-       });
        $("#CheckAllitems").click(function(){
                $(allcheckboxes).checkCheckboxes(":input[name*=items]");
                $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false;
@@ -77,18 +72,28 @@ var allcheckboxes = $(".checkboxed");
     } ).attr( 'checked', false );
     <!-- /TMPL_IF -->
     <!-- /TMPL_IF -->
+    // Clicking the table cell checks the checkbox inside it
        $("td").click(function(e){
                if(e.target.tagName.toLowerCase() == 'td'){
-           $(this).find("input:checkbox").each( function() {
-               $(this).attr('checked', !$(this).attr('checked'));
-                          if($(this).attr('checked')){
-                    $(this).parent().siblings().find("input:checkbox").each(function(){
-                       if($(this).attr('checked')){ $(this).attr('checked',''); }
-                   });
-                          }
+           $(this).find("input:checkbox:visible").each( function() {
+                if($(this).attr("checked")){
+                    $(this).attr("checked",'');
+                } else {
+                    $(this).attr("checked","checked");
+                    radioCheckBox($(this));
+                }
            });
-               }
+        }
        });
+    // prevent adjacent checkboxes from being checked simultaneously
+    function radioCheckBox(box){
+            box.parents("td").siblings().find("input:checkbox:visible").each(function(){
+                if($(this).attr("checked")){
+                    $(this).attr("checked",'');
+                }
+             });
+     }
+
        $("#messages ul").after("<a href=\"#\" id=\"addmessage\">"+_("Add a new message")+"</a>");
        $("#borrower_messages .cancel").click(function(){
                $("#add_message_form").hide();
@@ -98,30 +103,12 @@ var allcheckboxes = $(".checkboxed");
         $(this).hide();
                $("#add_message_form").show();
         });
+
+     $("input.radio").click(function(){
+        radioCheckBox($(this));
+     });
  });
-function uncheck_sibling(me){
-nodename=me.getAttribute("name");
-if (nodename =="barcodes[]"){
-    var Node=me.parentNode.previousSibling;
-    while (Node.nodeName!="TD"){Node=Node.previousSibling}
-    var Nodes=Node.childNodes;
-    for (var i=0;i<Nodes.length;i++){
-      if (Nodes[i].nodeName=="INPUT" && Nodes[i].getAttribute("type")=="checkbox"){
-        Nodes[i].checked=false;
-      }     
-   }   
-
-}else {
-    var Node=me.parentNode.nextSibling;
-    while (Node.nodeName!="TD"){Node=Node.nextSibling}
-    var Nodes=Node.childNodes;
-    for (var i=0;i<Nodes.length;i++){
-      if (Nodes[i].nodeName=="INPUT" && Nodes[i].getAttribute("type")=="checkbox"){
-        Nodes[i].checked=false;
-      }     
-   }   
-}
-}
+
 function validate1(date) {
     var today = new Date();
     if ( date < today ) {
@@ -180,7 +167,7 @@ function refocus(calendar) {
     </li>
     <!-- TMPL_IF NAME="canned_bor_notes_loop" -->
         <li>
-                <label for="canned_notes">Predefined notes: </label>
+                <label for="type">Predefined notes: </label>
                 <select name="type" id="type" onchange="this.form.borrower_message.value=this.options[this.selectedIndex].value;">
                     <option value="">Select Note</option>
                     <!-- TMPL_LOOP NAME="canned_bor_notes_loop" -->
@@ -197,7 +184,7 @@ function refocus(calendar) {
         <input type="submit" value="Save" /> <a href="#" class="cancel">Cancel</a>
     </fieldset>
 
-        <input type="hidden" name="borrowernumber" id="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
+        <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
         <input type="hidden" name="branchcode" value="<!-- TMPL_VAR NAME="branch" -->" />
 </fieldset>
 </form>
@@ -224,7 +211,7 @@ function refocus(calendar) {
 <!-- /TMPL_IF -->
 
 <!-- TMPL_IF NAME="RESERVED" -->
-    <li>Item is on reserve for <!-- TMPL_VAR NAME="RESERVED" --></li>
+    <li>Item is on hold for <!-- TMPL_VAR NAME="RESERVED" --></li>
 <!-- /TMPL_IF -->
 
 <!-- TMPL_IF NAME="ISSUED_TO_ANOTHER" -->
@@ -235,6 +222,10 @@ function refocus(calendar) {
     <li>Too many checked out (already checked out / max : <!-- TMPL_VAR name="TOO_MANY" -->)</li>
 <!-- /TMPL_IF -->
 
+<!-- TMPL_IF NAME="BORRNOTSAMEBRANCH" -->
+    <li>This patrons is from a different library (<!-- TMPL_VAR NAME="BORRNOTSAMEBRANCH" -->)</li>
+<!-- /TMPL_IF -->
+
 <!-- TMPL_IF NAME="PATRON_CANT" -->
     <li>This patron can't check out this item per library circulation policy</i>
 <!-- /TMPL_IF -->
@@ -252,14 +243,14 @@ function refocus(calendar) {
 <!-- TMPL_IF NAME="RESERVED" -->
     <p>
     <input type="checkbox" id="cancelreserve" name="cancelreserve" value="1" />
-    <label for="cancelreserve">Cancel Reserve</label>
+    <label for="cancelreserve">Cancel hold</label>
     </p>
 <!-- /TMPL_IF -->
 
 <!-- TMPL_IF NAME="RESERVE_WAITING" -->
     <p>
     <input type="checkbox" id="cancelreserve" name="cancelreserve" value="1" />
-    <label for="cancelreserve">Cancel Reserve</label>
+    <label for="cancelreserve">Cancel hold</label>
     </p>
 <!-- /TMPL_IF -->
 
@@ -267,7 +258,14 @@ function refocus(calendar) {
     <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
     <input type="hidden" name="issueconfirmed" value="1" />
     <!-- TMPL_IF NAME="DEBT" --><input type="hidden" name="debt_confirmed" value="1" /><!-- /TMPL_IF -->
+    <!-- TMPL_IF NAME="INVALID_DATE" -->
+    <p>
+    <input type="text" size="10" id="duedatespec" name="duedatespec" value="<!-- TMPL_VAR NAME="duedatespec" -->" />
+    <label for="duedatespec">Due Date</label>
+    </p>
+    <!-- TMPL_ELSE -->
     <input type="hidden" name="duedatespec" value="<!-- TMPL_VAR NAME="duedatespec" -->" />
+    <!-- /TMPL_IF -->
     <input type="hidden" name="stickyduedate" value="<!-- TMPL_VAR NAME="stickyduedate" -->" />
     <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
     <input type="submit" class="approve" value="Yes, Check Out (Y)" accesskey="y" />
@@ -302,7 +300,7 @@ function refocus(calendar) {
         <!-- /TMPL_IF -->
 
         <!-- TMPL_IF NAME="UNKNOWN_BARCODE" -->
-            <li>The barcode was not found</li>
+            <li>The barcode was not found <!-- TMPL_VAR NAME="barcode" --></li>
         <!-- /TMPL_IF -->
 
         <!-- TMPL_IF NAME="NOT_FOR_LOAN" -->
@@ -337,7 +335,7 @@ function refocus(calendar) {
             <li>Patron's card is expired</li>
         <!-- /TMPL_IF -->
 
-        <!-- TMPL_IF NAME="NOTSAMEBRANCH" -->
+        <!-- TMPL_IF NAME="ITEMNOTSAMEBRANCH" -->
             <li>This item belongs to <!-- TMPL_VAR NAME="itemhomebranch" --> and cannot be issued from this location.</li>
         <!-- /TMPL_IF -->
 
@@ -417,7 +415,12 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
     <label for="barcode">Checking out to <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->) </label>
        <div class="hint">Enter item barcode:</div>
 
-       <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" <!-- TMPL_IF NAME="NEEDSCONFIRMATION" -->disabled="disabled"<!-- /TMPL_IF -->/> <input type="submit" value="Check Out" />
+    <!-- TMPL_IF NAME="NEEDSCONFIRMATION" -->
+           <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" disabled="disabled" />
+    <!-- TMPL_ELSE -->
+           <!-- TMPL_IF NAME="barcode" -->><input type="text" name="barcode" id="barcode" class="barcode focus" size="14" value="<!-- TMPL_VAR NAME="barcode" -->"/><!-- TMPL_ELSE --><input type="text" name="barcode" id="barcode" class="barcode focus" size="14" /><!-- /TMPL_IF -->
+    <!-- /TMPL_IF -->
+    <input type="submit" value="Check Out" />
 
     <!-- TMPL_IF NAME="SpecifyDueDate" --><div class="date-select">
         <div class="hint">Specify Due Date <!-- TMPL_INCLUDE NAME="date-format.inc" -->: </div>
@@ -444,8 +447,8 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
                              inputField : "duedatespec",
                              ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
                              button : "CalendarDueDate",
-                             disableFunc : validate1,
-                             dateStatusFunc : validate1,
+//                           disableFunc : validate1,
+//                           dateStatusFunc : validate1,
                              onClose : refocus
                            }
                         );
@@ -637,36 +640,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
         <th scope="col">Check in <p class="column-tool"><a href="#" id="CheckAllreturns">select all</a> | <a href="#" id="CheckNoreturns">none</a></p></th>
     </tr>
 <!-- TMPL_IF NAME="todayissues" --></thead>
-<tfoot>
-               <tr>
-            <td colspan="5" style="text-align: right; font-weight:bold;">Totals:</td>
-                       <td><!-- TMPL_VAR NAME="totaldue" --></td>
-            <td><!-- TMPL_VAR NAME="totalprice" --></td>
-            <td colspan="2">      
-                <p>
-                    Renewal due date: <input type="text" size="8" id="newduedate" name="newduedate" value="<!-- TMPL_VAR Name="newduedate" -->" />
-                    <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="newduedate_button" alt="Show Calendar" />
- <script type="text/javascript"> //<![CDATA[
-                               //#TODO - ADD syspref (AllowPostDatedCheckouts).
-                     Calendar.setup(
-                          {
-                             inputField : "newduedate",
-                             ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
-                             button : "newduedate_button",
-                             disableFunc : validate1,
-                             dateStatusFunc : validate1,
-                             onClose : refocus
-                           }
-                        );
-                               //]]>
-                                </script>
-                </p>
-                <p>
-                    <label>Forgive fines on return: <input type="checkbox" name="exemptfine" value="1" /></label>
-                </p>
-            </td>
-        </tr>
-               </tfoot>
+<!-- TMPL_INCLUDE NAME="checkouts-table-footer.inc" -->
        <tbody>
 
     <!-- TMPL_LOOP NAME="todayissues" -->
@@ -685,21 +659,21 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
       <!-- TMPL_IF NAME="renew_failed" -->
             <td class="problem">Renewal Failed</td>
       <!-- TMPL_ELSE -->
-        <td><span style="padding: 0 1em;"><!-- TMPL_VAR NAME="renewals" --></span>
+        <td><span style="padding: 0 1em;"><!-- TMPL_IF NAME="renewals" --><!-- TMPL_VAR NAME="renewals" --><!-- TMPL_ELSE -->0<!-- /TMPL_IF --></span>
         <!-- TMPL_IF NAME="can_renew" -->
         <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
         <!-- TMPL_IF NAME="od" -->
-            <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
+            <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
         <!-- TMPL_ELSE -->
-            <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
+            <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
         <!-- /TMPL_IF -->
         <!-- TMPL_ELSE -->
             <!-- TMPL_IF NAME="can_confirm" --><span class="renewals-allowed" style="display: none">
                 <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
                 <!-- TMPL_IF NAME="od" -->
-                    <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
+                    <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
                 <!-- TMPL_ELSE -->
-                    <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
+                    <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
                 <!-- /TMPL_IF -->
                 </span>
                 <span class="renewals-disabled">
@@ -719,7 +693,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
   <!-- TMPL_IF NAME="return_failed" -->
             <td class="problem">Checkin Failed</td>
       <!--TMPL_ELSE-->
-            <td><input type="checkbox" name="barcodes[]"  value="<!-- TMPL_VAR NAME="barcode" -->" onclick="uncheck_sibling(this);" />
+            <td><input type="checkbox" class="radio" name="barcodes[]"  value="<!-- TMPL_VAR NAME="barcode" -->" />
                 <input type="checkbox" name="all_barcodes[]" value="<!-- TMPL_VAR NAME="barcode" -->" checked="checked" style="display: none;" />
             </td>
       <!-- /TMPL_IF -->
@@ -729,6 +703,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
 <!-- TMPL_IF NAME="previssues" -->
 <!-- TMPL_IF NAME="todayissues" --><tr><th colspan="10"><a name="previous" id="previous"></a>Previous checkouts</th></tr><!-- TMPL_ELSE -->
 <tr><th class="{sorter: false}" colspan="10"><a name="previous" id="previous"></a>Previous checkouts</th></tr></thead>
+<!-- TMPL_INCLUDE NAME="checkouts-table-footer.inc" -->
        <tbody>
 <!-- /TMPL_IF -->
     <!-- TMPL_LOOP NAME="previssues" -->
@@ -755,17 +730,17 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
         <!-- TMPL_IF NAME="can_renew" -->
         <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
         <!-- TMPL_IF NAME="od" -->
-            <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
+            <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
         <!-- TMPL_ELSE -->
-            <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
+            <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
         <!-- /TMPL_IF -->
         <!-- TMPL_ELSE -->
             <!-- TMPL_IF NAME="can_confirm" --><span class="renewals-allowed" style="display: none">
                 <input type="checkbox" name="all_items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" style="display: none;" />
                 <!-- TMPL_IF NAME="od" -->
-                    <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
+                    <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" checked="checked" />
                 <!-- TMPL_ELSE -->
-                    <input type="checkbox" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
+                    <input type="checkbox" class="radio" name="items[]" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
                 <!-- /TMPL_IF -->
                 </span>
                 <span class="renewals-disabled">
@@ -785,7 +760,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
                  <!-- TMPL_IF NAME="return_failed" -->
             <td class="problem">Checkin Failed</td>
         <!--TMPL_ELSE-->
-            <td><input type="checkbox" name="barcodes[]"  value="<!-- TMPL_VAR NAME="barcode" -->" onclick="uncheck_sibling(this);" />
+            <td><input type="checkbox" class="radio" name="barcodes[]"  value="<!-- TMPL_VAR NAME="barcode" -->" />
                 <input type="checkbox" name="all_barcodes[]" value="<!-- TMPL_VAR NAME="barcode" -->" checked="checked" style="display: none;" />
             </td>
       <!-- /TMPL_IF -->
@@ -804,7 +779,6 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
         <!-- /TMPL_IF -->
         <input type="submit" name="renew_checked" value="Renew or Return checked items" />
         <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
-        <input type="submit" id="return_all" name="return_all" value="Return all" />
         </fieldset>
     <!-- /TMPL_IF -->
 </form>
@@ -839,7 +813,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
                         <!-- TMPL_IF name="transfered" --> <strong>in transit</strong> from
                         <!-- TMPL_VAR NAME="frombranch" --> since <!-- TMPL_VAR NAME="datesent" -->
                         <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="nottransfered" --> hasn't been transfered yet from <!-- TMPL_VAR NAME="nottransferedby" --></i>
+                        <!-- TMPL_IF name="nottransfered" --> hasn't been transferred yet from <!-- TMPL_VAR NAME="nottransferedby" --></i>
                         <!-- /TMPL_IF --></em></td>
                     <td>
                         <!-- TMPL_IF NAME="waitingposition" --><b> <!-- TMPL_VAR NAME="waitingposition" --> </b><!-- /TMPL_IF -->
@@ -850,6 +824,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
                 </select>
                 <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->" />
                 <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR name="borrowernumber" -->" />
+                <input type="hidden" name="reservenumber" value="<!-- TMPL_VAR name="reservenumber" -->" />
             </td>
             </tr>
         <!-- /TMPL_LOOP --></tbody>