Bug 14070

Summary: Notice not saved when mandatory fields are not filled
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: NoticesAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: indradg, jonathan.druart, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 14070 Improved handling of Notice saving
Bug 14070 Improved handling of Notice saving
Bug 14118: Prevent to save a letter if an error occurred
Bug 14070: Prevent to save a letter if an error occurred
[PASSED QA] Bug 14070: Prevent to save a letter if an error occurred

Description Katrin Fischer 2015-04-28 14:41:34 UTC
To test:
- Enter a new text for a notice, don't fill the subject line
- Save - a note is shown that not all mandatory fields have been filled in
- Verify: You are kicked back to the overview page of notices, your changes
  have not been saved 
- Start again...
Comment 1 Indranil Das Gupta 2015-05-15 06:06:43 UTC
(In reply to Katrin Fischer from comment #0)
> To test:
> - Enter a new text for a notice, don't fill the subject line
> - Save - a note is shown that not all mandatory fields have been filled in
> - Verify: You are kicked back to the overview page of notices, your changes
>   have not been saved 
> - Start again...

I found another issue too - the same issue affected during edits too. Example: You had mail and print filled in. Now you want to edit print, but accidentally managed to delete one of the fields in the mail fieldset. Koha would allow you to save the record, but in the process knocked off the rest of the mail fieldset data.

Wrote a small patch. Uploading in a few.

-idg
Comment 2 Indranil Das Gupta 2015-05-15 14:22:14 UTC Comment hidden (obsolete)
Comment 3 Mark Tompsett 2015-05-15 19:27:02 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-05-22 10:02:55 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2015-05-22 10:03:47 UTC
Indranil, could you please have a look at my counter patch?
I am not sure to understand why you patch is so complex :)
Comment 6 Indranil Das Gupta 2015-05-22 11:00:22 UTC
(In reply to Jonathan Druart from comment #5)
> Indranil, could you please have a look at my counter patch?
> I am not sure to understand why you patch is so complex :)

Jonathan: your patch is better and cleaner. I agree we should 
run with this.
Comment 7 Jonathan Druart 2015-05-22 12:04:35 UTC
(In reply to Indranil Das Gupta from comment #6)
> (In reply to Jonathan Druart from comment #5)
> > Indranil, could you please have a look at my counter patch?
> > I am not sure to understand why you patch is so complex :)
> 
> Jonathan: your patch is better and cleaner. I agree we should 
> run with this.

Great, I obsolete yours.
Comment 8 Indranil Das Gupta 2015-05-22 12:31:04 UTC
(In reply to Jonathan Druart from comment #7)
> (In reply to Indranil Das Gupta from comment #6)
> > (In reply to Jonathan Druart from comment #5)
> > > Indranil, could you please have a look at my counter patch?
> > > I am not sure to understand why you patch is so complex :)
> > 
> > Jonathan: your patch is better and cleaner. I agree we should 
> > run with this.
> 
> Great, I obsolete yours.

Could you please update the commit message with the correct bug id? thanks :)
Comment 9 Indranil Das Gupta 2015-05-22 12:35:47 UTC Comment hidden (obsolete)
Comment 10 Katrin Fischer 2015-05-31 20:59:31 UTC
Created attachment 39721 [details] [review]
[PASSED QA] Bug 14070: Prevent to save a letter if an error occurred

On saving a letter, if the title or the content of a template is not
defined, a JS alert is raised. But the form is submitted anyway.
This patch prevent the form to be submitted.

Test plan:
- Create or edit a letter
- Fill the title for a template, not the content
- Save
- Confirm you get the alert and that the form is not submitted

http://bugs.koha-community.org/show_bug.cgi?id=14070

Signed-off-by: Indranil Das Gupta <indradg@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2015-05-31 20:59:53 UTC
Much less annoying, thx!
Comment 12 Tomás Cohen Arazi 2015-06-17 12:58:13 UTC
Patch pushed to master.

Thanks Jonathan!