Lines 2668-2673
sub CanBookBeRenewed {
Link Here
|
2668 |
|
2668 |
|
2669 |
my $dbh = C4::Context->dbh; |
2669 |
my $dbh = C4::Context->dbh; |
2670 |
my $renews = 1; |
2670 |
my $renews = 1; |
|
|
2671 |
my $auto_renew = 0; |
2671 |
|
2672 |
|
2672 |
my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); |
2673 |
my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); |
2673 |
my $issue = $item->checkout or return ( 0, 'no_checkout' ); |
2674 |
my $issue = $item->checkout or return ( 0, 'no_checkout' ); |
Lines 2761-2777
sub CanBookBeRenewed {
Link Here
|
2761 |
return ( 0, "too_soon" ); |
2762 |
return ( 0, "too_soon" ); |
2762 |
} |
2763 |
} |
2763 |
elsif ( $issue->auto_renew ) { |
2764 |
elsif ( $issue->auto_renew ) { |
2764 |
return ( 0, "auto_renew" ); |
2765 |
$auto_renew = 1; |
2765 |
} |
2766 |
} |
2766 |
} |
2767 |
} |
2767 |
|
2768 |
|
2768 |
# Fallback for automatic renewals: |
2769 |
# Fallback for automatic renewals: |
2769 |
# If norenewalbefore is undef, don't renew before due date. |
2770 |
# If norenewalbefore is undef, don't renew before due date. |
2770 |
if ( $issue->auto_renew ) { |
2771 |
if ( $issue->auto_renew && !$auto_renew ) { |
2771 |
my $now = dt_from_string; |
2772 |
my $now = dt_from_string; |
2772 |
return ( 0, "auto_renew" ) |
2773 |
if( $now >= dt_from_string( $issue->date_due, 'sql' ) ){ |
2773 |
if $now >= dt_from_string( $issue->date_due, 'sql' ); |
2774 |
$auto_renew = 1; |
2774 |
return ( 0, "auto_too_soon" ); |
2775 |
} else { |
|
|
2776 |
return ( 0, "auto_too_soon" ); |
2777 |
} |
2775 |
} |
2778 |
} |
2776 |
} |
2779 |
} |
2777 |
|
2780 |
|
Lines 2841-2846
sub CanBookBeRenewed {
Link Here
|
2841 |
} |
2844 |
} |
2842 |
} |
2845 |
} |
2843 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |
2846 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |
|
|
2847 |
return ( 0, "auto_renew" ) if $auto_renew && !$override_limit; # 0 if auto-renewal should not succeed |
2844 |
|
2848 |
|
2845 |
return ( 1, undef ); |
2849 |
return ( 1, undef ); |
2846 |
} |
2850 |
} |