Lines 1349-1355
sub checkHighHolds {
Link Here
|
1349 |
|
1349 |
|
1350 |
my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branchcode, $borrower ); |
1350 |
my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branchcode, $borrower ); |
1351 |
|
1351 |
|
1352 |
my $rule = Koha::CirculationRules->get_effective_rule( |
1352 |
my $rule = Koha::CirculationRules->get_effective_rule_value( |
1353 |
{ |
1353 |
{ |
1354 |
categorycode => $borrower->{categorycode}, |
1354 |
categorycode => $borrower->{categorycode}, |
1355 |
itemtype => $item_object->effective_itemtype, |
1355 |
itemtype => $item_object->effective_itemtype, |
Lines 1359-1367
sub checkHighHolds {
Link Here
|
1359 |
); |
1359 |
); |
1360 |
|
1360 |
|
1361 |
my $duration; |
1361 |
my $duration; |
1362 |
if ( defined($rule) && $rule->rule_value ne '' ){ |
1362 |
if ( defined($rule) && $rule ne '' ){ |
1363 |
# overrides decreaseLoanHighHoldsDuration syspref |
1363 |
# overrides decreaseLoanHighHoldsDuration syspref |
1364 |
$duration = $rule->rule_value; |
1364 |
$duration = $rule; |
1365 |
} else { |
1365 |
} else { |
1366 |
$duration = C4::Context->preference('decreaseLoanHighHoldsDuration'); |
1366 |
$duration = C4::Context->preference('decreaseLoanHighHoldsDuration'); |
1367 |
} |
1367 |
} |
Lines 1520-1526
sub AddIssue {
Link Here
|
1520 |
|
1520 |
|
1521 |
# If automatic renewal wasn't selected while issuing, set the value according to the issuing rule. |
1521 |
# If automatic renewal wasn't selected while issuing, set the value according to the issuing rule. |
1522 |
unless ($auto_renew) { |
1522 |
unless ($auto_renew) { |
1523 |
my $rule = Koha::CirculationRules->get_effective_rule( |
1523 |
my $rule = Koha::CirculationRules->get_effective_rule_value( |
1524 |
{ |
1524 |
{ |
1525 |
categorycode => $borrower->{categorycode}, |
1525 |
categorycode => $borrower->{categorycode}, |
1526 |
itemtype => $item_object->effective_itemtype, |
1526 |
itemtype => $item_object->effective_itemtype, |
Lines 1529-1535
sub AddIssue {
Link Here
|
1529 |
} |
1529 |
} |
1530 |
); |
1530 |
); |
1531 |
|
1531 |
|
1532 |
$auto_renew = $rule->rule_value if $rule; |
1532 |
$auto_renew = $rule if defined $rule && $rule ne ''; |
1533 |
} |
1533 |
} |
1534 |
|
1534 |
|
1535 |
my $issue_attributes = { |
1535 |
my $issue_attributes = { |
Lines 2763-2773
sub CanBookBeRenewed {
Link Here
|
2763 |
branchcode => $branchcode, |
2763 |
branchcode => $branchcode, |
2764 |
rules => [ |
2764 |
rules => [ |
2765 |
'renewalsallowed', |
2765 |
'renewalsallowed', |
2766 |
'lengthunit', |
|
|
2767 |
'unseen_renewals_allowed', |
2766 |
'unseen_renewals_allowed', |
2768 |
'no_auto_renewal_after', |
|
|
2769 |
'no_auto_renewal_after_hard_limit', |
2770 |
'norenewalbefore' |
2771 |
] |
2767 |
] |
2772 |
} |
2768 |
} |
2773 |
); |
2769 |
); |
Lines 2792-2805
sub CanBookBeRenewed {
Link Here
|
2792 |
return ( 0, 'overdue'); |
2788 |
return ( 0, 'overdue'); |
2793 |
} |
2789 |
} |
2794 |
|
2790 |
|
2795 |
$soonest_renew_date = GetSoonestRenewDate($borrowernumber, $itemnumber, $branchcode, $issuing_rule); |
2791 |
$soonest_renew_date = GetSoonestRenewDate($borrowernumber, $itemnumber, $branchcode); |
2796 |
|
2792 |
|
2797 |
$auto_renew = _CanBookBeAutoRenewed({ |
2793 |
$auto_renew = _CanBookBeAutoRenewed({ |
2798 |
patron => $patron, |
2794 |
patron => $patron, |
2799 |
item => $item, |
2795 |
item => $item, |
2800 |
branchcode => $branchcode, |
2796 |
branchcode => $branchcode, |
2801 |
issue => $issue, |
2797 |
issue => $issue, |
2802 |
issuing_rule => $issuing_rule, |
|
|
2803 |
soonest => $soonest_renew_date |
2798 |
soonest => $soonest_renew_date |
2804 |
}) if $issue->auto_renew && $patron->autorenew_checkouts; |
2799 |
}) if $issue->auto_renew && $patron->autorenew_checkouts; |
2805 |
|
2800 |
|
Lines 3168-3174
cannot be found.
Link Here
|
3168 |
=cut |
3163 |
=cut |
3169 |
|
3164 |
|
3170 |
sub GetSoonestRenewDate { |
3165 |
sub GetSoonestRenewDate { |
3171 |
my ( $borrowernumber, $itemnumber, $branchcode, $issuing_rule ) = @_; |
3166 |
my ( $borrowernumber, $itemnumber, $branchcode ) = @_; |
3172 |
|
3167 |
|
3173 |
my $dbh = C4::Context->dbh; |
3168 |
my $dbh = C4::Context->dbh; |
3174 |
|
3169 |
|
Lines 3180-3186
sub GetSoonestRenewDate {
Link Here
|
3180 |
or return; |
3175 |
or return; |
3181 |
|
3176 |
|
3182 |
$branchcode = _GetCircControlBranch( $item->unblessed, $patron->unblessed ) unless $branchcode; |
3177 |
$branchcode = _GetCircControlBranch( $item->unblessed, $patron->unblessed ) unless $branchcode; |
3183 |
$issuing_rule = Koha::CirculationRules->get_effective_rules( |
3178 |
my $issuing_rule = Koha::CirculationRules->get_effective_rules( |
3184 |
{ categorycode => $patron->categorycode, |
3179 |
{ categorycode => $patron->categorycode, |
3185 |
itemtype => $item->effective_itemtype, |
3180 |
itemtype => $item->effective_itemtype, |
3186 |
branchcode => $branchcode, |
3181 |
branchcode => $branchcode, |
Lines 3189-3195
sub GetSoonestRenewDate {
Link Here
|
3189 |
'lengthunit', |
3184 |
'lengthunit', |
3190 |
] |
3185 |
] |
3191 |
} |
3186 |
} |
3192 |
) unless $issuing_rule; |
3187 |
); |
3193 |
|
3188 |
|
3194 |
my $now = dt_from_string; |
3189 |
my $now = dt_from_string; |
3195 |
|
3190 |
|
Lines 4278-4289
sub _CanBookBeAutoRenewed {
Link Here
|
4278 |
my $branchcode = $params->{branchcode}; |
4273 |
my $branchcode = $params->{branchcode}; |
4279 |
my $issue = $params->{issue}; |
4274 |
my $issue = $params->{issue}; |
4280 |
my $soonest_renew_date = $params->{soonest}; |
4275 |
my $soonest_renew_date = $params->{soonest}; |
4281 |
my $issuing_rule = $params->{issuing_rule}; |
|
|
4282 |
|
4276 |
|
4283 |
if ( $patron->category->effective_BlockExpiredPatronOpacActions and $patron->is_expired ) { |
4277 |
if ( $patron->category->effective_BlockExpiredPatronOpacActions and $patron->is_expired ) { |
4284 |
return 'auto_account_expired'; |
4278 |
return 'auto_account_expired'; |
4285 |
} |
4279 |
} |
4286 |
|
4280 |
|
|
|
4281 |
my $issuing_rule = Koha::CirculationRules->get_effective_rules( |
4282 |
{ |
4283 |
categorycode => $patron->categorycode, |
4284 |
itemtype => $item->effective_itemtype, |
4285 |
branchcode => $branchcode, |
4286 |
rules => [ |
4287 |
'no_auto_renewal_after', |
4288 |
'no_auto_renewal_after_hard_limit', |
4289 |
'lengthunit' |
4290 |
] |
4291 |
} |
4292 |
); |
4293 |
|
4287 |
if ( defined $issuing_rule->{no_auto_renewal_after} |
4294 |
if ( defined $issuing_rule->{no_auto_renewal_after} |
4288 |
and $issuing_rule->{no_auto_renewal_after} ne "" ) { |
4295 |
and $issuing_rule->{no_auto_renewal_after} ne "" ) { |
4289 |
# Get issue_date and add no_auto_renewal_after |
4296 |
# Get issue_date and add no_auto_renewal_after |