koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/misc bulkupdate.pl


From: Antoine Farnault
Subject: [Koha-cvs] koha/misc bulkupdate.pl
Date: Mon, 25 Jun 2007 09:37:26 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     Antoine Farnault <toins>        07/06/25 09:37:26

Modified files:
        misc           : bulkupdate.pl 

Log message:
        don't escape '-' in regexp.

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

Patches:
Index: bulkupdate.pl
===================================================================
RCS file: /sources/koha/koha/misc/bulkupdate.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- bulkupdate.pl       19 Jun 2007 15:58:23 -0000      1.2
+++ bulkupdate.pl       25 Jun 2007 09:37:26 -0000      1.3
@@ -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.2 2007/06/19 15:58:23 toins Exp $
+# $Id: bulkupdate.pl,v 1.3 2007/06/25 09:37:26 toins Exp $
 
 
 =head1 bulkupdate.pl 
@@ -30,11 +30,11 @@
 use MARC::Record;
 use Getopt::Long;
 
-my ( $process_marcxml, $process_isbn, $help) = (0,0,0);
+my ( $no_marcxml, $no_isbn, $help) = (0,0,0);
 
 GetOptions(
-    'noisbn'    => \$process_isbn,
-    'noxml'     => \$process_marcxml,
+    'noisbn'    => \$no_isbn,
+    'noxml'     => \$no_marcxml,
     'h'       => \$help,
     'help'    => \$help,
 );
@@ -55,7 +55,7 @@
 }
 
 my $cpt_isbn = 0;
-if(not $process_isbn){
+if(not $no_isbn){
 
     my $query_isbn = "
         SELECT biblioitemnumber,isbn FROM biblioitems WHERE isbn IS NOT NULL
@@ -75,7 +75,7 @@
         # suppression des tirets de l'isbn
         my $isbn    = $data->[1];
         if($isbn){
-            $isbn =~ s/\-//g;
+            $isbn =~ s/-//g;
             
             #update 
             my $sth = $dbh->prepare($update_isbn);
@@ -86,7 +86,7 @@
     print "$cpt_isbn updated";
 }
 
-if(not $process_marcxml){
+if(not $no_marcxml){
     
     my $query_marcxml = "
         SELECT biblioitemnumber,marcxml FROM biblioitems WHERE isbn IS NOT NULL
@@ -109,17 +109,17 @@
         my $marcxml = $data->[1];
         
         eval{
-            my $record = MARC::Record->new_from_xml($marcxml,'UTF-8');
+            my $record = MARC::Record->new_from_xml($marcxml);
             my @field = $record->field('010');
            foreach my $field (@field){
                    my $subfield = $field->subfield('a');
                    if($subfield){
                        my $isbn = $subfield;
-                       $isbn =~ s/\-//g;
+                    $isbn =~ s/-//g;
                        $field->update('a' => $isbn);
                    }
            }
-           $marcxml = $record->as_xml('UTF-8');
+           $marcxml = $record->as_xml;
            # Update
            my $sth = $dbh->prepare($update_marcxml);
            $sth->execute($marcxml,$biblioitemnumber);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]