koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/misc/migration_tools/unimarc rebuild_100.pl [rel_3_0]


From: paul poulain
Subject: [Koha-cvs] koha/misc/migration_tools/unimarc rebuild_100.pl [rel_3_0]
Date: Wed, 11 Oct 2006 15:23:22 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     paul poulain <tipaul>   06/10/11 15:23:22

Modified files:
        misc/migration_tools/unimarc: rebuild_100.pl 

Log message:
        - parsing biblionumber by biblionumber, not bibid
        - some fixes to handle when the field 100 exist but has to be updated

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/misc/migration_tools/unimarc/rebuild_100.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2

Patches:
Index: rebuild_100.pl
===================================================================
RCS file: /sources/koha/koha/misc/migration_tools/unimarc/Attic/rebuild_100.pl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- rebuild_100.pl      10 Oct 2006 15:23:09 -0000      1.1.2.1
+++ rebuild_100.pl      11 Oct 2006 15:23:22 -0000      1.1.2.2
@@ -14,10 +14,10 @@
 
 my $dbh = C4::Context->dbh;
 
-my $sth=$dbh->prepare("select m.bibid,b.biblioitemnumber,b.timestamp from 
marc_biblio m left join biblioitems b on b.biblionumber=m.biblionumber ");
+my $sth=$dbh->prepare("select biblionumber,timestamp from biblioitems");
        $sth->execute();
 
-while (my ($biblionumber,$biblioitemnumber,$time)=$sth->fetchrow ){
+while (my ($biblionumber,$time)=$sth->fetchrow ){
 #   my $record;
   my $record = MARCgetbiblio($dbh,$biblionumber);
 #print $record->as_marc;
@@ -25,30 +25,31 @@
 #              
 }
 
-sub MARCmodrecord{
-my ($biblionumber,$record,$time)address@hidden;
-my $update=0;
-#warn "".$record->leader();
-#if (length($record->leader())>24){
-#      $record->leader(substr($record->leader,0,24));  
-#      $update =1;
-#} elsif (length($record->leader())<24){
+sub MARCmodrecord {
+    my ($biblionumber,$record,$time)address@hidden;
+#     warn "AVANT : ".$record->as_formatted;
+    my $update=0;
        $record->leader('     nac  22     1u 4500');
        $update=1;
-#}
-    my $string = POSIX::strftime("%Y%m%d", localtime);
+        my $string;
+        if ($record->subfield(100,"a")) {
+            $string = $record->subfield(100,"a");
+            my $f100 = $record->field(100);
+            $record->delete_field($f100);
+        } else {
+            $string = POSIX::strftime("%Y%m%d", localtime);
     $string=~s/\-//g;
      $string = sprintf("%-*s",35, $string);
+        }
      substr($string,22,6,"frey50");
      unless ($record->subfield(100,"a")){
        
$record->insert_fields_ordered(MARC::Field->new(100,"","","a"=>$string));
      }
-  warn $record->as_formatted;
-# 
-# warn "leader : ".$record->leader if ($biblionumber==2262);
+#     warn "APRES : ".$record->as_formatted;
+    # delete all items related fields
  foreach ($record->field('995')) {
        $record->delete_field($_);
-}
+    }
  if ($update){ 
        &MARCmodbiblio($dbh,$biblionumber,$record,'',0);
        print "$biblionumber \n";       




reply via email to

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