@@ -, +, @@ updated MARC records --- misc/cronjobs/newly_added_records.pl | 101 ++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100755 misc/cronjobs/newly_added_records.pl --- a/misc/cronjobs/newly_added_records.pl +++ a/misc/cronjobs/newly_added_records.pl @@ -0,0 +1,101 @@ +#!/usr/bin/perl + +# Copyright 2012 Catalyst IT +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# This is script is to create a batch of MARC records that have been added to Koha in a set period +# Then email the file to a designated email + +use strict; +use warnings; +use DateTime; +use C4::RecordExporter; + +BEGIN { + + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} + +use Getopt::Long; +use Pod::Usage; + +my ( + $help, $days, $months, $verbose, $export_items, + @address, $not_loan, @not_itypes, $format, $filename, +); +GetOptions( + 'help|?' => \$help, + 'days=s' => \$days, + 'months=s' => \$months, + 'v' => \$verbose, + 'items' => \$export_items, + 'address=s' => \@address, + 'not_loan=s' => \$not_loan, + 'not_itype=s' => \@not_itypes, + 'format=s' => \$format, + 'filename=s' => \$filename, +); + +if ( $help or ( not $days and not $months ) or not @address or not $format ) { + print <now()->month_name() ); +$filename =~ s/%month%/$month/g; + +my $date = DateTime->now(); +if ($days) { + $date->subtract( days => $days ); +} +elsif ($months) { + $date->set_day(1); + $date->subtract( months => $months ); +} + +export_and_mail_new( $date, \@address, $verbose, $export_items, $not_loan, + $format, $filename, @not_itypes ); --