Bugzilla – Attachment 15861 Details for
Bug 9656
fines.pl creating a log file should be optional
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9656: Followup Make logging to a file optional (for fines)
Bug-9656-Followup-Make-logging-to-a-file-optional-.patch (text/plain), 2.36 KB, created by
Elliott Davis
on 2013-03-04 19:04:58 UTC
(
hide
)
Description:
Bug 9656: Followup Make logging to a file optional (for fines)
Filename:
MIME Type:
Creator:
Elliott Davis
Created:
2013-03-04 19:04:58 UTC
Size:
2.36 KB
patch
obsolete
>From 6527a1a64c0812bb2754a7ac3810b3d501e2bbc5 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 28 Feb 2013 14:09:24 +0100 >Subject: [PATCH] Bug 9656: Followup Make logging to a file optional (for fines) > >The -log option become optional if the -output_dir is given. > >Test plan: >call the script with >1/ no one parameter : no log file >2/ -l : log file will be created in /tmp >3/ -o=/home/koha/var/log : log file with be created in the specified >4/ -o=/home/koha/var/log -l: Same as 3/ > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> > >Comment: All combination of options tested. Works well. No errors. >Signed-off-by: Elliott Davis <elliott@bywatersolions.com> >--- > misc/cronjobs/fines.pl | 15 +++++++++------ > 1 files changed, 9 insertions(+), 6 deletions(-) > >diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl >index 3801450..d2b0062 100755 >--- a/misc/cronjobs/fines.pl >+++ b/misc/cronjobs/fines.pl >@@ -60,7 +60,7 @@ calculated but not applied. > > This script has the following parameters : > -h --help: this message >- -l --log: log the output to a file >+ -l --log: log the output to a file (optional if the -o parameter is given) > -o --out: ouput directory for logs (defaults to env or /tmp if !exist) > -v --verbose > >@@ -82,10 +82,13 @@ my $delim = "\t"; # ? C4::Context->preference('delimiter') || "\t"; > > my %is_holiday; > my $today = DateTime->now( time_zone => C4::Context->tz() ); >-my $filename = get_filename($output_dir); >+my $filename; >+if ($log or $output_dir) { >+ $filename = get_filename($output_dir); >+} > > my $fh; >-if ($log) { >+if ($filename) { > open $fh, '>>', $filename or croak "Cannot write file $filename: $!"; > print {$fh} join $delim, ( @borrower_fields, @item_fields, @other_fields ); > print {$fh} "\n"; >@@ -131,7 +134,7 @@ for my $overdue ( @{$overdues} ) { > ); > } > } >- if ($log) { >+ if ($filename) { > my @cells; > push @cells, > map { defined $borrower->{$_} ? $borrower->{$_} : q{} } >@@ -141,7 +144,7 @@ for my $overdue ( @{$overdues} ) { > say {$fh} join $delim, @cells; > } > } >-if ($log){ >+if ($filename){ > close $fh; > } > >@@ -150,7 +153,7 @@ if ($verbose) { > print <<"EOM"; > Fines assessment -- $today > EOM >- if ($log) { >+ if ($filename) { > say "Saved to $filename"; > } > print <<"EOM"; >-- >1.7.2.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 9656
:
15581
|
15643
|
15644
|
15767
|
15814
|
15860
| 15861