[Bug 43558] New: Convert misc/cronjobs/longoverdue.pl to the Getopt::Long::Descriptive convention (see bug 43546)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Bug ID: 43558 Summary: Convert misc/cronjobs/longoverdue.pl to the Getopt::Long::Descriptive convention (see bug 43546) Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: jake.deery@openfifth.co.uk, robin@catalyst.net.nz Target Milestone: --- Convert the plain Getopt::Long option parsing in misc/cronjobs/longoverdue.pl to Koha::Script->describe_options, per the convention established by bug 43546. This script has three separate mutually-exclusive option pairs, each currently enforced with its own hand-rolled pod2usage check after parsing: - --category / --skip-category - --library / --skip-library - --itemtype / --skip-itemtype Depends on bug 43557 (declarative mutually-exclusive option support in Koha::Script->describe_options), so all three pairs can be declared rather than reimplemented as three near-identical post-parse checks. Test plan: 1. misc/cronjobs/longoverdue.pl --help Confirm the description and all options are documented. 2. For each of the three pairs, confirm supplying both options together is still rejected as mutually exclusive, and each option still works correctly on its own. 3. koha-qa.pl passes for the changed file. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |43557 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43557 [Bug 43557] Add declarative mutually-exclusive option support to Koha::Script->describe_options -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- 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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206175|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208582 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208582&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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208582|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 --- Comment #3 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208596 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208596&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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208596|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 --- Comment #4 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 211062 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211062&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. Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211062|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 --- Comment #5 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 211066 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211066&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. Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 --- Comment #6 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 211067 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211067&action=edit Bug 43558: (QA follow-up) Require a value for --charge and --maxdays The conversion declared --charge and --maxdays with an optional value (:s), where Getopt::Long had them requiring one (=s). Passed without a value they used to stop the script with "requires an argument"; with :s they ran instead: - a bare -c gave an empty charge value, which skipped the DefaultLongOverdueChargeValue default, so items were marked lost without charging the patron - a bare --maxdays gave an empty end of range, so the query matched nothing and the script did nothing without saying why Declare both with =s again. Test plan: 1. longoverdue.pl --lost 30=1 -c => Option c requires an argument 2. longoverdue.pl --lost 30=1 --maxdays => Option maxdays requires an argument 3. longoverdue.pl --lost 30=1 -c 1 --maxdays 100 => Runs in TEST MODE over the range 30 - 100 days Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |andrew@bywatersolutions.com |y.org | CC| |andrew@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_26_11_candidate -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 --- Comment #7 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |The `longoverdue.pl` release notes| |cronjob now parses its | |options with the shared | |`Koha::Script` option | |handling. The | |`--category`/`--skip-catego | |ry`, | |`--library`/`--skip-library | |` and | |`--itemtype`/`--skip-itemty | |pe` pairs are each rejected | |when used together. | | | |**Configuration** | |- `-h` and `--manual` are | |no longer accepted. Use | |`--help` and `--man`. | | | |**Upgrade notes** | |- Cron lines that use `-h` | |or `--manual` need to be | |updated. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43558 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Status|Pushed to main |Needs documenting --- Comment #8 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Enhancement, no 26.05.x backport. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org