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

(-)a/C4/Biblio.pm (-1 / +1 lines)
Lines 1414-1420 sub GetAuthorisedValueDesc { Link Here
1414
            my $itypes = $cache->get_from_cache( $cache_key, { unsafe => 1 } );
1414
            my $itypes = $cache->get_from_cache( $cache_key, { unsafe => 1 } );
1415
            if ( !$itypes ) {
1415
            if ( !$itypes ) {
1416
                $itypes =
1416
                $itypes =
1417
                  { map { $_->itemtype => db_t('itemtype', $itemtype->description) }
1417
                  { map { $_->itemtype => db_t('itemtype', $itemtype->itemtype) }
1418
                      Koha::ItemTypes->search()->as_list };
1418
                      Koha::ItemTypes->search()->as_list };
1419
                $cache->set_in_cache( $cache_key, $itypes );
1419
                $cache->set_in_cache( $cache_key, $itypes );
1420
            }
1420
            }
(-)a/C4/Items.pm (-1 / +1 lines)
Lines 1464-1470 sub PrepareItemrecordDisplay { Link Here
1464
                        push @authorised_values, "";
1464
                        push @authorised_values, "";
1465
                        while ( my $itemtype = $itemtypes->next ) {
1465
                        while ( my $itemtype = $itemtypes->next ) {
1466
                            push @authorised_values, $itemtype->itemtype;
1466
                            push @authorised_values, $itemtype->itemtype;
1467
                            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description);
1467
                            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->itemtype);
1468
                        }
1468
                        }
1469
                        if ($defaultvalues && $defaultvalues->{'itemtype'}) {
1469
                        if ($defaultvalues && $defaultvalues->{'itemtype'}) {
1470
                            $defaultvalue = $defaultvalues->{'itemtype'};
1470
                            $defaultvalue = $defaultvalues->{'itemtype'};
(-)a/C4/Search.pm (-3 / +3 lines)
Lines 539-545 sub getRecords { Link Here
539
                                    && ref( $itemtypes->{$one_facet} ) eq
539
                                    && ref( $itemtypes->{$one_facet} ) eq
540
                                    "HASH" )
540
                                    "HASH" )
541
                                {
541
                                {
542
                                    $facet_label_value = db_t('itemtype', $itemtypes->{$one_facet}->{description});
542
                                    $facet_label_value = db_t('itemtype', $itemtypes->{$one_facet}->{itemtype});
543
                                }
543
                                }
544
                            }
544
                            }
545
545
Lines 1751-1757 sub searchResults { Link Here
1751
        # add imageurl to itemtype if there is one
1751
        # add imageurl to itemtype if there is one
1752
        $oldbiblio->{imageurl} = $itemtype ? getitemtypeimagelocation( $search_context->{'interface'}, $itemtype->{imageurl} ) : q{};
1752
        $oldbiblio->{imageurl} = $itemtype ? getitemtypeimagelocation( $search_context->{'interface'}, $itemtype->{imageurl} ) : q{};
1753
        # Build summary if there is one (the summary is defined in the itemtypes table)
1753
        # Build summary if there is one (the summary is defined in the itemtypes table)
1754
        $oldbiblio->{description} = $itemtype ? db_t('itemtype', $itemtype->{description}) : q{};
1754
        $oldbiblio->{description} = $itemtype ? db_t('itemtype', $itemtype->{itemtype}) : q{};
1755
1755
1756
        # Pull out the items fields
1756
        # Pull out the items fields
1757
        my @fields = $marcrecord->field($itemtag);
1757
        my @fields = $marcrecord->field($itemtag);
Lines 1823-1829 sub searchResults { Link Here
1823
                next;
1823
                next;
1824
            }
1824
            }
1825
1825
1826
            $item->{description} = db_t('itemtype', $itemtypes{ $item->{itype} }{description}) if $item->{itype};
1826
            $item->{description} = db_t('itemtype', $itemtypes{ $item->{itype} }{itemtype}) if $item->{itype};
1827
1827
1828
            # OPAC hidden items
1828
            # OPAC hidden items
1829
            if ($is_opac) {
1829
            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 40-48 sub Get { Link Here
40
}
40
}
41
41
42
sub t {
42
sub t {
43
    my ($self, $description) = @_;
43
    my ($self, $key) = @_;
44
44
45
    return db_t('itemtype', $description);
45
    return db_t('itemtype', $key);
46
}
46
}
47
47
48
1;
48
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 73-79 sub build_authorized_values_list { Link Here
73
          unless ( $tagslib->{$tag}->{$subfield}->{mandatory}
73
          unless ( $tagslib->{$tag}->{$subfield}->{mandatory}
74
            && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
74
            && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
75
            push @authorised_values, $itemtype->itemtype;
75
            push @authorised_values, $itemtype->itemtype;
76
            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description);
76
            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->itemtype);
77
        }
77
        }
78
    }
78
    }
79
    else { # "true" authorised value
79
    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 283-289 my @itemtypes; Link Here
283
foreach my $itemtype ( Koha::ItemTypes->search->as_list ) {
283
foreach my $itemtype ( Koha::ItemTypes->search->as_list ) {
284
    push @itemtypes, {
284
    push @itemtypes, {
285
        value => $itemtype->itemtype,
285
        value => $itemtype->itemtype,
286
        label => db_t('itemtype', $itemtype->description),
286
        label => db_t('itemtype', $itemtype->itemtype),
287
    };
287
    };
288
}
288
}
289
289
(-)a/catalogue/moredetail.pl (-3 / +2 lines)
Lines 141-147 my $copynumbers = Link Here
141
141
142
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
142
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
143
143
144
$data->{'itemtypename'} = db_t('itemtype', $itemtypes->{ $data->{'itemtype'} }->{description})
144
$data->{'itemtypename'} = db_t('itemtype', $itemtypes->{ $data->{'itemtype'} }->{itemtype})
145
  if $data->{itemtype} && exists $itemtypes->{ $data->{itemtype} };
145
  if $data->{itemtype} && exists $itemtypes->{ $data->{itemtype} };
146
foreach ( keys %{$data} ) {
146
foreach ( keys %{$data} ) {
147
    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
147
    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
Lines 155-162 foreach my $item (@items){ Link Here
155
155
156
    my $item_info = $item->unblessed;
156
    my $item_info = $item->unblessed;
157
    $item_info->{object} = $item;
157
    $item_info->{object} = $item;
158
    $item_info->{itype} = $itemtypes->{ $item->itype }->{'translated_description'} if exists $itemtypes->{ $item->itype };
158
    $item_info->{itype}                = db_t('itemtype', $itemtypes->{ $item_info->{itype} }->{itemtype}) if exists $itemtypes->{ $item_info->{itype} };
159
    $item_info->{itype}                = db_t('itemtype', $itemtypes->{ $item_info->{itype} }->{description}) if exists $itemtypes->{ $item_info->{itype} };
160
    $item_info->{effective_itemtype} = $itemtypes->{$item->effective_itemtype};
159
    $item_info->{effective_itemtype} = $itemtypes->{$item->effective_itemtype};
161
    $item_info->{'ccode'}              = $ccodes->{ $item->ccode } if $ccodes && $item->ccode && exists $ccodes->{ $item->ccode };
160
    $item_info->{'ccode'}              = $ccodes->{ $item->ccode } if $ccodes && $item->ccode && exists $ccodes->{ $item->ccode };
162
    if ( defined $item->copynumber ) {
161
    if ( defined $item->copynumber ) {
(-)a/catalogue/search.pl (-1 / +1 lines)
Lines 815-821 sub prepare_adv_search_types { Link Here
815
        map {
815
        map {
816
            $_->{itemtype} => {
816
            $_->{itemtype} => {
817
                %$_,
817
                %$_,
818
                description => db_t( 'itemtype', $_->{description} ),
818
                description => db_t( 'itemtype', $_->{itemtype} ),
819
              }
819
              }
820
        } @{ Koha::ItemTypes->search->unblessed }
820
        } @{ Koha::ItemTypes->search->unblessed }
821
    };
821
    };
(-)a/cataloguing/addbiblio.pl (-1 / +1 lines)
Lines 201-207 sub build_authorized_values_list { Link Here
201
        my $itemtypes = Koha::ItemTypes->search;
201
        my $itemtypes = Koha::ItemTypes->search;
202
        while ( $itemtype = $itemtypes->next ) {
202
        while ( $itemtype = $itemtypes->next ) {
203
            push @authorised_values, $itemtype->itemtype;
203
            push @authorised_values, $itemtype->itemtype;
204
            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description);
204
            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->itemtype);
205
        }
205
        }
206
        $value = $itemtype unless ($value);
206
        $value = $itemtype unless ($value);
207
    }
207
    }
(-)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 3754-3782 CREATE TABLE `keyboard_shortcuts` ( Link Here
3754
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3754
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3755
/*!40101 SET character_set_client = @saved_cs_client */;
3755
/*!40101 SET character_set_client = @saved_cs_client */;
3756
3756
3757
--
3758
-- Table structure for table `l10n_source`
3759
--
3757
3760
3758
DROP TABLE IF EXISTS l10n_source;
3761
DROP TABLE IF EXISTS l10n_source;
3759
CREATE TABLE l10n_source (
3762
CREATE TABLE l10n_source (
3760
    l10n_source_id INT(11) NOT NULL AUTO_INCREMENT,
3763
    `l10n_source_id` INT(11) NOT NULL AUTO_INCREMENT,
3761
    `group` VARCHAR(100) NULL DEFAULT NULL,
3764
    `group` VARCHAR(100) NULL DEFAULT NULL,
3762
    `key` VARCHAR(100) NOT NULL,
3765
    `key` VARCHAR(100) NOT NULL,
3763
    `text` TEXT NOT NULL,
3766
    `text` TEXT NOT NULL,
3764
    PRIMARY KEY (l10n_source_id),
3767
    PRIMARY KEY (l10n_source_id),
3765
    UNIQUE KEY group_key (`group`, `key`),
3768
    UNIQUE KEY group_key (`group`, `key`)
3766
    KEY group_text (`group`, `text`(60))
3767
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
3769
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
3770
/*!40101 SET character_set_client = @saved_cs_client */;
3771
3772
--
3773
-- Table structure for table `l10n_target`
3774
--
3768
3775
3769
DROP TABLE IF EXISTS l10n_target;
3776
DROP TABLE IF EXISTS l10n_target;
3770
CREATE TABLE l10n_target (
3777
CREATE TABLE l10n_target (
3771
    l10n_target_id INT(11) NOT NULL AUTO_INCREMENT,
3778
    `l10n_target_id` INT(11) NOT NULL AUTO_INCREMENT,
3772
    l10n_source_id INT(11) NOT NULL,
3779
    `l10n_source_id` INT(11) NOT NULL,
3773
    language VARCHAR(10) NOT NULL,
3780
    `language` VARCHAR(10) NOT NULL,
3774
    translation TEXT NOT NULL,
3781
    `translation` TEXT NOT NULL,
3782
    `fuzzy` tinyint(1) NOT NULL DEFAULT 0,
3775
    PRIMARY KEY (l10n_target_id),
3783
    PRIMARY KEY (l10n_target_id),
3776
    UNIQUE KEY l10n_source_language (l10n_source_id, language),
3784
    UNIQUE KEY l10n_source_language (l10n_source_id, language),
3777
    FOREIGN KEY l10n_source (l10n_source_id) REFERENCES l10n_source (l10n_source_id)
3785
    CONSTRAINT `l10n_target_fk` FOREIGN KEY (`l10n_source_id`) REFERENCES `l10n_source` (`l10n_source_id`)
3778
        ON DELETE CASCADE ON UPDATE CASCADE
3786
        ON DELETE CASCADE ON UPDATE CASCADE
3779
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
3787
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
3788
/*!40101 SET character_set_client = @saved_cs_client */;
3780
3789
3781
--
3790
--
3782
-- Table structure for table `language_descriptions`
3791
-- Table structure for table `language_descriptions`
Lines 5106-5112 CREATE TABLE `saved_sql` ( Link Here
5106
/*!40101 SET character_set_client = @saved_cs_client */;
5115
/*!40101 SET character_set_client = @saved_cs_client */;
5107
5116
5108
--
5117
--
5109
-- Table structure for table `search_field`
5118
5110
--
5119
--
5111
5120
5112
DROP TABLE IF EXISTS `search_field`;
5121
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 513-519 my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unble Link Here
513
my $itemtype = $dat->{'itemtype'};
513
my $itemtype = $dat->{'itemtype'};
514
if ( $itemtype ) {
514
if ( $itemtype ) {
515
    $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
515
    $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
516
    $dat->{'description'} = db_t('itemtype', $itemtypes->{$itemtype}->{description});
516
    $dat->{'description'} = db_t('itemtype', $itemtypes->{$itemtype}->{itemtype});
517
}
517
}
518
518
519
my $shelflocations =
519
my $shelflocations =
Lines 709-715 else { Link Here
709
        $item_info->{'imageurl'} = getitemtypeimagelocation( 'opac',
709
        $item_info->{'imageurl'} = getitemtypeimagelocation( 'opac',
710
            $itemtypes->{ $itemtype->itemtype }->{'imageurl'} );
710
            $itemtypes->{ $itemtype->itemtype }->{'imageurl'} );
711
        $item_info->{'description'} =
711
        $item_info->{'description'} =
712
          db_t('itemtype', $itemtypes->{ $itemtype->itemtype }->{description});
712
          db_t('itemtype', $itemtypes->{ $itemtype->itemtype }->{itemtype});
713
713
714
        foreach my $field (
714
        foreach my $field (
715
            qw(ccode materials enumchron copynumber itemnotes location_description uri)
715
            qw(ccode materials enumchron copynumber itemnotes location_description uri)
(-)a/opac/opac-search.pl (-1 / +1 lines)
Lines 240-246 foreach my $itemtype ( keys %{$itemtypes} ) { Link Here
240
    # If 'iscat' (see ITEMTYPECAT) then there is no itemtype and the description is not translated
240
    # If 'iscat' (see ITEMTYPECAT) then there is no itemtype and the description is not translated
241
    my $description = $itemtypes->{$itemtype}->{iscat}
241
    my $description = $itemtypes->{$itemtype}->{iscat}
242
      ? $itemtypes->{$itemtype}->{description}
242
      ? $itemtypes->{$itemtype}->{description}
243
      : db_t('itemtype', Koha::ItemTypes->find($itemtype)->description);
243
      : db_t('itemtype', Koha::ItemTypes->find($itemtype)->itemtype);
244
    $itemtypes->{$itemtype}->{description} = $description || $itemtypes->{$itemtype}->{description} || q{};
244
    $itemtypes->{$itemtype}->{description} = $description || $itemtypes->{$itemtype}->{description} || q{};
245
}
245
}
246
246
(-)a/reports/issues_stats.pl (-2 / +2 lines)
Lines 340-346 sub calculate { Link Here
340
        $cell{rowtitle_display} =
340
        $cell{rowtitle_display} =
341
            ( $line =~ /ccode/ )    ? $ccodes->{$celvalue}
341
            ( $line =~ /ccode/ )    ? $ccodes->{$celvalue}
342
          : ( $line =~ /location/ ) ? $locations->{$celvalue}
342
          : ( $line =~ /location/ ) ? $locations->{$celvalue}
343
          : ( $line =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{description})
343
          : ( $line =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{itemtype})
344
          :                           $celvalue;                               # default fallback
344
          :                           $celvalue;                               # default fallback
345
        if ( $line =~ /sort1/ ) {
345
        if ( $line =~ /sort1/ ) {
346
            foreach (@$Bsort1) {
346
            foreach (@$Bsort1) {
Lines 429-435 sub calculate { Link Here
429
        $cell{coltitle_display} =
429
        $cell{coltitle_display} =
430
            ( $column =~ /ccode/ )    ? $ccodes->{$celvalue}
430
            ( $column =~ /ccode/ )    ? $ccodes->{$celvalue}
431
          : ( $column =~ /location/ ) ? $locations->{$celvalue}
431
          : ( $column =~ /location/ ) ? $locations->{$celvalue}
432
          : ( $column =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{description})
432
          : ( $column =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{itemtype})
433
          :                             $celvalue;                               # default fallback
433
          :                             $celvalue;                               # default fallback
434
        if ( $column =~ /sort1/ ) {
434
        if ( $column =~ /sort1/ ) {
435
            foreach (@$Bsort1) {
435
            foreach (@$Bsort1) {
(-)a/reports/reserves_stats.pl (-1 / +1 lines)
Lines 299-305 sub display_value { Link Here
299
    my $display_value =
299
    my $display_value =
300
        ( $crit =~ /ccode/ )         ? $ccodes->{$value}
300
        ( $crit =~ /ccode/ )         ? $ccodes->{$value}
301
      : ( $crit =~ /location/ )      ? $locations->{$value}
301
      : ( $crit =~ /location/ )      ? $locations->{$value}
302
      : ( $crit =~ /itemtype/ )      ? db_t('itemtype', Koha::ItemTypes->find( $value )->description)
302
      : ( $crit =~ /itemtype/ )      ? db_t('itemtype', Koha::ItemTypes->find( $value )->itemtype)
303
      : ( $crit =~ /branch/ )        ? Koha::Libraries->find($value)->branchname
303
      : ( $crit =~ /branch/ )        ? Koha::Libraries->find($value)->branchname
304
      : ( $crit =~ /reservestatus/ ) ? reservestatushuman($value)
304
      : ( $crit =~ /reservestatus/ ) ? reservestatushuman($value)
305
      :                                $value;    # default fallback
305
      :                                $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