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

(-)a/C4/Biblio.pm (-1 / +1 lines)
Lines 1448-1454 sub GetAuthorisedValueDesc { Link Here
1448
        #---- itemtypes
1448
        #---- itemtypes
1449
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
1449
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "itemtypes" ) {
1450
            my $itemtype = Koha::ItemTypes->find( $value );
1450
            my $itemtype = Koha::ItemTypes->find( $value );
1451
            return $itemtype ? db_t('itemtype', $itemtype->description) : q||;
1451
            return $itemtype ? db_t('itemtype', $itemtype->itemtype) : q||;
1452
        }
1452
        }
1453
1453
1454
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "cn_source" ) {
1454
        if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "cn_source" ) {
(-)a/C4/Items.pm (-1 / +1 lines)
Lines 1723-1729 sub PrepareItemrecordDisplay { Link Here
1723
                        push @authorised_values, "";
1723
                        push @authorised_values, "";
1724
                        while ( my $itemtype = $itemtypes->next ) {
1724
                        while ( my $itemtype = $itemtypes->next ) {
1725
                            push @authorised_values, $itemtype->itemtype;
1725
                            push @authorised_values, $itemtype->itemtype;
1726
                            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description);
1726
                            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->itemtype);
1727
                        }
1727
                        }
1728
                        if ($defaultvalues && $defaultvalues->{'itemtype'}) {
1728
                        if ($defaultvalues && $defaultvalues->{'itemtype'}) {
1729
                            $defaultvalue = $defaultvalues->{'itemtype'};
1729
                            $defaultvalue = $defaultvalues->{'itemtype'};
(-)a/C4/Search.pm (-3 / +3 lines)
Lines 530-536 sub getRecords { Link Here
530
                                    && ref( $itemtypes->{$one_facet} ) eq
530
                                    && ref( $itemtypes->{$one_facet} ) eq
531
                                    "HASH" )
531
                                    "HASH" )
532
                                {
532
                                {
533
                                    $facet_label_value = db_t('itemtype', $itemtypes->{$one_facet}->{description});
533
                                    $facet_label_value = db_t('itemtype', $itemtypes->{$one_facet}->{itemtype});
534
                                }
534
                                }
535
                            }
535
                            }
