[Bug 41401] New: Translating Custom slips adds same amount of options to the Print dropdown in patron's details
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41401 Bug ID: 41401 Summary: Translating Custom slips adds same amount of options to the Print dropdown in patron's details Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Notices Assignee: koha-bugs@lists.koha-community.org Reporter: anneli.osterman@koha-suomi.fi QA Contact: testopia@bugs.koha-community.org Created attachment 190287 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190287&action=edit Custom slip with two languages When you add a custom slip and there are several languages installed and translating notices (TranslateNotices system preference) is allowed there will be as many options as added languages in the Print dropdown menu in patron's details. All of those options print the slip in the the language that has been selected as patron's Preferred language for notices. So, if you have three languages plus default you will get four options that all look the same (name comes from the Name of the notice) and prints the same content. How to reproduce: 1. Make sure you have at least to languages added to Koha. 2. Select in StaffInterfaceLanguages systempreferences at least two of those languages 3. Choose "Allow" to TranslateNotices systempreference 4. Go to Tools - Notices and slips - New notice - Patrons (custom slip) 5. Add code (TEST) and Name (Testing languages) 6. Add (different) content to at least two languages 7. Go to random patron's details and modify to select one of the selected languages as Preferred language for notices. Save. 8. Select Print from the toolbar and notice that there are at least two custom slips with the same name 9. Try to print both/all of them and notice that all of them prints the content in the language that patron has preferred. See the screenshot attached. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41401 Jakr <jan.kristof@svkk.sk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jan.kristof@svkk.sk --- Comment #1 from Jakr <jan.kristof@svkk.sk> --- 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.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org