|
Lines 156-161
unless ( $enddate ) {
Link Here
|
| 156 |
# building query parameters |
156 |
# building query parameters |
| 157 |
my %where = ( |
157 |
my %where = ( |
| 158 |
'reserve.found' => undef, |
158 |
'reserve.found' => undef, |
|
|
159 |
'reserve.priority' => 1, |
| 159 |
'reserve.suspend' => 0, |
160 |
'reserve.suspend' => 0, |
| 160 |
'itembib.itemlost' => 0, |
161 |
'itembib.itemlost' => 0, |
| 161 |
'itembib.withdrawn' => 0, |
162 |
'itembib.withdrawn' => 0, |
|
Lines 222-227
my $patrons_count = {
Link Here
|
| 222 |
} |
223 |
} |
| 223 |
}; |
224 |
}; |
| 224 |
|
225 |
|
|
|
226 |
my $holds_biblios_map = { |
| 227 |
map { $_->{biblionumber} => $_->{reserve_id} } @{ Koha::Holds->search( |
| 228 |
{%where}, |
| 229 |
{ |
| 230 |
join => ['itembib', 'biblio'], |
| 231 |
alias => 'reserve', |
| 232 |
select => ['reserve.biblionumber', 'reserve.reserve_id'], |
| 233 |
} |
| 234 |
)->unblessed |
| 235 |
} |
| 236 |
}; |
| 237 |
|
| 238 |
my $all_holds = { |
| 239 |
map { $_->biblionumber => $_ } @{ Koha::Holds->search( |
| 240 |
{ reserve_id => [ values %$holds_biblios_map ]}, |
| 241 |
{ |
| 242 |
prefetch => [ 'borrowernumber', 'itembib', 'biblio' ], |
| 243 |
alias => 'reserve', |
| 244 |
} |
| 245 |
)->as_list |
| 246 |
} |
| 247 |
}; |
| 248 |
|
| 225 |
# make final holds_info array and fill with info |
249 |
# make final holds_info array and fill with info |
| 226 |
my @holds_info; |
250 |
my @holds_info; |
| 227 |
foreach my $bibnum ( @biblionumbers ){ |
251 |
foreach my $bibnum ( @biblionumbers ){ |
|
Lines 275-287
foreach my $bibnum ( @biblionumbers ){
Link Here
|
| 275 |
$hold_info->{pull_count} = $pull_count; |
299 |
$hold_info->{pull_count} = $pull_count; |
| 276 |
|
300 |
|
| 277 |
# get other relevant information |
301 |
# get other relevant information |
| 278 |
my $res_info = Koha::Holds->search( |
302 |
my $res_info = $all_holds->{$bibnum}; |
| 279 |
{ 'reserve.biblionumber' => $bibnum, %where }, |
|
|
| 280 |
{ prefetch => [ 'borrowernumber', 'itembib', 'biblio' ], |
| 281 |
order_by => 'priority', |
| 282 |
alias => 'reserve' |
| 283 |
} |
| 284 |
)->next; # get first item in results |
| 285 |
$hold_info->{patron} = $res_info->patron; |
303 |
$hold_info->{patron} = $res_info->patron; |
| 286 |
$hold_info->{item} = $res_info->item; |
304 |
$hold_info->{item} = $res_info->item; |
| 287 |
$hold_info->{biblio} = $res_info->biblio; |
305 |
$hold_info->{biblio} = $res_info->biblio; |
| 288 |
- |
|
|