From f292b58af7777e23095abf0d9ca515e098ef2f59 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 87950ff3c7..91b0d94ee2 100644 --- a/Koha/AuthorisedValue.pm +++ b/Koha/AuthorisedValue.pm @@ -161,7 +161,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', @@ -187,7 +187,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; @@ -204,7 +204,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 ec4fc20c5e..85cb7033fc 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