From 8c733f9cc60049c42499bfaa57a6c141906d4b8a Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 18 Sep 2025 13:53:58 -0400 Subject: [PATCH] Bug 40840: Failure of an EDI SFTP account will kill edi_cron.pl preventing uploads from subsequent accounts EDI uploads are processed in order. If one account is unable to connect to the SFTP server, it will call die_on_error which kills the script. This does not affect regular FTP which will fail gracefully. Test Plan: 1) Set up an SFTP server 2) Set up 3 EDI accounts 3) Set accounts 1 and 3 to have a good SFTP server hostname 4) Set account 2 to have a bad SFTP server hostname 5) Queue an edi order for each account 6) Run edi_cron.pl 7) Note the cronjob runs and dies with an error 8) Note only 1 EDI message was uploaded 9) Apply this patch 10) Run edi_cron.pl 11) Note that the cronjob does not die 12) Verify the message for account 3 was uploaded! ( the message for account 2 should remain as pending ). --- Koha/Edifact/Transport.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Koha/Edifact/Transport.pm b/Koha/Edifact/Transport.pm index ec59ae41109..32c2febc408 100644 --- a/Koha/Edifact/Transport.pm +++ b/Koha/Edifact/Transport.pm @@ -318,7 +318,12 @@ sub sftp_upload { port => $port, timeout => 10, ); - $sftp->die_on_error( "Cannot ssh to " . $self->{account}->host ); + if ( $sftp->error ) { + return $self->_abort_download( + $sftp, + "Cannot ssh to " . $self->{account}->host . " : " . $sftp->error + ); + } $sftp->setcwd( $self->{account}->upload_directory ) or return $self->_abort_download( $sftp, -- 2.39.5 (Apple Git-154)