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

(-)a/misc/cronjobs/update_totalissues.pl (-15 / +24 lines)
Lines 46-69 my $test_only = 0; Link Here
46
my $want_help = 0;
46
my $want_help = 0;
47
my $since;
47
my $since;
48
my $interval;
48
my $interval;
49
my $usestats    = 0;
49
my $usestats        = 0;
50
my $useitems    = 0;
50
my $useitems        = 0;
51
my $incremental = 0;
51
my $include_deleted = 0;
52
my $progress    = 100;
52
my $incremental     = 0;
53
my $progress        = 100;
53
my $unit;
54
my $unit;
54
55
55
my $command_line_options = join( " ", @ARGV );
56
my $command_line_options = join( " ", @ARGV );
56
57
57
my $result = GetOptions(
58
my $result = GetOptions(
58
    'v|verbose'    => \$verbose,
59
    'v|verbose'         => \$verbose,
59
    't|test'       => \$test_only,
60
    't|test'            => \$test_only,
60
    's|since=s'    => \$since,
61
    's|since=s'         => \$since,
61
    'i|interval=s' => \$interval,
62
    'i|interval=s'      => \$interval,
62
    'use-stats'    => \$usestats,
63
    'use-stats'         => \$usestats,
63
    'use-items'    => \$useitems,
64
    'use-items'         => \$useitems,
64
    'incremental'  => \$incremental,
65
    'use-deleted-items' => \$include_deleted,
65
    'p|progress=i' => \$progress,
66
    'incremental'       => \$incremental,
66
    'h|help'       => \$want_help
67
    'p|progress=i'      => \$progress,
68
    'h|help'            => \$want_help
67
);
69
);
68
70
69
binmode( STDOUT, ":encoding(UTF-8)" );
71
binmode( STDOUT, ":encoding(UTF-8)" );
Lines 109-115 cronlogaction( { action => 'End', info => "COMPLETED" } ); Link Here
109
exit 0;
111
exit 0;
110
112
111
sub process_items {
113
sub process_items {
112
    my $query = "SELECT items.biblionumber, SUM(items.issues) FROM items GROUP BY items.biblionumber;";
114
    my $query =
115
        $include_deleted
116
        ? "SELECT all_items.biblionumber, SUM(all_items.issues) FROM (SELECT items.biblionumber,items.issues FROM items UNION ALL SELECT deleteditems.biblionumber, deleteditems.issues FROM deleteditems) all_items GROUP BY all_items.biblionumber;"
117
        : "SELECT items.biblionumber, SUM(items.issues) FROM items GROUP BY items.biblionumber;";
113
    process_query($query);
118
    process_query($query);
114
}
119
}
115
120
Lines 243-248 options, by definition. Also note that if both --use-stats and Link Here
243
--use-items are specified, the count of biblios processed will be
248
--use-items are specified, the count of biblios processed will be
244
misleading.
249
misleading.
245
250
251
=item B<--use-deleted-items>
252
253
Only applies when using items as above, will include deleted items in the total
254
count of issues for the bibliographic records.
255
246
=item B<-s|--since=DATE>
256
=item B<-s|--since=DATE>
247
257
248
Only process issues recorded in the statistics table since DATE.
258
Only process issues recorded in the statistics table since DATE.
249
- 

Return to bug 11530