$absence_policy_id = $h_obj->getHolidayPolicyObject()->getAbsencePolicyID(); Debug::text('Default Schedule Status: ' . $status_id, __FILE__, __LINE__, __METHOD__, 10); } else { Debug::text('User is NOT Eligible...', __FILE__, __LINE__, __METHOD__, 10); } } else { Debug::text('No Holidays on this day: ', __FILE__, __LINE__, __METHOD__, 10); } unset($hlf, $h_obj); //Debug::text('Schedule Status ID: '. $status_id, __FILE__, __LINE__, __METHOD__, 10); $profiler->startTimer("Add Schedule"); //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->findUserDate($user_id, $recurring_schedule_shift_start_time); $sf->setStatus($status_id); //Working $sf->setStartTime($recurring_schedule_shift_start_time); $sf->setEndTime($recurring_schedule_shift_end_time); $sf->setSchedulePolicyID($recurring_schedule_shift['schedule_policy_id']); if (isset($absence_policy_id) and $absence_policy_id != '') { $sf->setAbsencePolicyID($absence_policy_id); } unset($absence_policy_id); if ($recurring_schedule_shift['branch_id'] == -1) { $sf->setBranch($user_obj->getDefaultBranch()); } else { $sf->setBranch($recurring_schedule_shift['branch_id']); }