From 35ee21eadd63f38569da864c6a506d8fac7551ab Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 19 Aug 2019 16:15:38 -0400 Subject: [PATCH] Bug 20307: Code for AVs must be category and value And not only the authorized value, otherwise we could not handle the case where 2 categories have an identical authorized value. FIXME: When editing an AV, if you translate then change the AV's value, we will have inconsistent data, we should add some JS code to disable the translate link if the AV's value is modified. I would suggest to do it on a follow-up bug. Signed-off-by: Michal Denar Signed-off-by: Martin Renvoize --- Koha/AuthorisedValue.pm | 6 +++--- .../prog/en/modules/admin/authorised_values.tt | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Koha/AuthorisedValue.pm b/Koha/AuthorisedValue.pm index 08f77f24b2..8eee2fc450 100644 --- a/Koha/AuthorisedValue.pm +++ b/Koha/AuthorisedValue.pm @@ -68,7 +68,7 @@ sub opac_translated_description { } $lang ||= C4::Languages::getlanguage; my $translated_description = Koha::Localizations->search({ - code => $self->authorised_value, + code => sprintf "%s_%s", $self->category, $self->authorised_value, entity => 'authorised_values', lang => $lang, interface => 'opac', @@ -94,7 +94,7 @@ sub translated_description { } $lang ||= C4::Languages::getlanguage; my $translated_description = Koha::Localizations->search({ - code => $self->authorised_value, + code => sprintf "%s_%s", $self->category, $self->authorised_value, entity => 'authorised_values', lang => $lang, })->next; @@ -111,7 +111,7 @@ sub translated_descriptions { my ( $self ) = @_; my @translated_descriptions = Koha::Localizations->search( { entity => 'authorised_values', - code => $self->authorised_value, + code => sprintf "%s_%s", $self->category, $self->authorised_value, } ); return [ map { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt index 4021243fdb..1efe5967e8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -77,7 +77,7 @@ [% IF can_be_translated %] [% IF action_modify %] - Translate into other languages + Translate into other languages [% ELSE %] Translate into other languages [% END %] @@ -88,7 +88,7 @@ [% IF can_be_translated %] [% IF action_modify %] - Translate into other languages + Translate into other languages [% ELSE %] Translate into other languages [% END %] -- 2.20.1