X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FXSLT.pm;h=06dfaf4a7b5a32837559b21e23460269909da49e;hb=aa114f53499b9cffde0571fe7e08622f9c9a332a;hp=28a70fc4154689ac4e40b2d83853bb16606a78ae;hpb=f8ea370fdd5e62c38dc22b3ee7c8eebcf9a4a780;p=koha_gimpoz diff --git a/C4/XSLT.pm b/C4/XSLT.pm old mode 100755 new mode 100644 index 28a70fc415..06dfaf4a7b --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -29,7 +29,6 @@ use C4::Koha; use C4::Biblio; use C4::Circulation; use C4::Reserves; -use C4::Output qw//; use Encode; use XML::LibXML; use XML::LibXSLT; @@ -59,7 +58,7 @@ Replaces codes with authorized values in a MARC::Record object sub transformMARCXML4XSLT { my ($biblionumber, $record) = @_; - my $frameworkcode = GetFrameworkCode($biblionumber); + my $frameworkcode = GetFrameworkCode($biblionumber) || ''; my $tagslib = &GetMarcStructure(1,$frameworkcode); my @fields; # FIXME: wish there was a better way to handle exceptions @@ -122,12 +121,12 @@ sub getAuthorisedValues4MARCSubfields { my $stylesheet; sub XSLTParse4Display { - my ( $biblionumber, $orig_record, $xsl_suffix, $interface, $fixamps ) = @_; + my ( $biblionumber, $orig_record, $xsl_suffix, $interface, $fixamps, $hidden_items ) = @_; $interface = 'opac' unless $interface; # grab the XML, run it through our stylesheet, push it out to the browser my $record = transformMARCXML4XSLT($biblionumber, $orig_record); #return $record->as_formatted(); - my $itemsxml = buildKohaItemsNamespace($biblionumber); + my $itemsxml = buildKohaItemsNamespace($biblionumber, $hidden_items); my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour')); my $sysxml = "\n"; foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow @@ -160,14 +159,14 @@ sub XSLTParse4Display { if ($interface eq 'intranet') { $xslfile = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference("template") . - '/' . C4::Output::_current_language() . + '/' . C4::Templates::_current_language() . '/xslt/' . C4::Context->preference('marcflavour') . "slim2intranet$xsl_suffix.xsl"; } else { $xslfile = C4::Context->config('opachtdocs') . '/' . C4::Context->preference("opacthemes") . - '/' . C4::Output::_current_language() . + '/' . C4::Templates::_current_language() . '/xslt/' . C4::Context->preference('marcflavour') . "slim2OPAC$xsl_suffix.xsl"; @@ -181,8 +180,13 @@ sub XSLTParse4Display { } sub buildKohaItemsNamespace { - my ($biblionumber) = @_; + my ($biblionumber, $hidden_items) = @_; + my @items = C4::Items::GetItemsInfo($biblionumber); + if ($hidden_items && @$hidden_items) { + my %hi = map {$_ => 1} @$hidden_items; + @items = grep { !$hi{$_->{itemnumber}} } @items; + } my $branches = GetBranches(); my $itemtypes = GetItemTypes(); my $xml = ''; @@ -191,7 +195,7 @@ sub buildKohaItemsNamespace { my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber}); - my ( $reservestatus, $reserveitem ) = C4::Reserves::CheckReserves($item->{itemnumber}); + my ( $reservestatus, $reserveitem, undef ) = C4::Reserves::CheckReserves($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") ){ @@ -222,7 +226,7 @@ sub buildKohaItemsNamespace { } else { $status = "available"; } - my $homebranch = xml_escape($branches->{$item->{homebranch}}->{'branchname'}); + my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):''; my $itemcallnumber = xml_escape($item->{itemcallnumber}); $xml.= "$homebranch". "$status".