$sf->setJobItem($user_obj->getDefaultJobItem()); } else { $sf->setJobItem($recurring_schedule_shift['job_item_id']); } if ($sf->isValid()) { //Recalculate if its a absence schedule, so the holiday //policy takes effect. //Always re-calculate, this way it automatically applies dock time and holiday time. //Recalculate at the end of the day in a cronjob. //Part of the reason is that if they have a dock policy, it will show up as //docking them time during the entire day. //$sf->setEnableReCalculateDay(FALSE); //Only for holidays do we calculate the day right away. //So they don't have to wait 24hrs to see stat time. //Also need to recalculate if the schedule was added after the schedule has already started. if ($status_id == 20 and $rsc_obj->getAutoFill() == FALSE or $sf->getStartTime() <= $current_epoch) { $sf->setEnableReCalculateDay(TRUE); } else { $sf->setEnableReCalculateDay(FALSE); //Don't need to re-calc right now? } $schedule_result = $sf->Save(); $sf->CommitTransaction(); $profiler->startTimer("Add Punch"); Debug::text('Schedule Checks out, saving: ' . TTDate::getDate('DATE+TIME', $recurring_schedule_shift_start_time), __FILE__, __LINE__, __METHOD__, 10); if ($schedule_result == TRUE and $user_id > 0 and $rsc_obj->getAutoFill() == TRUE and $status_id == 10) { //Make sure they are working for Auto-fill to kickin. Debug::text('Schedule has AutoFill enabled!', __FILE__, __LINE__, __METHOD__, 10); $commit_punch_transaction = FALSE; Debug::text('Punch In: ' . TTDate::getDate('DATE+TIME', $recurring_schedule_shift_start_time), __FILE__, __LINE__, __METHOD__, 10); $pf_in = new PunchFactory();