|
Lines 43-48
use Koha::Account;
Link Here
|
| 43 |
use Koha::AuthorisedValues; |
43 |
use Koha::AuthorisedValues; |
| 44 |
use Koha::DateUtils; |
44 |
use Koha::DateUtils; |
| 45 |
use Koha::Calendar; |
45 |
use Koha::Calendar; |
|
|
46 |
use Koha::IssuingRules; |
| 46 |
use Koha::Items; |
47 |
use Koha::Items; |
| 47 |
use Koha::Patrons; |
48 |
use Koha::Patrons; |
| 48 |
use Koha::Patron::Debarments; |
49 |
use Koha::Patron::Debarments; |
|
Lines 89-95
BEGIN {
Link Here
|
| 89 |
&GetItemIssue |
90 |
&GetItemIssue |
| 90 |
&GetItemIssues |
91 |
&GetItemIssues |
| 91 |
&GetIssuingCharges |
92 |
&GetIssuingCharges |
| 92 |
&GetIssuingRule |
|
|
| 93 |
&GetBranchBorrowerCircRule |
93 |
&GetBranchBorrowerCircRule |
| 94 |
&GetBranchItemRule |
94 |
&GetBranchItemRule |
| 95 |
&GetBiblioIssues |
95 |
&GetBiblioIssues |
|
Lines 397-408
sub TooMany {
Link Here
|
| 397 |
|
397 |
|
| 398 |
# given branch, patron category, and item type, determine |
398 |
# given branch, patron category, and item type, determine |
| 399 |
# applicable issuing rule |
399 |
# applicable issuing rule |
| 400 |
my $issuing_rule = GetIssuingRule($cat_borrower, $type, $branch); |
400 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $cat_borrower, itemtype => $type, branchcode => $branch }); |
| 401 |
|
401 |
|
| 402 |
# if a rule is found and has a loan limit set, count |
402 |
# if a rule is found and has a loan limit set, count |
| 403 |
# how many loans the patron already has that meet that |
403 |
# how many loans the patron already has that meet that |
| 404 |
# rule |
404 |
# rule |
| 405 |
if (defined($issuing_rule) and defined($issuing_rule->{'maxissueqty'})) { |
405 |
if (defined($issuing_rule) and defined($issuing_rule->maxissueqty)) { |
| 406 |
my @bind_params; |
406 |
my @bind_params; |
| 407 |
my $count_query = q| |
407 |
my $count_query = q| |
| 408 |
SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts |
408 |
SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts |
|
Lines 410-416
sub TooMany {
Link Here
|
| 410 |
JOIN items USING (itemnumber) |
410 |
JOIN items USING (itemnumber) |
| 411 |
|; |
411 |
|; |
| 412 |
|
412 |
|
| 413 |
my $rule_itemtype = $issuing_rule->{itemtype}; |
413 |
my $rule_itemtype = $issuing_rule->itemtype; |
| 414 |
if ($rule_itemtype eq "*") { |
414 |
if ($rule_itemtype eq "*") { |
| 415 |
# matching rule has the default item type, so count only |
415 |
# matching rule has the default item type, so count only |
| 416 |
# those existing loans that don't fall under a more |
416 |
# those existing loans that don't fall under a more |
|
Lines 431-438
sub TooMany {
Link Here
|
| 431 |
AND itemtype <> '*' |
431 |
AND itemtype <> '*' |
| 432 |
) "; |
432 |
) "; |
| 433 |
} |
433 |
} |
| 434 |
push @bind_params, $issuing_rule->{branchcode}; |
434 |
push @bind_params, $issuing_rule->branchcode; |
| 435 |
push @bind_params, $issuing_rule->{categorycode}; |
435 |
push @bind_params, $issuing_rule->categorycode; |
| 436 |
push @bind_params, $cat_borrower; |
436 |
push @bind_params, $cat_borrower; |
| 437 |
} else { |
437 |
} else { |
| 438 |
# rule has specific item type, so count loans of that |
438 |
# rule has specific item type, so count loans of that |
|
Lines 448-454
sub TooMany {
Link Here
|
| 448 |
|
448 |
|
| 449 |
$count_query .= " AND borrowernumber = ? "; |
449 |
$count_query .= " AND borrowernumber = ? "; |
| 450 |
push @bind_params, $borrower->{'borrowernumber'}; |
450 |
push @bind_params, $borrower->{'borrowernumber'}; |
| 451 |
my $rule_branch = $issuing_rule->{branchcode}; |
451 |
my $rule_branch = $issuing_rule->branchcode; |
| 452 |
if ($rule_branch ne "*") { |
452 |
if ($rule_branch ne "*") { |
| 453 |
if (C4::Context->preference('CircControl') eq 'PickupLibrary') { |
453 |
if (C4::Context->preference('CircControl') eq 'PickupLibrary') { |
| 454 |
$count_query .= " AND issues.branchcode = ? "; |
454 |
$count_query .= " AND issues.branchcode = ? "; |
|
Lines 463-470
sub TooMany {
Link Here
|
| 463 |
|
463 |
|
| 464 |
my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $count_query, {}, @bind_params ); |
464 |
my ( $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $count_query, {}, @bind_params ); |
| 465 |
|
465 |
|
| 466 |
my $max_checkouts_allowed = $issuing_rule->{maxissueqty}; |
466 |
my $max_checkouts_allowed = $issuing_rule->maxissueqty; |
| 467 |
my $max_onsite_checkouts_allowed = $issuing_rule->{maxonsiteissueqty}; |
467 |
my $max_onsite_checkouts_allowed = $issuing_rule->maxonsiteissueqty; |
| 468 |
|
468 |
|
| 469 |
if ( $onsite_checkout ) { |
469 |
if ( $onsite_checkout ) { |
| 470 |
if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) { |
470 |
if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) { |
|
Lines 1333-1340
sub AddIssue {
Link Here
|
| 1333 |
|
1333 |
|
| 1334 |
# If automatic renewal wasn't selected while issuing, set the value according to the issuing rule. |
1334 |
# If automatic renewal wasn't selected while issuing, set the value according to the issuing rule. |
| 1335 |
unless ($auto_renew) { |
1335 |
unless ($auto_renew) { |
| 1336 |
my $issuingrule = GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branch ); |
1336 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branch }); |
| 1337 |
$auto_renew = $issuingrule->{auto_renew}; |
1337 |
$auto_renew = $issuing_rule->auto_renew if $issuing_rule; |
| 1338 |
} |
1338 |
} |
| 1339 |
|
1339 |
|
| 1340 |
# Record in the database the fact that the book was issued. |
1340 |
# Record in the database the fact that the book was issued. |
|
Lines 1533-1604
Get the Hard Due Date and it's comparison for an itemtype, a borrower type and a
Link Here
|
| 1533 |
sub GetHardDueDate { |
1533 |
sub GetHardDueDate { |
| 1534 |
my ( $borrowertype, $itemtype, $branchcode ) = @_; |
1534 |
my ( $borrowertype, $itemtype, $branchcode ) = @_; |
| 1535 |
|
1535 |
|
| 1536 |
my $rule = GetIssuingRule( $borrowertype, $itemtype, $branchcode ); |
1536 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrowertype, itemtype => $itemtype, branchcode => $branchcode }); |
| 1537 |
|
1537 |
|
| 1538 |
if ( defined( $rule ) ) { |
1538 |
if ( defined( $issuing_rule ) ) { |
| 1539 |
if ( $rule->{hardduedate} ) { |
1539 |
if ( $issuing_rule->hardduedate ) { |
| 1540 |
return (dt_from_string($rule->{hardduedate}, 'iso'),$rule->{hardduedatecompare}); |
1540 |
return (dt_from_string($issuing_rule->hardduedate, 'iso'),$issuing_rule->hardduedatecompare); |
| 1541 |
} else { |
1541 |
} else { |
| 1542 |
return (undef, undef); |
1542 |
return (undef, undef); |
| 1543 |
} |
1543 |
} |
| 1544 |
} |
1544 |
} |
| 1545 |
} |
1545 |
} |
| 1546 |
|
1546 |
|
| 1547 |
=head2 GetIssuingRule |
|
|
| 1548 |
|
| 1549 |
my $irule = &GetIssuingRule($borrowertype,$itemtype,branchcode) |
| 1550 |
|
| 1551 |
FIXME - This is a copy-paste of GetLoanLength |
| 1552 |
as a stop-gap. Do not wish to change API for GetLoanLength |
| 1553 |
this close to release. |
| 1554 |
|
| 1555 |
Get the issuing rule for an itemtype, a borrower type and a branch |
| 1556 |
Returns a hashref from the issuingrules table. |
| 1557 |
|
| 1558 |
=cut |
| 1559 |
|
| 1560 |
sub GetIssuingRule { |
| 1561 |
my ( $borrowertype, $itemtype, $branchcode ) = @_; |
| 1562 |
my $dbh = C4::Context->dbh; |
| 1563 |
my $sth = $dbh->prepare( "select * from issuingrules where categorycode=? and itemtype=? and branchcode=?" ); |
| 1564 |
my $irule; |
| 1565 |
|
| 1566 |
$sth->execute( $borrowertype, $itemtype, $branchcode ); |
| 1567 |
$irule = $sth->fetchrow_hashref; |
| 1568 |
return $irule if defined($irule) ; |
| 1569 |
|
| 1570 |
$sth->execute( $borrowertype, "*", $branchcode ); |
| 1571 |
$irule = $sth->fetchrow_hashref; |
| 1572 |
return $irule if defined($irule) ; |
| 1573 |
|
| 1574 |
$sth->execute( "*", $itemtype, $branchcode ); |
| 1575 |
$irule = $sth->fetchrow_hashref; |
| 1576 |
return $irule if defined($irule) ; |
| 1577 |
|
| 1578 |
$sth->execute( "*", "*", $branchcode ); |
| 1579 |
$irule = $sth->fetchrow_hashref; |
| 1580 |
return $irule if defined($irule) ; |
| 1581 |
|
| 1582 |
$sth->execute( $borrowertype, $itemtype, "*" ); |
| 1583 |
$irule = $sth->fetchrow_hashref; |
| 1584 |
return $irule if defined($irule) ; |
| 1585 |
|
| 1586 |
$sth->execute( $borrowertype, "*", "*" ); |
| 1587 |
$irule = $sth->fetchrow_hashref; |
| 1588 |
return $irule if defined($irule) ; |
| 1589 |
|
| 1590 |
$sth->execute( "*", $itemtype, "*" ); |
| 1591 |
$irule = $sth->fetchrow_hashref; |
| 1592 |
return $irule if defined($irule) ; |
| 1593 |
|
| 1594 |
$sth->execute( "*", "*", "*" ); |
| 1595 |
$irule = $sth->fetchrow_hashref; |
| 1596 |
return $irule if defined($irule) ; |
| 1597 |
|
| 1598 |
# if no rule matches, |
| 1599 |
return; |
| 1600 |
} |
| 1601 |
|
| 1602 |
=head2 GetBranchBorrowerCircRule |
1547 |
=head2 GetBranchBorrowerCircRule |
| 1603 |
|
1548 |
|
| 1604 |
my $branch_cat_rule = GetBranchBorrowerCircRule($branchcode, $categorycode); |
1549 |
my $branch_cat_rule = GetBranchBorrowerCircRule($branchcode, $categorycode); |
|
Lines 2240-2249
sub _debar_user_on_return {
Link Here
|
| 2240 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
2185 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
| 2241 |
|
2186 |
|
| 2242 |
my $circcontrol = C4::Context->preference('CircControl'); |
2187 |
my $circcontrol = C4::Context->preference('CircControl'); |
| 2243 |
my $issuingrule = |
2188 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branchcode }); |
| 2244 |
GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode ); |
2189 |
my $finedays = $issuing_rule ? $issuing_rule->finedays : undef; |
| 2245 |
my $finedays = $issuingrule->{finedays}; |
2190 |
my $unit = $issuing_rule ? $issuing_rule->lengthunit : undef; |
| 2246 |
my $unit = $issuingrule->{lengthunit}; |
|
|
| 2247 |
my $chargeable_units = C4::Overdues::get_chargeable_units($unit, $dt_due, $dt_today, $branchcode); |
2191 |
my $chargeable_units = C4::Overdues::get_chargeable_units($unit, $dt_due, $dt_today, $branchcode); |
| 2248 |
|
2192 |
|
| 2249 |
if ($finedays) { |
2193 |
if ($finedays) { |
|
Lines 2254-2260
sub _debar_user_on_return {
Link Here
|
| 2254 |
|
2198 |
|
| 2255 |
# grace period is measured in the same units as the loan |
2199 |
# grace period is measured in the same units as the loan |
| 2256 |
my $grace = |
2200 |
my $grace = |
| 2257 |
DateTime::Duration->new( $unit => $issuingrule->{firstremind} ); |
2201 |
DateTime::Duration->new( $unit => $issuing_rule->firstremind ); |
| 2258 |
|
2202 |
|
| 2259 |
my $deltadays = DateTime::Duration->new( |
2203 |
my $deltadays = DateTime::Duration->new( |
| 2260 |
days => $chargeable_units |
2204 |
days => $chargeable_units |
|
Lines 2264-2270
sub _debar_user_on_return {
Link Here
|
| 2264 |
|
2208 |
|
| 2265 |
# If the max suspension days is < than the suspension days |
2209 |
# If the max suspension days is < than the suspension days |
| 2266 |
# the suspension days is limited to this maximum period. |
2210 |
# the suspension days is limited to this maximum period. |
| 2267 |
my $max_sd = $issuingrule->{maxsuspensiondays}; |
2211 |
my $max_sd = $issuing_rule->maxsuspensiondays; |
| 2268 |
if ( defined $max_sd ) { |
2212 |
if ( defined $max_sd ) { |
| 2269 |
$max_sd = DateTime::Duration->new( days => $max_sd ); |
2213 |
$max_sd = DateTime::Duration->new( days => $max_sd ); |
| 2270 |
$suspension_days = $max_sd |
2214 |
$suspension_days = $max_sd |
|
Lines 2836-2846
sub CanBookBeRenewed {
Link Here
|
| 2836 |
return ( 1, undef ) if $override_limit; |
2780 |
return ( 1, undef ) if $override_limit; |
| 2837 |
|
2781 |
|
| 2838 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
2782 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
| 2839 |
my $issuingrule = |
2783 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branchcode }); |
| 2840 |
GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode ); |
|
|
| 2841 |
|
2784 |
|
| 2842 |
return ( 0, "too_many" ) |
2785 |
return ( 0, "too_many" ) |
| 2843 |
if $issuingrule->{renewalsallowed} <= $itemissue->{renewals}; |
2786 |
if not $issuing_rule or $issuing_rule->renewalsallowed <= $itemissue->{renewals}; |
| 2844 |
|
2787 |
|
| 2845 |
my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing'); |
2788 |
my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing'); |
| 2846 |
my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing'); |
2789 |
my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing'); |
|
Lines 2855-2868
sub CanBookBeRenewed {
Link Here
|
| 2855 |
} |
2798 |
} |
| 2856 |
|
2799 |
|
| 2857 |
if ( $itemissue->{auto_renew} |
2800 |
if ( $itemissue->{auto_renew} |
| 2858 |
and defined $issuingrule->{no_auto_renewal_after} |
2801 |
and defined $issuing_rule->no_auto_renewal_after |
| 2859 |
and $issuingrule->{no_auto_renewal_after} ne "" ) { |
2802 |
and $issuing_rule->no_auto_renewal_after ne "" ) { |
| 2860 |
|
2803 |
|
| 2861 |
# Get issue_date and add no_auto_renewal_after |
2804 |
# Get issue_date and add no_auto_renewal_after |
| 2862 |
# If this is greater than today, it's too late for renewal. |
2805 |
# If this is greater than today, it's too late for renewal. |
| 2863 |
my $maximum_renewal_date = dt_from_string($itemissue->{issuedate}); |
2806 |
my $maximum_renewal_date = dt_from_string($itemissue->{issuedate}); |
| 2864 |
$maximum_renewal_date->add( |
2807 |
$maximum_renewal_date->add( |
| 2865 |
$issuingrule->{lengthunit} => $issuingrule->{no_auto_renewal_after} |
2808 |
$issuing_rule->lengthunit => $issuing_rule->no_auto_renewal_after |
| 2866 |
); |
2809 |
); |
| 2867 |
my $now = dt_from_string; |
2810 |
my $now = dt_from_string; |
| 2868 |
if ( $now >= $maximum_renewal_date ) { |
2811 |
if ( $now >= $maximum_renewal_date ) { |
|
Lines 2870-2888
sub CanBookBeRenewed {
Link Here
|
| 2870 |
} |
2813 |
} |
| 2871 |
} |
2814 |
} |
| 2872 |
|
2815 |
|
| 2873 |
if ( defined $issuingrule->{norenewalbefore} |
2816 |
if ( defined $issuing_rule->norenewalbefore |
| 2874 |
and $issuingrule->{norenewalbefore} ne "" ) |
2817 |
and $issuing_rule->norenewalbefore ne "" ) |
| 2875 |
{ |
2818 |
{ |
| 2876 |
|
2819 |
|
| 2877 |
# Calculate soonest renewal by subtracting 'No renewal before' from due date |
2820 |
# Calculate soonest renewal by subtracting 'No renewal before' from due date |
| 2878 |
my $soonestrenewal = |
2821 |
my $soonestrenewal = |
| 2879 |
$itemissue->{date_due}->clone() |
2822 |
$itemissue->{date_due}->clone() |
| 2880 |
->subtract( |
2823 |
->subtract( |
| 2881 |
$issuingrule->{lengthunit} => $issuingrule->{norenewalbefore} ); |
2824 |
$issuing_rule->lengthunit => $issuing_rule->norenewalbefore ); |
| 2882 |
|
2825 |
|
| 2883 |
# Depending on syspref reset the exact time, only check the date |
2826 |
# Depending on syspref reset the exact time, only check the date |
| 2884 |
if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date' |
2827 |
if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date' |
| 2885 |
and $issuingrule->{lengthunit} eq 'days' ) |
2828 |
and $issuing_rule->lengthunit eq 'days' ) |
| 2886 |
{ |
2829 |
{ |
| 2887 |
$soonestrenewal->truncate( to => 'day' ); |
2830 |
$soonestrenewal->truncate( to => 'day' ); |
| 2888 |
} |
2831 |
} |
|
Lines 3078-3087
sub GetRenewCount {
Link Here
|
| 3078 |
$renewcount = $data->{'renewals'} if $data->{'renewals'}; |
3021 |
$renewcount = $data->{'renewals'} if $data->{'renewals'}; |
| 3079 |
# $item and $borrower should be calculated |
3022 |
# $item and $borrower should be calculated |
| 3080 |
my $branchcode = _GetCircControlBranch($item, $borrower); |
3023 |
my $branchcode = _GetCircControlBranch($item, $borrower); |
| 3081 |
|
3024 |
|
| 3082 |
my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branchcode); |
3025 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branchcode }); |
| 3083 |
|
3026 |
|
| 3084 |
$renewsallowed = $issuingrule->{'renewalsallowed'}; |
3027 |
$renewsallowed = $issuing_rule ? $issuing_rule->renewalsallowed : undef; # FIXME Just replace undef with 0 to get what we expected. But what about the side-effects? TODO LATER |
| 3085 |
$renewsleft = $renewsallowed - $renewcount; |
3028 |
$renewsleft = $renewsallowed - $renewcount; |
| 3086 |
if($renewsleft < 0){ $renewsleft = 0; } |
3029 |
if($renewsleft < 0){ $renewsleft = 0; } |
| 3087 |
return ( $renewcount, $renewsallowed, $renewsleft ); |
3030 |
return ( $renewcount, $renewsallowed, $renewsleft ); |
|
Lines 3119-3139
sub GetSoonestRenewDate {
Link Here
|
| 3119 |
or return; |
3062 |
or return; |
| 3120 |
|
3063 |
|
| 3121 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
3064 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
| 3122 |
my $issuingrule = |
3065 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branchcode }); |
| 3123 |
GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode ); |
|
|
| 3124 |
|
3066 |
|
| 3125 |
my $now = dt_from_string; |
3067 |
my $now = dt_from_string; |
|
|
3068 |
return $now unless $issuing_rule; |
| 3126 |
|
3069 |
|
| 3127 |
if ( defined $issuingrule->{norenewalbefore} |
3070 |
if ( defined $issuing_rule->norenewalbefore |
| 3128 |
and $issuingrule->{norenewalbefore} ne "" ) |
3071 |
and $issuing_rule->norenewalbefore ne "" ) |
| 3129 |
{ |
3072 |
{ |
| 3130 |
my $soonestrenewal = |
3073 |
my $soonestrenewal = |
| 3131 |
$itemissue->{date_due}->clone() |
3074 |
$itemissue->{date_due}->clone() |
| 3132 |
->subtract( |
3075 |
->subtract( |
| 3133 |
$issuingrule->{lengthunit} => $issuingrule->{norenewalbefore} ); |
3076 |
$issuing_rule->lengthunit => $issuing_rule->norenewalbefore ); |
| 3134 |
|
3077 |
|
| 3135 |
if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date' |
3078 |
if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date' |
| 3136 |
and $issuingrule->{lengthunit} eq 'days' ) |
3079 |
and $issuing_rule->lengthunit eq 'days' ) |
| 3137 |
{ |
3080 |
{ |
| 3138 |
$soonestrenewal->truncate( to => 'day' ); |
3081 |
$soonestrenewal->truncate( to => 'day' ); |
| 3139 |
} |
3082 |
} |
|
Lines 3174-3190
sub GetLatestAutoRenewDate {
Link Here
|
| 3174 |
or return; |
3117 |
or return; |
| 3175 |
|
3118 |
|
| 3176 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
3119 |
my $branchcode = _GetCircControlBranch( $item, $borrower ); |
| 3177 |
my $issuingrule = |
3120 |
my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $borrower->{categorycode}, itemtype => $item->{itype}, branchcode => $branchcode }); |
| 3178 |
GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode ); |
|
|
| 3179 |
|
| 3180 |
my $now = dt_from_string; |
| 3181 |
|
3121 |
|
| 3182 |
return if not $issuingrule->{no_auto_renewal_after} |
3122 |
return unless $issuing_rule; |
| 3183 |
or $issuingrule->{no_auto_renewal_after} eq ''; |
3123 |
return if not $issuing_rule->no_auto_renewal_after |
|
|
3124 |
or $issuing_rule->no_auto_renewal_after eq ''; |
| 3184 |
|
3125 |
|
| 3185 |
my $maximum_renewal_date = dt_from_string($itemissue->{issuedate}); |
3126 |
my $maximum_renewal_date = dt_from_string($itemissue->{issuedate}); |
| 3186 |
$maximum_renewal_date->add( |
3127 |
$maximum_renewal_date->add( |
| 3187 |
$issuingrule->{lengthunit} => $issuingrule->{no_auto_renewal_after} |
3128 |
$issuing_rule->lengthunit => $issuing_rule->no_auto_renewal_after |
| 3188 |
); |
3129 |
); |
| 3189 |
|
3130 |
|
| 3190 |
return $maximum_renewal_date; |
3131 |
return $maximum_renewal_date; |