Bug Fix : kohanews was broken when nodate or bad formatted supplied.
authorHenri-Damien LAURENT <henridamien@koha-fr.org>
Mon, 22 Oct 2007 19:43:15 +0000 (14:43 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 22 Oct 2007 20:40:39 +0000 (15:40 -0500)
+ 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>
C4/Languages.pm
tools/koha-news.pl

index 626449d..8a8ae2e 100644 (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);
index 49879e7..76e1093 100755 (executable)
@@ -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(