https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40910

--- Comment #2 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 187107
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187107&action=edit
Bug 40910: Reduce log pollution for undefined/empty barcodes

This patch prevents warnings and DBIx::Class errors when
C4::SIP::ILS::Item->new()
receives undefined, empty, or whitespace-only item_id values that could occur
from faulty plugins or malformed SIP requests.

Changes:
- Add early validation for undefined/empty item_id before barcodedecode()
- Add validation for barcodedecode() result before Koha::Items->find()
- Add debug logging when barcodedecode empties a barcode (indicates
misconfiguration)
- Prevent "Odd number of elements in anonymous hash" warnings
- Prevent DBIx::Class constraint validation errors
- No functional changes - behavior preserved for valid barcodes

Test plan:
1. Apply the regression tests
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/SIP/Item.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Tests cover:
   - Valid barcode functionality (preserved)
   - Undefined item_id (no warnings)
   - Empty string item_id (no warnings)
   - Whitespace-only item_id (no warnings)
   - barcodedecode edge cases (tabs, newlines, mixed)
   - Nonexistent barcodes (expected warnings preserved)
6. Verify no warnings in SIP logs for malformed requests
7. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to