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

(-)a/misc/maintenance/remove_items_from_biblioitems.pl (-2 / +10 lines)
Lines 20-34 Link Here
20
20
21
use strict;
21
use strict;
22
use warnings;
22
use warnings;
23
$|=1;
23
24
24
use C4::Context;
25
use C4::Context;
25
use C4::Biblio;
26
use C4::Biblio;
26
use Getopt::Long;
27
use Getopt::Long;
27
28
28
my ($wherestring, $run, $want_help);
29
my ($wherestring, $run, $silent, $want_help);
29
my $result = GetOptions(
30
my $result = GetOptions(
30
    'where:s'      => \$wherestring,
31
    'where:s'      => \$wherestring,
31
    '--run'        => \$run,
32
    '--run'        => \$run,
33
    '--silent'     => \$silent,
32
    'help|h'       => \$want_help,
34
    'help|h'       => \$want_help,
33
);
35
);
34
36
Lines 38-48 if ( not $result or not $run or $want_help ) { Link Here
38
}
40
}
39
41
40
my $dbh = C4::Context->dbh;
42
my $dbh = C4::Context->dbh;
43
my $count = 0;
41
my $querysth =  qq{SELECT biblionumber from biblioitems };
44
my $querysth =  qq{SELECT biblionumber from biblioitems };
42
$querysth    .= " WHERE $wherestring " if ($wherestring);
45
$querysth    .= " WHERE $wherestring " if ($wherestring);
43
my $query = $dbh->prepare($querysth);
46
my $query = $dbh->prepare($querysth);
44
$query->execute;
47
$query->execute;
45
while (my $biblionumber = $query->fetchrow){
48
while (my $biblionumber = $query->fetchrow){
49
    $count++;
50
    print "." unless $silent;
51
    print "\r$count" unless ($silent or ($count % 100)); 
46
    my $record = GetMarcBiblio($biblionumber);
52
    my $record = GetMarcBiblio($biblionumber);
47
    
53
    
48
    if ($record) {
54
    if ($record) {
Lines 53-58 while (my $biblionumber = $query->fetchrow){ Link Here
53
    }
59
    }
54
}
60
}
55
61
62
print "\n\n$count records processed.\n" unless $silent;
63
56
sub print_usage {
64
sub print_usage {
57
    print <<_USAGE_;
65
    print <<_USAGE_;
58
$0: removes items from selected biblios
66
$0: removes items from selected biblios
Lines 66-71 should be run using rebuild_zebra.pl -b -r. Link Here
66
Parameters:
74
Parameters:
67
    -where                  use this to limit modifications to selected biblios
75
    -where                  use this to limit modifications to selected biblios
68
    --run                   perform the update
76
    --run                   perform the update
77
    --silent                run silently
69
    --help or -h            show this message
78
    --help or -h            show this message
70
_USAGE_
79
_USAGE_
71
}
80
}
72
- 

Return to bug 5579