Lines 735-760
sub GetReservesForBranch {
Link Here
|
735 |
return (@transreserv); |
735 |
return (@transreserv); |
736 |
} |
736 |
} |
737 |
|
737 |
|
|
|
738 |
=head2 GetReserveStatus |
739 |
|
740 |
$reservestatus = GetReserveStatus($itemnumber, $biblionumber); |
741 |
|
742 |
Take an itemnumber or a biblionumber and return the status of the reserve places on it. |
743 |
If several reserves exist, the reserve with the lower priority is given. |
744 |
|
745 |
=cut |
746 |
|
738 |
sub GetReserveStatus { |
747 |
sub GetReserveStatus { |
739 |
my ($itemnumber, $biblionumber) = @_; |
748 |
my ($itemnumber, $biblionumber) = @_; |
740 |
|
749 |
|
741 |
my $dbh = C4::Context->dbh; |
750 |
my $dbh = C4::Context->dbh; |
742 |
|
751 |
|
743 |
my ($sth, $found, $priority); |
752 |
my ($sth, $found, $priority) = (undef, q{}, 0); |
744 |
if ( $itemnumber ) { |
753 |
if ( $itemnumber ) { |
745 |
$sth = $dbh->prepare("SELECT found, priority FROM reserves WHERE itemnumber = ? order by priority LIMIT 1"); |
754 |
$sth = $dbh->prepare("SELECT found, priority FROM reserves WHERE itemnumber = ? order by priority LIMIT 1"); |
746 |
$sth->execute($itemnumber); |
755 |
$sth->execute($itemnumber); |
747 |
($found, $priority) = $sth->fetchrow_array; |
|
|
748 |
} |
756 |
} |
749 |
|
757 |
|
750 |
if ( $biblionumber and not defined $found and not defined $priority ) { |
758 |
if ( $biblionumber and not defined $found and not defined $priority ) { |
751 |
$sth = $dbh->prepare("SELECT found, priority FROM reserves WHERE biblionumber = ? order by priority LIMIT 1"); |
759 |
$sth = $dbh->prepare("SELECT found, priority FROM reserves WHERE biblionumber = ? order by priority LIMIT 1"); |
752 |
$sth->execute($biblionumber); |
760 |
$sth->execute($biblionumber); |
753 |
} else { |
|
|
754 |
return; |
755 |
} |
761 |
} |
756 |
($found, $priority) = $sth->fetchrow_array; |
762 |
($found, $priority) = $sth->fetchrow_array; |
757 |
|
763 |
|
|
|
764 |
return unless defined $found; |
758 |
return 'Waiting' if $found eq 'W' and $priority == 0; |
765 |
return 'Waiting' if $found eq 'W' and $priority == 0; |
759 |
return 'Finished' if $found eq 'F'; |
766 |
return 'Finished' if $found eq 'F'; |
760 |
return 'Reserved' if $priority > 0; |
767 |
return 'Reserved' if $priority > 0; |
Lines 1455-1462
sub IsAvailableForItemLevelRequest {
Link Here
|
1455 |
if (C4::Context->preference('AllowOnShelfHolds')) { |
1462 |
if (C4::Context->preference('AllowOnShelfHolds')) { |
1456 |
return $available_per_item; |
1463 |
return $available_per_item; |
1457 |
} else { |
1464 |
} else { |
1458 |
my $status = GetReserveStatus($itemnumber); |
1465 |
return ($available_per_item and ($item->{onloan} or GetReserveStatus($itemnumber) eq "Waiting")); |
1459 |
return ($available_per_item and ($item->{onloan} or $status eq "Waiting" or $status = "Reserved")); |
|
|
1460 |
} |
1466 |
} |
1461 |
} |
1467 |
} |
1462 |
|
1468 |
|
1463 |
- |
|
|