Bug 35944: Add booking handling to CanBookBeRenewed
This patch adds a bookings check to CanBookBeRenewed
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 59afaf533b
)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
371a5cae70
commit
ecc0df256b
1 changed files with 16 additions and 1 deletions
|
@ -2997,8 +2997,8 @@ sub CanBookBeRenewed {
|
|||
my $final_unseen_renewal = 0;
|
||||
|
||||
# override_limit will override anything else except on_reserve
|
||||
my $branchcode = _GetCircControlBranch( $item, $patron );
|
||||
unless ( $override_limit ){
|
||||
my $branchcode = _GetCircControlBranch( $item, $patron );
|
||||
|
||||
( $auto_renew, $soonest ) = _CanBookBeAutoRenewed({
|
||||
patron => $patron,
|
||||
|
@ -3120,6 +3120,21 @@ sub CanBookBeRenewed {
|
|||
}
|
||||
}
|
||||
|
||||
# CHECK FOR BOOKINGS
|
||||
my $startdate =
|
||||
( C4::Context->preference('RenewalPeriodBase') eq 'date_due' )
|
||||
? dt_from_string( $issue->date_due, 'sql' )
|
||||
: dt_from_string();
|
||||
my $datedue = CalcDateDue( $startdate, $item->effective_itemtype, $branchcode, $patron, 'is a renewal' );
|
||||
if (
|
||||
my $booking = $item->find_booking(
|
||||
{ checkout_date => $startdate, due_date => $datedue, patron_id => $patron->borrowernumber }
|
||||
)
|
||||
)
|
||||
{
|
||||
return ( 0, 'booked' ) unless ( $booking->patron_id == $patron->borrowernumber );
|
||||
}
|
||||
|
||||
if ( $auto_renew eq 'auto_too_soon' ) {
|
||||
|
||||
# If its cron, tell it it's too soon for a an auto renewal
|
||||
|
|
Loading…
Reference in a new issue