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 |
|