Lines 292-301
Is only used in this module currently.
Link Here
|
292 |
sub buildKohaItemsNamespace { |
292 |
sub buildKohaItemsNamespace { |
293 |
my ($biblionumber, $hidden_items) = @_; |
293 |
my ($biblionumber, $hidden_items) = @_; |
294 |
|
294 |
|
295 |
my $search_params; |
295 |
$hidden_items ||= []; |
296 |
$search_params->{'me.biblionumber'} = $biblionumber; |
296 |
my @items = Koha::Items->search( |
297 |
$search_params->{'me.itemnumber'} = { not_in => $hidden_items } if $hidden_items; |
297 |
{ |
298 |
my @items = Koha::Items->search($search_params,{prefetch=>['branchtransfers','reserves']}); |
298 |
'me.biblionumber' => $biblionumber, |
|
|
299 |
'me.itemnumber' => { not_in => $hidden_items } |
300 |
}, |
301 |
{ prefetch => [ 'branchtransfers', 'reserves' ] } |
302 |
); |
299 |
|
303 |
|
300 |
my $shelflocations = |
304 |
my $shelflocations = |
301 |
{ map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) }; |
305 |
{ map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) }; |
Lines 305-318
sub buildKohaItemsNamespace {
Link Here
|
305 |
my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' }); |
309 |
my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' }); |
306 |
|
310 |
|
307 |
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } }; |
311 |
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } }; |
308 |
my $location = ""; |
|
|
309 |
my $ccode = ""; |
310 |
my $xml = ''; |
312 |
my $xml = ''; |
311 |
for my $item (@items) { |
313 |
for my $item (@items) { |
312 |
my $status; |
314 |
my $status; |
313 |
|
315 |
|
314 |
my $reservestatus = C4::Reserves::GetReserveStatus( $item->itemnumber ); |
|
|
315 |
|
316 |
if ($item->has_pending_hold) { |
316 |
if ($item->has_pending_hold) { |
317 |
$status = 'Pending hold'; |
317 |
$status = 'Pending hold'; |
318 |
} |
318 |
} |
Lines 343-354
sub buildKohaItemsNamespace {
Link Here
|
343 |
else { |
343 |
else { |
344 |
$status = "available"; |
344 |
$status = "available"; |
345 |
} |
345 |
} |
346 |
my $homebranch = $item->homebranch? xml_escape($branches{$item->homebranch}):''; |
346 |
my $homebranch = xml_escape($branches{$item->homebranch}); |
347 |
my $holdingbranch = $item->holdingbranch? xml_escape($branches{$item->holdingbranch}):''; |
347 |
my $holdingbranch = xml_escape($branches{$item->holdingbranch}); |
348 |
$location = $item->location? xml_escape($shelflocations->{$item->location}||$item->location):''; |
348 |
my $location = xml_escape($item->location && exists $shelflocations->{$item->location} ? $shelflocations->{$item->location} : $item->location); |
349 |
$ccode = $item->ccode? xml_escape($ccodes->{$item->ccode}||$item->ccode):''; |
349 |
my $ccode = xml_escape($item->ccode && exists $ccodes->{$item->ccode} ? $ccodes->{$item->ccode} : $item->ccode); |
350 |
my $itemcallnumber = xml_escape($item->itemcallnumber); |
350 |
my $itemcallnumber = xml_escape($item->itemcallnumber); |
351 |
my $stocknumber = $item->stocknumber? xml_escape($item->stocknumber):''; |
351 |
my $stocknumber = xml_escape($item->stocknumber); |
352 |
$xml .= |
352 |
$xml .= |
353 |
"<item>" |
353 |
"<item>" |
354 |
. "<homebranch>$homebranch</homebranch>" |
354 |
. "<homebranch>$homebranch</homebranch>" |
355 |
- |
|
|