Lines 818-824
sub CanBookBeIssued {
Link Here
|
818 |
my $circ_library = Koha::Libraries->find( _GetCircControlBranch( $item_object, $patron ) ); |
818 |
my $circ_library = Koha::Libraries->find( _GetCircControlBranch( $item_object, $patron ) ); |
819 |
|
819 |
|
820 |
my $now = dt_from_string(); |
820 |
my $now = dt_from_string(); |
821 |
my $message; |
|
|
822 |
my @message_log; |
821 |
my @message_log; |
823 |
|
822 |
|
824 |
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron ); |
823 |
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron ); |
Lines 826-839
sub CanBookBeIssued {
Link Here
|
826 |
if ( DateTime->compare( $duedate, $now ) == -1 ) { # duedate cannot be before now |
825 |
if ( DateTime->compare( $duedate, $now ) == -1 ) { # duedate cannot be before now |
827 |
$needsconfirmation{INVALID_DATE} = $duedate; |
826 |
$needsconfirmation{INVALID_DATE} = $duedate; |
828 |
if ($issueconfirmed) { |
827 |
if ($issueconfirmed) { |
829 |
if ($message) { |
|
|
830 |
$message = "$message + sticky due date is invalid or due date in the past"; |
831 |
} else { |
832 |
$message = "sticky due date is invalid or due date in the past"; |
833 |
} |
834 |
push( @message_log, "sticky due date is invalid or due date in the past" ); |
828 |
push( @message_log, "sticky due date is invalid or due date in the past" ); |
835 |
} |
829 |
} |
836 |
|
|
|
837 |
} |
830 |
} |
838 |
|
831 |
|
839 |
my $fees = Koha::Charges::Fees->new( |
832 |
my $fees = Koha::Charges::Fees->new( |
Lines 880-890
sub CanBookBeIssued {
Link Here
|
880 |
if ( $patron->is_debarred ) { |
873 |
if ( $patron->is_debarred ) { |
881 |
$issuingimpossible{DEBARRED} = 1; |
874 |
$issuingimpossible{DEBARRED} = 1; |
882 |
if ($issueconfirmed) { |
875 |
if ($issueconfirmed) { |
883 |
if ($message) { |
|
|
884 |
$message = "$message + borrower is restricted"; |
885 |
} else { |
886 |
$message = "borrower is restricted"; |
887 |
} |
888 |
push( @message_log, "borrower is restricted" ); |
876 |
push( @message_log, "borrower is restricted" ); |
889 |
} |
877 |
} |
890 |
} |
878 |
} |
Lines 960-970
sub CanBookBeIssued {
Link Here
|
960 |
if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && $allowfineoverride ) { |
948 |
if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && $allowfineoverride ) { |
961 |
$needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
949 |
$needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
962 |
if ($issueconfirmed) { |
950 |
if ($issueconfirmed) { |
963 |
if ($message) { |
|
|
964 |
$message = "$message + borrower had amend"; |
965 |
} else { |
966 |
$message = "borrower had amend"; |
967 |
} |
968 |
push( @message_log, "borrower had amend" ); |
951 |
push( @message_log, "borrower had amend" ); |
969 |
} |
952 |
} |
970 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) { |
953 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) { |
Lines 972-982
sub CanBookBeIssued {
Link Here
|
972 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{charge} > 0 && $allfinesneedoverride ) { |
955 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{charge} > 0 && $allfinesneedoverride ) { |
973 |
$needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
956 |
$needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
974 |
if ($issueconfirmed) { |
957 |
if ($issueconfirmed) { |
975 |
if ($message) { |
|
|
976 |
$message = "$message + borrower had amend"; |
977 |
} else { |
978 |
$message = "borrower had amend"; |
979 |
} |
980 |
push( @message_log, "borrower had amend" ); |
958 |
push( @message_log, "borrower had amend" ); |
981 |
} |
959 |
} |
982 |
} |
960 |
} |
Lines 1060-1070
sub CanBookBeIssued {
Link Here
|
1060 |
$needsconfirmation{issued_cardnumber} = $patron->cardnumber; |
1038 |
$needsconfirmation{issued_cardnumber} = $patron->cardnumber; |
1061 |
$needsconfirmation{issued_borrowernumber} = $patron->borrowernumber; |
1039 |
$needsconfirmation{issued_borrowernumber} = $patron->borrowernumber; |
1062 |
if ($issueconfirmed) { |
1040 |
if ($issueconfirmed) { |
1063 |
if ($message) { |
|
|
1064 |
$message = "$message + item is checked out for someone else "; |
1065 |
} else { |
1066 |
$message = "item is checked out for someone else"; |
1067 |
} |
1068 |
push( @message_log, "item is checked out for someone else" ); |
1041 |
push( @message_log, "item is checked out for someone else" ); |
1069 |
} |
1042 |
} |
1070 |
} |
1043 |
} |
Lines 1095-1105
sub CanBookBeIssued {
Link Here
|
1095 |
$needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; |
1068 |
$needsconfirmation{max_loans_allowed} = $toomany->{max_allowed}; |
1096 |
$needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; |
1069 |
$needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule}; |
1097 |
if ($issueconfirmed) { |
1070 |
if ($issueconfirmed) { |
1098 |
if ($message) { |
|
|
1099 |
$message = "$message + too many checkout"; |
1100 |
} else { |
1101 |
$message = "too many checkout"; |
1102 |
} |
1103 |
push( @message_log, "too many checkout" ); |
1071 |
push( @message_log, "too many checkout" ); |
1104 |
} |
1072 |
} |
1105 |
} else { |
1073 |
} else { |
Lines 1130-1140
sub CanBookBeIssued {
Link Here
|
1130 |
$needsconfirmation{NOT_FOR_LOAN_FORCING} = 1; |
1098 |
$needsconfirmation{NOT_FOR_LOAN_FORCING} = 1; |
1131 |
$needsconfirmation{item_notforloan} = $item_object->notforloan; |
1099 |
$needsconfirmation{item_notforloan} = $item_object->notforloan; |
1132 |
if ($issueconfirmed) { |
1100 |
if ($issueconfirmed) { |
1133 |
if ($message) { |
|
|
1134 |
$message = "$message + item not for loan"; |
1135 |
} else { |
1136 |
$message = "item not for loan"; |
1137 |
} |
1138 |
push( @message_log, "item not for loan" ); |
1101 |
push( @message_log, "item not for loan" ); |
1139 |
} |
1102 |
} |
1140 |
} |
1103 |
} |
Lines 1183-1193
sub CanBookBeIssued {
Link Here
|
1183 |
$needsconfirmation{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'confirm' ); |
1146 |
$needsconfirmation{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'confirm' ); |
1184 |
$alerts{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' ); |
1147 |
$alerts{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' ); |
1185 |
if ($issueconfirmed) { |
1148 |
if ($issueconfirmed) { |
1186 |
if ($message) { |
|
|
1187 |
$message = "$message + item lost"; |
1188 |
} else { |
1189 |
$message = "item lost"; |
1190 |
} |
1191 |
push( @message_log, "item lost" ); |
1149 |
push( @message_log, "item lost" ); |
1192 |
} |
1150 |
} |
1193 |
} |
1151 |
} |
Lines 1292-1303
sub CanBookBeIssued {
Link Here
|
1292 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1250 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1293 |
|
1251 |
|
1294 |
if ($issueconfirmed) { |
1252 |
if ($issueconfirmed) { |
1295 |
if ($message) { |
|
|
1296 |
$message = |
1297 |
"$message + item is on reserve and waiting, but has been reserved by some other patron."; |
1298 |
} else { |
1299 |
$message = "item is on reserve and waiting, but has been reserved by some other patron."; |
1300 |
} |
1301 |
push( |
1253 |
push( |
1302 |
@message_log, |
1254 |
@message_log, |
1303 |
"item is on reserve and waiting, but has been reserved by some other patron" |
1255 |
"item is on reserve and waiting, but has been reserved by some other patron" |
Lines 1316-1326
sub CanBookBeIssued {
Link Here
|
1316 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1268 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1317 |
|
1269 |
|
1318 |
if ($issueconfirmed) { |
1270 |
if ($issueconfirmed) { |
1319 |
if ($message) { |
|
|
1320 |
$message = "$message + item is on reserve for someone else"; |
1321 |
} else { |
1322 |
$message = "item is on reserve for someone else"; |
1323 |
} |
1324 |
push( @message_log, "item is on reserve for someone else" ); |
1271 |
push( @message_log, "item is on reserve for someone else" ); |
1325 |
} |
1272 |
} |
1326 |
} elsif ( $restype eq "Transferred" ) { |
1273 |
} elsif ( $restype eq "Transferred" ) { |
Lines 1336-1346
sub CanBookBeIssued {
Link Here
|
1336 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1283 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1337 |
|
1284 |
|
1338 |
if ($issueconfirmed) { |
1285 |
if ($issueconfirmed) { |
1339 |
if ($message) { |
|
|
1340 |
$message = "$message + item is determined hold being transferred for someone else"; |
1341 |
} else { |
1342 |
$message = "item is determined hold being transferred for someone else"; |
1343 |
} |
1344 |
push( @message_log, "item is determined hold being transferred for someone else" ); |
1286 |
push( @message_log, "item is determined hold being transferred for someone else" ); |
1345 |
} |
1287 |
} |
1346 |
} elsif ( $restype eq "Processing" ) { |
1288 |
} elsif ( $restype eq "Processing" ) { |
Lines 1356-1366
sub CanBookBeIssued {
Link Here
|
1356 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1298 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1357 |
|
1299 |
|
1358 |
if ($issueconfirmed) { |
1300 |
if ($issueconfirmed) { |
1359 |
if ($message) { |
|
|
1360 |
$message = "$message + item is determined hold being processed for someone else"; |
1361 |
} else { |
1362 |
$message = "item is determined hold being processed for someone else"; |
1363 |
} |
1364 |
push( @message_log, "item is determined hold being processed for someone else" ); |
1301 |
push( @message_log, "item is determined hold being processed for someone else" ); |
1365 |
} |
1302 |
} |
1366 |
} |
1303 |
} |
Lines 1407-1417
sub CanBookBeIssued {
Link Here
|
1407 |
if ( C4::Context->preference('AgeRestrictionOverride') ) { |
1344 |
if ( C4::Context->preference('AgeRestrictionOverride') ) { |
1408 |
$needsconfirmation{AGE_RESTRICTION} = "$agerestriction"; |
1345 |
$needsconfirmation{AGE_RESTRICTION} = "$agerestriction"; |
1409 |
if ($issueconfirmed) { |
1346 |
if ($issueconfirmed) { |
1410 |
if ($message) { |
|
|
1411 |
$message = "$message + age restriction"; |
1412 |
} else { |
1413 |
$message = "age restriction"; |
1414 |
} |
1415 |
push( @message_log, "age restriction" ); |
1347 |
push( @message_log, "age restriction" ); |
1416 |
} |
1348 |
} |
1417 |
} else { |
1349 |
} else { |