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

Joshua Ferraro jmf at kados.org
Thu Jul 27 19:58:48 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Joshua Ferraro <kados>	06/07/27 17:58:48

Modified files:
	acqui.simple   : addbiblio.pl 

Log message:
	sync with rel_2_2:
	
	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=dev_week&r1=1.52.2.40.2.3&r2=1.52.2.40.2.4

Patches:
Index: addbiblio.pl
===================================================================
RCS file: /sources/koha/koha/acqui.simple/Attic/addbiblio.pl,v
retrieving revision 1.52.2.40.2.3
retrieving revision 1.52.2.40.2.4
diff -u -b -r1.52.2.40.2.3 -r1.52.2.40.2.4
--- addbiblio.pl	21 Jul 2006 17:46:48 -0000	1.52.2.40.2.3
+++ addbiblio.pl	27 Jul 2006 17:58:48 -0000	1.52.2.40.2.4
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: addbiblio.pl,v 1.52.2.40.2.3 2006/07/21 17:46:48 kados Exp $
+# $Id: addbiblio.pl,v 1.52.2.40.2.4 2006/07/27 17:58:48 kados Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -225,7 +225,7 @@
 		$subfield_data{marc_value}= build_authorized_values_list($tag, $subfield, $value, $dbh,$authorised_values_sth);
 	# it's a thesaurus / authority field
 	} elsif ($tagslib->{$tag}->{$subfield}->{authtypecode}) {
-		$subfield_data{marc_value}="<input onblur=\"this.style.backgroundColor='#ffffff';\" onfocus=\"this.style.backgroundColor='#ffff00;'\"\" tabindex=\"1\" type=\"text\" name=\"field_value\" value=\"$value\" size=\"70\" maxlength=\"255\" DISABLE READONLY> <a  style=\"cursor: help;\" href=\"javascript:openAuth('tag$tag','$tagslib->{$tag}->{$subfield}->{authtypecode}','subfield$tag$i')\">...</a>";
+		$subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=\"67\" maxlength=\"255\" DISABLE READONLY> <a href=\"javascript:Dopop('../authorities/auth_finder.pl?authtypecode=".$tagslib->{$tag}->{$subfield}->{authtypecode}."&index=$i',$i)\">...</a>";
 	# it's a plugin field
 	} elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) {
 		# opening plugin. Just check wether we are on a developper computer on a production one
@@ -265,6 +265,10 @@
 		from authorised_values
 		where category=? order by lib");
 
+    # in this array, we will push all the 10 tabs
+    # to avoid having 10 tabs in the template : they will all be in the same BIG_LOOP
+    my @BIG_LOOP;
+
 # loop through each tab 0 through 9
 	for (my $tabloop = 0; $tabloop <= 9; $tabloop++) {
 		my @loop_data = ();
@@ -369,8 +373,17 @@
 				}
 			}
 		}
-		$template->param($tabloop."XX" =>\@loop_data);
-	}
+		if ($#loop_data >=0) {
+            my %big_loop_line;
+            $big_loop_line{number}=$tabloop;
+            $big_loop_line{innerloop}=\@loop_data;
+            push @BIG_LOOP,\%big_loop_line;
+        }
+# 		$template->param($tabloop."XX" =>\@loop_data);
+	}
+# 	use Data::Dumper;
+# 	warn "DUMP : ".Dumper(@BIG_LOOP);
+	$template->param(BIG_LOOP => \@BIG_LOOP);
 }
 
 
@@ -486,11 +499,13 @@
 	# build indicator hash.
 	my @ind_tag = $input->param('ind_tag');
 	my @indicator = $input->param('indicator');
+	if (C4::Context->preference('TemplateEncoding') eq "iso-8859-1") {
+		$record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
+	} 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