View | Details | Raw Unified | Return to bug 23414
Collapse All | Expand All

(-)a/C4/XSLT.pm (-23 / +21 lines)
Lines 292-302 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 @items = C4::Items::GetItemsInfo($biblionumber);
295
    my $search_params;
296
    if ($hidden_items && @$hidden_items) {
296
    $search_params->{biblionumber} = $biblionumber;
297
        my %hi = map {$_ => 1} @$hidden_items;
297
    $search_params->{itemnumber} = { not_in => $hidden_items } if $hidden_items;
298
        @items = grep { !$hi{$_->{itemnumber}} } @items;
298
    my @items = Koha::Items->search($search_params);
299
    }
300
299
301
    my $shelflocations =
300
    my $shelflocations =
302
      { 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 => GetFrameworkCode($biblionumber), kohafield => 'items.location' } ) };
Lines 312-339 sub buildKohaItemsNamespace { Link Here
312
    for my $item (@items) {
311
    for my $item (@items) {
313
        my $status;
312
        my $status;
314
313
315
        my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber});
314
        my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->itemnumber);
316
315
317
        my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} );
316
        my $reservestatus = C4::Reserves::GetReserveStatus( $item->itemnumber );
318
317
319
        if ( ( $item->{itype} && $itemtypes->{ $item->{itype} }->{notforloan} ) || $item->{notforloan} || $item->{onloan} || $item->{withdrawn} || $item->{itemlost} || $item->{damaged} ||
318
        if ( ( $item->itype && $itemtypes->{ $item->itype }->{notforloan} ) || $item->notforloan || $item->onloan || $item->withdrawn || $item->itemlost || $item->damaged ||
320
             (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") || $item->{has_pending_hold} ){
319
             (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") || $item->has_pending_hold ){
321
            if ( $item->{notforloan} < 0) {
320
            if ( $item->notforloan < 0) {
322
                $status = "On order";
321
                $status = "On order";
323
            }
322
            }
324
            if ( $item->{itemnotforloan} && $item->{itemnotforloan} > 0 || $item->{notforloan} && $item->{notforloan} > 0 || $item->{itype} && $itemtypes->{ $item->{itype} }->{notforloan} && $itemtypes->{ $item->{itype} }->{notforloan} == 1 ) {
323
            if ( $item->notforloan && $item->notforloan > 0 || $item->itype && $itemtypes->{ $item->itype }->{notforloan} && $itemtypes->{ $item->itype }->{notforloan} == 1 ) {
325
                $status = "reference";
324
                $status = "reference";
326
            }
325
            }
327
            if ($item->{onloan}) {
326
            if ($item->onloan) {
328
                $status = "Checked out";
327
                $status = "Checked out";
329
            }
328
            }
330
            if ( $item->{withdrawn}) {
329
            if ( $item->withdrawn) {
331
                $status = "Withdrawn";
330
                $status = "Withdrawn";
332
            }
331
            }
333
            if ($item->{itemlost}) {
332
            if ($item->itemlost) {
334
                $status = "Lost";
333
                $status = "Lost";
335
            }
334
            }
336
            if ($item->{damaged}) {
335
            if ($item->damaged) {
337
                $status = "Damaged";
336
                $status = "Damaged";
338
            }
337
            }
339
            if (defined $transfertwhen && $transfertwhen ne '') {
338
            if (defined $transfertwhen && $transfertwhen ne '') {
Lines 342-359 sub buildKohaItemsNamespace { Link Here
342
            if (defined $reservestatus && $reservestatus eq "Waiting") {
341
            if (defined $reservestatus && $reservestatus eq "Waiting") {
343
                $status = 'Waiting';
342
                $status = 'Waiting';
344
            }
343
            }
345
            if ($item->{has_pending_hold}) {
344
            if ($item->has_pending_hold) {
346
                $status = 'Pending hold';
345
                $status = 'Pending hold';
347
            }
346
            }
348
        } else {
347
        } else {
349
            $status = "available";
348
            $status = "available";
350
        }
349
        }
351
        my $homebranch = $item->{homebranch}? xml_escape($branches{$item->{homebranch}}):'';
350
        my $homebranch = $item->homebranch? xml_escape($branches{$item->homebranch}):'';
352
        my $holdingbranch = $item->{holdingbranch}? xml_escape($branches{$item->{holdingbranch}}):'';
351
        my $holdingbranch = $item->holdingbranch? xml_escape($branches{$item->holdingbranch}):'';
353
        $location = $item->{location}? xml_escape($shelflocations->{$item->{location}}||$item->{location}):'';
352
        $location = $item->location? xml_escape($shelflocations->{$item->location}||$item->location):'';
354
        $ccode = $item->{ccode}? xml_escape($ccodes->{$item->{ccode}}||$item->{ccode}):'';
353
        $ccode = $item->ccode? xml_escape($ccodes->{$item->ccode}||$item->ccode):'';
355
        my $itemcallnumber = xml_escape($item->{itemcallnumber});
354
        my $itemcallnumber = xml_escape($item->itemcallnumber);
356
        my $stocknumber = $item->{stocknumber}? xml_escape($item->{stocknumber}):'';
355
        my $stocknumber = $item->stocknumber? xml_escape($item->stocknumber):'';
357
        $xml .=
356
        $xml .=
358
            "<item>"
357
            "<item>"
359
          . "<homebranch>$homebranch</homebranch>"
358
          . "<homebranch>$homebranch</homebranch>"
360
- 

Return to bug 23414