From 2f9d0ff070deb87538023b84931ba889118cde99 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 --- Koha/AuthorisedValue.pm | 6 +++--- koha-tmpl/intranet-tmpl/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 e01aed9c71..961c386a82 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.11.0