Hello everyone,
I wrote a some lines to get different email answers when its weekend/after Work / Holiday
I don´t know why its not really working. I always getting the ticket.autorespBuisHours answer
When I´m test this code outside of osticket it works (just changing to return to a echo)
File class.template.php
`$url = 'http://feiertage-api.de/api/?jahr=' . date(Y) . '&nur_land=HE';
$sFile = file_get_contents($url);
$feiertage = json_decode($sFile, true);
$date = date("Y-m-d");
$istFeiertage = FALSE;
$startZeit = 8;
$endZeit = 16;
foreach ($feiertage as $row) {
$tocheck = $row['datum'] ;
if( $tocheck == $date){
$istFeiertage = TRUE;
}
}
if(date("D") == "Sat" or date("D") == "Sun"){
return $this->getMsgTemplate('ticket.autorespWeekend');
} else if($istFeiertage){
return $this->getMsgTemplate('ticket.autorespHoliday');
} else if(date("G") < $startZeit or date("G") > $endZeit){
return $this->getMsgTemplate('ticket.autorespBuisHours');
} else {
return $this->getMsgTemplate('ticket.autoresp');
}`