Bug 41711

Summary: The function Koha::Notice::Templates::find_effective_template selects a (probably) incorrect notice template
Product: Koha Reporter: Janusz Kaczmarek <januszop>
Component: NoticesAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low    
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Janusz Kaczmarek 2026-01-26 11:21:35 UTC
When notice templates of a given type are defined for a specific library, but not in all languages, we would likely expect Koha to select the template of that type for the given library in the default language, rather than a generic template in the requested language.

For example, if we are looking for:

{ branch: 'BRANCH', lang: 'es-ES', code: 'CHECKOUT' }

and such a template does not exist, we would prefer:

{ branch: 'BRANCH', lang: 'default', code: 'CHECKOUT' }

over:

{ branch: '', lang: 'es-ES', code: 'CHECKOUT' }.

However, Koha currently prioritizes language matching over library matching and therefore returns the template:

{ branch: '', lang: 'es-ES', code: 'CHECKOUT' }.