Lines 2693-2698
sub CanBookBeRenewed {
Link Here
|
2693 |
|
2693 |
|
2694 |
my $dbh = C4::Context->dbh; |
2694 |
my $dbh = C4::Context->dbh; |
2695 |
my $renews = 1; |
2695 |
my $renews = 1; |
|
|
2696 |
my $auto_renew = 0; |
2696 |
|
2697 |
|
2697 |
my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); |
2698 |
my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); |
2698 |
my $issue = $item->checkout or return ( 0, 'no_checkout' ); |
2699 |
my $issue = $item->checkout or return ( 0, 'no_checkout' ); |
Lines 2794-2810
sub CanBookBeRenewed {
Link Here
|
2794 |
return ( 0, "too_soon" ); |
2795 |
return ( 0, "too_soon" ); |
2795 |
} |
2796 |
} |
2796 |
elsif ( $issue->auto_renew ) { |
2797 |
elsif ( $issue->auto_renew ) { |
2797 |
return ( 0, "auto_renew" ); |
2798 |
$auto_renew = 1; |
2798 |
} |
2799 |
} |
2799 |
} |
2800 |
} |
2800 |
|
2801 |
|
2801 |
# Fallback for automatic renewals: |
2802 |
# Fallback for automatic renewals: |
2802 |
# If norenewalbefore is undef, don't renew before due date. |
2803 |
# If norenewalbefore is undef, don't renew before due date. |
2803 |
if ( $issue->auto_renew ) { |
2804 |
if ( $issue->auto_renew && !$auto_renew ) { |
2804 |
my $now = dt_from_string; |
2805 |
my $now = dt_from_string; |
2805 |
return ( 0, "auto_renew" ) |
2806 |
if ( $now >= dt_from_string( $issue->date_due, 'sql' ) ){ |
2806 |
if $now >= dt_from_string( $issue->date_due, 'sql' ); |
2807 |
$auto_renew = 1; |
2807 |
return ( 0, "auto_too_soon" ); |
2808 |
} else { |
|
|
2809 |
return ( 0, "auto_too_soon" ); |
2810 |
} |
2808 |
} |
2811 |
} |
2809 |
} |
2812 |
} |
2810 |
|
2813 |
|
Lines 2874-2879
sub CanBookBeRenewed {
Link Here
|
2874 |
} |
2877 |
} |
2875 |
} |
2878 |
} |
2876 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |
2879 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |
|
|
2880 |
return ( 0, "auto_renew" ) if $auto_renew && !$override_limit; # 0 if auto-renewal should not succeed |
2877 |
|
2881 |
|
2878 |
return ( 1, undef ); |
2882 |
return ( 1, undef ); |
2879 |
} |
2883 |
} |