|
Line 0
Link Here
|
|
|
1 |
use Modern::Perl; |
| 2 |
|
| 3 |
return { |
| 4 |
bug_number => "42001", |
| 5 |
description => "Add email notifications for duplicate EDI purchase orders", |
| 6 |
up => sub { |
| 7 |
my ($args) = @_; |
| 8 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
| 9 |
|
| 10 |
# Email notification toggle |
| 11 |
$dbh->do( |
| 12 |
q{ |
| 13 |
INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) |
| 14 |
VALUES ( |
| 15 |
'EdiDuplicateOrderEmailNotice', |
| 16 |
'0', |
| 17 |
NULL, |
| 18 |
'Send email notification when a duplicate EDIFACT purchase order number is detected for the same supplier.', |
| 19 |
'YesNo' |
| 20 |
) |
| 21 |
} |
| 22 |
); |
| 23 |
say $out "Added system preference 'EdiDuplicateOrderEmailNotice'"; |
| 24 |
|
| 25 |
# Email recipient list |
| 26 |
$dbh->do( |
| 27 |
q{ |
| 28 |
INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) |
| 29 |
VALUES ( |
| 30 |
'EdiDuplicateOrderEmailAddresses', |
| 31 |
'', |
| 32 |
NULL, |
| 33 |
'Comma-separated list of email addresses to notify when duplicate EDIFACT purchase order numbers are detected (e.g., "purchasing@library.org,edi_support@library.org"). Requires EdiDuplicateOrderEmailNotice to be enabled.', |
| 34 |
'Textarea' |
| 35 |
) |
| 36 |
} |
| 37 |
); |
| 38 |
say $out "Added system preference 'EdiDuplicateOrderEmailAddresses'"; |
| 39 |
|
| 40 |
# Add notice template - library staff notification |
| 41 |
$dbh->do( |
| 42 |
q{ |
| 43 |
INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type, lang) |
| 44 |
VALUES ( |
| 45 |
'acquisition', |
| 46 |
'EDI_DUP_ORD_LIBRARY', |
| 47 |
'', |
| 48 |
'EDIFACT duplicate order detected - library notification', |
| 49 |
0, |
| 50 |
'EDIFACT Duplicate Purchase Order Blocked - [% po_number | html %]', |
| 51 |
'Duplicate EDIFACT Purchase Order Detected and Blocked |
| 52 |
|
| 53 |
Purchase Order Number: [% po_number | html %] |
| 54 |
Vendor: [% aqbooksellers.name | html %] (ID: [% vendor_id | html %]) |
| 55 |
Basket No: [% basketno | html %] |
| 56 |
Existing Basket No: [% existing_basketno | html %] |
| 57 |
|
| 58 |
Status: The EDI order was NOT sent. The basket remains open. |
| 59 |
|
| 60 |
This purchase order number already exists for this vendor (basket [% existing_basketno | html %]). |
| 61 |
A basket name/PO number must be unique per vendor when the vendor EDI account has "Use basket name as PO number" enabled. |
| 62 |
|
| 63 |
Action Required: |
| 64 |
Rename the basket to use a unique purchase order number, then resend the EDI order. |
| 65 |
|
| 66 |
View Basket: [% OPACBaseURL | uri %]/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | uri %] |
| 67 |
View Existing Basket: [% OPACBaseURL | uri %]/cgi-bin/koha/acqui/basket.pl?basketno=[% existing_basketno | uri %] |
| 68 |
|
| 69 |
This is an automated notification from your Koha system.', |
| 70 |
'email', |
| 71 |
'default' |
| 72 |
) |
| 73 |
} |
| 74 |
); |
| 75 |
say $out "Added letter template 'EDI_DUP_ORD_LIBRARY'"; |
| 76 |
|
| 77 |
# Add notice template - vendor notification |
| 78 |
$dbh->do( |
| 79 |
q{ |
| 80 |
INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type, lang) |
| 81 |
VALUES ( |
| 82 |
'acquisition', |
| 83 |
'EDI_DUP_ORD_VENDOR', |
| 84 |
'', |
| 85 |
'EDIFACT duplicate order detected - vendor notification', |
| 86 |
0, |
| 87 |
'Duplicate Purchase Order Number Received - [% po_number | html %]', |
| 88 |
'Dear Supplier, |
| 89 |
|
| 90 |
We have attempted to send an EDIFACT order to your system but the purchase order number is a duplicate. |
| 91 |
|
| 92 |
Purchase Order Number: [% po_number | html %] |
| 93 |
Your Reference (SAN): [% vendor_san | html %] |
| 94 |
|
| 95 |
Issue: |
| 96 |
This purchase order number has already been used in a previous order with your organisation. We were unable to send the order. |
| 97 |
|
| 98 |
No action is required from you at this stage. Our acquisitions team has been notified and will resubmit the order with a corrected purchase order number. |
| 99 |
|
| 100 |
If you have any questions, please contact our acquisitions department. |
| 101 |
|
| 102 |
Library: [% aqbooksellers.name | html %] |
| 103 |
|
| 104 |
This is an automated notification. Please do not reply to this email.', |
| 105 |
'email', |
| 106 |
'default' |
| 107 |
) |
| 108 |
} |
| 109 |
); |
| 110 |
say $out "Added letter template 'EDI_DUP_ORD_VENDOR'"; |
| 111 |
}, |
| 112 |
}; |