@@ -, +, @@ processing to 'default' barcode for this biblio biblio detail page, in the toolbar, click "Edit -> Link to host record" and enter the barcode for the item you created at step 2 results with the search "child" (and not be redirected to the detail page) You should see two results, no items. Click on one of them. On the detail page you should see one item (the one from the host record) You should now see one item (the same item) for each result. --- C4/XSLT.pm | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) --- a/C4/XSLT.pm +++ a/C4/XSLT.pm @@ -263,7 +263,7 @@ sub XSLTParse4Display { if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" || $xslsyspref eq "XSLTResultsDisplay" ) { $itemsxml = ""; #We don't use XSLT for items display on these pages } else { - $itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items, $items_rs); + $itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items, $items_rs, $record); } my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour')); @@ -324,20 +324,30 @@ Is only used in this module currently. =cut sub buildKohaItemsNamespace { - my ($biblionumber, $hidden_items, $items_rs) = @_; + my ($biblionumber, $hidden_items, $items_rs, $record) = @_; $hidden_items ||= []; - my $query = {}; - $query = { 'me.itemnumber' => { not_in => $hidden_items } } - if $hidden_items; - unless ( $items_rs && ref($items_rs) eq 'Koha::Items' ) { - $query->{'me.biblionumber'} = $biblionumber; - $items_rs = Koha::Items->new; + # adding linked items that belong to host records + my @linkeditemnumbers; + if ( C4::Context->preference('EasyAnalyticalRecords') ) { + my $analyticsfield = C4::Context->preference("marcflavour") eq 'UNIMARC' ? '461' : '773'; + @linkeditemnumbers = map { $_->subfield('9') } $record->field($analyticsfield); + } + + $items_rs = Koha::Items->search( + [ + 'me.biblionumber' => $biblionumber, + 'me.itemnumber' => { in => \@linkeditemnumbers }, + ] + ); } - my $items = $items_rs->search( $query, { prefetch => [ 'branchtransfers', 'reserves' ] } ); + my $items = $items_rs->search( + { 'me.itemnumber' => { not_in => $hidden_items } }, + { prefetch => [ 'branchtransfers', 'reserves' ] } + ); my $shelflocations = { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) }; --