Bug 31383: Check lang and use right column in search_for_display
We should check if $lang equals default before looking for translated contents. And note that @translated_content_id contains additional_content_id not id, so cannot be used in the last query. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
772337f525
commit
2e773a33c3
1 changed files with 4 additions and 4 deletions
|
@ -87,9 +87,9 @@ sub search_for_display {
|
|||
my $contents = $self->SUPER::search( $search_params, { order_by => 'number' } );
|
||||
my @all_content_id = $contents->get_column('id');
|
||||
|
||||
my @translated_content_id;
|
||||
if ( $params->{lang} ) {
|
||||
my $translated_contents = Koha::AdditionalContentsLocalizations->search(
|
||||
my ( $translated_contents, @translated_content_id );
|
||||
if ( $params->{lang} && $params->{lang} ne 'default' ) {
|
||||
$translated_contents = Koha::AdditionalContentsLocalizations->search(
|
||||
{
|
||||
additional_content_id => [$contents->get_column('id')],
|
||||
lang => $params->{lang},
|
||||
|
@ -107,7 +107,7 @@ sub search_for_display {
|
|||
|
||||
return Koha::AdditionalContentsLocalizations->search(
|
||||
{
|
||||
id => [@translated_content_id, $default_contents->get_column('id')]
|
||||
id => [ $translated_contents ? $translated_contents->get_column('id') : (), $default_contents->get_column('id') ]
|
||||
},
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue