本文整理汇总了PHP中getTTProductEdition函数的典型用法代码示例。如果您正苦于以下问题:PHP getTTProductEdition函数的具体用法?PHP getTTProductEdition怎么用?PHP getTTProductEdition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTTProductEdition函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getFactoryOptions
function _getFactoryOptions($name, $parent = NULL)
{
$retval = NULL;
switch ($name) {
case 'columns':
$retval = array('-1100-type' => TTi18n::gettext('Type'), '-1110-status' => TTi18n::gettext('Status'), '-1210-time_stamp' => TTi18n::gettext('Date/Time'), '-1220-date' => TTi18n::gettext('Date'), '-1230-time' => TTi18n::gettext('Time'), '-1239-in_type' => TTi18n::gettext('In Type'), '-1240-in_time_stamp' => TTi18n::gettext('In Date/Time'), '-1250-in_punch_date' => TTi18n::gettext('In Date'), '-1260-in_punch_time' => TTi18n::gettext('In Time'), '-1269-out_type' => TTi18n::gettext('Out Type'), '-1270-out_time_stamp' => TTi18n::gettext('Out Date/Time'), '-1280-out_punch_date' => TTi18n::gettext('Out Date'), '-1290-out_punch_time' => TTi18n::gettext('Out Time'), '-1310-branch' => TTi18n::gettext('Branch'), '-1320-department' => TTi18n::gettext('Department'), '-1410-station_id' => TTi18n::gettext('Station ID'), '-1420-longitude' => TTi18n::gettext('Longitude'), '-1430-latitude' => TTi18n::gettext('Latitude'), '-1500-note' => TTi18n::gettext('Note'));
//Since getOptions() can be called without first setting a company, we don't always know the product edition for the currently
//logged in employee.
if (is_object($this->getCompanyObject()) and $this->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE or !is_object($this->getCompanyObject()) and getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
$retval += array('-1330-job' => TTi18n::gettext('Job'), '-1340-job_item' => TTi18n::gettext('Task'), '-1350-quantity' => TTi18n::gettext('Quantity'), '-1360-bad_quantity' => TTi18n::gettext('Bad Quantity'));
}
$retval = Misc::addSortPrefix(Misc::prependArray($this->getUserIdentificationColumns(), Misc::trimSortPrefix($retval)));
ksort($retval);
break;
case 'column_aliases':
//Used for converting column names after they have been parsed.
$retval = array('type' => 'type_id', 'status' => 'status_id', 'branch' => 'branch_id', 'department' => 'department_id', 'job' => 'job_id', 'job_item' => 'job_item_id');
break;
case 'import_options':
$retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'), '-1020-disable_rounding' => TTi18n::getText('Disable rounding.'));
break;
case 'parse_hint':
$upf = TTnew('UserPreferenceFactory');
$retval = array('branch' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'department' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job_item' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'time_stamp' => $upf->getOptions('date_time_format'), 'in_time_stamp' => $upf->getOptions('date_time_format'), 'out_time_stamp' => $upf->getOptions('date_time_format'), 'date' => $upf->getOptions('date_format'), 'in_punch_date' => $upf->getOptions('date_format'), 'out_punch_date' => $upf->getOptions('date_format'), 'time' => $upf->getOptions('time_format'), 'in_punch_time' => $upf->getOptions('time_format'), 'out_punch_time' => $upf->getOptions('time_format'));
break;
}
return $retval;
}
示例2: _getFactoryOptions
function _getFactoryOptions($name, $parent = NULL)
{
$retval = NULL;
switch ($name) {
case 'columns':
global $current_company;
$uf = TTNew('UserFactory');
$retval = Misc::trimSortPrefix($uf->getOptions('columns'));
$retval['-1025-password'] = TTi18n::getText('Password');
$retval['-1026-phone_password'] = TTi18n::getText('Quick Punch Password');
$retval['-1099-group'] = isset($retval['-1099-user_group']) ? $retval['-1099-user_group'] : NULL;
unset($retval['-1099-user_group']);
ksort($retval);
//Since getOptions() can be called without first setting a company, we don't always know the product edition for the currently
//logged in employee.
if (is_object($this->getCompanyObject()) and $this->getCompanyObject()->getProductEdition() < TT_PRODUCT_CORPORATE or !is_object($this->getCompanyObject()) and getTTProductEdition() < TT_PRODUCT_CORPORATE) {
unset($retval['-1104-default_job'], $retval['-1105-default_job_item']);
}
if (is_object($current_company)) {
//Get custom fields for import data.
$oflf = TTnew('OtherFieldListFactory');
$other_field_names = $oflf->getByCompanyIdAndTypeIdArray($current_company->getID(), array(10), array(10 => ''));
if (is_array($other_field_names)) {
$retval = array_merge((array) $retval, (array) $other_field_names);
}
}
Debug::Arr($retval, 'ImportUserColumns: ', __FILE__, __LINE__, __METHOD__, 10);
break;
case 'column_aliases':
//Used for converting column names after they have been parsed.
$retval = array('status' => 'status_id', 'default_branch' => 'default_branch_id', 'default_department' => 'default_department_id', 'default_job' => 'default_job_id', 'default_job_item' => 'default_job_item_id', 'title' => 'title_id', 'user_group' => 'group_id', 'group' => 'group_id', 'sex' => 'sex_id', 'permission_control' => 'permission_control_id', 'pay_period_schedule' => 'pay_period_schedule_id', 'policy_group' => 'policy_group_id', 'hierarchy_control_display' => 'hierarchy_control');
break;
case 'import_options':
$retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'), '-1015-update' => TTi18n::getText('Update existing records based on UserName, Employee Number, or SIN/SSN.'), '-1040-create_group' => TTi18n::getText('Create groups that don\'t already exist.'), '-1050-create_title' => TTi18n::getText('Create titles that don\'t already exist.'));
break;
case 'parse_hint':
$upf = TTnew('UserPreferenceFactory');
$retval = array('default_branch' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'default_department' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'default_job' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'default_job_item' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'first_name' => array('-1010-first_name' => TTi18n::gettext('First Name'), '-1020-first_last_name' => TTi18n::gettext('FirstName LastName'), '-1030-last_first_name' => TTi18n::gettext('LastName, FirstName'), '-1040-last_first_middle_name' => TTi18n::gettext('LastName, FirstName MiddleInitial')), 'last_name' => array('-1010-last_name' => TTi18n::gettext('Last Name'), '-1020-first_last_name' => TTi18n::gettext('FirstName LastName'), '-1030-last_first_name' => TTi18n::gettext('LastName, FirstName'), '-1040-last_first_middle_name' => TTi18n::gettext('LastName, FirstName MiddleInitial')), 'middle_name' => array('-1010-middle_name' => TTi18n::gettext('Middle Name'), '-1040-last_first_middle_name' => TTi18n::gettext('LastName, FirstName MiddleInitial')), 'hire_date' => $upf->getOptions('date_format'), 'termination_date' => $upf->getOptions('date_format'), 'birth_date' => $upf->getOptions('date_format'));
break;
}
return $retval;
}
示例3: _getOptions
protected function _getOptions($name, $params = NULL)
{
$retval = NULL;
switch ($name) {
case 'output_format':
$retval = parent::getOptions('default_output_format');
break;
case 'default_setup_fields':
$retval = array('template', 'time_period', 'columns');
break;
case 'setup_fields':
$retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2035-user_tag' => TTi18n::gettext('Employee Tags'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2080-schedule_branch_id' => TTi18n::gettext('Schedule Branch'), '-2090-schedule_department_id' => TTi18n::gettext('Schedule Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-3000-status_id' => TTi18n::gettext('Schedule Status'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By'));
break;
case 'time_period':
$retval = TTDate::getTimePeriodOptions();
break;
case 'date_columns':
$retval = TTDate::getReportDateOptions(NULL, TTi18n::getText('Date'), 15, TRUE);
break;
case 'custom_columns':
//Get custom fields for report data.
$oflf = TTnew('OtherFieldListFactory');
//User and Punch fields conflict as they are merged together in a secondary process.
$other_field_names = $oflf->getByCompanyIdAndTypeIdArray($this->getUserObject()->getCompany(), array(10), array(10 => ''));
if (is_array($other_field_names)) {
$retval = Misc::addSortPrefix($other_field_names, 9000);
}
break;
case 'report_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
// Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns.
// So just get custom columns with Selection and Formula.
$custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'ScheduleSummaryReport', 'custom_column');
if (is_array($custom_column_labels)) {
$retval = Misc::addSortPrefix($custom_column_labels, 9500);
}
}
break;
case 'report_custom_filters':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'ScheduleSummaryReport', 'custom_column');
}
break;
case 'report_dynamic_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'ScheduleSummaryReport', 'custom_column');
if (is_array($report_dynamic_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700);
}
}
break;
case 'report_static_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'ScheduleSummaryReport', 'custom_column');
if (is_array($report_static_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700);
}
}
break;
case 'formula_columns':
$retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns')));
break;
case 'filter_columns':
$retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')));
break;
case 'static_columns':
$retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1055-city' => TTi18n::gettext('City'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-user_group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1200-permission_control' => TTi18n::gettext('Permission Group'), '-1210-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1220-policy_group' => TTi18n::gettext('Policy Group'), '-1290-note' => TTi18n::gettext('Employee Note'), '-1295-tag' => TTi18n::gettext('Tags'), '-1600-branch' => TTi18n::gettext('Branch'), '-1610-department' => TTi18n::gettext('Department'), '-1620-schedule_policy' => TTi18n::gettext('Schedule Policy'), '-1640-schedule_status' => TTi18n::gettext('Schedule Status'), '-1650-absence_policy' => TTi18n::gettext('Absence Policy'), '-1670-start_time' => TTi18n::gettext('Start Time'), '-1680-end_time' => TTi18n::gettext('End Time'), '-5000-schedule_note' => TTi18n::gettext('Note'));
$retval = array_merge($retval, (array) $this->getOptions('date_columns'), (array) $this->getOptions('custom_columns'), (array) $this->getOptions('report_static_custom_column'));
ksort($retval);
break;
case 'dynamic_columns':
$retval = array('-2010-hourly_rate' => TTi18n::gettext('Hourly Rate'), '-2100-total_time' => TTi18n::gettext('Total Time'), '-2110-total_time_wage' => TTi18n::gettext('Total Time Wage'), '-2112-total_time_wage_burden' => TTi18n::gettext('Total Time Wage Burden'), '-2114-total_time_wage_with_burden' => TTi18n::gettext('Total Time Wage w/Burden'), '-4000-total_shift' => TTi18n::gettext('Total Shifts'));
break;
case 'columns':
$retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'));
break;
case 'column_format':
//Define formatting function for each column.
$columns = $this->getOptions('columns');
if (is_array($columns)) {
foreach ($columns as $column => $name) {
if (strpos($column, 'absence_policy')) {
//Ignore
} elseif (strpos($column, 'start_time') !== FALSE or strpos($column, 'end_time') !== FALSE) {
$retval[$column] = 'time';
} elseif (strpos($column, '_wage') !== FALSE or strpos($column, '_hourly_rate') !== FALSE or strpos($column, 'hourly_rate') !== FALSE) {
$retval[$column] = 'currency';
} elseif (strpos($column, '_time') or strpos($column, '_policy')) {
$retval[$column] = 'time_unit';
}
}
}
break;
case 'aggregates':
$retval = array();
$dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))));
//.........这里部分代码省略.........
示例4: addLogDetail
//.........这里部分代码省略.........
break;
case 'ScheduleFactory':
case 'ScheduleListFactory':
unset($diff_arr['recurring_schedule_template_control_id'], $diff_arr['replaced_id']);
break;
case 'PunchFactory':
case 'PunchListFactory':
unset($diff_arr['actual_time_stamp'], $diff_arr['original_time_stamp'], $diff_arr['punch_control_id'], $diff_arr['station_id'], $diff_arr['latitude'], $diff_arr['longitude']);
break;
case 'PunchControlFactory':
case 'PunchControlListFactory':
unset($diff_arr['actual_total_time']);
break;
case 'PunchControlFactory':
case 'PunchControlListFactory':
unset($diff_arr['overlap']);
break;
case 'AccrualFactory':
case 'AccrualListFactory':
unset($diff_arr['user_date_total_id']);
break;
case 'JobItemFactory':
case 'JobItemListFactory':
unset($diff_arr['type_id'], $diff_arr['department_id']);
break;
case 'ClientContactFactory':
case 'ClientContactListFactory':
unset($diff_arr['password'], $diff_arr['password_reset_key'], $diff_arr['password_reset_date']);
break;
case 'UserReviewFactory':
case 'UserReviewListFactory':
unset($diff_arr['user_review_control_id']);
break;
case 'ClientPaymentFactory':
case 'ClientPaymentListFactory':
if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
//Only log secure values.
if (isset($diff_arr['cc_number'])) {
$old_data['cc_number'] = isset($old_data['cc_number']) ? $object->getSecureCreditCardNumber(Misc::decrypt($old_data['cc_number'])) : '';
$new_data['cc_number'] = isset($new_data['cc_number']) ? $object->getSecureCreditCardNumber(Misc::decrypt($new_data['cc_number'])) : '';
}
if (isset($diff_arr['bank_account'])) {
$old_data['bank_account'] = isset($old_data['bank_account']) ? $object->getSecureAccount($old_data['bank_account']) : '';
$new_data['bank_account'] = isset($old_data['bank_account']) ? $object->getSecureAccount($new_data['bank_account']) : '';
}
if (isset($diff_arr['cc_check'])) {
$old_data['cc_check'] = isset($old_data['cc_check']) ? $object->getSecureCreditCardCheck($old_data['cc_check']) : '';
$new_data['cc_check'] = isset($old_data['cc_check']) ? $object->getSecureCreditCardCheck($new_data['cc_check']) : '';
}
}
break;
case 'JobApplicantFactory':
case 'JobApplicantListFactory':
unset($diff_arr['password'], $diff_arr['password_reset_key'], $diff_arr['password_reset_date'], $diff_arr['first_name_metaphone'], $diff_arr['last_name_metaphone']);
break;
}
//Ignore specific columns here, like updated_date, updated_by, etc...
unset($diff_arr['id'], $diff_arr['company_id'], $diff_arr['user_date_id'], $diff_arr['name_metaphone'], $diff_arr['created_date'], $diff_arr['created_by'], $diff_arr['created_by_id'], $diff_arr['updated_date'], $diff_arr['updated_by'], $diff_arr['updated_by_id'], $diff_arr['deleted_date'], $diff_arr['deleted_by'], $diff_arr['deleted_by_id'], $diff_arr['deleted']);
//Debug::Arr($diff_arr, 'Array Diff: ', __FILE__, __LINE__, __METHOD__, 10);
if (is_array($diff_arr) and count($diff_arr) > 0) {
foreach ($diff_arr as $field => $value) {
$old_value = NULL;
if (isset($old_data[$field])) {
$old_value = $old_data[$field];
if (is_bool($old_value) and $old_value === FALSE) {
$old_value = NULL;
} elseif (is_array($old_value)) {
//$old_value = serialize($old_value);
//If the old value is an array, replace it with NULL because it will always match the NEW value too.
$old_value = NULL;
}
}
$new_value = $new_data[$field];
if (is_bool($new_value) and $new_value === FALSE) {
$new_value = NULL;
} elseif (is_array($new_value)) {
$new_value = serialize($new_value);
}
//Debug::Text('Old Value: '. $old_value .' New Value: '. $new_value, __FILE__, __LINE__, __METHOD__, 10);
if (!($old_value == '' and $new_value == '')) {
$ph[] = (int) $system_log_id;
$ph[] = $field;
$ph[] = $new_value;
$ph[] = $old_value;
$data[] = '(?,?,?,?)';
}
}
if (isset($data)) {
//Save data in a single SQL query.
$query = 'INSERT INTO ' . $this->getTable() . '(SYSTEM_LOG_ID,FIELD,NEW_VALUE,OLD_VALUE) VALUES' . implode(',', $data);
//Debug::Text('Query: '. $query, __FILE__, __LINE__, __METHOD__, 10);
$this->db->Execute($query, $ph);
Debug::Text('Logged detail records in: ' . (microtime(TRUE) - $start_time), __FILE__, __LINE__, __METHOD__, 10);
return TRUE;
}
}
}
Debug::Text('Not logging detail records, likely no data changed in: ' . (microtime(TRUE) - $start_time) . 's', __FILE__, __LINE__, __METHOD__, 10);
return FALSE;
}
示例5: _getOptions
protected function _getOptions($name, $params = NULL)
{
$retval = NULL;
switch ($name) {
case 'output_format':
$retval = array_merge(parent::getOptions('default_output_format'), array('-1100-pdf_form' => TTi18n::gettext('Form'), '-1120-efile_xml' => TTi18n::gettext('eFile')));
break;
case 'default_setup_fields':
$retval = array('template', 'time_period', 'columns');
break;
case 'setup_fields':
$retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2080-code_id' => TTi18n::gettext('Reason'), '-2090-pay_period_type_id' => TTi18n::gettext('Pay Period Type'), '-3000-custom_filter' => TTi18n::gettext('Custom Filter'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By'));
break;
case 'time_period':
$retval = TTDate::getTimePeriodOptions();
break;
case 'date_columns':
$retval = array_merge(TTDate::getReportDateOptions('first', TTi18n::gettext('First Day Worked(Or first day since last ROE)'), 16, FALSE), TTDate::getReportDateOptions('last', TTi18n::gettext('Last Day For Which Paid'), 16, FALSE), TTDate::getReportDateOptions('pay_period_end', TTi18n::gettext('Final Pay Period Ending Date'), 17, FALSE), TTDate::getReportDateOptions('recall', TTi18n::gettext('Expected Date of Recall'), 17, FALSE));
$retval = array();
break;
case 'report_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
// Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns.
// So just get custom columns with Selection and Formula.
$custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'ROEReport', 'custom_column');
if (is_array($custom_column_labels)) {
$retval = Misc::addSortPrefix($custom_column_labels, 9500);
}
}
break;
case 'report_custom_filters':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'ROEReport', 'custom_column');
}
break;
case 'report_dynamic_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'ROEReport', 'custom_column');
if (is_array($report_dynamic_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700);
}
}
break;
case 'report_static_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'ROEReport', 'custom_column');
if (is_array($report_static_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700);
}
}
break;
case 'formula_columns':
$retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns')));
break;
case 'filter_columns':
$retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')));
break;
case 'static_columns':
$retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1035-sin' => TTi18n::gettext('SIN/SSN'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1120-code' => TTi18n::gettext('Reason'), '-1130-pay_period_type' => TTi18n::gettext('Pay Period Type'), '-1180-serial' => TTi18n::gettext('Serial No'), '-1190-comments' => TTi18n::gettext('Comments'), '-1400-permission_control' => TTi18n::gettext('Permission Group'), '-1410-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1420-policy_group' => TTi18n::gettext('Policy Group'));
$retval = array_merge($retval, $this->getOptions('date_columns'), (array) $this->getOptions('report_static_custom_column'));
ksort($retval);
break;
case 'dynamic_columns':
$retval = array('-2100-insurable_earnings' => TTi18n::gettext('Insurable Earnings (Box 15B)'), '-2110-vacation_pay' => TTi18n::gettext('Vacation Pay (Box 17A)'));
break;
case 'columns':
$retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'));
break;
case 'column_format':
//Define formatting function for each column.
$columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column'));
if (is_array($columns)) {
foreach ($columns as $column => $name) {
$retval[$column] = 'numeric';
}
}
break;
case 'aggregates':
$retval = array();
$dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))));
if (is_array($dynamic_columns)) {
foreach ($dynamic_columns as $column) {
switch ($column) {
default:
$retval[$column] = 'sum';
}
}
}
break;
case 'type':
$retval = array('-1010-O' => TTi18n::getText('Original'), '-1020-A' => TTi18n::getText('Amended'), '-1030-C' => TTi18n::getText('Cancel'));
break;
case 'templates':
$retval = array('-1020-by_employee' => TTi18n::gettext('by Employee'), '-1030-by_branch' => TTi18n::gettext('by Branch'), '-1040-by_department' => TTi18n::gettext('by Department'), '-1050-by_branch_by_department' => TTi18n::gettext('by Branch/Department'));
break;
case 'template_config':
//.........这里部分代码省略.........
示例6: getTTProductEditionName
function getTTProductEditionName()
{
switch (getTTProductEdition()) {
case 15:
$retval = 'Business';
break;
case 20:
$retval = 'Professional';
break;
default:
$retval = 'Standard';
break;
}
return $retval;
}
示例7: getGeoCodeByAddress
function getGeoCodeByAddress($address1, $address2, $city, $province, $country, $postal_code)
{
global $config_vars;
if (!isset($config_vars['other']['primary_company_id'])) {
$config_vars['other']['primary_company_id'] = 1;
}
try {
$clf = TTnew('CompanyListFactory');
$clf->getById($config_vars['other']['primary_company_id']);
if ($clf->getRecordCount() > 0) {
foreach ($clf as $c_obj) {
$company_data = array('system_version' => APPLICATION_VERSION, 'registration_key' => $this->getLocalRegistrationKey(), 'product_edition_id' => $c_obj->getProductEdition(), 'product_edition_available' => getTTProductEdition(), 'name' => $c_obj->getName(), 'short_name' => $c_obj->getShortName(), 'work_phone' => $c_obj->getWorkPhone(), 'city' => $c_obj->getCity(), 'country' => $c_obj->getCountry(), 'province' => $c_obj->getProvince(), 'postal_code' => $c_obj->getPostalCode());
}
}
} catch (Exception $e) {
Debug::Text('ERROR: Cant get company data for geocoding, database is likely down...', __FILE__, __LINE__, __METHOD__, 10);
$company_data = NULL;
}
if (isset($company_data) and $city != '' and $country != '') {
return $this->getSoapObject()->getGeoCodeByAddress($address1, $address2, $city, $province, $country, $postal_code, $company_data);
}
return NULL;
//Return NULL when no data available, and FALSE to try again later.
}
示例8: getNotifications
/**
* Returns array of notifications message to be displayed to the user.
* @param string $action Action that is being performed, possible values: 'login', 'preference', 'notification', 'pay_period'
* @return array
*/
function getNotifications($action = FALSE)
{
global $config_vars, $disable_database_connection;
$retarr = FALSE;
//Skip this step if disable_database_connection is enabled or the user is going through the installer still
switch (strtolower($action)) {
case 'login':
if ((!isset($disable_database_connection) or isset($disable_database_connection) and $disable_database_connection != TRUE) and (!isset($config_vars['other']['installer_enabled']) or isset($config_vars['other']['installer_enabled']) and $config_vars['other']['installer_enabled'] != TRUE)) {
//Get all system settings, so they can be used even if the user isn't logged in, such as the login page.
$sslf = new SystemSettingListFactory();
$system_settings = $sslf->getAllArray();
}
unset($sslf);
//Check license validity
if ((DEPLOYMENT_ON_DEMAND == FALSE and $this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id']) and getTTProductEdition() > 10) {
if (!isset($system_settings['license'])) {
$system_settings['license'] = NULL;
}
$license = new TTLicense();
$license_validate = $license->validateLicense($system_settings['license']);
$license_message = $license->getFullErrorMessage($license_validate, TRUE);
if ($license_message != '') {
$destination_url = 'http://www.timetrex.com/r.php?id=899';
if ($license_validate === TRUE) {
//License likely expires soon.
$retarr[] = array('delay' => 0, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('WARNING: %1', $license_message), 'destination' => $destination_url);
} else {
//License error.
$retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1', $license_message), 'destination' => $destination_url);
}
}
unset($license, $license_validate, $license_message, $destination);
}
//System Requirements not being met.
if (isset($system_settings['valid_install_requirements']) and DEPLOYMENT_ON_DEMAND == FALSE and (int) $system_settings['valid_install_requirements'] == 0) {
$retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 system requirement check has failed! Please contact your %1 administrator immediately to re-run the %1 installer to correct the issue.', APPLICATION_NAME), 'destination' => NULL);
}
//Check version mismatch
if (isset($system_settings['system_version']) and DEPLOYMENT_ON_DEMAND == FALSE and APPLICATION_VERSION != $system_settings['system_version']) {
$retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 application version does not match database version. Please re-run the %1 installer to complete the upgrade process.', APPLICATION_NAME), 'destination' => NULL);
}
//Only display message to the primary company.
if (time() - (int) APPLICATION_VERSION_DATE > 86400 * 475 and ($this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id'])) {
//~1yr and 3mths
$retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: This %1 version (v%2) is severely out of date and may no longer be supported. Please upgrade to the latest version as soon as possible as invalid calculations may already be occurring.', array(APPLICATION_NAME, APPLICATION_VERSION)), 'destination' => NULL);
}
//New version available notification.
if (DEMO_MODE == FALSE and (isset($system_settings['new_version']) and $system_settings['new_version'] == 1) and ($this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id'])) {
//Only display this every two weeks.
$new_version_available_notification_arr = UserSettingFactory::getUserSetting($this->getCurrentUserObject()->getID(), 'new_version_available_notification');
if (!isset($new_version_available_notification_arr['value']) or isset($new_version_available_notification_arr['value']) and $new_version_available_notification_arr['value'] <= time() - 86400 * 14) {
UserSettingFactory::setUserSetting($this->getCurrentUserObject()->getID(), 'new_version_available_notification', time());
$retarr[] = array('delay' => -1, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: A new version of %1 available, it is highly recommended that you upgrade as soon as possible. Click here to download the latest version.', array(APPLICATION_NAME)), 'destination' => getTTProductEdition() == TT_PRODUCT_COMMUNITY ? 'http://www.timetrex.com/r.php?id=19' : 'http://www.timetrex.com/r.php?id=9');
}
unset($new_version_available_notification);
}
//Check for major new version.
$new_version_notification_arr = UserSettingFactory::getUserSetting($this->getCurrentUserObject()->getID(), 'new_version_notification');
if (DEMO_MODE == FALSE and (!isset($config_vars['branding']['application_name']) or ($this->getCurrentCompanyObject()->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $this->getCurrentCompanyObject()->getId() == $config_vars['other']['primary_company_id'])) and $this->getPermissionObject()->getLevel() >= 20 and $this->getCurrentUserObject()->getCreatedDate() <= APPLICATION_VERSION_DATE and (!isset($new_version_notification_arr['value']) or isset($new_version_notification_arr['value']) and Misc::MajorVersionCompare(APPLICATION_VERSION, $new_version_notification_arr['value'], '>'))) {
UserSettingFactory::setUserSetting($this->getCurrentUserObject()->getID(), 'new_version_notification', APPLICATION_VERSION);
$retarr[] = array('delay' => -1, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: Your instance of %1 has been upgraded to v%2, click here to see whats new.', array(APPLICATION_NAME, APPLICATION_VERSION)), 'destination' => 'http://www.timetrex.com/r.php?id=300');
}
unset($new_version_notification);
//Check installer enabled.
if (isset($config_vars['other']['installer_enabled']) and $config_vars['other']['installer_enabled'] == 1) {
$retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 is currently in INSTALL MODE. Please go to your timetrex.ini.php file and set "installer_enabled" to "FALSE".', APPLICATION_NAME), 'destination' => NULL);
}
//Make sure CronJobs are running correctly.
$cjlf = new CronJobListFactory();
$cjlf->getMostRecentlyRun();
if ($cjlf->getRecordCount() > 0) {
//Is last run job more then 48hrs old?
$cj_obj = $cjlf->getCurrent();
if (PRODUCTION == TRUE and DEMO_MODE == FALSE and $cj_obj->getLastRunDate() < time() - 172800 and $cj_obj->getCreatedDate() < time() - 172800) {
$retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: Critical maintenance jobs have not run in the last 48hours. Please contact your %1 administrator immediately.', APPLICATION_NAME), 'destination' => NULL);
}
}
unset($cjlf, $cj_obj);
//Check if any pay periods are past their transaction date and not closed.
if (DEMO_MODE == FALSE and $this->getPermissionObject()->Check('pay_period_schedule', 'enabled') and $this->getPermissionObject()->Check('pay_period_schedule', 'view')) {
$pplf = TTnew('PayPeriodListFactory');
$pplf->getByCompanyIdAndStatusAndTransactionDate($this->getCurrentCompanyObject()->getId(), array(10, 30), TTDate::getBeginDayEpoch(time()));
//Open or Post Adjustment pay periods.
if ($pplf->getRecordCount() > 0) {
foreach ($pplf as $pp_obj) {
if ($pp_obj->getCreatedDate() < time() - 86400 * 40) {
//Ignore pay period schedules newer than 40 days. They are automatically closed after 45 days.
$retarr[] = array('delay' => 0, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: Pay periods past their transaction date have not been closed yet. It\'s critical that these pay periods are closed to prevent data loss, click here to close them now.'), 'destination' => array('menu_name' => 'Pay Periods'));
break;
}
}
}
unset($pplf, $pp_obj);
}
//CHeck for unread messages
//.........这里部分代码省略.........
示例9: _getOptions
protected function _getOptions($name, $params = NULL)
{
$retval = NULL;
switch ($name) {
case 'output_format':
$retval = parent::getOptions('default_output_format');
break;
case 'default_setup_fields':
$retval = array('template', 'columns');
break;
case 'setup_fields':
$retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2035-user_tag' => TTi18n::gettext('Employee Tags'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By'));
if ($this->getUserObject()->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE) {
$professional_edition_setup_fields = array('-2510-job_status_id' => TTi18n::gettext('Job Status'), '-2520-job_group_id' => TTi18n::gettext('Job Group'), '-2530-include_job_id' => TTi18n::gettext('Include Job'), '-2540-exclude_job_id' => TTi18n::gettext('Exclude Job'), '-2610-job_item_group_id' => TTi18n::gettext('Task Group'), '-2620-include_job_item_id' => TTi18n::gettext('Include Task'), '-2630-exclude_job_item_id' => TTi18n::gettext('Exclude Task'));
$retval = array_merge($retval, $professional_edition_setup_fields);
}
break;
case 'time_period':
$retval = TTDate::getTimePeriodOptions();
break;
case 'date_columns':
/*
$retval = array_merge(
TTDate::getReportDateOptions( 'time_stamp', TTi18n::getText('Punch Time'), 19, FALSE ),
array()
);
*/
break;
case 'custom_columns':
//Get custom fields for report data.
$oflf = TTnew('OtherFieldListFactory');
//User and Punch fields conflict as they are merged together in a secondary process.
$other_field_names = $oflf->getByCompanyIdAndTypeIdArray($this->getUserObject()->getCompany(), array(10), array(10 => ''));
if (is_array($other_field_names)) {
$retval = Misc::addSortPrefix($other_field_names, 9000);
}
break;
case 'report_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
// Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns.
// So just get custom columns with Selection and Formula.
$custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'ActiveShiftReport', 'custom_column');
if (is_array($custom_column_labels)) {
$retval = Misc::addSortPrefix($custom_column_labels, 9500);
}
}
break;
case 'report_custom_filters':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'ActiveShiftReport', 'custom_column');
}
break;
case 'report_dynamic_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'ActiveShiftReport', 'custom_column');
if (is_array($report_dynamic_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700);
}
}
break;
case 'report_static_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'ActiveShiftReport', 'custom_column');
if (is_array($report_static_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700);
}
}
break;
case 'formula_columns':
$retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns')));
break;
case 'filter_columns':
$retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')));
break;
case 'static_columns':
$retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1010-user_name' => TTi18n::gettext('User Name'), '-1020-phone_id' => TTi18n::gettext('Quick Punch ID'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1050-title' => TTi18n::gettext('Title'), '-1080-user_group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Branch'), '-1100-default_department' => TTi18n::gettext('Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1200-permission_control' => TTi18n::gettext('Permission Group'), '-1210-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1220-policy_group' => TTi18n::gettext('Policy Group'), '-1310-sex' => TTi18n::gettext('Gender'), '-1320-address1' => TTi18n::gettext('Address 1'), '-1330-address2' => TTi18n::gettext('Address 2'), '-1340-city' => TTi18n::gettext('City'), '-1350-province' => TTi18n::gettext('Province/State'), '-1360-country' => TTi18n::gettext('Country'), '-1370-postal_code' => TTi18n::gettext('Postal Code'), '-1380-work_phone' => TTi18n::gettext('Work Phone'), '-1391-work_phone_ext' => TTi18n::gettext('Work Phone Ext'), '-1400-home_phone' => TTi18n::gettext('Home Phone'), '-1410-mobile_phone' => TTi18n::gettext('Mobile Phone'), '-1420-fax_phone' => TTi18n::gettext('Fax Phone'), '-1430-home_email' => TTi18n::gettext('Home Email'), '-1440-work_email' => TTi18n::gettext('Work Email'), '-1495-tag' => TTi18n::gettext('Tags'), '-1740-time_zone_display' => TTi18n::gettext('Time Zone'), '-1801-type' => TTi18n::gettext('Type'), '-1802-status' => TTi18n::gettext('Status'), '-1810-branch' => TTi18n::gettext('Branch'), '-1820-department' => TTi18n::gettext('Department'), '-1830-station_type' => TTi18n::gettext('Station Type'), '-1840-station_station_id' => TTi18n::gettext('Station ID'), '-1850-station_source' => TTi18n::gettext('Station Source'), '-1860-station_description' => TTi18n::gettext('Station Description'), '-1900-time_stamp' => TTi18n::gettext('Punch Time'), '-1910-actual_time_stamp' => TTi18n::gettext('Actual Punch Time'), '-2010-note' => TTi18n::gettext('Note'));
if ($this->getUserObject()->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE) {
$professional_edition_static_columns = array('-1825-job' => TTi18n::gettext('Job'), '-1826-job_item' => TTi18n::gettext('Task'));
$retval = array_merge($retval, $professional_edition_static_columns, (array) $this->getOptions('report_static_custom_column'));
}
break;
case 'dynamic_columns':
$retval = array('-2000-total_user' => TTi18n::gettext('Total Employees'));
break;
case 'columns':
$retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('custom_columns'), (array) $this->getOptions('report_dynamic_custom_column'));
break;
case 'column_format':
//Define formatting function for each column.
$columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column'));
if (is_array($columns)) {
foreach ($columns as $column => $name) {
if (strpos($column, 'wage') !== FALSE or strpos($column, 'hourly_rate') !== FALSE) {
$retval[$column] = 'currency';
}
}
//.........这里部分代码省略.........
示例10: _getOptions
protected function _getOptions($name, $params = NULL)
{
$retval = NULL;
switch ($name) {
case 'output_format':
$retval = array_merge(parent::getOptions('default_output_format'), array('-1100-pdf_form' => TTi18n::gettext('Employee (One Employee/Page)'), '-1110-pdf_form_government' => TTi18n::gettext('Government (Multiple Employees/Page)'), '-1120-efile' => TTi18n::gettext('eFile')));
break;
case 'default_setup_fields':
$retval = array('template', 'time_period', 'columns');
break;
case 'setup_fields':
$retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-4020-exclude_ytd_adjustment' => TTi18n::gettext('Exclude YTD Adjustments'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By'));
break;
case 'time_period':
$retval = TTDate::getTimePeriodOptions();
break;
case 'date_columns':
//$retval = TTDate::getReportDateOptions( NULL, TTi18n::getText('Date'), 13, TRUE );
$retval = array();
break;
case 'report_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
// Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns.
// So just get custom columns with Selection and Formula.
$custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'FormW2Report', 'custom_column');
if (is_array($custom_column_labels)) {
$retval = Misc::addSortPrefix($custom_column_labels, 9500);
}
}
break;
case 'report_custom_filters':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'FormW2Report', 'custom_column');
}
break;
case 'report_dynamic_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'FormW2Report', 'custom_column');
if (is_array($report_dynamic_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700);
}
}
break;
case 'report_static_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'FormW2Report', 'custom_column');
if (is_array($report_static_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700);
}
}
break;
case 'formula_columns':
$retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns')));
break;
case 'filter_columns':
$retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')));
break;
case 'static_columns':
$retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1035-sin' => TTi18n::gettext('SIN/SSN'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1080-group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1400-permission_control' => TTi18n::gettext('Permission Group'), '-1410-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1420-policy_group' => TTi18n::gettext('Policy Group'), '-1510-address1' => TTi18n::gettext('Address 1'), '-1512-address2' => TTi18n::gettext('Address 2'), '-1520-city' => TTi18n::gettext('City'), '-1522-province' => TTi18n::gettext('Province/State'), '-1524-country' => TTi18n::gettext('Country'), '-1526-postal_code' => TTi18n::gettext('Postal Code'), '-1530-work_phone' => TTi18n::gettext('Work Phone'), '-1540-work_phone_ext' => TTi18n::gettext('Work Phone Ext'), '-1550-home_phone' => TTi18n::gettext('Home Phone'), '-1560-home_email' => TTi18n::gettext('Home Email'), '-1590-note' => TTi18n::gettext('Note'), '-1595-tag' => TTi18n::gettext('Tags'));
$retval = array_merge($retval, $this->getOptions('date_columns'), (array) $this->getOptions('report_static_custom_column'));
ksort($retval);
break;
case 'dynamic_columns':
$retval = array('-2010-l1' => TTi18n::gettext('Wages (1)'), '-2020-l2' => TTi18n::gettext('Federal Income Tax (2)'), '-2030-l3' => TTi18n::gettext('Social Security Wages (3)'), '-2040-l4' => TTi18n::gettext('Social Security Tax (4)'), '-2040-l7' => TTi18n::gettext('Social Security Tips (7)'), '-2050-l5' => TTi18n::gettext('Medicare Wages (5)'), '-2060-l6' => TTi18n::gettext('Medicare Tax (6)'), '-2070-l8' => TTi18n::gettext('Allocated Tips (8)'), '-2080-l10' => TTi18n::gettext('Dependent Care Benefits (10)'), '-2090-l11' => TTi18n::gettext('Nonqualified Plans (11)'), '-2100-l12a' => TTi18n::gettext('Box 12a'), '-2110-l12b' => TTi18n::gettext('Box 12b'), '-2120-l12c' => TTi18n::gettext('Box 12c'), '-2130-l12d' => TTi18n::gettext('Box 12d'), '-2200-l14a' => TTi18n::gettext('Box 14a'), '-2210-l14b' => TTi18n::gettext('Box 14b'), '-2220-l14c' => TTi18n::gettext('Box 14c'), '-2230-l14d' => TTi18n::gettext('Box 14d'));
break;
case 'columns':
$retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'));
break;
case 'column_format':
//Define formatting function for each column.
$columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column'));
if (is_array($columns)) {
foreach ($columns as $column => $name) {
$retval[$column] = 'currency';
}
}
break;
case 'aggregates':
$retval = array();
$dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))));
if (is_array($dynamic_columns)) {
foreach ($dynamic_columns as $column) {
switch ($column) {
default:
$retval[$column] = 'sum';
}
}
}
break;
case 'templates':
$retval = array('-1020-by_employee' => TTi18n::gettext('by Employee'), '-1030-by_branch' => TTi18n::gettext('by Branch'), '-1040-by_department' => TTi18n::gettext('by Department'), '-1050-by_branch_by_department' => TTi18n::gettext('by Branch/Department'));
break;
case 'template_config':
$template = strtolower(Misc::trimSortPrefix($params['template']));
if (isset($template) and $template != '') {
switch ($template) {
//.........这里部分代码省略.........
示例11: _getOptions
protected function _getOptions($name, $params = NULL)
{
$retval = NULL;
switch ($name) {
case 'output_format':
$psf = TTnew('PayStubFactory');
$retval = array_merge(parent::getOptions('default_output_format'), array('-1100-pdf_employee_pay_stub' => TTi18n::gettext('Employee Pay Stub'), '-1110-pdf_employer_pay_stub' => TTi18n::gettext('Employer Pay Stub')), Misc::addSortPrefix(Misc::trimSortPrefix($psf->getOptions('export_type')), 1200));
break;
case 'default_setup_fields':
$retval = array('template', 'time_period', 'columns');
break;
case 'setup_fields':
$retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2035-user_tag' => TTi18n::gettext('Employee Tags'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2080-currency_id' => TTi18n::gettext('Currency'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-4020-exclude_ytd_adjustment' => TTi18n::gettext('Exclude YTD Adjustments'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By'));
break;
case 'time_period':
$retval = TTDate::getTimePeriodOptions();
break;
case 'date_columns':
$retval = TTDate::getReportDateOptions('transaction', TTi18n::getText('Transaction Date'), 13, TRUE);
break;
case 'custom_columns':
//Get custom fields for report data.
$oflf = TTnew('OtherFieldListFactory');
//User and Punch fields conflict as they are merged together in a secondary process.
$other_field_names = $oflf->getByCompanyIdAndTypeIdArray($this->getUserObject()->getCompany(), array(10), array(10 => ''));
if (is_array($other_field_names)) {
$retval = Misc::addSortPrefix($other_field_names, 9000);
}
break;
case 'report_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
// Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns.
// So just get custom columns with Selection and Formula.
$custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'PayStubSummaryReport', 'custom_column');
if (is_array($custom_column_labels)) {
$retval = Misc::addSortPrefix($custom_column_labels, 9500);
}
}
break;
case 'report_custom_filters':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'PayStubSummaryReport', 'custom_column');
}
break;
case 'report_dynamic_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'PayStubSummaryReport', 'custom_column');
if (is_array($report_dynamic_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700);
}
}
break;
case 'report_static_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'PayStubSummaryReport', 'custom_column');
if (is_array($report_static_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700);
}
}
break;
case 'formula_columns':
$retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns')));
break;
case 'filter_columns':
$retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')));
break;
case 'static_columns':
$retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1055-city' => TTi18n::gettext('City'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-user_group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1131-current_currency' => TTi18n::gettext('Current Currency'), '-1200-permission_control' => TTi18n::gettext('Permission Group'), '-1210-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1220-policy_group' => TTi18n::gettext('Policy Group'), '-1280-sin' => TTi18n::gettext('SIN/SSN'), '-1290-note' => TTi18n::gettext('Note'), '-1295-tag' => TTi18n::gettext('Tags'));
$retval = array_merge($retval, (array) $this->getOptions('date_columns'), (array) $this->getOptions('custom_columns'), (array) $this->getOptions('report_static_custom_column'));
ksort($retval);
break;
case 'dynamic_columns':
$retval = array('-2900-total_pay_stub' => TTi18n::gettext('Total Pay Stubs'));
$retval = array_merge($retval, $this->getOptions('pay_stub_account_amount_columns'));
ksort($retval);
break;
case 'pay_stub_account_amount_columns':
//Get all pay stub accounts
$retval = array();
$psealf = TTnew('PayStubEntryAccountListFactory');
$psealf->getByCompanyIdAndStatusIdAndTypeId($this->getUserObject()->getCompany(), 10, array(10, 20, 30, 40, 50, 60, 65));
if ($psealf->getRecordCount() > 0) {
$type_options = $psealf->getOptions('type');
foreach ($type_options as $key => $val) {
$type_options[$key] = str_replace(array('Employee', 'Employer', 'Deduction', 'Total'), array('EE', 'ER', 'Ded', ''), $val);
}
$i = 0;
foreach ($psealf as $psea_obj) {
//Need to make the PSEA_ID a string so we can array_merge it properly later.
if ($psea_obj->getType() == 40) {
//Total accounts.
$prefix = NULL;
} else {
$prefix = $type_options[$psea_obj->getType()] . ' - ';
}
$retval['-3' . str_pad($i, 3, 0, STR_PAD_LEFT) . '-PA' . $psea_obj->getID()] = $prefix . $psea_obj->getName();
//.........这里部分代码省略.........
示例12: getLastPunchByCompanyIdAndArrayCriteria
function getLastPunchByCompanyIdAndArrayCriteria($company_id, $filter_data, $limit = NULL, $page = NULL, $where = NULL, $order = NULL)
{
if ($company_id == '') {
return FALSE;
}
if (!is_array($order)) {
//Use Filter Data ordering if its set.
if (isset($filter_data['sort_column']) and $filter_data['sort_order']) {
$order = array(Misc::trimSortPrefix($filter_data['sort_column']) => $filter_data['sort_order']);
}
}
//$additional_order_fields = array('b.name', 'c.name', 'd.name', 'e.name');
$additional_order_fields = array('b.branch_id', 'c.date_stamp', 'd.last_name', 'a.time_stamp', 'a.status_id', 'b.branch_id', 'b.department_id', 'e.type_id');
if ($order == NULL) {
$order = array('b.branch_id' => 'asc', 'd.last_name' => 'asc', 'a.time_stamp' => 'desc', 'a.punch_control_id' => 'asc', 'a.status_id' => 'asc');
$strict = FALSE;
} else {
$strict = TRUE;
}
//Debug::Arr($order,'Order Data:', __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($filter_data,'Filter Data:', __FILE__, __LINE__, __METHOD__,10);
if (isset($filter_data['exclude_user_ids'])) {
$filter_data['exclude_id'] = $filter_data['exclude_user_ids'];
}
if (isset($filter_data['include_user_ids'])) {
$filter_data['id'] = $filter_data['include_user_ids'];
}
if (isset($filter_data['user_status_ids'])) {
$filter_data['status_id'] = $filter_data['user_status_ids'];
}
if (isset($filter_data['user_title_ids'])) {
$filter_data['title_id'] = $filter_data['user_title_ids'];
}
if (isset($filter_data['group_ids'])) {
$filter_data['group_id'] = $filter_data['group_ids'];
}
if (isset($filter_data['branch_ids'])) {
$filter_data['default_branch_id'] = $filter_data['branch_ids'];
}
if (isset($filter_data['department_ids'])) {
$filter_data['default_department_id'] = $filter_data['department_ids'];
}
if (isset($filter_data['punch_branch_ids'])) {
$filter_data['punch_branch_id'] = $filter_data['punch_branch_ids'];
}
if (isset($filter_data['punch_department_ids'])) {
$filter_data['punch_department_id'] = $filter_data['punch_department_ids'];
}
if (isset($filter_data['exclude_job_ids'])) {
$filter_data['exclude_id'] = $filter_data['exclude_job_ids'];
}
if (isset($filter_data['include_job_ids'])) {
$filter_data['include_job_id'] = $filter_data['include_job_ids'];
}
if (isset($filter_data['job_group_ids'])) {
$filter_data['job_group_id'] = $filter_data['job_group_ids'];
}
if (isset($filter_data['job_item_ids'])) {
$filter_data['job_item_id'] = $filter_data['job_item_ids'];
}
$uf = new UserFactory();
$udf = new UserDateFactory();
$pcf = new PunchControlFactory();
$sf = new StationFactory();
if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
$jf = new JobFactory();
$jif = new JobItemFactory();
}
$ph = array('company_id' => $company_id);
$query = '
select
a.id as punch_id,
a.punch_control_id as punch_control_id,
a.type_id as type_id,
a.status_id as status_id,
a.time_stamp as time_stamp,
a.actual_time_stamp as actual_time_stamp,
b.user_date_id as user_date_id,
c.date_stamp as date_stamp,
b.branch_id as branch_id,
b.department_id as department_id,
b.job_id as job_id,
b.job_item_id as job_item_id,
b.note as note,
c.user_id as user_id,
e.type_id as station_type_id,
e.station_id as station_station_id,
e.source as station_source,
e.description as station_description
from ' . $this->getTable() . ' as a
LEFT JOIN ' . $pcf->getTable() . ' as b ON a.punch_control_id = b.id
LEFT JOIN ' . $udf->getTable() . ' as c ON b.user_date_id = c.id
LEFT JOIN ' . $uf->getTable() . ' as d ON c.user_id = d.id
LEFT JOIN ' . $sf->getTable() . ' as e ON a.station_id = e.id
LEFT JOIN (
select tmp2_d.id, max(tmp2_a.time_stamp) as max_punch_time_stamp
//.........这里部分代码省略.........
示例13: _getOptions
protected function _getOptions($name, $params = NULL)
{
$retval = NULL;
switch ($name) {
case 'output_format':
$retval = array_merge(parent::getOptions('default_output_format'), array('-1100-pdf_form' => TTi18n::gettext('Form')));
break;
case 'default_setup_fields':
$retval = array('template', 'time_period', 'columns');
break;
case 'setup_fields':
$retval = array('-1000-template' => TTi18n::gettext('Template'), '-1010-time_period' => TTi18n::gettext('Time Period'), '-2010-user_status_id' => TTi18n::gettext('Employee Status'), '-2020-user_group_id' => TTi18n::gettext('Employee Group'), '-2030-user_title_id' => TTi18n::gettext('Employee Title'), '-2040-include_user_id' => TTi18n::gettext('Employee Include'), '-2050-exclude_user_id' => TTi18n::gettext('Employee Exclude'), '-2060-default_branch_id' => TTi18n::gettext('Default Branch'), '-2070-default_department_id' => TTi18n::gettext('Default Department'), '-2100-custom_filter' => TTi18n::gettext('Custom Filter'), '-4020-exclude_ytd_adjustment' => TTi18n::gettext('Exclude YTD Adjustments'), '-5000-columns' => TTi18n::gettext('Display Columns'), '-5010-group' => TTi18n::gettext('Group By'), '-5020-sub_total' => TTi18n::gettext('SubTotal By'), '-5030-sort' => TTi18n::gettext('Sort By'));
break;
case 'time_period':
$retval = TTDate::getTimePeriodOptions();
break;
case 'date_columns':
$retval = TTDate::getReportDateOptions(NULL, TTi18n::getText('Date'), 13, TRUE);
break;
case 'report_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
// Because the Filter type is just only a filter criteria and not need to be as an option of Display Columns, Group By, Sub Total, Sort By dropdowns.
// So just get custom columns with Selection and Formula.
$custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), NULL, 'Form940Report', 'custom_column');
if (is_array($custom_column_labels)) {
$retval = Misc::addSortPrefix($custom_column_labels, 9500);
}
}
break;
case 'report_custom_filters':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$retval = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('filter_column_type_ids'), NULL, 'Form940Report', 'custom_column');
}
break;
case 'report_dynamic_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_dynamic_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('dynamic_format_ids'), 'Form940Report', 'custom_column');
if (is_array($report_dynamic_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_dynamic_custom_column_labels, 9700);
}
}
break;
case 'report_static_custom_column':
if (getTTProductEdition() >= TT_PRODUCT_PROFESSIONAL) {
$rcclf = TTnew('ReportCustomColumnListFactory');
$report_static_custom_column_labels = $rcclf->getByCompanyIdAndTypeIdAndFormatIdAndScriptArray($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), $rcclf->getOptions('static_format_ids'), 'Form940Report', 'custom_column');
if (is_array($report_static_custom_column_labels)) {
$retval = Misc::addSortPrefix($report_static_custom_column_labels, 9700);
}
}
break;
case 'formula_columns':
$retval = TTMath::formatFormulaColumns(array_merge(array_diff($this->getOptions('static_columns'), (array) $this->getOptions('report_static_custom_column')), $this->getOptions('dynamic_columns')));
break;
case 'filter_columns':
$retval = TTMath::formatFormulaColumns(array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column')));
break;
case 'static_columns':
$retval = array('-1000-first_name' => TTi18n::gettext('First Name'), '-1001-middle_name' => TTi18n::gettext('Middle Name'), '-1002-last_name' => TTi18n::gettext('Last Name'), '-1005-full_name' => TTi18n::gettext('Full Name'), '-1030-employee_number' => TTi18n::gettext('Employee #'), '-1035-sin' => TTi18n::gettext('SIN/SSN'), '-1040-status' => TTi18n::gettext('Status'), '-1050-title' => TTi18n::gettext('Title'), '-1060-province' => TTi18n::gettext('Province/State'), '-1070-country' => TTi18n::gettext('Country'), '-1080-group' => TTi18n::gettext('Group'), '-1090-default_branch' => TTi18n::gettext('Default Branch'), '-1100-default_department' => TTi18n::gettext('Default Department'), '-1110-currency' => TTi18n::gettext('Currency'), '-1400-permission_control' => TTi18n::gettext('Permission Group'), '-1410-pay_period_schedule' => TTi18n::gettext('Pay Period Schedule'), '-1420-policy_group' => TTi18n::gettext('Policy Group'));
$retval = array_merge($retval, $this->getOptions('date_columns'), (array) $this->getOptions('report_static_custom_column'));
ksort($retval);
break;
case 'dynamic_columns':
$retval = array('-2010-total_payments' => TTi18n::gettext('Total Payments'), '-2020-exempt_payments' => TTi18n::gettext('Exempt Payments'), '-2030-excess_payments' => TTi18n::gettext('Excess Payments'), '-2040-taxable_wages' => TTi18n::gettext('Taxable Wages'), '-2050-before_adjustment_tax' => TTi18n::gettext('Tax Before Adjustments'), '-2052-adjustment_tax' => TTi18n::gettext('Tax Adjustments'), '-2054-after_adjustment_tax' => TTi18n::gettext('Tax After Adjustments'));
break;
case 'columns':
$retval = array_merge($this->getOptions('static_columns'), $this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'));
break;
case 'column_format':
//Define formatting function for each column.
$columns = array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_custom_column'));
if (is_array($columns)) {
foreach ($columns as $column => $name) {
$retval[$column] = 'currency';
}
}
break;
case 'aggregates':
$retval = array();
$dynamic_columns = array_keys(Misc::trimSortPrefix(array_merge($this->getOptions('dynamic_columns'), (array) $this->getOptions('report_dynamic_custom_column'))));
if (is_array($dynamic_columns)) {
foreach ($dynamic_columns as $column) {
switch ($column) {
default:
$retval[$column] = 'sum';
}
}
}
break;
case 'state':
$retval = Misc::prependArray(array(0 => TTi18n::getText('- Multi-state Employer -')), $this->getUserObject()->getCompanyObject()->getOptions('province', 'US'));
break;
case 'return_type':
$retval = array(10 => TTi18n::getText('Amended'), 20 => TTi18n::getText('Successor Employer'), 30 => TTi18n::getText('No Payments to Employees'), 40 => TTi18n::getText('Final: Business closed or stopped paying wages'));
break;
case 'exempt_payment':
$retval = array(10 => TTi18n::getText('4a. Fringe benefits'), 20 => TTi18n::getText('4b. Group term life insurance'), 30 => TTi18n::getText('4c. Retirement/Pension'), 40 => TTi18n::getText('4d. Dependant care'), 50 => TTi18n::getText('4e. Other'));
//.........这里部分代码省略.........
示例14: Validate
function Validate()
{
Debug::text('Validating...', __FILE__, __LINE__, __METHOD__, 10);
//Call this here so getShiftData can get the correct total time, before we call findUserDate.
if ($this->getEnableCalcTotalTime() == TRUE) {
$this->calcTotalTime();
}
if (is_object($this->getPunchObject())) {
$this->findUserDate();
}
Debug::text('User Date Id: ' . $this->getUserDateID(), __FILE__, __LINE__, __METHOD__, 10);
if ($this->getUserDateObject() == FALSE or $this->getUserDateObject()->getPayPeriodObject() == FALSE) {
$this->Validator->isTRUE('pay_period', FALSE, TTi18n::gettext('Date/Time is incorrect, or pay period does not exist for this date. Please create a pay period schedule if you have not done so already'));
} elseif ($this->getUserDateObject() == FALSE or $this->getUserDateObject()->getPayPeriodObject()->getIsLocked() == TRUE) {
$this->Validator->isTRUE('pay_period', FALSE, TTi18n::gettext('Pay Period is Currently Locked'));
}
$plf = $this->getPLFByPunchControlID();
if ($plf !== NULL and ($this->isNew() and $plf->getRecordCount() == 2 or $plf->getRecordCount() > 2)) {
//TTi18n::gettext('Punch Control can not have more than two punches. Please use the Add Punch button instead')
//They might be trying to insert a punch inbetween two others?
$this->Validator->isTRUE('punch_control', FALSE, TTi18n::gettext('Time conflicts with another punch on this day (c)'));
}
//Skip these checks if they are deleting a punch.
if (is_object($this->getPunchObject()) and $this->getPunchObject()->getDeleted() == FALSE) {
$shift_data = $this->getShiftData();
if (is_array($shift_data)) {
foreach ($shift_data['punches'] as $punch_data) {
//Make sure there aren't two In punches, or two Out punches in the same pair.
//This fixes the bug where if you have an In punch, then click the blank cell below it
//to add a new punch, but change the status from Out to In instead.
if (isset($punches[$punch_data['punch_control_id']][$punch_data['status_id']])) {
if ($punch_data['status_id'] == 10) {
$this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('In punches cannot occur twice in the same punch pair, you may want to make this an out punch instead'));
} else {
$this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Out punches cannot occur twice in the same punch pair, you may want to make this an in punch instead'));
}
}
Debug::text(' Current Punch Object: ID: ' . $this->getPunchObject()->getId() . ' TimeStamp: ' . $this->getPunchObject()->getTimeStamp() . ' Status: ' . $this->getPunchObject()->getStatus(), __FILE__, __LINE__, __METHOD__, 10);
Debug::text(' Looping Punch Object: ID: ' . $punch_data['id'] . ' TimeStamp: ' . $punch_data['time_stamp'] . ' Status: ' . $punch_data['status_id'], __FILE__, __LINE__, __METHOD__, 10);
//Check for another punch that matches the timestamp and status.
if ($this->getPunchObject()->getID() != $punch_data['id']) {
if ($this->getPunchObject()->getTimeStamp() == $punch_data['time_stamp'] and $this->getPunchObject()->getStatus() == $punch_data['status_id']) {
$this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Time and status match that of another punch, this could be due to rounding (a)'));
}
}
//Check for another punch that matches the timestamp and NOT status in the SAME punch pair.
if ($this->getPunchObject()->getID() != $punch_data['id'] and $this->getID() == $punch_data['punch_control_id']) {
if ($this->getPunchObject()->getTimeStamp() == $punch_data['time_stamp'] and $this->getPunchObject()->getStatus() != $punch_data['status_id']) {
$this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Time matches another punch in the same punch pair, this could be due to rounding (b)'));
}
}
$punches[$punch_data['punch_control_id']][$punch_data['status_id']] = $punch_data;
}
unset($punch_data);
if (isset($punches[$this->getID()])) {
Debug::text('Current Punch ID Id: ' . $this->getPunchObject()->getId() . ' Punch Control ID: ' . $this->getID() . ' Status: ' . $this->getPunchObject()->getStatus(), __FILE__, __LINE__, __METHOD__, 10);
//Debug::Arr($punches, 'Punches Arr: ', __FILE__, __LINE__, __METHOD__,10);
if ($this->getPunchObject()->getStatus() == 10 and isset($punches[$this->getID()][20]) and $this->getPunchObject()->getTimeStamp() > $punches[$this->getID()][20]['time_stamp']) {
$this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('In punches cannot occur after an out punch, in the same punch pair'));
} elseif ($this->getPunchObject()->getStatus() == 20 and isset($punches[$this->getID()][10]) and $this->getPunchObject()->getTimeStamp() < $punches[$this->getID()][10]['time_stamp']) {
$this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Out punches cannot occur before an in punch, in the same punch pair'));
} else {
Debug::text('bPunch does not match any other punch pair.', __FILE__, __LINE__, __METHOD__, 10);
$punch_neighbors = Misc::getArrayNeighbors($punches, $this->getID(), 'both');
//Debug::Arr($punch_neighbors, ' Punch Neighbors: ', __FILE__, __LINE__, __METHOD__,10);
if (isset($punch_neighbors['next']) and isset($punches[$punch_neighbors['next']])) {
Debug::text('Found Next Punch...', __FILE__, __LINE__, __METHOD__, 10);
if (isset($punches[$punch_neighbors['next']][10]) and $this->getPunchObject()->getTimeStamp() > $punches[$punch_neighbors['next']][10]['time_stamp'] or isset($punches[$punch_neighbors['next']][20]) and $this->getPunchObject()->getTimeStamp() > $punches[$punch_neighbors['next']][20]['time_stamp']) {
$this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Time conflicts with another punch on this day') . ' (a)');
}
}
if (isset($punch_neighbors['prev']) and isset($punches[$punch_neighbors['prev']])) {
Debug::text('Found prev Punch...', __FILE__, __LINE__, __METHOD__, 10);
if (isset($punches[$punch_neighbors['prev']][10]) and $this->getPunchObject()->getTimeStamp() < $punches[$punch_neighbors['prev']][10]['time_stamp'] or isset($punches[$punch_neighbors['prev']][20]) and $this->getPunchObject()->getTimeStamp() < $punches[$punch_neighbors['prev']][20]['time_stamp']) {
$this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Time conflicts with another punch on this day') . ' (b)');
}
}
}
//Check to make sure punches don't exceed maximum shift time.
$maximum_shift_time = $plf->getPayPeriodMaximumShiftTime($this->getPunchObject()->getUser());
Debug::text('aaaMaximum shift time: ' . $maximum_shift_time, __FILE__, __LINE__, __METHOD__, 10);
if ($shift_data['total_time'] > $maximum_shift_time) {
$this->Validator->isTRUE('time_stamp', FALSE, TTi18n::gettext('Punch exceeds maximum shift time of') . ' ' . TTDate::getTimeUnit($maximum_shift_time) . ' ' . TTi18n::getText('hrs set for this pay period schedule'));
}
}
unset($punches);
}
}
if (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL and $this->getEnableStrictJobValidation() == TRUE) {
if ($this->getJob() > 0) {
$jlf = new JobListFactory();
$jlf->getById($this->getJob());
if ($jlf->getRecordCount() > 0) {
$j_obj = $jlf->getCurrent();
if (is_object($this->getUserDateObject()) and $j_obj->isAllowedUser($this->getUserDateObject()->getUser()) == FALSE) {
$this->Validator->isTRUE('job', FALSE, TTi18n::gettext('Employee is not assigned to this job'));
}
if ($j_obj->isAllowedItem($this->getJobItem()) == FALSE) {
$this->Validator->isTRUE('job_item', FALSE, TTi18n::gettext('Task is not assigned to this job'));
}
//.........这里部分代码省略.........
示例15: getAPISearchByCompanyIdAndArrayCriteria
/**
* Return user records based on advanced filter criteria.
*
* @param int $company_id Company ID
* @param array $filter_data Filter criteria in array('id' => array(1,2), 'last_name' => 'smith' ) format, with possible top level array keys as follows: id, exclude_id, status_id, user_group_id, default_branch_id, default_department_id, title_id, currency_id, permission_control_id, pay_period_schedule_id, policy_group_id, sex_id, first_name, last_name, home_phone, work_phone, country, province, city, address1, address2, postal_code, employee_number, user_name, sin, work_email, home_email, tag, last_login_date, created_by, created_date, updated_by, updated_date
* @param int $limit Optional. Restrict the number of records returned
* @param int $page Optional. Specify the page of records to return
* @param array $where Optional. Additional WHERE clauses in array( 'column' => 'value', 'column' => 'value' ) format.
* @param array $order Optional. Sort order in array( 'column' => ASC, 'column2' => DESC ) format.
*
* @return object $this
*/
function getAPISearchByCompanyIdAndArrayCriteria($company_id, $filter_data, $limit = NULL, $page = NULL, $where = NULL, $order = NULL)
{
if ($company_id == '') {
return FALSE;
}
if (!is_array($order)) {
//Use Filter Data ordering if its set.
if (isset($filter_data['sort_column']) and $filter_data['sort_order']) {
$order = array(Misc::trimSortPrefix($filter_data['sort_column']) => $filter_data['sort_order']);
}
}
if (isset($filter_data['user_status_id'])) {
$filter_data['status_id'] = $filter_data['user_status_id'];
}
if (isset($filter_data['include_user_id'])) {
$filter_data['id'] = $filter_data['include_user_id'];
}
if (isset($filter_data['exclude_user_id'])) {
$filter_data['exclude_id'] = $filter_data['exclude_user_id'];
}
//Some of these are passed from Flex Schedule view.
if (isset($filter_data['default_branch_ids'])) {
$filter_data['default_branch_id'] = $filter_data['default_branch_ids'];
}
if (isset($filter_data['default_department_ids'])) {
$filter_data['default_department_id'] = $filter_data['default_department_ids'];
}
if (isset($filter_data['group_id'])) {
$filter_data['user_group_id'] = $filter_data['group_id'];
}
if (isset($filter_data['user_title_id'])) {
$filter_data['title_id'] = $filter_data['user_title_id'];
}
if (isset($filter_data['user_tag'])) {
$filter_data['tag'] = $filter_data['user_tag'];
}
//$additional_order_fields = array('b.name', 'c.name', 'd.name', 'e.name');
$additional_order_fields = array('default_branch', 'default_department', 'default_job', 'default_job_item', 'sex', 'user_group', 'title', 'currency', 'permission_control', 'pay_period_schedule', 'policy_group');
$sort_column_aliases = array('type' => 'type_id', 'status' => 'status_id', 'sex' => 'sex_id', 'full_name' => 'last_name');
$order = $this->getColumnsFromAliases($order, $sort_column_aliases);
if ($order == NULL) {
$order = array('status_id' => 'asc', 'last_name' => 'asc', 'first_name' => 'asc', 'middle_name' => 'asc');
$strict = FALSE;
} else {
//Do order by column conversions, because if we include these columns in the SQL
//query, they contaminate the data array.
//Always try to order by status first so INACTIVE employees go to the bottom.
if (!isset($order['status_id'])) {
$order = Misc::prependArray(array('status_id' => 'asc'), $order);
}
//Always sort by last name,first name after other columns
if (!isset($order['last_name'])) {
$order['last_name'] = 'asc';
}
if (!isset($order['first_name'])) {
$order['first_name'] = 'asc';
}
$strict = TRUE;
}
//Debug::Arr($order,'Order Data:', __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($filter_data,'Filter Data:', __FILE__, __LINE__, __METHOD__,10);
$compf = new CompanyFactory();
$bf = new BranchFactory();
$df = new DepartmentFactory();
$ugf = new UserGroupFactory();
$utf = new UserTitleFactory();
$cf = new CurrencyFactory();
$pcf = new PermissionControlFactory();
$puf = new PermissionUserFactory();
$ppsuf = new PayPeriodScheduleUserFactory();
$ppsf = new PayPeriodScheduleFactory();
$pguf = new PolicyGroupUserFactory();
$pgf = new PolicyGroupFactory();
$egf = new EthnicGroupFactory();
if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
$jf = new JobFactory();
$jif = new JobItemFactory();
}
$ph = array('company_id' => $company_id);
$query = '
select
a.*,
compf.name as company,
b.name as default_branch,
c.name as default_department,
d.name as user_group,
e.name as title,
f.name as currency,
//.........这里部分代码省略.........