From 77a91af72c824a077e46f1517fb81df49adfb3a4 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 23 Sep 2025 17:25:55 +0100 Subject: [PATCH] Bug 38489: Update EDI accounts UI to use file transport selection This patch updates the EDI accounts administration interface to use the new file_transports system instead of direct transport configuration. Changes: - Replace transport configuration fields with transport selection dropdown - Add file_transports data to template for selection options - Remove password decryption since credentials are now managed by transports - Simplify form handling to only manage EDI-specific fields - Add helpful link to file transport administration Sponsored-by: ByWater Solutions Signed-off-by: Hannah Dunne-Howrie --- admin/edi_accounts.pl | 43 ++++++++--------- .../prog/en/modules/admin/edi_accounts.tt | 47 ++++--------------- 2 files changed, 28 insertions(+), 62 deletions(-) diff --git a/admin/edi_accounts.pl b/admin/edi_accounts.pl index 52f472270ac..4aa11517614 100755 --- a/admin/edi_accounts.pl +++ b/admin/edi_accounts.pl @@ -56,6 +56,13 @@ if ( $op eq 'acct_form' ) { ); $template->param( vendors => \@vendors ); + # Get available file transports for selection + my @file_transports = $schema->resultset('FileTransport')->search( + {}, + { order_by => { -asc => 'name' } } + ); + $template->param( file_transports => \@file_transports ); + if ( C4::Context->config("enable_plugins") ) { my @plugins = Koha::Plugins->new()->GetPlugins( { @@ -71,29 +78,20 @@ if ( $op eq 'acct_form' ) { if ( $op eq 'cud-save' ) { # validate & display - my $id = $input->param('id'); - my $password = scalar $input->param('password'); - $password = $crypt->encrypt_hex($password); + my $id = $input->param('id'); my $fields = { - description => scalar $input->param('description'), - host => scalar $input->param('host'), - username => scalar $input->param('username'), - password => $password, - upload_port => scalar $input->param('upload_port') || $input->param('transport') eq 'FTP' ? 21 : 22, - download_port => scalar $input->param('download_port') || $input->param('transport') eq 'FTP' ? 21 : 22, - vendor_id => scalar $input->param('vendor_id'), - 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, - orders_enabled => $input->param('orders_enabled') ? 1 : 0, - responses_enabled => $input->param('responses_enabled') ? 1 : 0, - auto_orders => $input->param('auto_orders') ? 1 : 0, - id_code_qualifier => scalar $input->param('id_code_qualifier'), - plugin => scalar $input->param('plugin'), + description => scalar $input->param('description'), + vendor_id => scalar $input->param('vendor_id'), + file_transport_id => scalar $input->param('file_transport_id') || undef, + san => scalar $input->param('san'), + standard => scalar $input->param('standard'), + quotes_enabled => $input->param('quotes_enabled') ? 1 : 0, + invoices_enabled => $input->param('invoices_enabled') ? 1 : 0, + orders_enabled => $input->param('orders_enabled') ? 1 : 0, + responses_enabled => $input->param('responses_enabled') ? 1 : 0, + auto_orders => $input->param('auto_orders') ? 1 : 0, + id_code_qualifier => scalar $input->param('id_code_qualifier'), + plugin => scalar $input->param('plugin'), }; if ($id) { @@ -163,7 +161,6 @@ sub show_account { my $acct_id = $input->param('id'); if ($acct_id) { my $acct = $schema->resultset('VendorEdiAccount')->find($acct_id); - $acct->password( $crypt->decrypt_hex( $acct->password ) ); if ($acct) { $template->param( account => $acct ); } 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 6a207b8ba01..25129642753 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 @@ -134,49 +134,18 @@
  • - [% transport_types = [ 'FTP', 'SFTP', 'FILE' ] %] - - + + [% FOREACH transport IN file_transports %] + [% IF transport.file_transport_id == account.file_transport_id %] + [% ELSE %] - + [% END %] [% END %] -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
  • - - -
    The upload port will default to 22 (for SFTP) or 21 (for FTP) if not set.
    -
  • -
  • - - -
    The download port will default to 22 (for SFTP) or 21 (for FTP) if not set.
    -
  • -
  • - - -
    The download directory specifies the directory on the ftp site from which quotes and invoices are downloaded.
    -
  • -
  • - - -
    The upload directory specifies the directory on the ftp site to which orders are uploaded.
    +
    Select a file transport configuration for this EDI account. File transports can be managed in Administration › File transports.
  • -- 2.51.0