Hi,
In my sites I used the "Allowed Date Function" and the "PHP Allowed Date function" next to each other to block some dates. I use following code:
Allowed Date Function (to Block Sunday and Monday)
var date = new Date(date);
/* Check if this is a weekend */
var dayOfWeek = date.getDay();
if (dayOfWeek === 0 || dayOfWeek == 6 )
{ result = true; }
else
{ result = false; }
PHP Allowed Date Function (to block days that are set in separate table)
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery
->select ('DATE(datum)')
->from('volgeboekt');
$myDb->setQuery($myQuery);
$bookedDates = $myDb->loadColumn();
$begin = new DateTime();
$end = new DateTime('2020-12-31');
$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($begin, $interval, $end);
$myAllowedDates = array();
foreach( $period as $dt ) {
$thisDate = $dt->format("Y-m-d");
if (!in_array($thisDate, $bookedDates)) {
$myAllowedDates[] = $thisDate;
}
}
return $myAllowedDates;
This used to work without issues. I now have upgraded Fabrikar to latetst 3.8.1 version and it stopped working only one of the functions works but not both at same time.
Is this normal in new version?
In my sites I used the "Allowed Date Function" and the "PHP Allowed Date function" next to each other to block some dates. I use following code:
Allowed Date Function (to Block Sunday and Monday)
var date = new Date(date);
/* Check if this is a weekend */
var dayOfWeek = date.getDay();
if (dayOfWeek === 0 || dayOfWeek == 6 )
{ result = true; }
else
{ result = false; }
PHP Allowed Date Function (to block days that are set in separate table)
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery
->select ('DATE(datum)')
->from('volgeboekt');
$myDb->setQuery($myQuery);
$bookedDates = $myDb->loadColumn();
$begin = new DateTime();
$end = new DateTime('2020-12-31');
$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($begin, $interval, $end);
$myAllowedDates = array();
foreach( $period as $dt ) {
$thisDate = $dt->format("Y-m-d");
if (!in_array($thisDate, $bookedDates)) {
$myAllowedDates[] = $thisDate;
}
}
return $myAllowedDates;
This used to work without issues. I now have upgraded Fabrikar to latetst 3.8.1 version and it stopped working only one of the functions works but not both at same time.
Is this normal in new version?