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

            Bug ID: 43269
           Summary: Add cached description_for() class methods to
                    Koha::Libraries, Koha::ItemTypes,
                    Koha::Patron::Categories
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
  Target Milestone: ---

Several places in Koha need to resolve codes to human-readable descriptions
(branchcode to library name, categorycode to category description, itype to
item type description). Currently this is done either per-row via
Koha::Libraries->find($code)->branchname (uncached, N+1 queries) or via
C4::Biblio::GetAuthorisedValueDesc (cached but MARC-centric API requiring
tag/subfield/framework).

We should add cached class-level lookup methods on the domain objects:

  Koha::Libraries->name_for($branchcode);
  Koha::Patron::Categories->description_for($categorycode);
  Koha::ItemTypes->description_for($itype);

These would:
- Use Koha::Caches to pre-fetch all values for the table on first access
- Return the description string (or the raw code as fallback)
- Be usable from any context (CSV exports, templates, scripts, REST API)

This decouples the caching from the MARC layer and makes it available to the
Koha::CSV subclass pattern (bug 41621) and anywhere else that needs bulk
code-to-description resolution without N+1 queries.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to