|
Lines 31-36
use C4::Dates;
Link Here
|
| 31 |
use C4::Calendar; |
31 |
use C4::Calendar; |
| 32 |
use C4::Accounts; |
32 |
use C4::Accounts; |
| 33 |
use C4::ItemCirculationAlertPreference; |
33 |
use C4::ItemCirculationAlertPreference; |
|
|
34 |
use C4::Dates qw(format_date); |
| 34 |
use C4::Message; |
35 |
use C4::Message; |
| 35 |
use C4::Debug; |
36 |
use C4::Debug; |
| 36 |
use Date::Calc qw( |
37 |
use Date::Calc qw( |
|
Lines 412-418
sub TooMany {
Link Here
|
| 412 |
|
413 |
|
| 413 |
my $max_loans_allowed = $issuing_rule->{'maxissueqty'}; |
414 |
my $max_loans_allowed = $issuing_rule->{'maxissueqty'}; |
| 414 |
if ($current_loan_count >= $max_loans_allowed) { |
415 |
if ($current_loan_count >= $max_loans_allowed) { |
| 415 |
return "$current_loan_count / $max_loans_allowed"; |
416 |
return ($current_loan_count, $max_loans_allowed); |
| 416 |
} |
417 |
} |
| 417 |
} |
418 |
} |
| 418 |
|
419 |
|
|
Lines 440-446
sub TooMany {
Link Here
|
| 440 |
|
441 |
|
| 441 |
my $max_loans_allowed = $branch_borrower_circ_rule->{maxissueqty}; |
442 |
my $max_loans_allowed = $branch_borrower_circ_rule->{maxissueqty}; |
| 442 |
if ($current_loan_count >= $max_loans_allowed) { |
443 |
if ($current_loan_count >= $max_loans_allowed) { |
| 443 |
return "$current_loan_count / $max_loans_allowed"; |
444 |
return ($current_loan_count, $max_loans_allowed); |
| 444 |
} |
445 |
} |
| 445 |
} |
446 |
} |
| 446 |
|
447 |
|
|
Lines 747-758
sub CanBookBeIssued {
Link Here
|
| 747 |
# |
748 |
# |
| 748 |
# JB34 CHECKS IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS |
749 |
# JB34 CHECKS IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS |
| 749 |
# |
750 |
# |
| 750 |
my $toomany = TooMany( $borrower, $item->{biblionumber}, $item ); |
751 |
my ($current_loan_count, $max_loans_allowed) = TooMany( $borrower, $item->{biblionumber}, $item ); |
| 751 |
# if TooMany return / 0, then the user has no permission to check out this book |
752 |
# if TooMany max_loans_allowed returns 0 the user doesn't have permission to check out this book |
| 752 |
if ($toomany =~ /\/ 0/) { |
753 |
if ($max_loans_allowed eq 0) { |
| 753 |
$needsconfirmation{PATRON_CANT} = 1; |
754 |
$needsconfirmation{PATRON_CANT} = 1; |
| 754 |
} else { |
755 |
} else { |
| 755 |
$needsconfirmation{TOO_MANY} = $toomany if $toomany; |
756 |
if($max_loans_allowed){ |
|
|
757 |
$needsconfirmation{TOO_MANY} = 1; |
| 758 |
$needsconfirmation{current_loan_count} = $current_loan_count; |
| 759 |
$needsconfirmation{max_loans_allowed} = $max_loans_allowed; |
| 760 |
} |
| 756 |
} |
761 |
} |
| 757 |
|
762 |
|
| 758 |
# |
763 |
# |
|
Lines 835-842
sub CanBookBeIssued {
Link Here
|
| 835 |
my $currborinfo = C4::Members::GetMemberDetails( $issue->{borrowernumber} ); |
840 |
my $currborinfo = C4::Members::GetMemberDetails( $issue->{borrowernumber} ); |
| 836 |
|
841 |
|
| 837 |
# warn "=>.$currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})"; |
842 |
# warn "=>.$currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})"; |
| 838 |
$needsconfirmation{ISSUED_TO_ANOTHER} = |
843 |
$needsconfirmation{ISSUED_TO_ANOTHER} = 1; |
| 839 |
"$currborinfo->{'reservedate'} : $currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})"; |
844 |
$needsconfirmation{issued_firstname} = $currborinfo->{'firstname'}; |
|
|
845 |
$needsconfirmation{issued_surname} = $currborinfo->{'surname'}; |
| 846 |
$needsconfirmation{issued_cardnumber} = $currborinfo->{'cardnumber'}; |
| 847 |
$needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'}; |
| 840 |
} |
848 |
} |
| 841 |
|
849 |
|
| 842 |
# See if the item is on reserve. |
850 |
# See if the item is on reserve. |
|
Lines 850-862
sub CanBookBeIssued {
Link Here
|
| 850 |
{ |
858 |
{ |
| 851 |
# The item is on reserve and waiting, but has been |
859 |
# The item is on reserve and waiting, but has been |
| 852 |
# reserved by some other patron. |
860 |
# reserved by some other patron. |
| 853 |
$needsconfirmation{RESERVE_WAITING} = |
861 |
$needsconfirmation{RESERVE_WAITING} = 1; |
| 854 |
"$resborrower->{'firstname'} $resborrower->{'surname'} ($resborrower->{'cardnumber'}, $branchname)"; |
862 |
$needsconfirmation{'resfirstname'} = $resborrower->{'firstname'}; |
|
|
863 |
$needsconfirmation{'ressurname'} = $resborrower->{'surname'}; |
| 864 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
| 865 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
| 866 |
$needsconfirmation{'resbranchname'} = $branchname; |
| 867 |
$needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'}); |
| 855 |
} |
868 |
} |
| 856 |
elsif ( $restype eq "Reserved" ) { |
869 |
elsif ( $restype eq "Reserved" ) { |
| 857 |
# The item is on reserve for someone else. |
870 |
# The item is on reserve for someone else. |
| 858 |
$needsconfirmation{RESERVED} = |
871 |
$needsconfirmation{RESERVED} = 1; |
| 859 |
"$res->{'reservedate'} : $resborrower->{'firstname'} $resborrower->{'surname'} ($resborrower->{'cardnumber'})"; |
872 |
$needsconfirmation{'resfirstname'} = $resborrower->{'firstname'}; |
|
|
873 |
$needsconfirmation{'ressurname'} = $resborrower->{'surname'}; |
| 874 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
| 875 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
| 876 |
$needsconfirmation{'resbranchname'} = $branchname; |
| 877 |
$needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'}); |
| 860 |
} |
878 |
} |
| 861 |
} |
879 |
} |
| 862 |
return ( \%issuingimpossible, \%needsconfirmation ); |
880 |
return ( \%issuingimpossible, \%needsconfirmation ); |