diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm index 4dfde13175..0789cee293 100644 --- a/C4/NewsChannels.pm +++ b/C4/NewsChannels.pm @@ -135,7 +135,7 @@ sub get_opac_new { $sth->execute($idnew); my $data = $sth->fetchrow_hashref; $data->{$data->{'lang'}} = 1 if defined $data->{lang}; - $data->{expirationdate} = output_pref({ dt => dt_from_string( $data->{expirationdate} ), dateonly => 1 }); + $data->{expirationdate} = output_pref({ dt => dt_from_string( $data->{expirationdate} ), dateonly => 1 }) if ( $data->{expirationdate} ); $data->{timestamp} = output_pref({ dt => dt_from_string( $data->{timestamp} ), dateonly => 1 }) ; return $data; } diff --git a/tools/koha-news.pl b/tools/koha-news.pl index d5f2c5b50c..7074f9d624 100755 --- a/tools/koha-news.pl +++ b/tools/koha-news.pl @@ -40,7 +40,10 @@ my $cgi = new CGI; my $id = $cgi->param('id'); my $title = $cgi->param('title'); my $new = $cgi->param('new'); -my $expirationdate = output_pref({ dt => dt_from_string( scalar $cgi->param('expirationdate') ), dateformat => 'iso', dateonly => 1 }); +my $expirationdate; +if ( scalar $cgi->param('expirationdate') ) { + $expirationdate = output_pref({ dt => dt_from_string( scalar $cgi->param('expirationdate') ), dateformat => 'iso', dateonly => 1 }); +} my $timestamp = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 }); my $number = $cgi->param('number'); my $lang = $cgi->param('lang');