EDIFACT invoice processing should detect and block duplicate invoice numbers, notify the supplier (possibly via an EDI CONTRL message), and alert library staff. While Koha has the AcqWarnOnDuplicateInvoice system preference for manual invoice creation (implemented in Bug 10366), this check is not applied to invoices created automatically via EDIFACT/EDI processing in Koha/EDI.pm.
Created attachment 189962 [details] [review] Bug 41297: Block duplicate EDIFACT invoice processing This patch adds duplicate invoice detection and blocking for EDIFACT invoice processing, with email notifications to library staff and vendors. Key features: 1. System preferences to enable/disable duplicate blocking and email notifications 2. Database index on aqinvoices (invoicenumber, booksellerid) for performance 3. Email notifications using the message_queue (GetPreparedLetter → EnqueueLetter pattern) 4. Vendor contact-based notifications via a new aqcontacts.edi_error_notification flag 5. Two notice templates (EDI_DUP_INV_LIBRARY and EDI_DUP_INV_VENDOR) Changes: - Add EdiBlockDuplicateInvoice system preference - Add EdiBlockDuplicateInvoiceEmailNotice system preference - Add EdiBlockDuplicateInvoiceEmailAddresses system preference - Add edi_error_notification column to aqcontacts table - Add duplicate invoice detection logic to Koha::EDI::process_invoice - Add email notification support using standard Koha messaging queue - Add "Contact about EDI errors" checkbox to vendor contacts UI - Add notice templates to sample_notices.yml for fresh installations - Add test coverage in t/db_dependent/Koha/EDI.t Test plan: 1. Run database update: perl installer/data/mysql/updatedatabase.pl 2. Enable system preferences: - Set EdiBlockDuplicateInvoice to "Block" - Set EdiBlockDuplicateInvoiceEmailNotice to "Send" - Set EdiBlockDuplicateInvoiceEmailAddresses to valid email(s) 3. Edit a vendor and add a contact with "Contact about EDI errors" enabled 4. Process an EDIFACT invoice 5. Attempt to process the same invoice again - should be blocked 6. Check message_queue table for queued notifications 7. Run tests: prove t/db_dependent/Koha/EDI.t :: duplicate_invoice_blocking
Created attachment 189963 [details] [review] Bug 41297: Block duplicate EDIFACT invoice processing This patch adds duplicate invoice detection and blocking for EDIFACT invoice processing, with email notifications to library staff and vendors. Key features: 1. System preferences to enable/disable duplicate blocking and email notifications 2. Database index on aqinvoices (invoicenumber, booksellerid) for performance 3. Email notifications using the message_queue (GetPreparedLetter → EnqueueLetter pattern) 4. Vendor contact-based notifications via a new aqcontacts.edi_error_notification flag 5. Two notice templates (EDI_DUP_INV_LIBRARY and EDI_DUP_INV_VENDOR) Changes: - Add EdiBlockDuplicateInvoice system preference - Add EdiBlockDuplicateInvoiceEmailNotice system preference - Add EdiBlockDuplicateInvoiceEmailAddresses system preference - Add edi_error_notification column to aqcontacts table - Add duplicate invoice detection logic to Koha::EDI::process_invoice - Add email notification support using standard Koha messaging queue - Add "Contact about EDI errors" checkbox to vendor contacts UI - Add notice templates to sample_notices.yml for fresh installations - Add test coverage in t/db_dependent/Koha/EDI.t Test plan: 1. Run database update: perl installer/data/mysql/updatedatabase.pl 2. Enable system preferences: - Set EdiBlockDuplicateInvoice to "Block" - Set EdiBlockDuplicateInvoiceEmailNotice to "Send" - Set EdiBlockDuplicateInvoiceEmailAddresses to valid email(s) 3. Edit a vendor and add a contact with "Contact about EDI errors" enabled 4. Process an EDIFACT invoice 5. Attempt to process the same invoice again - should be blocked 6. Check message_queue table for queued notifications 7. Run tests: prove t/db_dependent/Koha/EDI.t :: duplicate_invoice_blocking
Created attachment 189964 [details] [review] Bug 41297: Block duplicate EDIFACT invoice processing This patch adds duplicate invoice detection and blocking for EDIFACT invoice processing, with email notifications to library staff and vendors. Key features: 1. System preferences to enable/disable duplicate blocking and email notifications 2. Database index on aqinvoices (invoicenumber, booksellerid) for performance 3. Email notifications using the message_queue (GetPreparedLetter → EnqueueLetter pattern) 4. Vendor contact-based notifications via a new aqcontacts.edi_error_notification flag 5. Two notice templates (EDI_DUP_INV_LIBRARY and EDI_DUP_INV_VENDOR) Changes: - Add EdiBlockDuplicateInvoice system preference - Add EdiBlockDuplicateInvoiceEmailNotice system preference - Add EdiBlockDuplicateInvoiceEmailAddresses system preference - Add edi_error_notification column to aqcontacts table - Add duplicate invoice detection logic to Koha::EDI::process_invoice - Add email notification support using standard Koha messaging queue - Add "Contact about EDI errors" checkbox to vendor contacts UI - Add notice templates to sample_notices.yml for fresh installations - Add test coverage in t/db_dependent/Koha/EDI.t Test plan: 1. Run database update: perl installer/data/mysql/updatedatabase.pl 2. Enable system preferences: - Set EdiBlockDuplicateInvoice to "Block" - Set EdiBlockDuplicateInvoiceEmailNotice to "Send" - Set EdiBlockDuplicateInvoiceEmailAddresses to valid email(s) 3. Edit a vendor and add a contact with "Contact about EDI errors" enabled 4. Process an EDIFACT invoice 5. Attempt to process the same invoice again - should be blocked 6. Check message_queue table for queued notifications 7. Run tests: prove t/db_dependent/Koha/EDI.t :: duplicate_invoice_blocking Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/> Sponsored-by: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/>