Bug 16112: Add the ability to define due date for batch renew
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>
Mon, 24 Aug 2020 10:10:53 +0000 (12:10 +0200)
Same as bug 16748, for batch renew.

Test plan:
Check an item in
Renew it using the circ/renew.pl page
=> You can pick a due date!
=> The date is kept from one renew to another
Renew it until you reach the maximum number of renewals
=> You get a warning with "continue without renewing"
=> The date is still kept

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

circ/renew.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt

index c3f1d2a..fb51380 100755 (executable)
@@ -48,6 +48,7 @@ $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespae
 $barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
 my $override_limit = $cgi->param('override_limit');
 my $override_holds = $cgi->param('override_holds');
+my $hard_due_date  = $cgi->param('hard_due_date');
 
 my ( $item, $issue, $borrower );
 my $error = q{};
@@ -99,6 +100,9 @@ if ($barcode) {
                     if ( $cgi->param('renewonholdduedate') ) {
                         $date_due = dt_from_string( scalar $cgi->param('renewonholdduedate'));
                     }
+                    if ( C4::Context->preference('SpecifyDueDate') && $hard_due_date ) {
+                        $date_due = dt_from_string( $hard_due_date );
+                    }
                     $date_due = AddRenewal( undef, $item->itemnumber(), $branchcode, $date_due );
                     $template->param( date_due => $date_due );
                 }
@@ -125,6 +129,7 @@ if ($barcode) {
     );
 }
 
+$template->param( hard_due_date => ($hard_due_date ? output_pref({ str => $hard_due_date, dateformat => 'iso' }) : undef) );
 # Checking if there is a Fast Cataloging Framework
 $template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' );
 
index 608ed5c..d9d335e 100644 (file)
                             [% END %]
 
                                 <form method="get" action="/cgi-bin/koha/circ/renew.pl">
+                                    <input type="hidden" name="hard_due_date" value="[% hard_due_date | html %]" />
                                     <button type="submit" class="deny"><i class="fa fa-times"></i> Continue without renewing</button>
                                 </form>
                     </div>
                     <fieldset>
                         <legend>Renew</legend>
 
+                        [% IF Koha.Preference('SpecifyDueDate') %]
+                            <label for="hard_due_date">Hard due date [% INCLUDE 'date-format.inc' %]:</label>
+                            <input type="text" size="20" id="hard_due_date" name="hard_due_date" value="[% hard_due_date | $KohaDates with_hours => 1 %]" />
+                            <br/>
+                        [% END %]
+
                         <label for="barcode">Enter item barcode: </label>
 
                         <input name="barcode" id="barcode" size="14" class="focus" type="text" />
             }).on('change', function(e) {
                 if ( ! is_valid_date( $(this).val() ) ) {$(this).val('');}
             });
+
+            [% IF Koha.Preference('SpecifyDueDate') %]
+                $("#hard_due_date").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>
 [% END %]