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

(-)a/Koha/AuthorisedValue.pm (-3 / +3 lines)
Lines 69-75 sub opac_translated_description { Link Here
69
    $lang ||= C4::Languages::getlanguage;
69
    $lang ||= C4::Languages::getlanguage;
70
    my $translated_description = Koha::Localizations->search({
70
    my $translated_description = Koha::Localizations->search({
71
        code => $self->authorised_value,
71
        code => $self->authorised_value,
72
        entity => 'avs',
72
        entity => 'authorised_values',
73
        lang => $lang,
73
        lang => $lang,
74
        interface => 'opac',
74
        interface => 'opac',
75
    })->next;
75
    })->next;
Lines 95-101 sub translated_description { Link Here
95
    $lang ||= C4::Languages::getlanguage;
95
    $lang ||= C4::Languages::getlanguage;
96
    my $translated_description = Koha::Localizations->search({
96
    my $translated_description = Koha::Localizations->search({
97
        code => $self->authorised_value,
97
        code => $self->authorised_value,
98
        entity => 'avs',
98
        entity => 'authorised_values',
99
        lang => $lang,
99
        lang => $lang,
100
    })->next;
100
    })->next;
101
    return $translated_description
101
    return $translated_description
Lines 110-116 sub translated_description { Link Here
110
sub translated_descriptions {
110
sub translated_descriptions {
111
    my ( $self ) = @_;
111
    my ( $self ) = @_;
112
    my @translated_descriptions = Koha::Localizations->search(
112
    my @translated_descriptions = Koha::Localizations->search(
113
        {   entity => 'avs',
113
        {   entity => 'authorised_values',
114
            code   => $self->authorised_value,
114
            code   => $self->authorised_value,
115
        }
115
        }
116
    );
116
    );
(-)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 3732-3738 CREATE TABLE `additional_field_values` ( Link Here
3732
DROP TABLE IF EXISTS localization;
3732
DROP TABLE IF EXISTS localization;
3733
CREATE TABLE `localization` (
3733
CREATE TABLE `localization` (
3734
      localization_id int(11) NOT NULL AUTO_INCREMENT,
3734
      localization_id int(11) NOT NULL AUTO_INCREMENT,
3735
      entity varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
3735
      entity varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
3736
      interface varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3736
      interface varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3737
      code varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
3737
      code varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
3738
      lang varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL, -- could be a foreign key
3738
      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