From 4e6499a73693b65f4d564c1910d49f5260b1aefe Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Tue, 29 Oct 2024 08:54:39 +1300 Subject: [PATCH] Bug 36766: (follow-up) Set ReplytoDefault as the preferred from_address of sftp_file.pl Default to KohaAdminEmailAddress if ReplytoDefault is not set Test plan: 1. Enter a valid email address into ReplytoDefault and KohaAdminEmailAddress sysprefs 2. Apply patch and restart services 3. Generate a file on your Koha server. Place it in /tmp/test.mrc 4. Manually connect to the SFTP remote host and accept the hostkey 5. Enter Koha shell 6. Run the sftp_file.pl command-line script ./sftp_file.pl --host --user --pass --upload_dir --file /tmp/test.mrc --email 7. Confirm the SFTP was successful 8. Confirm that the email that you received has a from address matching the ReplytoDefault syspref 9. Empty out the ReplytoDefault syspref and repeat steps 5 and 6 10. Confirm that the new email you received has a from address matching the KohaAdminEmailAddress syspref Sponsored-by: Catalyst IT --- misc/cronjobs/sftp_file.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/cronjobs/sftp_file.pl b/misc/cronjobs/sftp_file.pl index 526f9d48829..e769ac19147 100755 --- a/misc/cronjobs/sftp_file.pl +++ b/misc/cronjobs/sftp_file.pl @@ -169,7 +169,9 @@ $sftp->setcwd($upload_dir) # If the --email parameter is defined then prepare sending an email confirming the success # or failure of the SFTP if ($email) { - if ( C4::Context->preference('KohaAdminEmailAddress') ) { + if ( C4::Context->preference('ReplytoDefault') ) { + $admin_address = C4::Context->preference('ReplytoDefault'); + } elsif ( C4::Context->preference('KohaAdminEmailAddress') ) { $admin_address = C4::Context->preference('KohaAdminEmailAddress'); } -- 2.39.2