unset($slf, $s_obj); $ulf->getByIdAndCompanyId($user_id, $current_company->getId()); if ($ulf->getRecordCount() == 1) { $user_obj = $ulf->getCurrent(); $user_generic_status_label = $user_obj->getFullName(TRUE) . ' @ ' . TTDate::getDate('DATE', $start_time) . ': ' . TTDate::getDate('TIME', $start_time) . ' - ' . TTDate::getDate('TIME', $end_time); if ($conflicting_shifts == TRUE) { $user_generic_status_label .= ' - ' . TTi18n::gettext('DELETED CONFLICTING SHIFT'); } } else { $user_obj = NULL; $user_generic_status_label = 'N/A @ ' . TTDate::getDate('DATE', $start_time) . ': ' . TTDate::getDate('TIME', $start_time) . ' - ' . TTDate::getDate('TIME', $end_time); } //Re-initialize schedule factory here so we clear any errors preventing the next schedule from being inserted. $sf = new ScheduleFactory(); //$sf->setUserDateId( $user_date_id ); $sf->setUserDate($user_id, $time_stamp); $sf->setStatus($data['status_id']); $sf->setSchedulePolicyID($data['schedule_policy_id']); $sf->setAbsencePolicyID($data['absence_policy_id']); if (isset($data['branch_id']) and $data['branch_id'] == -1) { $sf->setBranch($user_obj->getDefaultBranch()); } elseif (isset($data['branch_id'])) { $sf->setBranch($data['branch_id']); } if (isset($data['department_id']) and $data['department_id'] == -1) { $sf->setDepartment($user_obj->getDefaultDepartment()); } elseif (isset($data['department_id'])) { $sf->setDepartment($data['department_id']); } if (isset($data['job_id'])) { $sf->setJob($data['job_id']);
} Debug::Text('Repeating Punch For: ' . $data['repeat'] . ' Days', __FILE__, __LINE__, __METHOD__, 10); for ($i = 0; $i <= (int) $data['repeat']; $i++) { Debug::Text('Punch Repeat: ' . $i, __FILE__, __LINE__, __METHOD__, 10); if ($i == 0) { $date_stamp = $data['date_stamp']; } else { $date_stamp = $data['date_stamp'] + 86400 * $i; } Debug::Text('Date Stamp: ' . TTDate::getDate('DATE', $date_stamp), __FILE__, __LINE__, __METHOD__, 10); $sf = new ScheduleFactory(); if ($i == 0) { $sf->setID($data['id']); } //$sf->setUserDateId( UserDateFactory::findOrInsertUserDate($data['user_id'], $date_stamp) ); $sf->setUserDate($data['user_id'], $date_stamp); $sf->setStatus($data['status_id']); $sf->setSchedulePolicyID($data['schedule_policy_id']); $sf->setAbsencePolicyID($data['absence_policy_id']); $sf->setBranch($data['branch_id']); $sf->setDepartment($data['department_id']); if (isset($data['job_id'])) { $sf->setJob($data['job_id']); } if (isset($data['job_item_id'])) { $sf->setJobItem($data['job_item_id']); } if ($data['start_time'] != '') { $start_time = strtotime($data['start_time'], $date_stamp); } else { $start_time = NULL;