$ulf->getByIdAndCompanyId($user_id, $current_company->getId()); if ($ulf->getRecordCount() > 0) { $user_obj = $ulf->getCurrent(); $pc_data = array('user_id' => $user_obj->getId(), 'user_full_name' => $user_obj->getFullName(), 'date_stamp' => $date_stamp, 'time_stamp' => $time_stamp, 'status_id' => $status_id, 'branch_id' => $user_obj->getDefaultBranch(), 'department_id' => $user_obj->getDefaultDepartment(), 'quantity' => 0, 'bad_quantity' => 0); } unset($time_stamp, $plf); } } $blf = new BranchListFactory(); $branch_options = $blf->getByCompanyIdArray($current_company->getId()); $dlf = new DepartmentListFactory(); $department_options = $dlf->getByCompanyIdArray($current_company->getId()); if ($current_company->getProductEdition() == 20) { $jlf = new JobListFactory(); $jlf->getByCompanyIdAndUserIdAndStatus($current_company->getId(), $pc_data['user_id'], array(10, 20, 30, 40)); $pc_data['job_options'] = $jlf->getArrayByListFactory($jlf, TRUE, TRUE); $pc_data['job_manual_id_options'] = $jlf->getManualIDArrayByListFactory($jlf, TRUE); $jilf = new JobItemListFactory(); $jilf->getByCompanyId($current_company->getId()); $pc_data['job_item_options'] = $jilf->getArrayByListFactory($jilf, TRUE, TRUE); $pc_data['job_item_manual_id_options'] = $jilf->getManualIdArrayByListFactory($jilf, TRUE); } //Select box options; $pc_data['status_options'] = $pf->getOptions('status'); $pc_data['type_options'] = $pf->getOptions('type'); $pc_data['branch_options'] = $branch_options; $pc_data['department_options'] = $department_options; //Get other field names $oflf = new OtherFieldListFactory(); $pc_data['other_field_names'] = $oflf->getByCompanyIdAndTypeIdArray($current_company->getId(), 15); //Debug::Text('pc_data[date_stamp]: '. TTDate::getDate('DATE+TIME', $pc_data['date_stamp']), __FILE__, __LINE__, __METHOD__,10);
$blf->getByCompanyId($u_obj->getCompany()); $branch_options = $blf->getArrayByListFactory($blf, FALSE, TRUE); unset($blf); } if (!isset($department_options)) { //Get departments $dlf = new DepartmentListFactory(); $dlf->getByCompanyId($u_obj->getCompany()); $department_options = $dlf->getArrayByListFactory($dlf, FALSE, TRUE); unset($dlf); } if (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL and !isset($job_options)) { //Get jobs $jlf = new JobListFactory(); $jlf->getByCompanyId($u_obj->getCompany()); $job_options = $jlf->getArrayByListFactory($jlf, FALSE, TRUE); unset($jlf); } if (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL and !isset($job_item_options)) { //Get tasks $jilf = new JobItemListFactory(); $jilf->getByCompanyId($u_obj->getCompany()); $job_item_options = $jilf->getArrayByListFactory($jilf, FALSE, TRUE); unset($jilf); } if (isset($mapped_row['time_stamp']) and $mapped_row['time_stamp'] != '') { $time_stamp_epoch = Misc::importCallInputParseFunction('time_stamp', $mapped_row['time_stamp'], $filtered_import_map['time_stamp']['default_value'], $filtered_import_map['time_stamp']['parse_hint']); } else { if (isset($mapped_row['start_time_stamp']) and $mapped_row['start_time_stamp'] != '') { $time_stamp_epoch = Misc::importCallInputParseFunction('time_stamp', $mapped_row['start_time_stamp'], $filtered_import_map['start_time_stamp']['default_value'], $filtered_import_map['start_time_stamp']['parse_hint']); } else {
$filter_data['selected_department_options'] = Misc::arrayIntersectByKey((array) $filter_data['department_ids'], $department_options); $filter_data['src_punch_branch_options'] = Misc::arrayDiffByKey((array) $filter_data['punch_branch_ids'], $branch_options); $filter_data['selected_punch_branch_options'] = Misc::arrayIntersectByKey((array) $filter_data['punch_branch_ids'], $branch_options); $filter_data['src_punch_department_options'] = Misc::arrayDiffByKey((array) $filter_data['punch_department_ids'], $department_options); $filter_data['selected_punch_department_options'] = Misc::arrayIntersectByKey((array) $filter_data['punch_department_ids'], $department_options); //Get employee titles $utlf = new UserTitleListFactory(); $utlf->getByCompanyId($current_company->getId()); $user_title_options = Misc::prependArray($all_array_option, $utlf->getArrayByListFactory($utlf, FALSE, TRUE)); $filter_data['src_user_title_options'] = Misc::arrayDiffByKey((array) $filter_data['user_title_ids'], $user_title_options); $filter_data['selected_user_title_options'] = Misc::arrayIntersectByKey((array) $filter_data['user_title_ids'], $user_title_options); if ($current_company->getProductEdition() == 20) { $jlf = new JobListFactory(); //Get include job list. $jlf->getByCompanyId($current_company->getId()); $job_options = Misc::prependArray(array('0' => TTi18n::gettext('- No Job -')), $jlf->getArrayByListFactory($jlf, FALSE, TRUE)); $filter_data['job_manual_id_options'] = $jlf->getManualIDArrayByListFactory($jlf, TRUE); $filter_data['src_include_job_options'] = Misc::arrayDiffByKey((array) $filter_data['include_job_ids'], $job_options); $filter_data['selected_include_job_options'] = Misc::arrayIntersectByKey((array) $filter_data['include_job_ids'], $job_options); //Get exclude job list $exclude_job_options = Misc::prependArray($all_array_option, $jlf->getArrayByListFactory($jlf, FALSE, TRUE)); $filter_data['src_exclude_job_options'] = Misc::arrayDiffByKey((array) $filter_data['exclude_job_ids'], $job_options); $filter_data['selected_exclude_job_options'] = Misc::arrayIntersectByKey((array) $filter_data['exclude_job_ids'], $job_options); //Get Job Groups $jglf = new JobGroupListFactory(); $nodes = FastTree::FormatArray($jglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE); $job_group_options = Misc::prependArray($all_array_option, $jglf->getArrayByNodes($nodes, FALSE, TRUE)); $filter_data['src_job_group_options'] = Misc::arrayDiffByKey((array) $filter_data['job_group_ids'], $job_group_options); $filter_data['selected_job_group_options'] = Misc::arrayIntersectByKey((array) $filter_data['job_group_ids'], $job_group_options); //Get Job Items $jilf = new JobItemListFactory();
} } elseif ($action != 'submit' and $action != 'time_clock_command') { $data = array('status' => 20, 'port' => 80, 'password' => 0, 'poll_frequency' => 600, 'push_frequency' => 86400, 'partial_push_frequency' => 3600); } $data = Misc::preSetArrayValues($data, array('branch_ids', 'department_ids', 'group_ids', 'include_user_ids', 'exclude_user_ids'), NULL); //Select box options; $data['status_options'] = $sf->getOptions('status'); $data['type_options'] = $sf->getOptions('type'); $data['poll_frequency_options'] = $sf->getOptions('poll_frequency'); $data['push_frequency_options'] = $sf->getOptions('push_frequency'); $data['time_clock_command_options'] = $sf->getOptions('time_clock_command'); $data['mode_flag_options'] = $sf->getOptions('mode_flag'); if ($current_company->getProductEdition() == 20) { $jlf = new JobListFactory(); $jlf->getByCompanyId($current_company->getId()); $data['job_options'] = Misc::prependArray(array(0 => '-- None --'), $jlf->getArrayByListFactory($jlf, FALSE, TRUE)); $jilf = new JobItemListFactory(); $jilf->getByCompanyIdAndStatus($current_company->getId(), 10); $data['job_item_options'] = Misc::prependArray(array(0 => '-- None --'), $jilf->getArrayByListFactory($jilf, TRUE, FALSE)); } //Get branches $blf = new BranchListFactory(); $blf->getByCompanyId($current_company->getId()); $branch_options = $blf->getArrayByListFactory($blf, FALSE, TRUE); $data['src_branch_options'] = Misc::arrayDiffByKey((array) $data['branch_ids'], $branch_options); $data['selected_branch_options'] = Misc::arrayIntersectByKey((array) $data['branch_ids'], $branch_options); //Get departments $dlf = new DepartmentListFactory(); $dlf->getByCompanyId($current_company->getId()); $department_options = $dlf->getArrayByListFactory($dlf, FALSE, TRUE); $data['src_department_options'] = Misc::arrayDiffByKey((array) $data['department_ids'], $department_options);