Lines 1279-1295
sub IsAvailableForItemLevelRequest {
Link Here
|
1279 |
|
1279 |
|
1280 |
if ( $on_shelf_holds == 1 ) { |
1280 |
if ( $on_shelf_holds == 1 ) { |
1281 |
return 1; |
1281 |
return 1; |
1282 |
} elsif ( $on_shelf_holds == 2 ) { |
1282 |
} elsif ( $on_shelf_holds == 2 ) { # On shelf holds == "If all unavailable" |
1283 |
|
1283 |
|
1284 |
# if we have this param predefined from outer caller sub, we just need |
1284 |
# if we have this param predefined from outer caller sub, we just need |
1285 |
# to return it, so we saving from having loop inside other loop: |
1285 |
# to return it, so we saving from having loop inside other loop: |
1286 |
return $items_any_available ? 0 : 1 |
1286 |
$items_any_available //= ItemsAnyAvailableForHold( { biblionumber => $item->biblionumber, patron => $patron }); |
1287 |
if defined $items_any_available; |
|
|
1288 |
|
1287 |
|
1289 |
my $any_available = ItemsAnyAvailableForHold( { biblionumber => $item->biblionumber, patron => $patron }); |
1288 |
return !$items_any_available; |
1290 |
return $any_available ? 0 : 1; |
|
|
1291 |
} else { # on_shelf_holds == 0 "If any unavailable" (the description is rather cryptic and could still be improved) |
1289 |
} else { # on_shelf_holds == 0 "If any unavailable" (the description is rather cryptic and could still be improved) |
1292 |
return $item->onloan || IsItemOnHoldAndFound( $item->itemnumber ); |
1290 |
return $item->notforloan < 0 || $item->onloan || IsItemOnHoldAndFound( $item->itemnumber ); |
1293 |
} |
1291 |
} |
1294 |
} |
1292 |
} |
1295 |
|
1293 |
|
Lines 1319-1325
sub ItemsAnyAvailableForHold {
Link Here
|
1319 |
|
1317 |
|
1320 |
$any_available = 1 |
1318 |
$any_available = 1 |
1321 |
unless $i->itemlost |
1319 |
unless $i->itemlost |
1322 |
|| $i->notforloan > 0 |
1320 |
|| $i->notforloan != 0 |
1323 |
|| $i->withdrawn |
1321 |
|| $i->withdrawn |
1324 |
|| $i->onloan |
1322 |
|| $i->onloan |
1325 |
|| IsItemOnHoldAndFound( $i->id ) |
1323 |
|| IsItemOnHoldAndFound( $i->id ) |