536
536
Lines 1733-1739 sub searchResults { Link Here
1733
        # add imageurl to itemtype if there is one
1733
        # add imageurl to itemtype if there is one
1734
        $oldbiblio->{imageurl} = $itemtype ? getitemtypeimagelocation( $search_context->{'interface'}, $itemtype->{imageurl} ) : q{};
1734
        $oldbiblio->{imageurl} = $itemtype ? getitemtypeimagelocation( $search_context->{'interface'}, $itemtype->{imageurl} ) : q{};
1735
        # Build summary if there is one (the summary is defined in the itemtypes table)
1735
        # Build summary if there is one (the summary is defined in the itemtypes table)
1736
        $oldbiblio->{description} = $itemtype ? db_t('itemtype', $itemtype->{description}) : q{};
1736
        $oldbiblio->{description} = $itemtype ? db_t('itemtype', $itemtype->{itemtype}) : q{};
1737
1737
1738
        # Pull out the items fields
1738
        # Pull out the items fields
1739
        my @fields = $marcrecord->field($itemtag);
1739
        my @fields = $marcrecord->field($itemtag);
Lines 1799-1805 sub searchResults { Link Here
1799
            foreach my $code ( keys %subfieldstosearch ) {
1799
            foreach my $code ( keys %subfieldstosearch ) {
1800
                $item->{$code} = $field->subfield( $subfieldstosearch{$code} );
1800
                $item->{$code} = $field->subfield( $subfieldstosearch{$code} );
1801
            }
1801
            }
1802
            $item->{description} = db_t('itemtype', $itemtypes{ $item->{itype} }{description}) if $item->{itype};
1802
            $item->{description} = db_t('itemtype', $itemtypes{ $item->{itype} }{itemtype}) if $item->{itype};
1803
1803
1804
	        # OPAC hidden items
1804
	        # OPAC hidden items
1805
            if ($is_opac) {
1805
            if ($is_opac) {
(-)a/Koha/DBIx/Component/L10nSource.pm (-12 / +15 lines)
Lines 49-67 Update or create an entry in l10n_source Link Here
49
=cut
49
=cut
50
50
51
sub update_l10n_source {
51
sub update_l10n_source {
52
    my ($self, $group, $key, $text) = @_;
52
    my ( $self, $group, $key, $source_text ) = @_;
53
53
54
    my $l10n_source_rs = $self->result_source->schema->resultset('L10nSource');
54
    my $l10n_source_rs =
55
    $l10n_source_rs->update_or_create(
55
      $self->result_source->schema->resultset('L10nSource')
56
        {
56
      ->find( { group => $group, key => $key }, { key => 'group_key' } );
57
            group => $group,
57
58
            key   => $key,
58
    if ($l10n_source_rs) {
59
            text  => $text,
59
        $l10n_source_rs->update( { text => $source_text } );
60
        },
60
        my $l10n_target_rs = $l10n_source_rs->l10n_targets_rs;
61
        {
61
        $l10n_target_rs->update( { fuzzy => 1 } );
62
            key => 'group_key',
62
    }
63
        }
63
    else {
64
    );
64
        $l10n_source_rs =
65
          $self->result_source->schema->resultset('L10nSource')
66
          ->create( { group => $group, key => $key, text => $source_text } );
67
    }
65
}
68
}
66
69
67
=head2 delete_l10n_source
70
=head2 delete_l10n_source
(-)a/Koha/I18N.pm (-15 / +14 lines)
Lines 228-246 sub _expand { Link Here
228
228
229
=head2 db_t
229
=head2 db_t
230
230
231
    db_t($group, $text)
231
    db_t($group, $key)
232
    db_t('itemtype', $itemtype->description)
232
    db_t('itemtype', $itemtype->translation_key)
233
233
234
Search for a translation in l10n_target table and return it if found
234
Search for a translation in l10n_target table and return it if found
235
Return C<$text> otherwise
235
Return untranslated original text otherwise.
236
236
237
=cut
237
=cut
238
238
239
sub db_t {
239
sub db_t {
240
    my ($group, $text) = @_;
240
    my ($group, $key) = @_;
241
241
242
    my $cache = Koha::Caches->get_instance();
242
    my $cache = Koha::Caches->get_instance();
243
    unless ($cache->is_cache_active) {
243
    unless ($cache->is_cache_active) {
244
        warn "Using Koha::Cache::Memory::Lite";
244
        $cache = Koha::Cache::Memory::Lite->get_instance();
245
        $cache = Koha::Cache::Memory::Lite->get_instance();
245
    }
246
    }
246
247
Lines 249-277 sub db_t { Link Here
249
    my $translations = $cache->get_from_cache($cache_key);
250
    my $translations = $cache->get_from_cache($cache_key);
250
    unless ($translations) {
251
    unless ($translations) {
251
        my $schema = Koha::Database->new->schema;
252
        my $schema = Koha::Database->new->schema;
252
        my $rs = $schema->resultset('L10nTarget');
253
        my $rs = $schema->resultset('L10nSource');
253
254
254
        my @targets = $rs->search(
255
        my @targets = $rs->search(
255
            {
256
            {
256
                'l10n_source.group' => $group,
257
                'group' => $group,
257
                language => $language,
258
                'l10n_target.language' => $language,
258
            },
259
            },
259
            {
260
            {
260
                join => 'l10n_source',
261
                join => 'l10n_target',
261
                prefetch => 'l10n_source',
262
                prefetch => 'l10n_target',
262
                result_class => 'DBIx::Class::ResultClass::HashRefInflator',
263
                result_class => 'DBIx::Class::ResultClass::HashRefInflator',
263
            },
264
            },
264
        );
265
        );
265
        $translations = { map { $_->{l10n_source}->{text} => $_->{translation} } @targets };
266
        $translations =
267
          { map { $_->{key} => $_->{l10n_targets}->[0]{translation} //= $_->{text} }
268
              @targets };
266
269
267
        $cache->set_in_cache($cache_key, $translations);
270
        $cache->set_in_cache($cache_key, $translations);
268
    }
271
    }
269
272
270
    if (exists $translations->{$text}) {
273
    return $translations->{$key};
271
        return $translations->{$text};
272
    }
273
274
    return $text;
275
}
274
}
276
275
277
1;
276
1;
(-)a/Koha/Schema/Result/Itemtype.pm (-6 / +6 lines)
Lines 356-362 sub insert { Link Here
356
356
357
    my $result = $self->next::method(@_);
357
    my $result = $self->next::method(@_);
358
358
359
    $self->update_l10n_source('itemtype', $self->itemtype, $self->description);
359
    $self->update_l10n_source( 'itemtype', $self->itemtype, $self->description );
360
360
361
    return $result;
361
    return $result;
362
}
362
}
Lines 366-386 sub update { Link Here
366
366
367
    my $is_description_changed = $self->is_column_changed('description');
367
    my $is_description_changed = $self->is_column_changed('description');
368
368
369
    my $result = $self->next::method(@_);
370
371
    if ($is_description_changed) {
369
    if ($is_description_changed) {
372
        $self->update_l10n_source('itemtype', $self->itemtype, $self->description);
370
        $self->update_l10n_source( 'itemtype', $self->itemtype, $self->description );
373
    }
371
    }
374
372
373
    my $result = $self->next::method(@_);
374
375
    return $result;
375
    return $result;
376
}
376
}
377
377
378
sub delete {
378
sub delete {
379
    my $self = shift;
379
    my $self = shift;
380
380
381
    my $result = $self->next::method(@_);
381
    $self->delete_l10n_source( 'itemtype', $self->itemtype );
382
382
383
    $self->delete_l10n_source('itemtype', $self->itemtype);
383
    my $result = $self->next::method(@_);
384
384
385
    return $result;
385
    return $result;
386
}
386
}
(-)a/Koha/Template/Plugin/ItemTypes.pm (-2 / +2 lines)
Lines 39-47 sub Get { Link Here
39
}
39
}
40
40
41
sub t {
41
sub t {
42
    my ($self, $description) = @_;
42
    my ($self, $key) = @_;
43
43
44
    return db_t('itemtype', $description);
44
    return db_t('itemtype', $key);
45
}
45
}
46
46
47
1;
47
1;
(-)a/acqui/orderreceive.pl (-1 lines)
Lines 115-121 unless($acq_fw) { Link Here
115
    $template->param('NoACQframework' => 1);
115
    $template->param('NoACQframework' => 1);
116
}
116
}
117
117
118
119
my $creator = Koha::Patrons->find( $order->created_by );
118
my $creator = Koha::Patrons->find( $order->created_by );
120
119
121
my $budget = GetBudget( $order->budget_id );
120
my $budget = GetBudget( $order->budget_id );
(-)a/authorities/authorities.pl (-1 / +1 lines)
Lines 88-94 sub build_authorized_values_list { Link Here
88
          unless ( $tagslib->{$tag}->{$subfield}->{mandatory}
88
          unless ( $tagslib->{$tag}->{$subfield}->{mandatory}
89
            && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
89
            && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
90
            push @authorised_values, $itemtype->itemtype;
90
            push @authorised_values, $itemtype->itemtype;
91
            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description);
91
            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->itemtype);
92
        }
92
        }
93
    }
93
    }
94
    else { # "true" authorised value
94
    else { # "true" authorised value
(-)a/catalogue/getitem-ajax.pl (-1 / +1 lines)
Lines 76-82 if($itemnumber) { Link Here
76
76
77
    my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
77
    my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
78
    # We should not do that here, but call ->itemtype->description when needed instea
78
    # We should not do that here, but call ->itemtype->description when needed instea
79
    $item_unblessed->{itemtype} = db_t('itemtype', $itemtype->description);
79
    $item_unblessed->{itemtype} = db_t('itemtype', $itemtype->itemtype);
80
}
80
}
81
81
82
my $json_text = to_json( $item_unblessed, { utf8 => 1 } );
82
my $json_text = to_json( $item_unblessed, { utf8 => 1 } );
(-)a/catalogue/itemsearch.pl (-1 / +1 lines)
Lines 282-288 my @itemtypes; Link Here
282
foreach my $itemtype ( Koha::ItemTypes->search->as_list ) {
282
foreach my $itemtype ( Koha::ItemTypes->search->as_list ) {
283
    push @itemtypes, {
283
    push @itemtypes, {
284
        value => $itemtype->itemtype,
284
        value => $itemtype->itemtype,
285
        label => db_t('itemtype', $itemtype->description),
285
        label => db_t('itemtype', $itemtype->itemtype),
286
    };
286
    };
287
}
287
}
288
288
(-)a/catalogue/moredetail.pl (-2 / +2 lines)
Lines 145-151 my $copynumbers = Link Here
145
145
146
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
146
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
147
147
148
$data->{'itemtypename'} = db_t('itemtype', $itemtypes->{ $data->{'itemtype'} }->{description})
148
$data->{'itemtypename'} = db_t('itemtype', $itemtypes->{ $data->{'itemtype'} }->{itemtype})
149
  if $data->{itemtype} && exists $itemtypes->{ $data->{itemtype} };
149
  if $data->{itemtype} && exists $itemtypes->{ $data->{itemtype} };
150
foreach ( keys %{$data} ) {
150
foreach ( keys %{$data} ) {
151
    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
151
    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
Lines 155-161 foreach ( keys %{$data} ) { Link Here
155
foreach my $item (@items){
155
foreach my $item (@items){
156
    $item->{object} = Koha::Items->find( $item->{itemnumber} );
156
    $item->{object} = Koha::Items->find( $item->{itemnumber} );
157
    $item->{'collection'}              = $ccodes->{ $item->{ccode} } if $ccodes && $item->{ccode} && exists $ccodes->{ $item->{ccode} };
157
    $item->{'collection'}              = $ccodes->{ $item->{ccode} } if $ccodes && $item->{ccode} && exists $ccodes->{ $item->{ccode} };
158
    $item->{'itype'}                   = db_t('itemtype', $itemtypes->{ $item->{'itype'} }->{description}) if exists $itemtypes->{ $item->{'itype'} };
158
    $item->{'itype'}                   = db_t('itemtype', $itemtypes->{ $item->{'itype'} }->{itemtype}) if exists $itemtypes->{ $item->{'itype'} };
159
    $item->{'replacementprice'}        = $item->{'replacementprice'};
159
    $item->{'replacementprice'}        = $item->{'replacementprice'};
160
    if ( defined $item->{'copynumber'} ) {
160
    if ( defined $item->{'copynumber'} ) {
161
        $item->{'displaycopy'} = 1;
161
        $item->{'displaycopy'} = 1;
(-)a/catalogue/search.pl (-1 / +1 lines)
Lines 734-740 sub prepare_adv_search_types { Link Here
734
        map {
734
        map {
735
            $_->{itemtype} => {
735
            $_->{itemtype} => {
736
                %$_,
736
                %$_,
737
                description => db_t( 'itemtype', $_->{description} ),
737
                description => db_t( 'itemtype', $_->{itemtype} ),
738
              }
738
              }
739
        } @{ Koha::ItemTypes->search->unblessed }
739
        } @{ Koha::ItemTypes->search->unblessed }
740
    };
740
    };
(-)a/cataloguing/addbiblio.pl (-1 / +1 lines)
Lines 196-202 sub build_authorized_values_list { Link Here
196
        my $itemtypes = Koha::ItemTypes->search;
196
        my $itemtypes = Koha::ItemTypes->search;
197
        while ( $itemtype = $itemtypes->next ) {
197
        while ( $itemtype = $itemtypes->next ) {
198
            push @authorised_values, $itemtype->itemtype;
198
            push @authorised_values, $itemtype->itemtype;
199
            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description);
199
            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->itemtype);
200
        }
200
        }
201
        $value = $itemtype unless ($value);
201
        $value = $itemtype unless ($value);
202
    }
202
    }
(-)a/circ/transferstoreceive.pl (-1 / +1 lines)
Lines 88-94 while ( my $library = $libraries->next ) { Link Here
88
            my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
88
            my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
89
89
90
            $getransf{'datetransfer'} = $num->{'datesent'};
90
            $getransf{'datetransfer'} = $num->{'datesent'};
91
            $getransf{'itemtype'} = db_t('itemtype', $itemtype->description);
91
            $getransf{'itemtype'} = db_t('itemtype', $itemtype->itemtype);
92
            %getransf = (
92
            %getransf = (
93
                %getransf,
93
                %getransf,
94
                title          => $biblio->title,
94
                title          => $biblio->title,
(-)a/installer/data/mysql/atomicupdate/bug-24975.perl (-10 / +10 lines)
Lines 2-26 $DBversion = 'XXX'; Link Here
2
if( CheckVersion( $DBversion ) ) {
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
3
    $dbh->do(q{
4
        CREATE TABLE IF NOT EXISTS l10n_source (
4
        CREATE TABLE IF NOT EXISTS l10n_source (
5
            l10n_source_id INT(11) NOT NULL AUTO_INCREMENT,
5
            `l10n_source_id` INT(11) NOT NULL AUTO_INCREMENT,
6
            `group` VARCHAR(100) NULL DEFAULT NULL,
6
            `group` VARCHAR(100) NULL DEFAULT NULL,
7
            `key` VARCHAR(100) NOT NULL,
7
            `key` VARCHAR(100) NOT NULL,
8
            `text` TEXT NOT NULL,
8
            `text` TEXT NOT NULL,
9
            PRIMARY KEY (l10n_source_id),
9
            PRIMARY KEY (l10n_source_id),
10
            UNIQUE KEY group_key (`group`, `key`),
10
            UNIQUE KEY group_text (`group`, `key`)
11
            KEY group_text (`group`, `text`(60))
12
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
11
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
13
    });
12
    });
14
13
15
    $dbh->do(q{
14
    $dbh->do(q{
16
        CREATE TABLE IF NOT EXISTS l10n_target (
15
        CREATE TABLE IF NOT EXISTS l10n_target (
17
            l10n_target_id INT(11) NOT NULL AUTO_INCREMENT,
16
            `l10n_target_id` INT(11) NOT NULL AUTO_INCREMENT,
18
            l10n_source_id INT(11) NOT NULL,
17
            `l10n_source_id` INT(11) NOT NULL,
19
            language VARCHAR(10) NOT NULL,
18
            `language` VARCHAR(10) NOT NULL,
20
            translation TEXT NOT NULL,
19
            `translation` TEXT NOT NULL,
20
            `fuzzy` tinyint(1) NOT NULL DEFAULT 0,
21
            PRIMARY KEY (l10n_target_id),
21
            PRIMARY KEY (l10n_target_id),
22
            UNIQUE KEY l10n_source_language (l10n_source_id, language),
22
            UNIQUE KEY l10n_source_language (l10n_source_id, language),
23
            FOREIGN KEY l10n_source (l10n_source_id) REFERENCES l10n_source (l10n_source_id)
23
            CONSTRAINT `l10n_target_fk` FOREIGN KEY (`l10n_source_id`) REFERENCES `l10n_source` (`l10n_source_id`)
24
                ON DELETE CASCADE ON UPDATE CASCADE
24
                ON DELETE CASCADE ON UPDATE CASCADE
25
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
25
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
26
    });
26
    });
Lines 37-47 if( CheckVersion( $DBversion ) ) { Link Here
37
            SELECT DISTINCT l10n_source_id, lang, translation
37
            SELECT DISTINCT l10n_source_id, lang, translation
38
            FROM localization
38
            FROM localization
39
            JOIN itemtypes ON (localization.code = itemtypes.itemtype)
39
            JOIN itemtypes ON (localization.code = itemtypes.itemtype)
40
            JOIN l10n_source ON (itemtypes.itemtype = l10n_source.`key` AND l10n_source.`group` = 'itemtype')
40
            JOIN l10n_source ON (itemtypes.description = l10n_source.`text` AND l10n_source.`group` = 'itemtype')
41
            WHERE entity = 'itemtypes'
41
            WHERE entity = 'itemtypes'
42
        });
42
        });
43
43
44
        $dbh->do('DROP TABLE localization');
44
        #$dbh->do('DROP TABLE localization');
45
    }
45
    }
46
46
47
47
(-)a/installer/data/mysql/kohastructure.sql (-9 / +18 lines)
Lines 3203-3231 CREATE TABLE `keyboard_shortcuts` ( Link Here
3203
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3203
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3204
/*!40101 SET character_set_client = @saved_cs_client */;
3204
/*!40101 SET character_set_client = @saved_cs_client */;
3205
3205
3206
--
3207
-- Table structure for table `l10n_source`
3208
--
3206
3209
3207
DROP TABLE IF EXISTS l10n_source;
3210
DROP TABLE IF EXISTS l10n_source;
3208
CREATE TABLE l10n_source (
3211
CREATE TABLE l10n_source (
3209
    l10n_source_id INT(11) NOT NULL AUTO_INCREMENT,
3212
    `l10n_source_id` INT(11) NOT NULL AUTO_INCREMENT,
3210
    `group` VARCHAR(100) NULL DEFAULT NULL,
3213
    `group` VARCHAR(100) NULL DEFAULT NULL,
3211
    `key` VARCHAR(100) NOT NULL,
3214
    `key` VARCHAR(100) NOT NULL,
3212
    `text` TEXT NOT NULL,
3215
    `text` TEXT NOT NULL,
3213
    PRIMARY KEY (l10n_source_id),
3216
    PRIMARY KEY (l10n_source_id),
3214
    UNIQUE KEY group_key (`group`, `key`),
3217
    UNIQUE KEY group_key (`group`, `key`)
3215
    KEY group_text (`group`, `text`(60))
3216
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
3218
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
3219
/*!40101 SET character_set_client = @saved_cs_client */;
3220
3221
--
3222
-- Table structure for table `l10n_target`
3223
--
3217
3224
3218
DROP TABLE IF EXISTS l10n_target;
3225
DROP TABLE IF EXISTS l10n_target;
3219
CREATE TABLE l10n_target (
3226
CREATE TABLE l10n_target (
3220
    l10n_target_id INT(11) NOT NULL AUTO_INCREMENT,
3227
    `l10n_target_id` INT(11) NOT NULL AUTO_INCREMENT,
3221
    l10n_source_id INT(11) NOT NULL,
3228
    `l10n_source_id` INT(11) NOT NULL,
3222
    language VARCHAR(10) NOT NULL,
3229
    `language` VARCHAR(10) NOT NULL,
3223
    translation TEXT NOT NULL,
3230
    `translation` TEXT NOT NULL,
3231
    `fuzzy` tinyint(1) NOT NULL DEFAULT 0,
3224
    PRIMARY KEY (l10n_target_id),
3232
    PRIMARY KEY (l10n_target_id),
3225
    UNIQUE KEY l10n_source_language (l10n_source_id, language),
3233
    UNIQUE KEY l10n_source_language (l10n_source_id, language),
3226
    FOREIGN KEY l10n_source (l10n_source_id) REFERENCES l10n_source (l10n_source_id)
3234
    CONSTRAINT `l10n_target_fk` FOREIGN KEY (`l10n_source_id`) REFERENCES `l10n_source` (`l10n_source_id`)
3227
        ON DELETE CASCADE ON UPDATE CASCADE
3235
        ON DELETE CASCADE ON UPDATE CASCADE
3228
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
3236
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
3237
/*!40101 SET character_set_client = @saved_cs_client */;
3229
3238
3230
--
3239
--
3231
-- Table structure for table `language_descriptions`
3240
-- Table structure for table `language_descriptions`
Lines 4526-4532 CREATE TABLE `saved_sql` ( Link Here
4526
/*!40101 SET character_set_client = @saved_cs_client */;
4535
/*!40101 SET character_set_client = @saved_cs_client */;
4527
4536
4528
--
4537
--
4529
-- Table structure for table `search_field`
4538
4530
--
4539
--
4531
4540
4532
DROP TABLE IF EXISTS `search_field`;
4541
DROP TABLE IF EXISTS `search_field`;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt (+5 lines)
Lines 46-51 Link Here
46
                        <thead>
46
                        <thead>
47
                            <tr>
47
                            <tr>
48
                                <th>Group</th>
48
                                <th>Group</th>
49
                                <th>Key</th>
49
                                <th>Text</th>
50
                                <th>Text</th>
50
                                <th>Translations</th>
51
                                <th>Translations</th>
51
                            </tr>
52
                            </tr>
Lines 92-97 Link Here
92
                        name: 'group',
93
                        name: 'group',
93
                        data: 'group',
94
                        data: 'group',
94
                    },
95
                    },
96
                    {
97
                        name: 'key',
98
                        data: 'key',
99
                    },
95
                    {
100
                    {
96
                        name: 'text',
101
                        name: 'text',
97
                        data: 'text',
102
                        data: 'text',
(-)a/opac/opac-detail.pl (-2 / +2 lines)
Lines 546-552 my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unble Link Here
546
my $itemtype = $dat->{'itemtype'};
546
my $itemtype = $dat->{'itemtype'};
547
if ( $itemtype ) {
547
if ( $itemtype ) {
548
    $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
548
    $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
549
    $dat->{'description'} = db_t('itemtype', $itemtypes->{$itemtype}->{description});
549
    $dat->{'description'} = db_t('itemtype', $itemtypes->{$itemtype}->{itemtype});
550
}
550
}
551
551
552
my $shelflocations =
552
my $shelflocations =
Lines 725-731 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
725
    }
725
    }
726
    if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
726
    if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
727
        $itm->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
727
        $itm->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
728
        $itm->{'description'} = db_t('itemtype', $itemtypes->{ $itm->{itype} }->{description});
728
        $itm->{'description'} = db_t('itemtype', $itemtypes->{ $itm->{itype} }->{itemtype});
729
    }
729
    }
730
    foreach (qw(ccode materials enumchron copynumber itemnotes location_description uri)) {
730
    foreach (qw(ccode materials enumchron copynumber itemnotes location_description uri)) {
731
        $itemfields{$_} = 1 if ($itm->{$_});
731
        $itemfields{$_} = 1 if ($itm->{$_});
(-)a/opac/opac-search.pl (-1 / +1 lines)
Lines 231-237 foreach my $itemtype ( keys %{$itemtypes} ) { Link Here
231
    # If 'iscat' (see ITEMTYPECAT) then there is no itemtype and the description is not translated
231
    # If 'iscat' (see ITEMTYPECAT) then there is no itemtype and the description is not translated
232
    my $description = $itemtypes->{$itemtype}->{iscat}
232
    my $description = $itemtypes->{$itemtype}->{iscat}
233
      ? $itemtypes->{$itemtype}->{description}
233
      ? $itemtypes->{$itemtype}->{description}
234
      : db_t('itemtype', Koha::ItemTypes->find($itemtype)->description);
234
      : db_t('itemtype', Koha::ItemTypes->find($itemtype)->itemtype);
235
    $itemtypes->{$itemtype}->{description} = $description || $itemtypes->{$itemtype}->{description} || q{};
235
    $itemtypes->{$itemtype}->{description} = $description || $itemtypes->{$itemtype}->{description} || q{};
236
}
236
}
237
237
(-)a/reports/issues_stats.pl (-2 / +2 lines)
Lines 351-357 sub calculate { Link Here
351
        $cell{rowtitle_display} =
351
        $cell{rowtitle_display} =
352
            ( $line =~ /ccode/ )    ? $ccodes->{$celvalue}
352
            ( $line =~ /ccode/ )    ? $ccodes->{$celvalue}
353
          : ( $line =~ /location/ ) ? $locations->{$celvalue}
353
          : ( $line =~ /location/ ) ? $locations->{$celvalue}
354
          : ( $line =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{description})
354
          : ( $line =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{itemtype})
355
          :                           $celvalue;                               # default fallback
355
          :                           $celvalue;                               # default fallback
356
        if ( $line =~ /sort1/ ) {
356
        if ( $line =~ /sort1/ ) {
357
            foreach (@$Bsort1) {
357
            foreach (@$Bsort1) {
Lines 440-446 sub calculate { Link Here
440
        $cell{coltitle_display} =
440
        $cell{coltitle_display} =
441
            ( $column =~ /ccode/ )    ? $ccodes->{$celvalue}
441
            ( $column =~ /ccode/ )    ? $ccodes->{$celvalue}
442
          : ( $column =~ /location/ ) ? $locations->{$celvalue}
442
          : ( $column =~ /location/ ) ? $locations->{$celvalue}
443
          : ( $column =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{description})
443
          : ( $column =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{itemtype})
444
          :                             $celvalue;                               # default fallback
444
          :                             $celvalue;                               # default fallback
445
        if ( $column =~ /sort1/ ) {
445
        if ( $column =~ /sort1/ ) {
446
            foreach (@$Bsort1) {
446
            foreach (@$Bsort1) {
(-)a/reports/reserves_stats.pl (-1 / +1 lines)
Lines 309-315 sub display_value { Link Here
309
    my $display_value =
309
    my $display_value =
310
        ( $crit =~ /ccode/ )         ? $ccodes->{$value}
310
        ( $crit =~ /ccode/ )         ? $ccodes->{$value}
311
      : ( $crit =~ /location/ )      ? $locations->{$value}
311
      : ( $crit =~ /location/ )      ? $locations->{$value}
312
      : ( $crit =~ /itemtype/ )      ? db_t('itemtype', Koha::ItemTypes->find( $value )->description)
312
      : ( $crit =~ /itemtype/ )      ? db_t('itemtype', Koha::ItemTypes->find( $value )->itemtype)
313
      : ( $crit =~ /branch/ )        ? Koha::Libraries->find($value)->branchname
313
      : ( $crit =~ /branch/ )        ? Koha::Libraries->find($value)->branchname
314
      : ( $crit =~ /reservestatus/ ) ? reservestatushuman($value)
314
      : ( $crit =~ /reservestatus/ ) ? reservestatushuman($value)
315
      :                                $value;    # default fallback
315
      :                                $value;    # default fallback
(-)a/svc/checkouts (-1 / +1 lines)
Lines 147-153 my $item_level_itypes = C4::Context->preference('item-level_itypes'); Link Here
147
my $claims_returned_lost_value = C4::Context->preference('ClaimReturnedLostValue');
147
my $claims_returned_lost_value = C4::Context->preference('ClaimReturnedLostValue');
148
my $confirm_parts_required = C4::Context->preference("CircConfirmItemParts");
148
my $confirm_parts_required = C4::Context->preference("CircConfirmItemParts");
149
149
150
my $itemtypes = { map { $_->{itemtype} => db_t('itemtypes', $_->{itemtype}) } @{ Koha::ItemTypes->search->unblessed } };
150
my $itemtypes = { map { $_->{itemtype} => db_t('itemtype', $_->{itemtype}) } @{ Koha::ItemTypes->search->unblessed } };
151
151
152
my @checkouts_today;
152
my @checkouts_today;
153
my @checkouts_previous;
153
my @checkouts_previous;
(-)a/svc/holds (-2 / +1 lines)
Lines 82-88 while ( my $h = $holds_rs->next() ) { Link Here
82
    my $itemtype_limit;
82
    my $itemtype_limit;
83
    if ( $h->itemtype ) {
83
    if ( $h->itemtype ) {
84
        my $itemtype = Koha::ItemTypes->find( $h->itemtype );
84
        my $itemtype = Koha::ItemTypes->find( $h->itemtype );
85
        $itemtype_limit = db_t('itemtype', $itemtype->description);
85
        $itemtype_limit = db_t('itemtype', $itemtype->itemtype);
86
    }
86
    }
87
87
88
    my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
88
    my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
89
- 

Return to bug 24975