https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41020

Martin Renvoize (ashimema) <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #188150|0                           |1
        is obsolete|                            |

--- Comment #36 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 188157
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=188157&action=edit
Bug 41020: (follow-up) Modernize code to use Koha objects and relationship
accessors

This follow-up improves the code to better follow Koha best practices:

1. Added file_transport() relationship accessor to Koha::MarcOrderAccount
   - Returns the correct polymorphic subclass (SFTP, FTP, or Local)
   - Respects prefetched relationships to avoid N+1 queries
   - Follows the same pattern as vendor() and budget() accessors

2. Updated admin/marc_order_accounts.pl to use Koha::File::Transports
   - Replaced direct DBIx::Class schema access with Koha objects
   - Removed unused $schema variable

3. Updated misc/cronjobs/marc_ordering_process.pl
   - Changed manual transport lookup to use the new relationship accessor
   - Cleaner code that can benefit from prefetching

4. Added unit tests (t/db_dependent/Koha/MarcOrderAccount.t)
   - Tests for all relationship accessors (vendor, budget, file_transport)
   - Verifies polymorphism works correctly for all transport types
   - Includes test demonstrating that prefetched relationships don't
     trigger additional database queries

Test plan:
1. prove t/db_dependent/Koha/MarcOrderAccount.t
2. Verify all tests pass
3. Run marc_ordering_process.pl cronjob and verify it still works

Signed-off-by: Martin Renvoize <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to