Koha-clms/Koha/Edifact
Martin Renvoize 4179211ce8
Bug 20253: Optionally use buyer's purchase order number from EDIFACT quote as basket name
This enhancement allows libraries to configure vendors to use the buyer's
purchase order number (from RFF+ON segments) as the basket name instead of
the EDIFACT filename, improving searchability and reference tracking.

Backend Changes:
- Added purchase_order_number() method to Koha::Edifact::Message to extract
  RFF+ON segments from message-level data (before first LIN segment)
- Modified process_quote() in Koha::EDI to use purchase order number for
  basket naming when configured, with fallback to filename

Frontend Changes:
- Updated admin/edi_accounts.pl to handle po_is_basketname parameter
- Added "Use purhase order numbers" option to EDI accounts template

Test Plan:
1. Apply patches and run database update
2. Go to Administration > Acquisitions > EDI accounts
3. Create or edit a vendor EDI account
4. Verify "Use purchase order numbers" option appears
5. Enable "Use purchase order numbers" and save
6. Process an EDIFACT quote file that contains RFF+ON segments
7. Verify the created basket name uses the purchase order number instead of filename
8. Process a quote file without RFF+ON segments
9. Verify the basket name falls back to the filename
10. Test with "Use purchase order numbers" disabled
11. Verify basket names use filenames regardless of RFF+ON presence
12. Run tests: prove t/Edifact.t t/db_dependent/Koha/EDI.t

The feature is optional and backward compatible - existing behavior is
unchanged unless explicitly configured.

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/>
Sponsored-by: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/>
Sponsored-by: OpenFifth <https://openfifth.co.uk/>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-11-03 14:13:37 -07:00
..
File Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
File.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Files.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Line.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Message.pm Bug 20253: Optionally use buyer's purchase order number from EDIFACT quote as basket name 2025-11-03 14:13:37 -07:00
Order.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Segment.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Transport.pm Bug 38489: Update Koha::Edifact::Transport to use new file transport system 2025-10-14 14:51:48 -06:00