|
Lines 205-211
foreach my $bibnum ( @biblionumbers ){
Link Here
|
| 205 |
my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 }); |
205 |
my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 }); |
| 206 |
my @issues = map { $_->itemnumber } Koha::Checkouts->search({}, { columns => [ 'itemnumber' ], collapse => 1 }); |
206 |
my @issues = map { $_->itemnumber } Koha::Checkouts->search({}, { columns => [ 'itemnumber' ], collapse => 1 }); |
| 207 |
|
207 |
|
| 208 |
my $items = Koha::Items->search( |
208 |
@items = Koha::Items->search( |
| 209 |
{ |
209 |
{ |
| 210 |
biblionumber => $bibnum, |
210 |
biblionumber => $bibnum, |
| 211 |
itemlost => 0, |
211 |
itemlost => 0, |
|
Lines 216-316
foreach my $bibnum ( @biblionumbers ){
Link Here
|
| 216 |
); |
216 |
); |
| 217 |
|
217 |
|
| 218 |
# get available item types for each biblio |
218 |
# get available item types for each biblio |
| 219 |
my $res_itemtypes; |
219 |
my @res_itemtypes; |
| 220 |
if ( C4::Context->preference('item-level_itypes') ){ |
220 |
if ( C4::Context->preference('item-level_itypes') ){ |
| 221 |
$res_itemtypes = $items->search( |
221 |
@res_itemtypes = uniq map { defined $_->itype ? $_->itype : () } @items; |
| 222 |
{ |
|
|
| 223 |
itype => { '!=', undef }, |
| 224 |
}, |
| 225 |
{ |
| 226 |
columns => 'itype', |
| 227 |
distinct => 1, |
| 228 |
} |
| 229 |
); |
| 230 |
} else { |
222 |
} else { |
| 231 |
my $res_itemtypes = Koha::Biblioitems->search( |
223 |
@res_itemtypes = Koha::Biblioitems->search( |
| 232 |
{ biblionumber => $bibnum, itemtype => { '!=', undef } }, |
224 |
{ biblionumber => $bibnum, itemtype => { '!=', undef } }, |
| 233 |
{ columns => 'itemtype', |
225 |
{ columns => 'itemtype', |
| 234 |
distinct => 1, |
226 |
distinct => 1, |
| 235 |
} |
227 |
} |
| 236 |
); |
228 |
)->get_column('itemtype'); |
| 237 |
} |
229 |
} |
| 238 |
$reserves->{$bibnum}->{itemtypes} = $res_itemtypes; |
230 |
$reserves->{$bibnum}->{itemtypes} = \@res_itemtypes; |
| 239 |
|
231 |
|
| 240 |
# get available locations for each biblio |
232 |
# get available locations for each biblio |
| 241 |
my $res_locations = $items->search( |
233 |
$reserves->{$bibnum}->{locations} = [ uniq map { defined $_->location ? $_->location : () } @items ]; |
| 242 |
{ |
|
|
| 243 |
location => { '!=', undef }, |
| 244 |
}, |
| 245 |
{ |
| 246 |
columns => 'location', |
| 247 |
distinct => 1, |
| 248 |
} |
| 249 |
); |
| 250 |
$reserves->{$bibnum}->{locations} = $res_locations; |
| 251 |
|
234 |
|
| 252 |
# get available callnumbers for each biblio |
235 |
# get available callnumbers for each biblio |
| 253 |
my $res_callnumbers = $items->search( |
236 |
$reserves->{$bibnum}->{locations} = [ uniq map { defined $_->itemcallnumber ? $_->itemcallnumber : () } @items ]; |
| 254 |
{ |
|
|
| 255 |
itemcallnumber => { '!=', undef }, |
| 256 |
}, |
| 257 |
{ |
| 258 |
columns => 'itemcallnumber', |
| 259 |
distinct => 1, |
| 260 |
} |
| 261 |
); |
| 262 |
$reserves->{$bibnum}->{callnumbers} = $res_callnumbers; |
| 263 |
|
237 |
|
| 264 |
# get available enumchrons for each biblio |
238 |
# get available enumchrons for each biblio |
| 265 |
my $res_enumchrons = $items->search( |
239 |
$reserves->{$bibnum}->{enumchrons} = [ uniq map { defined $_->enumchron ? $_->enumchron : () } @items ]; |
| 266 |
{ |
|
|
| 267 |
enumchron => { '!=', undef }, |
| 268 |
}, |
| 269 |
{ |
| 270 |
columns => 'enumchron', |
| 271 |
distinct => 1, |
| 272 |
} |
| 273 |
); |
| 274 |
$reserves->{$bibnum}->{enumchrons} = $res_enumchrons; |
| 275 |
|
240 |
|
| 276 |
# get available copynumbers for each biblio |
241 |
# get available copynumbers for each biblio |
| 277 |
my $res_copynumbers = $items->search( |
242 |
$reserves->{$bibnum}->{copynumbers} = [ uniq map { defined $_->copynumber ? $_->copynumber : () } @items ]; |
| 278 |
{ |
|
|
| 279 |
copynumber => { '!=', undef }, |
| 280 |
}, |
| 281 |
{ |
| 282 |
columns => 'copynumber', |
| 283 |
distinct => 1, |
| 284 |
} |
| 285 |
); |
| 286 |
$reserves->{$bibnum}->{copynumbers} = $res_copynumbers; |
| 287 |
|
243 |
|
| 288 |
# get available barcodes for each biblio |
244 |
# get available barcodes for each biblio |
| 289 |
my $res_barcodes = $items->search( |
245 |
$reserves->{$bibnum}->{barcodes} = [ uniq map { defined $_->barcode ? $_->barcode : () } @items ]; |
| 290 |
{ |
|
|
| 291 |
barcode => { '!=', undef }, |
| 292 |
}, |
| 293 |
{ |
| 294 |
columns => 'barcode', |
| 295 |
distinct => 1, |
| 296 |
} |
| 297 |
); |
| 298 |
$reserves->{$bibnum}->{barcodes} = $res_barcodes; |
| 299 |
|
246 |
|
| 300 |
# get available holding branches for each biblio |
247 |
# get available holding branches for each biblio |
| 301 |
my $res_holdingbranches = $items->search( |
248 |
$reserves->{$bibnum}->{holdingbranches} = [ uniq map { defined $_->holdingbranch ? $_->holdingbranch : () } @items ]; |
| 302 |
{ |
|
|
| 303 |
holdingbranch => { '!=', undef }, |
| 304 |
}, |
| 305 |
{ |
| 306 |
columns => 'holdingbranch', |
| 307 |
distinct => 1, |
| 308 |
} |
| 309 |
); |
| 310 |
$reserves->{$bibnum}->{holdingbranches} = $res_holdingbranches; |
| 311 |
|
249 |
|
| 312 |
# items available |
250 |
# items available |
| 313 |
my $items_count = $items->count; |
251 |
my $items_count = scalar @items; |
| 314 |
$reserves->{$bibnum}->{items_count} = $items_count; |
252 |
$reserves->{$bibnum}->{items_count} = $items_count; |
| 315 |
|
253 |
|
| 316 |
# patrons with holds |
254 |
# patrons with holds |