From 789eab7d430bbb9af3fbeb267ac4f43c98c55602 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Mon, 22 Oct 2007 14:43:15 -0500 Subject: [PATCH] Bug Fix : kohanews was broken when nodate or bad formatted supplied. + minor change in Languages in order not to have problems with eq Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Languages.pm | 4 ++-- tools/koha-news.pl | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/C4/Languages.pm b/C4/Languages.pm index 626449d140..8a8ae2e25f 100644 --- a/C4/Languages.pm +++ b/C4/Languages.pm @@ -106,7 +106,7 @@ sub getTranslatedLanguages { my @languages; my $lang; - if ( $interface eq 'opac' ) { + if ($interface && $interface eq 'opac' ) { $htdocs = C4::Context->config('opachtdocs'); if ( $theme and -d "$htdocs/$theme" ) { (@languages) = _get_language_dirs($htdocs,$theme); @@ -119,7 +119,7 @@ sub getTranslatedLanguages { return _get_final_languages($all_languages,@languages); } } - elsif ( $interface eq 'intranet' ) { + elsif ($interface && $interface eq 'intranet' ) { $htdocs = C4::Context->config('intrahtdocs'); if ( $theme and -d "$htdocs/$theme" ) { @languages = _get_language_dirs($htdocs,$theme); diff --git a/tools/koha-news.pl b/tools/koha-news.pl index 49879e71be..76e10935bd 100755 --- a/tools/koha-news.pl +++ b/tools/koha-news.pl @@ -103,9 +103,11 @@ else { foreach my $new ( @$opac_news ) { next unless $new->{'expirationdate'}; # next if $new->{'expirationdate'} eq '0000-00-00'; # now saved as null - if (Date_to_Days( split "-" ,$new->{'expirationdate'} ) < Date_to_Days(&Today) ){ - $new->{'hasexpirated'} = 1; - } + $new->{'expirationdate'}=format_date_in_iso($new->{'expirationdate'}); + my @date = split (/-/,$new->{'expirationdate'}); + if ($date[0]*$date[1]*$date[2]>0 && Date_to_Days( @date ) < Date_to_Days(&Today) ){ + $new->{'hasexpirated'} = 1; + } } $template->param( -- 2.20.1