|
Lines 1188-1194
and canreservefromotherbranches.
Link Here
|
| 1188 |
=cut |
1188 |
=cut |
| 1189 |
|
1189 |
|
| 1190 |
sub IsAvailableForItemLevelRequest { |
1190 |
sub IsAvailableForItemLevelRequest { |
| 1191 |
my ( $item, $patron, $pickup_branchcode ) = @_; |
1191 |
my $item = shift; |
|
|
1192 |
my $patron = shift; |
| 1193 |
my $pickup_branchcode = shift; |
| 1194 |
# items_any_available is precalculated status passed from request.pl when set of items |
| 1195 |
# looped outside of IsAvailableForItemLevelRequest to avoid nested loops: |
| 1196 |
my $items_any_available = shift; |
| 1192 |
|
1197 |
|
| 1193 |
my $dbh = C4::Context->dbh; |
1198 |
my $dbh = C4::Context->dbh; |
| 1194 |
# must check the notforloan setting of the itemtype |
1199 |
# must check the notforloan setting of the itemtype |
|
Lines 1205-1212
sub IsAvailableForItemLevelRequest {
Link Here
|
| 1205 |
$item->withdrawn || |
1210 |
$item->withdrawn || |
| 1206 |
($item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems')); |
1211 |
($item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems')); |
| 1207 |
|
1212 |
|
| 1208 |
my $on_shelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); |
|
|
| 1209 |
|
| 1210 |
if ($pickup_branchcode) { |
1213 |
if ($pickup_branchcode) { |
| 1211 |
my $destination = Koha::Libraries->find($pickup_branchcode); |
1214 |
my $destination = Koha::Libraries->find($pickup_branchcode); |
| 1212 |
return 0 unless $destination; |
1215 |
return 0 unless $destination; |
|
Lines 1214-1222
sub IsAvailableForItemLevelRequest {
Link Here
|
| 1214 |
return 0 unless $item->can_be_transferred( { to => $destination } ); |
1217 |
return 0 unless $item->can_be_transferred( { to => $destination } ); |
| 1215 |
} |
1218 |
} |
| 1216 |
|
1219 |
|
|
|
1220 |
my $on_shelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); |
| 1221 |
|
| 1217 |
if ( $on_shelf_holds == 1 ) { |
1222 |
if ( $on_shelf_holds == 1 ) { |
| 1218 |
return 1; |
1223 |
return 1; |
| 1219 |
} elsif ( $on_shelf_holds == 2 ) { |
1224 |
} elsif ( $on_shelf_holds == 2 ) { |
|
|
1225 |
|
| 1226 |
# if we have this param predefined from outer caller sub, we just need |
| 1227 |
# to return it, so we saving from having loop inside other loop: |
| 1228 |
return $items_any_available ? 0 : 1 |
| 1229 |
if defined $items_any_available; |
| 1230 |
|
| 1220 |
my @items = |
1231 |
my @items = |
| 1221 |
Koha::Items->search( { biblionumber => $item->biblionumber } ); |
1232 |
Koha::Items->search( { biblionumber => $item->biblionumber } ); |
| 1222 |
|
1233 |
|