Lines 293-306
sub buildKohaItemsNamespace {
Link Here
|
293 |
my ($biblionumber, $hidden_items) = @_; |
293 |
my ($biblionumber, $hidden_items) = @_; |
294 |
|
294 |
|
295 |
my $search_params; |
295 |
my $search_params; |
296 |
$search_params->{biblionumber} = $biblionumber; |
296 |
$search_params->{'me.biblionumber'} = $biblionumber; |
297 |
$search_params->{itemnumber} = { not_in => $hidden_items } if $hidden_items; |
297 |
$search_params->{'me.itemnumber'} = { not_in => $hidden_items } if $hidden_items; |
298 |
my @items = Koha::Items->search($search_params); |
298 |
my @items = Koha::Items->search($search_params,{prefetch=>['branchtransfers','reserves']}); |
299 |
|
299 |
|
300 |
my $shelflocations = |
300 |
my $shelflocations = |
301 |
{ map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => GetFrameworkCode($biblionumber), kohafield => 'items.location' } ) }; |
301 |
{ map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) }; |
302 |
my $ccodes = |
302 |
my $ccodes = |
303 |
{ map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => GetFrameworkCode($biblionumber), kohafield => 'items.ccode' } ) }; |
303 |
{ map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.ccode' } ) }; |
304 |
|
304 |
|
305 |
my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' }); |
305 |
my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' }); |
306 |
|
306 |
|
Lines 311-350
sub buildKohaItemsNamespace {
Link Here
|
311 |
for my $item (@items) { |
311 |
for my $item (@items) { |
312 |
my $status; |
312 |
my $status; |
313 |
|
313 |
|
314 |
my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->itemnumber); |
|
|
315 |
|
316 |
my $reservestatus = C4::Reserves::GetReserveStatus( $item->itemnumber ); |
314 |
my $reservestatus = C4::Reserves::GetReserveStatus( $item->itemnumber ); |
317 |
|
315 |
|
318 |
if ( ( $item->itype && $itemtypes->{ $item->itype }->{notforloan} ) || $item->notforloan || $item->onloan || $item->withdrawn || $item->itemlost || $item->damaged || |
316 |
if ($item->has_pending_hold) { |
319 |
(defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") || $item->has_pending_hold ){ |
317 |
$status = 'Pending hold'; |
320 |
if ( $item->notforloan < 0) { |
318 |
} |
321 |
$status = "On order"; |
319 |
elsif ( $item->holds->waiting->count ) { |
322 |
} |
320 |
$status = 'Waiting'; |
323 |
if ( $item->notforloan && $item->notforloan > 0 || $item->itype && $itemtypes->{ $item->itype }->{notforloan} && $itemtypes->{ $item->itype }->{notforloan} == 1 ) { |
321 |
} |
324 |
$status = "reference"; |
322 |
elsif ($item->get_transfer) { |
325 |
} |
323 |
$status = 'In transit'; |
326 |
if ($item->onloan) { |
324 |
} |
327 |
$status = "Checked out"; |
325 |
elsif ($item->damaged) { |
328 |
} |
326 |
$status = "Damaged"; |
329 |
if ( $item->withdrawn) { |
327 |
} |
330 |
$status = "Withdrawn"; |
328 |
elsif ($item->itemlost) { |
331 |
} |
329 |
$status = "Lost"; |
332 |
if ($item->itemlost) { |
330 |
} |
333 |
$status = "Lost"; |
331 |
elsif ( $item->withdrawn) { |
334 |
} |
332 |
$status = "Withdrawn"; |
335 |
if ($item->damaged) { |
333 |
} |
336 |
$status = "Damaged"; |
334 |
elsif ($item->onloan) { |
337 |
} |
335 |
$status = "Checked out"; |
338 |
if (defined $transfertwhen && $transfertwhen ne '') { |
336 |
} |
339 |
$status = 'In transit'; |
337 |
elsif ( $item->notforloan && $item->notforloan > 0 || $item->itype && $itemtypes->{ $item->itype }->{notforloan} && $itemtypes->{ $item->itype }->{notforloan} == 1 ) { |
340 |
} |
338 |
$status = "reference"; |
341 |
if (defined $reservestatus && $reservestatus eq "Waiting") { |
339 |
} |
342 |
$status = 'Waiting'; |
340 |
elsif ( $item->notforloan < 0) { |
343 |
} |
341 |
$status = "On order"; |
344 |
if ($item->has_pending_hold) { |
342 |
} |
345 |
$status = 'Pending hold'; |
343 |
else { |
346 |
} |
|
|
347 |
} else { |
348 |
$status = "available"; |
344 |
$status = "available"; |
349 |
} |
345 |
} |
350 |
my $homebranch = $item->homebranch? xml_escape($branches{$item->homebranch}):''; |
346 |
my $homebranch = $item->homebranch? xml_escape($branches{$item->homebranch}):''; |
351 |
- |
|
|