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

(-)a/Koha/EDI.pm (-7 / +20 lines)
Lines 649-659 sub process_quote { Link Here
649
    my $split_message;
649
    my $split_message;
650
    my @added_baskets;    # if auto & multiple baskets need to order all
650
    my @added_baskets;    # if auto & multiple baskets need to order all
651
651
652
    # Get vendor EDI account configuration
653
    my $v = $schema->resultset('VendorEdiAccount')->search(
654
        {
655
            vendor_id => $quote_message->vendor_id,
656
        }
657
    )->single;
658
652
    if ( @{$messages} && $quote_message->vendor_id ) {
659
    if ( @{$messages} && $quote_message->vendor_id ) {
660
653
        foreach my $msg ( @{$messages} ) {
661
        foreach my $msg ( @{$messages} ) {
654
            ++$message_count;
662
            ++$message_count;
663
664
            # Determine basket name based on vendor configuration
665
            my $basket_name = $quote_message->filename;
666
            if ( $v && $v->po_is_basketname ) {
667
                my $purchase_order_number = $msg->purchase_order_number;
668
                if ($purchase_order_number) {
669
                    $basket_name = $purchase_order_number;
670
                }
671
            }
672
655
            my $basketno = NewBasket(
673
            my $basketno = NewBasket(
656
                $quote_message->vendor_id, 0, $quote_message->filename, q{},
674
                $quote_message->vendor_id, 0, $basket_name, q{},
657
                q{} . q{}
675
                q{} . q{}
658
            );
676
            );
659
            push @added_baskets, $basketno;
677
            push @added_baskets, $basketno;
Lines 695-706 sub process_quote { Link Here
695
    $quote_message->status($status);
713
    $quote_message->status($status);
696
    $quote_message->update;    # status and basketno link
714
    $quote_message->update;    # status and basketno link
697
                               # Do we automatically generate orders for this vendor
715
                               # Do we automatically generate orders for this vendor
698
    my $v = $schema->resultset('VendorEdiAccount')->search(
716
    if ( $v && $v->auto_orders ) {
699
        {
700
            vendor_id => $quote_message->vendor_id,
701
        }
702
    )->single;
703
    if ( $v->auto_orders ) {
704
        for my $b (@added_baskets) {
717
        for my $b (@added_baskets) {
705
            create_edi_order(
718
            create_edi_order(
706
                {
719
                {
(-)a/Koha/Edifact/Message.pm (+20 lines)
Lines 183-188 sub supplier_ean { Link Here
183
183
184
}
184
}
185
185
186
sub purchase_order_number {
187
    my $self = shift;
188
    foreach my $s ( @{ $self->{datasegs} } ) {
189
        if ( $s->tag eq 'LIN' ) {
190
            last;
191
        }
192
        if ( $s->tag eq 'RFF' ) {
193
            my $qualifier = $s->elem( 0, 0 );
194
            if ( $qualifier eq 'ON' ) {
195
                return $s->elem( 0, 1 );
196
            }
197
        }
198
    }
199
    return;
200
}
201
186
sub lineitems {
202
sub lineitems {
187
    my $self = shift;
203
    my $self = shift;
188
    if ( $self->{quotation_lines} ) {
204
    if ( $self->{quotation_lines} ) {
Lines 280-285 Missing POD for buyer_ean. Link Here
280
296
281
Missing POD for supplier_ean.
297
Missing POD for supplier_ean.
282
298
299
=head2 purchase_order_number
300
301
Missing POD for purchase_order_number.
302
283
=head2 lineitems
303
=head2 lineitems
284
304
285
Missing POD for lineitems.
305
Missing POD for lineitems.
(-)a/admin/edi_accounts.pl (+1 lines)
Lines 93-98 if ( $op eq 'acct_form' ) { Link Here
93
            auto_orders       => $input->param('auto_orders')       ? 1 : 0,
93
            auto_orders       => $input->param('auto_orders')       ? 1 : 0,
94
            id_code_qualifier => scalar $input->param('id_code_qualifier'),
94
            id_code_qualifier => scalar $input->param('id_code_qualifier'),
95
            plugin            => scalar $input->param('plugin'),
95
            plugin            => scalar $input->param('plugin'),
96
            po_is_basketname  => $input->param('po_is_basketname') ? 1 : 0,
96
        };
97
        };
97
98
98
        if ($id) {
99
        if ($id) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_accounts.tt (-21 / +54 lines)
Lines 96-104 Link Here
96
                    <span>New account</span>
96
                    <span>New account</span>
97
                [% END %]
97
                [% END %]
98
            </h1>
98
            </h1>
99
            <fieldset class="rows">
100
                <legend class="sr-only">Account details</legend>
101
99
100
            <!-- Basic Information -->
101
            <fieldset class="rows">
102
                <legend>Basic Information</legend>
102
                <ol>
103
                <ol>
103
                    <li>
104
                    <li>
104
                        <label for="vendor_id">Vendor: </label>
105
                        <label for="vendor_id">Vendor: </label>
Lines 112-117 Link Here
112
                            [% END %]
113
                            [% END %]
113
                        </select>
114
                        </select>
114
                    </li>
115
                    </li>
116
                    <li>
117
                        <label for="description">Description: </label>
118
                        <input type="text" name="description" id="description" size="20" value="[% account.description | html %]" />
119
                    </li>
115
                    [% IF plugins %]
120
                    [% IF plugins %]
116
                        <li>
121
                        <li>
117
                            <label for="plugin">Plugin: </label>
122
                            <label for="plugin">Plugin: </label>
Lines 129-152 Link Here
129
                    [% ELSE %]
134
                    [% ELSE %]
130
                        <input type="hidden" name="plugin" value="" />
135
                        <input type="hidden" name="plugin" value="" />
131
                    [% END %]
136
                    [% END %]
132
                    <li>
133
                        <label for="description">Description: </label>
134
                        <input type="text" name="description" id="description" size="20" value="[% account.description | html %]" />
135
                    </li>
136
                    <li>
137
                        <label for="file_transport_id">File transport: </label>
138
                        <select name="file_transport_id" id="file_transport_id">
139
                            <option value="">Select a file transport configuration</option>
140
                            [% FOREACH transport IN file_transports %]
141
                                [% IF transport.file_transport_id == account.file_transport_id %]
142
                                    <option value="[% transport.file_transport_id | html %]" selected="selected">[% transport.name | html %] ([% transport.transport | upper | html %] - [% transport.host | html %])</option>
143
                                [% ELSE %]
144
                                    <option value="[% transport.file_transport_id | html %]">[% transport.name | html %] ([% transport.transport | upper | html %] - [% transport.host | html %])</option>
145
                                [% END %]
146
                            [% END %]
147
                        </select>
148
                        <div class="hint"> Select a file transport configuration for this EDI account. File transports can be managed in <a href="/cgi-bin/koha/admin/file_transports.pl">Administration &rsaquo; File transports</a>. </div>
149
                    </li>
150
                    <li>
137
                    <li>
151
                        <label for="id_code_qualifier">Qualifier:</label>
138
                        <label for="id_code_qualifier">Qualifier:</label>
152
                        <select name="id_code_qualifier" id="id_code_qualifier">
139
                        <select name="id_code_qualifier" id="id_code_qualifier">
Lines 180-185 Link Here
180
                            [% END %]
167
                            [% END %]
181
                        </select>
168
                        </select>
182
                    </li>
169
                    </li>
170
                </ol>
171
            </fieldset>
172
173
            <!-- Transport Settings -->
174
            <fieldset class="rows">
175
                <legend>Transport Settings</legend>
176
                <ol>
177
                    <li>
178
                        <label for="file_transport_id">File transport: </label>
179
                        <select name="file_transport_id" id="file_transport_id">
180
                            <option value="">Select a file transport configuration</option>
181
                            [% FOREACH transport IN file_transports %]
182
                                [% IF transport.file_transport_id == account.file_transport_id %]
183
                                    <option value="[% transport.file_transport_id | html %]" selected="selected">[% transport.name | html %] ([% transport.transport | upper | html %] - [% transport.host | html %])</option>
184
                                [% ELSE %]
185
                                    <option value="[% transport.file_transport_id | html %]">[% transport.name | html %] ([% transport.transport | upper | html %] - [% transport.host | html %])</option>
186
                                [% END %]
187
                            [% END %]
188
                        </select>
189
                        <div class="hint"> Select a file transport configuration for this EDI account. File transports can be managed in <a href="/cgi-bin/koha/admin/file_transports.pl">Administration &rsaquo; File transports</a>. </div>
190
                    </li>
191
                </ol>
192
            </fieldset>
193
194
            <!-- Message Types -->
195
            <fieldset class="rows">
196
                <legend>Message Types</legend>
197
                <ol>
183
                    <li>
198
                    <li>
184
                        <label for="quotes_enabled">Quotes enabled: </label>
199
                        <label for="quotes_enabled">Quotes enabled: </label>
185
                        [% IF account.quotes_enabled %]
200
                        [% IF account.quotes_enabled %]
Lines 212-217 Link Here
212
                            <input type="checkbox" name="responses_enabled" id="responses_enabled" value="1" />
227
                            <input type="checkbox" name="responses_enabled" id="responses_enabled" value="1" />
213
                        [% END %]
228
                        [% END %]
214
                    </li>
229
                    </li>
230
                </ol>
231
            </fieldset>
232
233
            <!-- Functional Switches -->
234
            <fieldset class="rows">
235
                <legend>Functional Switches</legend>
236
                <ol>
215
                    <li>
237
                    <li>
216
                        <label for="auto_orders">Automatic ordering: </label>
238
                        <label for="auto_orders">Automatic ordering: </label>
217
                        [% IF account.auto_orders %]
239
                        [% IF account.auto_orders %]
Lines 221-226 Link Here
221
                        [% END %]
243
                        [% END %]
222
                        <div class="hint"> With automatic ordering quotes generate orders without staff intervention. </div>
244
                        <div class="hint"> With automatic ordering quotes generate orders without staff intervention. </div>
223
                    </li>
245
                    </li>
246
                    <li>
247
                        <label for="po_is_basketname">Use purchase order numbers: </label>
248
                        [% IF account.po_is_basketname %]
249
                            <input type="checkbox" name="po_is_basketname" id="po_is_basketname" value="1" checked="checked" />
250
                        [% ELSE %]
251
                            <input type="checkbox" name="po_is_basketname" id="po_is_basketname" value="1" />
252
                        [% END %]
253
                        <div class="hint">
254
                            When enabled, basket names are used as purchase order numbers. <br />For received QUOTE messages, we will use the RFF+ON field to populate the basket name. <br />For generated ORDER messages, we will use the
255
                            basket name to populate the BGM segment.</div
256
                        >
257
                    </li>
224
                </ol>
258
                </ol>
225
            </fieldset>
259
            </fieldset>
226
260
227
- 

Return to bug 20253