Bugzilla – Attachment 39261 Details for
Bug 12919
Automate collecting all records added and deleted from the catalogue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 12919: Cronjob to create and email new or updated MARC records
SIGNED-OFF-Bug-12919-Cronjob-to-create-and-email-n.patch (text/plain), 4.76 KB, created by
Bernardo Gonzalez Kriegel
on 2015-05-17 22:24:49 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 12919: Cronjob to create and email new or updated MARC records
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2015-05-17 22:24:49 UTC
Size:
4.76 KB
patch
obsolete
>From 7214512d5b3d080a6eb850d5f100149a424b9abf Mon Sep 17 00:00:00 2001 >From: Chris Cormack <chrisc@catalyst.net.nz> >Date: Mon, 15 Sep 2014 14:51:49 +1200 >Subject: [PATCH] [SIGNED-OFF] Bug 12919: Cronjob to create and email new or > updated MARC records > >To test > >1/ Add some new records to your Koha >2/ if you are using koha from packages >run > >sudo koha-shell <kohainstancename> > >otherwise > >export PERL5LIB=/path/to/koha >export KOHA_CONF=/path/to/koha-conf.xml > >3/ run > >perl misc/cronjobs/newly_added_records --days 1 --address your@email.goes.here --format marc > >4/ Check your email and see if you got some marc records > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >--- > misc/cronjobs/newly_added_records.pl | 101 ++++++++++++++++++++++++++++++++++ > 1 file changed, 101 insertions(+) > create mode 100755 misc/cronjobs/newly_added_records.pl > >diff --git a/misc/cronjobs/newly_added_records.pl b/misc/cronjobs/newly_added_records.pl >new file mode 100755 >index 0000000..a237158 >--- /dev/null >+++ b/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 <<EOF >+This script creates an emails a batch of marc records that have been added to >+Koha in a set period of time >+ Parameters: >+ --help|-? This message >+ -v Verbose, output biblionumbers of records that can't be parsed >+ --items Export item data also >+ --days TTT to define the age of marc records to export >+ --months TTT to define the age of marc records to export eg -months 1 >+ will export any created in the last calendar month >+ --address TTT to define the email address to send the file to. Can >+ be repeated. >+ --not_loan TTT to define the not for loan value to exclude from the >+ export (useful for on-order records) >+ --not_itypes to define the itemtypes to exclude from the outputted >+ records. Can be repeated. >+ --format 'marc': output the whole record as MARC, 'isbn': just >+ output text ISBN values. >+ --filename the filename (including extension) of the attachment. >+ May include %month% which is replaced with the current >+ month. >+ example : >+ export PERL5LIB=/path/to/koha;export KOHA_CONF=/etc/koha/koha-conf.xml;./newly_added_records --days 30 --address chrisc\@catalyst.net.nz --format marc >+ export PERL5LIB=/path/to/koha;export KOHA_CONF=/etc/koha/koha-conf.xml;./newly_added_records --days 30 --not_loan -1 --not_itype BK --not_itype CF --address chrisc\@catalyst.net.nz --format isbn >+ >+EOF >+ ; >+ exit; >+} >+ >+$filename = $filename || 'Koha.' . ( $format eq 'isbn' ? 'csv' : 'mrc' ); >+my $month = lc( DateTime->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 ); >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12919
:
31589
|
31590
|
31591
|
39260
| 39261 |
39262
|
39263
|
40505