Bug 41020

Summary: Add ability to use file transports for marc ordering accounts
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: AcquisitionsAssignee: Kyle M Hall (khall) <kyle>
Status: Needs Signoff --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: martin.renvoize
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38489
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 39190    
Bug Blocks:    
Attachments: Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Bug 41020: Add ability to use file transports for marc ordering accounts
Bug 41020: Update schema files [DO NOT PUSH]
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Bug 41020: Add ability to use file transports for marc ordering accounts
Bug 41020: Update schema files [DO NOT PUSH]
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Bug 41020: Add ability to use file transports for marc ordering accounts
Bug 41020: Update schema files [DO NOT PUSH]

Description Kyle M Hall (khall) 2025-10-14 19:01:23 UTC
FTP and SFTP server management was added to Koha in bug 39190. This feature should be made available to the marc order accounts feature so external processes are not needed to downloading the marc order files.
Comment 1 Kyle M Hall (khall) 2025-10-15 18:36:43 UTC
Created attachment 187931 [details] [review]
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Comment 2 Kyle M Hall (khall) 2025-10-15 18:37:07 UTC
Created attachment 187932 [details] [review]
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Comment 3 Kyle M Hall (khall) 2025-10-15 18:37:15 UTC
Created attachment 187933 [details] [review]
Bug 41020: Add ability to use file transports for marc ordering accounts

FTP and SFTP server management was added to Koha in bug 39190. This feature should be made available to the marc order accounts feature so external processes are not needed to downloading the marc order files.

Test Plan:
1) Run updatedatabase.pl
2) Restart all the things!
3) Create one or more file transports
4) Attach those transports to one or more MARC order accounts
5) Run marc_order_accounts.tt, note the files are transferred from the
   remove server to the "Download directory" of the MARC order account
6) Add another file to the remote server
7) Run script with "--rr dl"
8) Note the remote file has ".dl" append to the filename
9) Remove the .dl file extension from the remote file
10) Run script with "--dr"
11) Note the remote file is deleted
Comment 4 Kyle M Hall (khall) 2025-10-15 18:37:18 UTC
Created attachment 187934 [details] [review]
Bug 41020: Update schema files [DO NOT PUSH]
Comment 5 Kyle M Hall (khall) 2025-10-15 18:45:10 UTC
Created attachment 187935 [details] [review]
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Comment 6 Kyle M Hall (khall) 2025-10-15 18:45:31 UTC
Created attachment 187936 [details] [review]
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Comment 7 Kyle M Hall (khall) 2025-10-15 18:45:39 UTC
Created attachment 187937 [details] [review]
Bug 41020: Add ability to use file transports for marc ordering accounts

FTP and SFTP server management was added to Koha in bug 39190. This feature should be made available to the marc order accounts feature so external processes are not needed to downloading the marc order files.

Test Plan:
1) Run updatedatabase.pl
2) Restart all the things!
3) Create one or more file transports
4) Attach those transports to one or more MARC order accounts
5) Run marc_order_accounts.tt, note the files are transferred from the
   remove server to the "Download directory" of the MARC order account
6) Add another file to the remote server
7) Run script with "--rr dl"
8) Note the remote file has ".dl" append to the filename
9) Remove the .dl file extension from the remote file
10) Run script with "--dr"
11) Note the remote file is deleted
Comment 8 Kyle M Hall (khall) 2025-10-15 18:45:41 UTC
Created attachment 187938 [details] [review]
Bug 41020: Update schema files [DO NOT PUSH]
Comment 9 Kyle M Hall (khall) 2025-10-15 18:47:50 UTC
Created attachment 187939 [details] [review]
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Comment 10 Kyle M Hall (khall) 2025-10-15 18:48:09 UTC
Created attachment 187940 [details] [review]
Bug 41020: Add ability to delete files to Koha::File::Transport and derived classes
Comment 11 Kyle M Hall (khall) 2025-10-15 18:48:18 UTC
Created attachment 187941 [details] [review]
Bug 41020: Add ability to use file transports for marc ordering accounts

FTP and SFTP server management was added to Koha in bug 39190. This feature should be made available to the marc order accounts feature so external processes are not needed to downloading the marc order files.

Test Plan:
1) Run updatedatabase.pl
2) Restart all the things!
3) Create one or more file transports
4) Attach those transports to one or more MARC order accounts
5) Run marc_order_accounts.tt, note the files are transferred from the
   remove server to the "Download directory" of the MARC order account
6) Add another file to the remote server
7) Run script with "--rr dl"
8) Note the remote file has ".dl" append to the filename
9) Remove the .dl file extension from the remote file
10) Run script with "--dr"
11) Note the remote file is deleted
Comment 12 Kyle M Hall (khall) 2025-10-15 18:48:20 UTC
Created attachment 187942 [details] [review]
Bug 41020: Update schema files [DO NOT PUSH]
Comment 13 Martin Renvoize (ashimema) 2025-10-16 10:23:32 UTC
Comment on attachment 187941 [details] [review]
Bug 41020: Add ability to use file transports for marc ordering accounts

Review of attachment 187941 [details] [review]:
-----------------------------------------------------------------

Generally looks good, couple of minor queries of why we took a few shortcuts ;)

::: admin/marc_order_accounts.pl
@@ +61,5 @@
>      my @matchers = C4::Matcher::GetMatcherList();
>      $template->param( available_matchers => \@matchers );
>  
> +    # Get available file transports for selection
> +    my @file_transports = $schema->resultset('FileTransport')->search(

Was it intentional to use DBIC directly instead of doing a Koha::File::Transports->search() call?

::: misc/cronjobs/marc_ordering_process.pl
@@ +111,5 @@
>      }
>  
>      my $working_dir = $acct->download_directory;
> +
> +    my $file_transport = $acct->file_transport_id ? Koha::File::Transports->find( $acct->file_transport_id ) : undef;

Any reason to do this here rather than introducing a 'transport' relation accessor to give you back a Koha::File::Transport object directly if one exists?  i.e. why in the script not the object as a relation?