rebuild_zebra now handle correctly improper authorities records
authorPaul POULAIN <paul@koha-fr.org>
Tue, 6 Nov 2007 17:55:38 +0000 (11:55 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Wed, 7 Nov 2007 14:18:24 +0000 (08:18 -0600)
(missing 100 field are automatically added)

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
misc/migration_tools/rebuild_zebra.pl

index 39679a8..b6cee7d 100755 (executable)
@@ -299,8 +299,11 @@ rank:rank-1
             eval {
                 $record = GetAuthority($authid);
             };
+            next unless $record;
             # force authid in case it's not here, otherwise, zebra will die on this authority
-            unless ($record->field('001')){
+            unless ($record->field('001')->data() eq $authid){
+                print "$authid don't exist for this authority :".$record->as_formatted;
+                $record->delete_field($record->field('001'));
                 $record->insert_fields_ordered(MARC::Field->new('001',$authid));
             }
             if($@){