From 42e0f5c873ed0448e6186b96f958a4197fbb219f Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 7 Apr 2009 17:37:55 -0500 Subject: [PATCH] Bug 3090 - Add perldoc details This is half of the fix for 3090. Signed-off-by: Galen Charlton Signed-off-by: Henri-Damien LAURENT --- misc/cronjobs/runreport.pl | 50 ++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/misc/cronjobs/runreport.pl b/misc/cronjobs/runreport.pl index ebbaa6ef52..b2e4af9105 100755 --- a/misc/cronjobs/runreport.pl +++ b/misc/cronjobs/runreport.pl @@ -36,21 +36,24 @@ BEGIN { # test carefully before changing this use FindBin; eval { require "$FindBin::Bin/../kohalib.pl" }; - $VERSION = 0.21; + $VERSION = 0.22; } =head1 NAME -runreport.pl - Run a pre-existing saved report. +runreport.pl - Run pre-existing saved reports =head1 SYNOPSIS -runreport.pl [ -v ] +runreport.pl [ -h | -m ] [ -v ] reportID [ reportID ... ] Options: - -h --help brief help message - -m --man full documentation, same as --help --verbose - -v --verbose verbose output + -h --help brief help message + -m --man full documentation, same as --help --verbose + -v --verbose verbose output + + Arguments: + reportID report ID Number from saved_sql.id, multiple ID's may be specified =head1 OPTIONS @@ -72,15 +75,29 @@ Verbose. Without this flag set, only fatal errors are reported. =head1 DESCRIPTION -This script is designed to run an existing Saved Report. +This script is designed to run existing Saved Reports. =head1 USAGE EXAMPLES -B 16 +B In the most basic form, runs the report specified by ID number from saved_sql.id, in this case #16, outputting the results to STDOUT. +B + +Same as above, but also runs report #17. + +=head1 TO DO + +=over 8 + + ~ Complete testing for Sendmail related options: --email, --to, and --from. + ~ Allow Saved Results option. + ~ Possible --format option for CSV or tab-delimited output. + +=back + =head1 SEE ALSO Reports - Guided Reports @@ -93,9 +110,10 @@ Reports - Guided Reports my $help = 0; my $man = 0; my $verbose = 0; +my $email = 0; my $format = ""; -my $to = C4::Context->preference('KohaAdminEmailAddress'); -my $from = C4::Context->preference('KohaAdminEmailAddress'); +my $to = ""; +my $from = ""; my $subject = 'Koha Saved Report'; GetOptions( @@ -105,6 +123,7 @@ GetOptions( 'format' => \$format, 'to' => \$to, 'from' => \$from, + 'email' => \$email, ) or pod2usage(2); pod2usage( -verbose => 2 ) if ($man); pod2usage( -verbose => 2 ) if ($help and $verbose); @@ -116,13 +135,18 @@ unless ($format) { # $format = 'text'; } +if ($to or $from or $email) { + $email = 1; + $from or $from = C4::Context->preference('KohaAdminEmailAddress'); + $to or $to = C4::Context->preference('KohaAdminEmailAddress'); +} + unless (scalar(@ARGV)) { - print STDERR "ERROR: No reports specified\n"; + print STDERR "ERROR: No reportID(s) specified\n"; pod2usage(1); } -print scalar(@ARGV), " argument(s) after options: " . join(" ", @ARGV) . "\n"; +($verbose) and print scalar(@ARGV), " argument(s) after options: " . join(" ", @ARGV) . "\n"; -my $email; foreach my $report (@ARGV) { my ($sql, $type) = get_saved_report($report); -- 2.39.2