Lines 994-1041
sub CanBookBeIssued {
Link Here
|
994 |
} |
994 |
} |
995 |
} |
995 |
} |
996 |
|
996 |
|
997 |
unless ( $ignore_reserves ) { |
997 |
my $recall; |
998 |
# See if the item is on reserve. |
|
|
999 |
my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ); |
1000 |
if ($restype) { |
1001 |
my $resbor = $res->{'borrowernumber'}; |
1002 |
if ( $resbor ne $patron->borrowernumber ) { |
1003 |
my $patron = Koha::Patrons->find( $resbor ); |
1004 |
if ( $restype eq "Waiting" ) |
1005 |
{ |
1006 |
# The item is on reserve and waiting, but has been |
1007 |
# reserved by some other patron. |
1008 |
$needsconfirmation{RESERVE_WAITING} = 1; |
1009 |
$needsconfirmation{'resfirstname'} = $patron->firstname; |
1010 |
$needsconfirmation{'ressurname'} = $patron->surname; |
1011 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1012 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1013 |
$needsconfirmation{'resbranchcode'} = $res->{branchcode}; |
1014 |
$needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; |
1015 |
} |
1016 |
elsif ( $restype eq "Reserved" ) { |
1017 |
# The item is on reserve for someone else. |
1018 |
$needsconfirmation{RESERVED} = 1; |
1019 |
$needsconfirmation{'resfirstname'} = $patron->firstname; |
1020 |
$needsconfirmation{'ressurname'} = $patron->surname; |
1021 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1022 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1023 |
$needsconfirmation{'resbranchcode'} = $patron->branchcode; |
1024 |
$needsconfirmation{'resreservedate'} = $res->{reservedate}; |
1025 |
} |
1026 |
} |
1027 |
} |
1028 |
} |
1029 |
|
1030 |
#CHECK IF ITEM HAS WAITING RECALL FOR ANOTHER PATRON |
998 |
#CHECK IF ITEM HAS WAITING RECALL FOR ANOTHER PATRON |
1031 |
if ( C4::Context->preference('UseRecalls') ) { |
999 |
if ( C4::Context->preference('UseRecalls') ) { |
1032 |
my $recall = Koha::Recalls->find({ itemnumber => $item->{'itemnumber'} }); |
1000 |
$recall = Koha::Recalls->find({ itemnumber => $item->{'itemnumber'}, status => 'W' }); |
1033 |
if ((defined $recall) && ($recall->patron->borrowernumber != $patron->borrowernumber) && $recall->status eq 'W') { |
1001 |
if ((defined $recall) && ($recall->patron->borrowernumber != $patron->borrowernumber) && $recall->status eq 'W') { |
1034 |
#Item has been recalled by a different patron and is waiting for them |
1002 |
#Item has been recalled by a different patron and is waiting for them |
1035 |
$issuingimpossible{WAITING_RECALL_FOR_A_DIFFERENT_PATRON} = 1; |
1003 |
$issuingimpossible{WAITING_RECALL_FOR_A_DIFFERENT_PATRON} = 1; |
1036 |
} |
1004 |
} |
1037 |
} |
1005 |
} |
1038 |
|
1006 |
|
|
|
1007 |
if (!((defined $recall) && $recall->patron->borrowernumber == $patron->borrowernumber && $recall->status eq 'W')) { |
1008 |
unless ( $ignore_reserves ) { |
1009 |
# See if the item is on reserve. |
1010 |
my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ); |
1011 |
if ($restype) { |
1012 |
my $resbor = $res->{'borrowernumber'}; |
1013 |
if ( $resbor ne $patron->borrowernumber ) { |
1014 |
my $patron = Koha::Patrons->find( $resbor ); |
1015 |
if ( $restype eq "Waiting" ) |
1016 |
{ |
1017 |
# The item is on reserve and waiting, but has been |
1018 |
# reserved by some other patron. |
1019 |
$needsconfirmation{RESERVE_WAITING} = 1; |
1020 |
$needsconfirmation{'resfirstname'} = $patron->firstname; |
1021 |
$needsconfirmation{'ressurname'} = $patron->surname; |
1022 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1023 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1024 |
$needsconfirmation{'resbranchcode'} = $res->{branchcode}; |
1025 |
$needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; |
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 |
} |
1039 |
} |
1040 |
} |
1041 |
|
1039 |
## CHECK AGE RESTRICTION |
1042 |
## CHECK AGE RESTRICTION |
1040 |
my $agerestriction = $biblioitem->agerestriction; |
1043 |
my $agerestriction = $biblioitem->agerestriction; |
1041 |
my ($restriction_age, $daysToAgeRestriction) = GetAgeRestriction( $agerestriction, $patron->unblessed ); |
1044 |
my ($restriction_age, $daysToAgeRestriction) = GetAgeRestriction( $agerestriction, $patron->unblessed ); |
1042 |
- |
|
|