|
Lines 27-33
use Koha::AuthorisedValue;
Link Here
|
| 27 |
use Koha::MarcSubfieldStructures; |
27 |
use Koha::MarcSubfieldStructures; |
| 28 |
use Koha::Cache::Memory::Lite; |
28 |
use Koha::Cache::Memory::Lite; |
| 29 |
|
29 |
|
| 30 |
use base qw(Koha::Objects); |
30 |
use base qw(Koha::Objects Koha::Objects::Limit::Library); |
| 31 |
|
31 |
|
| 32 |
=head1 NAME |
32 |
=head1 NAME |
| 33 |
|
33 |
|
|
Lines 62-68
sub search {
Link Here
|
| 62 |
: {}; |
62 |
: {}; |
| 63 |
|
63 |
|
| 64 |
my @join = $attributes->{join} || (); |
64 |
my @join = $attributes->{join} || (); |
| 65 |
push @join, 'authorised_values_branches'; |
65 |
push @join, $branchcode ? 'authorised_values_branches' : (); |
| 66 |
my $join = { join => \@join }; |
66 |
my $join = { join => \@join }; |
| 67 |
$attributes //= {}; |
67 |
$attributes //= {}; |
| 68 |
$attributes = { %$attributes, %$join }; |
68 |
$attributes = { %$attributes, %$join }; |
|
Lines 197-211
sub search_with_localization {
Link Here
|
| 197 |
$attributes->{order_by} = 'translated_description' unless exists $attributes->{order_by}; |
197 |
$attributes->{order_by} = 'translated_description' unless exists $attributes->{order_by}; |
| 198 |
my @join = $attributes->{join} || (); |
198 |
my @join = $attributes->{join} || (); |
| 199 |
push @join, 'localization'; |
199 |
push @join, 'localization'; |
| 200 |
my $join = { join => \@join }; |
200 |
$attributes->{join} = \@join; |
| 201 |
$attributes->{'+select'} = [ |
201 |
$attributes->{'+select'} = [ |
| 202 |
{ |
202 |
{ |
| 203 |
coalesce => [qw( localization.translation me.lib )], |
203 |
coalesce => [qw( localization.translation me.lib )], |
| 204 |
-as => 'translated_description' |
204 |
-as => 'translated_description' |
| 205 |
} |
205 |
} |
| 206 |
]; |
206 |
]; |
| 207 |
$attributes = { %$attributes, %$join }; |
207 |
if(defined $params->{branchcode}) { |
| 208 |
$self->search( $params, $attributes ); |
208 |
my $branchcode = delete $params->{branchcode}; |
|
|
209 |
$self->search_with_library_limits( $params, $attributes, $branchcode ); |
| 210 |
} else { |
| 211 |
$self->SUPER::search( $params, $attributes ); |
| 212 |
} |
| 209 |
} |
213 |
} |
| 210 |
|
214 |
|
| 211 |
|
215 |
|