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

Joshua Ferraro jmf at kados.org
Tue Jul 11 14:54:16 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	Joshua Ferraro <kados>	06/07/11 12:54:16

Modified files:
	acqui.simple   : addbiblio.pl 

Log message:
	syncing with rel_2_2 before rel_2_2 was broken (meaning that
	dev-week MARC editor works now)

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.47&r2=1.52.2.48

Patches:
Index: addbiblio.pl
===================================================================
RCS file: /sources/koha/koha/acqui.simple/Attic/addbiblio.pl,v
retrieving revision 1.52.2.47
retrieving revision 1.52.2.48
diff -u -b -r1.52.2.47 -r1.52.2.48
--- addbiblio.pl	19 Jun 2006 13:18:17 -0000	1.52.2.47
+++ addbiblio.pl	11 Jul 2006 12:54:16 -0000	1.52.2.48
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: addbiblio.pl,v 1.52.2.47 2006/06/19 13:18:17 tipaul Exp $
+# $Id: addbiblio.pl,v 1.52.2.48 2006/07/11 12:54:16 kados Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -26,6 +26,7 @@
 use C4::Interface::CGI::Output;
 use C4::Biblio;
 use C4::SearchMarc; # also includes Biblio.pm, SearchMarc is used to FindDuplicate
+use C4::Search;
 use C4::Context;
 use C4::Koha; # XXX subfield_is_koha_internal_p
 #use Smart::Comments;
@@ -225,7 +226,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 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>";
+		$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>";
 	# 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,10 +266,6 @@
 		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 = ();
@@ -373,17 +370,8 @@
 				}
 			}
 		}
-		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);
+		$template->param($tabloop."XX" =>\@loop_data);
+	}
 }
 
 
@@ -499,13 +487,11 @@
 	# 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);
-		$record=MARC::Record->new_from_xml($xml,C4::Context->preference('TemplateEncoding'),C4::Context->preference('marcflavour'));
-	}
-	#warn $record->as_formatted;
+	$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;
 	#warn "IN ADDBIB";
 	# check for a duplicate
 	my ($duplicatebiblionumber,$duplicatebibid,$duplicatetitle) = FindDuplicate($record) if ($op eq "addbiblio") && (!$is_a_modif);
@@ -553,7 +539,7 @@
 	my @ind_tag = $input->param('ind_tag');
 	my @indicator = $input->param('indicator');
 	my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
-	my $record=MARC::Record->new_from_xml($xml, C4::Context->preference('TemplateEncoding'),C4::Context->preference('marcflavour'));
+	my $record=MARC::Record->new_from_xml($xml, 'UTF-8'); #C4::Context->preference('TemplateEncoding'),C4::Context->preference('marcflavour'));
 	# adding an empty field
 	my $field = MARC::Field->new("$addedfield",'','','$tagaddfield_subfield' => "");
 	$record->append_fields($field);





More information about the Koha-cvs mailing list