Bug 38489: (follow-up) Update EDI accounts list display
This patch updates the EDI accounts management page to display the new file transport system instead of the old inline transport configuration fields. Changes: - Replaced multiple transport-related columns (Transport, Remote host, Username, Password, Upload/Download ports and directories) with a single "File transport" column - The file transport column displays the transport name with its connection test status in brackets - Status indicators match the file_transports page: * "Tests passing" (green with checkmark icon) for successful tests * "Errors detected" (red with x icon) for failed tests * "Never used" (italic) for untested transports - Updated the Perl controller to decode the JSON status field from the file_transports table and pass it to the template - Uses get_inflated_columns to convert DBIx::Class results to plain hashrefs for template consumption The display now correctly reflects the architectural change where transport configuration is managed separately in the file_transports table rather than duplicated in each EDI account. Note: At a future date we should replace the raw DBIx::Class methods with Koha::Object based classes. I propose Koha::EDI::Account(s). Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
8438782c6d
commit
bff78d2cb5
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -269,14 +269,7 @@
|
|||
<th>ID</th>
|
||||
<th>Vendor</th>
|
||||
<th>Description</th>
|
||||
<th>Transport</th>
|
||||
<th>Remote host</th>
|
||||
<th>Username</th>
|
||||
<th>Password</th>
|
||||
<th>Upload port</th>
|
||||
<th>Download port</th>
|
||||
<th>Download directory</th>
|
||||
<th>Upload directory</th>
|
||||
<th>File transport</th>
|
||||
<th>Qualifier</th>
|
||||
<th>SAN</th>
|
||||
<th>Standard</th>
|
||||
|
|
@ -294,14 +287,24 @@
|
|||
<td>[% account.id | html %]</td>
|
||||
<td><a href="/cgi-bin/koha/acquisition/vendors/[% account.vendor_id | uri %]">[% account.vendor.name | html %]</a></td>
|
||||
<td>[% account.description | html %]</td>
|
||||
<td>[% account.transport | html %]</td>
|
||||
<td>[% account.host | html %]</td>
|
||||
<td>[% account.username | html %]</td>
|
||||
<td>[% IF account.password %]*****[% END %]</td>
|
||||
<td>[% account.upload_port | html %]</td>
|
||||
<td>[% account.download_port | html %]</td>
|
||||
<td>[% account.download_directory | html %]</td>
|
||||
<td>[% account.upload_directory | html %]</td>
|
||||
<td>
|
||||
[% IF account.file_transport %]
|
||||
[% account.file_transport.name | html %]
|
||||
[% IF account.file_transport.status %]
|
||||
[% IF account.file_transport.status.status == "ok" %]
|
||||
(<i class="text-success fa-solid fa-circle-check"></i> <span class="text-success">Tests passing</span>)
|
||||
[% ELSIF account.file_transport.status.status == "errors" %]
|
||||
(<i class="text-danger fa-solid fa-circle-xmark"></i> <span class="text-danger">Errors detected</span>)
|
||||
[% ELSE %]
|
||||
(<em>Never used</em>)
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
(<em>Never used</em>)
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
<span class="text-danger">No transport configured</span>
|
||||
[% END %]
|
||||
</td>
|
||||
<td>
|
||||
[% FOREACH qualifier IN code_qualifiers %]
|
||||
[% IF qualifier.code == account.id_code_qualifier %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue