From 877527a6da2297994a94d39036e677428e7864e2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 19 Aug 2019 15:44:17 -0400 Subject: [PATCH] Bug 20307: Use 'auhorised_values' instead of 'avs' to avoid confusion And so we need to extend the size of localization.entity --- Koha/AuthorisedValue.pm | 6 +++--- Koha/Schema/Result/AuthorisedValueLocalization.pm | 2 +- installer/data/mysql/atomicupdate/bug_20307.perl | 1 + installer/data/mysql/kohastructure.sql | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Koha/AuthorisedValue.pm b/Koha/AuthorisedValue.pm index 2c2e4cd051..08f77f24b2 100644 --- a/Koha/AuthorisedValue.pm +++ b/Koha/AuthorisedValue.pm @@ -69,7 +69,7 @@ sub opac_translated_description { $lang ||= C4::Languages::getlanguage; my $translated_description = Koha::Localizations->search({ code => $self->authorised_value, - entity => 'avs', + entity => 'authorised_values', lang => $lang, interface => 'opac', })->next; @@ -95,7 +95,7 @@ sub translated_description { $lang ||= C4::Languages::getlanguage; my $translated_description = Koha::Localizations->search({ code => $self->authorised_value, - entity => 'avs', + entity => 'authorised_values', lang => $lang, })->next; return $translated_description @@ -110,7 +110,7 @@ sub translated_description { sub translated_descriptions { my ( $self ) = @_; my @translated_descriptions = Koha::Localizations->search( - { entity => 'avs', + { entity => 'authorised_values', code => $self->authorised_value, } ); diff --git a/Koha/Schema/Result/AuthorisedValueLocalization.pm b/Koha/Schema/Result/AuthorisedValueLocalization.pm index fa2c69662b..b283172b1e 100644 --- a/Koha/Schema/Result/AuthorisedValueLocalization.pm +++ b/Koha/Schema/Result/AuthorisedValueLocalization.pm @@ -9,7 +9,7 @@ __PACKAGE__->table_class('DBIx::Class::ResultSource::View'); __PACKAGE__->table('authorised_value_localizations'); __PACKAGE__->result_source_instance->is_virtual(1); __PACKAGE__->result_source_instance->view_definition( - "SELECT localization_id, code, lang, translation FROM localization WHERE entity='avs'" + "SELECT localization_id, code, lang, translation FROM localization WHERE entity='authorised_values'" ); __PACKAGE__->add_columns( diff --git a/installer/data/mysql/atomicupdate/bug_20307.perl b/installer/data/mysql/atomicupdate/bug_20307.perl index 36896af3be..c82a7af872 100644 --- a/installer/data/mysql/atomicupdate/bug_20307.perl +++ b/installer/data/mysql/atomicupdate/bug_20307.perl @@ -4,6 +4,7 @@ if ( CheckVersion($DBversion) ) { $dbh->do("ALTER TABLE `localization` ADD COLUMN `interface` VARCHAR(30) DEFAULT NULL AFTER `entity`"); $dbh->do("ALTER TABLE `localization` DROP FOREIGN KEY `entity_code_lang`"); $dbh->do("ALTER TABLE `localization` ADD UNIQUE KEY `entity_code_interface_lang` (entity, code, interface, lang)"); + $dbh->do("ALTER TABLE `localization` MODIFY entity VARCHAR(30) NOT NULL"); } SetVersion($DBversion); diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 957c86017d..3e5c6e0920 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3674,7 +3674,7 @@ CREATE TABLE `additional_field_values` ( DROP TABLE IF EXISTS localization; CREATE TABLE `localization` ( localization_id int(11) NOT NULL AUTO_INCREMENT, - entity varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL, + entity varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL, interface varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL, code varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, lang varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL, -- could be a foreign key 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 2a768c7130..bccfd803f4 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