From c8802346ab64668c638f7e32688c34fe798317da Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Wed, 20 Jan 2016 12:40:22 +0000
Subject: [PATCH] [PASSED QA] Bug 14377 [QA Followup] - Don't do 942$n
 processing for UNIMARC

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Fixed supressed typo within this patch.
---
 C4/XSLT.pm | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/C4/XSLT.pm b/C4/XSLT.pm
index 14976e4..aa5f24b 100644
--- a/C4/XSLT.pm
+++ b/C4/XSLT.pm
@@ -159,6 +159,7 @@ sub _get_best_default_xslt_filename {
 sub XSLTParse4Display {
     my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items ) = @_;
     my $xslfilename = C4::Context->preference($xslsyspref);
+    my $marcflavour = C4::Context->preference('marcflavour');
     if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
         my $htdocs;
         my $theme;
@@ -196,7 +197,7 @@ sub XSLTParse4Display {
     # grab the XML, run it through our stylesheet, push it out to the browser
     my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
     my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
-    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
+    my $xmlrecord = $record->as_xml($marcflavour);
     my $sysxml = "<sysprefs>\n";
     foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
                               DisplayOPACiconsXSLT URLLinkText viewISBD
@@ -223,16 +224,18 @@ sub XSLTParse4Display {
     ## Non-syspref variables that need to be computed
     $sysxml .= "<OtherVars>";
 
-    # Fetch the authorised value description for 942$n ( supressed in opac ) for the value '1'
-    # if 942$n is not mapped, the return value will be '1' which means even if the field is not
-    # mapped in the framework, we will still get the correct value to compare against
-    my $frameworkcode = GetFrameworkCode($biblionumber) || '';
-    my $tagslib = &GetMarcStructure(1,$frameworkcode);
-    my $value = GetAuthorisedValueDesc( '942', 'n', '1', '', $tagslib );
-    $sysxml .= "<OtherVar name=\"Field942_1_True_Value\">$value</OtherVar>";
-
-    $sysxml .= "</OtherVars>\n";
-    ## End non-syspref variables that need to be computed
+    unless ( $marcflavour eq 'UNIMARC' ) {
+        # Fetch the authorised value description for 942$n ( suppressed in opac ) for the value '1'
+        # if 942$n is not mapped, the return value will be '1' which means even if the field is not
+        # mapped in the framework, we will still get the correct value to compare against
+        my $frameworkcode = GetFrameworkCode($biblionumber) || '';
+        my $tagslib = &GetMarcStructure(1,$frameworkcode);
+        my $value = GetAuthorisedValueDesc( '942', 'n', '1', '', $tagslib );
+        $sysxml .= "<OtherVar name=\"Field942_1_True_Value\">$value</OtherVar>";
+
+        $sysxml .= "</OtherVars>\n";
+        ## End non-syspref variables that need to be computed
+    }
 
     $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
     if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
-- 
1.9.1