Lines 1158-1180
sub CanBookBeIssued {
Link Here
|
1158 |
} |
1158 |
} |
1159 |
} |
1159 |
} |
1160 |
|
1160 |
|
1161 |
my $now = dt_from_string(); |
1161 |
if ( C4::Context->preference("PreventCheckoutOnSameReservePeriod") ) { |
1162 |
my $preventCheckoutOnSameReservePeriod = |
1162 |
my $now = dt_from_string(); |
1163 |
C4::Context->preference("PreventCheckoutOnSameReservePeriod"); |
1163 |
my $reserves_on_same_period = |
1164 |
my $reserves_on_same_period = |
1164 |
ReservesOnSamePeriod($item_object->biblionumber, $item_object->itemnumber, $now->ymd, $duedate->ymd); |
1165 |
ReservesOnSamePeriod($item_object->biblionumber, $item_object->itemnumber, $now->ymd, $duedate->ymd); |
1165 |
if ($reserves_on_same_period) { |
1166 |
if ($preventCheckoutOnSameReservePeriod && $reserves_on_same_period) { |
1166 |
my $reserve = $reserves_on_same_period->[0]; |
1167 |
my $reserve = $reserves_on_same_period->[0]; |
1167 |
if ($reserve->{borrowernumber} ne $patron->borrowernumber) { |
1168 |
if ($reserve->{borrowernumber} ne $patron->borrowernumber) { |
1168 |
my $patron = Koha::Patrons->find( $reserve->{borrowernumber} ); |
1169 |
my $patron = Koha::Patrons->find( $reserve->{borrowernumber} ); |
1169 |
$needsconfirmation{RESERVED} = 1; |
1170 |
$needsconfirmation{RESERVED} = 1; |
1170 |
$needsconfirmation{resfirstname} = $patron->firstname; |
1171 |
$needsconfirmation{resfirstname} = $patron->firstname; |
1171 |
$needsconfirmation{ressurname} = $patron->surname; |
1172 |
$needsconfirmation{ressurname} = $patron->surname; |
1172 |
$needsconfirmation{rescardnumber} = $patron->cardnumber; |
1173 |
$needsconfirmation{rescardnumber} = $patron->cardnumber; |
1173 |
$needsconfirmation{resborrowernumber} = $patron->borrowernumber; |
1174 |
$needsconfirmation{resborrowernumber} = $patron->borrowernumber; |
1174 |
$needsconfirmation{resbranchcode} = $patron->branchcode; |
1175 |
$needsconfirmation{resbranchcode} = $patron->branchcode; |
1175 |
$needsconfirmation{resreservedate} = $reserve->{reservedate}; |
1176 |
$needsconfirmation{resreservedate} = $reserve->{reservedate}; |
1176 |
$needsconfirmation{reserve_id} = $reserve->{reserve_id}; |
1177 |
$needsconfirmation{reserve_id} = $reserve->{reserve_id}; |
1177 |
} |
1178 |
} |
1178 |
} |
1179 |
} |
1179 |
} |
1180 |
|
1180 |
|
Lines 2932-2955
sub CanBookBeRenewed {
Link Here
|
2932 |
} |
2932 |
} |
2933 |
} |
2933 |
} |
2934 |
} |
2934 |
} |
2935 |
unless ($date_due) { |
|
|
2936 |
my $itemtype = $item->effective_itemtype; |
2937 |
my $patron_unblessed = $patron->unblessed; |
2938 |
$date_due = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ? |
2939 |
dt_from_string( $issue->date_due, 'sql' ) : |
2940 |
dt_from_string(); |
2941 |
$date_due = CalcDateDue($date_due, $itemtype, _GetCircControlBranch($item->unblessed(), $patron_unblessed), $patron_unblessed, 'is a renewal'); |
2942 |
} |
2943 |
|
2935 |
|
2944 |
my $now = dt_from_string(); |
2936 |
if ( C4::Context->preference("PreventCheckoutOnSameReservePeriod") ) { |
2945 |
my $biblionumber = $item->biblionumber; |
2937 |
unless ($date_due) { |
2946 |
my $preventCheckoutOnSameReservePeriod = |
2938 |
my $itemtype = $item->effective_itemtype; |
2947 |
C4::Context->preference("PreventCheckoutOnSameReservePeriod"); |
2939 |
my $patron_unblessed = $patron->unblessed; |
2948 |
my $reserves_on_same_period = |
2940 |
$date_due = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ? |
2949 |
ReservesOnSamePeriod($biblionumber, $itemnumber, $now->ymd, $date_due->ymd); |
2941 |
dt_from_string( $issue->date_due, 'sql' ) : |
2950 |
if ($preventCheckoutOnSameReservePeriod && $reserves_on_same_period) { |
2942 |
dt_from_string(); |
2951 |
$resfound = 1; |
2943 |
$date_due = CalcDateDue($date_due, $itemtype, _GetCircControlBranch($item->unblessed(), $patron_unblessed), $patron_unblessed, 'is a renewal'); |
|
|
2944 |
} |
2945 |
my $now = dt_from_string(); |
2946 |
my $biblionumber = $item->biblionumber; |
2947 |
my $reserves_on_same_period = |
2948 |
ReservesOnSamePeriod($biblionumber, $itemnumber, $now->ymd, $date_due->ymd); |
2949 |
if ($reserves_on_same_period) { |
2950 |
$resfound = 1; |
2951 |
} |
2952 |
} |
2952 |
} |
|
|
2953 |
|
2953 |
if( $cron ) { #The cron wants to return 'too_soon' over 'on_reserve' |
2954 |
if( $cron ) { #The cron wants to return 'too_soon' over 'on_reserve' |
2954 |
return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; |
2955 |
return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; |
2955 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |
2956 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |