From 7220a6eca5e0d48bf80fb7881376af6e2b43c9eb 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. --- 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 bccfd803f4..7f83819524 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