|
Description
Martin Renvoize (ashimema)
2025-08-04 12:17:37 UTC
Created attachment 185099 [details] [review] Bug 40587: Add tests for multiple message EAN handling in EDI quotes This patch adds unit tests to verify that when processing EDI QUOTE transports containing multiple messages with different buyer EANs, each basket gets the correct EAN for its corresponding message. Test plan: 1. Run: prove t/db_dependent/Koha/EDI.t 2. Verify the new 'multiple_message_ean_handling' subtest passes 3. Verify that all existing EDI tests continue to pass Created attachment 185100 [details] [review] Bug 40587: Auto-select EAN from QUOTE message when creating EDIFACT orders When a basket is generated via an EDI QUOTE message, the QUOTE message includes a library's EAN code (buyer_ean). This patch makes the 'Create EDIFACT order' button automatically use the EAN from the original QUOTE message instead of requiring manual EAN selection. This patch also fixes a bug in process_quote where all baskets in multi-message QUOTE transports incorrectly used the first message's buyer_ean, even when subsequent messages had different EANs. Changes made: 1. Fixed Koha/EDI.pm process_quote auto-order creation to use the correct buyer_ean for each message/basket pair in multi-message transports 2. Enhanced acqui/basket.pl to extract and provide the quote_ean from QUOTE messages, handling both single and multi-message scenarios 3. Updated basket.tt template to automatically select the EAN from the original QUOTE message when available and matching Test plan: 1. Create a vendor with EDI account and multiple EANs configured 2. Process a QUOTE message that creates a basket 3. Go to the basket page and click "Create EDIFACT order" 4. Verify it automatically uses the EAN from the QUOTE message (shows tooltip "Using EAN from original QUOTE message") 5. Test with multi-message QUOTE files to ensure each basket uses the correct EAN from its corresponding message 6. Verify fallback behavior when no QUOTE EAN matches available EANs Created attachment 187176 [details] [review] Bug 40587: Add tests for multiple message EAN handling in EDI quotes This patch adds unit tests to verify that when processing EDI QUOTE transports containing multiple messages with different buyer EANs, each basket gets the correct EAN for its corresponding message. Test plan: 1. Run: prove t/db_dependent/Koha/EDI.t 2. Verify the new 'multiple_message_ean_handling' subtest passes 3. Verify that all existing EDI tests continue to pass Sponsored-by: OpenFifth <https://openfifth.co.uk/> Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk> Created attachment 187177 [details] [review] Bug 40587: Auto-select EAN from QUOTE message when creating EDIFACT orders When a basket is generated via an EDI QUOTE message, the QUOTE message includes a library's EAN code (buyer_ean). This patch makes the 'Create EDIFACT order' button automatically use the EAN from the original QUOTE message instead of requiring manual EAN selection. This patch also fixes a bug in process_quote where all baskets in multi-message QUOTE transports incorrectly used the first message's buyer_ean, even when subsequent messages had different EANs. Changes made: 1. Fixed Koha/EDI.pm process_quote auto-order creation to use the correct buyer_ean for each message/basket pair in multi-message transports 2. Enhanced acqui/basket.pl to extract and provide the quote_ean from QUOTE messages, handling both single and multi-message scenarios 3. Updated basket.tt template to automatically select the EAN from the original QUOTE message when available and matching Test plan: 1. Create a vendor with EDI account and multiple EANs configured 2. Process a QUOTE message that creates a basket 3. Go to the basket page and click "Create EDIFACT order" 4. Verify it automatically uses the EAN from the QUOTE message (shows tooltip "Using EAN from original QUOTE message") 5. Test with multi-message QUOTE files to ensure each basket uses the correct EAN from its corresponding message 6. Verify fallback behavior when no QUOTE EAN matches available EANs Sponsored-by: OpenFifth <https://openfifth.co.uk/> Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk> Created attachment 187663 [details] [review] Bug 40587: Add tests for multiple message EAN handling in EDI quotes This patch adds unit tests to verify that when processing EDI QUOTE transports containing multiple messages with different buyer EANs, each basket gets the correct EAN for its corresponding message. Test plan: 1. Run: prove t/db_dependent/Koha/EDI.t 2. Verify the new 'multiple_message_ean_handling' subtest passes 3. Verify that all existing EDI tests continue to pass Sponsored-by: OpenFifth <https://openfifth.co.uk/> Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 187664 [details] [review] Bug 40587: Auto-select EAN from QUOTE message when creating EDIFACT orders When a basket is generated via an EDI QUOTE message, the QUOTE message includes a library's EAN code (buyer_ean). This patch makes the 'Create EDIFACT order' button automatically use the EAN from the original QUOTE message instead of requiring manual EAN selection. This patch also fixes a bug in process_quote where all baskets in multi-message QUOTE transports incorrectly used the first message's buyer_ean, even when subsequent messages had different EANs. Changes made: 1. Fixed Koha/EDI.pm process_quote auto-order creation to use the correct buyer_ean for each message/basket pair in multi-message transports 2. Enhanced acqui/basket.pl to extract and provide the quote_ean from QUOTE messages, handling both single and multi-message scenarios 3. Updated basket.tt template to automatically select the EAN from the original QUOTE message when available and matching Test plan: 1. Create a vendor with EDI account and multiple EANs configured 2. Process a QUOTE message that creates a basket 3. Go to the basket page and click "Create EDIFACT order" 4. Verify it automatically uses the EAN from the QUOTE message (shows tooltip "Using EAN from original QUOTE message") 5. Test with multi-message QUOTE files to ensure each basket uses the correct EAN from its corresponding message 6. Verify fallback behavior when no QUOTE EAN matches available EANs Sponsored-by: OpenFifth <https://openfifth.co.uk/> Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Would be nice if that large block of logic in basket.pl were moved to a class, but at this time Koha doesn't have Koha::Object based classes for edi messages. Nice work everyone! Pushed to main for 25.11 Nice work everyone! Pushed to 25.05.x Looks like this depends on Bug 38689 not in 24.11.x |