function createBreakPolicy($company_id, $type) { $bpf = new BreakPolicyFactory(); $bpf->setCompany($company_id); switch ($type) { case 100: //Normal 15min break $bpf->setName('Normal'); $bpf->setType(20); $bpf->setTriggerTime(3600 * 6); $bpf->setAmount(60 * 15); $bpf->setIncludeBreakPunchTime(FALSE); $bpf->setIncludeMultipleBreaks(FALSE); break; case 110: //AutoAdd 15min $bpf->setName('AutoAdd 15min'); $bpf->setType(15); $bpf->setTriggerTime(3600 * 1); $bpf->setAmount(60 * 15); $bpf->setIncludeBreakPunchTime(FALSE); $bpf->setIncludeMultipleBreaks(FALSE); break; case 115: //AutoAdd 15min $bpf->setName('AutoAdd 15min (Include Punch Time)'); $bpf->setType(15); $bpf->setTriggerTime(3600 * 1); $bpf->setAmount(60 * 15); $bpf->setIncludeBreakPunchTime(TRUE); $bpf->setIncludeMultipleBreaks(FALSE); break; case 120: //AutoDeduct 15min $bpf->setName('AutoDeduct 15min'); $bpf->setType(10); $bpf->setTriggerTime(3600 * 6); $bpf->setAmount(15 * 60); $bpf->setIncludeBreakPunchTime(FALSE); $bpf->setIncludeMultipleBreaks(FALSE); break; case 150: //AutoAdd 15min $bpf->setName('AutoAdd 15min (Include Both)'); $bpf->setType(15); $bpf->setTriggerTime(3600 * 1); $bpf->setAmount(60 * 15); $bpf->setIncludeBreakPunchTime(TRUE); $bpf->setIncludeMultipleBreaks(TRUE); break; case 152: //AutoAdd 15min $bpf->setName('AutoAdd 15min (Include Both) [2]'); $bpf->setType(15); $bpf->setTriggerTime(3600 * 3); $bpf->setAmount(60 * 15); $bpf->setIncludeBreakPunchTime(TRUE); $bpf->setIncludeMultipleBreaks(TRUE); break; case 154: //AutoAdd 15min $bpf->setName('AutoAdd 15min (Include Both) [3]'); $bpf->setType(15); $bpf->setTriggerTime(3600 * 5); $bpf->setAmount(60 * 15); $bpf->setIncludeBreakPunchTime(TRUE); $bpf->setIncludeMultipleBreaks(TRUE); break; case 156: //AutoAdd 15min $bpf->setName('AutoAdd 15min (Include Both) [4]'); $bpf->setType(15); $bpf->setTriggerTime(3600 * 10); $bpf->setAmount(60 * 15); $bpf->setIncludeBreakPunchTime(TRUE); $bpf->setIncludeMultipleBreaks(TRUE); break; } if ($bpf->isValid()) { $insert_id = $bpf->Save(); Debug::Text('Break Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10); return $insert_id; } Debug::Text('Failed Creating Break Policy!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
function createBreakPolicy($company_id, $type) { $bpf = new BreakPolicyFactory(); $bpf->setCompany($company_id); switch ($type) { case 100: //Normal 15min break: Detect by Time Window $bpf->setName('Normal'); $bpf->setType(20); $bpf->setTriggerTime(3600 * 0.5); $bpf->setAmount(60 * 15); $bpf->setAutoDetectType(10); $bpf->setStartWindow(1 * 3600); $bpf->setWindowLength(1 * 3600); $bpf->setIncludeBreakPunchTime(FALSE); $bpf->setIncludeMultipleBreaks(FALSE); break; case 110: //Normal 15min break: Detect by Punch Time $bpf->setName('Normal'); $bpf->setType(20); $bpf->setTriggerTime(3600 * 0.5); $bpf->setAmount(60 * 15); $bpf->setAutoDetectType(20); $bpf->setMinimumPunchTime(60 * 5); ///5min $bpf->setMaximumPunchTime(60 * 25); //25min $bpf->setIncludeBreakPunchTime(FALSE); $bpf->setIncludeMultipleBreaks(FALSE); break; } if ($bpf->isValid()) { $insert_id = $bpf->Save(); Debug::Text('Break Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10); return $insert_id; } Debug::Text('Failed Creating Break Policy!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
if (isset($data['trigger_time'])) { $data['trigger_time'] = TTDate::parseTimeUnit($data['trigger_time']); $data['amount'] = TTDate::parseTimeUnit($data['amount']); $data['start_window'] = TTDate::parseTimeUnit($data['start_window']); $data['window_length'] = TTDate::parseTimeUnit($data['window_length']); $data['minimum_punch_time'] = TTDate::parseTimeUnit($data['minimum_punch_time']); $data['maximum_punch_time'] = TTDate::parseTimeUnit($data['maximum_punch_time']); } $bpf = new BreakPolicyFactory(); $action = Misc::findSubmitButton(); $action = strtolower($action); switch ($action) { case 'submit': Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); $bpf->setId($data['id']); $bpf->setCompany($current_company->getId()); $bpf->setName($data['name']); $bpf->setType($data['type_id']); $bpf->setTriggerTime($data['trigger_time']); $bpf->setAmount($data['amount']); $bpf->setAutoDetectType($data['auto_detect_type_id']); $bpf->setStartWindow($data['start_window']); $bpf->setWindowLength($data['window_length']); $bpf->setMinimumPunchTime($data['minimum_punch_time']); $bpf->setMaximumPunchTime($data['maximum_punch_time']); if (isset($data['include_break_punch_time'])) { $bpf->setIncludeBreakPunchTime(TRUE); } else { $bpf->setIncludeBreakPunchTime(FALSE); } if ($bpf->isValid()) {