Lines 22-27
use Modern::Perl;
Link Here
|
22 |
use DateTime; |
22 |
use DateTime; |
23 |
use POSIX qw( floor ); |
23 |
use POSIX qw( floor ); |
24 |
use Encode; |
24 |
use Encode; |
|
|
25 |
use JSON; |
25 |
|
26 |
|
26 |
use C4::Context; |
27 |
use C4::Context; |
27 |
use C4::Stats qw( UpdateStats ); |
28 |
use C4::Stats qw( UpdateStats ); |
Lines 317-322
A recall for this item was found, and the item needs to be transferred to the re
Link Here
|
317 |
|
318 |
|
318 |
=cut |
319 |
=cut |
319 |
|
320 |
|
|
|
321 |
my $query = CGI->new; |
322 |
|
323 |
my $stickyduedate = $query->param('stickyduedate'); |
324 |
my $duedatespec = $query->param('duedatespec'); |
325 |
my $restoreduedatespec = $query->param('restoreduedatespec') || $duedatespec; |
326 |
if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) { |
327 |
undef $restoreduedatespec; |
328 |
} |
329 |
my $issueconfirmed = $query->param('issueconfirmed'); |
330 |
my $cancelreserve = $query->param('cancelreserve'); |
331 |
my $cancel_recall = $query->param('cancel_recall'); |
332 |
my $recall_id = $query->param('recall_id'); |
333 |
my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice |
334 |
my $charges = $query->param('charges') || q{}; |
335 |
|
320 |
sub transferbook { |
336 |
sub transferbook { |
321 |
my $params = shift; |
337 |
my $params = shift; |
322 |
my $tbr = $params->{to_branch}; |
338 |
my $tbr = $params->{to_branch}; |
Lines 803-811
sub CanBookBeIssued {
Link Here
|
803 |
|
819 |
|
804 |
my $now = dt_from_string(); |
820 |
my $now = dt_from_string(); |
805 |
my $message; |
821 |
my $message; |
|
|
822 |
<<<<<<< HEAD |
806 |
my @message_log; |
823 |
my @message_log; |
|
|
824 |
======= |
825 |
my @message; |
826 |
>>>>>>> Bug 9762: Log circulation overrides |
807 |
|
827 |
|
808 |
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron ); |
828 |
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron ); |
|
|
829 |
|
809 |
if (DateTime->compare($duedate,$now) == -1 ) { # duedate cannot be before now |
830 |
if (DateTime->compare($duedate,$now) == -1 ) { # duedate cannot be before now |
810 |
$needsconfirmation{INVALID_DATE} = $duedate; |
831 |
$needsconfirmation{INVALID_DATE} = $duedate; |
811 |
if ($issueconfirmed) { |
832 |
if ($issueconfirmed) { |
Lines 814-820
sub CanBookBeIssued {
Link Here
|
814 |
} else { |
835 |
} else { |
815 |
$message = "sticky due date is invalid or due date in the past"; |
836 |
$message = "sticky due date is invalid or due date in the past"; |
816 |
} |
837 |
} |
|
|
838 |
<<<<<<< HEAD |
817 |
push( @message_log, "sticky due date is invalid or due date in the past" ); |
839 |
push( @message_log, "sticky due date is invalid or due date in the past" ); |
|
|
840 |
======= |
841 |
push( @message, "sticky due date is invalid or due date in the past" ); |
842 |
>>>>>>> Bug 9762: Log circulation overrides |
818 |
} |
843 |
} |
819 |
|
844 |
|
820 |
} |
845 |
} |
Lines 867-873
sub CanBookBeIssued {
Link Here
|
867 |
} else { |
892 |
} else { |
868 |
$message = "borrower is restricted"; |
893 |
$message = "borrower is restricted"; |
869 |
} |
894 |
} |
|
|
895 |
<<<<<<< HEAD |
870 |
push( @message_log, "borrower is restricted" ); |
896 |
push( @message_log, "borrower is restricted" ); |
|
|
897 |
======= |
898 |
push( @message, "borrower is restricted" ); |
899 |
>>>>>>> Bug 9762: Log circulation overrides |
871 |
} |
900 |
} |
872 |
} |
901 |
} |
873 |
|
902 |
|
Lines 947-953
sub CanBookBeIssued {
Link Here
|
947 |
} else { |
976 |
} else { |
948 |
$message = "borrower had amend"; |
977 |
$message = "borrower had amend"; |
949 |
} |
978 |
} |
|
|
979 |
<<<<<<< HEAD |
950 |
push( @message_log, "borrower had amend" ); |
980 |
push( @message_log, "borrower had amend" ); |
|
|
981 |
======= |
982 |
push( @message, "borrower had amend" ); |
983 |
>>>>>>> Bug 9762: Log circulation overrides |
951 |
} |
984 |
} |
952 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) { |
985 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) { |
953 |
$issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
986 |
$issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
Lines 959-965
sub CanBookBeIssued {
Link Here
|
959 |
} else { |
992 |
} else { |
960 |
$message = "borrower had amend"; |
993 |
$message = "borrower had amend"; |
961 |
} |
994 |
} |
|
|
995 |
<<<<<<< HEAD |
962 |
push( @message_log, "borrower had amend" ); |
996 |
push( @message_log, "borrower had amend" ); |
|
|
997 |
======= |
998 |
push( @message, "borrower had amend" ); |
999 |
>>>>>>> Bug 9762: Log circulation overrides |
963 |
} |
1000 |
} |
964 |
} |
1001 |
} |
965 |
} |
1002 |
} |
Lines 1038-1045
sub CanBookBeIssued {
Link Here
|
1038 |
} else { |
1075 |
} else { |
1039 |
if ( C4::Context->preference('AutoReturnCheckedOutItems') ) { |
1076 |
if ( C4::Context->preference('AutoReturnCheckedOutItems') ) { |
1040 |
$alerts{RETURNED_FROM_ANOTHER} = { patron => $patron }; |
1077 |
$alerts{RETURNED_FROM_ANOTHER} = { patron => $patron }; |
1041 |
} |
1078 |
} else { |
1042 |
else { |
|
|
1043 |
$needsconfirmation{ISSUED_TO_ANOTHER} = 1; |
1079 |
$needsconfirmation{ISSUED_TO_ANOTHER} = 1; |
1044 |
$needsconfirmation{issued_firstname} = $patron->firstname; |
1080 |
$needsconfirmation{issued_firstname} = $patron->firstname; |
1045 |
$needsconfirmation{issued_surname} = $patron->surname; |
1081 |
$needsconfirmation{issued_surname} = $patron->surname; |
Lines 1051-1057
sub CanBookBeIssued {
Link Here
|
1051 |
} else { |
1087 |
} else { |
1052 |
$message = "item is checked out for someone else"; |
1088 |
$message = "item is checked out for someone else"; |
1053 |
} |
1089 |
} |
|
|
1090 |
<<<<<<< HEAD |
1054 |
push( @message_log, "item is checked out for someone else" ); |
1091 |
push( @message_log, "item is checked out for someone else" ); |
|
|
1092 |
======= |
1093 |
push( @message, "item is checked out for someone else" ); |
1094 |
>>>>>>> Bug 9762: Log circulation overrides |
1055 |
} |
1095 |
} |
1056 |
} |
1096 |
} |
1057 |
} |
1097 |
} |
Lines 1082-1088
sub CanBookBeIssued {
Link Here
|
1082 |
} else { |
1122 |
} else { |
1083 |
$message = "too many checkout"; |
1123 |
$message = "too many checkout"; |
1084 |
} |
1124 |
} |
|
|
1125 |
<<<<<<< HEAD |
1085 |
push( @message_log, "too many checkout" ); |
1126 |
push( @message_log, "too many checkout" ); |
|
|
1127 |
======= |
1128 |
push( @message, "too many checkout" ); |
1129 |
>>>>>>> Bug 9762: Log circulation overrides |
1086 |
} |
1130 |
} |
1087 |
} else { |
1131 |
} else { |
1088 |
$issuingimpossible{TOO_MANY} = $toomany->{reason}; |
1132 |
$issuingimpossible{TOO_MANY} = $toomany->{reason}; |
Lines 1117-1123
sub CanBookBeIssued {
Link Here
|
1117 |
} else { |
1161 |
} else { |
1118 |
$message = "item not for loan"; |
1162 |
$message = "item not for loan"; |
1119 |
} |
1163 |
} |
|
|
1164 |
<<<<<<< HEAD |
1120 |
push( @message_log, "item not for loan" ); |
1165 |
push( @message_log, "item not for loan" ); |
|
|
1166 |
======= |
1167 |
push( @message, "item not for loan" ); |
1168 |
>>>>>>> Bug 9762: Log circulation overrides |
1121 |
} |
1169 |
} |
1122 |
} |
1170 |
} |
1123 |
} |
1171 |
} |
Lines 1171-1177
sub CanBookBeIssued {
Link Here
|
1171 |
} else { |
1219 |
} else { |
1172 |
$message = "item lost"; |
1220 |
$message = "item lost"; |
1173 |
} |
1221 |
} |
|
|
1222 |
<<<<<<< HEAD |
1174 |
push( @message_log, "item lost" ); |
1223 |
push( @message_log, "item lost" ); |
|
|
1224 |
======= |
1225 |
push( @message, "item lost" ); |
1226 |
>>>>>>> Bug 9762: Log circulation overrides |
1175 |
} |
1227 |
} |
1176 |
} |
1228 |
} |
1177 |
if ( C4::Context->preference("IndependentBranches") ) { |
1229 |
if ( C4::Context->preference("IndependentBranches") ) { |
Lines 1276-1285
sub CanBookBeIssued {
Link Here
|
1276 |
} else { |
1328 |
} else { |
1277 |
$message = "item is on reserve and waiting, but has been reserved by some other patron."; |
1329 |
$message = "item is on reserve and waiting, but has been reserved by some other patron."; |
1278 |
} |
1330 |
} |
|
|
1331 |
<<<<<<< HEAD |
1279 |
push( |
1332 |
push( |
1280 |
@message_log, |
1333 |
@message_log, |
1281 |
"item is on reserve and waiting, but has been reserved by some other patron" |
1334 |
"item is on reserve and waiting, but has been reserved by some other patron" |
1282 |
); |
1335 |
); |
|
|
1336 |
======= |
1337 |
push( @message, "item is on reserve and waiting, but has been reserved by some other patron" ); |
1338 |
>>>>>>> Bug 9762: Log circulation overrides |
1283 |
} |
1339 |
} |
1284 |
} |
1340 |
} |
1285 |
elsif ( $restype eq "Reserved" ) { |
1341 |
elsif ( $restype eq "Reserved" ) { |
Lines 1298-1304
sub CanBookBeIssued {
Link Here
|
1298 |
} else { |
1354 |
} else { |
1299 |
$message = "item is on reserve for someone else"; |
1355 |
$message = "item is on reserve for someone else"; |
1300 |
} |
1356 |
} |
|
|
1357 |
<<<<<<< HEAD |
1301 |
push( @message_log, "item is on reserve for someone else" ); |
1358 |
push( @message_log, "item is on reserve for someone else" ); |
|
|
1359 |
======= |
1360 |
push( @message, "item is on reserve for someone else" ); |
1361 |
>>>>>>> Bug 9762: Log circulation overrides |
1302 |
} |
1362 |
} |
1303 |
} |
1363 |
} |
1304 |
elsif ( $restype eq "Transferred" ) { |
1364 |
elsif ( $restype eq "Transferred" ) { |
Lines 1317-1323
sub CanBookBeIssued {
Link Here
|
1317 |
} else { |
1377 |
} else { |
1318 |
$message = "item is determined hold being transferred for someone else"; |
1378 |
$message = "item is determined hold being transferred for someone else"; |
1319 |
} |
1379 |
} |
|
|
1380 |
<<<<<<< HEAD |
1320 |
push( @message_log, "item is determined hold being transferred for someone else" ); |
1381 |
push( @message_log, "item is determined hold being transferred for someone else" ); |
|
|
1382 |
======= |
1383 |
push( @message, "item is determined hold being transferred for someone else" ); |
1384 |
>>>>>>> Bug 9762: Log circulation overrides |
1321 |
} |
1385 |
} |
1322 |
} |
1386 |
} |
1323 |
elsif ( $restype eq "Processing" ) { |
1387 |
elsif ( $restype eq "Processing" ) { |
Lines 1336-1342
sub CanBookBeIssued {
Link Here
|
1336 |
} else { |
1400 |
} else { |
1337 |
$message = "item is determined hold being processed for someone else"; |
1401 |
$message = "item is determined hold being processed for someone else"; |
1338 |
} |
1402 |
} |
|
|
1403 |
<<<<<<< HEAD |
1339 |
push( @message_log, "item is determined hold being processed for someone else" ); |
1404 |
push( @message_log, "item is determined hold being processed for someone else" ); |
|
|
1405 |
======= |
1406 |
push( @message, "item is determined hold being processed for someone else" ); |
1407 |
>>>>>>> Bug 9762: Log circulation overrides |
1340 |
} |
1408 |
} |
1341 |
} |
1409 |
} |
1342 |
} |
1410 |
} |
Lines 1386-1392
sub CanBookBeIssued {
Link Here
|
1386 |
} else { |
1454 |
} else { |
1387 |
$message = "age restriction"; |
1455 |
$message = "age restriction"; |
1388 |
} |
1456 |
} |
|
|
1457 |
<<<<<<< HEAD |
1389 |
push( @message_log, "age restriction" ); |
1458 |
push( @message_log, "age restriction" ); |
|
|
1459 |
======= |
1460 |
push( @message, "age restriction" ); |
1461 |
>>>>>>> Bug 9762: Log circulation overrides |
1390 |
} |
1462 |
} |
1391 |
else { |
1463 |
else { |
1392 |
$issuingimpossible{AGE_RESTRICTION} = "$agerestriction"; |
1464 |
$issuingimpossible{AGE_RESTRICTION} = "$agerestriction"; |
Lines 1454-1460
sub CanBookBeIssued {
Link Here
|
1454 |
|
1526 |
|
1455 |
my $infos = ( |
1527 |
my $infos = ( |
1456 |
{ |
1528 |
{ |
|
|
1529 |
<<<<<<< HEAD |
1457 |
message => \@message_log, |
1530 |
message => \@message_log, |
|
|
1531 |
======= |
1532 |
message => \@message, |
1533 |
>>>>>>> Bug 9762: Log circulation overrides |
1458 |
borrowernumber => $borrower->borrowernumber, |
1534 |
borrowernumber => $borrower->borrowernumber, |
1459 |
barcode => $barcode, |
1535 |
barcode => $barcode, |
1460 |
manager_id => $user, |
1536 |
manager_id => $user, |
Lines 1473-1479
sub CanBookBeIssued {
Link Here
|
1473 |
} |
1549 |
} |
1474 |
|
1550 |
|
1475 |
|
1551 |
|
|
|
1552 |
<<<<<<< HEAD |
1476 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, \@message_log ); |
1553 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, \@message_log ); |
|
|
1554 |
======= |
1555 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, ); |
1556 |
>>>>>>> Bug 9762: Log circulation overrides |
1477 |
} |
1557 |
} |
1478 |
|
1558 |
|
1479 |
=head2 CanBookBeReturned |
1559 |
=head2 CanBookBeReturned |
Lines 2496-2504
sub AddReturn {
Link Here
|
2496 |
if ( $transfer->tobranch eq $branch ) { |
2576 |
if ( $transfer->tobranch eq $branch ) { |
2497 |
$transfer->receive; |
2577 |
$transfer->receive; |
2498 |
$messages->{'TransferArrived'} = $transfer->frombranch; |
2578 |
$messages->{'TransferArrived'} = $transfer->frombranch; |
|
|
2579 |
|
2499 |
# validTransfer=1 allows us returning the item back if the reserve is cancelled |
2580 |
# validTransfer=1 allows us returning the item back if the reserve is cancelled |
2500 |
$validTransfer = 1 |
2581 |
$validTransfer = 1 if $transfer->reason eq 'Reserve'; |
2501 |
if defined $transfer->reason && $transfer->reason eq 'Reserve'; |
|
|
2502 |
} |
2582 |
} |
2503 |
else { |
2583 |
else { |
2504 |
$messages->{'WrongTransfer'} = $transfer->tobranch; |
2584 |
$messages->{'WrongTransfer'} = $transfer->tobranch; |
Lines 3226-3231
sub CanBookBeRenewed {
Link Here
|
3226 |
return ( 0, "on_reserve" ) |
3306 |
return ( 0, "on_reserve" ) |
3227 |
if ( $item->current_holds->search( { non_priority => 0 } )->count ); |
3307 |
if ( $item->current_holds->search( { non_priority => 0 } )->count ); |
3228 |
|
3308 |
|
|
|
3309 |
my $issuing_rule = Koha::CirculationRules->get_effective_rules( |
3310 |
{ |
3311 |
categorycode => $patron->categorycode, |
3312 |
itemtype => $item->effective_itemtype, |
3313 |
branchcode => $branchcode, |
3314 |
rules => [ |
3315 |
'renewalsallowed', |
3316 |
'lengthunit', |
3317 |
'unseen_renewals_allowed' |
3318 |
] |
3319 |
} |
3320 |
); |
3321 |
|
3322 |
return ( 0, "too_many" ) |
3323 |
if not $issuing_rule->{renewalsallowed} |
3324 |
or $issuing_rule->{renewalsallowed} <= $issue->renewals_count; |
3229 |
|
3325 |
|
3230 |
my ( $status, $matched_reserve, $possible_holds ) = C4::Reserves::CheckReserves($item); |
3326 |
my ( $status, $matched_reserve, $possible_holds ) = C4::Reserves::CheckReserves($item); |
3231 |
my @fillable_holds = (); |
3327 |
my @fillable_holds = (); |
Lines 3354-3361
fallback to a true value
Link Here
|
3354 |
|
3450 |
|
3355 |
C<$automatic> is a boolean flag indicating the renewal was triggered automatically and not by a person ( librarian or patron ) |
3451 |
C<$automatic> is a boolean flag indicating the renewal was triggered automatically and not by a person ( librarian or patron ) |
3356 |
|
3452 |
|
3357 |
C<$skip_record_index> is an optional boolean flag to indicate whether queuing the search indexing |
3453 |
C<$skip_record_index> is an optional boolean flag to indicate whether queuing the search indexing should be skipped for this renewal. |
3358 |
should be skipped for this renewal. |
|
|
3359 |
|
3454 |
|
3360 |
=cut |
3455 |
=cut |
3361 |
|
3456 |
|
Lines 3557-3565
sub AddRenewal {
Link Here
|
3557 |
}); |
3652 |
}); |
3558 |
}); |
3653 |
}); |
3559 |
|
3654 |
|
3560 |
unless( $skip_record_index ){ |
3655 |
unless ($skip_record_index) { |
|
|
3656 |
|
3561 |
# We index now, after the transaction is committed |
3657 |
# We index now, after the transaction is committed |
3562 |
my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); |
3658 |
my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
3563 |
$indexer->index_records( $item_object->biblionumber, "specialUpdate", "biblioserver" ); |
3659 |
$indexer->index_records( $item_object->biblionumber, "specialUpdate", "biblioserver" ); |
3564 |
} |
3660 |
} |
3565 |
|
3661 |
|