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

(-)a/Koha/ItemTypes.pm (-4 / +8 lines)
Lines 46-56 sub search_with_localization { Link Here
46
    my ( $self, $params, $attributes ) = @_;
46
    my ( $self, $params, $attributes ) = @_;
47
47
48
    my $language = C4::Languages::getlanguage();
48
    my $language = C4::Languages::getlanguage();
49
    $params->{'-or'} = { 'localization.lang' => [ $language, undef ] };
49
    $Koha::Schema::Result::Itemtype::LANGUAGE = $language;
50
    $attributes->{order_by} = 'localization.translation' unless exists $attributes->{order_by};
50
    $attributes->{order_by} = 'translated_description' unless exists $attributes->{order_by};
51
    $attributes->{join} = 'localization';
51
    $attributes->{join} = 'localization';
52
    $attributes->{'+select'} = [ { coalesce => [qw( localization.translation me.description )] } ];
52
    $attributes->{'+select'} = [
53
    $attributes->{'+as'} = ['translated_description'];
53
        {
54
            coalesce => [qw( localization.translation me.description )],
55
            -as      => 'translated_description'
56
        }
57
    ];
54
    $self->SUPER::search( $params, $attributes );
58
    $self->SUPER::search( $params, $attributes );
55
}
59
}
56
60
(-)a/Koha/Schema/Result/Itemtype.pm (-4 / +13 lines)
Lines 199-209 __PACKAGE__->has_many( Link Here
199
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1GiikODklVISOurHX37qjA
199
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1GiikODklVISOurHX37qjA
200
200
201
# Use the ItemtypeLocalization view to create the join on localization
201
# Use the ItemtypeLocalization view to create the join on localization
202
our $LANGUAGE;
202
__PACKAGE__->has_many(
203
__PACKAGE__->has_many(
203
  "localization",
204
  "localization" => "Koha::Schema::Result::ItemtypeLocalization",
204
  "Koha::Schema::Result::ItemtypeLocalization",
205
    sub {
205
  { "foreign.code" => "self.itemtype" },
206
        my $args = shift;
206
  { cascade_copy => 0, cascade_delete => 0 },
207
208
        die "no lang specified!" unless $LANGUAGE;
209
210
        return ({
211
            "$args->{self_alias}.itemtype" => { -ident => "$args->{foreign_alias}.code" },
212
            "$args->{foreign_alias}.lang" => $LANGUAGE,
213
        });
214
215
    }
207
);
216
);
208
217
209
1;
218
1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt (-2 / +2 lines)
Lines 223-230 Link Here
223
            <td><input type="radio" name="Column" value="items.itype" /></td>
223
            <td><input type="radio" name="Column" value="items.itype" /></td>
224
           <td><select name="filter_items.itype" id="itype">
224
           <td><select name="filter_items.itype" id="itype">
225
               <option value=""> </option>
225
               <option value=""> </option>
226
               [% FOREACH itypeloo IN itemtypeloop %]
226
               [% FOREACH itemtype IN itemtypes %]
227
                 [% IF ( itypeloo.selected ) %]<option value="[% itypeloo.code %]" selected="selected">[% itypeloo.description %]</option>[% ELSE %]<option value="[% itypeloo.code %]">[% itypeloo.description %]</option>[% END %]
227
                 <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
228
               [% END %]
228
               [% END %]
229
               </select>
229
               </select>
230
             </td> 
230
             </td> 
(-)a/suggestion/suggestion.pl (+1 lines)
Lines 24-29 use CGI qw ( -utf8 ); Link Here
24
use C4::Auth;    # get_template_and_user
24
use C4::Auth;    # get_template_and_user
25
use C4::Output;
25
use C4::Output;
26
use C4::Suggestions;
26
use C4::Suggestions;
27
use C4::Koha;
27
use C4::Budgets;
28
use C4::Budgets;
28
use C4::Search;
29
use C4::Search;
29
use C4::Members;
30
use C4::Members;
(-)a/t/db_dependent/Koha/ItemTypes.t (-2 / +13 lines)
Lines 57-62 Koha::ItemType->new( Link Here
57
    }
57
    }
58
)->store;
58
)->store;
59
59
60
Koha::ItemType->new(
61
    {
62
        itemtype       => 'type3',
63
        description    => 'description',
64
        rentalcharge   => '0.00',
65
        imageurl       => 'imageurl',
66
        summary        => 'summary',
67
        checkinmsg     => 'checkinmsg',
68
        checkinmsgtype => 'checkinmsgtype',
69
    }
70
)->store;
71
60
Koha::Localization->new(
72
Koha::Localization->new(
61
    {
73
    {
62
        entity      => 'itemtypes',
74
        entity      => 'itemtypes',
Lines 103-109 is( $type->checkinmsg, 'checkinmsg', 'checkinmsg' ); Link Here
103
is( $type->checkinmsgtype, 'checkinmsgtype', 'checkinmsgtype' );
115
is( $type->checkinmsgtype, 'checkinmsgtype', 'checkinmsgtype' );
104
116
105
my $itemtypes = Koha::ItemTypes->search_with_localization;
117
my $itemtypes = Koha::ItemTypes->search_with_localization;
106
is( $itemtypes->count, 2, 'There are 2 item types' );
118
is( $itemtypes->count, 3, 'There are 3 item types' );
107
my $first_itemtype = $itemtypes->next;
119
my $first_itemtype = $itemtypes->next;
108
is(
120
is(
109
    $first_itemtype->translated_description,
121
    $first_itemtype->translated_description,
110
- 

Return to bug 17835