Lines 825-831
sub CanBookBeIssued {
Link Here
|
825 |
my $circ_library = Koha::Libraries->find( _GetCircControlBranch( $item_object, $patron ) ); |
825 |
my $circ_library = Koha::Libraries->find( _GetCircControlBranch( $item_object, $patron ) ); |
826 |
|
826 |
|
827 |
my $now = dt_from_string(); |
827 |
my $now = dt_from_string(); |
828 |
my $message; |
|
|
829 |
my @message_log; |
828 |
my @message_log; |
830 |
|
829 |
|
831 |
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron ); |
830 |
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron ); |
Lines 833-846
sub CanBookBeIssued {
Link Here
|
833 |
if ( DateTime->compare( $duedate, $now ) == -1 ) { # duedate cannot be before now |
832 |
if ( DateTime->compare( $duedate, $now ) == -1 ) { # duedate cannot be before now |
834 |
$needsconfirmation{INVALID_DATE} = $duedate; |
833 |
$needsconfirmation{INVALID_DATE} = $duedate; |
835 |
if ($issueconfirmed) { |
834 |
if ($issueconfirmed) { |
836 |
if ($message) { |
|
|
837 |
$message = "$message + sticky due date is invalid or due date in the past"; |
838 |
} else { |
839 |
$message = "sticky due date is invalid or due date in the past"; |
840 |
} |
841 |
push( @message_log, "sticky due date is invalid or due date in the past" ); |
835 |
push( @message_log, "sticky due date is invalid or due date in the past" ); |
842 |
} |
836 |
} |
843 |
|
|
|
844 |
} |
837 |
} |
845 |
|
838 |
|
846 |
my $fees = Koha::Charges::Fees->new( |
839 |
my $fees = Koha::Charges::Fees->new( |
Lines 887-897
sub CanBookBeIssued {
Link Here
|
887 |
if ( $patron->is_debarred ) { |
880 |
if ( $patron->is_debarred ) { |
888 |
$issuingimpossible{DEBARRED} = 1; |
881 |
$issuingimpossible{DEBARRED} = 1; |
889 |
if ($issueconfirmed) { |
882 |
if ($issueconfirmed) { |
890 |
if ($message) { |
|
|
891 |
$message = "$message + borrower is restricted"; |
892 |
} else { |
893 |
$message = "borrower is restricted"; |
894 |
} |
895 |
push( @message_log, "borrower is restricted" ); |
883 |
push( @message_log, "borrower is restricted" ); |
896 |
} |
884 |
} |
897 |
} |
885 |
} |
Lines 967-977
sub CanBookBeIssued {
Link Here
|
967 |
if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && $allowfineoverride ) { |
955 |
if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && $allowfineoverride ) { |
968 |
$needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
956 |
$needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
969 |
if ($issueconfirmed) { |
957 |
if ($issueconfirmed) { |
970 |
if ($message) { |
|
|
971 |
$message = "$message + borrower had amend"; |
972 |
} else { |
973 |
$message = "borrower had amend"; |
974 |
} |
975 |
push( @message_log, "borrower had amend" ); |
958 |
push( @message_log, "borrower had amend" ); |
976 |
} |
959 |
} |
977 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) { |
960 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) { |
Lines 979-989
sub CanBookBeIssued {
Link Here
|
979 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{charge} > 0 && $allfinesneedoverride ) { |
962 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{charge} > 0 && $allfinesneedoverride ) { |
980 |
$needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
963 |
$needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
981 |
if ($issueconfirmed) { |
964 |
if ($issueconfirmed) { |
982 |
if ($message) { |
|
|
983 |
$message = "$message + borrower had amend"; |
984 |
} else { |
985 |
$message = "borrower had amend"; |
986 |
} |
987 |
push( @message_log, "borrower had amend" ); |
965 |
push( @message_log, "borrower had amend" ); |
988 |
} |
966 |
} |
989 |
} |
967 |
} |
Lines 1067-1077
sub CanBookBeIssued {
Link Here
|
1067 |
$needsconfirmation{issued_cardnumber} = $patron->cardnumber; |
1045 |
$needsconfirmation{issued_cardnumber} = $patron->cardnumber; |
1068 |
$needsconfirmation{issued_borrowernumber} = $patron->borrowernumber; |
1046 |
$needsconfirmation{issued_borrowernumber} = $patron->borrowernumber; |
1069 |
if ($issueconfirmed) { |
1047 |
if ($issueconfirmed) { |
1070 |
if ($message) { |
|
|
1071 |
$message = "$message + item is checked out for someone else "; |
1072 |
} else { |
1073 |
$message = "item is checked out for someone else"; |
1074 |
} |
1075 |
push( @message_log, "item is checked out for someone else" ); |
1048 |
push( @message_log, "item is checked out for someone else" ); |
1076 |
} |
1049 |
} |
1077 |
} |
1050 |
} |
Lines 1102-1112
sub CanBookBeIssued {
Link Here
|
1102 |
$needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; |
1075 |
$needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; |
1103 |
$needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; |
1076 |
$needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; |
1104 |
if ($issueconfirmed) { |
1077 |
if ($issueconfirmed) { |
1105 |
if ($message) { |
|
|
1106 |
$message = "$message + too many checkout"; |
1107 |
} else { |
1108 |
$message = "too many checkout"; |
1109 |
} |
1110 |
push( @message_log, "too many checkout" ); |
1078 |
push( @message_log, "too many checkout" ); |
1111 |
} |
1079 |
} |
1112 |
} else { |
1080 |
} else { |
Lines 1142-1152
sub CanBookBeIssued {
Link Here
|
1142 |
$needsconfirmation{NOT_FOR_LOAN_FORCING} = 1; |
1110 |
$needsconfirmation{NOT_FOR_LOAN_FORCING} = 1; |
1143 |
$needsconfirmation{item_notforloan} = $item_object->notforloan; |
1111 |
$needsconfirmation{item_notforloan} = $item_object->notforloan; |
1144 |
if ($issueconfirmed) { |
1112 |
if ($issueconfirmed) { |
1145 |
if ($message) { |
|
|
1146 |
$message = "$message + item not for loan"; |
1147 |
} else { |
1148 |
$message = "item not for loan"; |
1149 |
} |
1150 |
push( @message_log, "item not for loan" ); |
1113 |
push( @message_log, "item not for loan" ); |
1151 |
} |
1114 |
} |
1152 |
} |
1115 |
} |
Lines 1195-1205
sub CanBookBeIssued {
Link Here
|
1195 |
$needsconfirmation{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'confirm' ); |
1158 |
$needsconfirmation{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'confirm' ); |
1196 |
$alerts{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' ); |
1159 |
$alerts{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' ); |
1197 |
if ($issueconfirmed) { |
1160 |
if ($issueconfirmed) { |
1198 |
if ($message) { |
|
|
1199 |
$message = "$message + item lost"; |
1200 |
} else { |
1201 |
$message = "item lost"; |
1202 |
} |
1203 |
push( @message_log, "item lost" ); |
1161 |
push( @message_log, "item lost" ); |
1204 |
} |
1162 |
} |
1205 |
} |
1163 |
} |
Lines 1304-1315
sub CanBookBeIssued {
Link Here
|
1304 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1262 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1305 |
|
1263 |
|
1306 |
if ($issueconfirmed) { |
1264 |
if ($issueconfirmed) { |
1307 |
if ($message) { |
|
|
1308 |
$message = |
1309 |
"$message + item is on reserve and waiting, but has been reserved by some other patron."; |
1310 |
} else { |
1311 |
$message = "item is on reserve and waiting, but has been reserved by some other patron."; |
1312 |
} |
1313 |
push( |
1265 |
push( |
1314 |
@message_log, |
1266 |
@message_log, |
1315 |
"item is on reserve and waiting, but has been reserved by some other patron" |
1267 |
"item is on reserve and waiting, but has been reserved by some other patron" |
Lines 1328-1338
sub CanBookBeIssued {
Link Here
|
1328 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1280 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1329 |
|
1281 |
|
1330 |
if ($issueconfirmed) { |
1282 |
if ($issueconfirmed) { |
1331 |
if ($message) { |
|
|
1332 |
$message = "$message + item is on reserve for someone else"; |
1333 |
} else { |
1334 |
$message = "item is on reserve for someone else"; |
1335 |
} |
1336 |
push( @message_log, "item is on reserve for someone else" ); |
1283 |
push( @message_log, "item is on reserve for someone else" ); |
1337 |
} |
1284 |
} |
1338 |
} elsif ( $restype eq "Transferred" ) { |
1285 |
} elsif ( $restype eq "Transferred" ) { |
Lines 1348-1358
sub CanBookBeIssued {
Link Here
|
1348 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1295 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1349 |
|
1296 |
|
1350 |
if ($issueconfirmed) { |
1297 |
if ($issueconfirmed) { |
1351 |
if ($message) { |
|
|
1352 |
$message = "$message + item is determined hold being transferred for someone else"; |
1353 |
} else { |
1354 |
$message = "item is determined hold being transferred for someone else"; |
1355 |
} |
1356 |
push( @message_log, "item is determined hold being transferred for someone else" ); |
1298 |
push( @message_log, "item is determined hold being transferred for someone else" ); |
1357 |
} |
1299 |
} |
1358 |
} elsif ( $restype eq "Processing" ) { |
1300 |
} elsif ( $restype eq "Processing" ) { |
Lines 1368-1378
sub CanBookBeIssued {
Link Here
|
1368 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1310 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1369 |
|
1311 |
|
1370 |
if ($issueconfirmed) { |
1312 |
if ($issueconfirmed) { |
1371 |
if ($message) { |
|
|
1372 |
$message = "$message + item is determined hold being processed for someone else"; |
1373 |
} else { |
1374 |
$message = "item is determined hold being processed for someone else"; |
1375 |
} |
1376 |
push( @message_log, "item is determined hold being processed for someone else" ); |
1313 |
push( @message_log, "item is determined hold being processed for someone else" ); |
1377 |
} |
1314 |
} |
1378 |
} |
1315 |
} |
Lines 1419-1429
sub CanBookBeIssued {
Link Here
|
1419 |
if ( C4::Context->preference('AgeRestrictionOverride') ) { |
1356 |
if ( C4::Context->preference('AgeRestrictionOverride') ) { |
1420 |
$needsconfirmation{AGE_RESTRICTION} = "$agerestriction"; |
1357 |
$needsconfirmation{AGE_RESTRICTION} = "$agerestriction"; |
1421 |
if ($issueconfirmed) { |
1358 |
if ($issueconfirmed) { |
1422 |
if ($message) { |
|
|
1423 |
$message = "$message + age restriction"; |
1424 |
} else { |
1425 |
$message = "age restriction"; |
1426 |
} |
1427 |
push( @message_log, "age restriction" ); |
1359 |
push( @message_log, "age restriction" ); |
1428 |
} |
1360 |
} |
1429 |
} else { |
1361 |
} else { |