Bug 3090 - Add perldoc details
This is half of the fix for 3090. Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
parent
f20a415803
commit
4e76d3c1bb
1 changed files with 37 additions and 13 deletions
|
@ -36,21 +36,24 @@ BEGIN {
|
||||||
# test carefully before changing this
|
# test carefully before changing this
|
||||||
use FindBin;
|
use FindBin;
|
||||||
eval { require "$FindBin::Bin/../kohalib.pl" };
|
eval { require "$FindBin::Bin/../kohalib.pl" };
|
||||||
$VERSION = 0.21;
|
$VERSION = 0.22;
|
||||||
}
|
}
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
runreport.pl - Run a pre-existing saved report.
|
runreport.pl - Run pre-existing saved reports
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
runreport.pl [ -v ]
|
runreport.pl [ -h | -m ] [ -v ] reportID [ reportID ... ]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h --help brief help message
|
-h --help brief help message
|
||||||
-m --man full documentation, same as --help --verbose
|
-m --man full documentation, same as --help --verbose
|
||||||
-v --verbose verbose output
|
-v --verbose verbose output
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
reportID report ID Number from saved_sql.id, multiple ID's may be specified
|
||||||
|
|
||||||
=head1 OPTIONS
|
=head1 OPTIONS
|
||||||
|
|
||||||
|
@ -72,15 +75,29 @@ Verbose. Without this flag set, only fatal errors are reported.
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
This script is designed to run an existing Saved Report.
|
This script is designed to run existing Saved Reports.
|
||||||
|
|
||||||
=head1 USAGE EXAMPLES
|
=head1 USAGE EXAMPLES
|
||||||
|
|
||||||
B<runreport.pl> 16
|
B<runreport.pl 16>
|
||||||
|
|
||||||
In the most basic form, runs the report specified by ID number from
|
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.
|
saved_sql.id, in this case #16, outputting the results to STDOUT.
|
||||||
|
|
||||||
|
B<runreport.pl 16 17>
|
||||||
|
|
||||||
|
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
|
=head1 SEE ALSO
|
||||||
|
|
||||||
Reports - Guided Reports
|
Reports - Guided Reports
|
||||||
|
@ -93,9 +110,10 @@ Reports - Guided Reports
|
||||||
my $help = 0;
|
my $help = 0;
|
||||||
my $man = 0;
|
my $man = 0;
|
||||||
my $verbose = 0;
|
my $verbose = 0;
|
||||||
|
my $email = 0;
|
||||||
my $format = "";
|
my $format = "";
|
||||||
my $to = C4::Context->preference('KohaAdminEmailAddress');
|
my $to = "";
|
||||||
my $from = C4::Context->preference('KohaAdminEmailAddress');
|
my $from = "";
|
||||||
my $subject = 'Koha Saved Report';
|
my $subject = 'Koha Saved Report';
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
|
@ -105,6 +123,7 @@ GetOptions(
|
||||||
'format' => \$format,
|
'format' => \$format,
|
||||||
'to' => \$to,
|
'to' => \$to,
|
||||||
'from' => \$from,
|
'from' => \$from,
|
||||||
|
'email' => \$email,
|
||||||
) or pod2usage(2);
|
) or pod2usage(2);
|
||||||
pod2usage( -verbose => 2 ) if ($man);
|
pod2usage( -verbose => 2 ) if ($man);
|
||||||
pod2usage( -verbose => 2 ) if ($help and $verbose);
|
pod2usage( -verbose => 2 ) if ($help and $verbose);
|
||||||
|
@ -116,13 +135,18 @@ unless ($format) {
|
||||||
# $format = 'text';
|
# $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)) {
|
unless (scalar(@ARGV)) {
|
||||||
print STDERR "ERROR: No reports specified\n";
|
print STDERR "ERROR: No reportID(s) specified\n";
|
||||||
pod2usage(1);
|
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) {
|
foreach my $report (@ARGV) {
|
||||||
my ($sql, $type) = get_saved_report($report);
|
my ($sql, $type) = get_saved_report($report);
|
||||||
|
|
Loading…
Reference in a new issue