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

(-)a/C4/Biblio.pm (-1 / +2 lines)
Lines 107-112 use Koha::Acquisition::Currencies; Link Here
107
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
107
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
108
use Koha::Biblio::Metadatas;
108
use Koha::Biblio::Metadatas;
109
use Koha::Holds;
109
use Koha::Holds;
110
use Koha::I18N;
110
use Koha::ItemTypes;
111
use Koha::ItemTypes;
111
use Koha::MarcOverlayRules;
112
use Koha::MarcOverlayRules;
112
use Koha::Plugins;
113
use Koha::Plugins;
Lines 1413-1419 sub GetAuthorisedValueDesc { Link Here
1413
            my $itypes = $cache->get_from_cache( $cache_key, { unsafe => 1 } );
1414
            my $itypes = $cache->get_from_cache( $cache_key, { unsafe => 1 } );
1414
            if ( !$itypes ) {
1415
            if ( !$itypes ) {
1415
                $itypes =
1416
                $itypes =
1416
                  { map { $_->itemtype => $_->translated_description }
1417
                  { map { $_->itemtype => db_t('itemtype', $itemtype->description) }
1417
                      Koha::ItemTypes->search()->as_list };
1418
                      Koha::ItemTypes->search()->as_list };
1418
                $cache->set_in_cache( $cache_key, $itypes );
1419
                $cache->set_in_cache( $cache_key, $itypes );
1419
            }
1420
            }
(-)a/C4/Items.pm (-2 / +3 lines)
Lines 61-66 use Koha::Database; Link Here
61
61
62
use Koha::Biblios;
62
use Koha::Biblios;
63
use Koha::Biblioitems;
63
use Koha::Biblioitems;
64
use Koha::I18N;
64
use Koha::Items;
65
use Koha::Items;
65
use Koha::ItemTypes;
66
use Koha::ItemTypes;
66
use Koha::SearchEngine;
67
use Koha::SearchEngine;
Lines 1459-1469 sub PrepareItemrecordDisplay { Link Here
1459
1460
1460
                        #----- itemtypes
1461
                        #----- itemtypes
1461
                    } elsif ( $subfield->{authorised_value} eq "itemtypes" ) {
1462
                    } elsif ( $subfield->{authorised_value} eq "itemtypes" ) {
1462
                        my $itemtypes = Koha::ItemTypes->search_with_localization;
1463
                        my $itemtypes = Koha::ItemTypes->search;
1463
                        push @authorised_values, "";
1464
                        push @authorised_values, "";
1464
                        while ( my $itemtype = $itemtypes->next ) {
1465
                        while ( my $itemtype = $itemtypes->next ) {
1465
                            push @authorised_values, $itemtype->itemtype;
1466
                            push @authorised_values, $itemtype->itemtype;
1466
                            $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
1467
                            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description);
1467
                        }
1468
                        }
1468
                        if ($defaultvalues && $defaultvalues->{'itemtype'}) {
1469
                        if ($defaultvalues && $defaultvalues->{'itemtype'}) {
1469
                            $defaultvalue = $defaultvalues->{'itemtype'};
1470
                            $defaultvalue = $defaultvalues->{'itemtype'};
(-)a/C4/Search.pm (-6 / +5 lines)
Lines 28-33 use C4::XSLT qw( XSLTParse4Display ); Link Here
28
use C4::Reserves qw( GetReserveStatus );
28
use C4::Reserves qw( GetReserveStatus );
29
use C4::Charset qw( SetUTF8Flag );
29
use C4::Charset qw( SetUTF8Flag );
30
use Koha::AuthorisedValues;
30
use Koha::AuthorisedValues;
31
use Koha::I18N;
31
use Koha::ItemTypes;
32
use Koha::ItemTypes;
32
use Koha::Libraries;
33
use Koha::Libraries;
33
use Koha::Logger;
34
use Koha::Logger;
Lines 538-546 sub getRecords { Link Here
538
                                    && ref( $itemtypes->{$one_facet} ) eq
539
                                    && ref( $itemtypes->{$one_facet} ) eq
539
                                    "HASH" )
540
                                    "HASH" )
540
                                {
541
                                {
541
                                    $facet_label_value =
542
                                    $facet_label_value = db_t('itemtype', $itemtypes->{$one_facet}->{description});
542
                                      $itemtypes->{$one_facet}
543
                                      ->{translated_description};
544
                                }
543
                                }
545
                            }
544
                            }
546
545
Lines 1670-1676 sub searchResults { Link Here
1670
    my $notforloan_authorised_value = $av->count ? $av->next->authorised_value : undef;
1669
    my $notforloan_authorised_value = $av->count ? $av->next->authorised_value : undef;
1671
1670
1672
    #Get itemtype hash
1671
    #Get itemtype hash
1673
    my $itemtypes = Koha::ItemTypes->search_with_localization;
1672
    my $itemtypes = Koha::ItemTypes->search;
1674
    my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed };
1673
    my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed };
1675
1674
1676
    #search item field code
1675
    #search item field code
Lines 1752-1758 sub searchResults { Link Here
1752
        # add imageurl to itemtype if there is one
1751
        # add imageurl to itemtype if there is one
1753
        $oldbiblio->{imageurl} = $itemtype ? getitemtypeimagelocation( $search_context->{'interface'}, $itemtype->{imageurl} ) : q{};
1752
        $oldbiblio->{imageurl} = $itemtype ? getitemtypeimagelocation( $search_context->{'interface'}, $itemtype->{imageurl} ) : q{};
1754
        # 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)
1755
        $oldbiblio->{description} = $itemtype ? $itemtype->{translated_description} : q{};
1754
        $oldbiblio->{description} = $itemtype ? db_t('itemtype', $itemtype->{description}) : q{};
1756
1755
1757
        # Pull out the items fields
1756
        # Pull out the items fields
1758
        my @fields = $marcrecord->field($itemtag);
1757
        my @fields = $marcrecord->field($itemtag);
Lines 1824-1830 sub searchResults { Link Here
1824
                next;
1823
                next;
1825
            }
1824
            }
1826
1825
1827
            $item->{description} = $itemtypes{ $item->{itype} }{translated_description} if $item->{itype};
1826
            $item->{description} = db_t('itemtype', $itemtypes{ $item->{itype} }{description}) if $item->{itype};
1828
1827
1829
            # OPAC hidden items
1828
            # OPAC hidden items
1830
            if ($is_opac) {
1829
            if ($is_opac) {
(-)a/Koha/DBIx/Component/L10nSource.pm (+73 lines)
Line 0 Link Here
1
package Koha::DBIx::Component::L10nSource;
2
3
use Modern::Perl;
4
use base 'DBIx::Class';
5
6
=head1 NAME
7
8
Koha::DBIx::Component::L10nSource
9
10
=head1 SYNOPSIS
11
12
    __PACKAGE__->load_components('+Koha::DBIx::Component::L10nSource')
13
14
    sub insert {
15
        my $self = shift;
16
        my $result = $self->next::method(@_);
17
        my @sources = $self->result_source->resultset->get_column('label')->all;
18
        $self->update_l10n_source('somecontext', @sources);
19
        return $result;
20
    }
21
22
    sub update {
23
        my $self = shift;
24
        my $is_column_changed = $self->is_column_changed('label');
25
        my $result = $self->next::method(@_);
26
        if ($is_column_changed) {
27
            my @sources = $self->result_source->resultset->get_column('label')->all;
28
            $self->update_l10n_source('somecontext', @sources);
29
        }
30
        return $result;
31
    }
32
33
    sub delete {
34
        my $self = shift;
35
        my $result = $self->next::method(@_);
36
        my @sources = $self->result_source->resultset->get_column('label')->all;
37
        $self->update_l10n_source('somecontext', @sources);
38
        return $result;
39
    }
40
41
=head1 METHODS
42
43
=head2 update_l10n_source
44
45
    $self->update_l10n_source($context, @sources)
46
47
Ensure that all sources in C<@sources>and only them are present in l10n_source
48
for a given C<$context>
49
50
=cut
51
52
sub update_l10n_source {
53
    my ($self, $context, @sources) = @_;
54
55
    my $l10n_source_rs = $self->result_source->schema->resultset('L10nSource')->search({ context => $context });
56
57
    # Insert missing l10n_source rows
58
    foreach my $source (@sources) {
59
        my $count = $l10n_source_rs->search({ source => $source })->count;
60
        if ($count == 0) {
61
            $l10n_source_rs->create({ source => $source });
62
        }
63
    }
64
65
    # Remove l10n_source rows that do not match an existing source
66
    my %sources = map { $_ => undef } @sources;
67
    my @l10n_sources = grep { !exists $sources{$_->source} } $l10n_source_rs->all;
68
    foreach my $l10n_source (@l10n_sources) {
69
        $l10n_source->delete;
70
    }
71
}
72
73
1;
(-)a/Koha/I18N.pm (+49 lines)
Lines 35-40 use Locale::Messages qw( Link Here
35
);
35
);
36
use POSIX qw();
36
use POSIX qw();
37
use Koha::Cache::Memory::Lite;
37
use Koha::Cache::Memory::Lite;
38
use Koha::Caches;
39
use Koha::Database;
38
40
39
use parent 'Exporter';
41
use parent 'Exporter';
40
our @EXPORT = qw(
42
our @EXPORT = qw(
Lines 51-56 our @EXPORT = qw( Link Here
51
    N__n
53
    N__n
52
    N__p
54
    N__p
53
    N__np
55
    N__np
56
57
    db_t
54
);
58
);
55
59
56
our $textdomain = 'Koha';
60
our $textdomain = 'Koha';
Lines 222-225 sub _expand { Link Here
222
    return $text;
226
    return $text;
223
}
227
}
224
228
229
=head2 db_t
230
231
    db_t($context, $source)
232
    db_t('itemtype', $itemtype->description)
233
234
Search for a translation in l10n_target table and return it if found
235
Return source string otherwise
236
237
=cut
238
239
sub db_t {
240
    my ($context, $source) = @_;
241
242
    my $cache = Koha::Caches->get_instance();
243
    my $language = C4::Languages::getlanguage();
244
    my $cache_key = sprintf('%s:%s', $context, $language);
245
246
    my $translations = $cache->get_from_cache($cache_key);
247
    unless ($translations) {
248
        my $schema = Koha::Database->new->schema;
249
        my $rs = $schema->resultset('L10nTarget');
250
251
        my @targets = $rs->search(
252
            {
253
                'l10n_source.context' => $context,
254
                language => $language,
255
            },
256
            {
257
                join => 'l10n_source',
258
                prefetch => 'l10n_source',
259
                result_class => 'DBIx::Class::ResultClass::HashRefInflator',
260
            },
261
        );
262
        $translations = { map { $_->{l10n_source}->{source} => $_->{translation} } @targets };
263
264
        $cache->set_in_cache($cache_key, $translations);
265
    }
266
267
    if (exists $translations->{$source}) {
268
        return $translations->{$source};
269
    }
270
271
    return $source;
272
}
273
225
1;
274
1;
(-)a/Koha/ItemType.pm (-48 / +3 lines)
Lines 23-29 use C4::Languages; Link Here
23
use Koha::Caches;
23
use Koha::Caches;
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::CirculationRules;
25
use Koha::CirculationRules;
26
use Koha::Localizations;
27
26
28
use base qw(Koha::Object Koha::Object::Limit::Library);
27
use base qw(Koha::Object Koha::Object::Limit::Library);
29
28
Lines 89-138 sub image_location { Link Here
89
    return C4::Koha::getitemtypeimagelocation( $interface, $self->SUPER::imageurl );
88
    return C4::Koha::getitemtypeimagelocation( $interface, $self->SUPER::imageurl );
90
}
89
}
91
90
92
=head3 translated_description
93
94
=cut
95
96
sub translated_description {
97
    my ( $self, $lang ) = @_;
98
    if ( my $translated_description = eval { $self->get_column('translated_description') } ) {
99
        # If the value has already been fetched (eg. from sarch_with_localization),
100
        # do not search for it again
101
        # Note: This is a bit hacky but should be fast
102
        return $translated_description
103
             ? $translated_description
104
             : $self->description;
105
    }
106
    $lang ||= C4::Languages::getlanguage;
107
    my $translated_description = Koha::Localizations->search({
108
        code => $self->itemtype,
109
        entity => 'itemtypes',
110
        lang => $lang
111
    })->next;
112
    return $translated_description
113
         ? $translated_description->translation
114
         : $self->description;
115
}
116
117
=head3 translated_descriptions
118
119
=cut
120
121
sub translated_descriptions {
122
    my ( $self ) = @_;
123
    my @translated_descriptions = Koha::Localizations->search(
124
        {   entity => 'itemtypes',
125
            code   => $self->itemtype,
126
        }
127
    )->as_list;
128
    return [ map {
129
        {
130
            lang => $_->lang,
131
            translation => $_->translation,
132
        }
133
    } @translated_descriptions ];
134
}
135
136
=head3 can_be_deleted
91
=head3 can_be_deleted
137
92
138
my $can_be_deleted = Koha::ItemType->can_be_deleted();
93
my $can_be_deleted = Koha::ItemType->can_be_deleted();
Lines 196-210 sub parent { Link Here
196
151
197
}
152
}
198
153
199
=head3 children_with_localization
154
=head3 children
200
155
201
    Returns the ItemType objects of the children of this type or undef.
156
    Returns the ItemType objects of the children of this type or undef.
202
157
203
=cut
158
=cut
204
159
205
sub children_with_localization {
160
sub children {
206
    my ( $self ) = @_;
161
    my ( $self ) = @_;
207
    return Koha::ItemTypes->search_with_localization({ parent_type => $self->itemtype });
162
    return Koha::ItemTypes->search({ parent_type => $self->itemtype });
208
}
163
}
209
164
210
=head3 type
165
=head3 type
(-)a/Koha/ItemTypes.pm (-31 lines)
Lines 31-67 Koha::ItemTypes - Koha ItemType Object set class Link Here
31
31
32
=head1 API
32
=head1 API
33
33
34
=head2 Class methods
35
36
=cut
37
38
=head3 search_with_localization
39
40
my $itemtypes = Koha::ItemTypes->search_with_localization
41
42
=cut
43
44
sub search_with_localization {
45
    my ( $self, $params, $attributes ) = @_;
46
47
    my $language = C4::Languages::getlanguage();
48
    $Koha::Schema::Result::Itemtype::LANGUAGE = $language;
49
    $attributes->{order_by} = 'translated_description' unless exists $attributes->{order_by};
50
    $attributes->{join} = 'localization';
51
    $attributes->{'+select'} = [
52
        {
53
            coalesce => [qw( localization.translation me.description )],
54
            -as      => 'translated_description'
55
        }
56
    ];
57
    if(defined $params->{branchcode}) {
58
        my $branchcode = delete $params->{branchcode};
59
        $self->search_with_library_limits( $params, $attributes, $branchcode );
60
    } else {
61
        $self->SUPER::search( $params, $attributes );
62
    }
63
}
64
65
=head2 Internal methods
34
=head2 Internal methods
66
35
67
=head3 type
36
=head3 type
(-)a/Koha/Localization.pm (-73 lines)
Lines 1-73 Link Here
1
package Koha::Localization;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Koha::Database;
21
22
use base qw(Koha::Object);
23
24
my $cache = Koha::Caches->get_instance();
25
26
=head1 NAME
27
28
Koha::Localization - Koha Localization type Object class
29
30
=head1 API
31
32
=head2 Class methods
33
34
=cut
35
36
=head3 store
37
38
Localization specific store to ensure relevant caches are flushed on change
39
40
=cut
41
42
sub store {
43
    my ($self) = @_;
44
    $self = $self->SUPER::store;
45
46
    if ($self->entity eq 'itemtypes') {
47
        my $key = "itemtype:description:".$self->lang;
48
        $cache->clear_from_cache($key);
49
    }
50
51
    return $self;
52
}
53
54
=head2 delete
55
56
Localization specific C<delete> to clear relevant caches on delete.
57
58
=cut
59
60
sub delete {
61
    my $self = shift @_;
62
    if ($self->entity eq 'itemtypes') {
63
        my $key = "itemtype:description:".$self->lang;
64
        $cache->clear_from_cache($key);
65
    }
66
    $self->SUPER::delete(@_);
67
}
68
69
sub _type {
70
    return 'Localization';
71
}
72
73
1;
(-)a/Koha/Localizations.pm (-34 lines)
Lines 1-34 Link Here
1
package Koha::Localizations;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Koha::Database;
21
22
use Koha::Localization;
23
24
use base qw(Koha::Objects);
25
26
sub _type {
27
    return 'Localization';
28
}
29
30
sub object_class {
31
    return 'Koha::Localization';
32
}
33
34
1;
(-)a/Koha/Schema/Result/Itemtype.pm (-16 / +38 lines)
Lines 342-363 __PACKAGE__->add_columns( Link Here
342
    '+automatic_checkin'            => { is_boolean => 1 },
342
    '+automatic_checkin'            => { is_boolean => 1 },
343
);
343
);
344
344
345
# Use the ItemtypeLocalization view to create the join on localization
345
__PACKAGE__->load_components('+Koha::DBIx::Component::L10nSource');
346
our $LANGUAGE;
347
__PACKAGE__->has_many(
348
  "localization" => "Koha::Schema::Result::ItemtypeLocalization",
349
    sub {
350
        my $args = shift;
351
352
        die "no lang specified!" unless $LANGUAGE;
353
354
        return ({
355
            "$args->{self_alias}.itemtype" => { -ident => "$args->{foreign_alias}.code" },
356
            "$args->{foreign_alias}.lang" => $LANGUAGE,
357
        });
358
359
    }
360
);
361
346
362
sub koha_object_class {
347
sub koha_object_class {
363
    'Koha::ItemType';
348
    'Koha::ItemType';
Lines 366-369 sub koha_objects_class { Link Here
366
    'Koha::ItemTypes';
351
    'Koha::ItemTypes';
367
}
352
}
368
353
354
sub insert {
355
    my $self = shift;
356
357
    my $result = $self->next::method(@_);
358
359
    my @sources = $self->result_source->resultset->get_column('description')->all;
360
    $self->update_l10n_source('itemtype', @sources);
361
362
    return $result;
363
}
364
365
sub update {
366
    my $self = shift;
367
368
    my $is_description_changed = $self->is_column_changed('description');
369
370
    my $result = $self->next::method(@_);
371
372
    if ($is_description_changed) {
373
        my @sources = $self->result_source->resultset->get_column('description')->all;
374
        $self->update_l10n_source('itemtype', @sources);
375
    }
376
377
    return $result;
378
}
379
380
sub delete {
381
    my $self = shift;
382
383
    my $result = $self->next::method(@_);
384
385
    my @sources = $self->result_source->resultset->get_column('description')->all;
386
    $self->update_l10n_source('itemtype', @sources);
387
388
    return $result;
389
}
390
369
1;
391
1;
(-)a/Koha/Schema/Result/ItemtypeLocalization.pm (-32 lines)
Lines 1-32 Link Here
1
package Koha::Schema::Result::ItemtypeLocalization;
2
3
use base 'DBIx::Class::Core';
4
5
use Modern::Perl;
6
7
__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
8
9
__PACKAGE__->table('itemtype_localizations');
10
__PACKAGE__->result_source_instance->is_virtual(1);
11
__PACKAGE__->result_source_instance->view_definition(
12
    "SELECT localization_id, code, lang, translation FROM localization WHERE entity='itemtypes'"
13
);
14
15
__PACKAGE__->add_columns(
16
  "localization_id",
17
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
18
  "code",
19
  { data_type => "varchar", is_nullable => 0, size => 64 },
20
  "lang",
21
  { data_type => "varchar", is_nullable => 0, size => 25 },
22
  "translation",
23
  { data_type => "text", is_nullable => 1 },
24
);
25
26
__PACKAGE__->belongs_to(
27
    "itemtype",
28
    "Koha::Schema::Result::Itemtype",
29
    { code => 'itemtype' }
30
);
31
32
1;
(-)a/Koha/Template/Plugin/ItemTypes.pm (-19 / +10 lines)
Lines 23-57 use Template::Plugin; Link Here
23
use base qw( Template::Plugin );
23
use base qw( Template::Plugin );
24
24
25
use Koha::Cache::Memory::Lite;
25
use Koha::Cache::Memory::Lite;
26
use Koha::I18N;
26
use Koha::ItemTypes;
27
use Koha::ItemTypes;
27
28
28
sub GetDescription {
29
sub GetDescription {
29
    my ( $self, $itemtypecode, $want_parent ) = @_;
30
    my ( $self, $itemtypecode, $want_parent ) = @_;
30
    return q{} unless defined $itemtypecode;
31
32
    my $memory_cache = Koha::Cache::Memory::Lite->get_instance;
33
    my $cache_key    = $want_parent ? "Itemtype_parent_description:".$itemtypecode : "Itemtype_description:" . $itemtypecode;
34
35
    my $cached       = $memory_cache->get_from_cache($cache_key);
36
    return $cached if $cached;
37
38
    my $itemtype = Koha::ItemTypes->find( $itemtypecode );
31
    my $itemtype = Koha::ItemTypes->find( $itemtypecode );
39
    unless ($itemtype) {
32
    return q{} unless defined $itemtype;
40
        $memory_cache->set_in_cache( $cache_key, q{} );
41
        return q{};
42
    }
43
44
    my $parent;
33
    my $parent;
45
    $parent = $itemtype->parent if $want_parent;
34
    $parent = $itemtype->parent if $want_parent;
46
35
    return $parent ? $self->t($parent->description) . "->" . $self->t($itemtype->description) : $self->t($itemtype->description);
47
    my $description = $parent ? $parent->translated_description . "->" . $itemtype->translated_description : $itemtype->translated_description;
48
    $memory_cache->set_in_cache( $cache_key, $description );
49
50
    return $description;
51
}
36
}
52
37
53
sub Get {
38
sub Get {
54
    return Koha::ItemTypes->search_with_localization->unblessed;
39
    return Koha::ItemTypes->search->unblessed;
40
}
41
42
sub t {
43
    my ($self, $description) = @_;
44
45
    return db_t('itemtype', $description);
55
}
46
}
56
47
57
1;
48
1;
(-)a/acqui/orderreceive.pl (+1 lines)
Lines 74-79 use Koha::Acquisition::Booksellers; Link Here
74
use Koha::Acquisition::Currencies qw( get_active );
74
use Koha::Acquisition::Currencies qw( get_active );
75
use Koha::Acquisition::Orders;
75
use Koha::Acquisition::Orders;
76
use Koha::DateUtils qw( dt_from_string );
76
use Koha::DateUtils qw( dt_from_string );
77
use Koha::I18N;
77
use Koha::ItemTypes;
78
use Koha::ItemTypes;
78
use Koha::Patrons;
79
use Koha::Patrons;
79
80
(-)a/admin/itemtypes.pl (-3 / +1 lines)
Lines 32-38 use C4::Auth qw( get_template_and_user ); Link Here
32
use C4::Output qw( output_html_with_http_headers );
32
use C4::Output qw( output_html_with_http_headers );
33
use Koha::ItemTypes;
33
use Koha::ItemTypes;
34
use Koha::ItemType;
34
use Koha::ItemType;
35
use Koha::Localizations;
36
35
37
my $input         = CGI->new;
36
my $input         = CGI->new;
38
my $searchfield   = $input->param('description');
37
my $searchfield   = $input->param('description');
Lines 60-66 if ( $op eq 'add_form' ) { Link Here
60
    my $parent_types = Koha::ItemTypes->search({parent_type=>undef,itemtype => {'!='=>$itemtype_code}});
59
    my $parent_types = Koha::ItemTypes->search({parent_type=>undef,itemtype => {'!='=>$itemtype_code}});
61
    my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
60
    my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
62
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT");
61
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT");
63
    my $translated_languages = C4::Languages::getTranslatedLanguages( "both", C4::Context->preference('template') );
64
    $template->param(
62
    $template->param(
65
        itemtype  => $itemtype,
63
        itemtype  => $itemtype,
66
        parent_type => $parent_type,
64
        parent_type => $parent_type,
Lines 68-74 if ( $op eq 'add_form' ) { Link Here
68
        is_a_parent => $itemtype ? Koha::ItemTypes->search({parent_type=>$itemtype_code})->count : 0,
66
        is_a_parent => $itemtype ? Koha::ItemTypes->search({parent_type=>$itemtype_code})->count : 0,
69
        imagesets => $imagesets,
67
        imagesets => $imagesets,
70
        searchcategory => $searchcategory,
68
        searchcategory => $searchcategory,
71
        can_be_translated => ( scalar(@$translated_languages) > 1 ? 1 : 0 ),
69
        branches_loop    => \@branches_loop,
72
    );
70
    );
73
} elsif ( $op eq 'add_validate' ) {
71
} elsif ( $op eq 'add_validate' ) {
74
    my $is_a_modif   = $input->param('is_a_modif');
72
    my $is_a_modif   = $input->param('is_a_modif');
(-)a/admin/localization.pl (-20 lines)
Lines 21-29 use Modern::Perl; Link Here
21
use C4::Auth qw( get_template_and_user );
21
use C4::Auth qw( get_template_and_user );
22
use C4::Output qw( output_html_with_http_headers );
22
use C4::Output qw( output_html_with_http_headers );
23
23
24
use Koha::Localization;
25
use Koha::Localizations;
26
27
use CGI qw( -utf8 );
24
use CGI qw( -utf8 );
28
25
29
my $query = CGI->new;
26
my $query = CGI->new;
Lines 36-62 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
36
    }
33
    }
37
);
34
);
38
35
39
my $entity = $query->param('entity');
40
my $code   = $query->param('code');
41
my $rs     = Koha::Localizations->search( { entity => $entity, code => $code } );
42
my @translations;
43
while ( my $s = $rs->next ) {
44
    push @translations,
45
      { id          => $s->localization_id,
46
        entity      => $s->entity,
47
        code        => $s->code,
48
        lang        => $s->lang,
49
        translation => $s->translation,
50
      };
51
}
52
53
my $translated_languages = C4::Languages::getTranslatedLanguages( 'intranet', C4::Context->preference('template') );
36
my $translated_languages = C4::Languages::getTranslatedLanguages( 'intranet', C4::Context->preference('template') );
54
37
55
$template->param(
38
$template->param(
56
    translations => \@translations,
57
    languages    => $translated_languages,
39
    languages    => $translated_languages,
58
    entity       => $entity,
59
    code         => $code,
60
);
40
);
61
41
62
output_html_with_http_headers $query, $cookie, $template->output;
42
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/admin/smart-rules.pl (-31 / +1 lines)
Lines 727-733 $template->param( Link Here
727
727
728
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
728
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
729
729
730
my $itemtypes = Koha::ItemTypes->search_with_localization;
730
my $itemtypes = Koha::ItemTypes->search;
731
731
732
my $humanbranch = ( $branch ne '*' ? $branch : undef );
732
my $humanbranch = ( $branch ne '*' ? $branch : undef );
733
733
Lines 754-789 output_html_with_http_headers $input, $cookie, $template->output; Link Here
754
754
755
exit 0;
755
exit 0;
756
756
757
# sort by patron category, then item type, putting
758
# default entries at the bottom
759
sub by_category_and_itemtype {
760
    unless (by_category($a, $b)) {
761
        return by_itemtype($a, $b);
762
    }
763
}
764
765
sub by_category {
766
    my ($a, $b) = @_;
767
    if ($a->{'default_humancategorycode'}) {
768
        return ($b->{'default_humancategorycode'} ? 0 : 1);
769
    } elsif ($b->{'default_humancategorycode'}) {
770
        return -1;
771
    } else {
772
        return $a->{'humancategorycode'} cmp $b->{'humancategorycode'};
773
    }
774
}
775
776
sub by_itemtype {
777
    my ($a, $b) = @_;
778
    if ($a->{default_translated_description}) {
779
        return ($b->{'default_translated_description'} ? 0 : 1);
780
    } elsif ($b->{'default_translated_description'}) {
781
        return -1;
782
    } else {
783
        return lc $a->{'translated_description'} cmp lc $b->{'translated_description'};
784
    }
785
}
786
787
sub strip_non_numeric {
757
sub strip_non_numeric {
788
    my $string = shift;
758
    my $string = shift;
789
    $string =~ s/\s//g;
759
    $string =~ s/\s//g;
(-)a/authorities/authorities.pl (-2 / +6 lines)
Lines 32-37 use C4::Biblio qw( TransformHtmlToMarc ); Link Here
32
use Koha::Authority::Types;
32
use Koha::Authority::Types;
33
use Koha::Import::Records;
33
use Koha::Import::Records;
34
use Koha::ItemTypes;
34
use Koha::ItemTypes;
35
use Koha::I18N;
35
use vars qw( $tagslib);
36
use vars qw( $tagslib);
36
use vars qw( $authorised_values_sth);
37
use vars qw( $authorised_values_sth);
37
use vars qw( $is_a_modif );
38
use vars qw( $is_a_modif );
Lines 66-75 sub build_authorized_values_list { Link Here
66
        }
67
        }
67
    }
68
    }
68
    elsif ( $category eq "itemtypes" ) {
69
    elsif ( $category eq "itemtypes" ) {
69
        my $itemtypes = Koha::ItemTypes->search_with_localization;
70
        my $itemtypes = Koha::ItemTypes->search;
70
        while ( my $itemtype = $itemtypes->next ) {
71
        while ( my $itemtype = $itemtypes->next ) {
72
        push @authorised_values, ""
73
          unless ( $tagslib->{$tag}->{$subfield}->{mandatory}
74
            && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
71
            push @authorised_values, $itemtype->itemtype;
75
            push @authorised_values, $itemtype->itemtype;
72
            $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
76
            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description);
73
        }
77
        }
74
    }
78
    }
