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

(-)a/Koha/AdditionalContents.pm (-2 / +7 lines)
Lines 20-25 package Koha::AdditionalContents; Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Array::Utils qw( array_minus );
22
use Array::Utils qw( array_minus );
23
use Data::Dumper;
23
24
24
use Koha::Database;
25
use Koha::Database;
25
use Koha::Exceptions;
26
use Koha::Exceptions;
Lines 83-89 sub search_for_display { Link Here
83
    my $search_params;
84
    my $search_params;
84
    $search_params->{location}       = $params->{location};
85
    $search_params->{location}       = $params->{location};
85
    $search_params->{branchcode}     = $params->{library_id} ? [ $params->{library_id}, undef ] : undef;
86
    $search_params->{branchcode}     = $params->{library_id} ? [ $params->{library_id}, undef ] : undef;
86
    $search_params->{published_on}   = { '<=' => \'CAST(NOW() AS DATE)' };
87
    $params->{category} && $params->{category} eq 'news'
88
        ? $search_params->{published_on} = { '<=' => \'CAST(NOW() AS DATE)' }
89
        : $search_params->{-or} = [
90
            published_on => { '<=' => \'CAST(NOW() AS DATE)' },
91
            published_on => { '='  => \'NULL' }
92
        ];
87
    $search_params->{expirationdate} = [ '-or', { '>=' => \'CAST(NOW() AS DATE)' }, undef ];
93
    $search_params->{expirationdate} = [ '-or', { '>=' => \'CAST(NOW() AS DATE)' }, undef ];
88
    $search_params->{category}       = $params->{category} if $params->{category};
94
    $search_params->{category}       = $params->{category} if $params->{category};
89
    $search_params->{lang}           = 'default' if !$lang || $lang eq 'default';
95
    $search_params->{lang}           = 'default' if !$lang || $lang eq 'default';
90
- 

Return to bug 31450