Lines 174-180
sub AddReserve {
Link Here
|
174 |
# of the document, we force the value $priority and $found . |
174 |
# of the document, we force the value $priority and $found . |
175 |
if ( $checkitem and not C4::Context->preference('ReservesNeedReturns') ) { |
175 |
if ( $checkitem and not C4::Context->preference('ReservesNeedReturns') ) { |
176 |
my $item = Koha::Items->find( $checkitem ); # FIXME Prevent bad calls |
176 |
my $item = Koha::Items->find( $checkitem ); # FIXME Prevent bad calls |
177 |
if ( !$item->onloan && $item->holdingbranch eq $branch && ( $item->damaged && C4::Context->preference('AllowHoldsOnDamagedItems') || !$item->damaged ) && !$item->get_transfer && !$item->holds->count ) { |
177 |
|
|
|
178 |
if ( |
179 |
# If item is already checked out, it cannot be set waiting |
180 |
!$item->onloan |
181 |
|
182 |
# The item can't be waiting if it needs a transfer |
183 |
&& $item->holdingbranch eq $branch |
184 |
|
185 |
# Similarly, if in transit it can't be waiting |
186 |
&& !$item->get_transfer |
187 |
|
188 |
# If we can't hold damaged items, and it is damaged, it can't be waiting |
189 |
&& ( $item->damaged && C4::Context->preference('AllowHoldsOnDamagedItems') || !$item->damaged ) |
190 |
|
191 |
# Lastly, if this already has holds, we shouldn't make it waiting for the new hold |
192 |
&& !$item->holds->count ) |
193 |
{ |
178 |
$priority = 0; |
194 |
$priority = 0; |
179 |
$found = 'W'; |
195 |
$found = 'W'; |
180 |
} |
196 |
} |
181 |
- |
|
|