Bug 23551: Fix AddRenewal call in circ/renew.pl
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 4 Oct 2019 13:06:27 +0000 (14:06 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 17 Oct 2019 13:40:47 +0000 (14:40 +0100)
Without the patch, renewing from the renewal tab/page
led to wrong renewal/due dates.

To test:
- Check an item out to your patron account
- Renew it from the patron account
- Note the due date
- Return the item
- Check the item out again
- Renew it using the renewal tab
- Verify a different due date was calculated
- Apply patch
- Repeat test - due dates now should be the same

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

circ/renew.pl

index a431a2c..df1e043 100755 (executable)
@@ -95,7 +95,11 @@ if ($barcode) {
                 }
                 if ($can_renew) {
                     my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
-                    my $date_due = AddRenewal( undef, $item->itemnumber(), $branchcode, dt_from_string( scalar $cgi->param('renewonholdduedate')) );
+                    my $date_due;
+                    if ( $cgi->param('renewonholdduedate') ) {
+                        $date_due = dt_from_string( scalar $cgi->param('renewonholdduedate'));
+                    }
+                    $date_due = AddRenewal( undef, $item->itemnumber(), $branchcode, $date_due );
                     $template->param( date_due => $date_due );
                 }
             }