Bug 16748: Add the ability to define due date in batch checkout
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 4 Aug 2020 14:55:56 +0000 (16:55 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 18 Aug 2020 15:39:48 +0000 (17:39 +0200)
This patch allows the librarian to pick the due date when batch checkout

Test plan:
Batch checkout using a hard due date
=> Notice that the due date is taken into account
Batch checkout the same barcodes with a different due date, to trigger the confirmation step
=> Notice that the due date is taken into account for the renewals

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/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt

index 4df661a..8483d57 100644 (file)
@@ -1,6 +1,7 @@
 [% USE raw %]
 [% USE Asset %]
 [% USE Branches %]
+[% USE Koha %]
 [% USE KohaDates %]
 [% USE Price %]
 [% USE AuthorisedValues %]
           </li>
         </ol>
       </fieldset>
+      [% IF Koha.Preference('SpecifyDueDate') %]
+          <fieldset class="rows">
+              <legend>Due date: </legend>
+              <label for="duedatespec">Hard due date [% INCLUDE 'date-format.inc' %]:</label>
+              <input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | $KohaDates with_hours => 1 %]" />
+          </fieldset>
+      [% END %]
       <input type="hidden" name="op" value="show" />
       <fieldset class="action">
         <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
               [% END %]
 
               [% IF checkout_info.issue.date_due %]
-                <li>Due on [% checkout_info.issue.date_due | $KohaDates %]</li>
+                <li>Due on [% checkout_info.issue.date_due | $KohaDates as_due_date => 1 %]</li>
               [% END %]
             </td>
           </tr>
       <input type="hidden" name="issueconfirmed" value="1" />
       <input type="hidden" name="debt_confirmed" value="1" />
       <input type="hidden" name="branch" value="[% branch | html %]" />
+      <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
       <input type="hidden" name="batch" value="1" />
       <input type="submit" id="checkoutrenew" class="approve" value="Checkout or renew" />
         </fieldset>
                 ],
                 "bPaginate": false
             }));
+
+            [% IF Koha.Preference('SpecifyDueDate') %]
+                $("#duedatespec").datetimepicker({
+                    onClose: function(dateText, inst) {
+                        validate_date(dateText, inst);
+                    },
+                    hour: 23,
+                    minute: 59
+                }).on("change", function(e, value) {
+                    if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
+                });
+            [% END %]
         });
+
     </script>
     [% INCLUDE 'str/members-menu.inc' %]
     [% Asset.js("js/members-menu.js") | $raw %]