Debug::Text(' ID was NOT passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10); $user_id = NULL; $user_date_id = NULL; $user_full_name = NULL; $user_default_branch = NULL; $user_default_department = NULL; $pay_period_is_locked = FALSE; $time_stamp = $start_date_stamp = $end_date_stamp = TTDate::getBeginDayEpoch(TTDate::getTime()) + 3600 * 12; //Noon $data = array('start_date_stamp' => $start_date_stamp, 'end_date_stamp' => $end_date_stamp, 'start_time' => strtotime('08:00 AM'), 'parsed_start_time' => strtotime('08:00 AM'), 'end_time' => strtotime('05:00 PM'), 'parsed_end_time' => strtotime('05:00 PM'), 'total_time' => 3600 * 9, 'branch_id' => $user_default_branch, 'department_id' => $user_default_department, 'dow' => array(1 => TRUE, 2 => TRUE, 3 => TRUE, 4 => TRUE, 5 => TRUE)); } //var_dump($data); $ulf = TTnew('UserListFactory'); $ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data); $src_user_options = UserListFactory::getArrayByListFactory($ulf, FALSE, FALSE); $user_options = Misc::arrayDiffByKey((array) $filter_user_id, $src_user_options); $filter_user_options = Misc::arrayIntersectByKey((array) $filter_user_id, $src_user_options); $prepend_array_option = array(0 => '--', -1 => TTi18n::gettext('-- Default --')); $splf = TTnew('SchedulePolicyListFactory'); $schedule_policy_options = $splf->getByCompanyIdArray($current_company->getId()); $aplf = TTnew('AbsencePolicyListFactory'); $absence_policy_options = $aplf->getByCompanyIdArray($current_company->getId()); $blf = TTnew('BranchListFactory'); $blf->getByCompanyId($current_company->getId()); $branch_options = Misc::prependArray($prepend_array_option, $blf->getArrayByListFactory($blf, FALSE, TRUE)); $dlf = TTnew('DepartmentListFactory'); $dlf->getByCompanyId($current_company->getId()); $department_options = Misc::prependArray($prepend_array_option, $dlf->getArrayByListFactory($dlf, FALSE, TRUE)); if ($current_company->getProductEdition() >= 20) { $jlf = TTnew('JobListFactory'); $jlf->getByStatusIdAndCompanyId(array(10, 20, 30, 40), $current_company->getId());
$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 = TTnew('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); //Get pay periods $pplf = TTnew('PayPeriodListFactory'); $pplf->getByCompanyId($current_company->getId()); $pay_period_options = Misc::prependArray($all_array_option, $pplf->getArrayByListFactory($pplf, FALSE, TRUE)); $filter_data['src_pay_period_options'] = Misc::arrayDiffByKey((array) $filter_data['pay_period_ids'], $pay_period_options); $filter_data['selected_pay_period_options'] = Misc::arrayIntersectByKey((array) $filter_data['pay_period_ids'], $pay_period_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); //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(); /***/ $filter_data['group_by_options'] = Misc::prependArray(array('0' => TTi18n::gettext('No Grouping')), $static_columns); /***/ $saved_report_options = $ugdlf->getByUserIdAndScriptArray($current_user->getId(), $_SERVER['SCRIPT_NAME']); $generic_data['saved_report_options'] = $saved_report_options; $smarty->assign_by_ref('generic_data', $generic_data); $smarty->assign_by_ref('filter_data', $filter_data); $smarty->assign_by_ref('ugdf', $ugdf); $smarty->display('report/TimesheetSummary.tpl');
$jlf = TTnew('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 = TTnew('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 = TTnew('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 = TTnew('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['include_holiday_type_options'] = $ppf->getOptions('include_holiday_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'); $data['job_item_selection_type_options'] = $ppf->getOptions('job_item_selection_type'); $data['pay_stub_entry_options'] = $pay_stub_entry_options;
$blf = new BranchListFactory(); $blf->getByCompanyId($current_company->getId()); $branch_options = Misc::prependArray($all_array_option, $blf->getArrayByListFactory($blf, FALSE, TRUE)); $filter_data['src_branch_options'] = Misc::arrayDiffByKey((array) $filter_data['branch_ids'], $branch_options); $filter_data['selected_branch_options'] = Misc::arrayIntersectByKey((array) $filter_data['branch_ids'], $branch_options); //Get departments $dlf = new DepartmentListFactory(); $dlf->getByCompanyId($current_company->getId()); $department_options = Misc::prependArray($all_array_option, $dlf->getArrayByListFactory($dlf, FALSE, TRUE)); $filter_data['src_department_options'] = Misc::arrayDiffByKey((array) $filter_data['department_ids'], $department_options); $filter_data['selected_department_options'] = Misc::arrayIntersectByKey((array) $filter_data['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); //Deduction PSEA accounts $psealf = new PayStubEntryAccountListFactory(); $filter_data['deduction_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(20, 30, 40), TRUE); $filter_data['earning_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 40), TRUE); $filter_data['income_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 30, 40), TRUE); //Get employee list //$filter_data['user_options'] = UserListFactory::getByCompanyIdArray( $current_company->getId(), FALSE ); //Quarters $filter_data['year_options'] = $year_options; $setup_data['state_options'] = $state_options; $saved_report_options = $ugdlf->getByUserIdAndScriptArray($current_user->getId(), $_SERVER['SCRIPT_NAME']); $generic_data['saved_report_options'] = $saved_report_options; $smarty->assign_by_ref('generic_data', $generic_data); $smarty->assign_by_ref('filter_data', $filter_data);
} } //Select box options; $status_options_filter = array(50); if (isset($pay_stub_amendment) and $pay_stub_amendment->getStatus() == 55) { $status_options_filter = array(55); } elseif (isset($pay_stub_amendment) and $pay_stub_amendment->getStatus() == 52) { $status_options_filter = array(52); } if (!isset($pay_stub_amendment_data['filter_user_id'])) { $pay_stub_amendment_data['filter_user_id'] = array(); } $ulf = TTnew('UserListFactory'); $ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), NULL); $src_user_options = UserListFactory::getArrayByListFactory($ulf, FALSE, FALSE); $user_options = Misc::arrayDiffByKey((array) $pay_stub_amendment_data['filter_user_id'], $src_user_options); $filter_user_options = Misc::arrayIntersectByKey((array) $pay_stub_amendment_data['filter_user_id'], $src_user_options); $status_options = Option::getByArray($status_options_filter, $psaf->getOptions('status')); $pay_stub_amendment_data['status_options'] = $status_options; $pseallf = TTnew('PayStubEntryAccountLinkListFactory'); $pseallf->getByCompanyId($current_company->getId()); if ($pseallf->getRecordCount() > 0) { $net_pay_psea_id = $pseallf->getCurrent()->getTotalNetPay(); } $psealf = TTnew('PayStubEntryAccountListFactory'); $pay_stub_amendment_data['pay_stub_entry_name_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 50, 60, 65)); $pay_stub_amendment_data['percent_amount_entry_name_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 40, 50, 60, 65)); if (isset($net_pay_psea_id)) { unset($pay_stub_amendment_data['percent_amount_entry_name_options'][$net_pay_psea_id]); } //$pay_stub_amendment_data['pay_stub_entry_name_options'] = $psenlf->getByTypeIdArray( array(10,20,30,35) );
//$nodes = FastTree::FormatArray( $hlf->getByHierarchyControlId( $hierarchy_id ), 'TEXT', TRUE); $nodes = FastTree::FormatArray($hlf->getByCompanyIdAndHierarchyControlId($current_company->getId(), $hierarchy_id), 'TEXT', TRUE); foreach ($nodes as $node) { $parent_list_options[$node['id']] = $node['text']; } //Get include employee list. $ulf = new UserListFactory(); $ulf->getByCompanyId($current_company->getId()); $raw_user_options = $ulf->getArrayByListFactory($ulf, FALSE, TRUE); //$raw_user_list_options = UserListFactory::getByCompanyIdArray( $current_company->getId() ); //Only allow them to select employees not already in the tree. unset($parent_list_options[$id]); //If we're editing a single entry, include that user in the list. $parent_list_keys = array_keys($parent_list_options); $user_options = Misc::arrayDiffByKey((array) $parent_list_keys, $raw_user_options); $src_user_options = Misc::arrayDiffByKey((array) $user_data['user_id'], $user_options); $selected_user_options = Misc::arrayIntersectByKey((array) $user_data['user_id'], $user_options); //$smarty->assign_by_ref('user_list_options', $user_list_options); $smarty->assign_by_ref('src_user_options', $src_user_options); $smarty->assign_by_ref('selected_user_options', $selected_user_options); $smarty->assign_by_ref('parent_list_options', $parent_list_options); if (isset($id) and $id != '' and $redirect == 0) { Debug::Text(' ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10); $node = $hlf->getByHierarchyControlIdAndUserId($hierarchy_id, $id); $smarty->assign_by_ref('selected_node', $node); } else { $id = $user_data['user_id'][0]; } break; } $smarty->assign_by_ref('hierarchy_id', $hierarchy_id);
$mcf->setSubject($data['subject']); $mcf->setBody($data['body']); if ($mcf->isValid()) { $mcf->Save(); $mcf->CommitTransaction(); Redirect::Page(URLBuilder::getURL(NULL, 'UserMessageList.php')); break; } $mcf->FailTransaction(); } else { $mcf->Validator->isTrue('to', FALSE, TTi18n::gettext('Please select at least one recipient')); } default: if ($permission->Check('message', 'send_to_any')) { $user_options = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE, TRUE); $data['user_options'] = Misc::arrayDiffByKey((array) $filter_user_id, $user_options); $filter_user_options = Misc::arrayIntersectByKey((array) $filter_user_id, $user_options); } else { //Only allow sending to supervisors OR children. $hlf = TTnew('HierarchyListFactory'); //FIXME: For supervisors, we may need to include supervisors at the same level // Also how to handle cases where there are no To: recipients to select from. //Get Parents $request_parent_level_user_ids = $hlf->getHierarchyParentByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId(), array(1010, 1020, 1030, 1040, 1100), FALSE, FALSE); //Debug::Arr( $request_parent_level_user_ids, 'Request Parent Level Ids', __FILE__, __LINE__, __METHOD__,10); //Get Children, in case the current user is a superior. $request_child_level_user_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId(), array(1010, 1020, 1030, 1040, 1100)); //Debug::Arr( $request_child_level_user_ids, 'Request Child Level Ids', __FILE__, __LINE__, __METHOD__,10); $request_user_ids = array_merge((array) $request_parent_level_user_ids, (array) $request_child_level_user_ids); //Debug::Arr( $request_user_ids, 'User Ids', __FILE__, __LINE__, __METHOD__,10); $ulf = TTnew('UserListFactory');
$dlf = TTnew('DepartmentListFactory'); $dlf->getByCompanyId($current_company->getId()); $department_options = Misc::prependArray($all_array_option, $dlf->getArrayByListFactory($dlf, FALSE, TRUE)); $filter_data['src_department_options'] = Misc::arrayDiffByKey((array) $filter_data['department_ids'], $department_options); $filter_data['selected_department_options'] = Misc::arrayIntersectByKey((array) $filter_data['department_ids'], $department_options); //Get employee titles $utlf = TTnew('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); //Get pay periods $pplf = TTnew('PayPeriodListFactory'); $pplf->getByCompanyId($current_company->getId()); $pay_period_options = Misc::prependArray($all_array_option, $pplf->getArrayByListFactory($pplf, FALSE, TRUE)); $filter_data['src_pay_period_options'] = Misc::arrayDiffByKey((array) $filter_data['pay_period_ids'], $pay_period_options); $filter_data['selected_pay_period_options'] = Misc::arrayIntersectByKey((array) $filter_data['pay_period_ids'], $pay_period_options); $filter_data['export_type_options'] = array(0 => TTi18n::gettext('-- Please Choose --'), 'adp' => TTi18n::gettext('ADP'), 'paychex_preview' => TTi18n::gettext('Paychex Preview'), 'paychex_online' => TTi18n::gettext('Paychex Online Payroll'), 'ceridian_insync' => TTi18n::gettext('Ceridian Insync'), 'millenium' => TTi18n::gettext('Millenium'), 'quickbooks' => TTi18n::gettext('QuickBooks Pro'), 'surepayroll' => TTi18n::gettext('SurePayroll'), 'csv' => TTi18n::gettext('Generic Excel/CSV'), 'other' => TTi18n::gettext('-- Other --')); $setup_data['src_column_options'] = $columns; // //ADP specific columns // $setup_data['adp_hour_column_options'][0] = TTi18n::gettext('-- DO NOT EXPORT --'); $setup_data['adp_hour_column_options']['regular_time'] = TTi18n::gettext('Regular Time'); $setup_data['adp_hour_column_options']['overtime'] = TTi18n::gettext('Overtime'); for ($i = 3; $i <= 4; $i++) { $setup_data['adp_hour_column_options'][$i] = TTi18n::gettext('Hours') . ' ' . $i; } //Quickbooks additional column mapping $setup_data['quickbooks_proj_options'] = array(0 => TTi18n::gettext('-- NONE --'), 'default_branch' => TTi18n::gettext('Default Branch'), 'default_department' => TTi18n::gettext('Default Department'), 'group' => TTi18n::gettext('Group'), 'title' => TTi18n::gettext('Title')); $saved_report_options = $ugdlf->getByUserIdAndScriptArray($current_user->getId(), $_SERVER['SCRIPT_NAME']);
$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); $uglf = new UserGroupListFactory(); $group_options = $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE)); $data['src_group_options'] = Misc::arrayDiffByKey((array) $data['group_ids'], $group_options); $data['selected_group_options'] = Misc::arrayIntersectByKey((array) $data['group_ids'], $group_options); $ulf = new UserListFactory(); $ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), NULL); $user_options = $ulf->getArrayByListFactory($ulf, FALSE, TRUE); $data['src_include_user_options'] = Misc::arrayDiffByKey((array) $data['include_user_ids'], $user_options); $data['selected_include_user_options'] = Misc::arrayIntersectByKey((array) $data['include_user_ids'], $user_options); $data['src_exclude_user_options'] = Misc::arrayDiffByKey((array) $data['exclude_user_ids'], $user_options); $data['selected_exclude_user_options'] = Misc::arrayIntersectByKey((array) $data['exclude_user_ids'], $user_options); $data['group_selection_type_options'] = $sf->getOptions('group_selection_type'); $data['branch_selection_type_options'] = $sf->getOptions('branch_selection_type'); $data['department_selection_type_options'] = $sf->getOptions('department_selection_type'); $data['branch_options'] = Misc::prependArray(array(0 => '-- None --'), $branch_options); $data['department_options'] = Misc::prependArray(array(0 => '-- None --'), $department_options); $upf = new UserPreferenceFactory(); $timezone_options = Misc::prependArray(array(0 => '-- None --'), $upf->getOptions('time_zone')); $data['time_zone_options'] = $timezone_options; $smarty->assign_by_ref('data', $data); break; } $smarty->assign_by_ref('sf', $sf); $smarty->display('station/EditStation.tpl');