X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FXSLT.pm;h=8f24df9e74db167129ef8382d1985cc76077933f;hb=b24252bedeb76e04e83ae377fb1f3ea85590d000;hp=56ba5446622657967a01f16ca6a2d05c473cc4a2;hpb=574f46fb19a933a6ef25d32423785cafc378213c;p=koha.git diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 56ba544662..8f24df9e74 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -39,7 +39,7 @@ use vars qw($VERSION @ISA @EXPORT); BEGIN { require Exporter; - $VERSION = 0.03; + $VERSION = 3.07.00.049; @ISA = qw(Exporter); @EXPORT = qw( &XSLTParse4Display @@ -140,35 +140,35 @@ sub XSLTParse4Display { my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items ) = @_; my $xslfilename = C4::Context->preference($xslsyspref); if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) { + my $htdocs; + my $theme; + my $lang = C4::Templates::_current_language(); + my $xslfile; if ($xslsyspref eq "XSLTDetailsDisplay") { - $xslfilename = C4::Context->config('intrahtdocs') . - '/' . C4::Context->preference("template") . - '/' . C4::Templates::_current_language() . - '/xslt/' . - C4::Context->preference('marcflavour') . - "slim2intranetDetail.xsl"; + $htdocs = C4::Context->config('intrahtdocs'); + $theme = C4::Context->preference("template"); + $xslfile = C4::Context->preference('marcflavour') . + "slim2intranetDetail.xsl"; } elsif ($xslsyspref eq "XSLTResultsDisplay") { - $xslfilename = C4::Context->config('intrahtdocs') . - '/' . C4::Context->preference("template") . - '/' . C4::Templates::_current_language() . - '/xslt/' . - C4::Context->preference('marcflavour') . + $htdocs = C4::Context->config('intrahtdocs'); + $theme = C4::Context->preference("template"); + $xslfile = C4::Context->preference('marcflavour') . "slim2intranetResults.xsl"; } elsif ($xslsyspref eq "OPACXSLTDetailsDisplay") { - $xslfilename = C4::Context->config('opachtdocs') . - '/' . C4::Context->preference("opacthemes") . - '/' . C4::Templates::_current_language() . - '/xslt/' . - C4::Context->preference('marcflavour') . - "slim2OPACDetail.xsl"; + $htdocs = C4::Context->config('opachtdocs'); + $theme = C4::Context->preference("opacthemes"); + $xslfile = C4::Context->preference('marcflavour') . + "slim2OPACDetail.xsl"; } elsif ($xslsyspref eq "OPACXSLTResultsDisplay") { - $xslfilename = C4::Context->config('opachtdocs') . - '/' . C4::Context->preference("opacthemes") . - '/' . C4::Templates::_current_language() . - '/xslt/' . - C4::Context->preference('marcflavour') . - "slim2OPACResults.xsl"; + $htdocs = C4::Context->config('opachtdocs'); + $theme = C4::Context->preference("opacthemes"); + $xslfile = C4::Context->preference('marcflavour') . + "slim2OPACResults.xsl"; } + $xslfilename = "$htdocs/$theme/$lang/xslt/$xslfile"; + $xslfilename = "$htdocs/$theme/en/xslt/$xslfile" unless ( $lang ne 'en' && -f $xslfilename ); + $xslfilename = "$htdocs/prog/$lang/xslt/$xslfile" unless ( -f $xslfilename ); + $xslfilename = "$htdocs/prog/en/xslt/$xslfile" unless ( $lang ne 'en' && -f $xslfilename ); } if ( $xslfilename =~ m/\{langcode\}/ ) { @@ -187,8 +187,10 @@ sub XSLTParse4Display { OPACBaseURL TraceCompleteSubfields UseICU UseAuthoritiesForTracings TraceSubjectSubdivisions Display856uAsImage OPACDisplay856uAsImage - UseControlNumber - AlternateHoldingsField AlternateHoldingsSeparator / ) + UseControlNumber IntranetBiblioDefaultView BiblioDefaultView + singleBranchMode OPACItemLocation DisplayIconsXSLT + AlternateHoldingsField AlternateHoldingsSeparator + TrackClicks / ) { my $sp = C4::Context->preference( $syspref ); next unless defined($sp); @@ -219,7 +221,8 @@ sub XSLTParse4Display { $stylesheet->{$xslfilename} = $xslt->parse_stylesheet($style_doc); } my $results = $stylesheet->{$xslfilename}->transform($source); - my $newxmlrecord = $stylesheet->{$xslfilename}->output_string($results); + my $newxmlrecord = $stylesheet->{$xslfilename}->output_as_chars($results); + #no need to decode with UTF-8 in header of XSLT templates: BZ 6554 return $newxmlrecord; } @@ -231,15 +234,21 @@ sub buildKohaItemsNamespace { my %hi = map {$_ => 1} @$hidden_items; @items = grep { !$hi{$_->{itemnumber}} } @items; } + + my $shelflocations = GetKohaAuthorisedValues('items.location',GetFrameworkCode($biblionumber), 'opac'); + my $ccodes = GetKohaAuthorisedValues('items.ccode',GetFrameworkCode($biblionumber), 'opac'); + my $branches = GetBranches(); my $itemtypes = GetItemTypes(); + my $location = ""; + my $ccode = ""; my $xml = ''; for my $item (@items) { my $status; my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber}); - my ( $reservestatus, $reserveitem, undef ) = C4::Reserves::CheckReserves($item->{itemnumber}); + my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} ); if ( $itemtypes->{ $item->{itype} }->{notforloan} || $item->{notforloan} || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} || (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") ){ @@ -271,8 +280,14 @@ sub buildKohaItemsNamespace { $status = "available"; } my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):''; - my $itemcallnumber = xml_escape($item->{itemcallnumber}); + my $holdingbranch = $item->{holdingbranch}? xml_escape($branches->{$item->{holdingbranch}}->{'branchname'}):''; + $location = $item->{location}? xml_escape($shelflocations->{$item->{location}}||$item->{location}):''; + $ccode = $item->{ccode}? xml_escape($ccodes->{$item->{ccode}}||$item->{ccode}):''; + my $itemcallnumber = xml_escape($item->{itemcallnumber}); $xml.= "$homebranch". + "$holdingbranch". + "$location". + "$ccode". "$status". "".$itemcallnumber."" . "";