View | Details | Raw Unified | Return to bug 42001
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_42001.pl (+112 lines)
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
};
(-)a/installer/data/mysql/en/mandatory/sample_notices.yml (+56 lines)
Lines 100-105 tables: Link Here
100
            - ""
100
            - ""
101
            - "This is an automated notification. Please do not reply to this email."
101
            - "This is an automated notification. Please do not reply to this email."
102
102
103
        - module: acquisition
104
          code: EDI_DUP_ORD_LIBRARY
105
          branchcode: ""
106
          name: "EDIFACT duplicate order detected - library notification"
107
          is_html: 0
108
          title: "EDIFACT Duplicate Purchase Order Blocked - [% po_number %]"
109
          message_transport_type: email
110
          lang: default
111
          content:
112
            - "Duplicate EDIFACT Purchase Order Detected and Blocked"
113
            - ""
114
            - "Purchase Order Number: [% po_number %]"
115
            - "Vendor: [% aqbooksellers.name %] (ID: [% vendor_id %])"
116
            - "Basket No: [% basketno %]"
117
            - "Existing Basket No: [% existing_basketno %]"
118
            - ""
119
            - "Status: The EDI order was NOT sent. The basket remains open."
120
            - ""
121
            - "This purchase order number already exists for this vendor (basket [% existing_basketno %])."
122
            - "A basket name/PO number must be unique per vendor when the vendor EDI account has \"Use basket name as PO number\" enabled."
123
            - ""
124
            - "Action Required:"
125
            - "Rename the basket to use a unique purchase order number, then resend the EDI order."
126
            - ""
127
            - "View Basket: [% OPACBaseURL %]/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]"
128
            - "View Existing Basket: [% OPACBaseURL %]/cgi-bin/koha/acqui/basket.pl?basketno=[% existing_basketno %]"
129
            - ""
130
            - "This is an automated notification from your Koha system."
131
132
        - module: acquisition
133
          code: EDI_DUP_ORD_VENDOR
134
          branchcode: ""
135
          name: "EDIFACT duplicate order detected - vendor notification"
136
          is_html: 0
137
          title: "Duplicate Purchase Order Number Received - [% po_number %]"
138
          message_transport_type: email
139
          lang: default
140
          content:
141
            - "Dear Supplier,"
142
            - ""
143
            - "We have attempted to send an EDIFACT order to your system but the purchase order number is a duplicate."
144
            - ""
145
            - "Purchase Order Number: [% po_number %]"
146
            - "Your Reference (SAN): [% vendor_san %]"
147
            - ""
148
            - "Issue:"
149
            - "This purchase order number has already been used in a previous order with your organisation. We were unable to send the order."
150
            - ""
151
            - "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."
152
            - ""
153
            - "If you have any questions, please contact our acquisitions department."
154
            - ""
155
            - "Library: [% aqbooksellers.name %]"
156
            - ""
157
            - "This is an automated notification. Please do not reply to this email."
158
103
        - module: bookings
159
        - module: bookings
104
          code: BOOKING_CANCELLATION
160
          code: BOOKING_CANCELLATION
105
          branchcode: ""
161
          branchcode: ""
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +2 lines)
Lines 243-248 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
243
('EdiBlockDuplicateInvoice', '0', NULL, 'Block processing of EDIFACT invoices when a duplicate invoice number is detected for the same supplier. When enabled, duplicate invoices will be rejected and logged as errors.', 'YesNo'),
243
('EdiBlockDuplicateInvoice', '0', NULL, 'Block processing of EDIFACT invoices when a duplicate invoice number is detected for the same supplier. When enabled, duplicate invoices will be rejected and logged as errors.', 'YesNo'),
244
('EdiBlockDuplicateInvoiceEmailAddresses', '', NULL, 'Comma-separated list of email addresses to notify when duplicate EDIFACT invoices are detected (e.g., "purchasing@library.org,edi_support@library.org"). Requires EdiBlockDuplicateInvoiceEmailNotice to be enabled.', 'Textarea'),
244
('EdiBlockDuplicateInvoiceEmailAddresses', '', NULL, 'Comma-separated list of email addresses to notify when duplicate EDIFACT invoices are detected (e.g., "purchasing@library.org,edi_support@library.org"). Requires EdiBlockDuplicateInvoiceEmailNotice to be enabled.', 'Textarea'),
245
('EdiBlockDuplicateInvoiceEmailNotice', '0', NULL, 'Send email notification when duplicate EDIFACT invoices are detected. Requires EdiBlockDuplicateInvoice to be enabled.', 'YesNo'),
245
('EdiBlockDuplicateInvoiceEmailNotice', '0', NULL, 'Send email notification when duplicate EDIFACT invoices are detected. Requires EdiBlockDuplicateInvoice to be enabled.', 'YesNo'),
246
('EdiDuplicateOrderEmailAddresses', '', NULL, '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.', 'Textarea'),
247
('EdiDuplicateOrderEmailNotice', '0', NULL, 'Send email notification when a duplicate EDIFACT purchase order number is detected for the same supplier.', 'YesNo'),
246
('ElasticsearchBoostFieldMatch', '0', NULL, 'Add a "match" query to es when searching, will follow indexes chosen in advanced search, or use title-cover for generic keyword or title index search', 'YesNo'),
248
('ElasticsearchBoostFieldMatch', '0', NULL, 'Add a "match" query to es when searching, will follow indexes chosen in advanced search, or use title-cover for generic keyword or title index search', 'YesNo'),
247
('ElasticsearchCrossFields', '1', NULL, 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'),
249
('ElasticsearchCrossFields', '1', NULL, 'Enable "cross_fields" option for searches using Elastic search.', 'YesNo'),
248
('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL),
250
('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL),
249
- 

Return to bug 42001