Lines 190-196
sub get_xslt_sysprefs {
Link Here
|
190 |
} |
190 |
} |
191 |
|
191 |
|
192 |
sub XSLTParse4Display { |
192 |
sub XSLTParse4Display { |
193 |
my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables ) = @_; |
193 |
my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables, $items_rs ) = @_; |
194 |
|
194 |
|
195 |
$sysxml ||= C4::Context->preference($xslsyspref); |
195 |
$sysxml ||= C4::Context->preference($xslsyspref); |
196 |
$xslfilename ||= C4::Context->preference($xslsyspref); |
196 |
$xslfilename ||= C4::Context->preference($xslsyspref); |
Lines 246-252
sub XSLTParse4Display {
Link Here
|
246 |
if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" || $xslsyspref eq "XSLTResultsDisplay" ) { |
246 |
if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" || $xslsyspref eq "XSLTResultsDisplay" ) { |
247 |
$itemsxml = ""; #We don't use XSLT for items display on these pages |
247 |
$itemsxml = ""; #We don't use XSLT for items display on these pages |
248 |
} else { |
248 |
} else { |
249 |
$itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items); |
249 |
$itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items, $items_rs); |
250 |
} |
250 |
} |
251 |
my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour')); |
251 |
my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour')); |
252 |
|
252 |
|
Lines 289-310
sub XSLTParse4Display {
Link Here
|
289 |
|
289 |
|
290 |
=head2 buildKohaItemsNamespace |
290 |
=head2 buildKohaItemsNamespace |
291 |
|
291 |
|
292 |
Returns XML for items. |
292 |
my $items_xml = buildKohaItemsNamespace( $biblionumber, [ $hidden_items, $items ] ); |
|
|
293 |
|
294 |
Returns XML for items. It accepts two optional parameters: |
295 |
- I<$hidden_items>: An arrayref of itemnumber values, for items that should be hidden |
296 |
- I<$items>: A Koha::Items resultset, for the items to be returned |
297 |
|
298 |
If both parameters are passed, I<$items> is used as the basis resultset, and I<$hidden_items> |
299 |
are filtered out of it. |
300 |
|
293 |
Is only used in this module currently. |
301 |
Is only used in this module currently. |
294 |
|
302 |
|
295 |
=cut |
303 |
=cut |
296 |
|
304 |
|
297 |
sub buildKohaItemsNamespace { |
305 |
sub buildKohaItemsNamespace { |
298 |
my ($biblionumber, $hidden_items) = @_; |
306 |
my ($biblionumber, $hidden_items, $items_rs) = @_; |
299 |
|
307 |
|
300 |
$hidden_items ||= []; |
308 |
$hidden_items ||= []; |
301 |
my @items = Koha::Items->search( |
309 |
|
302 |
{ |
310 |
my $query = {}; |
303 |
'me.biblionumber' => $biblionumber, |
311 |
$query = { 'me.itemnumber' => { not_in => $hidden_items } } |
304 |
'me.itemnumber' => { not_in => $hidden_items } |
312 |
if $hidden_items; |
305 |
}, |
313 |
|
306 |
{ prefetch => [ 'branchtransfers', 'reserves' ] } |
314 |
unless ( $items_rs && ref($items_rs) eq 'Koha::Items' ) { |
307 |
); |
315 |
$query->{'me.biblionumber'} = $biblionumber; |
|
|
316 |
$items_rs = Koha::Items->new; |
317 |
} |
318 |
|
319 |
my $items = $items_rs->search( $query, { prefetch => [ 'branchtransfers', 'reserves' ] } ); |
308 |
|
320 |
|
309 |
my $shelflocations = |
321 |
my $shelflocations = |
310 |
{ map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) }; |
322 |
{ map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) }; |
Lines 318-324
sub buildKohaItemsNamespace {
Link Here
|
318 |
my %descs = map { $_->{authorised_value} => $_ } Koha::AuthorisedValues->get_descriptions_by_koha_field( { kohafield => 'items.notforloan' } ); |
330 |
my %descs = map { $_->{authorised_value} => $_ } Koha::AuthorisedValues->get_descriptions_by_koha_field( { kohafield => 'items.notforloan' } ); |
319 |
my $ref_status = C4::Context->preference('Reference_NFL_Statuses') || '1|2'; |
331 |
my $ref_status = C4::Context->preference('Reference_NFL_Statuses') || '1|2'; |
320 |
|
332 |
|
321 |
for my $item (@items) { |
333 |
while ( my $item = $items->next ) { |
322 |
my $status; |
334 |
my $status; |
323 |
my $substatus = ''; |
335 |
my $substatus = ''; |
324 |
|
336 |
|