diff --git a/admin/edi_accounts.pl b/admin/edi_accounts.pl index 4aa1151761..ffbf6e9b04 100755 --- a/admin/edi_accounts.pl +++ b/admin/edi_accounts.pl @@ -20,6 +20,7 @@ use Modern::Perl; use CGI; +use JSON qw( decode_json ); use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); @@ -111,12 +112,24 @@ if ( $op eq 'acct_form' ) { # we do a default display after deletes and saves # as well as when that's all you want $template->param( display => 1 ); - my @ediaccounts = $schema->resultset('VendorEdiAccount')->search( + my $ediaccounts = $schema->resultset('VendorEdiAccount')->search( {}, - { - join => 'vendor', - } + { prefetch => [ 'vendor', 'file_transport' ] } ); + + # Decode file_transport status for each account + my @ediaccounts; + while ( my $ediaccount = $ediaccounts->next ) { + my $unblessed = { $ediaccount->get_inflated_columns }; + $unblessed->{vendor} = { $ediaccount->vendor->get_inflated_columns }; + if ( $ediaccount->file_transport ) { + $unblessed->{file_transport} = { $ediaccount->file_transport->get_inflated_columns }; + $unblessed->{file_transport}->{status} = + $ediaccount->file_transport->status ? decode_json( $ediaccount->file_transport->status ) : undef; + } + push @ediaccounts, $unblessed; + } + $template->param( ediaccounts => \@ediaccounts ); } 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 2512964275..4879e2bc4c 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 @@ -269,14 +269,7 @@ ID Vendor Description - Transport - Remote host - Username - Password - Upload port - Download port - Download directory - Upload directory + File transport Qualifier SAN Standard @@ -294,14 +287,24 @@ [% account.id | html %] [% account.vendor.name | html %] [% account.description | html %] - [% account.transport | html %] - [% account.host | html %] - [% account.username | html %] - [% IF account.password %]*****[% END %] - [% account.upload_port | html %] - [% account.download_port | html %] - [% account.download_directory | html %] - [% account.upload_directory | html %] + + [% IF account.file_transport %] + [% account.file_transport.name | html %] + [% IF account.file_transport.status %] + [% IF account.file_transport.status.status == "ok" %] + ( Tests passing) + [% ELSIF account.file_transport.status.status == "errors" %] + ( Errors detected) + [% ELSE %] + (Never used) + [% END %] + [% ELSE %] + (Never used) + [% END %] + [% ELSE %] + No transport configured + [% END %] + [% FOREACH qualifier IN code_qualifiers %] [% IF qualifier.code == account.id_code_qualifier %]