Lines 353-368
sub transferbook {
Link Here
|
353 |
$dotransfer = 0; |
353 |
$dotransfer = 0; |
354 |
$messages->{'RecallPlacedAtHoldingBranch'} = 1; |
354 |
$messages->{'RecallPlacedAtHoldingBranch'} = 1; |
355 |
} else { |
355 |
} else { |
356 |
$dotransfer = 1; |
356 |
$dotransfer = 0; |
357 |
} |
357 |
} |
358 |
} else { #recalls take priority over holds, only check holds if no recalls |
358 |
} else { #recalls take priority over holds, only check holds if no recalls |
359 |
# find reserves..... |
359 |
# find reserves..... |
360 |
my ( $resfound, $resrec, undef ) = CheckReserves( $itemnumber ); |
360 |
# my ( $resfound, $resrec, undef ) = |
361 |
if ( $resfound and not $ignoreRs ) { |
361 |
# CheckReserves( $itemnumber ); |
362 |
$resrec->{'ResFound'} = $resfound; |
362 |
# if ( $resfound and not $ignoreRs ) { |
363 |
# $messages->{'ResFound'} = $resrec; |
363 |
# $resrec->{'ResFound'} = $resfound; |
364 |
$dotransfer = 1; |
364 |
# $messages->{'ResFound'} = $resrec; |
365 |
} |
365 |
# $dotransfer = 1; |
|
|
366 |
# } |
366 |
} |
367 |
} |
367 |
|
368 |
|
368 |
#actually do the transfer.... |
369 |
#actually do the transfer.... |
Lines 665-670
sticky due date is invalid or due date in the past
Link Here
|
665 |
|
666 |
|
666 |
if the borrower borrows to much things |
667 |
if the borrower borrows to much things |
667 |
|
668 |
|
|
|
669 |
=head3 WAITING_RECALL_FOR_A_DIFFERENT_PATRON |
670 |
|
671 |
if the item has been recalled by a different patron and the recall status is waiting 'W' |
672 |
|
668 |
=cut |
673 |
=cut |
669 |
|
674 |
|
670 |
sub CanBookBeIssued { |
675 |
sub CanBookBeIssued { |
Lines 989-1024
sub CanBookBeIssued {
Link Here
|
989 |
} |
994 |
} |
990 |
} |
995 |
} |
991 |
|
996 |
|
992 |
unless ( $ignore_reserves ) { |
997 |
my $recall; |
993 |
# See if the item is on reserve. |
998 |
#CHECK IF ITEM HAS WAITING RECALL FOR ANOTHER PATRON |
994 |
my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ); |
999 |
if ( C4::Context->preference('UseRecalls') ) { |
995 |
if ($restype) { |
1000 |
$recall = Koha::Recalls->find({ itemnumber => $item->{'itemnumber'}, status => 'W' }); |
996 |
my $resbor = $res->{'borrowernumber'}; |
1001 |
if ((defined $recall) && ($recall->patron->borrowernumber != $patron->borrowernumber) && $recall->status eq 'W') { |
997 |
if ( $resbor ne $patron->borrowernumber ) { |
1002 |
#Item has been recalled by a different patron and is waiting for them |
998 |
my $patron = Koha::Patrons->find( $resbor ); |
1003 |
$issuingimpossible{WAITING_RECALL_FOR_A_DIFFERENT_PATRON} = 1; |
999 |
if ( $restype eq "Waiting" ) |
1004 |
} |
1000 |
{ |
1005 |
} |
1001 |
# The item is on reserve and waiting, but has been |
1006 |
|
1002 |
# reserved by some other patron. |
1007 |
if (!((defined $recall) && $recall->patron->borrowernumber == $patron->borrowernumber && $recall->status eq 'W')) { |
1003 |
$needsconfirmation{RESERVE_WAITING} = 1; |
1008 |
unless ( $ignore_reserves ) { |
1004 |
$needsconfirmation{'resfirstname'} = $patron->firstname; |
1009 |
# See if the item is on reserve. |
1005 |
$needsconfirmation{'ressurname'} = $patron->surname; |
1010 |
my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ); |
1006 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1011 |
if ($restype) { |
1007 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1012 |
my $resbor = $res->{'borrowernumber'}; |
1008 |
$needsconfirmation{'resbranchcode'} = $res->{branchcode}; |
1013 |
if ( $resbor ne $patron->borrowernumber ) { |
1009 |
$needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; |
1014 |
my $patron = Koha::Patrons->find( $resbor ); |
1010 |
} |
1015 |
if ( $restype eq "Waiting" ) |
1011 |
elsif ( $restype eq "Reserved" ) { |
1016 |
{ |
1012 |
# The item is on reserve for someone else. |
1017 |
# The item is on reserve and waiting, but has been |
1013 |
$needsconfirmation{RESERVED} = 1; |
1018 |
# reserved by some other patron. |
1014 |
$needsconfirmation{'resfirstname'} = $patron->firstname; |
1019 |
$needsconfirmation{RESERVE_WAITING} = 1; |
1015 |
$needsconfirmation{'ressurname'} = $patron->surname; |
1020 |
$needsconfirmation{'resfirstname'} = $patron->firstname; |
1016 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1021 |
$needsconfirmation{'ressurname'} = $patron->surname; |
1017 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1022 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1018 |
$needsconfirmation{'resbranchcode'} = $patron->branchcode; |
1023 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1019 |
$needsconfirmation{'resreservedate'} = $res->{reservedate}; |
1024 |
$needsconfirmation{'resbranchcode'} = $res->{branchcode}; |
1020 |
} |
1025 |
$needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; |
1021 |
} |
1026 |
} |
|
|
1027 |
elsif ( $restype eq "Reserved" ) { |
1028 |
# The item is on reserve for someone else. |
1029 |
$needsconfirmation{RESERVED} = 1; |
1030 |
$needsconfirmation{'resfirstname'} = $patron->firstname; |
1031 |
$needsconfirmation{'ressurname'} = $patron->surname; |
1032 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1033 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1034 |
$needsconfirmation{'resbranchcode'} = $patron->branchcode; |
1035 |
$needsconfirmation{'resreservedate'} = $res->{reservedate}; |
1036 |
} |
1037 |
} |
1038 |
} |
1022 |
} |
1039 |
} |
1023 |
} |
1040 |
} |
1024 |
|
1041 |
|
Lines 1377-1386
sub AddIssue {
Link Here
|
1377 |
|
1394 |
|
1378 |
# Check if a recall |
1395 |
# Check if a recall |
1379 |
if ( C4::Context->preference('UseRecalls') ) { |
1396 |
if ( C4::Context->preference('UseRecalls') ) { |
1380 |
my $recall = Koha::Recalls->find({ itemnumber => $item->{'itemnumber'}, borrowernumber => $borrower->{'borrowernumber'}, old => undef }); |
1397 |
my $recall = Koha::Recalls->find({ itemnumber => $item->{'itemnumber'}, borrowernumber => $borrower->{'borrowernumber'}, status => 'W' }); |
1381 |
if (defined $recall) { |
1398 |
if (defined $recall) { |
1382 |
$recall->update({ status => "F", old => 1 }); |
1399 |
$recall->update({ status => 'F', old => 1 }); |
1383 |
} |
1400 |
} |
1384 |
} |
1401 |
} |
1385 |
|
1402 |
|
1386 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { |
1403 |
if ( C4::Context->preference('ReturnToShelvingCart') ) { |
Lines 2034-2048
sub AddReturn {
Link Here
|
2034 |
my ($resfound, $resrec); |
2051 |
my ($resfound, $resrec); |
2035 |
|
2052 |
|
2036 |
# find recalls..... |
2053 |
# find recalls..... |
2037 |
my $recall = Koha::Recalls->find({ itemnumber => $item->{'itemnumber'}, old => undef }); |
2054 |
my $recall = Koha::Recalls->find({ itemnumber => $item->{'itemnumber'}, status => 'R' }); |
|
|
2055 |
my $waiting_recall = Koha::Recalls->find({ itemnumber => $item->{'itemnumber'}, status => 'W' }); |
2038 |
if (defined $recall){ |
2056 |
if (defined $recall){ |
2039 |
$messages->{'RecallFound'} = 1; |
2057 |
$messages->{'RecallFound'} = 1; |
2040 |
$messages->{'Recall'} = $recall; |
2058 |
$messages->{'Recall'} = $recall; |
|
|
2059 |
} elsif (defined $waiting_recall){ |
2060 |
$messages->{'RecallFound'} = 1; |
2061 |
$messages->{'Recall'} = $waiting_recall; |
2041 |
} else { |
2062 |
} else { |
2042 |
# find reserves..... |
2063 |
# find reserves..... |
2043 |
# if we don't have a reserve with the status W, we launch the Checkreserves routine |
2064 |
# if we don't have a reserve with the status W, we launch the Checkreserves routine |
2044 |
my $lookahead= C4::Context->preference('ConfirmFutureHolds'); #number of days to look for future holds |
2065 |
my $lookahead= C4::Context->preference('ConfirmFutureHolds'); #number of days to look for future holds |
2045 |
($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'}, undef, $lookahead ) unless ( $item->{'withdrawn'} ); |
2066 |
($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'}, undef, $lookahead ) unless ( $item->{'withdrawn'} ); |
|
|
2067 |
warn $issue; |
2068 |
warn $resrec; |
2046 |
if ($resfound) { |
2069 |
if ($resfound) { |
2047 |
$resrec->{'ResFound'} = $resfound; |
2070 |
$resrec->{'ResFound'} = $resfound; |
2048 |
$messages->{'ResFound'} = $resrec; |
2071 |
$messages->{'ResFound'} = $resrec; |
Lines 2692-2697
sub CanBookBeRenewed {
Link Here
|
2692 |
} |
2715 |
} |
2693 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |
2716 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |
2694 |
|
2717 |
|
|
|
2718 |
# check if item has been recalled. do a transfer if the recall branch is different to the item holding branch, otherwise don't do a transfer |
2719 |
my $recall = Koha::Recalls->find({ itemnumber => $itemnumber, status => 'R' }); |
2720 |
my $recallfound; |
2721 |
if (defined $recall){ |
2722 |
$recallfound = 1; |
2723 |
} |
2724 |
return ( 0, "recalled" ) if $recallfound; |
2725 |
|
2695 |
return ( 1, undef ) if $override_limit; |
2726 |
return ( 1, undef ) if $override_limit; |
2696 |
|
2727 |
|
2697 |
my $branchcode = _GetCircControlBranch( $item, $patron->unblessed ); |
2728 |
my $branchcode = _GetCircControlBranch( $item, $patron->unblessed ); |