Bug 4419 - Cannot change module for notice templates
Summary: Cannot change module for notice templates
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Owen Leonard
QA Contact: Bugs List
URL: cgi-bin/koha/tools/letter.pl
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-27 08:22 UTC by Nicole C. Engard
Modified: 2013-12-05 20:01 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed fix (2.88 KB, patch)
2011-08-22 15:13 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Fix for Bug 4419 - cannot change module for notice templates (2.92 KB, patch)
2011-08-25 00:12 UTC, Nicole C. Engard
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2010-05-21 01:26:57 UTC


---- Reported by nengard@gmail.com 2010-04-27 20:22:28 ----

I created a notice template and picked the wrong module so i went back to edit it.  I chose a new module and hit save and it did not change the module.



--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:26 UTC  ---

This bug was previously known as _bug_ 4419 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=4419

Actual time not defined. Setting to 0.0
Setting qa contact to the default for this product.
   This bug either had no qa contact or an invalid one.

Comment 1 Owen Leonard 2011-08-22 14:48:55 UTC
In my test the problem isn't that submitting the form doesn't do anything, it's that it does the wrong thing. What happens is a *new* notice is created with the update values you set. You end up with a duplicate notice with the updated module value.

This problem happens because of the way submissions are handled. First the code checks to see if you're updating a notice or editing it:

if (letter_exists($module, $code)) {...

The letter isn't going to exist, because the value for $module is the *new* value you're trying to update it to. There for the code proceeds to performing an insert instead of an update.
Comment 2 Owen Leonard 2011-08-22 15:13:48 UTC Comment hidden (obsolete)
Comment 3 Nicole C. Engard 2011-08-25 00:12:24 UTC
Created attachment 5135 [details] [review]
[SIGNED-OFF] Fix for Bug 4419 - cannot change module for notice templates

Adding a hidden form field to contain the original module
so that it can be used in the check for an existing entry.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Comment 4 Ian Walls 2011-08-26 15:48:59 UTC
Simple change, easy to read.  Some changes to spacing that are purely aesthetic and do not cause any breakage.  Marking as Passed QA.
Comment 5 Chris Cormack 2011-08-27 11:06:56 UTC
Pushed, please test
Comment 6 Chris Nighswonger 2011-10-26 18:02:10 UTC
The fix for this bug was published in the 3.4.5 release. If you were the reporter of this bug, please take time to verify the fix and update the status of this bug report accordingly. If the bug is fixed to your satisfaction, please close this report.