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

--- Comment #71 from Kyle M Hall (khall) <[email protected]> ---
Created attachment 188429
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=188429&action=edit
Bug 20253: (follow-up) Block auto_orders and UI ordering for duplicate PO
numbers

When po_is_basketname is enabled for a vendor, duplicate purchase order
numbers should prevent both automatic ordering (auto_orders) and manual
UI-triggered ordering to avoid conflicts with existing baskets.

This patch implements blocking functionality that:

1. Auto-orders blocking:
   - Tracks baskets with PO number conflicts during quote processing
   - Skips auto-ordering for baskets with duplicate PO numbers
   - Logs clear warnings about blocked baskets

2. UI basket ordering blocking:
   - Adds duplicate checking in create_edi_order function
   - Returns detailed error information when conflicts detected
   - Prevents EDI order creation for conflicting baskets

3. User-friendly error handling:
   - Updates basket.pl to handle duplicate PO number errors
   - Stays on basket page to display error messages
   - Provides clear messaging about conflicts and resolution steps

4. Template messaging:
   - Adds clear error message explaining duplicate PO conflicts
   - Shows which existing basket uses the same PO number
   - Guides users on next steps to resolve the issue

This ensures data integrity and prevents order processing conflicts
while providing clear feedback to users about duplicate PO number
issues.

Test plan:
1. Set up a vendor with EDI account and enable "po_is_basketname"
2. Create a basket with a specific name (e.g., "PO12345")
3. Process an EDIFACT quote that contains the same PO number:
   - If auto_orders is enabled: verify the new basket is created but NOT
automatically ordered
   - Check the logs show "Auto-order blocked" message
4. For UI testing, create another basket manually with the same name
5. Try to generate EDI order via "Generate EDI order" button
6. Verify: Error message appears stating duplicate PO number conflict
7. Verify: Basket remains open (not closed)
8. Verify: Error message shows which existing basket uses the PO number
9. Test with po_is_basketname disabled: verify normal operation continues
10. Test with unique PO numbers: verify orders process normally

Signed-off-by: Hannah Dunne-Howrie <[email protected]>
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 <[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