[Koha-cvs] koha/misc bulkupdate.pl

Antoine Farnault antoine at koha-fr.org
Thu Jul 12 17:33:31 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	Antoine Farnault <toins>	07/07/12 15:33:31

Modified files:
	misc           : bulkupdate.pl 

Log message:
	optimisation + encoding set.
	FIXME : unimarc hard coded.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/misc/bulkupdate.pl?cvsroot=koha&r1=1.3&r2=1.4

Patches:
Index: bulkupdate.pl
===================================================================
RCS file: /sources/koha/koha/misc/bulkupdate.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- bulkupdate.pl	25 Jun 2007 09:37:26 -0000	1.3
+++ bulkupdate.pl	12 Jul 2007 15:33:31 -0000	1.4
@@ -15,7 +15,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: bulkupdate.pl,v 1.3 2007/06/25 09:37:26 toins Exp $
+# $Id: bulkupdate.pl,v 1.4 2007/07/12 15:33:31 toins Exp $
 
 
 =head1 bulkupdate.pl 
@@ -109,20 +109,24 @@
         my $marcxml = $data->[1];
         
         eval{
-            my $record = MARC::Record->new_from_xml($marcxml);
+            my $record = MARC::Record->new_from_xml($marcxml,'UTF-8','UNIMARC');
             my @field = $record->field('010');
+            my $flag = 0;
 	    foreach my $field (@field){
                 my $subfield = $field->subfield('a');
                 if($subfield){
                     my $isbn = $subfield;
                     $isbn =~ s/-//g;
                     $field->update('a' => $isbn);
+                    $flag = 1;
                 }
 	    }
+            if($flag){
 	    $marcxml = $record->as_xml;
 	    # Update
 	    my $sth = $dbh->prepare($update_marcxml);
 	    $sth->execute($marcxml,$biblioitemnumber);
+            }
         };
         if($@){
             print "\n /!\\ pb getting $biblioitemnumber : $@";





More information about the Koha-cvs mailing list