function getJobtoJobItemMap($station_id) { //If the job is not in the list, that means all items are allowed Debug::Text('Getting JobToUser Map for Station ID: ' . $station_id, __FILE__, __LINE__, __METHOD__, 10); if ($station_id == '') { return FALSE; } if (getTTProductEdition() != TT_PRODUCT_PROFESSIONAL) { return FALSE; } $slf = new StationListFactory(); $slf->getByStationID($station_id); if ($slf->getRecordCount() > 0) { $s_obj = $slf->getCurrent(); $company_id = $s_obj->getCompany(); Debug::Text('Company ID: ' . $company_id, __FILE__, __LINE__, __METHOD__, 10); if ($company_id != FALSE) { //Gets all users allowed to punch in/out from this station $jilf = new JobItemListFactory(); $job_to_job_item_map = $jilf->getJobToJobItemMapByCompanyIdAndStatus($company_id, 10); if (is_array($job_to_job_item_map)) { foreach ($job_to_job_item_map as $key => $arr) { $list["'{$key}'"] = array('job_id' => (int) $arr['job_id'], 'job_item_id' => (int) $arr['job_item_id']); } if (isset($list)) { return $list; } } /* $jialf = new JobItemAllowListFactory(); $jialf->getByCompanyIdAndStatus( $company_id, 10); if ( $jialf->getRecordCount() > 0 ) { $x=0; foreach( $jialf as $jia_obj) { $list["'$x'"] = array( 'job_id' => (int)$jia_obj->getJob(), 'job_item_id' => (int)$jia_obj->getItem(), ); $x++; } if ( isset($list) ) { return $list; } } */ } } Debug::Text('Returning FALSE!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
$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(); $jilf->getByCompanyId($current_company->getId()); $job_item_options = Misc::prependArray(array('-1' => TTi18n::gettext('-- All --'), '0' => TTi18n::gettext('- No Task -')), $jilf->getArrayByListFactory($jilf, FALSE, TRUE)); $filter_data['src_job_item_options'] = Misc::arrayDiffByKey((array) $filter_data['job_item_ids'], $job_item_options); $filter_data['selected_job_item_options'] = Misc::arrayIntersectByKey((array) $filter_data['job_item_ids'], $job_item_options); } //Get column list $filter_data['src_column_options'] = Misc::arrayDiffByKey((array) $filter_data['column_ids'], $columns); $filter_data['selected_column_options'] = Misc::arrayIntersectByKey((array) $filter_data['column_ids'], $columns); //$filter_data['refresh_options'] = array( 0 => TTi18n::gettext('- Disabled -'), 60 => TTi18n::gettext('1 minute'), 300 => TTi18n::gettext('5 minutes'), 600 => TTi18n::gettext('10 minutes'), 1800 => TTi18n::gettext('30 minutes'), 3600 => TTi18n::gettext('60 minutes') ); //Get primary/secondary order list $filter_data['sort_options'] = $columns; $filter_data['sort_options']['effective_date_order'] = 'Wage Effective Date'; unset($filter_data['sort_options']['effective_date']); $filter_data['sort_direction_options'] = Misc::getSortDirectionArray(); $saved_report_options = $ugdlf->getByUserIdAndScriptArray($current_user->getId(), $_SERVER['SCRIPT_NAME']);
$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); $smarty->assign_by_ref('pc_data', $pc_data); break;
function setJobItem($id) { $id = trim($id); if ($id == FALSE or $id == 0 or $id == '') { $id = 0; } if (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL) { $jilf = new JobItemListFactory(); } if ($id == 0 or $this->Validator->isResultSetWithRows('job_item', $jilf->getByID($id), TTi18n::gettext('Job Item does not exist'))) { $this->data['job_item_id'] = $id; return TRUE; } return FALSE; }
$department_options = $dlf->getByCompanyIdArray($current_company->getId()); //Absence policies $otplf = new AbsencePolicyListFactory(); $absence_policy_options = $otplf->getByCompanyIDArray($current_company->getId(), TRUE); //Overtime policies $otplf = new OverTimePolicyListFactory(); $over_time_policy_options = $otplf->getByCompanyIDArray($current_company->getId(), TRUE); //Premium policies $pplf = new PremiumPolicyListFactory(); $premium_policy_options = $pplf->getByCompanyIDArray($current_company->getId(), TRUE); $job_options = array(); $job_item_options = array(); if ($current_company->getProductEdition() == 20) { $jlf = new JobListFactory(); $job_options = $jlf->getByCompanyIdArray($current_company->getId(), FALSE); $jilf = new JobItemListFactory(); $job_item_options = $jilf->getByCompanyIdArray($current_company->getId(), TRUE); } $day_total_time = array('total_time' => 0, 'worked_time' => 0, 'difference' => 0); foreach ($udtlf as $udt_obj) { if ($udt_obj->getStatus() == 20) { $day_total_time['worked_time'] += $udt_obj->getTotalTime(); } elseif ($udt_obj->getStatus() == 10 and $udt_obj->getType() == 10) { $day_total_time['total_time'] += $udt_obj->getTotalTime(); } if ($filter_system_time != 1 and $udt_obj->getStatus() == 10) { continue; } if ($udt_obj->getJob() != FALSE) { $job = $job_options[$udt_obj->getJob()]; } else {
function setJobItem($ids) { if (getTTProductEdition() != TT_PRODUCT_PROFESSIONAL) { return FALSE; } Debug::text('Setting IDs...', __FILE__, __LINE__, __METHOD__, 10); if (is_array($ids)) { $tmp_ids = array(); if (!$this->isNew()) { //If needed, delete mappings first. $lf_a = new PremiumPolicyJobItemListFactory(); $lf_a->getByPremiumPolicyId($this->getId()); foreach ($lf_a as $obj) { $id = $obj->getJobItem(); Debug::text('Job Item ID: ' . $obj->getJobItem() . ' ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10); //Delete users that are not selected. if (!in_array($id, $ids)) { Debug::text('Deleting: ' . $id, __FILE__, __LINE__, __METHOD__, 10); $obj->Delete(); } else { //Save ID's that need to be updated. Debug::text('NOT Deleting : ' . $id, __FILE__, __LINE__, __METHOD__, 10); $tmp_ids[] = $id; } } unset($id, $obj); } //Insert new mappings. $lf_b = new JobItemListFactory(); foreach ($ids as $id) { if (isset($ids) and $id > 0 and !in_array($id, $tmp_ids)) { $f = new PremiumPolicyJobItemFactory(); $f->setPremiumPolicy($this->getId()); $f->setJobItem($id); $obj = $lf_b->getById($id)->getCurrent(); if ($this->Validator->isTrue('job', $f->Validator->isValid(), TTi18n::gettext('Selected JobItem is invalid') . ' (' . $obj->getName() . ')')) { $f->save(); } } } return TRUE; } Debug::text('No IDs to set.', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
function getPunchData() { if ($this->StationCheckAllowed() !== TRUE) { Debug::text('Station NOT allowed: ', __FILE__, __LINE__, __METHOD__, 10); return FALSE; } $epoch = TTDate::getTime(); $slf = new ScheduleListFactory(); //Get last punch for this day, for this user. $plf = new PunchListFactory(); $plf->getPreviousPunchByUserIDAndEpoch($this->getUserObject()->getId(), $epoch); if ($plf->getRecordCount() > 0) { $prev_punch_obj = $plf->getCurrent(); Debug::Text(' Found Previous Punch within Continuous Time from now, ID: ' . $prev_punch_obj->getId(), __FILE__, __LINE__, __METHOD__, 10); $branch_id = $prev_punch_obj->getPunchControlObject()->getBranch(); $department_id = $prev_punch_obj->getPunchControlObject()->getDepartment(); $job_id = $prev_punch_obj->getPunchControlObject()->getJob(); $job_item_id = $prev_punch_obj->getPunchControlObject()->getJobItem(); //Don't enable transfer by default if the previous punch was any OUT punch. //Transfer does the OUT punch for them, so if the previous punch is an OUT punch //we don't gain anything anyways. if ($this->getPermissionObject()->Check('punch', 'default_transfer') and $prev_punch_obj->getStatus() == 10) { $transfer = TRUE; } else { $transfer = FALSE; } if ($branch_id == '' or empty($branch_id) or $department_id == '' or empty($department_id) or $job_id == '' or empty($job_id) or $job_item_id == '' or empty($job_item_id)) { Debug::Text(' Branch or department are null. ', __FILE__, __LINE__, __METHOD__, 10); $s_obj = $slf->getScheduleObjectByUserIdAndEpoch($this->getUserObject()->getId(), $epoch); if (is_object($s_obj)) { Debug::Text(' Found Schedule!: ', __FILE__, __LINE__, __METHOD__, 10); if ($branch_id == '' or empty($branch_id)) { Debug::Text(' overrriding branch: ' . $s_obj->getBranch(), __FILE__, __LINE__, __METHOD__, 10); $branch_id = $s_obj->getBranch(); } if ($department_id == '' or empty($department_id)) { Debug::Text(' overrriding department: ' . $s_obj->getDepartment(), __FILE__, __LINE__, __METHOD__, 10); $department_id = $s_obj->getDepartment(); } if ($job_id == '' or empty($job_id)) { Debug::Text(' overrriding job: ' . $s_obj->getJob(), __FILE__, __LINE__, __METHOD__, 10); $job_id = $s_obj->getJob(); } if ($job_item_id == '' or empty($job_item_id)) { Debug::Text(' overrriding job item: ' . $s_obj->getJobItem(), __FILE__, __LINE__, __METHOD__, 10); $job_item_id = $s_obj->getJobItem(); } } } $next_type = $prev_punch_obj->getNextType(); //Check for break policy window. if ($next_type != 30 and ($prev_punch_obj->getStatus() != 30 and $prev_punch_obj->getType() != 30)) { $prev_punch_obj->setUser($this->getUserObject()->getId()); $prev_punch_obj->setScheduleID($prev_punch_obj->findScheduleID($epoch)); if ($prev_punch_obj->inBreakPolicyWindow($epoch, $prev_punch_obj->getTimeStamp()) == TRUE) { Debug::Text(' Setting Type to Break: ', __FILE__, __LINE__, __METHOD__, 10); $next_type = 30; } } //Check for meal policy window. if ($next_type != 20 and ($prev_punch_obj->getStatus() != 20 and $prev_punch_obj->getType() != 20)) { $prev_punch_obj->setUser($this->getUserObject()->getId()); $prev_punch_obj->setScheduleID($prev_punch_obj->findScheduleID($epoch)); if ($prev_punch_obj->inMealPolicyWindow($epoch, $prev_punch_obj->getTimeStamp()) == TRUE) { Debug::Text(' Setting Type to Lunch: ', __FILE__, __LINE__, __METHOD__, 10); $next_type = 20; } } Debug::Text(' cJob Item ID: ' . $job_item_id, __FILE__, __LINE__, __METHOD__, 10); $note = ''; if ((int) $prev_punch_obj->getNextStatus() == 20) { $note = $prev_punch_obj->getPunchControlObject()->getNote(); } $data = array('user_id' => (int) $this->getUserObject()->getId(), 'user_full_name' => $this->getUserObject()->getFullName(), 'time_stamp' => TTDate::getDate('TIME', $epoch), 'date_stamp' => TTDate::getDate('DATE', $epoch), 'full_time_stamp' => $epoch, 'iso_time_stamp' => TTDate::getDBTimeStamp($epoch, FALSE), 'transfer' => $transfer, 'branch_id' => (int) $branch_id, 'department_id' => (int) $department_id, 'job_id' => $job_id, 'job_item_id' => $job_item_id, 'quantity' => $prev_punch_obj->getPunchControlObject()->getQuantity(), 'bad_quantity' => $prev_punch_obj->getPunchControlObject()->getBadQuantity(), 'note' => (string) $note, 'other_id1' => $prev_punch_obj->getPunchControlObject()->getOtherID1(), 'other_id2' => $prev_punch_obj->getPunchControlObject()->getOtherID2(), 'other_id3' => $prev_punch_obj->getPunchControlObject()->getOtherID3(), 'other_id4' => $prev_punch_obj->getPunchControlObject()->getOtherID4(), 'other_id5' => $prev_punch_obj->getPunchControlObject()->getOtherID5(), 'status_id' => (int) $prev_punch_obj->getNextStatus(), 'type_id' => (int) $next_type, 'punch_control_id' => (int) $prev_punch_obj->getNextPunchControlID()); unset($note); } else { Debug::Text(' DID NOT Find Previous Punch within Continuous Time from now: ', __FILE__, __LINE__, __METHOD__, 10); //These used to be NULLs, but as of TT v3.0 they cause deserilizer errors with a Java client. $branch_id = ''; $department_id = ''; $job_id = ''; $job_item_id = ''; $s_obj = $slf->getScheduleObjectByUserIdAndEpoch($this->getUserObject()->getId(), $epoch); if (is_object($s_obj)) { Debug::Text(' Found Schedule! ID:' . $s_obj->getID() . ' Job ID: ' . $s_obj->getJob(), __FILE__, __LINE__, __METHOD__, 10); $branch_id = $s_obj->getBranch(); $department_id = $s_obj->getDepartment(); $job_id = $s_obj->getJob(); $job_item_id = $s_obj->getJobItem(); } else { //Check for defaults $branch_id = $this->getUserObject()->getDefaultBranch(); $department_id = $this->getUserObject()->getDefaultDepartment(); //Check station for default/forced settings. if (is_object($this->getStationObject())) { if ($this->getStationObject()->getDefaultBranch() !== FALSE and $this->getStationObject()->getDefaultBranch() != 0) { $branch_id = $this->getStationObject()->getDefaultBranch(); } if ($this->getStationObject()->getDefaultDepartment() !== FALSE and $this->getStationObject()->getDefaultDepartment() != 0) { $department_id = $this->getStationObject()->getDefaultDepartment(); } if ($this->getStationObject()->getDefaultJob() !== FALSE and $this->getStationObject()->getDefaultJob() != 0) { $job_id = $this->getStationObject()->getDefaultJob(); } if ($this->getStationObject()->getDefaultJobItem() !== FALSE and $this->getStationObject()->getDefaultJobItem() != 0) { $job_item_id = $this->getStationObject()->getDefaultJobItem(); } } } $data = array('user_id' => (int) $this->getUserObject()->getId(), 'user_full_name' => $this->getUserObject()->getFullName(), 'time_stamp' => TTDate::getDate('TIME', $epoch), 'date_stamp' => TTDate::getDate('DATE', $epoch), 'full_time_stamp' => $epoch, 'iso_time_stamp' => TTDate::getDBTimeStamp($epoch, FALSE), 'transfer' => FALSE, 'branch_id' => (int) $branch_id, 'department_id' => (int) $department_id, 'job_id' => $job_id, 'job_item_id' => $job_item_id, 'status_id' => 10, 'type_id' => 10); } //Get options. $blf = new BranchListFactory(); $blf->getByCompanyId($this->getCompanyObject()->getId()); $branch_options = $blf->getArrayByListFactory($blf, TRUE, FALSE); $dlf = new DepartmentListFactory(); $dlf->getByCompanyId($this->getCompanyObject()->getId()); $department_options = $dlf->getArrayByListFactory($dlf, TRUE, FALSE); $job_options = array(); $job_item_options = array(); if (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL) { $jlf = new JobListFactory(); $job_options = $jlf->getByCompanyIdAndUserIdAndStatusArray($this->getCompanyObject()->getId(), $this->getUserObject()->getId(), array(10), TRUE); $jilf = new JobItemListFactory(); $job_item_options = $jilf->getByCompanyIdArray($this->getCompanyObject()->getId(), TRUE); } $pf = new PunchFactory(); //Select box options; $data['status_options'] = $pf->getOptions('status'); $data['type_options'] = $pf->getOptions('type'); $data['branch_options'] = $branch_options; $data['department_options'] = $department_options; $data['job_options'] = $job_options; $data['job_item_options'] = $job_item_options; //Hack for PHP v5.0.4 shotty SOAP. //If it can cast the first array key to a INT, it rekeys the entire array. //02-Nov-09: Using NULL values causes the Java client to throw a deserlizer error. Using '' causes blank entries. /* $data['status_options'] = Misc::prependArray( array('_' => FALSE ), $data['status_options'] ); $data['type_options'] = Misc::prependArray( array('_' => FALSE ), $data['type_options'] ); $data['branch_options'] = Misc::prependArray( array('_' => FALSE ), $data['branch_options'] ); $data['department_options'] = Misc::prependArray( array('_' => FALSE ), $data['department_options'] ); $data['job_options'] = Misc::prependArray( array('_' => FALSE ), $data['job_options'] ); $data['job_item_options'] = Misc::prependArray( array('_' => FALSE ), $data['job_item_options'] ); */ $data['timeout'] = 5; $data['date_format_example'] = (string) $this->getUserObject()->getUserPreferenceObject()->getDateFormatExample(); $data['time_format_example'] = (string) $this->getUserObject()->getUserPreferenceObject()->getTimeFormatExample(); //Debug::Arr($data, 'punchDataArray', __FILE__, __LINE__, __METHOD__,10); if (!$this->getPermissionObject()->Check('job', 'enabled')) { unset($data['job_options']); unset($data['job_item_options']); } //Debug::Arr($data, 'Return Data: ', __FILE__, __LINE__, __METHOD__,10); return $data; }
//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 { $time_stamp_epoch = NULL; } } echo " Time Stamp: {$i}. " . TTDate::getDate('DATE+TIME', $time_stamp_epoch) . " (" . $time_stamp_epoch . ")\n"; $status_id = Misc::importCallInputParseFunction('status_id', $mapped_row['status_id'], $filtered_import_map['status_id']['default_value'], $filtered_import_map['status_id']['parse_hint']);
//Absence policies $otplf = new AbsencePolicyListFactory(); $absence_policy_options = $otplf->getByCompanyIDArray($current_company->getId(), TRUE); //Overtime policies $otplf = new OverTimePolicyListFactory(); $over_time_policy_options = $otplf->getByCompanyIDArray($current_company->getId(), TRUE); //Premium policies $pplf = new PremiumPolicyListFactory(); $premium_policy_options = $pplf->getByCompanyIDArray($current_company->getId(), TRUE); //Meal policies $mplf = new MealPolicyListFactory(); $meal_policy_options = $mplf->getByCompanyIDArray($current_company->getId(), TRUE); if ($current_company->getProductEdition() == 20) { $jlf = new JobListFactory(); $udt_data['job_options'] = $jlf->getByCompanyIdAndUserIdAndStatusArray($current_company->getId(), $udt_data['user_id'], array(10, 20, 30, 40), TRUE); $jilf = new JobItemListFactory(); $udt_data['job_item_options'] = $jilf->getByCompanyIdArray($current_company->getId(), TRUE); } //Select box options; $udt_data['status_options'] = $udtf->getOptions('status'); $udt_data['type_options'] = $udtf->getOptions('type'); $udt_data['branch_options'] = $branch_options; $udt_data['department_options'] = $department_options; $udt_data['absence_policy_options'] = $absence_policy_options; $udt_data['over_time_policy_options'] = $over_time_policy_options; $udt_data['premium_policy_options'] = $premium_policy_options; $udt_data['meal_policy_options'] = $meal_policy_options; //var_dump($pc_data); $smarty->assign_by_ref('udt_data', $udt_data); $smarty->assign_by_ref('user_date_id', $user_date_id); $smarty->assign_by_ref('user_id', $user_id);
function getJobItemData($job_item_id) { global $current_company; if (!is_object($current_company)) { return FALSE; } Debug::text('Job Item ID: ' . $job_item_id . ' Company ID: ' . $current_company->getId(), __FILE__, __LINE__, __METHOD__, 10); if ($job_item_id == '') { return FALSE; } if ($current_company->getID() == '') { return FALSE; } $jilf = new JobItemListFactory(); $jilf->getByIdAndCompanyId($job_item_id, $current_company->getId()); if ($jilf->getRecordCount() > 0) { foreach ($jilf as $item_obj) { $retarr = array('id' => $item_obj->getId(), 'product_id' => $item_obj->getProduct(), 'group_id' => $item_obj->getGroup(), 'type_id' => $item_obj->getType(), 'other_id1' => $item_obj->getOtherID1(), 'other_id2' => $item_obj->getOtherID2(), 'other_id3' => $item_obj->getOtherID3(), 'other_id4' => $item_obj->getOtherID4(), 'other_id5' => $item_obj->getOtherID5(), 'manual_id' => $item_obj->getManualID(), 'name' => $item_obj->getName(), 'description' => $item_obj->getDescription(), 'estimate_time' => $item_obj->getEstimateTime(), 'estimate_time_display' => TTDate::getTimeUnit($item_obj->getEstimateTime()), 'estimate_quantity' => $item_obj->getEstimateQuantity(), 'estimate_bad_quantity' => $item_obj->getEstimateBadQuantity(), 'bad_quantity_rate' => $item_obj->getBadQuantityRate(), 'billable_rate' => $item_obj->getBillableRate(), 'minimum_time' => $item_obj->getMinimumTime(), 'minimum_time_display' => TTDate::getTimeUnit($item_obj->getMinimumTime()), 'created_date' => $item_obj->getCreatedDate(), 'created_by' => $item_obj->getCreatedBy(), 'updated_date' => $item_obj->getUpdatedDate(), 'updated_by' => $item_obj->getUpdatedBy(), 'deleted_date' => $item_obj->getDeletedDate(), 'deleted_by' => $item_obj->getDeletedBy()); Debug::text('Returning Data...', __FILE__, __LINE__, __METHOD__, 10); return $retarr; } } Debug::text('Returning False...', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
$data['date_stamp'] = $epoch; } $blf = new BranchListFactory(); $blf->getByCompanyId($current_company->getId()); $branch_options = $blf->getArrayByListFactory($blf, TRUE, FALSE); //$branch_options = $blf->getByCompanyIdArray( $current_company->getId() ); $dlf = new DepartmentListFactory(); $dlf->getByCompanyId($current_company->getId()); $department_options = $dlf->getArrayByListFactory($dlf, TRUE, FALSE); //$department_options = $dlf->getByCompanyIdArray( $current_company->getId() ); if ($current_company->getProductEdition() == 20) { $jlf = new JobListFactory(); $jlf->getByCompanyIdAndUserIdAndStatus($current_company->getId(), $current_user->getId(), array(10)); $data['job_options'] = $jlf->getArrayByListFactory($jlf, TRUE, TRUE); $data['job_manual_id_options'] = $jlf->getManualIDArrayByListFactory($jlf, TRUE); $jilf = new JobItemListFactory(); $jilf->getByCompanyIdAndStatus($current_company->getId(), 10); $data['job_item_options'] = $jilf->getArrayByListFactory($jilf, TRUE, FALSE); $data['job_item_manual_id_options'] = $jilf->getManualIdArrayByListFactory($jilf, FALSE); } //Select box options; $data['status_options'] = $pf->getOptions('status'); $data['type_options'] = $pf->getOptions('type'); $data['branch_options'] = $branch_options; $data['department_options'] = $department_options; //Get other field names $oflf = new OtherFieldListFactory(); $data['other_field_names'] = $oflf->getByCompanyIdAndTypeIdArray($current_company->getId(), 15); //Make sure current station is allowed. if (isset($current_station) and is_object($current_station)) { if (isset($_GET['ibutton'])) {
} 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); $data['selected_department_options'] = Misc::arrayIntersectByKey((array) $data['department_ids'], $department_options);
$data['src_job_group_options'] = Misc::arrayDiffByKey((array) $data['job_group_ids'], $job_group_options); $data['selected_job_group_options'] = Misc::arrayIntersectByKey((array) $data['job_group_ids'], $job_group_options); //Get Jobs $jlf = new JobListFactory(); $jlf->getByCompanyId($current_company->getId()); $job_options = $jlf->getArrayByListFactory($jlf, FALSE, TRUE); $data['src_job_options'] = Misc::arrayDiffByKey((array) $data['job_ids'], $job_options); $data['selected_job_options'] = Misc::arrayIntersectByKey((array) $data['job_ids'], $job_options); //Get Job Item Groups $jiglf = new JobItemGroupListFactory(); $nodes = FastTree::FormatArray($jiglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE); $job_item_group_options = $jiglf->getArrayByNodes($nodes, FALSE, FALSE); $data['src_job_item_group_options'] = Misc::arrayDiffByKey((array) $data['job_item_group_ids'], $job_item_group_options); $data['selected_job_item_group_options'] = Misc::arrayIntersectByKey((array) $data['job_item_group_ids'], $job_item_group_options); //Get Job Items $jilf = new JobItemListFactory(); $jilf->getByCompanyId($current_company->getId()); $job_item_options = $jilf->getArrayByListFactory($jilf, FALSE, TRUE); $data['src_job_item_options'] = Misc::arrayDiffByKey((array) $data['job_item_ids'], $job_item_options); $data['selected_job_item_options'] = Misc::arrayIntersectByKey((array) $data['job_item_ids'], $job_item_options); } //Select box options; $wglf = new WageGroupListFactory(); $data['wage_group_options'] = $wglf->getArrayByListFactory($wglf->getByCompanyId($current_company->getId()), TRUE); $data['type_options'] = $ppf->getOptions('type'); $data['pay_type_options'] = $ppf->getOptions('pay_type'); $data['branch_selection_type_options'] = $ppf->getOptions('branch_selection_type'); $data['department_selection_type_options'] = $ppf->getOptions('department_selection_type'); $data['job_group_selection_type_options'] = $ppf->getOptions('job_group_selection_type'); $data['job_selection_type_options'] = $ppf->getOptions('job_selection_type'); $data['job_item_group_selection_type_options'] = $ppf->getOptions('job_item_group_selection_type');
function setDefaultJobItem($id) { $id = trim($id); if ($id == FALSE or $id == 0 or $id == '') { $id = 0; } Debug::Text('Job Item ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10); if (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL) { $jilf = new JobItemListFactory(); } if ($id == 0 or $this->Validator->isResultSetWithRows('job_item_id', $jilf->getByID($id), TTi18n::gettext('Invalid Task'))) { $this->data['job_item_id'] = $id; return TRUE; } return FALSE; }