5 use Getopt::Long qw( GetOptions );
6 use Pod::Usage qw( pod2usage );
9 use Koha::Script -cron;
12 use C4::Log qw( cronlogaction );
14 my $command_line_options = join(" ",@ARGV);
17 my ( $verbose, $help, $confirm );
18 my $result = GetOptions(
20 'v|verbose' => \$verbose,
21 'c|confirm' => \$confirm,
24 pod2usage(1) if $help;
25 $verbose = 1 unless $confirm;
27 # Load configuration from the syspref
28 my $syspref_content = C4::Context->preference('automatic_item_modification_by_age_configuration');
29 my $rules = eval { JSON::from_json( $syspref_content ) };
30 pod2usage({ -message => "Unable to load the configuration : $@", -exitval => 1 })
33 cronlogaction({ info => $command_line_options });
35 my $report = C4::Items::ToggleNewStatus( { rules => $rules, report_only => not $confirm } );
39 say "Item to modify:";
40 while ( my ( $itemnumber, $substitutions ) = each %$report ) {
41 for my $substitution ( @$substitutions ) {
42 if ( defined $substitution->{value} and $substitution->{value} ne q|| ) {
43 say "\titemnumber $itemnumber: $substitution->{field}=$substitution->{value}";
45 say "\titemnumber $itemnumber: field $substitution->{field} to delete";
50 say "There is no item to modify";
54 cronlogaction({ action => 'End', info => "COMPLETED" });
62 automatic_item_modification_by_age.pl
66 ./automatic_item_modification_by_age.pl -h
68 Toggle recent acquisitions status.
69 Use this script to delete "new" status for items.
77 Prints this help message.
85 The script will modify the items.
91 Jonathan Druart <jonathan.druart@biblibre.com>
95 Copyright 2013 BibLibre
99 This file is part of Koha.
101 Koha is free software; you can redistribute it and/or modify it
102 under the terms of the GNU General Public License as published by
103 the Free Software Foundation; either version 3 of the License, or
104 (at your option) any later version.
106 Koha is distributed in the hope that it will be useful, but
107 WITHOUT ANY WARRANTY; without even the implied warranty of
108 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
109 GNU General Public License for more details.
111 You should have received a copy of the GNU General Public License
112 along with Koha; if not, see <http://www.gnu.org/licenses>.