Lines 3121-3149
sub CanBookBeRenewed {
Link Here
|
3121 |
} |
3121 |
} |
3122 |
|
3122 |
|
3123 |
# CHECK FOR BOOKINGS |
3123 |
# CHECK FOR BOOKINGS |
3124 |
my $startdate = |
3124 |
if( $item->bookings->count ){ |
3125 |
( C4::Context->preference('RenewalPeriodBase') eq 'date_due' ) |
3125 |
my $startdate = |
3126 |
? dt_from_string( $issue->date_due, 'sql' ) |
3126 |
( C4::Context->preference('RenewalPeriodBase') eq 'date_due' ) |
3127 |
: dt_from_string(); |
3127 |
? dt_from_string( $issue->date_due, 'sql' ) |
3128 |
my $datedue = CalcDateDue( $startdate, $item->effective_itemtype, $branchcode, $patron, 'is a renewal' ); |
3128 |
: dt_from_string(); |
3129 |
if ( |
3129 |
my $datedue = CalcDateDue( $startdate, $item->effective_itemtype, $branchcode, $patron, 'is a renewal' ); |
3130 |
my $booking = $item->find_booking( |
3130 |
if ( |
3131 |
{ checkout_date => $startdate, due_date => $datedue, patron_id => $patron->borrowernumber } |
3131 |
my $booking = $item->find_booking( |
3132 |
) |
3132 |
{ checkout_date => $startdate, due_date => $datedue, patron_id => $patron->borrowernumber } |
3133 |
) |
3133 |
) |
3134 |
{ |
3134 |
) |
3135 |
return ( 0, 'booked' ) unless ( $booking->patron_id == $patron->borrowernumber ); |
3135 |
{ |
3136 |
} |
3136 |
return ( 0, 'booked' ) unless ( $booking->patron_id == $patron->borrowernumber ); |
|
|
3137 |
} |
3137 |
|
3138 |
|
3138 |
if ( $auto_renew eq 'auto_too_soon' ) { |
3139 |
if ( $auto_renew eq 'auto_too_soon' ) { |
3139 |
|
3140 |
|
3140 |
# If its cron, tell it it's too soon for a an auto renewal |
3141 |
# If its cron, tell it it's too soon for a an auto renewal |
3141 |
return ( 0, $auto_renew, { soonest_renew_date => $soonest } ) if $cron; |
3142 |
return ( 0, $auto_renew, { soonest_renew_date => $soonest } ) if $cron; |
3142 |
|
3143 |
|
3143 |
# Check if it's too soon for a manual renewal |
3144 |
# Check if it's too soon for a manual renewal |
3144 |
my $soonestManual = GetSoonestRenewDate( $patron, $issue ); |
3145 |
my $soonestManual = GetSoonestRenewDate( $patron, $issue ); |
3145 |
if ( $soonestManual > dt_from_string() ) { |
3146 |
if ( $soonestManual > dt_from_string() ) { |
3146 |
return ( 0, "too_soon", { soonest_renew_date => $soonestManual } ) unless $override_limit; |
3147 |
return ( 0, "too_soon", { soonest_renew_date => $soonestManual } ) unless $override_limit; |
|
|
3148 |
} |
3147 |
} |
3149 |
} |
3148 |
} |
3150 |
} |
3149 |
|
3151 |
|
3150 |
- |
|
|