Bug 42110

Summary: Migrate marc_order_accounts.download_directory to use local file transport option
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: AcquisitionsAssignee: Kyle M Hall (khall) <kyle>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Crowdfunding committed: 0
Crowdfunding contact: Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 41020    
Bug Blocks:    
Attachments: Bug 42110: Migrate marc_order_accounts.download_directory to use local file transport option

Description Kyle M Hall (khall) 2026-03-16 16:28:35 UTC
As detailed in bug 41020, we should be using the pre-existing local file transport for marc order accounts. This offers a simple migration path to using FTP/SFTP after migration.
Comment 1 Kyle M Hall (khall) 2026-03-16 17:20:00 UTC
Created attachment 195494 [details] [review]
Bug 42110: Migrate marc_order_accounts.download_directory to use local file transport option

As detailed in bug 41020, we should be using the pre-existing local file transport for marc order accounts.
This offers a simple migration path to using FTP/SFTP after migration.

Test Plan:
1) Apply this patch on top of the bug 41020 patches
2) Before running the database update, create marc order accounts:
   a) Two with different download_directory values set
   b) One with no download_directory set
   c) One with a download_directory and a file_transport_id already set
3) Run the database update (installer/data/mysql/atomicupdate/bug_42110.pl)
4) Verify the migration results:
   a) Accounts from 2a have new local file transports created and linked,
      named "MARC order account: <description> [<id>] (Migrated)"
   b) Account from 2b has no file transport created or linked
   c) Account from 2c is unchanged (existing file_transport_id preserved)
   d) The download_directory column is removed from marc_order_accounts
5) Rebuild the API bundle: yarn api:bundle
6) Restart all the things!
7) Go to Administration > File transports
   a) Verify the migrated local file transports appear in the list
   b) Verify you can create a new file transport with transport type "Local"
   c) Verify that selecting "Local" disables and clears host, port, passive
      mode, authentication mode, username, password, and key file fields
   d) Verify switching back to SFTP/FTP re-enables those fields
   e) Verify saving a Local transport stores blank values for the
      disabled fields
8) Go to Administration > MARC order accounts
   a) Verify the download_directory column and form field are removed
   b) Verify you can create/edit accounts and select a file transport
9) Test the cron job (misc/cronjobs/marc_ordering_process.pl):
   a) Place .mrc files in the download directory of a local file transport
   b) Run: perl marc_ordering_process.pl -v -c
      Verify files are found and processed via the file transport
   c) Run with --delete flag, verify source files are deleted
   d) Run with --rename .done flag, verify source files are renamed
   e) Run with --archive /tmp/marc_archive flag, verify processed files
      are copied to the archive directory