Bug 25386 - Internal server error when duplicate/too long barcodes are used in acquisition
Summary: Internal server error when duplicate/too long barcodes are used in acquisition
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords: Academy
Depends on:
Blocks:
 
Reported: 2020-05-06 06:31 UTC by Katrin Fischer
Modified: 2022-03-24 14:00 UTC (History)
1 user (show)

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


Attachments
Bug 25386: Set maxlength=20 for items.barcode (1.22 KB, patch)
2020-05-26 10:20 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 Katrin Fischer 2020-05-06 06:31:51 UTC
When creating items on order or on receive there is a duplicate check for barcodes that usually detects if you are trying to reuse an already used barcode and prevents you from saving.

But if you have used a barcode too long before and are not running with 'strict', the barcode will have been cut off at 20 characters. Now trying to create the next item with a too long barcode, where the 20 first characters match, will not trigger the duplicate warning, but instead an internal server error. The bad part is that the order will still be created/received, but the items are not.

To test:
- Edit an item in your catalog to have a barcode with 20 characters
- Create a new basket in acq with either "create items on order" or "on receive"
- Start the ordering process, when you get to the create items step
- Enter your 20 character barcode, try to safe
- Verify the duplicate message is triggered on saving
- Add some characters to the end of your barcode
- Verify on saving there is an internal server error
- The order is created, but there are no new items
Comment 1 Jonathan Druart 2020-05-06 13:42:40 UTC
20 should be the default for subfields linked to items.barcode. Would that work?
Comment 2 Katrin Fischer 2020-05-06 13:44:22 UTC
Sorry, can you explain?
Comment 3 Jonathan Druart 2020-05-06 13:56:59 UTC
There is a "Max length" value when editing a subfield.

https://snipboard.io/qLAc3b.jpg

If you set it to 20 I guess the barcode input will not accept more than 20 characters.
Comment 4 Katrin Fischer 2020-05-24 00:18:10 UTC
Hi Jonathan, 

that seems to work - so we should make this change in our frameworks I guess? If there weren't just that many... :)
Comment 5 Jonathan Druart 2020-05-26 10:20:15 UTC
Created attachment 105352 [details] [review]
Bug 25386: Set maxlength=20 for items.barcode
Comment 6 Jonathan Druart 2020-05-26 10:21:25 UTC
I can provide that patch for the 'en' framework, but doing it for all the languages is too painful (like there are around 50 files to edit).
Comment 7 Katrin Fischer 2022-03-24 14:00:37 UTC
Maybe we can revisit this one now as most of the framewrks have been moved :)