[Bug 37096] New: Required fields in budget creation are ignored if left blank
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 Bug ID: 37096 Summary: Required fields in budget creation are ignored if left blank Change sponsored?: --- Product: Koha Version: 23.11 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: esther.melander@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org To Replicate 1. In Acquisitions, Budgets, add a new budget. 2. Fill in the Start date, Description, Total Amount, and make active. Leave the end date BLANK. 3. Save. See that the user is returned to the budget listing page but the budget creation silently fails. The behavior is repeated if both the start date and end date are blank. A save failure error message does appear if the description is left blank. I would expect a save fail error message if either the start or end date was blank. -- 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=37096 Sam Lau <samalau@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |samalau@gmail.com Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |samalau@gmail.com |ity.org | -- 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=37096 Sam Lau <samalau@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 --- Comment #1 from Sam Lau <samalau@gmail.com> --- Created attachment 169869 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=169869&action=edit Bug 37096: Display error message for budget creation/modification if start/end date is left blank This patch adds an error message for a failed budget creation or modifcation due to the dates being empty. To test: 1) Go to the acquisitions tab, then on the side under 'Administration' select the 'Budgets' tab. 2) Click 'New budget', enter only a description and press save. 3) Note that the budget was not created, but no messages were displayed. 4) Apply patch, restart_all 5) Once again select 'New budget' and enter only a description. 6) This time when submitting, you will see an error message that says the process failed. 7) Edit an exisitng budget and remove the start date from this budget. 8) Attempt to save and note that the error message displays properly. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 Roman Dolny <roman.dolny@jezuici.pl> 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=37096 Roman Dolny <roman.dolny@jezuici.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #169869|0 |1 is obsolete| | --- Comment #2 from Roman Dolny <roman.dolny@jezuici.pl> --- Created attachment 169873 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=169873&action=edit Bug 37096: Display error message for budget creation/modification if start/end date is left blank This patch adds an error message for a failed budget creation or modifcation due to the dates being empty. To test: 1) Go to the acquisitions tab, then on the side under 'Administration' select the 'Budgets' tab. 2) Click 'New budget', enter only a description and press save. 3) Note that the budget was not created, but no messages were displayed. 4) Apply patch, restart_all 5) Once again select 'New budget' and enter only a description. 6) This time when submitting, you will see an error message that says the process failed. 7) Edit an exisitng budget and remove the start date from this budget. 8) Attempt to save and note that the error message displays properly. Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 Roman Dolny <roman.dolny@jezuici.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |roman.dolny@jezuici.pl --- Comment #3 from Roman Dolny <roman.dolny@jezuici.pl> --- This works as described, but shouldn't we prevent the form from being saved until all required fields are filled in? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 --- Comment #4 from Sam Lau <samalau@gmail.com> --- (In reply to Roman Dolny from comment #3)
This works as described, but shouldn't we prevent the form from being saved until all required fields are filled in?
Validating flatpickr values isn't the easiest thing to do. I couldn't find a way to make both of them required before submission while still utilizing jquery validation, so this solution was the next best thing for now -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |minor -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl --- Comment #5 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Roman Dolny from comment #3)
This works as described, but shouldn't we prevent the form from being saved until all required fields are filled in?
Yeah, sounds good. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|23.11 |Main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Some minor QA comments: my $action = $budget_period_id ne '' ? 'modify' : 'add'; This probably may trigger an uninitialized warning. Shouldnt we fix by adding a fallback here: my $budget_period_id = $input->param('budget_period_id'); if ( $budget_period_startdate eq '' || $budget_period_enddate eq '' ) { Same here. Add fallback to: my $budget_period_startdate = $input->param('budget_period_startdate'); my $budget_period_enddate = $input->param('budget_period_enddate'); EXIT_IF: { [etc] $op = 'else'; last EXIT_IF; Using last (goto) is not the best programming style. And it seems easy to adjust the next if / else to prevent needing it. + [% IF failed_add_validate %] I wonder if adding something with no start- or enddate here would be more clear? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37096 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org