Bug 25393: (QA follow-up) simplify auto_renew condition

_CanBookBeAutoRenewed will only ever return 'auto_too_soon' not 'too_soon' so we can do a simple equality check

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-10-11 14:00:08 +00:00 committed by Tomas Cohen Arazi
parent d67ab23373
commit 448aec3fc9
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -3103,15 +3103,15 @@ sub CanBookBeRenewed {
}
}
if($auto_renew =~ 'too_soon'){
if ( $auto_renew eq 'auto_too_soon' ) {
# If its cron, tell it it's too soon for a an auto renewal
return ( 0, $auto_renew, { soonest_renew_date => $soonest } ) if $cron;
# Check if it's too soon for a manual renewal
my $soonestManual = GetSoonestRenewDate( $patron, $issue );
if($soonestManual > dt_from_string()){
return (0, "too_soon", { soonest_renew_date => $soonestManual } ) unless $override_limit;
if ( $soonestManual > dt_from_string() ) {
return ( 0, "too_soon", { soonest_renew_date => $soonestManual } ) unless $override_limit;
}
}