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

(-)a/misc/cronjobs/holds/build_holds_queue.pl (-7 / +67 lines)
Lines 6-21 Link Here
6
# FIXME: add command-line options for verbosity and summary
6
# FIXME: add command-line options for verbosity and summary
7
# FIXME: expand perldoc, explain intended logic
7
# FIXME: expand perldoc, explain intended logic
8
8
9
use strict;
9
use Modern::Perl;
10
use warnings;
11
10
12
use Koha::Script -cron;
11
use Getopt::Long qw( GetOptions );
12
use Pod::Usage qw( pod2usage );
13
14
use C4::Context;
13
use C4::HoldsQueue qw(CreateQueue);
15
use C4::HoldsQueue qw(CreateQueue);
14
use C4::Log qw( cronlogaction );
16
use C4::Log qw( cronlogaction );
17
use Koha::Script -cron;
18
19
=head1 NAME
20
21
build_holds_queue.pl - Rebuild the holds queue
22
23
=head1 SYNOPSIS
24
25
build_holds_queue.pl [-f]
26
27
 Options:
28
   -h --help        Brief help message
29
   -m --man         Full documentation
30
   -f --force    Run holds queue builder even if RealTimeHoldsQueue is enabled
31
32
=head1 OPTIONS
33
34
=over 8
35
36
=item B<--help>
37
38
Print a brief help message and exits.
39
40
=item B<--man>
41
42
Prints the manual page and exits.
43
44
=item B<--force>
45
46
Allows this script to rebuild the entire holds queue even if RealTimeHoldsQueue is enabled.
47
48
=back
49
50
=head1 DESCRIPTION
51
52
This script builds or rebuilds the entire holds queue.
53
54
=cut
55
56
my $help  = 0;
57
my $man   = 0;
58
my $force = 0;
59
60
my $command_line_options = join( " ", @ARGV );
61
62
GetOptions(
63
    'h|help'  => \$help,
64
    'm|man'   => \$man,
65
    'f|force' => \$force,
66
);
67
pod2usage(1)                              if $help;
68
pod2usage( -exitval => 0, -verbose => 2 ) if $man;
69
70
my $rthq = C4::Context->preference('RealTimeHoldsQueue');
71
72
if ( $rthq && !$force ) {
73
    say "Real Time Holds Queue is enabled, holds queue not built.";
74
    say "Use --force to force building the holds queue.";
75
    exit(1);
76
}
15
77
16
my $command_line_options = join(" ",@ARGV);
78
cronlogaction( { info => $command_line_options } );
17
cronlogaction({ info => $command_line_options });
18
79
19
CreateQueue();
80
CreateQueue();
20
81
21
cronlogaction({ action => 'End', info => "COMPLETED" });
82
cronlogaction( { action => 'End', info => "COMPLETED" } );
22
- 

Return to bug 31995