Bug 42001 - Update duplicate purchase order number detection on EDI quote import to optionally send notifications to staff and vendors
Summary: Update duplicate purchase order number detection on EDI quote import to optio...
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on: 20253 41297
Blocks: 38195
  Show dependency treegraph
 
Reported: 2026-03-05 14:49 UTC by Martin Renvoize (ashimema)
Modified: 2026-03-05 15:49 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: Sponsored
Comma delimited list of Sponsors: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/>, Westminster City Council <https://www.westminster.gov.uk/>
Crowdfunding goal: 0
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 42001: Database updates (10.72 KB, patch)
2026-03-05 15:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 42001: Database updates (10.72 KB, patch)
2026-03-05 15:49 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 42001: Email notifications for duplicate EDI purchase orders (9.18 KB, patch)
2026-03-05 15:49 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 42001: Unit tests for duplicate order email notifications (9.34 KB, patch)
2026-03-05 15:49 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 42001: (follow-up) Send new EDI duplicate order preferences to HEA (1.12 KB, patch)
2026-03-05 15:49 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2026-03-05 14:49:00 UTC
EDIFACT quote processing will detect duplicate purchase order numbers and block basket creation from those orders when using the po_is_basketname setting for EDIfact processing.

We should add the ability to notify the supplier, and alert library staff.
Comment 1 Martin Renvoize (ashimema) 2026-03-05 15:08:20 UTC
Created attachment 194517 [details] [review]
Bug 42001: Database updates

Adds system preferences and notice templates for duplicate EDI
purchase order email notifications.

New preferences:
- EdiDuplicateOrderEmailNotice (YesNo)
- EdiDuplicateOrderEmailAddresses (Textarea)

New notice templates:
- EDI_DUP_ORD_LIBRARY - library staff notification
- EDI_DUP_ORD_VENDOR  - vendor contact notification

Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/>
Sponsored-by: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/>
Comment 2 Martin Renvoize (ashimema) 2026-03-05 15:49:07 UTC
Created attachment 194523 [details] [review]
Bug 42001: Database updates

Adds system preferences and notice templates for duplicate EDI
purchase order email notifications.

New preferences:
- EdiDuplicateOrderEmailNotice (YesNo)
- EdiDuplicateOrderEmailAddresses (Textarea)

New notice templates:
- EDI_DUP_ORD_LIBRARY - library staff notification
- EDI_DUP_ORD_VENDOR  - vendor contact notification

Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/>
Sponsored-by: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/>
Comment 3 Martin Renvoize (ashimema) 2026-03-05 15:49:08 UTC
Created attachment 194524 [details] [review]
Bug 42001: Email notifications for duplicate EDI purchase orders

When create_edi_order detects a duplicate purchase order number (basket
name conflict with po_is_basketname enabled), send email notifications
to library staff and vendor EDI contacts, mirroring the behaviour
already in place for duplicate EDIFACT invoices (bug 41297).

New preference EdiDuplicateOrderEmailNotice enables/disables the
feature. EdiDuplicateOrderEmailAddresses specifies library recipients.
Vendor contacts flagged with edi_error_notification also receive
notification via EDI_DUP_ORD_VENDOR.

Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/>
Sponsored-by: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/>
Comment 4 Martin Renvoize (ashimema) 2026-03-05 15:49:10 UTC
Created attachment 194525 [details] [review]
Bug 42001: Unit tests for duplicate order email notifications

Adds a new top-level subtest 'duplicate_order_email_notifications' with
three cases:

1. email_notification_disabled - verifies no mail is queued when
   EdiDuplicateOrderEmailNotice is off, while the duplicate PO block
   still fires correctly.

2. library_email_notification - verifies EDI_DUP_ORD_LIBRARY is
   enqueued to the configured library addresses, with subject and
   content checks.

3. vendor_email_notification - verifies EDI_DUP_ORD_VENDOR is
   enqueued for vendor contacts with edi_error_notification set.

Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/>
Sponsored-by: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/>
Comment 5 Martin Renvoize (ashimema) 2026-03-05 15:49:11 UTC
Created attachment 194526 [details] [review]
Bug 42001: (follow-up) Send new EDI duplicate order preferences to HEA

Add EdiBlockDuplicateInvoice, EdiBlockDuplicateInvoiceEmailAddresses,
EdiBlockDuplicateInvoiceEmailNotice, EdiDuplicateOrderEmailAddresses,
and EdiDuplicateOrderEmailNotice to the list of system preferences
reported to the Koha usage statistics service (HEA).