Bugzilla – Attachment 20871 Details for
Bug 9739
more options for serialsUpdate.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 9739: more options for serialsUpdate.pl
SIGNED-OFF-Bug-9739-more-options-for-serialsUpdate.patch (text/plain), 4.04 KB, created by
Bernardo Gonzalez Kriegel
on 2013-09-08 01:59:30 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 9739: more options for serialsUpdate.pl
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2013-09-08 01:59:30 UTC
Size:
4.04 KB
patch
obsolete
>From 09fbabdaa20d358c49fa4fd17b7eb4aa2285335d Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Thu, 28 Feb 2013 18:21:18 +0100 >Subject: [PATCH] [SIGNED-OFF] Bug 9739: more options for serialsUpdate.pl > >Script serialsUpdate.pl must be set in crontab to run daily. >It checks serials that are late, modifies status and adds a note. > >This patch adds some options : >--note : defined note, a defaut one is used if not defined >--no-note : disable automatic note >--verbose : used to control output >This patch also implements confirmation option "-c" who whas present but not used. > >Test plan : >Run script on a database with late serials : >- serialsUpdate.pl -h >=> you get help text in output >- serialsUpdate.pl --man >=> you get full help >- serialsUpdate.pl -v >=> you get output of changed serials but database has not changed >- serialsUpdate.pl -c -v >=> you get output of changed serials and database has changed, with note "Automatically set to late" >- serialsUpdate.pl -c >=> database has changed without anything in output >- serialsUpdate.pl -c --note "LATE" >=> database has changed, with note "LATE" >- serialsUpdate.pl -c --no-note >=> database has changed with no note > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Works as described. No koha-qa errors. >--- > misc/cronjobs/serialsUpdate.pl | 50 ++++++++++++++++++++++++++++++++++------ > 1 file changed, 43 insertions(+), 7 deletions(-) > >diff --git a/misc/cronjobs/serialsUpdate.pl b/misc/cronjobs/serialsUpdate.pl >index a5a376f..4070331 100755 >--- a/misc/cronjobs/serialsUpdate.pl >+++ b/misc/cronjobs/serialsUpdate.pl >@@ -37,20 +37,56 @@ use Date::Calc qw/Date_to_Days check_date/; > use Getopt::Long; > use Pod::Usage; > >+=head1 NAME >+ >+serialsUpdate.pl - change status of serials that are late >+ >+=head1 SYNOPSIS >+ >+serialsUpdate.pl [ -h | -m ][ -v ] -c ][ --note "you are late" ][ --no-note ] >+ >+ Options: >+ --h --help -? Brief help message >+ --man Full documentation >+ --verbose -v Verbose mode >+ -c Confirm : without this option, the script will report the concerned serials >+ without modifying database >+ --note Note set to concerned serials, by default "Automatically set to late" >+ --no-note Do not set a note one concerned serials >+ >+=cut >+ > my $dbh = C4::Context->dbh; > > my $man = 0; > my $help = 0; > my $confirm = 0; >+my $verbose = 0; >+my $note = ''; >+my $nonote = 0; > > GetOptions( >- 'help|?' => \$help, >- 'c' => \$confirm, >+ 'help|h|?' => \$help, >+ 'man' => \$man, >+ 'v|verbose' => \$verbose, >+ 'c' => \$confirm, >+ 'note:s' => \$note, >+ 'no-note' => \$nonote, > ) or pod2usage(2); > > pod2usage(1) if $help; > pod2usage( -verbose => 2 ) if $man; > >+$verbose and !$confirm and print "### Database will not be modified ###\n"; >+ >+if ($note && $nonote) { >+ $note = ''; >+} >+if (!$note && !$nonote) { >+ $note = 'Automatically set to late'; >+} >+$verbose and print $note ? "Note : $note\n" : "No note\n"; >+ > # select all serials with not "irregular" periodicity that are late > my $sth = $dbh->prepare(" > SELECT * >@@ -81,16 +117,16 @@ while ( my $issue = $sth->fetchrow_hashref ) { > && Date_to_Days( $year, $month, $day ) < > Date_to_Days( $tyear, $tmonth, $tday ) ) > { >- >+ $confirm and > ModSerialStatus( $issue->{serialid}, $issue->{serialseq}, > $issue->{planneddate}, $issue->{publisheddate}, >- 3, "Automatically set to late" ); >- print $issue->{serialid}." update\n"; >+ 3, $note ); >+ $verbose and print "Serial id=" . $issue->{serialid}." update\n"; > } > }else{ >- print "Error with serial(".$issue->{serialid}.") has no existent >+ $verbose and print "Error with serial(".$issue->{serialid}.") has no existent > subscription(".$issue->{subscriptionid}.") attached >- or planneddate is "; >+ or planneddate is wrong\n"; > } > } > } >-- >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 9739
:
15800
|
15801
|
18058
|
18059
|
20871
|
20872
|
20873
|
21588
|
21589
|
21590
|
21592