Bug 10483 - check_uniqueness.pl does not work
Summary: check_uniqueness.pl does not work
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Target Milestone: ---
Assignee: Fridolin SOMERS
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-17 14:54 UTC by Fridolin SOMERS
Modified: 2014-12-07 20:02 UTC (History)
6 users (show)

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


Attachments
Proposed patch (1.79 KB, patch)
2013-06-17 15:11 UTC, Fridolin SOMERS
Details | Diff | Splinter Review
Bug 10483 - check_uniqueness.pl does not work (1.84 KB, patch)
2013-06-21 13:07 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 10483 - check_uniqueness.pl does not work (1.90 KB, patch)
2013-06-29 07:00 UTC, Chris Cormack
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin SOMERS 2013-06-17 14:54:22 UTC
When syspref "UniqueItemFields" is defined, the item uniqueness is tested in acquisition by an Ajax call to check_uniqueness.pl.
I noticed that it does not work, item is always created without alert even on existing barcode.

I have looked in perl debug mode and found that in check_uniqueness.pl :
    my $input = new CGI;
    my @field = $input->param('field');
    my @value = $input->param('value');
@field and @value are always empty.
It is because in CGI the params are named "field[]" and "value[]".
It seems to be because of the ajax serialization of a Javascript Array.
Comment 1 Fridolin SOMERS 2013-06-17 15:11:57 UTC Comment hidden (obsolete)
Comment 2 Katrin Fischer 2013-06-18 06:18:21 UTC
I think we have a lot of bug reports in that area that might be linked to this bug. A search for "uniqueitemfields" brings up quite a few, I think especially 8694 could maybe be fixed by this (hopefully). At least worth checking when testing this :)
Comment 3 Kyle M Hall 2013-06-21 13:07:39 UTC Comment hidden (obsolete)
Comment 4 Chris Cormack 2013-06-29 07:00:51 UTC
Created attachment 19282 [details] [review]
Bug 10483 - check_uniqueness.pl does not work

When syspref "UniqueItemFields" is defined, the item uniqueness is tested in acquisition by an Ajax call to check_uniqueness.pl.
I noticed that it does not work, item is always created without alert even on existing barcode.

I have looked in perl debug mode and found that in check_uniqueness.pl :
    my $input = new CGI;
    my @field = $input->param('field');
    my @value = $input->param('value');
@field and @value are always empty.
It is because in CGI the params are named "field[]" and "value[]".
It seems to be because of the ajax serialization of a Javascript Array.
This patch corrects this bug.

Test plan :
- Select an existing item with barcode
- Add "barcode" to "UniqueItemFields" syspref (use space as separator for multiple values)
- Set "AcqCreateItem" syspref to "Create an item when placing an order"
- Go to an acquisition basket
- Create a new order from empty
- Enter existing barcode in item form and save
=> You get an alert that barcode already exists and order is not saved
- Enter a non-existing barcode in item form and save
=> Order and item are created

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Comment 5 Galen Charlton 2013-08-14 21:19:46 UTC
Pushed to master.  Thanks, Fridolyn!
Comment 6 Tomás Cohen Arazi 2013-09-10 19:27:21 UTC
This patch has been pushed to 3.12.x, will be in 3.12.5.

Thanks Fridolyn!
Comment 7 Bernardo Gonzalez Kriegel 2013-09-14 19:14:42 UTC
Pushed to 3.10.x, will be in 3.10.11
Comment 8 Chris Hall 2013-10-20 07:13:14 UTC
Pushed to 3.8.x, will be in 3.8.19