This is a follow-up to bug 39572 and bug 21417. When an EDI basket is generated from then EDI QUOTE message, I believe the correct EAN is included in the original QUOTE. As such, we should be able to bind the 'Create EDI Order' button to only allow use of that EAN when automatic ordering is disabled.
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