Bug 26594: add Unit Test
[koha.git] / misc / mod_zebraqueue.pl
blob240aad44fa5f4e3ead7d8f8e9d9b5b77f7bc7bdb
1 #!/usr/bin/perl
3 # Copyright 2012 Kyle M Hall
4 # This file is part of Koha.
6 # Koha is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # Koha is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Koha; if not, see <http://www.gnu.org/licenses>.
19 # script to add records to the zebraqueue from the commandline.
21 use Modern::Perl;
23 use Getopt::Long;
24 use Pod::Usage;
26 use Koha::Script;
27 use C4::Biblio;
29 my @biblios;
30 my @authorities;
31 my $help;
32 my $verbose;
34 GetOptions(
35 "b|biblio|biblionumber=s" => \@biblios,
36 "a|authority|authoritynumber=s" => \@authorities,
37 'h|?|help' => \$help,
38 'v|verbose' => \$verbose,
41 pod2usage( -exitval => 0 ) if ( $help || !( @biblios || @authorities ) );
43 foreach my $biblionumber (@biblios) {
44 print "Adding bibliographic record $biblionumber to Zebra queue\n" if ($verbose);
45 ModZebra( $biblionumber, "specialUpdate", "biblioserver" );
48 foreach my $authority (@authorities) {
49 print "Adding authority record $authority to Zebra queue\n" if ($verbose);
50 ModZebra( $authority, 'specialUpdate', "authorityserver" );
53 __END__
55 =head1 NAME
57 mod_zebraqueue.pl - Mark bibliographic and/or authority records for updating via the zebraqueue.
59 =head1 SYNOPSIS
61 mod_zebraqueue.pl -v -b $bib1 -b $bib2 -a $authority1 -a $authority2
63 =head1 OPTIONS
65 =over 8
67 =item B<-b, --biblio, --biblionumber>
69 The biblionumber of a record to be updated, repeatable.
71 =item B<-a, --authority, --authoritynumber>
73 The authoritynumber of the record to be updated, repeatable.
75 =item B<-h, -?, --help>
77 Prints this help message and exits.
79 =item B<-v, --verbose>
81 Be verbose
83 =back
85 =cut