View | Details | Raw Unified | Return to bug 20307
Collapse All | Expand All

(-)a/Koha/AuthorisedValue.pm (-3 / +3 lines)
Lines 162-168 sub opac_translated_description { Link Here
162
    $lang ||= C4::Languages::getlanguage;
162
    $lang ||= C4::Languages::getlanguage;
163
    my $translated_description = Koha::Localizations->search({
163
    my $translated_description = Koha::Localizations->search({
164
        code => $self->authorised_value,
164
        code => $self->authorised_value,
165
        entity => 'avs',
165
        entity => 'authorised_values',
166
        lang => $lang,
166
        lang => $lang,
167
        interface => 'opac',
167
        interface => 'opac',
168
    })->next;
168
    })->next;
Lines 188-194 sub translated_description { Link Here
188
    $lang ||= C4::Languages::getlanguage;
188
    $lang ||= C4::Languages::getlanguage;
189
    my $translated_description = Koha::Localizations->search({
189
    my $translated_description = Koha::Localizations->search({
190
        code => $self->authorised_value,
190
        code => $self->authorised_value,
191
        entity => 'avs',
191
        entity => 'authorised_values',
192
        lang => $lang,
192
        lang => $lang,
193
    })->next;
193
    })->next;
194
    return $translated_description
194
    return $translated_description
Lines 203-209 sub translated_description { Link Here
203
sub translated_descriptions {
203
sub translated_descriptions {
204
    my ( $self ) = @_;
204
    my ( $self ) = @_;
205
    my @translated_descriptions = Koha::Localizations->search(
205
    my @translated_descriptions = Koha::Localizations->search(
206
        {   entity => 'avs',
206
        {   entity => 'authorised_values',
207
            code   => $self->authorised_value,
207
            code   => $self->authorised_value,
208
        }
208
        }
209
    );
209
    );
(-)a/Koha/Schema/Result/AuthorisedValueLocalization.pm (-1 / +1 lines)
Lines 9-15 __PACKAGE__->table_class('DBIx::Class::ResultSource::View'); Link Here
9
__PACKAGE__->table('authorised_value_localizations');
9
__PACKAGE__->table('authorised_value_localizations');
10
__PACKAGE__->result_source_instance->is_virtual(1);
10
__PACKAGE__->result_source_instance->is_virtual(1);
11
__PACKAGE__->result_source_instance->view_definition(
11
__PACKAGE__->result_source_instance->view_definition(
12
    "SELECT localization_id, code, lang, translation FROM localization WHERE entity='avs'"
12
    "SELECT localization_id, code, lang, translation FROM localization WHERE entity='authorised_values'"
13
);
13
);
14
14
15
__PACKAGE__->add_columns(
15
__PACKAGE__->add_columns(
(-)a/installer/data/mysql/atomicupdate/bug_20307.perl (+1 lines)
Lines 4-9 if ( CheckVersion($DBversion) ) { Link Here
4
        $dbh->do("ALTER TABLE `localization` ADD COLUMN `interface` VARCHAR(30) DEFAULT NULL AFTER `entity`");
4
        $dbh->do("ALTER TABLE `localization` ADD COLUMN `interface` VARCHAR(30) DEFAULT NULL AFTER `entity`");
5
        $dbh->do("ALTER TABLE `localization` DROP FOREIGN KEY `entity_code_lang`");
5
        $dbh->do("ALTER TABLE `localization` DROP FOREIGN KEY `entity_code_lang`");
6
        $dbh->do("ALTER TABLE `localization` ADD UNIQUE KEY `entity_code_interface_lang` (entity, code, interface, lang)");
6
        $dbh->do("ALTER TABLE `localization` ADD UNIQUE KEY `entity_code_interface_lang` (entity, code, interface, lang)");
7
        $dbh->do("ALTER TABLE `localization` MODIFY entity VARCHAR(30) NOT NULL");
7
    }
8
    }
8
9
9
    SetVersion($DBversion);
10
    SetVersion($DBversion);
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 3653-3659 CREATE TABLE `additional_field_values` ( Link Here
3653
DROP TABLE IF EXISTS localization;
3653
DROP TABLE IF EXISTS localization;
3654
CREATE TABLE `localization` (
3654
CREATE TABLE `localization` (
3655
      localization_id int(11) NOT NULL AUTO_INCREMENT,
3655
      localization_id int(11) NOT NULL AUTO_INCREMENT,
3656
      entity varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
3656
      entity varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
3657
      interface varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3657
      interface varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3658
      code varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
3658
      code varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
3659
      lang varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL, -- could be a foreign key
3659
      lang varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL, -- could be a foreign key
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt (-3 / +2 lines)
Lines 77-83 Link Here
77
            <input type="text" name="lib" id="lib" value="[% lib | html %]" maxlength="200" />
77
            <input type="text" name="lib" id="lib" value="[% lib | html %]" maxlength="200" />
78
            [% IF can_be_translated %]
78
            [% IF can_be_translated %]
79
                [% IF action_modify %]
79
                [% IF action_modify %]
80
                    <a href="/cgi-bin/koha/admin/localization.pl?entity=avs&code=[% authorised_value | uri %]&interface=intranet"" title="Translate description" rel="gb_page_center[600,500]"><i class="fa fa-pencil"></i> Translate into other languages</a>
80
                    <a href="/cgi-bin/koha/admin/localization.pl?entity=authorised_values&code=[% authorised_value | uri %]&interface=intranet"" title="Translate description" rel="gb_page_center[600,500]"><i class="fa fa-pencil"></i> Translate into other languages</a>
81
                [% ELSE %]
81
                [% ELSE %]
82
                    <a href="#" class="disabled" title="The authorized value has to be saved to make it translatable"><i class="fa fa-pencil"></i> Translate into other languages</a>
82
                    <a href="#" class="disabled" title="The authorized value has to be saved to make it translatable"><i class="fa fa-pencil"></i> Translate into other languages</a>
83
                [% END %]
83
                [% END %]
Lines 88-94 Link Here
88
            <input type="text" name="lib_opac" id="lib_opac" value="[% lib_opac | html %]" maxlength="200" />
88
            <input type="text" name="lib_opac" id="lib_opac" value="[% lib_opac | html %]" maxlength="200" />
89
            [% IF can_be_translated %]
89
            [% IF can_be_translated %]
90
                [% IF action_modify %]
90
                [% IF action_modify %]
91
                    <a href="/cgi-bin/koha/admin/localization.pl?entity=avs&code=[% authorised_value | uri %]&interface=opac" title="Translate OPAC description" rel="gb_page_center[600,500]"><i class="fa fa-pencil"></i> Translate into other languages</a>
91
                    <a href="/cgi-bin/koha/admin/localization.pl?entity=authorised_values&code=[% authorised_value | uri %]&interface=opac" title="Translate OPAC description" rel="gb_page_center[600,500]"><i class="fa fa-pencil"></i> Translate into other languages</a>
92
                [% ELSE %]
92
                [% ELSE %]
93
                    <a href="#" class="disabled" title="The authorized value has to be saved to make it translatable"><i class="fa fa-pencil"></i> Translate into other languages</a>
93
                    <a href="#" class="disabled" title="The authorized value has to be saved to make it translatable"><i class="fa fa-pencil"></i> Translate into other languages</a>
94
                [% END %]
94
                [% END %]
95
- 

Return to bug 20307