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

(-)a/Koha/AdditionalContents.pm (-2 / +10 lines)
Lines 19-24 package Koha::AdditionalContents; Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Data::Dumper;
23
22
use Koha::Database;
24
use Koha::Database;
23
use Koha::Exceptions;
25
use Koha::Exceptions;
24
use Koha::AdditionalContent;
26
use Koha::AdditionalContent;
Lines 69-78 location is one of this: Link Here
69
sub search_for_display {
71
sub search_for_display {
70
    my ( $self, $params ) = @_;
72
    my ( $self, $params ) = @_;
71
73
74
    warn Dumper($params);
75
72
    my $search_params;
76
    my $search_params;
73
    $search_params->{location} = $params->{location};
77
    $search_params->{location} = $params->{location};
74
    $search_params->{branchcode} = $params->{library_id} ? [ $params->{library_id}, undef ] : undef;
78
    $search_params->{branchcode} = $params->{library_id} ? [ $params->{library_id}, undef ] : undef;
75
    $search_params->{published_on} = { '<=' => \'CAST(NOW() AS DATE)' };
79
    $params->{category} && $params->{category} eq 'news'
80
        ? $search_params->{published_on} = { '<=' => \'CAST(NOW() AS DATE)' }
81
        : $search_params->{-or} = [
82
            published_on => { '<=' => \'CAST(NOW() AS DATE)' },
83
            published_on => { '='  => \'NULL' }
84
        ];
76
    $search_params->{-or} = [ expirationdate => { '>=' => \'CAST(NOW() AS DATE)' },
85
    $search_params->{-or} = [ expirationdate => { '>=' => \'CAST(NOW() AS DATE)' },
77
                              expirationdate => undef ];
86
                              expirationdate => undef ];
78
    $search_params->{category} = $params->{category} if $params->{category};
87
    $search_params->{category} = $params->{category} if $params->{category};
79
- 

Return to bug 31450