View | Details | Raw Unified | Return to bug 5724
Collapse All | Expand All

(-)a/misc/migration_tools/rebuild_zebra.pl (-16 / +12 lines)
Lines 66-77 if (not $biblios and not $authorities) { Link Here
66
    die $msg;
66
    die $msg;
67
}
67
}
68
68
69
if ($authorities and $as_xml) {
70
    my $msg = "Cannot specify both -a and -x\n";
71
    $msg   .= "Please do '$0 --help' to see usage.\n";
72
    die $msg;
73
}
74
75
if ( !$as_xml and $nosanitize ) {
69
if ( !$as_xml and $nosanitize ) {
76
    my $msg = "Cannot specify both -no_xml and -nosanitize\n";
70
    my $msg = "Cannot specify both -no_xml and -nosanitize\n";
77
    $msg   .= "Please do '$0 --help' to see usage.\n";
71
    $msg   .= "Please do '$0 --help' to see usage.\n";
Lines 238-247 sub index_records { Link Here
238
    }
232
    }
239
	my $record_fmt = ($as_xml) ? 'marcxml' : 'iso2709' ;
233
	my $record_fmt = ($as_xml) ? 'marcxml' : 'iso2709' ;
240
    if ($process_zebraqueue) {
234
    if ($process_zebraqueue) {
241
        do_indexing($record_type, 'delete', "$directory/del_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt) 
242
            if %$records_deleted;
243
        do_indexing($record_type, 'update', "$directory/upd_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt)
235
        do_indexing($record_type, 'update', "$directory/upd_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt)
244
            if $num_records_exported;
236
            if $num_records_exported;
237
        do_indexing($record_type, 'delete', "$directory/del_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt) 
238
            if %$records_deleted;
245
    } else {
239
    } else {
246
        do_indexing($record_type, 'update', "$directory/$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt)
240
        do_indexing($record_type, 'update', "$directory/$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt)
247
            if ($num_records_exported or $skip_export);
241
            if ($num_records_exported or $skip_export);
Lines 453-460 sub get_raw_marc_record { Link Here
453
    my $marc; 
447
    my $marc; 
454
    if ($record_type eq 'biblio') {
448
    if ($record_type eq 'biblio') {
455
        if ($noxml) {
449
        if ($noxml) {
456
            my $fetch_sth = $dbh->prepare_cached("SELECT marc FROM biblioitems WHERE biblionumber = ?");
450
            my $fetch_sth = $dbh->prepare_cached("SELECT marc FROM biblioitems WHERE biblionumber = ?
457
            $fetch_sth->execute($record_number);
451
                                                  UNION SELECT marc from deletedbiblioitems where biblionumber=?");
452
            $fetch_sth->execute($record_number,$record_number);
458
            if (my ($blob) = $fetch_sth->fetchrow_array) {
453
            if (my ($blob) = $fetch_sth->fetchrow_array) {
459
                $marc = MARC::Record->new_from_usmarc($blob);
454
                $marc = MARC::Record->new_from_usmarc($blob);
460
                unless ($marc) {
455
                unless ($marc) {
Lines 468-474 sub get_raw_marc_record { Link Here
468
            $fetch_sth->finish();
463
            $fetch_sth->finish();
469
            return unless $marc;
464
            return unless $marc;
470
        } else {
465
        } else {
471
            eval { $marc = GetMarcBiblio($record_number); };
466
            eval { $marc = GetMarcBiblio($record_number,"include_deleted_table"); };
472
            if ($@ || !$marc) {
467
            if ($@ || !$marc) {
473
                # here we do warn since catching an exception
468
                # here we do warn since catching an exception
474
                # means that the bib was found but failed
469
                # means that the bib was found but failed
Lines 486-492 sub get_raw_marc_record { Link Here
486
            return;
481
            return;
487
        }
482
        }
488
    }
483
    }
489
    return $marc;
484
        return $marc;
490
}
485
}
491
486
492
sub fix_leader {
487
sub fix_leader {
Lines 514-523 sub fix_biblio_ids { Link Here
514
    my $biblioitemnumber;
509
    my $biblioitemnumber;
515
    if (@_) {
510
    if (@_) {
516
        $biblioitemnumber = shift;
511
        $biblioitemnumber = shift;
517
    } else {    
512
    } else {
518
        my $sth = $dbh->prepare(
513
        my $sth = $dbh->prepare(
519
            "SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?");
514
            "SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?
520
        $sth->execute($biblionumber);
515
             UNION SELECT biblioitemnumber FROM deletedbiblioitems WHERE biblionumber=?");
516
        $sth->execute($biblionumber,$biblionumber);
521
        ($biblioitemnumber) = $sth->fetchrow_array;
517
        ($biblioitemnumber) = $sth->fetchrow_array;
522
        $sth->finish;
518
        $sth->finish;
523
        unless ($biblioitemnumber) {
519
        unless ($biblioitemnumber) {
Lines 550-555 sub fix_authority_id { Link Here
550
    }
546
    }
551
}
547
}
552
548
549
553
sub fix_unimarc_100 {
550
sub fix_unimarc_100 {
554
    # FIXME - again, if this is necessary, it belongs in C4::AuthoritiesMarc.
551
    # FIXME - again, if this is necessary, it belongs in C4::AuthoritiesMarc.
555
    my $marc = shift;
552
    my $marc = shift;
556
- 

Return to bug 5724