75
    else { # "true" authorised value
79
    else { # "true" authorised value
(-)a/catalogue/getitem-ajax.pl (-1 / +2 lines)
Lines 27-32 use C4::Output qw( output_with_http_headers ); Link Here
27
use Koha::Libraries;
27
use Koha::Libraries;
28
28
29
use Koha::AuthorisedValues;
29
use Koha::AuthorisedValues;
30
use Koha::I18N;
30
use Koha::Items;
31
use Koha::Items;
31
use Koha::ItemTypes;
32
use Koha::ItemTypes;
32
33
Lines 75-81 if($itemnumber) { Link Here
75
76
76
    my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
77
    my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
77
    # 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
78
    $item_unblessed->{itemtype} = $itemtype->description; # FIXME Should not it be translated_description?
79
    $item_unblessed->{itemtype} = db_t('itemtype', $itemtype->description);
79
}
80
}
80
81
81
my $json_text = to_json( $item_unblessed, { utf8 => 1 } );
82
my $json_text = to_json( $item_unblessed, { utf8 => 1 } );
(-)a/catalogue/itemsearch.pl (-1 / +8 lines)
Lines 28-33 use C4::Koha qw( GetAuthorisedValues ); Link Here
28
28
29
use Koha::AuthorisedValues;
29
use Koha::AuthorisedValues;
30
use Koha::Biblios;
30
use Koha::Biblios;
31
use Koha::I18N;
31
use Koha::Item::Search::Field qw(GetItemSearchFields);
32
use Koha::Item::Search::Field qw(GetItemSearchFields);
32
use Koha::ItemTypes;
33
use Koha::ItemTypes;
33
use Koha::Libraries;
34
use Koha::Libraries;
Lines 278-284 if ( defined $format ) { Link Here
278
# Display the search form
279
# Display the search form
279
280
280
my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list;
281
my @branches = map { value => $_->branchcode, label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list;
281
my @itemtypes = map { value => $_->itemtype, label => $_->translated_description }, Koha::ItemTypes->search_with_localization->as_list;
282
my @itemtypes;
283
foreach my $itemtype ( Koha::ItemTypes->search->as_list ) {
284
    push @itemtypes, {
285
        value => $itemtype->itemtype,
286
        label => db_t('itemtype', $itemtype->description),
287
    };
288
}
282
289
283
my @ccodes = Koha::AuthorisedValues->get_descriptions_by_koha_field({ kohafield => 'items.ccode' });
290
my @ccodes = Koha::AuthorisedValues->get_descriptions_by_koha_field({ kohafield => 'items.ccode' });
284
foreach my $ccode (@ccodes) {
291
foreach my $ccode (@ccodes) {
(-)a/catalogue/moredetail.pl (-2 / +4 lines)
Lines 35-40 use Koha::AuthorisedValues; Link Here
35
use Koha::Biblios;
35
use Koha::Biblios;
36
use Koha::Items;
36
use Koha::Items;
37
use Koha::Patrons;
37
use Koha::Patrons;
38
use Koha::I18N;
38
39
39
my $query=CGI->new;
40
my $query=CGI->new;
40
41
Lines 138-146 my $ccodes = Link Here
138
my $copynumbers =
139
my $copynumbers =
139
  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
140
  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
140
141
141
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
142
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
142
143
143
$data->{'itemtypename'} = $itemtypes->{ $data->{'itemtype'} }->{'translated_description'}
144
$data->{'itemtypename'} = db_t('itemtype', $itemtypes->{ $data->{'itemtype'} }->{description});
144
  if $data->{itemtype} && exists $itemtypes->{ $data->{itemtype} };
145
  if $data->{itemtype} && exists $itemtypes->{ $data->{itemtype} };
145
foreach ( keys %{$data} ) {
146
foreach ( keys %{$data} ) {
146
    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
147
    $template->param( "$_" => defined $data->{$_} ? $data->{$_} : '' );
Lines 155-160 foreach my $item (@items){ Link Here
155
    my $item_info = $item->unblessed;
156
    my $item_info = $item->unblessed;
156
    $item_info->{object} = $item;
157
    $item_info->{object} = $item;
157
    $item_info->{itype} = $itemtypes->{ $item->itype }->{'translated_description'} if exists $itemtypes->{ $item->itype };
158
    $item_info->{itype} = $itemtypes->{ $item->itype }->{'translated_description'} if exists $itemtypes->{ $item->itype };
159
    $item_info->{itype}                = db_t('itemtype', $itemtypes->{ $item_info->{itype} }->{description}) if exists $itemtypes->{ $item_info->{itype} };
158
    $item_info->{effective_itemtype} = $itemtypes->{$item->effective_itemtype};
160
    $item_info->{effective_itemtype} = $itemtypes->{$item->effective_itemtype};
159
    $item_info->{'ccode'}              = $ccodes->{ $item->ccode } if $ccodes && $item->ccode && exists $ccodes->{ $item->ccode };
161
    $item_info->{'ccode'}              = $ccodes->{ $item->ccode } if $ccodes && $item->ccode && exists $ccodes->{ $item->ccode };
160
    if ( defined $item->copynumber ) {
162
    if ( defined $item->copynumber ) {
(-)a/catalogue/search.pl (-5 / +13 lines)
Lines 158-163 use Koha::SearchEngine::QueryBuilder; Link Here
158
use Koha::Virtualshelves;
158
use Koha::Virtualshelves;
159
use Koha::SearchFields;
159
use Koha::SearchFields;
160
use Koha::SearchFilters;
160
use Koha::SearchFilters;
161
use Koha::I18N;
161
162
162
use URI::Escape;
163
use URI::Escape;
163
use JSON qw( decode_json encode_json );
164
use JSON qw( decode_json encode_json );
Lines 542-548 my $facets; # this object stores the faceted results that display on the left-ha Link Here
542
my $results_hashref;
543
my $results_hashref;
543
544
544
eval {
545
eval {
545
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
546
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
546
    ( $error, $results_hashref, $facets ) = $searcher->search_compat(
547
    ( $error, $results_hashref, $facets ) = $searcher->search_compat(
547
        $query,            $simple_query, \@sort_by,       \@servers,
548
        $query,            $simple_query, \@sort_by,       \@servers,
548
        $results_per_page, $offset,       undef,           $itemtypes,
549
        $results_per_page, $offset,       undef,           $itemtypes,
Lines 810-816 sub prepare_adv_search_types { Link Here
810
    # the index parameter is different for item-level itemtypes
811
    # the index parameter is different for item-level itemtypes
811
    my $itype_or_itemtype =
812
    my $itype_or_itemtype =
812
      ( C4::Context->preference("item-level_itypes") ) ? 'itype' : 'itemtype';
813
      ( C4::Context->preference("item-level_itypes") ) ? 'itype' : 'itemtype';
813
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
814
    my $itemtypes = {
815
        map {
816
            $_->{itemtype} => {
817
                %$_,
818
                description => db_t( 'itemtype', $_->{description} ),
819
              }
820
        } @{ Koha::ItemTypes->search->unblessed }
821
    };
814
822
815
    my ( $cnt, @result );
823
    my ( $cnt, @result );
816
    foreach my $advanced_srch_type (@advanced_search_types) {
824
    foreach my $advanced_srch_type (@advanced_search_types) {
Lines 822-829 sub prepare_adv_search_types { Link Here
822
            my @itypesloop;
830
            my @itypesloop;
823
            foreach my $thisitemtype (
831
            foreach my $thisitemtype (
824
                sort {
832
                sort {
825
                    $itemtypes->{$a}->{'translated_description'}
833
                    $itemtypes->{$a}->{'description'}
826
                      cmp $itemtypes->{$b}->{'translated_description'}
834
                      cmp $itemtypes->{$b}->{'description'}
827
                } keys %$itemtypes
835
                } keys %$itemtypes
828
              )
836
              )
829
            {
837
            {
Lines 831-837 sub prepare_adv_search_types { Link Here
831
                    number      => $cnt++,
839
                    number      => $cnt++,
832
                    ccl         => "$itype_or_itemtype,phr",
840
                    ccl         => "$itype_or_itemtype,phr",
833
                    code        => $thisitemtype,
841
                    code        => $thisitemtype,
834
                    description => $itemtypes->{$thisitemtype}->{'translated_description'},
842
                    description => $itemtypes->{$thisitemtype}->{'description'},
835
                    imageurl    => getitemtypeimagelocation(
843
                    imageurl    => getitemtypeimagelocation(
836
                        'intranet', $itemtypes->{$thisitemtype}->{'imageurl'}
844
                        'intranet', $itemtypes->{$thisitemtype}->{'imageurl'}
837
                    ),
845
                    ),
(-)a/cataloguing/addbiblio.pl (-2 / +3 lines)
Lines 57-62 use Koha::Patrons; Link Here
57
use MARC::File::USMARC;
57
use MARC::File::USMARC;
58
use MARC::File::XML;
58
use MARC::File::XML;
59
use URI::Escape qw( uri_escape_utf8 );
59
use URI::Escape qw( uri_escape_utf8 );
60
use Koha::I18N;
60
61
61
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
62
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
62
    MARC::File::XML->default_record_format('UNIMARC');
63
    MARC::File::XML->default_record_format('UNIMARC');
Lines 197-206 sub build_authorized_values_list { Link Here
197
        push @authorised_values, "";
198
        push @authorised_values, "";
198
199
199
        my $itemtype;
200
        my $itemtype;
200
        my $itemtypes = Koha::ItemTypes->search_with_localization;
201
        my $itemtypes = Koha::ItemTypes->search;
201
        while ( $itemtype = $itemtypes->next ) {
202
        while ( $itemtype = $itemtypes->next ) {
202
            push @authorised_values, $itemtype->itemtype;
203
            push @authorised_values, $itemtype->itemtype;
203
            $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
204
            $authorised_lib{$itemtype->itemtype} = db_t('itemtype', $itemtype->description);
204
        }
205
        }
205
        $value = $itemtype unless ($value);
206
        $value = $itemtype unless ($value);
206
    }
207
    }
(-)a/cataloguing/additem.pl (-1 / +1 lines)
Lines 34-42 use C4::Output qw( output_and_exit_if_error output_and_exit output_html_with_htt Link Here
34
use C4::Search qw( enabled_staff_search_views );
34
use C4::Search qw( enabled_staff_search_views );
35
use Koha::Biblios;
35
use Koha::Biblios;
36
use Koha::Item::Templates;
36
use Koha::Item::Templates;
37
use Koha::I18N;
37
use Koha::ItemTypes;
38
use Koha::ItemTypes;
38
use Koha::Items;
39
use Koha::Items;
39
use Koha::Items;
40
use Koha::Libraries;
40
use Koha::Libraries;
41
use Koha::Patrons;
41
use Koha::Patrons;
42
use Koha::SearchEngine::Indexer;
42
use Koha::SearchEngine::Indexer;
(-)a/circ/transferstoreceive.pl (-1 / +2 lines)
Lines 28-33 use C4::Members; Link Here
28
use Date::Calc qw( Add_Delta_Days Date_to_Days Today );
28
use Date::Calc qw( Add_Delta_Days Date_to_Days Today );
29
29
30
use C4::Reserves;
30
use C4::Reserves;
31
use Koha::I18N;
31
use Koha::Items;
32
use Koha::Items;
32
use Koha::ItemTypes;
33
use Koha::ItemTypes;
33
use Koha::Libraries;
34
use Koha::Libraries;
Lines 87-93 while ( my $library = $libraries->next ) { Link Here
87
            my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
88
            my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
88
89
89
            $getransf{'datetransfer'} = $num->{'datesent'};
90
            $getransf{'datetransfer'} = $num->{'datesent'};
90
            $getransf{'itemtype'} = $itemtype->description; # FIXME Should not it be translated_description?
91
            $getransf{'itemtype'} = db_t('itemtype', $itemtype->description);
91
            %getransf = (
92
            %getransf = (
92
                %getransf,
93
                %getransf,
93
                title          => $biblio->title,
94
                title          => $biblio->title,
(-)a/course_reserves/add_items.pl (-1 / +1 lines)
Lines 99-105 if ( $action eq 'lookup' and $item ) { Link Here
99
99
100
        ccodes    => GetAuthorisedValues('CCODE'),
100
        ccodes    => GetAuthorisedValues('CCODE'),
101
        locations => GetAuthorisedValues('LOC'),
101
        locations => GetAuthorisedValues('LOC'),
102
        itypes    => $itemtypes, # FIXME We certainly want to display the translated_description in the template
102
        itypes    => $itemtypes,
103
        return    => $return,
103
        return    => $return,
104
    );
104
    );
105
105
(-)a/installer/data/mysql/atomicupdate/bug-24975.perl (+48 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        CREATE TABLE IF NOT EXISTS l10n_source (
5
            l10n_source_id INT(11) NOT NULL AUTO_INCREMENT,
6
            context VARCHAR(100) NULL DEFAULT NULL,
7
            source TEXT NOT NULL,
8
            PRIMARY KEY (l10n_source_id),
9
            KEY context_source (context, source(60))
10
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
11
    });
12
13
    $dbh->do(q{
14
        CREATE TABLE IF NOT EXISTS l10n_target (
15
            l10n_target_id INT(11) NOT NULL AUTO_INCREMENT,
16
            l10n_source_id INT(11) NOT NULL,
17
            language VARCHAR(10) NOT NULL,
18
            translation TEXT NOT NULL,
19
            PRIMARY KEY (l10n_target_id),
20
            UNIQUE KEY l10n_source_language (l10n_source_id, language),
21
            FOREIGN KEY l10n_source (l10n_source_id) REFERENCES l10n_source (l10n_source_id)
22
                ON DELETE CASCADE ON UPDATE CASCADE
23
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
24
    });
25
26
    # Populate l10n_source and l10n_target for itemtypes
27
    $dbh->do(q{
28
        INSERT INTO l10n_source (context, source)
29
        SELECT DISTINCT 'itemtype', description FROM itemtypes
30
    });
31
32
    if (TableExists('localization')) {
33
        $dbh->do(q{
34
            INSERT INTO l10n_target (l10n_source_id, language, translation)
35
            SELECT DISTINCT l10n_source_id, lang, translation
36
            FROM localization
37
            JOIN itemtypes ON (localization.code = itemtypes.itemtype)
38
            JOIN l10n_source ON (itemtypes.description = l10n_source.source AND l10n_source.context = 'itemtype')
39
            WHERE entity = 'itemtypes'
40
        });
41
42
        $dbh->do('DROP TABLE localization');
43
    }
44
45
46
    SetVersion( $DBversion );
47
    print "Upgrade to $DBversion done (Bug 24975 - l10n_source, l10n_target)\n";
48
}
(-)a/installer/data/mysql/kohastructure.sql (+22 lines)
Lines 3754-3759 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
DROP TABLE IF EXISTS l10n_source;
3759
CREATE TABLE l10n_source (
3760
    l10n_source_id INT(11) NOT NULL AUTO_INCREMENT,
3761
    context VARCHAR(100) NULL DEFAULT NULL,
3762
    source TEXT NOT NULL,
3763
    PRIMARY KEY (l10n_source_id),
3764
    KEY context_source (context, source(60))
3765
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
3766
3767
DROP TABLE IF EXISTS l10n_target;
3768
CREATE TABLE l10n_target (
3769
    l10n_target_id INT(11) NOT NULL AUTO_INCREMENT,
3770
    l10n_source_id INT(11) NOT NULL,
3771
    language VARCHAR(10) NOT NULL,
3772
    translation TEXT NOT NULL,
3773
    PRIMARY KEY (l10n_target_id),
3774
    UNIQUE KEY l10n_source_language (l10n_source_id, language),
3775
    FOREIGN KEY l10n_source (l10n_source_id) REFERENCES l10n_source (l10n_source_id)
3776
        ON DELETE CASCADE ON UPDATE CASCADE
3777
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
3778
3757
--
3779
--
3758
-- Table structure for table `language_descriptions`
3780
-- Table structure for table `language_descriptions`
3759
--
3781
--
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc (+1 lines)
Lines 177-182 Link Here
177
            [% IF ( Koha.Preference('EnableAdvancedCatalogingEditor') && CAN_user_parameters_manage_keyboard_shortcuts ) %]
177
            [% IF ( Koha.Preference('EnableAdvancedCatalogingEditor') && CAN_user_parameters_manage_keyboard_shortcuts ) %]
178
                <li><a href="/cgi-bin/koha/admin/adveditorshortcuts.pl">Keyboard shortcuts</a></li>
178
                <li><a href="/cgi-bin/koha/admin/adveditorshortcuts.pl">Keyboard shortcuts</a></li>
179
            [% END %]
179
            [% END %]
180
            <li><a href="/cgi-bin/koha/admin/localization.pl">Localization</a></li>
180
        </ul>
181
        </ul>
181
    [% END %]
182
    [% END %]
182
</div>
183
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (-1 / +2 lines)
Lines 1-3 Link Here
1
[% USE ItemTypes %]
1
[% BLOCK options_for_libraries %]
2
[% BLOCK options_for_libraries %]
2
    [% FOREACH l IN libraries %]
3
    [% FOREACH l IN libraries %]
3
        [% IF l.selected %]
4
        [% IF l.selected %]
Lines 64-70 Link Here
64
        [% ELSE %]
65
        [% ELSE %]
65
            <option value="[% itemtype.itemtype | html %]">
66
            <option value="[% itemtype.itemtype | html %]">
66
        [% END %]
67
        [% END %]
67
            [% itemtype.translated_description | html %]
68
            [% ItemTypes.t(itemtype.description) | html %]
68
        </option>
69
        </option>
69
    [% END %]
70
    [% END %]
70
[% END %]
71
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (+3 lines)
Lines 282-287 Link Here
282
                        <dt><a href="/cgi-bin/koha/admin/adveditorshortcuts.pl">Keyboard shortcuts</a></dt>
282
                        <dt><a href="/cgi-bin/koha/admin/adveditorshortcuts.pl">Keyboard shortcuts</a></dt>
283
                        <dd>Define which keys trigger actions in the advanced cataloging editor</dd>
283
                        <dd>Define which keys trigger actions in the advanced cataloging editor</dd>
284
                    [% END %]
284
                    [% END %]
285
286
                    <dt><a href="/cgi-bin/koha/admin/localization.pl">Localization</a></dt>
287
                    <dd>Translate user-defined strings</dd>
285
                </dl>
288
                </dl>
286
            [% END %]
289
            [% END %]
287
            </div>
290
            </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (-4 / +2 lines)
Lines 1-5 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE ItemTypes %]
3
[% USE Koha %]
4
[% USE Koha %]
4
[% USE Branches %]
5
[% USE Branches %]
5
[% USE AuthorisedValues %]
6
[% USE AuthorisedValues %]
Lines 183-191 Item types &rsaquo; Administration &rsaquo; Koha Link Here
183
                <li>
184
                <li>
184
                    <label for="description" class="required">Description: </label>
185
                    <label for="description" class="required">Description: </label>
185
                    <input type="text" id="description" name="description" size="48" value="[% itemtype.description | html %]" required="required" /> <span class="required">Required</span>
186
                    <input type="text" id="description" name="description" size="48" value="[% itemtype.description | html %]" required="required" /> <span class="required">Required</span>
186
                    [% IF can_be_translated %]
187
                        <a href="/cgi-bin/koha/admin/localization.pl?entity=itemtypes&code=[% itemtype.itemtype | uri %]" title="Translate item type [% itemtype.itemtype | html %]" rel="gb_page_center[600,500]"><i class="fa fa-pencil"></i> Translate into other languages</a>
188
                    [% END %]
189
                </li>
187
                </li>
190
                <li>
188
                <li>
191
                    <label for="searchcategory">Search category: </label>
189
                    <label for="searchcategory">Search category: </label>
Lines 426-432 Item types &rsaquo; Administration &rsaquo; Koha Link Here
426
                <th scope="row">Item type</th>
424
                <th scope="row">Item type</th>
427
                <td>[% itemtype.itemtype | html %]</td>
425
                <td>[% itemtype.itemtype | html %]</td>
428
            </tr>
426
            </tr>
429
            <tr><th scope="row">Description</th><td>[% itemtype.translated_description | html %]</td></tr>
427
            <tr><th scope="row">Description</th><td>[% ItemTypes.t(itemtype.description) | html %]</td></tr>
430
            [% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]
428
            [% UNLESS Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') %]
431
                <tr>
429
                <tr>
432
                    <th scope="row">Image</th>
430
                    <th scope="row">Image</th>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt (-244 / +128 lines)
Lines 1-278 Link Here
1
[% USE raw %]
1
[% USE JSON.Escape %]
2
[% USE Asset %]
3
[% SET footerjs = 1 %]
2
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Localization &rsaquo; Koha</title>
4
<title>Localization &rsaquo; Koha</title>
6
[% INCLUDE 'doc-head-close.inc' popup => 1 %]
5
[% INCLUDE 'doc-head-close.inc' %]
7
<style>#localization { margin-top: 1em; }</style>
6
<style>
7
    #localization { margin-top: 1em; }
8
9
    .add-translation-block {
10
        margin-bottom: 5px;
11
    }
12
13
    .add-translation-block form {
14
        display: inline-flex;
15
        align-items: center;
16
    }
17
    code {
18
        background-color: lightgrey;
19
        font-weight: bold;
20
        display: inline-block;
21
        padding: 2px 4px;
22
    }
23
</style>
8
</head>
24
</head>
9
25
10
<body id="admin_localization" class="admin">
26
<body id="admin_localization" class="admin">
11
    <div class="container-fluid">
27
    [% INCLUDE 'header.inc' %]
12
        <div class="row">
28
    [% INCLUDE 'prefs-admin-search.inc' %]
13
            <div class="col-sm-12">
14
                <h1>Localization</h1>
15
<form id="add_translation" method="post">
16
    <input type="hidden" name="entity" value="[% entity | html %]" />
17
    <input type="hidden" name="code" value="[% code | html %]" />
18
    <input type="hidden" name="interface" value="[% interface_side | html %]" />
19
    <fieldset class="rows clearfix">
20
        <ol>
21
            <li>
22
                <span class="label">Authorized value:</span>
23
                [% code | html %]
24
            </li>
25
            <li>
26
                <label for="lang">Language:</label>
27
                <select name="lang" id="lang">
28
                    [% FOR language IN languages %]
29
                        [% FOR sublanguage IN language.sublanguages_loop %]
30
                            [% IF language.plural %]
31
                                <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
32
                            [% ELSE %]
33
                                <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
34
                            [% END %]
35
                        [% END %]
36
                    [% END %]
37
                </select>
38
            </li>
39
            <li>
40
                <label for="translation">Translation:</label>
41
                <input type="text" size="40" name="translation" id="translation" />
42
            </li>
43
            <li>
44
                <span class="label">&nbsp;</span>
45
                <input type="submit" class="btn btn-primary" value="Add" />
46
            </li>
47
        </ol>
48
    </fieldset>
49
</form>
50
            </div> <!-- /.col-sm-12 -->
51
        </div> <!-- /.row -->
52
29
53
        <div class="row">
30
    <div id="breadcrumbs">
54
            <div class="col-sm-12">
31
        <a href="/cgi-bin/koha/mainpage.pl">Home</a>
55
<div id="messages"></div>
32
        &rsaquo;
56
            </div> <!-- /.col-sm-12 -->
33
        <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
57
        </div> <!-- /.row -->
34
        &rsaquo;
35
        Localization
36
    </div>
37
38
    <div class="main container-fluid">
58
39
59
        <div class="row">
40
        <div class="row">
60
            <div class="col-sm-12">
41
            <div class="col-sm-10 col-sm-push-2">
61
<table id="localization">
42
                <main>
62
    <thead>
43
                    <h2>Localization</h2>
63
        <tr>
44
64
            <th>Id</th>
45
                    <table id="localization">
65
            <th>Entity</th>
46
                        <thead>
66
            <th>Code</th>
47
                            <tr>
67
            <th>Language</th>
48
                                <th>Context</th>
68
            <th>Translation</th>
49
                                <th>Source</th>
69
            <th class="NoSort">&nbsp;</th>
50
                                <th>Translations</th>
70
        </tr>
51
                            </tr>
71
    </thead>
52
                        </thead>
72
    <tbody>
53
                        <tbody>
73
        [% FOR t IN translations %]
54
                        </tbody>
74
        <tr id="row_id_[% t.id | html %]" data-id="[% t.id | html %]">
55
                    </table>
75
            <td>[% t.id | html %]</td>
56
                </main>
76
            <td>[% t.entity | html %]</td>
57
            </div>
77
            <td>[% t.code | html %]</td>
58
78
            <td class="lang">[% t.lang | html %]</td>
59
            <div class="col-sm-2 col-sm-pull-10">
79
            <td class="translation" contenteditable="true">[% t.translation | html %]</td>
60
                <aside>
80
            <td class="actions"><a href="#" class="delete"><i class="fa fa-trash"></i> Delete</a></td>
61
                    [% INCLUDE 'admin-menu.inc' %]
81
        </tr>
62
                </aside>
82
        [% END %]
63
            </div>
83
    </tbody>
64
        </div>
84
</table>
65
    </div>
85
            </div> <!-- /.col-sm-12 -->
86
        </div> <!-- /.row -->
87
    </div> <!-- /.container-fluid -->
88
66
89
[% MACRO jsinclude BLOCK %]
67
[% MACRO jsinclude BLOCK %]
90
    [% INCLUDE 'datatables.inc' %]
68
    [% INCLUDE 'datatables.inc' %]
91
    <script>
69
    <script>
92
70
93
        function show_message( params ) {
94
            var type = params.type;
95
            var data = params.data;
96
            var messages = $("#messages");
97
            var message;
98
            if ( type == 'success_on_update' ) {
99
                message = $('<div class="dialog message"></div>');
100
                message.text(_("Entity %s (code %s) for lang %s has correctly been updated with '%s'").format(data.entity, data.code, data.lang, data.translation));
101
            } else if ( type == 'error_on_update' ) {
102
                message = $('<div class="dialog alert"></div>');
103
                if ( data.error_code == 'already_exists' ) {
104
                    message.text(_("A translation already exists for this language."));
105
                } else {
106
                    message.text(_("An error occurred when updating this translation."));
107
                }
108
            } else if ( type == 'success_on_delete' ) {
109
                message = $('<div class="dialog message"></div>');
110
                message.text(_("The translation (id %s) has been removed successfully").format(data.id));
111
            } else if ( type == 'error_on_delete' ) {
112
                message = $('<div class="dialog alert"></div>');
113
                message.text(_("An error occurred when deleting this translation"));
114
            } else if ( type == 'success_on_insert' ) {
115
                message = $('<div class="dialog message"></div>');
116
                message.text(_("Translation (id %s) has been added successfully").format(data.id));
117
            } else if ( type == 'error_on_insert' ) {
118
                message = $('<div class="dialog alert"></div>');
119
                if ( data.error_code == 'already_exists' ) {
120
                    message.text(_("A translation already exists for this language."));
121
                } else {
122
                    message.text(_("An error occurred when adding this translation"));
123
                }
124
            }
125
126
            $(messages).append(message);
127
128
            setTimeout(function(){
129
                message.hide()
130
            }, 3000);
131
        }
132
133
        function send_update_request( data, cell ) {
71
        function send_update_request( data, cell ) {
134
            $.ajax({
72
            $.ajax({
135
                data: data,
73
                data: data,
136
                type: 'PUT',
74
                type: 'PUT',
137
                url: '/cgi-bin/koha/svc/localization',
75
                url: '/cgi-bin/koha/svc/localization',
138
                success: function (data) {
76
                success: function (data) {
139
                    if ( data.error ) {
77
                    $("#localization").DataTable().draw(false);
140
                        $(cell).css('background-color', '#FF0000');
141
                        show_message({ type: 'error_on_update', data: data });
142
                    } else if ( data.is_changed == 1 ) {
143
                        $(cell).css('background-color', '#00FF00');
144
                        show_message({ type: 'success_on_update', data: data });
145
                    }
146
147
                    if ( $(cell).hasClass('lang') ) {
148
                        $(cell).text(data.lang)
149
                    } else if ( $(cell).hasClass('translation') ) {
150
                        $(cell).text(data.translation)
151
                    }
152
                },
153
                error: function (data) {
154
                    $(cell).css('background-color', '#FF9090');
155
                    if ( $(cell).hasClass('lang') ) {
156
                        $(cell).text(data.lang)
157
                    } else if ( $(cell).hasClass('translation') ) {
158
                        $(cell).text(data.translation)
159
                    }
160
                    show_message({ type: 'error_on_update', data: data });
161
                },
162
            });
163
        }
164
165
        function send_delete_request( id, cell ) {
166
            $.ajax({
167
                type: 'DELETE',
168
                url: '/cgi-bin/koha/svc/localization/?id='+id,
169
                success: function (data) {
170
                    $("#localization").DataTable().row( '#row_id_' + id ).remove().draw();
171
                    show_message({ type: 'success_on_delete', data: data });
172
                },
173
                error: function (data) {
174
                    $(cell).css('background-color', '#FF9090');
175
                    show_message({ type: 'error_on_delete', data: data });
176
                },
78
                },
177
            });
79
            });
178
        }
80
        }
179
81
180
        $(document).ready(function() {
82
        $(document).ready(function() {
181
            $(".dialog").hide();
182
183
            var table = $("#localization").DataTable($.extend(true, {}, dataTablesDefaults, {
83
            var table = $("#localization").DataTable($.extend(true, {}, dataTablesDefaults, {
184
                "dom": 't',
84
                autoWidth: true,
185
                "columnDefs": [
85
                serverSide: true,
186
                    { 'sortable': false, 'targets': [ 'NoSort' ] }
86
                ordering: false,
187
                ],
87
                ajax: {
188
                'bPaginate': false,
189
                'autoWidth': false,
190
            }));
191
192
            var languages_select = $('<select name="lang" id="lang"></select>');
193
            [% FOR language IN languages %]
194
                [% FOR sublanguage IN language.sublanguages_loop %]
195
                    var option;
196
                    [% IF language.plural %]
197
                        option = $('<option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>');
198
                        $(languages_select).append(option);
199
                    [% ELSE %]
200
                        option = $('<option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>');
201
                    [% END %]
202
                    $(languages_select).append(option);
203
                [% END %]
204
            [% END %]
205
206
            $("td.translation").on('focus', function(){
207
                $(this).css('background-color', '');
208
            });
209
            $("td.lang").on('click', function(){
210
                var td = this;
211
                var lang = $(td).text();
212
                $(td).css('background-color', '');
213
                var my_select = $(languages_select).clone();
214
                $(my_select).find('option[value="' + lang + '"]').attr('selected', 'selected');
215
                $(my_select).on('click', function(e){
216
                    e.stopPropagation();
217
                });
218
                $(my_select).on('change', function(){
219
                    var tr = $(this).parent().parent();
220
                    var id = $(tr).data('id');
221
                    var lang = $(this).find('option:selected').val();
222
                    var data = "id=" + encodeURIComponent(id) + "&lang=" + encodeURIComponent(lang);
223
                    send_update_request( data, td );
224
                });
225
                $(my_select).on('blur', function(){
226
                    $(td).html(lang);
227
                });
228
                $(this).html(my_select);
229
            });
230
231
            $("td.translation").on('blur', function(){
232
                var tr = $(this).parent();
233
                var id = $(tr).data('id');
234
                var translation = $(this).text();
235
                var data = "id=" + encodeURIComponent(id) + "&translation=" + encodeURIComponent(translation);
236
                send_update_request( data, this );
237
            });
238
239
            $("body").on("click", "a.delete", function(e){
240
                e.preventDefault();
241
                if ( confirm(_("Are you sure you want to delete this translation?")) ) {
242
                    var td = $(this).parent();
243
                    var tr = $(td).parent();
244
                    var id = $(tr).data('id');
245
                    send_delete_request( id, td );
246
                }
247
            });
248
249
            $("#add_translation").on('submit', function(e){
250
                e.preventDefault();
251
                var entity = $(this).find('input[name="entity"]').val();
252
                var code = $(this).find('input[name="code"]').val();
253
                var lang = $(this).find('select[name="lang"] option:selected').val();
254
                var translation = $(this).find('input[name="translation"]').val();
255
                var data = "entity=" + encodeURIComponent(entity) + "&code=" + encodeURIComponent(code) + "&lang=" + encodeURIComponent(lang) + "&translation=" + encodeURIComponent(translation);
256
                $.ajax({
257
                    data: data,
258
                    type: 'POST',
259
                    url: '/cgi-bin/koha/svc/localization',
88
                    url: '/cgi-bin/koha/svc/localization',
260
                    success: function (data) {
89
                },
261
                        if ( data.error ) {
90
                columns: [
262
                            show_message({ type: 'error_on_insert', data: data });
91
                    {
263
                        } else {
92
                        name: 'context',
264
                            var new_row = table.row.add( [ data.id, data.entity, data.code, data.lang, data.translation, "<a href=\"#\" class=\"delete\"><i class=\"fa fa-trash\"></i> Delete</a>" ] ).draw().node();
93
                        data: 'context',
265
                            $( new_row ).attr("id", "row_id_" + data.id ).data("id", data.id );
94
                    },
266
                            show_message({ type: 'success_on_insert', data: data });
95
                    {
267
                        }
96
                        name: 'source',
97
                        data: 'source',
268
                    },
98
                    },
269
                    error: function (data) {
99
                    {
270
                        show_message({ type: 'error_on_insert', data: data });
100
                        name: 'targets',
101
                        data: 'l10n_targets',
102
                        render: function (data, type, row, meta) {
103
                            const languages = [% languages.json %];
104
                            const translations = Object.fromEntries(data.map(translation => [translation.language, translation]));
105
                            let output = '';
106
                            for (const language of languages) {
107
                                const div = $('<div>');
108
                                div.addClass('add-translation-block');
109
                                const languageCode = $('<code>').text(language.rfc4646_subtag);
110
                                const translationSpan = $('<span>');
111
                                if (translations[language.rfc4646_subtag]) {
112
                                    const translation = translations[language.rfc4646_subtag].translation;
113
                                    translationSpan.text(translation);
114
                                } else {
115
                                    languageCode.html('<del>' + languageCode.text() + '</del>');
116
                                }
117
                                const translateLink = $('<a>');
118
                                translateLink.text('Translate');
119
                                translateLink.addClass('add-translation');
120
                                translateLink.attr('href', '#');
121
                                translateLink.attr('data-l10n-source-id', row.l10n_source_id);
122
                                translateLink.attr('data-language', language.rfc4646_subtag);
123
                                translateLink.attr('data-source', row.source);
124
                                if (translations[language.rfc4646_subtag]) {
125
                                    translateLink.attr('data-translation', translations[language.rfc4646_subtag].translation);
126
                                }
127
128
                                div.append(languageCode, ' ', translationSpan, ' ', translateLink);
129
130
                                output += ' ' + div[0].outerHTML;
131
                            }
132
133
                            return output;
134
                        },
271
                    },
135
                    },
136
                ],
137
            }));
138
139
            $('#localization').on('click', '.add-translation', function (ev) {
140
                ev.preventDefault();
141
                const form = $('<form>');
142
                const textarea = $('<textarea>').attr('rows', '1');
143
                textarea.text(ev.target.getAttribute('data-translation'));
144
                form.append(textarea);
145
                form.append('<button type="submit">Save</button>');
146
                const l10n_source_id = ev.target.getAttribute('data-l10n-source-id');
147
                const language = ev.target.getAttribute('data-language');
148
                form.on('submit', function (ev) {
149
                    ev.preventDefault();
150
                    send_update_request({
151
                        id: l10n_source_id,
152
                        lang: language,
153
                        translation: textarea.val(),
154
                    });
272
                });
155
                });
156
                $(ev.target).hide();
157
                $(ev.target).after(form);
273
            });
158
            });
274
275
         });
159
         });
276
    </script>
160
    </script>
277
[% END %]
161
[% END %]
278
[% INCLUDE 'popup-bottom.inc' %]
162
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-7 / +7 lines)
Lines 414-429 Link Here
414
                                        <option value="*">All</option>
414
                                        <option value="*">All</option>
415
                                        [% FOREACH itemtypeloo IN itemtypeloop %]
415
                                        [% FOREACH itemtypeloo IN itemtypeloop %]
416
                                            [% NEXT IF itemtypeloo.parent_type %]
416
                                            [% NEXT IF itemtypeloo.parent_type %]
417
                                            [% SET children = itemtypeloo.children_with_localization %]
417
                                            [% SET children = itemtypeloo.children %]
418
                                            [% IF children.count %]
418
                                            [% IF children.count %]
419
                                                <optgroup label="[% itemtypeloo.translated_description | html %]">
419
                                                <optgroup label="[% ItemTypes.t(itemtypeloo.description) | html %]">
420
                                                    <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %] (All)</option>
420
                                                    <option value="[% itemtypeloo.itemtype | html %]">[% ItemTypes.t(itemtypeloo.description) | html %] (All)</option>
421
                                                    [% FOREACH child IN children %]
421
                                                    [% FOREACH child IN children %]
422
                                                        <option value="[% child.itemtype | html %]">[% child.translated_description | html %]</option>
422
                                                        <option value="[% child.itemtype | html %]">[% ItemTypes.t(child.description) | html %]</option>
423
                                                    [% END %]
423
                                                    [% END %]
424
                                                </optgroup>
424
                                                </optgroup>
425
                                            [% ELSE %]
425
                                            [% ELSE %]
426
                                                <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
426
                                                <option value="[% itemtypeloo.itemtype | html %]">[% ItemTypes.t(itemtypeloo.description) | html %]</option>
427
                                            [% END %]
427
                                            [% END %]
428
                                        [% END %]
428
                                        [% END %]
429
                                    </select>
429
                                    </select>
Lines 1285-1291 Link Here
1285
                                [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
1285
                                [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
1286
                                    <tr>
1286
                                    <tr>
1287
                                        <td>
1287
                                        <td>
1288
                                            [% i.translated_description | html %]
1288
                                            [% ItemTypes.t(i.description) | html %]
1289
                                        </td>
1289
                                        </td>
1290
                                        <td>
1290
                                        <td>
1291
                                            [% IF holdallowed == 'from_any_library' %]
1291
                                            [% IF holdallowed == 'from_any_library' %]
Lines 1330-1336 Link Here
1330
                                <td>
1330
                                <td>
1331
                                    <select name="itemtype">
1331
                                    <select name="itemtype">
1332
                                    [% FOREACH itemtypeloo IN itemtypeloop %]
1332
                                    [% FOREACH itemtypeloo IN itemtypeloop %]
1333
                                        <option value="[% itemtypeloo.itemtype | html %]">[% itemtypeloo.translated_description | html %]</option>
1333
                                        <option value="[% itemtypeloo.itemtype | html %]">[% ItemTypes.t(itemtypeloo.description) | html %]</option>
1334
                                    [% END %]
1334
                                    [% END %]
1335
                                    </select>
1335
                                    </select>
1336
                                </td>
1336
                                </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt (-1 / +2 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE ItemTypes %]
2
[% USE Koha %]
3
[% USE Koha %]
3
[% USE Asset %]
4
[% USE Asset %]
4
[% USE Branches %]
5
[% USE Branches %]
Lines 239-245 Link Here
239
                                                        [% END %]
240
                                                        [% END %]
240
                                                            &nbsp;
241
                                                            &nbsp;
241
                                                    [% END %]
242
                                                    [% END %]
242
                                                    <span class="itypetext">[% itemtypeloo.description | html %]</span>
243
                                                    <span class="itypetext">[% ItemTypes.t(itemtypeloo.description) | html %]</span>
243
                                                </label>
244
                                                </label>
244
                                            </td>
245
                                            </td>
245
                                            [% IF ( loop.last ) %]
246
                                            [% IF ( loop.last ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +3 lines)
Lines 1-5 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE ItemTypes %]
3
[% USE Koha %]
4
[% USE Koha %]
4
[% USE KohaDates %]
5
[% USE KohaDates %]
5
[% USE KohaPlugins %]
6
[% USE KohaPlugins %]
Lines 402-410 Link Here
402
                        <td class="itype">
403
                        <td class="itype">
403
                            [% SET itemtype = item.itemtype %]
404
                            [% SET itemtype = item.itemtype %]
404
                            [% IF !noItemTypeImages && itemtype.image_location('intranet') %]
405
                            [% IF !noItemTypeImages && itemtype.image_location('intranet') %]
405
                                <img src="[% itemtype.image_location('intranet') | html %]" alt="[% itemtype.translated_description | html %]" title="[% itemtype.translated_description | html %]" />
406
                                <img src="[% itemtype.image_location('intranet') | html %]" alt="[% ItemTypes.t(itemtype.description) | html %]" title="[% ItemTypes.t(itemtype.description) | html %]" />
406
                            [% END %]
407
                            [% END %]
407
                            <span class="itypedesc itypetext">[% itemtype.translated_description | html %]</span>
408
                            <span class="itypedesc itypetext">[% ItemTypes.t(item.description) | html %]</span>
408
                        </td>
409
                        </td>
409
                    [% END %]
410
                    [% END %]
410
                    <td class="location">[% UNLESS ( singlebranchmode ) %][% Branches.GetName( item.holdingbranch ) | html %] [% END %]</td>
411
                    <td class="location">[% UNLESS ( singlebranchmode ) %][% Branches.GetName( item.holdingbranch ) | html %] [% END %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt (-2 / +3 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE HtmlTags %]
2
[% USE HtmlTags %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% USE ItemTypes %]
4
[% SET footerjs = 1 %]
5
[% SET footerjs = 1 %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
6
[% PROCESS 'i18n.inc' %]
7
[% PROCESS 'i18n.inc' %]
Lines 88-96 Link Here
88
                            <option value=""></option>
89
                            <option value=""></option>
89
                            [% FOREACH it IN itypes %]
90
                            [% FOREACH it IN itypes %]
90
                                [% IF it.itemtype == course_item.itype %]
91
                                [% IF it.itemtype == course_item.itype %]
91
                                    <option value="[% it.itemtype | html %]" selected="selected">[% it.description | html %]</option>
92
                                    <option value="[% it.itemtype | html %]" selected="selected">[% ItemTypes.t(it.description) | html %]</option>
92
                                [% ELSE %]
93
                                [% ELSE %]
93
                                    <option value="[% it.itemtype | html %]">[% it.description | html %]</option>
94
                                    <option value="[% it.itemtype | html %]">[% ItemTypes.t(it.description) | html %]</option>
94
                                [% END %]
95
                                [% END %]
95
                            [% END %]
96
                            [% END %]
96
                        </select>
97
                        </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt (-1 / +1 lines)
Lines 57-63 Link Here
57
                                <option value=""></option>
57
                                <option value=""></option>
58
58
59
                                [% FOREACH it IN ItemTypes.Get() %]
59
                                [% FOREACH it IN ItemTypes.Get() %]
60
                                    <option value="[% it.itemtype | html %]">[% it.description | html %]</option>
60
                                    <option value="[% it.itemtype | html %]">[% ItemTypes.t(it.description) | html %]</option>
61
                                [% END %]
61
                                [% END %]
62
                            </select>
62
                            </select>
63
                        </li>
63
                        </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/acquisitions_stats.tt (-1 / +2 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE ItemTypes %]
2
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>[% IF ( do_it ) %]Acquisitions statistics &rsaquo; Results[% ELSE %]Acquisitions statistics[% END %] &rsaquo; Reports &rsaquo; Koha</title>
5
<title>[% IF ( do_it ) %]Acquisitions statistics &rsaquo; Results[% ELSE %]Acquisitions statistics[% END %] &rsaquo; Reports &rsaquo; Koha</title>
Lines 213-219 Link Here
213
                    <select name="Filter" id="itemtypes">
214
                    <select name="Filter" id="itemtypes">
214
                        <option value="">All item types</option>
215
                        <option value="">All item types</option>
215
                        [% FOREACH itemtype IN itemtypes %]
216
                        [% FOREACH itemtype IN itemtypes %]
216
                        <option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
217
                        <option value="[% itemtype.itemtype | html %]">[% ItemTypes.t(itemtype.description) | html %]</option>
217
                        [% END %]
218
                        [% END %]
218
                    </select>
219
                    </select>
219
                </td>
220
                </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt (-1 / +1 lines)
Lines 139-145 Link Here
139
			<li> 
139
			<li> 
140
                <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
140
                <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
141
    [% FOREACH itemtype IN itemtypes %]
141
    [% FOREACH itemtype IN itemtypes %]
142
        <option value="[% itemtype.itemtype | html %]" >[% itemtype.translated_description | html %] </option>
142
        <option value="[% itemtype.itemtype | html %]" >[% ItemTypes.t(itemtype.description) | html %] </option>
143
     [% END %] 
143
     [% END %] 
144
    </select>
144
    </select>
145
			</li>
145
			</li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt (-1 / +2 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE ItemTypes %]
2
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Most-circulated items[% IF ( do_it ) %] &rsaquo; Results[% END %] &rsaquo; Reports &rsaquo; Koha</title>
5
<title>Most-circulated items[% IF ( do_it ) %] &rsaquo; Results[% END %] &rsaquo; Reports &rsaquo; Koha</title>
Lines 117-123 Link Here
117
      <li> 
118
      <li> 
118
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
119
        <label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
119
    [% FOREACH itemtype IN itemtypes %]
120
    [% FOREACH itemtype IN itemtypes %]
120
        <option value="[% itemtype.itemtype | html %]" >[% itemtype.translated_description | html %] </option>
121
        <option value="[% itemtype.itemtype | html %]" >[% ItemTypes.t(itemtype.description) | html %] </option>
121
     [% END %] 
122
     [% END %] 
122
    </select>
123
    </select>
123
      </li>
124
      </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt (-1 / +1 lines)
Lines 169-175 Link Here
169
                                    <select name="Filter" id="documenttype">
169
                                    <select name="Filter" id="documenttype">
170
                                        <option value="">Any item type</option>
170
                                        <option value="">Any item type</option>
171
                                        [% FOREACH itemtype IN itemtypes %]
171
                                        [% FOREACH itemtype IN itemtypes %]
172
                                            <option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
172
                                            <option value="[% itemtype.itemtype | html %]">[% ItemTypes.t(itemtype.description) | html %]</option>
173
                                        [% END %]
173
                                        [% END %]
174
                                    </select>
174
                                    </select>
175
                                </li>
175
                                </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt (-1 / +2 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE ItemTypes %]
2
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>[% IF ( do_it ) %]Catalog statistics &rsaquo; Results[% ELSE %]Catalog statistics[% END %] &rsaquo; Reports &rsaquo; Koha</title>
5
<title>[% IF ( do_it ) %]Catalog statistics &rsaquo; Results[% ELSE %]Catalog statistics[% END %] &rsaquo; Reports &rsaquo; Koha</title>
Lines 137-143 Link Here
137
				<td><select name="Filter" id="[% item_itype | html %]">
138
				<td><select name="Filter" id="[% item_itype | html %]">
138
					<option value=""> </option>
139
					<option value=""> </option>
139
                    [% FOREACH itemtype IN itemtypes %]
140
                    [% FOREACH itemtype IN itemtypes %]
140
                        <option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
141
                        <option value="[% itemtype.itemtype | html %]">[% ItemTypes.t(itemtype.description) | html %]</option>
141
                    [% END %]
142
                    [% END %]
142
					</select>
143
					</select>
143
				</td>
144
				</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_avg_stats.tt (-1 / +2 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE ItemTypes %]
2
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Average loan time &rsaquo; Reports &rsaquo; Koha</title>
5
<title>Average loan time &rsaquo; Reports &rsaquo; Koha</title>
Lines 173-179 Link Here
173
                    <select name="Filter" id="itemtypes">
174
                    <select name="Filter" id="itemtypes">
174
                        <option value=""></option>
175
                        <option value=""></option>
175
                        [% FOREACH itemtype IN itemtypes %]
176
                        [% FOREACH itemtype IN itemtypes %]
176
                        <option value="[%- itemtype.itemtype | html -%]">[%- itemtype.translated_description | html -%]</option>
177
                        <option value="[%- itemtype.itemtype | html -%]">[%- ItemTypes.t(itemtype.description) | html -%]</option>
177
                        [% END %]
178
                        [% END %]
178
                    </select>
179
                    </select>
179
                </td>
180
                </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt (-1 / +2 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE ItemTypes %]
2
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Circulation statistics[% IF ( do_it ) %] &rsaquo; Results[% END %] &rsaquo; Reports &rsaquo; Koha</title>
5
<title>Circulation statistics[% IF ( do_it ) %] &rsaquo; Results[% END %] &rsaquo; Reports &rsaquo; Koha</title>
Lines 198-204 Link Here
198
           <td><select name="Filter" id="itemtype">
199
           <td><select name="Filter" id="itemtype">
199
               <option value=""> </option>
200
               <option value=""> </option>
200
               [% FOREACH itemtype IN itemtypes %]
201
               [% FOREACH itemtype IN itemtypes %]
201
                 <option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
202
                 <option value="[% itemtype.itemtype | html %]">[% ItemTypes.t(itemtype.description) | html %]</option>
202
               [% END %]
203
               [% END %]
203
               </select>
204
               </select>
204
             </td> 
205
             </td> 
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt (-1 / +1 lines)
Lines 158-164 Link Here
158
    <li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
158
    <li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
159
                <option value="">All</option>
159
                <option value="">All</option>
160
                [% FOREACH itemtype IN itemtypes %]
160
                [% FOREACH itemtype IN itemtypes %]
161
                    <option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
161
                    <option value="[% itemtype.itemtype | html %]">[% ItemTypes.t(itemtype.description) | html %]</option>
162
                [% END %]
162
                [% END %]
163
            </select></li>
163
            </select></li>
164
164
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt (-1 / +2 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE ItemTypes %]
2
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Holds statistics[% IF ( do_it ) %] &rsaquo; Results[% END %] &rsaquo; Reports &rsaquo; Koha</title>
5
<title>Holds statistics[% IF ( do_it ) %] &rsaquo; Results[% END %] &rsaquo; Reports &rsaquo; Koha</title>
Lines 201-207 Link Here
201
           <td><select name="filter_items.itype" id="itype">
202
           <td><select name="filter_items.itype" id="itype">
202
               <option value=""> </option>
203
               <option value=""> </option>
203
               [% FOREACH itemtype IN itemtypes %]
204
               [% FOREACH itemtype IN itemtypes %]
204
                 <option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
205
                 <option value="[% itemtype.itemtype | html %]">[% ItemTypes.t(itemtype.description) | html %]</option>
205
               [% END %]
206
               [% END %]
206
               </select>
207
               </select>
207
             </td> 
208
             </td> 
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-4 / +5 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE To %]
2
[% USE To %]
3
[% USE Asset %]
3
[% USE Asset %]
4
[% USE ItemTypes %]
4
[% USE KohaDates %]
5
[% USE KohaDates %]
5
[% USE Branches %]
6
[% USE Branches %]
6
[% USE Koha %]
7
[% USE Koha %]
Lines 227-235 fieldset.rows table { clear: none; margin: 0; } Link Here
227
                                        <option value=""></option>
228
                                        <option value=""></option>
228
                                        [% FOREACH type IN typeloop %]
229
                                        [% FOREACH type IN typeloop %]
229
                                            [% IF ( type.selected ) %]
230
                                            [% IF ( type.selected ) %]
230
                                                <option value="[% type.code | html %]" selected="selected">[% type.value | html %]</option>
231
                                                <option value="[% type.code | html %]" selected="selected">[% ItemTypes.t(type.value) | html %]</option>
231
                                            [% ELSE %]
232
                                            [% ELSE %]
232
                                                <option value="[% type.code | html %]">[% type.value | html %]</option>
233
                                                <option value="[% type.code | html %]">[% ItemTypes.t(type.value) | html %]</option>
233
                                            [% END %]
234
                                            [% END %]
234
                                        [% END %]
235
                                        [% END %]
235
                                    </select>
236
                                    </select>
Lines 241-249 fieldset.rows table { clear: none; margin: 0; } Link Here
241
                                            <option value=""></option>
242
                                            <option value=""></option>
242
                                        [% FOREACH previous IN previoustypeloop %]
243
                                        [% FOREACH previous IN previoustypeloop %]
243
                                            [% IF ( previous.selected ) %]
244
                                            [% IF ( previous.selected ) %]
244
                                                <option value="[% previous.code | html %]" selected="selected">[% previous.value | html %]</option>
245
                                                <option value="[% previous.code | html %]" selected="selected">[% ItemTypes.t(previous.value) | html %]</option>
245
                                            [% ELSE %]
246
                                            [% ELSE %]
246
                                                <option value="[% previous.code | html %]">[% previous.value | html %]</option>
247
                                                <option value="[% previous.code | html %]">[% ItemTypes.t(previous.value) | html %]</option>
247
                                            [% END %]
248
                                            [% END %]
248
                                        [% END %]
249
                                        [% END %]
249
                                    </select>
250
                                    </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-batchedit.tt (-1 / +1 lines)
Lines 122-128 Link Here
122
                                    <select id="itemtype" name="itemtype">
122
                                    <select id="itemtype" name="itemtype">
123
                                        <option value="">No change</option>
123
                                        <option value="">No change</option>
124
                                        [% FOREACH itemtype IN ItemTypes.Get() %]
124
                                        [% FOREACH itemtype IN ItemTypes.Get() %]
125
                                            <option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option>
125
                                            <option value="[% itemtype.itemtype | html %]">[% ItemTypes.t(itemtype.description) | html %]</option>
126
                                        [% END %]
126
                                        [% END %]
127
                                    </select>
127
                                    </select>
128
                                </li>
128
                                </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tt (-1 / +2 lines)
Lines 1-3 Link Here
1
[% USE ItemTypes %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Catalog search &rsaquo; Serials &rsaquo; Koha</title>
3
<title>Catalog search &rsaquo; Serials &rsaquo; Koha</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 25-31 Link Here
25
                <option value="">All</option>
26
                <option value="">All</option>
26
                [%- FOREACH itemtypeloo IN itemtypeloop %]
27
                [%- FOREACH itemtypeloo IN itemtypeloop %]
27
                <option value="[% itemtypeloo.code | html %]">
28
                <option value="[% itemtypeloo.code | html %]">
28
                    [% itemtypeloo.description | html %]
29
                    [% ItemTypes.t(itemtypeloo.description) | html %]
29
                </option>
30
                </option>
30
                [%- END %]
31
                [%- END %]
31
            </select>
32
            </select>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt (-1 / +2 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% USE ItemTypes %]
4
[% SET footerjs = 1 %]
5
[% SET footerjs = 1 %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Export data &rsaquo; Cataloging &rsaquo; Koha</title>
7
<title>Export data &rsaquo; Cataloging &rsaquo; Koha</title>
Lines 87-93 Link Here
87
                            <select name="itemtype" id="itemtype" multiple>
88
                            <select name="itemtype" id="itemtype" multiple>
88
                                <option value="">-- All --</option>
89
                                <option value="">-- All --</option>
89
                                [% FOREACH itemtype IN itemtypes %]
90
                                [% FOREACH itemtype IN itemtypes %]
90
                                    <option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
91
                                    <option value="[% itemtype.itemtype | html %]">[% ItemTypes.t(itemtype.description) | html %]</option>
91
                                [% END %]
92
                                [% END %]
92
                            </select>
93
                            </select>
93
                        </li>
94
                        </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt (-2 / +3 lines)
Lines 1-5 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE ItemTypes %]
3
[% USE Koha %]
4
[% USE Koha %]
4
[% USE KohaDates %]
5
[% USE KohaDates %]
5
[% USE AuthorisedValues %]
6
[% USE AuthorisedValues %]
Lines 331-339 Link Here
331
                                        [% UNLESS ( item_level_itypes ) %]
332
                                        [% UNLESS ( item_level_itypes ) %]
332
                                            <td>
333
                                            <td>
333
                                                [% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %]
334
                                                [% UNLESS ( noItemTypeImages || !itemsloo.imageurl ) %]
334
                                                    <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
335
                                                    <img src="[% itemsloo.imageurl | html %]" alt="[% ItemTypes.t(itemsloo.description) | html %]" title="[% ItemTypes.t(itemsloo.description) | html %]" />
335
                                                [% END %]
336
                                                [% END %]
336
                                                <span class="itypetext">[% itemsloo.description | html %]</span>
337
                                                <span class="itypetext">[% ItemTypes.t(itemsloo.description) | html %]</span>
337
                                            </td>
338
                                            </td>
338
                                        [% END %]
339
                                        [% END %]
339
                                        <td>
340
                                        <td>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc (-1 / +2 lines)
Lines 1-3 Link Here
1
[% USE ItemTypes %]
1
[% USE Koha %]
2
[% USE Koha %]
2
[% USE Branches %]
3
[% USE Branches %]
3
[% PROCESS 'html_helpers.inc' %]
4
[% PROCESS 'html_helpers.inc' %]
Lines 37-43 Link Here
37
                                [% ELSE %]
38
                                [% ELSE %]
38
                                    <option value="[% itemtype.itemtype | html %]">
39
                                    <option value="[% itemtype.itemtype | html %]">
39
                                [% END %]
40
                                [% END %]
40
                                    [% itemtype.translated_description | html %]
41
                                    [% ItemTypes.t(itemtype.description) | html %]
41
                                </option>
42
                                </option>
42
                            [% END %]
43
                            [% END %]
43
                        </select>
44
                        </select>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt (-1 / +2 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE ItemTypes %]
2
[% USE Koha %]
3
[% USE Koha %]
3
[% USE KohaDates %]
4
[% USE KohaDates %]
4
[% USE TablesSettings %]
5
[% USE TablesSettings %]
Lines 168-174 Link Here
168
                                                    [% END %]
169
                                                    [% END %]
169
                                                [% END %]
170
                                                [% END %]
170
                                                <span class="itypetext"><span class="tdlabel">Item type:</span>
171
                                                <span class="itypetext"><span class="tdlabel">Item type:</span>
171
                                                [% issue.translated_description | html %]</span></td>
172
                                                [% ItemTypes.t(issue.description) | html %]</span></td>
172
                                                <td>
173
                                                <td>
173
                                                <span class="tdlabel">Call number:</span>
174
                                                <span class="tdlabel">Call number:</span>
174
                                                [% issue.itemcallnumber | html %]
175
                                                [% issue.itemcallnumber | html %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt (-2 / +2 lines)
Lines 232-238 Link Here
232
                                                <li class="itype">
232
                                                <li class="itype">
233
                                                    <span class="label">Item type: </span>
233
                                                    <span class="label">Item type: </span>
234
                                                    [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl | html %]" alt="" />[% END %]
234
                                                    [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl | html %]" alt="" />[% END %]
235
                                                    <span class="itypetext">[% bibitemloo.translated_description | html %]</span>
235
                                                    <span class="itypetext">[% ItemTypes.t(bibitemloo.description) | html %]</span>
236
                                                </li>
236
                                                </li>
237
                                            [% END %]
237
                                            [% END %]
238
238
Lines 421-427 Link Here
421
                                                                            <img src="[% itemLoo.imageurl | html %]" alt="" />
421
                                                                            <img src="[% itemLoo.imageurl | html %]" alt="" />
422
                                                                        [% END %]
422
                                                                        [% END %]
423
                                                                    [% END %]
423
                                                                    [% END %]
424
                                                                    <span class="itypetext">[% itemLoo.translated_description | html %]</span>
424
                                                                    <span class="itypetext">[% ItemTypes.t(itemLoo.description) | html %]</span>
425
                                                                </td>
425
                                                                </td>
426
                                                            [% END %]
426
                                                            [% END %]
427
427
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (-2 / +3 lines)
Lines 1-5 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE ItemTypes %]
3
[% USE Koha %]
4
[% USE Koha %]
4
[% USE AdditionalContents %]
5
[% USE AdditionalContents %]
5
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
6
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
Lines 397-405 Link Here
397
                                                    [% UNLESS ( item_level_itypes ) %]
398
                                                    [% UNLESS ( item_level_itypes ) %]
398
                                                        <td>
399
                                                        <td>
399
                                                            [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
400
                                                            [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
400
                                                                <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
401
                                                                <img src="[% itemsloo.imageurl | html %]" alt="[% ItemTypes.t(itemsloo.description) | html %]" title="[% ItemTypes.t(itemsloo.description) | html %]" />
401
                                                            [% END %]
402
                                                            [% END %]
402
                                                            <span class="itypetext">[% itemsloo.description | html %]</span>
403
                                                            <span class="itypetext">[% ItemTypes.t(itemsloo.description) | html %]</span>
403
                                                        </td>
404
                                                        </td>
404
                                                    [% END %]
405
                                                    [% END %]
405
                                                    <td>
406
                                                    <td>
(-)a/labels/label-item-search.pl (-13 lines)
Lines 206-225 else { Link Here
206
            flagsrequired   => { catalogue => 1 },
206
            flagsrequired   => { catalogue => 1 },
207
        }
207
        }
208
    );
208
    );
209
    my $itemtypes = Koha::ItemTypes->search;
210
    my @itemtypeloop;
211
    while ( my $itemtype = $itemtypes->next ) {
212
        # FIXME This must be improved:
213
        # - pass the iterator to the template
214
        # - display the translated_description
215
        my %row = (
216
            value       => $itemtype->itemtype,
217
            description => $itemtype->description,
218
        );
219
        push @itemtypeloop, \%row;
220
    }
221
    $template->param(
209
    $template->param(
222
        itemtypeloop => \@itemtypeloop,
223
        batch_id     => $batch_id,
210
        batch_id     => $batch_id,
224
        type         => $type,
211
        type         => $type,
225
    );
212
    );
(-)a/opac/opac-detail.pl (-4 / +5 lines)
Lines 71-76 use Koha::Biblios; Link Here
71
use Koha::RecordProcessor;
71
use Koha::RecordProcessor;
72
use Koha::AuthorisedValues;
72
use Koha::AuthorisedValues;
73
use Koha::CirculationRules;
73
use Koha::CirculationRules;
74
use Koha::I18N;
74
use Koha::Items;
75
use Koha::Items;
75
use Koha::ItemTypes;
76
use Koha::ItemTypes;
76
use Koha::Acquisition::Orders;
77
use Koha::Acquisition::Orders;
Lines 232-238 if ($session->param('busc')) { Link Here
232
    {
233
    {
233
        my ($arrParamsBusc, $offset, $results_per_page, $patron) = @_;
234
        my ($arrParamsBusc, $offset, $results_per_page, $patron) = @_;
234
235
235
        my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
236
        my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
236
        my @servers;
237
        my @servers;
237
        @servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
238
        @servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
238
        @servers = ("biblioserver") unless (@servers);
239
        @servers = ("biblioserver") unless (@servers);
Lines 507-518 my $HideMARC = $record_processor->filters->[0]->should_hide_marc( Link Here
507
        interface     => 'opac',
508
        interface     => 'opac',
508
    } );
509
    } );
509
510
510
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
511
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
511
# imageurl:
512
# imageurl:
512
my $itemtype = $dat->{'itemtype'};
513
my $itemtype = $dat->{'itemtype'};
513
if ( $itemtype ) {
514
if ( $itemtype ) {
514
    $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
515
    $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
515
    $dat->{'description'} = $itemtypes->{$itemtype}->{translated_description};
516
    $dat->{'description'} = db_t('itemtype', $itemtypes->{$itemtype}->{description});
516
}
517
}
517
518
518
my $shelflocations =
519
my $shelflocations =
Lines 708-714 else { Link Here
708
        $item_info->{'imageurl'} = getitemtypeimagelocation( 'opac',
709
        $item_info->{'imageurl'} = getitemtypeimagelocation( 'opac',
709
            $itemtypes->{ $itemtype->itemtype }->{'imageurl'} );
710
            $itemtypes->{ $itemtype->itemtype }->{'imageurl'} );
710
        $item_info->{'description'} =
711
        $item_info->{'description'} =
711
          $itemtypes->{ $itemtype->itemtype }->{translated_description};
712
          db_t('itemtype', $itemtypes->{ $itemtype->itemtype }->{description});
712
713
713
        foreach my $field (
714
        foreach my $field (
714
            qw(ccode materials enumchron copynumber itemnotes location_description uri)
715
            qw(ccode materials enumchron copynumber itemnotes location_description uri)
(-)a/opac/opac-readingrecord.pl (-3 / +2 lines)
Lines 54-60 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
54
    }
54
    }
55
);
55
);
56
56
57
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
57
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
58
58
59
# get the record
59
# get the record
60
my $order = $query->param('order') || '';
60
my $order = $query->param('order') || '';
Lines 83-90 my $opac_summary_html = C4::Context->preference('OPACMySummaryHTML'); Link Here
83
foreach my $issue ( @{$issues} ) {
83
foreach my $issue ( @{$issues} ) {
84
    $issue->{normalized_isbn} = GetNormalizedISBN( $issue->{isbn} );
84
    $issue->{normalized_isbn} = GetNormalizedISBN( $issue->{isbn} );
85
    if ( $issue->{$itype_attribute} ) {
85
    if ( $issue->{$itype_attribute} ) {
86
        $issue->{translated_description} =
86
        $issue->{description} = $itemtypes->{ $issue->{$itype_attribute} }->{description};
87
          $itemtypes->{ $issue->{$itype_attribute} }->{translated_description};
88
        $issue->{imageurl} =
87
        $issue->{imageurl} =
89
          getitemtypeimagelocation( 'opac',
88
          getitemtypeimagelocation( 'opac',
90
            $itemtypes->{ $issue->{$itype_attribute} }->{imageurl} );
89
            $itemtypes->{ $issue->{$itype_attribute} }->{imageurl} );
(-)a/opac/opac-reserve.pl (-5 / +4 lines)
Lines 72-78 unless ( $can_place_hold_if_available_at_pickup ) { Link Here
72
    }
72
    }
73
}
73
}
74
74
75
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
75
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
76
76
77
# There are two ways of calling this script, with a single biblio num
77
# There are two ways of calling this script, with a single biblio num
78
# or multiple biblio nums.
78
# or multiple biblio nums.
Lines 413-424 foreach my $biblioNum (@biblionumbers) { Link Here
413
    $biblioLoopIter{object} = $biblio;
413
    $biblioLoopIter{object} = $biblio;
414
414
415
    if (!$itemLevelTypes && $biblioData->{itemtype}) {
415
    if (!$itemLevelTypes && $biblioData->{itemtype}) {
416
        $biblioLoopIter{translated_description} = $itemtypes->{$biblioData->{itemtype}}{translated_description};
416
        $biblioLoopIter{description} = $itemtypes->{$biblioData->{itemtype}}{description};
417
        $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$biblioData->{itemtype}}{imageurl};
417
        $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$biblioData->{itemtype}}{imageurl};
418
    }
418
    }
419
419
420
420
421
422
    $biblioLoopIter{itemLoop} = [];
421
    $biblioLoopIter{itemLoop} = [];
423
    my $numCopiesAvailable = 0;
422
    my $numCopiesAvailable = 0;
424
    my $numCopiesOPACAvailable = 0;
423
    my $numCopiesOPACAvailable = 0;
Lines 437-444 foreach my $biblioNum (@biblionumbers) { Link Here
437
            my $itemtype = $item->itemtype;
436
            my $itemtype = $item->itemtype;
438
            $item_info->{'imageurl'} = getitemtypeimagelocation( 'opac',
437
            $item_info->{'imageurl'} = getitemtypeimagelocation( 'opac',
439
                $itemtypes->{ $itemtype->itemtype }->{'imageurl'} );
438
                $itemtypes->{ $itemtype->itemtype }->{'imageurl'} );
440
            $item_info->{'translated_description'} =
439
            $item_info->{'description'} =
441
              $itemtypes->{ $itemtype->itemtype }->{translated_description};
440
                db_t('itemtype', $itemtypes->{ $itemtype->itemtype }->{description});
442
        }
441
        }
443
442
444
        # checking for holds
443
        # checking for holds
(-)a/opac/opac-search.pl (-7 / +7 lines)
Lines 57-62 use C4::External::BakerTaylor qw( image_url link_url ); Link Here
57
57
58
use Koha::CirculationRules;
58
use Koha::CirculationRules;
59
use Koha::Libraries;
59
use Koha::Libraries;
60
use Koha::I18N;
60
use Koha::ItemTypes;
61
use Koha::ItemTypes;
61
use Koha::Ratings;
62
use Koha::Ratings;
62
use Koha::Virtualshelves;
63
use Koha::Virtualshelves;
Lines 234-247 $template->param(search_languages_loop => $languages_limit_loop,); Link Here
234
235
235
# load the Type stuff
236
# load the Type stuff
236
my $itemtypes = GetItemTypesCategorized;
237
my $itemtypes = GetItemTypesCategorized;
237
# add translated_description to itemtypes
238
foreach my $itemtype ( keys %{$itemtypes} ) {
238
foreach my $itemtype ( keys %{$itemtypes} ) {
239
    # Itemtypes search categories don't have (yet) translated descriptions, they are auth values (and could still have no descriptions too BZ 18400)
239
    # Itemtypes search categories don't have (yet) translated descriptions, they are auth values (and could still have no descriptions too BZ 18400)
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 $translated_description = $itemtypes->{$itemtype}->{iscat}
241
    my $description = $itemtypes->{$itemtype}->{iscat}
242
      ? $itemtypes->{$itemtype}->{description}
242
      ? $itemtypes->{$itemtype}->{description}
243
      : Koha::ItemTypes->find($itemtype)->translated_description;
243
      : db_t('itemtype', Koha::ItemTypes->find($itemtype)->description);
244
    $itemtypes->{$itemtype}->{translated_description} = $translated_description || $itemtypes->{$itemtype}->{description} || q{};
244
    $itemtypes->{$itemtype}->{description} = $description || $itemtypes->{$itemtype}->{description} || q{};
245
}
245
}
246
246
247
# the index parameter is different for item-level itemtypes
247
# the index parameter is different for item-level itemtypes
Lines 253-259 my @advanced_search_types = split(/\|/, $advanced_search_types); Link Here
253
253
254
my $hidingrules = C4::Context->yaml_preference('OpacHiddenItems') // {};
254
my $hidingrules = C4::Context->yaml_preference('OpacHiddenItems') // {};
255
255
256
my @sorted_itemtypes = sort { $itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} } keys %$itemtypes;
256
my @sorted_itemtypes = sort { $itemtypes->{$a}->{description} cmp $itemtypes->{$b}->{description} } keys %$itemtypes;
257
foreach my $advanced_srch_type (@advanced_search_types) {
257
foreach my $advanced_srch_type (@advanced_search_types) {
258
    $advanced_srch_type =~ s/^\s*//;
258
    $advanced_srch_type =~ s/^\s*//;
259
    $advanced_srch_type =~ s/\s*$//;
259
    $advanced_srch_type =~ s/\s*$//;
Lines 266-272 foreach my $advanced_srch_type (@advanced_search_types) { Link Here
266
	    my %row =(  number=>$cnt++,
266
	    my %row =(  number=>$cnt++,
267
		ccl => "$itype_or_itemtype,phr",
267
		ccl => "$itype_or_itemtype,phr",
268
                code => $thisitemtype,
268
                code => $thisitemtype,
269
                description => $itemtypes->{$thisitemtype}->{translated_description},
269
                description => $itemtypes->{$thisitemtype}->{description},
270
                imageurl=> getitemtypeimagelocation( 'opac', $itemtypes->{$thisitemtype}->{'imageurl'} ),
270
                imageurl=> getitemtypeimagelocation( 'opac', $itemtypes->{$thisitemtype}->{'imageurl'} ),
271
                cat => $itemtypes->{$thisitemtype}->{'iscat'},
271
                cat => $itemtypes->{$thisitemtype}->{'iscat'},
272
                hideinopac => $itemtypes->{$thisitemtype}->{'hideinopac'},
272
                hideinopac => $itemtypes->{$thisitemtype}->{'hideinopac'},
Lines 577-583 if ($tag) { Link Here
577
    $pasarParams .= '&amp;count=' . uri_escape_utf8($results_per_page);
577
    $pasarParams .= '&amp;count=' . uri_escape_utf8($results_per_page);
578
    $pasarParams .= '&amp;simple_query=' . uri_escape_utf8($simple_query);
578
    $pasarParams .= '&amp;simple_query=' . uri_escape_utf8($simple_query);
579
    $pasarParams .= '&amp;query_type=' . uri_escape_utf8($query_type) if ($query_type);
579
    $pasarParams .= '&amp;query_type=' . uri_escape_utf8($query_type) if ($query_type);
580
    my $itemtypes_nocategory = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
580
    my $itemtypes_nocategory = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
581
    eval {
581
    eval {
582
        ($error, $results_hashref, $facets) = $searcher->search_compat($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,undef,$itemtypes_nocategory,$query_type,$scan,1);
582
        ($error, $results_hashref, $facets) = $searcher->search_compat($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,undef,$itemtypes_nocategory,$query_type,$scan,1);
583
};
583
};
(-)a/opac/opac-shelves.pl (-1 / +1 lines)
Lines 368-374 if ( $op eq 'view' ) { Link Here
368
                $itemtype = Koha::ItemTypes->find( $itemtype );
368
                $itemtype = Koha::ItemTypes->find( $itemtype );
369
                if( $itemtype ) {
369
                if( $itemtype ) {
370
                    $this_item->{imageurl}          = C4::Koha::getitemtypeimagelocation( 'opac', $itemtype->imageurl );
370
                    $this_item->{imageurl}          = C4::Koha::getitemtypeimagelocation( 'opac', $itemtype->imageurl );
371
                    $this_item->{description}       = $itemtype->description; #FIXME Should not it be translated_description?
371
                    $this_item->{description}       = $itemtype->description;
372
                    $this_item->{notforloan}        = $itemtype->notforloan;
372
                    $this_item->{notforloan}        = $itemtype->notforloan;
373
                }
373
                }
374
                $this_item->{'coins'}           = $biblio->get_coins;
374
                $this_item->{'coins'}           = $biblio->get_coins;
(-)a/opac/opac-user.pl (-1 / +1 lines)
Lines 192-198 my $count = 0; Link Here
192
my $overdues_count = 0;
192
my $overdues_count = 0;
193
my @overdues;
193
my @overdues;
194
my @issuedat;
194
my @issuedat;
195
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
195
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
196
my $pending_checkouts = $patron->pending_checkouts->search({}, { order_by => [ { -desc => 'date_due' }, { -asc => 'issue_id' } ] });
196
my $pending_checkouts = $patron->pending_checkouts->search({}, { order_by => [ { -desc => 'date_due' }, { -asc => 'issue_id' } ] });
197
my $are_renewable_items = 0;
197
my $are_renewable_items = 0;
198
if ( $pending_checkouts->count ) { # Useless test
198
if ( $pending_checkouts->count ) { # Useless test
(-)a/reports/acquisitions_stats.pl (-1 / +1 lines)
Lines 181-187 else { Link Here
181
        $ccode_avlist = GetAuthorisedValues($ccode_subfield_structure->{authorised_value});
181
        $ccode_avlist = GetAuthorisedValues($ccode_subfield_structure->{authorised_value});
182
    }
182
    }
183
183
184
    my $itemtypes = Koha::ItemTypes->search_with_localization;
184
    my $itemtypes = Koha::ItemTypes->search;
185
    $template->param(
185
    $template->param(
186
        booksellers   => $booksellers,
186
        booksellers   => $booksellers,
187
        itemtypes     => $itemtypes, # FIXME Should use the TT plugin instead
187
        itemtypes     => $itemtypes, # FIXME Should use the TT plugin instead
(-)a/reports/bor_issues_top.pl (-1 / +1 lines)
Lines 97-103 my @mime = ( map { {type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation Link Here
97
my $delims = GetDelimiterChoices;
97
my $delims = GetDelimiterChoices;
98
98
99
my $patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['categorycode']});
99
my $patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['categorycode']});
100
my $itemtypes = Koha::ItemTypes->search_with_localization;
100
my $itemtypes = Koha::ItemTypes->search;
101
$template->param(
101
$template->param(
102
	    mimeloop => \@mime,
102
	    mimeloop => \@mime,
103
	  CGIseplist => $delims,
103
	  CGIseplist => $delims,
(-)a/reports/cat_issues_top.pl (-1 / +1 lines)
Lines 98-104 if ($do_it) { Link Here
98
    my $CGIsepChoice=GetDelimiterChoices;
98
    my $CGIsepChoice=GetDelimiterChoices;
99
99
100
    #doctype
100
    #doctype
101
    my $itemtypes = Koha::ItemTypes->search_with_localization;
101
    my $itemtypes = Koha::ItemTypes->search;
102
102
103
    #ccode
103
    #ccode
104
    my $ccodes = GetAuthorisedValues('CCODE');
104
    my $ccodes = GetAuthorisedValues('CCODE');
(-)a/reports/catalogue_out.pl (-1 / +1 lines)
Lines 54-60 if ($do_it) { Link Here
54
    exit;    # in either case, exit after do_it
54
    exit;    # in either case, exit after do_it
55
}
55
}
56
56
57
my $itemtypes = Koha::ItemTypes->search_with_localization;
57
my $itemtypes = Koha::ItemTypes->search;
58
$template->param(
58
$template->param(
59
    itemtypes => $itemtypes,
59
    itemtypes => $itemtypes,
60
);
60
);
(-)a/reports/catalogue_stats.pl (-1 / +1 lines)
Lines 112-118 if ($do_it) { Link Here
112
	my $dbh = C4::Context->dbh;
112
	my $dbh = C4::Context->dbh;
113
	my $count=0;
113
	my $count=0;
114
114
115
    my $itemtypes = Koha::ItemTypes->search_with_localization;
115
    my $itemtypes = Koha::ItemTypes->search;
116
116
117
    my @authvals = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } );
117
    my @authvals = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } );
118
    my @locations = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } );
118
    my @locations = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } );
(-)a/reports/issues_avg_stats.pl (-1 / +1 lines)
Lines 105-111 if ($do_it) { Link Here
105
} else {
105
} else {
106
    my $patron_categories = Koha::Patron::Categories->search({}, {order_by => ['description']});
106
    my $patron_categories = Koha::Patron::Categories->search({}, {order_by => ['description']});
107
107
108
    my $itemtypes = Koha::ItemTypes->search_with_localization;
108
    my $itemtypes = Koha::ItemTypes->search;
109
109
110
    my $dbh = C4::Context->dbh;
110
    my $dbh = C4::Context->dbh;
111
    my $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1");
111
    my $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1");
(-)a/reports/issues_stats.pl (-3 / +4 lines)
Lines 28-33 use C4::Output qw( output_html_with_http_headers ); Link Here
28
use C4::Reports qw( GetDelimiterChoices );
28
use C4::Reports qw( GetDelimiterChoices );
29
29
30
use Koha::AuthorisedValues;
30
use Koha::AuthorisedValues;
31
use Koha::I18N;
31
use Koha::ItemTypes;
32
use Koha::ItemTypes;
32
use Koha::Patron::Attribute::Types;
33
use Koha::Patron::Attribute::Types;
33
34
Lines 74-80 our $sep = C4::Context->csv_delimiter(scalar $input->param("sep")); Link Here
74
$template->param(do_it => $do_it,
75
$template->param(do_it => $do_it,
75
);
76
);
76
77
77
our $itemtypes = Koha::ItemTypes->search_with_localization->unblessed;
78
our $itemtypes = Koha::ItemTypes->search->unblessed;
78
79
79
our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
80
our @patron_categories = Koha::Patron::Categories->search_with_library_limits({}, {order_by => ['description']})->as_list;
80
81
Lines 339-345 sub calculate { Link Here
339
        $cell{rowtitle_display} =
340
        $cell{rowtitle_display} =
340
            ( $line =~ /ccode/ )    ? $ccodes->{$celvalue}
341
            ( $line =~ /ccode/ )    ? $ccodes->{$celvalue}
341
          : ( $line =~ /location/ ) ? $locations->{$celvalue}
342
          : ( $line =~ /location/ ) ? $locations->{$celvalue}
342
          : ( $line =~ /itemtype/ ) ? $itemtypes_map->{$celvalue}->{translated_description}
343
          : ( $line =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{description})
343
          :                           $celvalue;                               # default fallback
344
          :                           $celvalue;                               # default fallback
344
        if ( $line =~ /sort1/ ) {
345
        if ( $line =~ /sort1/ ) {
345
            foreach (@$Bsort1) {
346
            foreach (@$Bsort1) {
Lines 428-434 sub calculate { Link Here
428
        $cell{coltitle_display} =
429
        $cell{coltitle_display} =
429
            ( $column =~ /ccode/ )    ? $ccodes->{$celvalue}
430
            ( $column =~ /ccode/ )    ? $ccodes->{$celvalue}
430
          : ( $column =~ /location/ ) ? $locations->{$celvalue}
431
          : ( $column =~ /location/ ) ? $locations->{$celvalue}
431
          : ( $column =~ /itemtype/ ) ? $itemtypes_map->{$celvalue}->{translated_description}
432
          : ( $column =~ /itemtype/ ) ? db_t('itemtype', $itemtypes_map->{$celvalue}->{description});
432
          :                             $celvalue;                               # default fallback
433
          :                             $celvalue;                               # default fallback
433
        if ( $column =~ /sort1/ ) {
434
        if ( $column =~ /sort1/ ) {
434
            foreach (@$Bsort1) {
435
            foreach (@$Bsort1) {
(-)a/reports/itemslost.pl (-1 / +1 lines)
Lines 149-155 if ( $op eq 'export' ) { Link Here
149
}
149
}
150
150
151
# getting all itemtypes
151
# getting all itemtypes
152
my $itemtypes = Koha::ItemTypes->search_with_localization;
152
my $itemtypes = Koha::ItemTypes->search;
153
153
154
my $csv_profiles = Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_lost_items' });
154
my $csv_profiles = Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_lost_items' });
155
155
(-)a/reports/reserves_stats.pl (-2 / +3 lines)
Lines 28-33 use C4::Output qw( output_html_with_http_headers ); Link Here
28
use C4::Reports qw( GetDelimiterChoices );
28
use C4::Reports qw( GetDelimiterChoices );
29
use C4::Members;
29
use C4::Members;
30
use Koha::AuthorisedValues;
30
use Koha::AuthorisedValues;
31
use Koha::I18N;
31
use Koha::ItemTypes;
32
use Koha::ItemTypes;
32
use Koha::Libraries;
33
use Koha::Libraries;
33
use Koha::Patron::Categories;
34
use Koha::Patron::Categories;
Lines 120-126 if ($do_it) { Link Here
120
121
121
my $dbh = C4::Context->dbh;
122
my $dbh = C4::Context->dbh;
122
123
123
my $itemtypes = Koha::ItemTypes->search_with_localization;
124
my $itemtypes = Koha::ItemTypes->search;
124
125
125
    # location list
126
    # location list
126
my @locations;
127
my @locations;
Lines 298-304 sub display_value { Link Here
298
    my $display_value =
299
    my $display_value =
299
        ( $crit =~ /ccode/ )         ? $ccodes->{$value}
300
        ( $crit =~ /ccode/ )         ? $ccodes->{$value}
300
      : ( $crit =~ /location/ )      ? $locations->{$value}
301
      : ( $crit =~ /location/ )      ? $locations->{$value}
301
      : ( $crit =~ /itemtype/ )      ? Koha::ItemTypes->find( $value )->translated_description
302
      : ( $crit =~ /itemtype/ )      ? db_t('itemtype', Koha::ItemTypes->find( $value )->description)
302
      : ( $crit =~ /branch/ )        ? Koha::Libraries->find($value)->branchname
303
      : ( $crit =~ /branch/ )        ? Koha::Libraries->find($value)->branchname
303
      : ( $crit =~ /reservestatus/ ) ? reservestatushuman($value)
304
      : ( $crit =~ /reservestatus/ ) ? reservestatushuman($value)
304
      :                                $value;    # default fallback
305
      :                                $value;    # default fallback
(-)a/reserve/request.pl (-1 / +1 lines)
Lines 71-77 my $itemtypes = { Link Here
71
    map {
71
    map {
72
        $_->itemtype =>
72
        $_->itemtype =>
73
          { %{ $_->unblessed }, image_location => $_->image_location('intranet'), notforloan => $_->notforloan }
73
          { %{ $_->unblessed }, image_location => $_->image_location('intranet'), notforloan => $_->notforloan }
74
    } Koha::ItemTypes->search_with_localization->as_list
74
    } Koha::ItemTypes->search->as_list
75
};
75
};
76
76
77
# Select borrowers infos
77
# Select borrowers infos
(-)a/serials/subscription-add.pl (-2 / +1 lines)
Lines 145-153 $template->param( Link Here
145
    additional_field_values => \%additional_field_values,
145
    additional_field_values => \%additional_field_values,
146
);
146
);
147
147
148
my $typeloop = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
148
my $typeloop = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
149
149
150
# FIXME We should use the translated_description for item types
151
my @typearg =
150
my @typearg =
152
    map { { code => $_, value => $typeloop->{$_}{'description'}, selected => ( ( $subs->{itemtype} and $_ eq $subs->{itemtype} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$typeloop};
151
    map { { code => $_, value => $typeloop->{$_}{'description'}, selected => ( ( $subs->{itemtype} and $_ eq $subs->{itemtype} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$typeloop};
153
my @previoustypearg =
152
my @previoustypearg =
(-)a/serials/subscription-bib-search.pl (-2 / +1 lines)
Lines 193-202 else { Link Here
193
    );
193
    );
194
194
195
    # load the itemtypes
195
    # load the itemtypes
196
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
196
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
197
    my @itemtypesloop;
197
    my @itemtypesloop;
198
    # FIXME This is uselessly complex, the iterator should be send to the template
198
    # FIXME This is uselessly complex, the iterator should be send to the template
199
    # FIXME The translated_description should be used
200
    foreach my $thisitemtype (
199
    foreach my $thisitemtype (
201
        sort {
200
        sort {
202
            $itemtypes->{$a}->{'description'}
201
            $itemtypes->{$a}->{'description'}
(-)a/svc/bib_profile (-1 / +1 lines)
Lines 113-119 sub _get_bib_number_tag { Link Here
113
113
114
sub _get_biblioitem_itemtypes {
114
sub _get_biblioitem_itemtypes {
115
    my $result = shift;
115
    my $result = shift;
116
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
116
    my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
117
    my $sth = $dbh->prepare_cached("SELECT tagfield, tagsubfield
117
    my $sth = $dbh->prepare_cached("SELECT tagfield, tagsubfield
118
                                    FROM marc_subfield_structure 
118
                                    FROM marc_subfield_structure 
119
                                    WHERE frameworkcode = '' 
119
                                    WHERE frameworkcode = '' 
(-)a/svc/checkouts (-1 / +2 lines)
Lines 30-35 use C4::Context; Link Here
30
use Koha::AuthorisedValues;
30
use Koha::AuthorisedValues;
31
use Koha::DateUtils qw( dt_from_string output_pref );
31
use Koha::DateUtils qw( dt_from_string output_pref );
32
use Koha::Items;
32
use Koha::Items;
33
use Koha::I18N;
33
use Koha::ItemTypes;
34
use Koha::ItemTypes;
34
35
35
my $input = CGI->new;
36
my $input = CGI->new;
Lines 146-152 my $item_level_itypes = C4::Context->preference('item-level_itypes'); Link Here
146
my $claims_returned_lost_value = C4::Context->preference('ClaimReturnedLostValue');
147
my $claims_returned_lost_value = C4::Context->preference('ClaimReturnedLostValue');
147
my $confirm_parts_required = C4::Context->preference("CircConfirmItemParts");
148
my $confirm_parts_required = C4::Context->preference("CircConfirmItemParts");
148
149
149
my $itemtypes = { map { $_->{itemtype} => $_->{translated_description} } @{ Koha::ItemTypes->search_with_localization->unblessed } };
150
my $itemtypes = { map { $_->{itemtype} => db_t('itemtypes', $_->{itemtype}) } @{ Koha::ItemTypes->search->unblessed } };
150
151
151
my @checkouts_today;
152
my @checkouts_today;
152
my @checkouts_previous;
153
my @checkouts_previous;
(-)a/svc/holds (-1 / +2 lines)
Lines 28-33 use C4::Context; Link Here
28
28
29
use Koha::DateUtils qw( dt_from_string output_pref );
29
use Koha::DateUtils qw( dt_from_string output_pref );
30
use Koha::Holds;
30
use Koha::Holds;
31
use Koha::I18N;
31
use Koha::ItemTypes;
32
use Koha::ItemTypes;
32
use Koha::Libraries;
33
use Koha::Libraries;
33
34
Lines 81-87 while ( my $h = $holds_rs->next() ) { Link Here
81
    my $itemtype_limit;
82
    my $itemtype_limit;
82
    if ( $h->itemtype ) {
83
    if ( $h->itemtype ) {
83
        my $itemtype = Koha::ItemTypes->find( $h->itemtype );
84
        my $itemtype = Koha::ItemTypes->find( $h->itemtype );
84
        $itemtype_limit = $itemtype->translated_description;
85
        $itemtype_limit = db_t('itemtype', $itemtype->description);
85
    }
86
    }
86
87
87
    my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
88
    my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
(-)a/svc/localization (-74 / +55 lines)
Lines 4-104 use Modern::Perl; Link Here
4
use Encode qw( encode );
4
use Encode qw( encode );
5
5
6
use C4::Service;
6
use C4::Service;
7
use Koha::Localizations;
7
use Koha::Caches;
8
use Koha::Database;
8
9
9
our ( $query, $response ) = C4::Service->init( parameters => 'manage_itemtypes' );
10
our ( $query, $response ) = C4::Service->init( parameters => 'parameters_remaining_permissions' );
10
11
11
sub get_translations {
12
sub get_translations {
12
    my $rs = Koha::Localizations->search({ entity => $query->param('entity'), code => $query->param('code') });
13
    my $draw = $query->param('draw');
13
    my @translations;
14
    my $start = $query->param('start');
14
    while ( my $s = $rs->next ) {
15
    my $length = $query->param('length');
15
        push @translations, {
16
    my $search = $query->param('search[value]');
16
              id          => $s->localization_id,
17
              entity      => $s->entity,
18
              code        => $s->code,
19
              lang        => $s->lang,
20
              translation => $s->translation,
21
        }
22
    }
23
    $response->param( translations => \@translations );
24
    C4::Service->return_success( $response );
25
}
26
17
27
sub update_translation {
18
    my $schema = Koha::Database->new->schema;
28
    my $id = $query->param('id');
19
    my $rs = $schema->resultset('L10nSource');
29
    my $translation = $query->param('translation');
20
    my $recordsTotal = $rs->count;
30
    my $lang = $query->param('lang');
31
21
32
    my $localization = Koha::Localizations->find( $id );
22
    my $cond = {};
33
    if ( defined $lang and $localization->lang ne $lang ) {
23
    if ($search) {
34
        $localization->lang( $lang )
24
        my @and;
35
    }
25
        my @words = split /\s+/, $search;
36
    if ( defined $translation and $localization->translation ne $translation ) {
26
        foreach my $word (@words) {
37
        $localization->translation( $translation )
27
            push @and, \['source LIKE ? COLLATE utf8mb4_unicode_ci', "%$word%"];
38
    }
39
    my %params;
40
    my $is_changed;
41
    if ( $localization->is_changed ) {
42
        $is_changed = 1;
43
        unless ( Koha::Localizations->search( { entity => $localization->entity, code => $localization->code, lang => $lang, localization_id => { '!=' => $localization->localization_id }, } )->count ) {
44
            $localization->store;
45
        } else {
46
            $params{error} = 1;
47
            $params{error_code} = 'already_exists';
48
        }
28
        }
29
        $cond->{-and} = \@and;
49
    }
30
    }
31
32
    $rs = $rs->search($cond);
33
    my $recordsFiltered = $rs->count;
34
35
    my @sources = $rs->search({}, {
36
        prefetch => 'l10n_targets',
37
        result_class => 'DBIx::Class::ResultClass::HashRefInflator',
38
        rows => $length,
39
        offset => $start,
40
        order_by => { -asc => ['context', 'source'] },
41
    });
42
50
    $response->param(
43
    $response->param(
51
        %params,
44
        draw => $draw,
52
        id          => $localization->localization_id,
45
        recordsTotal => $recordsTotal,
53
        entity      => $localization->entity,
46
        recordsFiltered => $recordsFiltered,
54
        code        => $localization->code,
47
        data => \@sources,
55
        lang        => $localization->lang,
56
        translation => $localization->translation,
57
        is_changed  => $is_changed,
58
    );
48
    );
59
    C4::Service->return_success( $response );
49
    C4::Service->return_success( $response );
60
}
50
}
61
51
62
sub add_translation {
52
sub update_translation {
63
    my $entity = $query->param('entity');
53
    my $id = $query->param('id');
64
    my $code = $query->param('code');
65
    my $lang = $query->param('lang');
66
    my $translation = $query->param('translation');
54
    my $translation = $query->param('translation');
55
    my $lang = $query->param('lang');
67
56
68
    unless ( Koha::Localizations->search({entity => $entity, code => $code, lang => $lang, })->count ) {
57
    my $schema = Koha::Database->new->schema;
69
        my $localization = Koha::Localization->new(
58
    my $rs = $schema->resultset('L10nTarget');
70
            {
71
                entity => $entity,
72
                code => $code,
73
                lang => $lang,
74
                translation => $translation,
75
            }
76
        );
77
        $localization->store;
78
        $response->param(
79
            id          => $localization->localization_id,
80
            entity      => $localization->entity,
81
            code        => $localization->code,
82
            lang        => $localization->lang,
83
            translation => $localization->translation,
84
        );
85
59
60
    if (defined $translation && $translation ne '') {
61
        $rs->update_or_create({
62
            l10n_source_id => $id,
63
            language => $lang,
64
            translation => $translation,
65
        }, {
66
            key => 'l10n_source_language',
67
        });
86
    } else {
68
    } else {
87
        $response->param( error => 1, error_code => 'already_exists', );
69
        $rs->search({
70
            l10n_source_id => $id,
71
            language => $lang,
72
        })->delete;
88
    }
73
    }
89
    C4::Service->return_success( $response );
90
}
91
74
92
sub delete_translation {
75
    my $source = $schema->resultset('L10nSource')->find($id);
93
    my $id = $query->param('id');
76
    my $cache_key = sprintf('%s:%s', $source->context, $lang);
94
    Koha::Localizations->find($id)->delete;
77
    Koha::Caches->get_instance()->clear_from_cache($cache_key);
95
    $response->param( id => $id );
78
96
    C4::Service->return_success( $response );
79
    C4::Service->return_success( $response );
97
}
80
}
98
81
99
C4::Service->dispatch(
82
C4::Service->dispatch(
100
    [ 'GET /', [ 'id' ], \&get_translations ],
83
    [ 'GET /', [], \&get_translations ],
101
    [ 'PUT /', [ 'id' ], \&update_translation ],
84
    [ 'PUT /', [ 'id' ], \&update_translation ],
102
    [ 'POST /', [ 'entity', 'code', 'lang', 'translation' ], \&add_translation ],
103
    [ 'DELETE /', ['id'],  \&delete_translation ],
104
);
85
);
(-)a/t/db_dependent/Koha/ItemTypes.t (-40 / +4 lines)
Lines 67-97 my $child3 = $builder->build_object({ Link Here
67
        }
67
        }
68
    });
68
    });
69
69
70
Koha::Localization->new(
71
    {
72
        entity      => 'itemtypes',
73
        code        => $child1->itemtype,
74
        lang        => 'en',
75
        translation => 'b translated itemtype desc'
76
    }
77
)->store;
78
Koha::Localization->new(
79
    {
80
        entity      => 'itemtypes',
81
        code        => $child2->itemtype,
82
        lang        => 'en',
83
        translation => 'a translated itemtype desc'
84
    }
85
)->store;
86
Koha::Localization->new(
87
    {
88
        entity      => 'something_else',
89
        code        => $child2->itemtype,
90
        lang        => 'en',
91
        translation => 'another thing'
92
    }
93
)->store;
94
95
my $type = Koha::ItemTypes->find($child1->itemtype);
70
my $type = Koha::ItemTypes->find($child1->itemtype);
96
ok( defined($type), 'first result' );
71
ok( defined($type), 'first result' );
97
is_deeply( $type->unblessed, $child1->unblessed, "We got back the same object" );
72
is_deeply( $type->unblessed, $child1->unblessed, "We got back the same object" );
Lines 103-124 is_deeply( $type->unblessed, $child2->unblessed, "We got back the same object" ) Link Here
103
78
104
t::lib::Mocks::mock_preference('language', 'en');
79
t::lib::Mocks::mock_preference('language', 'en');
105
t::lib::Mocks::mock_preference('OPACLanguages', 'en');
80
t::lib::Mocks::mock_preference('OPACLanguages', 'en');
106
my $itemtypes = Koha::ItemTypes->search_with_localization;
81
my $itemtypes = Koha::ItemTypes->search;
107
is( $itemtypes->count, $initial_count + 4, 'We added 4 item types' );
82
is( $itemtypes->count, $initial_count + 4, 'We added 4 item types' );
108
my $first_itemtype = $itemtypes->next;
83
109
is(
84
my $children = $parent1->children;
110
    $first_itemtype->translated_description,
85
is ($children->count, 3, 'parent type has 3 children');
111
    'a translated itemtype desc',
112
    'item types should be sorted by translated description'
113
);
114
115
my $children = $parent1->children_with_localization;
116
my $first_child = $children->next;
117
is(
118
    $first_child->translated_description,
119
    'a translated itemtype desc',
120
    'item types should be sorted by translated description'
121
);
122
86
123
my $item_type = $builder->build_object({ class => 'Koha::ItemTypes' });
87
my $item_type = $builder->build_object({ class => 'Koha::ItemTypes' });
124
88
(-)a/tools/batchMod.pl (+1 lines)
Lines 31-36 use List::MoreUtils qw( uniq ); Link Here
31
use Encode qw( encode_utf8 );
31
use Encode qw( encode_utf8 );
32
32
33
use Koha::Database;
33
use Koha::Database;
34
use Koha::I18N;
34
use Koha::Exception;
35
use Koha::Exception;
35
use Koha::Biblios;
36
use Koha::Biblios;
36
use Koha::Items;
37
use Koha::Items;
(-)a/tools/export.pl (-1 / +1 lines)
Lines 270-276 if ( $op eq "export" ) { Link Here
270
270
271
else {
271
else {
272
272
273
    my $itemtypes = Koha::ItemTypes->search_with_localization;
273
    my $itemtypes = Koha::ItemTypes->search;
274
274
275
    my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
275
    my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
276
276
(-)a/virtualshelves/shelves.pl (-2 / +1 lines)
Lines 307-313 if ( $op eq 'view' ) { Link Here
307
                $this_item->{author}            = $biblio->author;
307
                $this_item->{author}            = $biblio->author;
308
                $this_item->{dateadded}         = $content->dateadded;
308
                $this_item->{dateadded}         = $content->dateadded;
309
                $this_item->{imageurl}          = $itemtype ? C4::Koha::getitemtypeimagelocation( 'intranet', $itemtype->imageurl ) : q{};
309
                $this_item->{imageurl}          = $itemtype ? C4::Koha::getitemtypeimagelocation( 'intranet', $itemtype->imageurl ) : q{};
310
                $this_item->{description}       = $itemtype ? $itemtype->description : q{}; #FIXME Should this be translated_description ?
310
                $this_item->{description}       = $itemtype ? $itemtype->description : q{};
311
                $this_item->{notforloan}        = $itemtype->notforloan if $itemtype;
311
                $this_item->{notforloan}        = $itemtype->notforloan if $itemtype;
312
                $this_item->{'coins'}           = $biblio->get_coins;
312
                $this_item->{'coins'}           = $biblio->get_coins;
313
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
313
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
314
- 

Return to bug 24975