[Bug 36309] New: create_superlibrarian.pl output could be more helpful
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36309 Bug ID: 36309 Summary: create_superlibrarian.pl output could be more helpful Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz This helpful script could provide better output instead of just exploding. For instance, it could display the valid values for branchcode and categorycode in the event of a broken FK while creating the patron. -- 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=36309 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- 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=36309 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 163118 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=163118&action=edit Bug 36309: Make create_superlibrarian.pl output more useful In situations in which you are not familiar with all the Koha settings, and table structure, the fact this script just fails telling there's a broken FK is just not practical. We should capture those exceptions and display a useful message instead. This script does that. It adds some validations and some exception handling too. It prints a nice message about the bad value the user passed, and the valid values too! To test: 1. Run this on a fresh KTD: $ ktd --shell k$ perl misc/devel/create_superlibrarian.pl \ --userid tcohen \ --password tomasito \ --cardnumber 123456789 \ --categorycode POT \ --branchcode ATO => FAIL: It explodes with a MySQL exception message! 2. Apply this patch 3. Repeat 1 => SUCCESS: It tells you which value is wrong and what values you can pick to make the command work 4. Pick a valid value, and repeat => SUCCESS: Now the other value is wrong, a nice message is displayed! 5. Fix with a valid value and repeat => SUCCESS: Patron created! 6. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36309 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Comment for QA: I'm not 100% happy with our exception system as there's no consistent way to implement this without several manual checks and disambiguations... and disabling STDERR warns at DBIx::Class level to avoid noise for the end user. That said, it is a discussion to have on another report. And the extra checks inside a transaction I implemented here cause no harm either. I think the benefits are worth the (tiny) extra overhead. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36309 David Nind <david@davidnind.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=36309 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #163118|0 |1 is obsolete| | --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 163124 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=163124&action=edit Bug 36309: Make create_superlibrarian.pl output more useful In situations in which you are not familiar with all the Koha settings, and table structure, the fact this script just fails telling there's a broken FK is just not practical. We should capture those exceptions and display a useful message instead. This script does that. It adds some validations and some exception handling too. It prints a nice message about the bad value the user passed, and the valid values too! To test: 1. Run this on a fresh KTD: $ ktd --shell k$ perl misc/devel/create_superlibrarian.pl \ --userid tcohen \ --password tomasito \ --cardnumber 123456789 \ --categorycode POT \ --branchcode ATO => FAIL: It explodes with a MySQL exception message! 2. Apply this patch 3. Repeat 1 => SUCCESS: It tells you which value is wrong and what values you can pick to make the command work 4. Pick a valid value, and repeat => SUCCESS: Now the other value is wrong, a nice message is displayed! 5. Fix with a valid value and repeat => SUCCESS: Patron created! 6. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36309 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #4 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. Before the patch, the message was: Invalid parameter passed, categorycode=POT does not exist 2. After patch - no changes to parameters: ERROR: 'ATO' is not valid for the 'branchcode' field Possible values are: CPL, FFL, FPL, FRL, IPT, LPL, MPL, PVL, RPL, SPL, TPL, UPL 3. After patch - change branchcode to valid value: ERROR: 'ATO' is not valid for the 'branchcode' field Possible values are: CPL, FFL, FPL, FRL, IPT, LPL, MPL, PVL, RPL, SPL, TPL, UPL 4. After path - change categorycode to valid value: no output, successfully adds user -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36309 Kyle M Hall <kyle@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=36309 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #163124|0 |1 is obsolete| | --- Comment #5 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 163363 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=163363&action=edit Bug 36309: Make create_superlibrarian.pl output more useful In situations in which you are not familiar with all the Koha settings, and table structure, the fact this script just fails telling there's a broken FK is just not practical. We should capture those exceptions and display a useful message instead. This script does that. It adds some validations and some exception handling too. It prints a nice message about the bad value the user passed, and the valid values too! To test: 1. Run this on a fresh KTD: $ ktd --shell k$ perl misc/devel/create_superlibrarian.pl \ --userid tcohen \ --password tomasito \ --cardnumber 123456789 \ --categorycode POT \ --branchcode ATO => FAIL: It explodes with a MySQL exception message! 2. Apply this patch 3. Repeat 1 => SUCCESS: It tells you which value is wrong and what values you can pick to make the command work 4. Pick a valid value, and repeat => SUCCESS: Now the other value is wrong, a nice message is displayed! 5. Fix with a valid value and repeat => SUCCESS: Patron created! 6. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36309 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |kyle@bywatersolutions.com |y.org | CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36309 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |24.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36309 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.05! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36309 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Status|Pushed to main |Needs documenting --- Comment #7 from Fridolin Somers <fridolin.somers@biblibre.com> --- Not backported to 23.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org