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

Jakr <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Jakr <[email protected]> ---
Proposed solution

I tested a possible fix in Koha/Template/Plugin/Notices.pm (Koha 26.05.04), in
the GetTemplates method. The change removes duplicate entries based on the
combination of module and template code, while retaining the first matching
template object:

my %seen;
@letters = grep {
    my $key = $_->module . "\0" . $_->code;
    !$seen{$key}++;
} @letters;

diff /usr/share/koha/lib/Koha/Template/Plugin/Notices.pm.bak
/usr/share/koha/lib/Koha/Template/Plugin/Notices.pm
66a67,72
>     my %seen;
>     @letters = grep {
>          my $key = $_->module . "\0" . $_->code;
>         !$seen{$key}++;
>     } @letters;
> 

This change preserves the original query and returns the original template
objects. It only filters the returned list; it does not modify or delete any
database records.

The change eliminates duplicate entries in the patron toolbar while preserving
templates with the same code in different modules.

Request for review

This solution works in my test environment, but I have not investigated all
possible uses of GetTemplates or the original design assumptions behind
returning language-specific variants.

Could this approach be reviewed? If it is consistent with the intended
behaviour of the Notices plugin, would it be appropriate to implement this
deduplication in Koha's source code?

Thank you.

-- 
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