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

(-)a/misc/cronjobs/holds/build_holds_queue.pl (-14 / +10 lines)
Lines 18-24 use Koha::Script -cron; Link Here
18
18
19
=head1 NAME
19
=head1 NAME
20
20
21
build_holds_queue.pl - Rebuild the holds queue
21
build_holds_queue.pl - Build the holds queue based on RealTimeHoldsQueue sys pref
22
22
23
=head1 SYNOPSIS
23
=head1 SYNOPSIS
24
24
Lines 27-33 build_holds_queue.pl [-f] Link Here
27
 Options:
27
 Options:
28
   -h --help        Brief help message
28
   -h --help        Brief help message
29
   -m --man         Full documentation
29
   -m --man         Full documentation
30
   -f --force    Run holds queue builder even if RealTimeHoldsQueue is enabled
30
   -f --force       Fully rebuilds the holds queue even if RealTimeHoldsQueue is enabled
31
31
32
=head1 OPTIONS
32
=head1 OPTIONS
33
33
Lines 45-68 Prints the manual page and exits. Link Here
45
45
46
allows this script to rebuild the entire holds queue even if the realtimeholdsqueue system preference is enabled.
46
allows this script to rebuild the entire holds queue even if the realtimeholdsqueue system preference is enabled.
47
47
48
=item b<--unallocated>
49
50
prevents deletion of current queue and allows the script to only deal with holds not currently in the queue.
51
This is useful when using the realtimeholdsqueue and skipping closed libraries, or allowing holds in the future
52
This allows the script to catch holds that may have become active without triggering a real time update.
53
54
=back
48
=back
55
49
56
=head1 DESCRIPTION
50
=head1 DESCRIPTION
57
51
58
This script builds or rebuilds the entire holds queue.
52
This script rebuilds the entire holds queue if RealTimeHoldsQueue is disabled.
53
54
If RealTimeHoldsQueue is enabled, this script will only consider unallocated holds to add to the queue.
55
This is useful when a real-time-hold fails to allocate due to closed libraries.
56
This allows the script to catch holds that may have become active but failed to trigger a real time update.
59
57
60
=cut
58
=cut
61
59
62
my $help  = 0;
60
my $help  = 0;
63
my $man   = 0;
61
my $man   = 0;
64
my $force = 0;
62
my $force = 0;
65
my $unallocated = 0;
66
63
67
my $command_line_options = join( " ", @ARGV );
64
my $command_line_options = join( " ", @ARGV );
68
65
Lines 70-86 GetOptions( Link Here
70
    'h|help'  => \$help,
67
    'h|help'  => \$help,
71
    'm|man'   => \$man,
68
    'm|man'   => \$man,
72
    'f|force' => \$force,
69
    'f|force' => \$force,
73
    'u|unallocated' => \$unallocated
74
);
70
);
75
pod2usage(1)                              if $help;
71
pod2usage(1)                              if $help;
76
pod2usage( -exitval => 0, -verbose => 2 ) if $man;
72
pod2usage( -exitval => 0, -verbose => 2 ) if $man;
77
73
78
my $rthq = C4::Context->preference('RealTimeHoldsQueue');
74
my $rthq = C4::Context->preference('RealTimeHoldsQueue');
75
my $unallocated = 0;
79
76
80
if ( $rthq && !$force ) {
77
if ( $rthq && !$force ) {
81
    say "RealTimeHoldsQueue system preference is enabled, holds queue not built.";
78
    say "RealTimeHoldsQueue system preference is enabled, holds queue not rebuilt. Checking unallocated holds only.";
82
    say "Use --force to force building the holds queue.";
79
    say "Use --force to force building the holds queue.";
83
    exit(1);
80
    $unallocated = 1;
84
}
81
}
85
82
86
cronlogaction( { info => $command_line_options } );
83
cronlogaction( { info => $command_line_options } );
87
- 

Return to bug 32565