X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FXSLT.pm;h=d85b0486cd29b8f9f9880b76c69535623489d4ab;hb=9c5e40e4923179bf0b2b630d3e09797dc4c1fdb0;hp=bab03bc57e4121882801a89af710ff031d9c059d;hpb=dc59477bb09a7fd998aef3accd31d8ca6fe702fb;p=koha.git diff --git a/C4/XSLT.pm b/C4/XSLT.pm index bab03bc57e..d85b0486cd 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -136,6 +136,26 @@ sub getAuthorisedValues4MARCSubfields { my $stylesheet; +sub _get_best_default_xslt_filename { + my ($htdocs, $theme, $lang, $base_xslfile) = @_; + + my @candidates = ( + "$htdocs/$theme/$lang/xslt/${base_xslfile}", # exact match + "$htdocs/$theme/en/xslt/${base_xslfile}", # if not, preferred theme in English + "$htdocs/prog/$lang/xslt/${base_xslfile}", # if not, 'prog' theme in preferred language + "$htdocs/prog/en/xslt/${base_xslfile}", # otherwise, prog theme in English; should always + # exist + ); + my $xslfilename; + foreach my $filename (@candidates) { + $xslfilename = $filename; + if (-f $filename) { + last; # we have a winner! + } + } + return $xslfilename; +} + sub XSLTParse4Display { my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items ) = @_; my $xslfilename = C4::Context->preference($xslsyspref); @@ -165,10 +185,7 @@ sub XSLTParse4Display { $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 ); + $xslfilename = _get_best_default_xslt_filename($htdocs, $theme, $lang, $xslfile); } if ( $xslfilename =~ m/\{langcode\}/ ) { @@ -249,7 +266,7 @@ sub buildKohaItemsNamespace { my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} ); - if ( $itemtypes->{ $item->{itype} }->{notforloan} || $item->{notforloan} || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} || + if ( $itemtypes->{ $item->{itype} }->{notforloan} || $item->{notforloan} || $item->{onloan} || $item->{withdrawn} || $item->{itemlost} || $item->{damaged} || (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") ){ if ( $item->{notforloan} < 0) { $status = "On order"; @@ -260,7 +277,7 @@ sub buildKohaItemsNamespace { if ($item->{onloan}) { $status = "Checked out"; } - if ( $item->{wthdrawn}) { + if ( $item->{withdrawn}) { $status = "Withdrawn"; } if ($item->{itemlost}) { @@ -279,10 +296,12 @@ sub buildKohaItemsNamespace { $status = "available"; } my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):''; - $location = $item->{location}? xml_escape($shelflocations->{$item->{location}}):''; - $ccode = $item->{ccode}? xml_escape($ccodes->{$item->{ccode}}):''; + 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".