https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43548
--- Comment #6 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 206089 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206089&action=edit Bug 43548: Simplify runreport.pl's option-handling using Getopt::Long::Descriptive A few of runreport.pl's own option-handling clauses can lean on more of Getopt::Long::Descriptive's existing constraint vocabulary, with no behaviour change: - --to and --from now declare { implies => 'email' }, so GLD itself sets $opt->email when either is given, replacing the manual "if ($to or $from or $send_email) { $send_email = 1 }" check. - The --separator/--quote "only meaningful with --format csv" warnings stay as manual post-parse checks -- GLD's constraints are pass/fail (a failing one aborts the script via $usage->die), so turning this warn-and-continue behaviour into a declarative constraint would make it a hard failure instead, which would be a real behaviour change. They're simplified to flat checks against $opt->separator/$opt->quote directly, dropping the now-unneeded mutable local copies. - The "unless ($format) { assume 'text' }" fallback is dropped, since { default => 'text' } on the format option already guarantees this (it was only reachable via an explicit --format '', which behaves differently now, but nobody relies on that). - The positional report IDs are copied to @report_ids once, right after describe_options, instead of using @ARGV directly throughout -- purely a readability nicety pairing the declared 'args' name with a named variable at the point of use. Test plan: 1. Run misc/cronjobs/runreport.pl --separator ';' <id> (without --format csv) and confirm it still warns "Cannot specify separator if not using CSV format" and still produces default tab-separated output, unaffected by the warning. 2. Run misc/cronjobs/runreport.pl --format csv --separator ';' --quote "'" --csv-header <id> and confirm the custom separator/quote are applied. 3. Run misc/cronjobs/runreport.pl --to [email protected] <id> and confirm it still attempts to email the report (implied by --to). 4. Run misc/cronjobs/runreport.pl <id> <id2> and confirm both reports run. 5. Confirm koha-qa.pl passes for the changed file. Co-Authored-By: Claude Sonnet 5 <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
