Bug 30130: Use new standard field in account definition

This patch uses the new 'standard' field to in the edifact account
configuration area to allow setting the message standard as either
'EDItEUR' or 'BiC'.

This just replaces the currently hard coded hash of SAN's in
Koha::Edifact::Order to distinguish between the two standards instead of
requireing a bug submission per vender san we identify to be a BiC type
vendor.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Martin Renvoize 2022-02-21 16:25:24 +00:00 committed by Fridolin Somers
parent 60c1f7682a
commit dc770ff1fe
3 changed files with 32 additions and 15 deletions

View File

@ -263,7 +263,7 @@ sub order_msg_header {
push @header,
beginning_of_message(
$self->{basket}->basketno,
$self->{recipient}->san,
$self->{recipient}->standard,
$self->{is_response}
);
@ -297,29 +297,21 @@ sub order_msg_header {
sub beginning_of_message {
my $basketno = shift;
my $supplier_san = shift;
my $standard = shift;
my $response = shift;
my $document_message_no = sprintf '%011d', $basketno;
# Peters & Bolinda use the BIC recommendation to use 22V a code not in Edifact
# If the order is in response to a quote
my %bic_sans = (
'5013546025065' => 'Peters',
'9377779308820' => 'Bolinda',
);
# my $message_function = 9; # original 7 = retransmission
# message_code values
# 220 prder
# 220 order
# 224 rush order
# 228 sample order :: order for approval / inspection copies
# 22C continuation order for volumes in a set etc.
# my $message_code = '220';
if ( exists $bic_sans{$supplier_san} && $response ) {
return "BGM+22V+$document_message_no+9$seg_terminator";
}
return "BGM+220+$document_message_no+9$seg_terminator";
# If the order is in response to a quote and we're dealing with a BIC supplier
my $code = ( $response && ( $standard eq 'BIC' ) ) ? '22V' : '220';
return "BGM+$code+$document_message_no+9$seg_terminator";
}
sub name_and_address {

View File

@ -76,6 +76,7 @@ else {
upload_directory => scalar $input->param('upload_directory'),
download_directory => scalar $input->param('download_directory'),
san => scalar $input->param('san'),
standard => scalar $input->param('standard'),
transport => scalar $input->param('transport'),
quotes_enabled => $input->param('quotes_enabled') ? 1 : 0,
invoices_enabled => $input->param('invoices_enabled') ? 1 : 0,
@ -133,7 +134,8 @@ $template->param(
code => '92',
description => 'Assigned by buyer',
},
]
],
standards => [ 'BIC', 'EUR' ]
);
output_html_with_http_headers( $input, $cookie, $template->output );

View File

@ -193,6 +193,27 @@ EDI accounts &rsaquo; Administration &rsaquo; Koha
<label for="san">SAN: </label>
<input type="text" name="san" id="san" size="20" maxlength="20" value="[% account.san | html %]" />
</li>
<li>
<label for="standard">Standard:</label>
<select name="standard" id="standard">
[% FOREACH standard IN standards %]
[% IF standard == 'BIC' %]
[% SET description = 'BiC' %]
[% ELSE %]
[% SET description = 'EDItEUR' %]
[% END %]
[% IF standard == account.standard %]
<option value="[% standard | html %]" selected="selected">
[% description | html %]
</option>
[% ELSE %]
<option value="[% standard | html %]">
[% description | html %]
</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="quotes_enabled">Quotes enabled: </label>
[% IF account.quotes_enabled %]
@ -292,6 +313,7 @@ EDI accounts &rsaquo; Administration &rsaquo; Koha
<th>Upload directory</th>
<th>Qualifier</th>
<th>SAN</th>
<th>Standard</th>
<th>Quotes</th>
<th>Orders</th>
<th>Invoices</th>
@ -319,6 +341,7 @@ EDI accounts &rsaquo; Administration &rsaquo; Koha
([% account.id_code_qualifier | html %])
</td>
<td>[% account.san | html %]</td>
<td>[% IF account.standard == 'BIC' %]BiC[% ELSE %]EDItEUR[% END %]</td>
[% IF account.quotes_enabled %]
<td>Yes</td>
[% ELSE %]