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

(-)a/misc/cronjobs/delete_records_via_leader.pl (-6 / +5 lines)
Lines 70-85 This script has the following parameters : Link Here
70
    exit();
70
    exit();
71
}
71
}
72
72
73
my @metadatas =    # Should be replaced by a call to C4::Search on zebra index
73
my $metadatas =    # Should be replaced by a call to C4::Search on zebra index
74
                   # Record-status when bug 15537 will be pushed
74
                   # Record-status when bug 15537 will be pushed
75
  Koha::Biblio::Metadatas->search( { format => 'marcxml', schema => C4::Context->preference('marcflavour'), metadata => { LIKE => '%<leader>_____d%' } } );
75
  Koha::Biblio::Metadatas->search( { format => 'marcxml', schema => C4::Context->preference('marcflavour'), metadata => { LIKE => '%<leader>_____d%' } } );
76
76
77
my $total_records_count   = @metadatas;
77
my $total_records_count   = $metadatas->count;
78
my $deleted_records_count = 0;
78
my $deleted_records_count = 0;
79
my $total_items_count     = 0;
79
my $total_items_count     = 0;
80
my $deleted_items_count   = 0;
80
my $deleted_items_count   = 0;
81
foreach my $m (@metadatas) {
81
while ( my $m = $metadatas->next ) {
82
    my $biblionumber = $m->get_column('biblionumber');
82
    my $biblionumber = $m->biblionumber;
83
83
84
    say "RECORD: $biblionumber" if $verbose;
84
    say "RECORD: $biblionumber" if $verbose;
85
85
Lines 99-105 foreach my $m (@metadatas) { Link Here
99
                    say "TEST MODE: ERROR DELETING ITEM $itemnumber: $error";
99
                    say "TEST MODE: ERROR DELETING ITEM $itemnumber: $error";
100
                }
100
                }
101
            } else {
101
            } else {
102
                my $deleted = $item->safe_to_delete;
102
                my $deleted = $item->safe_delete;
103
                if ( $deleted ) {
103
                if ( $deleted ) {
104
                    say "DELETED ITEM $itemnumber" if $verbose;
104
                    say "DELETED ITEM $itemnumber" if $verbose;
105
                    $deleted_items_count++;
105
                    $deleted_items_count++;
106
- 

Return to bug 32656