Bugzilla – Attachment 130852 Details for
Bug 30130
Allow setting EDI type at the vendor level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30130: Add standard to edi account definition
Bug-30130-Add-standard-to-edi-account-definition.patch (text/plain), 8.29 KB, created by
Martin Renvoize
on 2022-02-18 14:25:47 UTC
(
hide
)
Description:
Bug 30130: Add standard to edi account definition
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2022-02-18 14:25:47 UTC
Size:
8.29 KB
patch
obsolete
>From 05b2acc4507a109ac5f7af7fe92b2b03d536ac57 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 18 Feb 2022 14:23:21 +0000 >Subject: [PATCH] Bug 30130: Add standard to edi account definition > >This patch add a 'standard' field to 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. >--- > Koha/Edifact/Order.pm | 20 ++++++------------- > Koha/Schema/Result/VendorEdiAccount.pm | 13 ++++++++++-- > admin/edi_accounts.pl | 11 ++++++++++ > .../data/mysql/atomicupdate/bug_30130.pl | 19 ++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 1 + > .../prog/en/modules/admin/edi_accounts.tt | 18 +++++++++++++++++ > 6 files changed, 66 insertions(+), 16 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_30130.pl > >diff --git a/Koha/Edifact/Order.pm b/Koha/Edifact/Order.pm >index f21a7a8b76..548c62c429 100644 >--- a/Koha/Edifact/Order.pm >+++ b/Koha/Edifact/Order.pm >@@ -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 { >diff --git a/Koha/Schema/Result/VendorEdiAccount.pm b/Koha/Schema/Result/VendorEdiAccount.pm >index e8e7d810fc..bb463a89b3 100644 >--- a/Koha/Schema/Result/VendorEdiAccount.pm >+++ b/Koha/Schema/Result/VendorEdiAccount.pm >@@ -80,6 +80,13 @@ __PACKAGE__->table("vendor_edi_accounts"); > is_nullable: 1 > size: 20 > >+=head2 standard >+ >+ data_type: 'varchar' >+ default_value: 'EUR' >+ is_nullable: 1 >+ size: 3 >+ > =head2 id_code_qualifier > > data_type: 'varchar' >@@ -160,6 +167,8 @@ __PACKAGE__->add_columns( > { data_type => "mediumtext", is_nullable => 1 }, > "san", > { data_type => "varchar", is_nullable => 1, size => 20 }, >+ "standard", >+ { data_type => "varchar", default_value => "EUR", is_nullable => 1, size => 3 }, > "id_code_qualifier", > { data_type => "varchar", default_value => 14, is_nullable => 1, size => 3 }, > "transport", >@@ -250,8 +259,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TtWuTpP4Ac6/+T6OPMSsRA >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-02-18 14:08:05 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yDbPFtwV40n3o+fFoxR99g > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/admin/edi_accounts.pl b/admin/edi_accounts.pl >index 293f7ef666..2da002e489 100755 >--- a/admin/edi_accounts.pl >+++ b/admin/edi_accounts.pl >@@ -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,6 +134,16 @@ $template->param( > code => '92', > description => 'Assigned by buyer', > }, >+ ], >+ standards => [ >+ { >+ code => 'BIC', >+ description => 'BiC' >+ }, >+ { >+ code => 'EUR', >+ description => 'EDItEUR' >+ } > ] > ); > >diff --git a/installer/data/mysql/atomicupdate/bug_30130.pl b/installer/data/mysql/atomicupdate/bug_30130.pl >new file mode 100644 >index 0000000000..58669f6fbd >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_30130.pl >@@ -0,0 +1,19 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "30130", >+ description => "A standard to edi_account", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ unless ( column_exists('vendor_edi_accounts', 'standard') ) { >+ $dbh->do(q{ >+ ALTER TABLE vendor_edi_accounts ADD standard varchar(3) DEFAULT 'EUR' AFTER san >+ }); >+ >+ $dbh->do(q{ >+ UPDATE vendor_edi_accounts SET standard = 'BIC' WHERE san IN ( '5013546025065', '9377779308820' ) >+ }); >+ } >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 4411ae7604..49f4ac8a60 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -5230,6 +5230,7 @@ CREATE TABLE `vendor_edi_accounts` ( > `download_directory` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, > `upload_directory` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, > `san` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, >+ `standard` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT 'EUR', > `id_code_qualifier` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT '14', > `transport` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT 'FTP', > `quotes_enabled` tinyint(1) NOT NULL DEFAULT 0, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_accounts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_accounts.tt >index 51d8ec0019..ce4669cd86 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_accounts.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_accounts.tt >@@ -185,6 +185,22 @@ EDI accounts › Administration › 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.code == account.standard %] >+ <option value="[% standard.code | html %]" selected="selected"> >+ [% standard.description | html %] >+ </option> >+ [% ELSE %] >+ <option value="[% standard.code | html %]"> >+ [% standard.description | html %] >+ </option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> > <li> > <label for="quotes_enabled">Quotes enabled: </label> > [% IF account.quotes_enabled %] >@@ -284,6 +300,7 @@ EDI accounts › Administration › Koha > <th>Upload directory</th> > <th>Qualifier</th> > <th>SAN</th> >+ <th>Standard</th> > <th>Quotes</th> > <th>Orders</th> > <th>Invoices</th> >@@ -311,6 +328,7 @@ EDI accounts › Administration › Koha > ([% account.id_code_qualifier | html %]) > </td> > <td>[% account.san | html %]</td> >+ <td>[% account.standard | html %]</td> > [% IF account.quotes_enabled %] > <td>Yes</td> > [% ELSE %] >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30130
:
130852
|
130860
|
130960
|
130966
|
130967
|
130968
|
130969
|
130970
|
130991
|
130992
|
130993
|
130994
|
130995
|
130996
|
132404
|
132405
|
132406
|
132407
|
132408
|
132409
|
132410