From 97b43e633d658fee6020756d7e068415940a68cb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 30 Mar 2017 13:55:36 -0300 Subject: [PATCH] Bug 15705: Reset the last error when an auto renew successes The auto_renew_error has to be reset when an auto renew successes, otherwise the patron is not going to receive the correct notice. Test plan; - Checkin an item and mark it as auto renewal (specify a due date in the past to allow auto renewals) - Set OPACFineNoRenewalsBlockAutoRenew to 'Block' and 'OPACFineNoRenewals' to '1' - Execute the script => Auto renewed, column auto_renew_error is null - Add a fine of '2' to the patron - Execute the script => Not auto renewed, column auto_renew_error is 'auto_too_much_oweing' => On the interface youo see the correct message "Automatic renewal failed, patron has unpaid fines" - Pay the fine - Execute the script Without this patch the auto_renew_error is not reset and the patron is going to receive a letter telling him he own too much money to the library With this patch the patron will receive a letter to inform him the renew has been done! Signed-off-by: Jonathan Field Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall --- misc/cronjobs/automatic_renewals.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl index de6a3c920f..8e6cdfafe8 100755 --- a/misc/cronjobs/automatic_renewals.pl +++ b/misc/cronjobs/automatic_renewals.pl @@ -61,6 +61,7 @@ while ( my $auto_renew = $auto_renews->next ) { my ( $ok, $error ) = CanBookBeRenewed( $auto_renew->borrowernumber, $auto_renew->itemnumber ); if ( $error eq 'auto_renew' ) { my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode ); + $auto_renew->auto_renew_error(undef)->store; push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew; } elsif ( $error eq 'too_many' or $error eq 'on_reserve' -- 2.39.5