@@ -, +, @@ --- Koha/AdditionalContents.pm | 4 ++-- t/db_dependent/Letters/TemplateToolkit.t | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) --- a/Koha/AdditionalContents.pm +++ a/Koha/AdditionalContents.pm @@ -72,8 +72,8 @@ sub search_for_display { my $search_params; $search_params->{location} = $params->{location}; $search_params->{branchcode} = [ $params->{library_id}, undef ] if $params->{library_id}; - $search_params->{published_on} = { '<=' => \'NOW()' }; - $search_params->{-or} = [ expirationdate => { '>=' => \'NOW()' }, + $search_params->{published_on} = { '<=' => \'CAST(NOW() AS DATE)' }; + $search_params->{-or} = [ expirationdate => { '>=' => \'CAST(NOW() AS DATE)' }, expirationdate => undef ]; if ( $params->{lang} ) { --- a/t/db_dependent/Letters/TemplateToolkit.t +++ a/t/db_dependent/Letters/TemplateToolkit.t @@ -39,7 +39,7 @@ use Koha::Biblio; use Koha::Biblioitem; use Koha::Item; use Koha::Hold; -use Koha::AdditionalContent; +use Koha::AdditionalContents; use Koha::Serial; use Koha::Subscription; use Koha::Suggestion; @@ -631,16 +631,21 @@ EOF my $branchcode = $library->{branchcode}; Koha::AdditionalContents->delete; - my $news_item = Koha::AdditionalContent->new( + my $news_item = $builder->build_object( { - branchcode => $branchcode, - title => "A wonderful news", - content => "This is the wonderful news.", - lang => "slip", - expiration_date => undef, - published_on => $one_minute_ago + class => 'Koha::AdditionalContents', + value => { + category => 'news', + location => "slip", + branchcode => $branchcode, + lang => 'default', + title => "A wonderful news", + content => "This is the wonderful news.", + expiration_date => undef, + published_on => $one_minute_ago + } } - )->store; + ); # historic syntax my $template = <