'an',
'Any',
'at',
+ 'arl',
+ 'arp',
'au',
'aub',
'aud',
my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber','');
# set stuff for XSLT processing here once, not later again for every record we retrieved
- my $interface = $search_context eq 'opac' ? 'OPAC' : '';
+ my $interface = $is_opac ? 'OPAC' : '';
my $xslsyspref = $interface . "XSLTResultsDisplay";
my $xslfile = C4::Context->preference($xslsyspref);
my $lang = $xslfile ? C4::Languages::getlanguage() : undef;
# Pull out the items fields
my @fields = $marcrecord->field($itemtag);
my $marcflavor = C4::Context->preference("marcflavour");
+
# adding linked items that belong to host records
- my $analyticsfield = '773';
- if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') {
- $analyticsfield = '773';
- } elsif ($marcflavor eq 'UNIMARC') {
- $analyticsfield = '461';
- }
- foreach my $hostfield ( $marcrecord->field($analyticsfield)) {
- my $hostbiblionumber = $hostfield->subfield("0");
- my $linkeditemnumber = $hostfield->subfield("9");
- if( $hostbiblionumber ) {
- my $hostbiblio = GetMarcBiblio({
- biblionumber => $hostbiblionumber,
- embed_items => 1 });
- my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) );
- if( $hostbiblio ) {
- my @hostitems = $hostbiblio->field($itemfield);
- foreach my $hostitem (@hostitems){
- if ($hostitem->subfield("9") eq $linkeditemnumber){
- my $linkeditem =$hostitem;
- # append linked items if they exist
- push @fields, $linkeditem if $linkeditem;
+ if ( C4::Context->preference('EasyAnalyticalRecords') ) {
+ my $analyticsfield = '773';
+ if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') {
+ $analyticsfield = '773';
+ } elsif ($marcflavor eq 'UNIMARC') {
+ $analyticsfield = '461';
+ }
+ foreach my $hostfield ( $marcrecord->field($analyticsfield)) {
+ my $hostbiblionumber = $hostfield->subfield("0");
+ my $linkeditemnumber = $hostfield->subfield("9");
+ if( $hostbiblionumber ) {
+ my $hostbiblio = GetMarcBiblio({
+ biblionumber => $hostbiblionumber,
+ embed_items => 1 });
+ my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) );
+ if( $hostbiblio ) {
+ my @hostitems = $hostbiblio->field($itemfield);
+ foreach my $hostitem (@hostitems){
+ if ($hostitem->subfield("9") eq $linkeditemnumber){
+ my $linkeditem =$hostitem;
+ # append linked items if they exist
+ push @fields, $linkeditem if $linkeditem;
+ }
}
}
}
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber};
$onloan_items->{$key}->{description} = $item->{description};
$onloan_items->{$key}->{imageurl} =
- getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} );
+ getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype} }->{imageurl} );
# if something's checked out and lost, mark it as 'long overdue'
if ( $item->{itemlost} ) {
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0;
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0;
$other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value and $item->{notforloan};
- $other_items->{$key}->{count}++ if $item->{$hbranch};
- $other_items->{$key}->{location} = $shelflocations->{ $item->{location} };
- $other_items->{$key}->{description} = $item->{description};
+ $other_items->{$key}->{count}++ if $item->{$hbranch};
+ $other_items->{$key}->{location} = $shelflocations->{ $item->{location} };
+ $other_items->{$key}->{description} = $item->{description};
$other_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype} }->{imageurl} );
}
# item is available
else {
$can_place_holds = 1;
$available_count++;
- $available_items->{$prefix}->{count}++ if $item->{$hbranch};
- foreach (qw(branchname itemcallnumber description)) {
- $available_items->{$prefix}->{$_} = $item->{$_};
- }
- $available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} };
+ $available_items->{$prefix}->{count}++ if $item->{$hbranch};
+ foreach (qw(branchname itemcallnumber description)) {
+ $available_items->{$prefix}->{$_} = $item->{$_};
+ }
+ $available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} };
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype} }->{imageurl} );
}
}
# XSLT processing of some stuff
# we fetched the sysprefs already before the loop through all retrieved record!
- my $interface = $search_context->{'interface'} eq 'opac' ? 'OPAC' : '';
if (!$scan && $xslfile) {
$oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang);
}
}
}
$oldbiblio->{norequests} = 1 unless $can_place_holds;
- $oldbiblio->{itemsplural} = 1 if $items_count > 1;
$oldbiblio->{items_count} = $items_count;
$oldbiblio->{available_items_loop} = \@available_items_loop;
$oldbiblio->{onloan_items_loop} = \@onloan_items_loop;