holiday: configDB patch (forum#22670)

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@5583 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2014-04-20 09:28:03 +00:00
parent 2098094970
commit 35b224ebf3

View File

@@ -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 = <FH>;
close(LAYOUT);
}
my @foundList;
while(my $l = <FH>) {
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);