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

Henri-Damien LAURENT laurenthdl at alinto.com
Fri Apr 21 10:54:55 CEST 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	Henri-Damien LAURENT <hdl at savannah.gnu.org>	06/04/21 08:54:55

Modified files:
	acqui.simple   : addbiblio.pl 
	updater        : updatedatabase 

Log message:
	Adding two new sysprefs :
	- z3950NormalizeAuthor of type YesNo. Set this to yes if you want author field to be filled with authorities fields when importing biblio in z3950
	- z3950AuthorAuthfields, free text : type in comma-separated list of fields to search for author names for AuthorNormalization.
	
	Adding a feature on a Z3950 import.
	You can now automatically fill author with person name authority contained in the biblio if sysprefs are filled.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/acqui.simple/addbiblio.pl.diff?only_with_tag=rel_2_2&tr1=1.52.2.39&tr2=1.52.2.40&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/updater/updatedatabase.diff?only_with_tag=rel_2_2&tr1=1.100.2.40&tr2=1.100.2.41&r1=text&r2=text

Patches:
Index: koha/acqui.simple/addbiblio.pl
diff -u koha/acqui.simple/addbiblio.pl:1.52.2.39 koha/acqui.simple/addbiblio.pl:1.52.2.40
--- koha/acqui.simple/addbiblio.pl:1.52.2.39	Thu Apr 13 05:53:45 2006
+++ koha/acqui.simple/addbiblio.pl	Fri Apr 21 08:54:55 2006
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: addbiblio.pl,v 1.52.2.39 2006/04/13 05:53:45 kados Exp $
+# $Id: addbiblio.pl,v 1.52.2.40 2006/04/21 08:54:55 hdl Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -98,6 +98,44 @@
 		if (ref($record) eq undef) {
 			return -1;
 		} else {
+			if (C4::Context->preference("z3950NormalizeAuthor") and C4::Context->preference("z3950AuthorAuthFields")){
+				my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblio.author");
+# 				my $summary = C4::Context->preference("z3950authortemplate");
+				my $auth_fields = C4::Context->preference("z3950AuthorAuthFields");
+				my @auth_fields= split /,/,$auth_fields;
+				my $field;
+				warn $record->as_formatted;
+				if ($record->field($tag)){
+					foreach my $tmpfield ($record->field($tag)->subfields){
+#						foreach my $subfieldcode ($tmpfield->subfields){
+						my $subfieldcode=shift @$tmpfield;
+						my $subfieldvalue=shift @$tmpfield;
+						if ($field){
+							$field->add_subfields("$subfieldcode"=>$subfieldvalue) if ($subfieldcode ne $subfield);
+						} else {
+							$field=MARC::Field->new($tag,"","",$subfieldcode=>$subfieldvalue) if ($subfieldcode ne $subfield);
+						}
+					}
+					warn $field->as_formatted;
+#					}
+				}
+				$record->delete_field($record->field($tag));
+				foreach my $fieldtag (@auth_fields){
+					next unless ($record->field($fieldtag));
+					my $lastname = $record->field($fieldtag)->subfield('a');
+					my $firstname= $record->field($fieldtag)->subfield('b');
+					my $title = $record->field($fieldtag)->subfield('c');
+					my $number= $record->field($fieldtag)->subfield('d');
+					if ($title){
+# 						$field->add_subfields("$subfield"=>"[ ".ucfirst($title).ucfirst($firstname)." ".$number." ]");
+						$field->add_subfields("$subfield"=>ucfirst($title)." ".ucfirst($firstname)." ".$number);
+					}else{
+# 						$field->add_subfields("$subfield"=>"[ ".ucfirst($firstname).", ".ucfirst($lastname)." ]");
+						$field->add_subfields("$subfield"=>ucfirst($firstname).", ".ucfirst($lastname));
+					}
+				}
+				$record->insert_fields_ordered($field);
+			}
 			return $record,$encoding;
 		}
 	}
Index: koha/updater/updatedatabase
diff -u koha/updater/updatedatabase:1.100.2.40 koha/updater/updatedatabase:1.100.2.41
--- koha/updater/updatedatabase:1.100.2.40	Tue Apr 18 09:34:15 2006
+++ koha/updater/updatedatabase	Fri Apr 21 08:54:55 2006
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: updatedatabase,v 1.100.2.40 2006/04/18 09:34:15 plg Exp $
+# $Id: updatedatabase,v 1.100.2.41 2006/04/21 08:54:55 hdl Exp $
 
 # Database Updater
 # This script checks for required updates to the database.
@@ -1321,6 +1321,32 @@
 "If set, the MARC editor won't show you tag/subfields description",
             type => 'YesNo',
         },
+        {
+            uniquefieldrequired => 'variable',
+            variable            => 'z3950NormalizeAuthor',
+            value               => '0',
+            forceupdate         => {
+                'explanation' => 1,
+                '
+                                        type' => 1
+            },
+            explanation =>
+"If set, Personnal Authorities will replace authors in biblio.author",
+            type => 'YesNo',
+        },
+        {
+            uniquefieldrequired => 'variable',
+            variable            => 'z3950AuthorAuthFields',
+            value               => '701,702,700',
+            forceupdate         => {
+                'explanation' => 1,
+                '
+                                        type' => 1
+            },
+            explanation =>
+"contains the MARC biblio tags of person authorities to fill biblio.author with when importing biblio",
+            type => 'free',
+        },
     ],
 
 );
@@ -2054,6 +2080,14 @@
 exit;
 
 # $Log: updatedatabase,v $
+# Revision 1.100.2.41  2006/04/21 08:54:55  hdl
+# Adding two new sysprefs :
+# - z3950NormalizeAuthor of type YesNo. Set this to yes if you want author field to be filled with authorities fields when importing biblio in z3950
+# - z3950AuthorAuthfields, free text : type in comma-separated list of fields to search for author names for AuthorNormalization.
+#
+# Adding a feature on a Z3950 import.
+# You can now automatically fill author with person name authority contained in the biblio if sysprefs are filled.
+#
 # Revision 1.100.2.40  2006/04/18 09:34:15  plg
 # bug fixed: typo fixed in labels and labels_conf tables creation query.
 #





More information about the Koha-cvs mailing list