https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558

--- Comment #1 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 206175
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206175&action=edit
Bug 43558: Convert longoverdue.pl to the Getopt::Long::Descriptive convention

Convert the plain Getopt::Long option parsing to
Koha::Script->describe_options, per the convention established by bug
43546. --category/--skip-category, --library/--skip-library, and
--itemtype/--skip-itemtype are each declared exclusive (bug 43557),
replacing three near-identical hand-rolled pod2usage checks.

--lost's Getopt::Long::Descriptive spec is a hash type (=s%), matching
its existing DAYS=LOST_CODE usage; --category/--skip-category/
--library/--skip-library/--itemtype/--skip-itemtype/--skip-lost-value
all move from the "arrayref/array passed as the destination" trick
(which accumulates regardless of the spec string) to an explicit @
type, since describe_options needs it declared, not inferred from the
destination.

No option here has a single-value shape worth a Params::Validate
callback: the FIXMEs already in this file ("do checks on --lost ranges
...") describe validation this script has never had, not something
this conversion adds, and the category/library/itemtype existence
checks stay post-parse code (same reasoning as the sibling bugs --
they're DB lookups shared with building the skip/include table, not
CLI-shape checks).

Two minor, expected losses of alternate spellings, consistent with the
other scripts already converted: -h no longer means --help
(describe_options' auto-added help is always help|?, no short letter),
and --manual no longer works as a --man alias (only --man). Both were
undocumented-by-convention duplicate spellings, not the primary flag;
updated the SYNOPSIS/OPTIONS POD to stop advertising them.

Test plan:
1. longoverdue.pl --help / --man
2. longoverdue.pl --category X --skip-category Y (and the library/
   itemtype equivalents)
   Each pair still rejected as mutually exclusive.
3. longoverdue.pl --list-categories / --list-itemtypes
   Still list and exit 0.
4. longoverdue.pl (no options, no DefaultLongOverdueLostValue/Days set)
   Still rejected: no --lost option or system preferences defined.
5. longoverdue.pl --lost 30=1 [--quiet]
   Still runs in TEST MODE (no --confirm) and prints the same report.
6. longoverdue.pl --lost 30=1 --category BADCODE
   Still rejected: category does not exist in the database.
7. koha-qa.pl passes.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
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/

Reply via email to