From 35b224ebf305da64bf0d360c004c734ab63a44b8 Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Sun, 20 Apr 2014 09:28:03 +0000 Subject: [PATCH] holiday: configDB patch (forum#22670) git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@5583 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/95_holiday.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/95_holiday.pm b/fhem/FHEM/95_holiday.pm index 331782ca8..15cda6195 100755 --- a/fhem/FHEM/95_holiday.pm +++ b/fhem/FHEM/95_holiday.pm @@ -61,10 +61,20 @@ holiday_refresh($$) } my $fname = $attr{global}{modpath} . "/FHEM/" . $hash->{NAME} . ".holiday"; - return "Can't open $fname: $!" if(!open(FH, $fname)); + my @holidayfile; + if($attr{global}{configfile} eq 'configDB') { + my $hfile = _cfgDB_Readfile($fname); + return "Holiday file not found in database." unless defined $hfile; + @holidayfile = split("\n", $hfile); + } else { + return "Can't open $fname: $!" if(!open(FH, $fname)); + @holidayfile = ; + close(LAYOUT); + } + my @foundList; - while(my $l = ) { + foreach my $l (@holidayfile) { next if($l =~ m/^\s*#/); next if($l =~ m/^\s*$/); chomp($l); @@ -171,7 +181,6 @@ holiday_refresh($$) push @foundList, $found if($found); } - close(FH); push @foundList, "none" if(!int(@foundList)); my $found = join(", ", @foundList);