Debug::text('Recurring Schedule Shift Date Stamp: ' . $date_stamp, __FILE__, __LINE__, __METHOD__, 10); foreach ($recurring_schedule_shifts as $recurring_schedule_shift) { $recurring_schedule_shift_start_time = TTDate::strtotime($recurring_schedule_shift['start_time']); $recurring_schedule_shift_end_time = TTDate::strtotime($recurring_schedule_shift['end_time']); Debug::text('(After User TimeZone)Recurring Schedule Shift Start Time: ' . TTDate::getDate('DATE+TIME', $recurring_schedule_shift_start_time) . ' End Time: ' . TTDate::getDate('DATE+TIME', $recurring_schedule_shift_end_time), __FILE__, __LINE__, __METHOD__, 10); //Make sure punch pairs fall within limits if ($recurring_schedule_shift_start_time < $current_epoch + $max_start_stop_window) { Debug::text('Recurring Schedule Shift Start Time falls within Limits: ' . TTDate::getDate('DATE+TIME', $recurring_schedule_shift_start_time), __FILE__, __LINE__, __METHOD__, 10); $status_id = 10; //Working //Make sure we not already added this schedule shift. //And that no schedule shifts overlap this one. //Use the isValid() function for this $sf = new ScheduleFactory(); $sf->StartTransaction(); $sf->setCompany($c_obj->getID()); $sf->setUser($user_id); //Find the date that the shift will be assigned to so we know if its a holiday or not. if (is_object($sf->getPayPeriodScheduleObject())) { $date_stamp = $sf->getPayPeriodScheduleObject()->getShiftAssignedDate($recurring_schedule_shift_start_time, $recurring_schedule_shift_end_time, $sf->getPayPeriodScheduleObject()->getShiftAssignedDay()); } else { $date_stamp = $recurring_schedule_shift_start_time; } //Is this a holiday? $hlf = new HolidayListFactory(); $hlf->getByPolicyGroupUserIdAndDate($user_id, TTDate::getBeginDayEpoch($date_stamp)); if ($hlf->getRecordCount() > 0) { $h_obj = $hlf->getCurrent(); Debug::text('Found Holiday! Name: ' . $h_obj->getName(), __FILE__, __LINE__, __METHOD__, 10); //Ignore after holiday eligibility when scheduling, since it will always fail. if ($h_obj->isEligible($user_id, TRUE)) {