Lines 188-214
if ( C4::Context->preference('IndependentBranches') ){
Link Here
|
188 |
} |
188 |
} |
189 |
|
189 |
|
190 |
# get all distinct unfulfilled reserves |
190 |
# get all distinct unfulfilled reserves |
191 |
my @biblionumbers = Koha::Holds->search( |
191 |
my $holds = Koha::Holds->search( |
192 |
{ %where }, |
192 |
{ %where }, |
193 |
{ join => 'itembib', alias => 'reserve', distinct => 1, columns => qw[me.biblionumber] } |
193 |
{ join => 'itembib', alias => 'reserve', distinct => 1, columns => qw[me.biblionumber] } |
194 |
)->get_column('biblionumber'); |
|
|
195 |
|
196 |
my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 }); |
197 |
my @waiting_holds = map { $_->itemnumber } Koha::Holds->search({'found' => 'W'}, { columns => [ 'itemnumber' ], collapse => 1 }); |
198 |
|
199 |
my @all_items = Koha::Items->search( |
200 |
{ |
201 |
biblionumber => { in => \@biblionumbers }, |
202 |
itemlost => 0, |
203 |
withdrawn => 0, |
204 |
notforloan => 0, |
205 |
onloan => undef, |
206 |
itemnumber => { -not_in => [ @branchtransfers, @waiting_holds ] }, |
207 |
} |
208 |
); |
194 |
); |
|
|
195 |
my @biblionumbers = $holds->get_column('biblionumber'); |
209 |
|
196 |
|
210 |
my $all_items; |
197 |
my $all_items; |
211 |
foreach my $item ( @all_items ) { |
198 |
foreach my $item ( $holds->get_items_that_can_fill ) { |
212 |
push @{$all_items->{$item->biblionumber}}, $item; |
199 |
push @{$all_items->{$item->biblionumber}}, $item; |
213 |
} |
200 |
} |
214 |
|
201 |
|
215 |
- |
|
|