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 319-324
A recall for this item was found, and the item needs to be transferred to the re
Link Here
|
319 |
|
320 |
|
320 |
=cut |
321 |
=cut |
321 |
|
322 |
|
|
|
323 |
my $query = CGI->new; |
324 |
|
325 |
my $stickyduedate = $query->param('stickyduedate'); |
326 |
my $duedatespec = $query->param('duedatespec'); |
327 |
my $restoreduedatespec = $query->param('restoreduedatespec') || $duedatespec; |
328 |
if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) { |
329 |
undef $restoreduedatespec; |
330 |
} |
331 |
my $issueconfirmed = $query->param('issueconfirmed'); |
332 |
my $cancelreserve = $query->param('cancelreserve'); |
333 |
my $cancel_recall = $query->param('cancel_recall'); |
334 |
my $recall_id = $query->param('recall_id'); |
335 |
my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice |
336 |
my $charges = $query->param('charges') || q{}; |
337 |
|
322 |
sub transferbook { |
338 |
sub transferbook { |
323 |
my $params = shift; |
339 |
my $params = shift; |
324 |
my $tbr = $params->{to_branch}; |
340 |
my $tbr = $params->{to_branch}; |
Lines 815-823
sub CanBookBeIssued {
Link Here
|
815 |
|
831 |
|
816 |
my $now = dt_from_string(); |
832 |
my $now = dt_from_string(); |
817 |
my $message; |
833 |
my $message; |
|
|
834 |
<<<<<<< HEAD |
818 |
my @message_log; |
835 |
my @message_log; |
|
|
836 |
======= |
837 |
my @message; |
838 |
>>>>>>> Bug 9762: Log circulation overrides |
819 |
|
839 |
|
820 |
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron ); |
840 |
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron ); |
|
|
841 |
|
821 |
if (DateTime->compare($duedate,$now) == -1 ) { # duedate cannot be before now |
842 |
if (DateTime->compare($duedate,$now) == -1 ) { # duedate cannot be before now |
822 |
$needsconfirmation{INVALID_DATE} = $duedate; |
843 |
$needsconfirmation{INVALID_DATE} = $duedate; |
823 |
if ($issueconfirmed) { |
844 |
if ($issueconfirmed) { |
Lines 826-832
sub CanBookBeIssued {
Link Here
|
826 |
} else { |
847 |
} else { |
827 |
$message = "sticky due date is invalid or due date in the past"; |
848 |
$message = "sticky due date is invalid or due date in the past"; |
828 |
} |
849 |
} |
|
|
850 |
<<<<<<< HEAD |
829 |
push( @message_log, "sticky due date is invalid or due date in the past" ); |
851 |
push( @message_log, "sticky due date is invalid or due date in the past" ); |
|
|
852 |
======= |
853 |
push( @message, "sticky due date is invalid or due date in the past" ); |
854 |
>>>>>>> Bug 9762: Log circulation overrides |
830 |
} |
855 |
} |
831 |
|
856 |
|
832 |
} |
857 |
} |
Lines 880-886
sub CanBookBeIssued {
Link Here
|
880 |
} else { |
905 |
} else { |
881 |
$message = "borrower is restricted"; |
906 |
$message = "borrower is restricted"; |
882 |
} |
907 |
} |
|
|
908 |
<<<<<<< HEAD |
883 |
push( @message_log, "borrower is restricted" ); |
909 |
push( @message_log, "borrower is restricted" ); |
|
|
910 |
======= |
911 |
push( @message, "borrower is restricted" ); |
912 |
>>>>>>> Bug 9762: Log circulation overrides |
884 |
} |
913 |
} |
885 |
} |
914 |
} |
886 |
|
915 |
|
Lines 960-966
sub CanBookBeIssued {
Link Here
|
960 |
} else { |
989 |
} else { |
961 |
$message = "borrower had amend"; |
990 |
$message = "borrower had amend"; |
962 |
} |
991 |
} |
|
|
992 |
<<<<<<< HEAD |
963 |
push( @message_log, "borrower had amend" ); |
993 |
push( @message_log, "borrower had amend" ); |
|
|
994 |
======= |
995 |
push( @message, "borrower had amend" ); |
996 |
>>>>>>> Bug 9762: Log circulation overrides |
964 |
} |
997 |
} |
965 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) { |
998 |
} elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) { |
966 |
$issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
999 |
$issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge}; |
Lines 972-978
sub CanBookBeIssued {
Link Here
|
972 |
} else { |
1005 |
} else { |
973 |
$message = "borrower had amend"; |
1006 |
$message = "borrower had amend"; |
974 |
} |
1007 |
} |
|
|
1008 |
<<<<<<< HEAD |
975 |
push( @message_log, "borrower had amend" ); |
1009 |
push( @message_log, "borrower had amend" ); |
|
|
1010 |
======= |
1011 |
push( @message, "borrower had amend" ); |
1012 |
>>>>>>> Bug 9762: Log circulation overrides |
976 |
} |
1013 |
} |
977 |
} |
1014 |
} |
978 |
} |
1015 |
} |
Lines 1049-1058
sub CanBookBeIssued {
Link Here
|
1049 |
if ( C4::Context->preference('AutoReturnCheckedOutItems') ) { |
1086 |
if ( C4::Context->preference('AutoReturnCheckedOutItems') ) { |
1050 |
$alerts{RETURNED_FROM_ANOTHER} = { patron => $patron }; |
1087 |
$alerts{RETURNED_FROM_ANOTHER} = { patron => $patron }; |
1051 |
} else { |
1088 |
} else { |
|
|
1089 |
<<<<<<< HEAD |
1052 |
$needsconfirmation{ISSUED_TO_ANOTHER} = 1; |
1090 |
$needsconfirmation{ISSUED_TO_ANOTHER} = 1; |
1053 |
$needsconfirmation{issued_firstname} = $patron->firstname; |
1091 |
$needsconfirmation{issued_firstname} = $patron->firstname; |
1054 |
$needsconfirmation{issued_surname} = $patron->surname; |
1092 |
$needsconfirmation{issued_surname} = $patron->surname; |
1055 |
$needsconfirmation{issued_cardnumber} = $patron->cardnumber; |
1093 |
$needsconfirmation{issued_cardnumber} = $patron->cardnumber; |
|
|
1094 |
======= |
1095 |
$needsconfirmation{ISSUED_TO_ANOTHER} = 1; |
1096 |
$needsconfirmation{issued_firstname} = $patron->firstname; |
1097 |
$needsconfirmation{issued_surname} = $patron->surname; |
1098 |
$needsconfirmation{issued_cardnumber} = $patron->cardnumber; |
1099 |
>>>>>>> Bug 9762: Log circulation overrides |
1056 |
$needsconfirmation{issued_borrowernumber} = $patron->borrowernumber; |
1100 |
$needsconfirmation{issued_borrowernumber} = $patron->borrowernumber; |
1057 |
if ($issueconfirmed) { |
1101 |
if ($issueconfirmed) { |
1058 |
if ($message) { |
1102 |
if ($message) { |
Lines 1060-1066
sub CanBookBeIssued {
Link Here
|
1060 |
} else { |
1104 |
} else { |
1061 |
$message = "item is checked out for someone else"; |
1105 |
$message = "item is checked out for someone else"; |
1062 |
} |
1106 |
} |
|
|
1107 |
<<<<<<< HEAD |
1063 |
push( @message_log, "item is checked out for someone else" ); |
1108 |
push( @message_log, "item is checked out for someone else" ); |
|
|
1109 |
======= |
1110 |
push( @message, "item is checked out for someone else" ); |
1111 |
>>>>>>> Bug 9762: Log circulation overrides |
1064 |
} |
1112 |
} |
1065 |
} |
1113 |
} |
1066 |
} |
1114 |
} |
Lines 1095-1101
sub CanBookBeIssued {
Link Here
|
1095 |
} else { |
1143 |
} else { |
1096 |
$message = "too many checkout"; |
1144 |
$message = "too many checkout"; |
1097 |
} |
1145 |
} |
|
|
1146 |
<<<<<<< HEAD |
1098 |
push( @message_log, "too many checkout" ); |
1147 |
push( @message_log, "too many checkout" ); |
|
|
1148 |
======= |
1149 |
push( @message, "too many checkout" ); |
1150 |
>>>>>>> Bug 9762: Log circulation overrides |
1099 |
} |
1151 |
} |
1100 |
} else { |
1152 |
} else { |
1101 |
$issuingimpossible{TOO_MANY} = $toomany->{reason}; |
1153 |
$issuingimpossible{TOO_MANY} = $toomany->{reason}; |
Lines 1130-1136
sub CanBookBeIssued {
Link Here
|
1130 |
} else { |
1182 |
} else { |
1131 |
$message = "item not for loan"; |
1183 |
$message = "item not for loan"; |
1132 |
} |
1184 |
} |
|
|
1185 |
<<<<<<< HEAD |
1133 |
push( @message_log, "item not for loan" ); |
1186 |
push( @message_log, "item not for loan" ); |
|
|
1187 |
======= |
1188 |
push( @message, "item not for loan" ); |
1189 |
>>>>>>> Bug 9762: Log circulation overrides |
1134 |
} |
1190 |
} |
1135 |
} |
1191 |
} |
1136 |
} else { |
1192 |
} else { |
Lines 1183-1189
sub CanBookBeIssued {
Link Here
|
1183 |
} else { |
1239 |
} else { |
1184 |
$message = "item lost"; |
1240 |
$message = "item lost"; |
1185 |
} |
1241 |
} |
|
|
1242 |
<<<<<<< HEAD |
1186 |
push( @message_log, "item lost" ); |
1243 |
push( @message_log, "item lost" ); |
|
|
1244 |
======= |
1245 |
push( @message, "item lost" ); |
1246 |
>>>>>>> Bug 9762: Log circulation overrides |
1187 |
} |
1247 |
} |
1188 |
} |
1248 |
} |
1189 |
if ( C4::Context->preference("IndependentBranches") ) { |
1249 |
if ( C4::Context->preference("IndependentBranches") ) { |
Lines 1292-1301
sub CanBookBeIssued {
Link Here
|
1292 |
} else { |
1352 |
} else { |
1293 |
$message = "item is on reserve and waiting, but has been reserved by some other patron."; |
1353 |
$message = "item is on reserve and waiting, but has been reserved by some other patron."; |
1294 |
} |
1354 |
} |
|
|
1355 |
<<<<<<< HEAD |
1295 |
push( |
1356 |
push( |
1296 |
@message_log, |
1357 |
@message_log, |
1297 |
"item is on reserve and waiting, but has been reserved by some other patron" |
1358 |
"item is on reserve and waiting, but has been reserved by some other patron" |
1298 |
); |
1359 |
); |
|
|
1360 |
======= |
1361 |
push( @message, "item is on reserve and waiting, but has been reserved by some other patron" ); |
1362 |
>>>>>>> Bug 9762: Log circulation overrides |
1299 |
} |
1363 |
} |
1300 |
} |
1364 |
} |
1301 |
elsif ( $restype eq "Reserved" ) { |
1365 |
elsif ( $restype eq "Reserved" ) { |
Lines 1314-1320
sub CanBookBeIssued {
Link Here
|
1314 |
} else { |
1378 |
} else { |
1315 |
$message = "item is on reserve for someone else"; |
1379 |
$message = "item is on reserve for someone else"; |
1316 |
} |
1380 |
} |
|
|
1381 |
<<<<<<< HEAD |
1317 |
push( @message_log, "item is on reserve for someone else" ); |
1382 |
push( @message_log, "item is on reserve for someone else" ); |
|
|
1383 |
======= |
1384 |
push( @message, "item is on reserve for someone else" ); |
1385 |
>>>>>>> Bug 9762: Log circulation overrides |
1318 |
} |
1386 |
} |
1319 |
} |
1387 |
} |
1320 |
elsif ( $restype eq "Transferred" ) { |
1388 |
elsif ( $restype eq "Transferred" ) { |
Lines 1333-1339
sub CanBookBeIssued {
Link Here
|
1333 |
} else { |
1401 |
} else { |
1334 |
$message = "item is determined hold being transferred for someone else"; |
1402 |
$message = "item is determined hold being transferred for someone else"; |
1335 |
} |
1403 |
} |
|
|
1404 |
<<<<<<< HEAD |
1336 |
push( @message_log, "item is determined hold being transferred for someone else" ); |
1405 |
push( @message_log, "item is determined hold being transferred for someone else" ); |
|
|
1406 |
======= |
1407 |
push( @message, "item is determined hold being transferred for someone else" ); |
1408 |
>>>>>>> Bug 9762: Log circulation overrides |
1337 |
} |
1409 |
} |
1338 |
} |
1410 |
} |
1339 |
elsif ( $restype eq "Processing" ) { |
1411 |
elsif ( $restype eq "Processing" ) { |
Lines 1352-1358
sub CanBookBeIssued {
Link Here
|
1352 |
} else { |
1424 |
} else { |
1353 |
$message = "item is determined hold being processed for someone else"; |
1425 |
$message = "item is determined hold being processed for someone else"; |
1354 |
} |
1426 |
} |
|
|
1427 |
<<<<<<< HEAD |
1355 |
push( @message_log, "item is determined hold being processed for someone else" ); |
1428 |
push( @message_log, "item is determined hold being processed for someone else" ); |
|
|
1429 |
======= |
1430 |
push( @message, "item is determined hold being processed for someone else" ); |
1431 |
>>>>>>> Bug 9762: Log circulation overrides |
1356 |
} |
1432 |
} |
1357 |
} |
1433 |
} |
1358 |
} |
1434 |
} |
Lines 1402-1408
sub CanBookBeIssued {
Link Here
|
1402 |
} else { |
1478 |
} else { |
1403 |
$message = "age restriction"; |
1479 |
$message = "age restriction"; |
1404 |
} |
1480 |
} |
|
|
1481 |
<<<<<<< HEAD |
1405 |
push( @message_log, "age restriction" ); |
1482 |
push( @message_log, "age restriction" ); |
|
|
1483 |
======= |
1484 |
push( @message, "age restriction" ); |
1485 |
>>>>>>> Bug 9762: Log circulation overrides |
1406 |
} |
1486 |
} |
1407 |
else { |
1487 |
else { |
1408 |
$issuingimpossible{AGE_RESTRICTION} = "$agerestriction"; |
1488 |
$issuingimpossible{AGE_RESTRICTION} = "$agerestriction"; |
Lines 1473-1479
sub CanBookBeIssued {
Link Here
|
1473 |
|
1553 |
|
1474 |
my $infos = ( |
1554 |
my $infos = ( |
1475 |
{ |
1555 |
{ |
|
|
1556 |
<<<<<<< HEAD |
1476 |
message => \@message_log, |
1557 |
message => \@message_log, |
|
|
1558 |
======= |
1559 |
message => \@message, |
1560 |
>>>>>>> Bug 9762: Log circulation overrides |
1477 |
borrowernumber => $borrower->borrowernumber, |
1561 |
borrowernumber => $borrower->borrowernumber, |
1478 |
barcode => $barcode, |
1562 |
barcode => $barcode, |
1479 |
manager_id => $user, |
1563 |
manager_id => $user, |
Lines 1492-1498
sub CanBookBeIssued {
Link Here
|
1492 |
} |
1576 |
} |
1493 |
|
1577 |
|
1494 |
|
1578 |
|
|
|
1579 |
<<<<<<< HEAD |
1495 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, \@message_log ); |
1580 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, \@message_log ); |
|
|
1581 |
======= |
1582 |
return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, ); |
1583 |
>>>>>>> Bug 9762: Log circulation overrides |
1496 |
} |
1584 |
} |
1497 |
|
1585 |
|
1498 |
=head2 CanBookBeReturned |
1586 |
=head2 CanBookBeReturned |
Lines 2552-2560
sub AddReturn {
Link Here
|
2552 |
$messages->{'TransferArrived'} = $transfer->frombranch; |
2640 |
$messages->{'TransferArrived'} = $transfer->frombranch; |
2553 |
|
2641 |
|
2554 |
# validTransfer=1 allows us returning the item back if the reserve is cancelled |
2642 |
# validTransfer=1 allows us returning the item back if the reserve is cancelled |
|
|
2643 |
<<<<<<< HEAD |
2555 |
$validTransfer = 1 |
2644 |
$validTransfer = 1 |
2556 |
if defined $transfer->reason && $transfer->reason eq 'Reserve'; |
2645 |
if defined $transfer->reason && $transfer->reason eq 'Reserve'; |
2557 |
} else { |
2646 |
} else { |
|
|
2647 |
======= |
2648 |
$validTransfer = 1 if $transfer->reason eq 'Reserve'; |
2649 |
} |
2650 |
else { |
2651 |
>>>>>>> Bug 9762: Log circulation overrides |
2558 |
$messages->{'WrongTransfer'} = $transfer->tobranch; |
2652 |
$messages->{'WrongTransfer'} = $transfer->tobranch; |
2559 |
$messages->{'WrongTransferItem'} = $item->itemnumber; |
2653 |
$messages->{'WrongTransferItem'} = $item->itemnumber; |
2560 |
$messages->{'TransferTrigger'} = $transfer->reason; |
2654 |
$messages->{'TransferTrigger'} = $transfer->reason; |
Lines 3309-3315
sub CanBookBeRenewed {
Link Here
|
3309 |
|
3403 |
|
3310 |
# There is an item level hold on this item, no other item can fill the hold |
3404 |
# There is an item level hold on this item, no other item can fill the hold |
3311 |
return ( 0, "on_reserve" ) |
3405 |
return ( 0, "on_reserve" ) |
|
|
3406 |
<<<<<<< HEAD |
3312 |
if ( $item->current_holds->search( { non_priority => 0 } )->count ); |
3407 |
if ( $item->current_holds->search( { non_priority => 0 } )->count ); |
|
|
3408 |
======= |
3409 |
if ( $item->current_holds->search( { non_priority => 0 } )->count ); |
3410 |
|
3411 |
my $issuing_rule = Koha::CirculationRules->get_effective_rules( |
3412 |
{ |
3413 |
categorycode => $patron->categorycode, |
3414 |
itemtype => $item->effective_itemtype, |
3415 |
branchcode => $branchcode, |
3416 |
rules => [ |
3417 |
'renewalsallowed', |
3418 |
'lengthunit', |
3419 |
'unseen_renewals_allowed' |
3420 |
] |
3421 |
} |
3422 |
); |
3423 |
|
3424 |
return ( 0, "too_many" ) |
3425 |
if not $issuing_rule->{renewalsallowed} |
3426 |
or $issuing_rule->{renewalsallowed} <= $issue->renewals_count; |
3427 |
>>>>>>> Bug 9762: Log circulation overrides |
3313 |
|
3428 |
|
3314 |
my ( $status, $matched_reserve, $possible_holds ) = C4::Reserves::CheckReserves($item); |
3429 |
my ( $status, $matched_reserve, $possible_holds ) = C4::Reserves::CheckReserves($item); |
3315 |
my @fillable_holds = (); |
3430 |
my @fillable_holds = (); |
Lines 3446-3453
fallback to a true value
Link Here
|
3446 |
|
3561 |
|
3447 |
C<$automatic> is a boolean flag indicating the renewal was triggered automatically and not by a person ( librarian or patron ) |
3562 |
C<$automatic> is a boolean flag indicating the renewal was triggered automatically and not by a person ( librarian or patron ) |
3448 |
|
3563 |
|
3449 |
C<$skip_record_index> is an optional boolean flag to indicate whether queuing the search indexing |
3564 |
C<$skip_record_index> is an optional boolean flag to indicate whether queuing the search indexing should be skipped for this renewal. |
3450 |
should be skipped for this renewal. |
|
|
3451 |
|
3565 |
|
3452 |
=cut |
3566 |
=cut |
3453 |
|
3567 |
|
Lines 3618-3623
sub AddRenewal {
Link Here
|
3618 |
DelUniqueDebarment( { borrowernumber => $borrowernumber, type => 'OVERDUES' } ); |
3732 |
DelUniqueDebarment( { borrowernumber => $borrowernumber, type => 'OVERDUES' } ); |
3619 |
} |
3733 |
} |
3620 |
|
3734 |
|
|
|
3735 |
<<<<<<< HEAD |
3621 |
# Add renewal record |
3736 |
# Add renewal record |
3622 |
my $renewal = Koha::Checkouts::Renewal->new( |
3737 |
my $renewal = Koha::Checkouts::Renewal->new( |
3623 |
{ |
3738 |
{ |
Lines 3662-3667
sub AddRenewal {
Link Here
|
3662 |
} |
3777 |
} |
3663 |
); |
3778 |
); |
3664 |
|
3779 |
|
|
|
3780 |
======= |
3781 |
>>>>>>> Bug 9762: Log circulation overrides |
3665 |
unless ($skip_record_index) { |
3782 |
unless ($skip_record_index) { |
3666 |
|
3783 |
|
3667 |
# We index now, after the transaction is committed |
3784 |
# We index now, after the transaction is committed |