Bug 17208 - Classification sources and filing rules shouldn't allow 'New' with same code
Summary: Classification sources and filing rules shouldn't allow 'New' with same code
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-29 02:29 UTC by Aleisha Amohia
Modified: 2016-12-27 22:11 UTC (History)
4 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 17208: Checking if classification source or filing rule already exists before adding (4.62 KB, patch)
2016-12-02 04:13 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 17208: Checking if classification source or filing rule already exists before adding (4.79 KB, patch)
2016-12-16 09:17 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 17208: Checking if classification source or filing rule already exists before adding (5.04 KB, patch)
2016-12-20 17:38 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2016-08-29 02:29:20 UTC

    
Comment 1 Aleisha Amohia 2016-08-29 02:31:47 UTC
Hit enter too early. At the moment, you can attempt to create sources and filing rules using codes that already exist, and you receive a message saying that the new source or filing rule was created, however it isn't actually added to the database (as the codes must be unique), so it doesn't work. 
There should be some kind of check upon submission of the form that checks if the code already exists (like the check of a barcode before creating a new item).
Comment 2 Aleisha Amohia 2016-12-02 04:13:43 UTC
Created attachment 57878 [details] [review]
Bug 17208: Checking if classification source or filing rule already exists before adding

To test:
1) Go to Admin -> Classification sources
2) Attempt to reproduce bug before applying patch. Notice the message
saying the add was successful, but was not added to the table
3) Apply patch and refresh page (restart plack if necessary)
4) Add new classification source with same code as existing one. Notice
you are now told that the add failed.
5) Confirm adding new classification source with unique code works
6) Add new classification filing rule with same code as existing one.
Notice you are told that add failed.
7) Confirm adding new classification filing rule with unique code works

Sponsored-by: Catalyst IT
Comment 3 Marc Véron 2016-12-16 09:17:49 UTC
Created attachment 58237 [details] [review]
Bug 17208: Checking if classification source or filing rule already exists before adding

To test:
1) Go to Admin -> Classification sources
2) Attempt to reproduce bug before applying patch. Notice the message
saying the add was successful, but was not added to the table
3) Apply patch and refresh page (restart plack if necessary)
4) Add new classification source with same code as existing one. Notice
you are now told that the add failed.
5) Confirm adding new classification source with unique code works
6) Add new classification filing rule with same code as existing one.
Notice you are told that add failed.
7) Confirm adding new classification filing rule with unique code works

Sponsored-by: Catalyst IT

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>
Comment 4 Jonathan Druart 2016-12-20 17:38:05 UTC
Created attachment 58315 [details] [review]
Bug 17208: Checking if classification source or filing rule already exists before adding

To test:
1) Go to Admin -> Classification sources
2) Attempt to reproduce bug before applying patch. Notice the message
saying the add was successful, but was not added to the table
3) Apply patch and refresh page (restart plack if necessary)
4) Add new classification source with same code as existing one. Notice
you are now told that the add failed.
5) Confirm adding new classification source with unique code works
6) Add new classification filing rule with same code as existing one.
Notice you are told that add failed.
7) Confirm adding new classification filing rule with unique code works

Sponsored-by: Catalyst IT

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
This is not the way to go, we should use an eval instead.
But since we do not have RaiseError set, it will not work.
This module will need to be moved to Koha::Objects to be implemented
correctly.
Comment 5 Kyle M Hall 2016-12-23 11:34:02 UTC
Pushed to master for 17.05, thanks Aleisha!
Comment 6 Katrin Fischer 2016-12-27 22:11:14 UTC
This won't get ported back to 16.11.x as it is an enhancement.