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 <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Henri-Damien LAURENT 2007-10-22 14:43:15 -05:00 committed by Joshua Ferraro
parent b8d8b0be67
commit 789eab7d43
2 changed files with 7 additions and 5 deletions

View file

@ -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);

View file

@ -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(