View | Details | Raw Unified | Return to bug 6536
Collapse All | Expand All

(-)a/C4/Breeding.pm (-12 / +18 lines)
Lines 542-551 sub handle_one_result { Link Here
542
	$hServer[$conn]->{syntax});
542
	$hServer[$conn]->{syntax});
543
  }
543
  }
544
  else { #z3950
544
  else { #z3950
545
    ($marcrecord)= MarcToUTF8Record($rec->raw(),
545
      if ($hServer[$conn]->{encoding} eq 'utf8'){
546
	marcflavour_from_syntax($conn), $hServer[$conn]->{encoding});
546
          $marcrecord= MARC::Record->new_from_usmarc($rec->raw());
547
          C4::Charset::SetUTF8Flag $marcrecord;
548
      }else{
549
          ($marcrecord) = MarcToUTF8Record($rec->raw(), marcflavour_from_syntax($conn), $hServer[$conn]->{encoding})
550
      }
547
  }
551
  }
548
  $marcrecord->encoding('UTF-8'); #force UTF-8
552
549
  #convert to system marc flavour and/or additional xslt proc.
553
  #convert to system marc flavour and/or additional xslt proc.
550
  $marcrecord= do_xslt_processing($conn, $marcrecord);
554
  $marcrecord= do_xslt_processing($conn, $marcrecord);
551
555
Lines 570-584 sub do_xslt_processing { Link Here
570
  my ($conn, $marcrecord)= @_;
574
  my ($conn, $marcrecord)= @_;
571
  my ($res, $newmarcrec, $parser, $style_doc, $stylesheet);
575
  my ($res, $newmarcrec, $parser, $style_doc, $stylesheet);
572
576
573
  if($hServer[$conn]->{marc_conv} && defined $xsltconv) {
577
 if($hServer[$conn]->{add_xslt}) { #server specific xslt proc
574
    $parser = XML::LibXML->new();
575
    $res= $parser->parse_string($marcrecord->as_xml());
576
    $res= $xsltconv->transform($res);
577
    $res= $xsltconv->output_string($res);
578
    $newmarcrec= MARC::Record->new_from_xml($res, 'UTF-8');
579
  }
580
581
  if($hServer[$conn]->{add_xslt}) { #server specific xslt proc
582
    $res= $newmarcrec? $newmarcrec->as_xml(): $marcrecord->as_xml();
578
    $res= $newmarcrec? $newmarcrec->as_xml(): $marcrecord->as_xml();
583
    $parser = XML::LibXML->new() unless $parser;
579
    $parser = XML::LibXML->new() unless $parser;
584
    $res= $parser->parse_string($res);
580
    $res= $parser->parse_string($res);
Lines 595-600 sub do_xslt_processing { Link Here
595
      warn "z3950_search: XSLT problem with ".$hServer[$conn]->{add_xslt};
591
      warn "z3950_search: XSLT problem with ".$hServer[$conn]->{add_xslt};
596
    }
592
    }
597
  }
593
  }
594
595
  if( not $newmarcrec and $hServer[$conn]->{marc_conv} and defined $xsltconv) {
596
    $parser = XML::LibXML->new();
597
    $res= $parser->parse_string($marcrecord->as_xml());
598
    $res= $xsltconv->transform($res);
599
    $res= $xsltconv->output_string($res);
600
601
    $newmarcrec= MARC::Record->new_from_xml($res, 'UTF-8');
602
  }
603
598
  return $newmarcrec // $marcrecord;
604
  return $newmarcrec // $marcrecord;
599
}
605
}
600
606
(-)a/C4/ImportBatch.pm (-1 / +5 lines)
Lines 1137-1143 sub _create_import_record { Link Here
1137
    my $sth = $dbh->prepare("INSERT INTO import_records (import_batch_id, record_sequence, marc, marcxml, 
1137
    my $sth = $dbh->prepare("INSERT INTO import_records (import_batch_id, record_sequence, marc, marcxml, 
1138
                                                         record_type, encoding, z3950random)
1138
                                                         record_type, encoding, z3950random)
1139
                                    VALUES (?, ?, ?, ?, ?, ?, ?)");
1139
                                    VALUES (?, ?, ?, ?, ?, ?, ?)");
1140
    $sth->execute($batch_id, $record_sequence, $marc_record->as_usmarc(), $marc_record->as_xml(),
1140
1141
    my $usmarc = $marc_record->as_usmarc();
1142
    my $xml    = $marc_record->as_xml( C4::Context->preference("marcflavour") );
1143
1144
    $sth->execute($batch_id, $record_sequence, $usmarc, $xml,
1141
                  $record_type, $encoding, $z3950random);
1145
                  $record_type, $encoding, $z3950random);
1142
    my $import_record_id = $dbh->{'mysql_insertid'};
1146
    my $import_record_id = $dbh->{'mysql_insertid'};
1143
    $sth->finish();
1147
    $sth->finish();
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21toUNIMARC.xsl (-3 / +2 lines)
Lines 141-148 with Koha; if not, write to the Free Software Foundation, Inc., Link Here
141
								<xsl:otherwise>y</xsl:otherwise>
141
								<xsl:otherwise>y</xsl:otherwise>
142
							</xsl:choose>
142
							</xsl:choose>
143
						</xsl:variable>
143
						</xsl:variable>
144
						<!-- Demander à nicomo pour les 2 variables suivantes -->
144
                        <!-- cs is the character set. 50 is utf8 the default value for Koha -->
145
						<xsl:variable name="cs"><xsl:value-of select="'    '" /></xsl:variable>
145
						<xsl:variable name="cs"><xsl:value-of select="'50  '" /></xsl:variable>
146
						<xsl:variable name="acs"><xsl:value-of select="'    '" /></xsl:variable>
146
						<xsl:variable name="acs"><xsl:value-of select="'    '" /></xsl:variable>
147
						<xsl:variable name="aot" select="substring(text(),34,1)" />
147
						<xsl:variable name="aot" select="substring(text(),34,1)" />
148
						<xsl:value-of select="concat($deof,$topd,$d1,$d2,$il,$gpc,$mrc,$loc,$tc,$cs,$acs,$aot)" />
148
						<xsl:value-of select="concat($deof,$topd,$d1,$d2,$il,$gpc,$mrc,$loc,$tc,$cs,$acs,$aot)" />
149
- 

Return to bug 6536