[Koha-cvs] koha/acqui.simple addbiblio.pl [rel_2_2]

paul poulain paul at koha-fr.org
Tue Jul 25 14:40:19 CEST 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	paul poulain <tipaul>	06/07/25 12:40:19

Modified files:
	acqui.simple   : addbiblio.pl 

Log message:
	getting MARC from either xml or old html, depending on template encoding (in france, my libraries use iso8859-1 templates, and html2xml has problem with non utf-8 values)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/acqui.simple/addbiblio.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.52.2.48&r2=1.52.2.49

Patches:
Index: addbiblio.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/Attic/addbiblio.pl,v
retrieving revision 1.52.2.48
retrieving revision 1.52.2.49
diff -u -b -r1.52.2.48 -r1.52.2.49
--- addbiblio.pl	11 Jul 2006 12:54:16 -0000	1.52.2.48
+++ addbiblio.pl	25 Jul 2006 12:40:19 -0000	1.52.2.49
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: addbiblio.pl,v 1.52.2.48 2006/07/11 12:54:16 kados Exp $
+# $Id: addbiblio.pl,v 1.52.2.49 2006/07/25 12:40:19 tipaul Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -487,11 +487,17 @@
 	# build indicator hash.
 	my @ind_tag = $input->param('ind_tag');
 	my @indicator = $input->param('indicator');
+	if (C4::Context->preference('TemplateEncoding') eq "iso-8859-1") {
+		my %indicators;
+        for (my $i=0;$i<=$#ind_tag;$i++) {
+            $indicators{$ind_tag[$i]} = $indicator[$i];
+        }
+		$record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
+	} else {
 	my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
-	$xml =~ s/collection/record/g;
-	warn "BEFORE".$xml;
-  	my $record=MARC::Record->new_from_xml($xml, 'UTF-8'); #,'UNIMARC'); #C4::Context->preference('TemplateEncoding'), C4::Context->preference('marcflavour'));
-	warn $record->as_formatted;
+		$record=MARC::Record->new_from_xml($xml,C4::Context->preference('TemplateEncoding'),C4::Context->preference('marcflavour'));
+	}
+	#warn $record->as_formatted;
 	#warn "IN ADDBIB";
 	# check for a duplicate
 	my ($duplicatebiblionumber,$duplicatebibid,$duplicatetitle) = FindDuplicate($record) if ($op eq "addbiblio") && (!$is_a_modif);





More information about the Koha-cvs mailing list