Browse Source

Bug 23964: (follow-up) Add comments and improve readability

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
remotes/origin/19.11.x
Nick Clemens 5 years ago
committed by Martin Renvoize
parent
commit
f847cfdd7e
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 18
      C4/Reserves.pm

18
C4/Reserves.pm

@ -174,7 +174,23 @@ sub AddReserve {
# of the document, we force the value $priority and $found .
if ( $checkitem and not C4::Context->preference('ReservesNeedReturns') ) {
my $item = Koha::Items->find( $checkitem ); # FIXME Prevent bad calls
if ( !$item->onloan && $item->holdingbranch eq $branch && ( $item->damaged && C4::Context->preference('AllowHoldsOnDamagedItems') || !$item->damaged ) && !$item->get_transfer && !$item->holds->count ) {
if (
# If item is already checked out, it cannot be set waiting
!$item->onloan
# The item can't be waiting if it needs a transfer
&& $item->holdingbranch eq $branch
# Similarly, if in transit it can't be waiting
&& !$item->get_transfer
# If we can't hold damaged items, and it is damaged, it can't be waiting
&& ( $item->damaged && C4::Context->preference('AllowHoldsOnDamagedItems') || !$item->damaged )
# Lastly, if this already has holds, we shouldn't make it waiting for the new hold
&& !$item->holds->count )
{
$priority = 0;
$found = 'W';
}

Loading…
Cancel
Save