Lines 541-546
sub TooMany {
Link Here
|
541 |
max_checkouts_allowed => $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef, |
541 |
max_checkouts_allowed => $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef, |
542 |
max_onsite_checkouts_allowed => $maxonsiteissueqty_rule ? $maxonsiteissueqty_rule->rule_value : undef, |
542 |
max_onsite_checkouts_allowed => $maxonsiteissueqty_rule ? $maxonsiteissueqty_rule->rule_value : undef, |
543 |
switch_onsite_checkout => $switch_onsite_checkout, |
543 |
switch_onsite_checkout => $switch_onsite_checkout, |
|
|
544 |
circulation_rule => $maxissueqty_rule, |
545 |
onsite_circulation_rule => $maxonsiteissueqty_rule, |
544 |
}; |
546 |
}; |
545 |
# If parent rules exists |
547 |
# If parent rules exists |
546 |
if ( defined($parent_maxissueqty_rule) and defined($parent_maxissueqty_rule->rule_value) ){ |
548 |
if ( defined($parent_maxissueqty_rule) and defined($parent_maxissueqty_rule->rule_value) ){ |
Lines 589-595
sub TooMany {
Link Here
|
589 |
onsite_checkout => $onsite_checkout, |
591 |
onsite_checkout => $onsite_checkout, |
590 |
max_checkouts_allowed => $max_checkouts_allowed, |
592 |
max_checkouts_allowed => $max_checkouts_allowed, |
591 |
max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed, |
593 |
max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed, |
592 |
switch_onsite_checkout => $switch_onsite_checkout |
594 |
switch_onsite_checkout => $switch_onsite_checkout, |
|
|
595 |
circulation_rule => $branch_borrower_circ_rule, |
593 |
} |
596 |
} |
594 |
); |
597 |
); |
595 |
return $qty_over if defined $qty_over; |
598 |
return $qty_over if defined $qty_over; |
Lines 611-624
sub _check_max_qty {
Link Here
|
611 |
my $max_checkouts_allowed = $params->{max_checkouts_allowed}; |
614 |
my $max_checkouts_allowed = $params->{max_checkouts_allowed}; |
612 |
my $max_onsite_checkouts_allowed = $params->{max_onsite_checkouts_allowed}; |
615 |
my $max_onsite_checkouts_allowed = $params->{max_onsite_checkouts_allowed}; |
613 |
my $switch_onsite_checkout = $params->{switch_onsite_checkout}; |
616 |
my $switch_onsite_checkout = $params->{switch_onsite_checkout}; |
|
|
617 |
my $circulation_rule = $params->{circulation_rule}; |
618 |
my $onsite_circulation_rule = $params->{onsite_circulation_rule}; |
614 |
|
619 |
|
615 |
if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) { |
620 |
if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) { |
616 |
if ( $max_onsite_checkouts_allowed eq '' ) { return; } |
621 |
if ( $max_onsite_checkouts_allowed eq '' ) { return; } |
617 |
if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) { |
622 |
if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) { |
618 |
return { |
623 |
return { |
619 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
624 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
620 |
count => $onsite_checkout_count, |
625 |
count => $onsite_checkout_count, |
621 |
max_allowed => $max_onsite_checkouts_allowed, |
626 |
max_allowed => $max_onsite_checkouts_allowed, |
|
|
627 |
circulation_rule => $onsite_circulation_rule, |
622 |
}; |
628 |
}; |
623 |
} |
629 |
} |
624 |
} |
630 |
} |
Lines 627-635
sub _check_max_qty {
Link Here
|
627 |
my $delta = $switch_onsite_checkout ? 1 : 0; |
633 |
my $delta = $switch_onsite_checkout ? 1 : 0; |
628 |
if ( $checkout_count >= $max_checkouts_allowed + $delta ) { |
634 |
if ( $checkout_count >= $max_checkouts_allowed + $delta ) { |
629 |
return { |
635 |
return { |
630 |
reason => 'TOO_MANY_CHECKOUTS', |
636 |
reason => 'TOO_MANY_CHECKOUTS', |
631 |
count => $checkout_count, |
637 |
count => $checkout_count, |
632 |
max_allowed => $max_checkouts_allowed, |
638 |
max_allowed => $max_checkouts_allowed, |
|
|
639 |
circulation_rule => $circulation_rule, |
633 |
}; |
640 |
}; |
634 |
} |
641 |
} |
635 |
} |
642 |
} |
Lines 639-647
sub _check_max_qty {
Link Here
|
639 |
$checkout_count - $onsite_checkout_count >= $max_checkouts_allowed ) |
646 |
$checkout_count - $onsite_checkout_count >= $max_checkouts_allowed ) |
640 |
{ |
647 |
{ |
641 |
return { |
648 |
return { |
642 |
reason => 'TOO_MANY_CHECKOUTS', |
649 |
reason => 'TOO_MANY_CHECKOUTS', |
643 |
count => $checkout_count - $onsite_checkout_count, |
650 |
count => $checkout_count - $onsite_checkout_count, |
644 |
max_allowed => $max_checkouts_allowed, |
651 |
max_allowed => $max_checkouts_allowed, |
|
|
652 |
circulation_rule => $circulation_rule, |
645 |
}; |
653 |
}; |
646 |
} |
654 |
} |
647 |
} |
655 |
} |
Lines 1019-1034
sub CanBookBeIssued {
Link Here
|
1019 |
# if TooMany max_allowed returns 0 the user doesn't have permission to check out this book |
1027 |
# if TooMany max_allowed returns 0 the user doesn't have permission to check out this book |
1020 |
if ( $toomany && not exists $needsconfirmation{RENEW_ISSUE} ) { |
1028 |
if ( $toomany && not exists $needsconfirmation{RENEW_ISSUE} ) { |
1021 |
if ( $toomany->{max_allowed} == 0 ) { |
1029 |
if ( $toomany->{max_allowed} == 0 ) { |
1022 |
$needsconfirmation{PATRON_CANT} = 1; |
1030 |
$needsconfirmation{PATRON_CANT} = 1; |
|
|
1031 |
$needsconfirmation{circulation_rule_PATRON_CANT} = $toomany->{circulation_rule}; |
1023 |
} |
1032 |
} |
1024 |
if ( C4::Context->preference("AllowTooManyOverride") ) { |
1033 |
if ( C4::Context->preference("AllowTooManyOverride") ) { |
1025 |
$needsconfirmation{TOO_MANY} = $toomany->{reason}; |
1034 |
$needsconfirmation{TOO_MANY} = $toomany->{reason}; |
1026 |
$needsconfirmation{current_loan_count} = $toomany->{count}; |
1035 |
$needsconfirmation{current_loan_count} = $toomany->{count}; |
1027 |
$needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; |
1036 |
$needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; |
|
|
1037 |
$needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; |
1028 |
} else { |
1038 |
} else { |
1029 |
$issuingimpossible{TOO_MANY} = $toomany->{reason}; |
1039 |
$issuingimpossible{TOO_MANY} = $toomany->{reason}; |
1030 |
$issuingimpossible{current_loan_count} = $toomany->{count}; |
1040 |
$issuingimpossible{current_loan_count} = $toomany->{count}; |
1031 |
$issuingimpossible{max_loans_allowed} = $toomany->{max_allowed}; |
1041 |
$issuingimpossible{max_loans_allowed} = $toomany->{max_allowed}; |
|
|
1042 |
$needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; |
1032 |
} |
1043 |
} |
1033 |
} |
1044 |
} |
1034 |
|
1045 |
|