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