|
Lines 829-834
sub CanBookBeIssued {
Link Here
|
| 829 |
} |
829 |
} |
| 830 |
} |
830 |
} |
| 831 |
|
831 |
|
|
|
832 |
# |
| 833 |
# CHECK IF BOOK ALREADY ISSUED TO THIS BORROWER |
| 834 |
# |
| 835 |
if ( $issue && $issue->borrowernumber eq $borrower->{'borrowernumber'} ){ |
| 836 |
|
| 837 |
# Already issued to current borrower. |
| 838 |
# If it is an on-site checkout if it can be switched to a normal checkout |
| 839 |
# or ask whether the loan should be renewed |
| 840 |
|
| 841 |
if ( $issue->onsite_checkout |
| 842 |
and C4::Context->preference('SwitchOnSiteCheckouts') ) { |
| 843 |
$messages{ONSITE_CHECKOUT_WILL_BE_SWITCHED} = 1; |
| 844 |
} else { |
| 845 |
my ($CanBookBeRenewed,$renewerror) = CanBookBeRenewed( |
| 846 |
$borrower->{'borrowernumber'}, |
| 847 |
$item->{'itemnumber'}, |
| 848 |
); |
| 849 |
if ( $CanBookBeRenewed == 0 ) { # no more renewals allowed |
| 850 |
if ( $renewerror eq 'onsite_checkout' ) { |
| 851 |
$issuingimpossible{NO_RENEWAL_FOR_ONSITE_CHECKOUTS} = 1; |
| 852 |
} |
| 853 |
else { |
| 854 |
$issuingimpossible{NO_MORE_RENEWALS} = 1; |
| 855 |
} |
| 856 |
} |
| 857 |
else { |
| 858 |
$needsconfirmation{RENEW_ISSUE} = 1; |
| 859 |
} |
| 860 |
} |
| 861 |
} |
| 862 |
elsif ( $issue ) { |
| 863 |
|
| 864 |
# issued to someone else |
| 865 |
|
| 866 |
my $patron = Koha::Patrons->find( $issue->borrowernumber ); |
| 867 |
|
| 868 |
my ( $can_be_returned, $message ) = CanBookBeReturned( $item, C4::Context->userenv->{branch} ); |
| 869 |
|
| 870 |
unless ( $can_be_returned ) { |
| 871 |
$issuingimpossible{RETURN_IMPOSSIBLE} = 1; |
| 872 |
$issuingimpossible{branch_to_return} = $message; |
| 873 |
} else { |
| 874 |
$needsconfirmation{ISSUED_TO_ANOTHER} = 1; |
| 875 |
$needsconfirmation{issued_firstname} = $patron->firstname; |
| 876 |
$needsconfirmation{issued_surname} = $patron->surname; |
| 877 |
$needsconfirmation{issued_cardnumber} = $patron->cardnumber; |
| 878 |
$needsconfirmation{issued_borrowernumber} = $patron->borrowernumber; |
| 879 |
} |
| 880 |
} |
| 881 |
|
| 832 |
# JB34 CHECKS IF BORROWERS DON'T HAVE ISSUE TOO MANY BOOKS |
882 |
# JB34 CHECKS IF BORROWERS DON'T HAVE ISSUE TOO MANY BOOKS |
| 833 |
# |
883 |
# |
| 834 |
my $switch_onsite_checkout = ( |
884 |
my $switch_onsite_checkout = ( |
|
Lines 838-844
sub CanBookBeIssued {
Link Here
|
| 838 |
and $issue->borrowernumber == $borrower->{'borrowernumber'} ? 1 : 0 ); |
888 |
and $issue->borrowernumber == $borrower->{'borrowernumber'} ? 1 : 0 ); |
| 839 |
my $toomany = TooMany( $borrower, $item->{biblionumber}, $item, { onsite_checkout => $onsite_checkout, switch_onsite_checkout => $switch_onsite_checkout, } ); |
889 |
my $toomany = TooMany( $borrower, $item->{biblionumber}, $item, { onsite_checkout => $onsite_checkout, switch_onsite_checkout => $switch_onsite_checkout, } ); |
| 840 |
# if TooMany max_allowed returns 0 the user doesn't have permission to check out this book |
890 |
# if TooMany max_allowed returns 0 the user doesn't have permission to check out this book |
| 841 |
if ( $toomany ) { |
891 |
if ( $toomany & !$needsconfirmation{RENEW_ISSUE} ) { |
| 842 |
if ( $toomany->{max_allowed} == 0 ) { |
892 |
if ( $toomany->{max_allowed} == 0 ) { |
| 843 |
$needsconfirmation{PATRON_CANT} = 1; |
893 |
$needsconfirmation{PATRON_CANT} = 1; |
| 844 |
} |
894 |
} |
|
Lines 939-994
sub CanBookBeIssued {
Link Here
|
| 939 |
} |
989 |
} |
| 940 |
} |
990 |
} |
| 941 |
|
991 |
|
| 942 |
# |
|
|
| 943 |
# CHECK IF BOOK ALREADY ISSUED TO THIS BORROWER |
| 944 |
# |
| 945 |
if ( $issue && $issue->borrowernumber eq $borrower->{'borrowernumber'} ){ |
| 946 |
|
| 947 |
# Already issued to current borrower. |
| 948 |
# If it is an on-site checkout if it can be switched to a normal checkout |
| 949 |
# or ask whether the loan should be renewed |
| 950 |
|
| 951 |
if ( $issue->onsite_checkout |
| 952 |
and C4::Context->preference('SwitchOnSiteCheckouts') ) { |
| 953 |
$messages{ONSITE_CHECKOUT_WILL_BE_SWITCHED} = 1; |
| 954 |
} else { |
| 955 |
my ($CanBookBeRenewed,$renewerror) = CanBookBeRenewed( |
| 956 |
$borrower->{'borrowernumber'}, |
| 957 |
$item->{'itemnumber'}, |
| 958 |
); |
| 959 |
if ( $CanBookBeRenewed == 0 ) { # no more renewals allowed |
| 960 |
if ( $renewerror eq 'onsite_checkout' ) { |
| 961 |
$issuingimpossible{NO_RENEWAL_FOR_ONSITE_CHECKOUTS} = 1; |
| 962 |
} |
| 963 |
else { |
| 964 |
$issuingimpossible{NO_MORE_RENEWALS} = 1; |
| 965 |
} |
| 966 |
} |
| 967 |
else { |
| 968 |
$needsconfirmation{RENEW_ISSUE} = 1; |
| 969 |
} |
| 970 |
} |
| 971 |
} |
| 972 |
elsif ( $issue ) { |
| 973 |
|
| 974 |
# issued to someone else |
| 975 |
|
| 976 |
my $patron = Koha::Patrons->find( $issue->borrowernumber ); |
| 977 |
|
| 978 |
my ( $can_be_returned, $message ) = CanBookBeReturned( $item, C4::Context->userenv->{branch} ); |
| 979 |
|
| 980 |
unless ( $can_be_returned ) { |
| 981 |
$issuingimpossible{RETURN_IMPOSSIBLE} = 1; |
| 982 |
$issuingimpossible{branch_to_return} = $message; |
| 983 |
} else { |
| 984 |
$needsconfirmation{ISSUED_TO_ANOTHER} = 1; |
| 985 |
$needsconfirmation{issued_firstname} = $patron->firstname; |
| 986 |
$needsconfirmation{issued_surname} = $patron->surname; |
| 987 |
$needsconfirmation{issued_cardnumber} = $patron->cardnumber; |
| 988 |
$needsconfirmation{issued_borrowernumber} = $patron->borrowernumber; |
| 989 |
} |
| 990 |
} |
| 991 |
|
| 992 |
unless ( $ignore_reserves ) { |
992 |
unless ( $ignore_reserves ) { |
| 993 |
# See if the item is on reserve. |
993 |
# See if the item is on reserve. |
| 994 |
my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ); |
994 |
my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ); |
| 995 |
- |
|
|