Exemplo n.º 1
0
 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'action':
             $retval = array(10 => TTi18n::gettext('Add'), 20 => TTi18n::gettext('Edit'), 30 => TTi18n::gettext('Delete'), 31 => TTi18n::gettext('Delete (F)'), 40 => TTi18n::gettext('UnDelete'), 100 => TTi18n::gettext('Login'), 110 => TTi18n::gettext('Logout'), 200 => TTi18n::gettext('Allow'), 210 => TTi18n::gettext('Deny'), 500 => TTi18n::gettext('Notice'), 510 => TTi18n::gettext('Warning'), 900 => TTi18n::gettext('Other'));
             break;
         case 'table_name':
             $retval = array('authentication' => TTi18n::getText('Authentication'), 'company' => TTi18n::getText('Company'), 'branch' => TTi18n::getText('Branch'), 'department' => TTi18n::getText('Department'), 'currency' => TTi18n::getText('Currency'), 'accrual' => TTi18n::getText('Accrual'), 'authorizations' => TTi18n::getText('Authorizations'), 'request' => TTi18n::getText('Request'), 'message' => TTi18n::getText('Messages'), 'message_control' => TTi18n::getText('Messages'), 'holidays' => TTi18n::getText('Holidays'), 'bank_account' => TTi18n::getText('Bank Account'), 'roe' => TTi18n::getText('Record of Employment'), 'station' => TTi18n::getText('Station'), 'station_user_group' => TTi18n::getText('Station Employee Group'), 'station_branch' => TTi18n::getText('Station Branch'), 'station_department' => TTi18n::getText('Station Department'), 'station_include_user' => TTi18n::getText('Station Include Employee'), 'station_exclude_user' => TTi18n::getText('Station Exclude Employee'), 'station' => TTi18n::getText('Station'), 'punch' => TTi18n::getText('Punch'), 'punch_control' => TTi18n::getText('Punch Control'), 'exception' => TTi18n::getText('Exceptions'), 'schedule' => TTi18n::getText('Schedule'), 'other_field' => TTi18n::getText('Other Field'), 'system_setting' => TTi18n::getText('System Setting'), 'cron' => TTi18n::getText('Maintenance Jobs'), 'permission_control' => TTi18n::getText('Permission Groups'), 'permission_user' => TTi18n::getText('Permission Employees'), 'permission' => TTi18n::getText('Permissions'), 'policy_group' => TTi18n::getText('Policy Group'), 'policy_group_user' => TTi18n::getText('Policy Group Employees'), 'schedule_policy' => TTi18n::getText('Schedule Policy'), 'round_interval_policy' => TTi18n::getText('Rounding Policy'), 'meal_policy' => TTi18n::getText('Meal Policy'), 'break_policy' => TTi18n::getText('Break Policy'), 'accrual_policy' => TTi18n::getText('Accrual Policy'), 'accrual_policy_milestone' => TTi18n::getText('Accrual Policy Milestone'), 'over_time_policy' => TTi18n::getText('Overtime Policy'), 'premium_policy' => TTi18n::getText('Premium Policy'), 'premium_policy_branch' => TTi18n::getText('Premium Policy Branch'), 'premium_policy_department' => TTi18n::getText('Premium Policy Department'), 'premium_policy_job_group' => TTi18n::getText('Premium Policy Job Group'), 'premium_policy_job' => TTi18n::getText('Premium Policy Job'), 'premium_policy_job_item_group' => TTi18n::getText('Premium Policy Task Group'), 'premium_policy_job_item' => TTi18n::getText('Premium Policy Task'), 'absence_policy' => TTi18n::getText('Absense Policy'), 'exception_policy_control' => TTi18n::getText('Exception Policy (Control)'), 'exception_policy' => TTi18n::getText('Exception Policy'), 'holiday_policy' => TTi18n::getText('Holiday Policy'), 'holiday_policy_recurring_holiday' => TTi18n::getText('Holiday Policy'), 'pay_period' => TTi18n::getText('Pay Period'), 'pay_period_schedule' => TTi18n::getText('Pay Period Schedule'), 'pay_period_schedule_user' => TTi18n::getText('Pay Period Schedule Employees'), 'pay_period_time_sheet_verify' => TTi18n::getText('TimeSheet Verify'), 'pay_stub' => TTi18n::getText('Pay Stub'), 'pay_stub_amendment' => TTi18n::getText('Pay Stub Amendment'), 'pay_stub_entry_account' => TTi18n::getText('Pay Stub Account'), 'pay_stub_entry_account_link' => TTi18n::getText('Pay Stub Account Linking'), 'recurring_holiday' => TTi18n::getText('Recurring Holiday'), 'recurring_ps_amendment' => TTi18n::getText('Recurring PS Amendment'), 'recurring_ps_amendment_user' => TTi18n::getText('Recurring PS Amendment Employees'), 'recurring_schedule_control' => TTi18n::getText('Recurring Schedule'), 'recurring_schedule_user' => TTi18n::getText('Recurring Schedule Employees'), 'recurring_schedule_template_control' => TTi18n::getText('Recurring Schedule Template'), 'recurring_schedule_template' => TTi18n::getText('Recurring Schedule Week'), 'user_date_total' => TTi18n::getText('Employee Hours'), 'user_default' => TTi18n::getText('New Hire Defaults'), 'user_generic_data' => TTi18n::getText('Employee Generic Data'), 'user_preference' => TTi18n::getText('Employee Preference'), 'users' => TTi18n::getText('Employee'), 'user_identification' => TTi18n::getText('Employee Identification'), 'company_deduction' => TTi18n::getText('Tax / Deduction'), 'company_deduction_pay_stub_entry_account' => TTi18n::getText('Tax / Deduction PS Accounts'), 'user_deduction' => TTi18n::getText('Employee Deduction'), 'user_title' => TTi18n::getText('Employee Title'), 'user_wage' => TTi18n::getText('Employee Wage'), 'hierarchy_control' => TTi18n::getText('Hierarchy'), 'hierarchy_object_type' => TTi18n::getText('Hierarchy Object Type'), 'hierarchy_user' => TTi18n::getText('Hierarchy Subordinate'), 'hierarchy_level' => TTi18n::getText('Hierarchy Superior'), 'hierarchy' => TTi18n::getText('Hierarchy Tree'), 'user_report_data' => TTi18n::getText('Reports'), 'report_schedule' => TTi18n::getText('Report Schedule'), 'report_custom_column' => TTi18n::getText('Report Custom Column'), 'job' => TTi18n::getText('Job'), 'job_user_branch' => TTi18n::getText('Job Branch'), 'job_user_department' => TTi18n::getText('Job Department'), 'job_user_group' => TTi18n::getText('Job Group'), 'job_include_user' => TTi18n::getText('Job Include Employee'), 'job_exclude_user' => TTi18n::getText('Job Exclude Employee'), 'job_job_item_group' => TTi18n::getText('Job Task Group'), 'job_include_job_item' => TTi18n::getText('Job Include Task'), 'job_exclude_job_item' => TTi18n::getText('Job Exclude Task'), 'job_item' => TTi18n::getText('Job Task'), 'job_item_amendment' => TTi18n::getText('Job Task Amendment'), 'document' => TTi18n::getText('Document'), 'document_revision' => TTi18n::getText('Document Revision'), 'client' => TTi18n::getText('Client'), 'client_contact' => TTi18n::getText('Client Contact'), 'client_payment' => TTi18n::getText('Client Payment'), 'invoice' => TTi18n::getText('Invoice'), 'invoice_config' => TTi18n::getText('Invoice Settings'), 'invoice_transaction' => TTi18n::getText('Invoice Transaction'), 'product' => TTi18n::getText('Product'), 'product_price' => TTi18n::getText('Product Price Bracket'), 'product_tax_policy' => TTi18n::getText('Product Tax Policy'), 'tax_area_policy' => TTi18n::getText('Invoice Tax Area Policy'), 'tax_policy' => TTi18n::getText('Invoice Tax Policy'), 'transaction' => TTi18n::getText('Invoice Transaction'), 'user_contact' => TTi18n::getText('Employee Contact'), 'user_expense' => TTi18n::getText('Expense'), 'expense_policy' => TTi18n::getText('Expense Policy'), 'user_review' => TTi18n::getText('Review'), 'user_review_control' => TTi18n::getText('Review (Control)'), 'kpi' => TTi18n::getText('Key Performance Indicator'), 'qualification' => TTi18n::getText('Qualification'), 'user_skill' => TTi18n::getText('Skill'), 'user_education' => TTi18n::getText('Education'), 'user_membership' => TTi18n::getText('Memberships'), 'user_license' => TTi18n::getText('Licenses'), 'user_language' => TTi18n::getText('Languages'), 'job_vacancy' => TTi18n::getText('Job Vacancy'), 'job_applicant' => TTi18n::getText('Job Applicant'), 'job_application' => TTi18n::getText('Job Application'), 'job_applicant_location' => TTi18n::getText('Job Applicant Location'), 'job_applicant_employment' => TTi18n::getText('Job Applicant Employment'), 'job_applicant_reference' => TTi18n::getText('Job Applicant Reference'), 'job_applicant_skill' => TTi18n::getText('Job Applicant Skill'), 'job_applicant_education' => TTi18n::getText('Job Applicant Education'), 'job_applicant_license' => TTi18n::getText('Job Applicant Licenses'), 'job_applicant_language' => TTi18n::getText('Job Applicant Languages'), 'job_applicant_membership' => TTi18n::getText('Job Applicant Memberships'), 'ethnic_group' => TTi18n::getText('Ethnic Group'));
             break;
         case 'columns':
             $retval = array('-1010-first_name' => TTi18n::gettext('First Name'), '-1020-last_name' => TTi18n::gettext('Last Name'), '-1100-date' => TTi18n::gettext('Date'), '-1110-object' => TTi18n::gettext('Object'), '-1120-action' => TTi18n::gettext('Action'), '-1130-description' => TTi18n::gettext('Description'));
             break;
         case 'list_columns':
             $retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
             break;
         case 'default_display_columns':
             //Columns that are displayed by default.
             $retval = array('first_name', 'last_name', 'date', 'object', 'action', 'description');
             break;
         case 'unique_columns':
             //Columns that are unique, and disabled for mass editing.
             $retval = array();
             break;
         case 'linked_columns':
             //Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
             $retval = array();
             break;
     }
     return $retval;
 }
Exemplo n.º 2
0
 static function getOptions($name, $interval = 1)
 {
     $all_array_option = array('*' => TTi18n::getText('-- All --'));
     $retval = FALSE;
     switch ($name) {
         case 'minute':
             for ($i = 0; $i <= 59; $i += $interval) {
                 $retval[$i] = $i;
             }
             $retval = Misc::prependArray($all_array_option, $retval);
             break;
         case 'hour':
             for ($i = 0; $i <= 23; $i += $interval) {
                 $retval[$i] = $i;
             }
             $retval = Misc::prependArray($all_array_option, $retval);
             break;
         case 'day_of_month':
             $retval = Misc::prependArray($all_array_option, TTDate::getDayOfMonthArray());
             break;
         case 'month':
             $retval = Misc::prependArray($all_array_option, TTDate::getMonthOfYearArray());
             break;
         case 'day_of_week':
             $retval = Misc::prependArray($all_array_option, TTDate::getDayOfWeekArray());
             break;
     }
     return $retval;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 function returnFileValidationError()
 {
     //Make sure we return a complete validation error to be displayed to the user.
     $validator_obj = new Validator();
     $validator_stats = array('total_records' => 1, 'valid_records' => 0);
     $validator_obj->isTrue('file', FALSE, TTi18n::getText('Please upload file again'));
     $validator[0] = $validator_obj->getErrorsArray();
     return $this->returnHandler(FALSE, 'IMPORT_FILE', TTi18n::getText('INVALID DATA'), $validator, $validator_stats);
 }
Exemplo n.º 5
0
 function notAuthenticatedInvokeService($serviceName, $methodName, $arguments, $extras = NULL)
 {
     Debug::text('Service: ' . $serviceName . ' Method: ' . $methodName, __FILE__, __LINE__, __METHOD__, 10);
     //Allow core.APIEnvironment calls in this state, otherwise Flex can't set the proper URLs.
     if (in_array($serviceName, array('APIAuthentication', 'core.APIEnvironment'))) {
         return $this->invokeService($serviceName, $methodName, $arguments);
     } else {
         $obj = new APIAuthentication();
         return $obj->returnHandler(FALSE, 'NOT_AUTHENTICATED', TTi18n::getText('Session timed out, please login again.'));
     }
 }
Exemplo n.º 6
0
 function _getFactoryOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'action':
             $retval = array(10 => TTi18n::gettext('Add'), 20 => TTi18n::gettext('Edit'), 30 => TTi18n::gettext('Delete'), 40 => TTi18n::gettext('UnDelete'), 100 => TTi18n::gettext('Login'), 110 => TTi18n::gettext('Logout'), 200 => TTi18n::gettext('Allow'), 210 => TTi18n::gettext('Deny'), 500 => TTi18n::gettext('Notice'), 510 => TTi18n::gettext('Warning'), 900 => TTi18n::gettext('Other'));
             break;
         case 'table_name':
             $retval = array('authentication' => TTi18n::getText('Authentication'), 'company' => TTi18n::getText('Company'), 'branch' => TTi18n::getText('Branch'), 'department' => TTi18n::getText('Department'), 'currency' => TTi18n::getText('Currency'), 'accrual' => TTi18n::getText('Accrual'), 'authorizations' => TTi18n::getText('Authorizations'), 'request' => TTi18n::getText('Request'), 'holidays' => TTi18n::getText('Holidays'), 'bank_account' => TTi18n::getText('Bank Account'), 'roe' => TTi18n::getText('Record of Employment'), 'station' => TTi18n::getText('Station'), 'punch' => TTi18n::getText('Punch'), 'schedule' => TTi18n::getText('Schedule'), 'other_field' => TTi18n::getText('Other Field'), 'system_setting' => TTi18n::getText('System Setting'), 'cron' => TTi18n::getText('Maintenance Jobs'), 'permission_control' => TTi18n::getText('Permission Groups'), 'policy_group' => TTi18n::getText('Policy Group'), 'schedule_policy' => TTi18n::getText('Schedule Policy'), 'round_interval_policy' => TTi18n::getText('Rounding Policy'), 'meal_policy' => TTi18n::getText('Meal Policy'), 'accrual_policy' => TTi18n::getText('Accrual Policy'), 'over_time_policy' => TTi18n::getText('Overtime Policy'), 'premium_policy' => TTi18n::getText('Premium Policy'), 'absence_policy' => TTi18n::getText('Absense Policy'), 'exception_policy_control' => TTi18n::getText('Exception Policy'), 'holiday_policy' => TTi18n::getText('Holiday Policy'), 'pay_period' => TTi18n::getText('Pay Period'), 'pay_period_schedule' => TTi18n::getText('Pay Period Schedule'), 'pay_period_time_sheet_verify' => TTi18n::getText('TimeSheet Verify'), 'pay_stub' => TTi18n::getText('Pay Stub'), 'pay_stub_amendment' => TTi18n::getText('Pay Stub Amendment'), 'pay_stub_entry_account' => TTi18n::getText('Pay Stub Account'), 'pay_stub_entry_account_link' => TTi18n::getText('Pay Stub Account Linking'), 'recurring_holiday' => TTi18n::getText('Recurring Holiday'), 'recurring_ps_amendment' => TTi18n::getText('Recurring PS Amendment'), 'recurring_schedule_control' => TTi18n::getText('Recurring Schedule'), 'recurring_schedule_template_control' => TTi18n::getText('Recurring Schedule Template'), 'user_date_total' => TTi18n::getText('Employee Hours'), 'user_default' => TTi18n::getText('New Hire Defaults'), 'user_generic_data' => TTi18n::getText('Employee Generic Data'), 'user_preference' => TTi18n::getText('Employee Preference'), 'users' => TTi18n::getText('Employee'), 'company_deduction' => TTi18n::getText('Company Deduction'), 'user_deduction' => TTi18n::getText('Employee Deduction'), 'user_title' => TTi18n::getText('Employee Title'), 'user_wage' => TTi18n::getText('Employee Wage'), 'hierarchy_control' => TTi18n::getText('Hierarchy'), 'hierarchy' => TTi18n::getText('Hierarchy Tree'), 'job' => TTi18n::getText('Job'), 'job_item' => TTi18n::getText('Job Task'), 'job_item_amendment' => TTi18n::getText('Job Task Amendment'), 'document' => TTi18n::getText('Document'), 'document_revision' => TTi18n::getText('Document Revision'), 'client' => TTi18n::getText('Client'), 'client_contact' => TTi18n::getText('Client Contact'), 'client_payment' => TTi18n::getText('Client Payment'), 'invoice' => TTi18n::getText('Invoice'), 'invoice_config' => TTi18n::getText('Invoice Settings'), 'invoice_transaction' => TTi18n::getText('Invoice Transaction'), 'product' => TTi18n::getText('Product'), 'product_tax_policy' => TTi18n::getText('Product Tax Policy'), 'tax_area_policy' => TTi18n::getText('Invoice Tax Area Policy'), 'tax_policy' => TTi18n::getText('Invoice Tax Policy'), 'transaction' => TTi18n::getText('Invoice Transaction'));
             break;
     }
     return $retval;
 }
Exemplo n.º 7
0
 function getOptions($name)
 {
     $retval = NULL;
     switch ($name) {
         case 'status':
             $retval = array('-1010-O' => TTi18n::getText('Original'), '-1020-A' => TTi18n::getText('Amended'), '-1030-C' => TTi18n::getText('Cancel'));
             break;
         case 'type':
             $retval = array('government' => TTi18n::gettext('Government (Multiple Employees/Page)'), 'employee' => TTi18n::gettext('Employee (One Employee/Page)'));
             break;
     }
     return $retval;
 }
Exemplo n.º 8
0
 function createPresets($data)
 {
     if (!$this->getPermissionObject()->Check('pay_period_schedule', 'enabled') or !($this->getPermissionObject()->Check('pay_period_schedule', 'edit') or $this->getPermissionObject()->Check('pay_period_schedule', 'edit_own') or $this->getPermissionObject()->Check('pay_period_schedule', 'edit_child') or $this->getPermissionObject()->Check('pay_period_schedule', 'add'))) {
         return $this->getPermissionObject()->PermissionDenied();
     }
     if (is_array($data)) {
         $this->getProgressBarObject()->start($this->getAMFMessageID(), count($data) + 1, NULL, TTi18n::getText('Creating policies...'));
         $this->getMainClassObject()->setCompany($this->getCurrentCompanyObject()->getId());
         $this->getMainClassObject()->setUser($this->getCurrentUserObject()->getId());
         $this->getMainClassObject()->createPresets();
         $already_processed_country = array();
         $i = 1;
         foreach ($data as $location) {
             if (isset($location['country']) and isset($location['province'])) {
                 if ($location['province'] == '00') {
                     $location['province'] = NULL;
                 }
                 if (!in_array($location['country'], $already_processed_country)) {
                     $this->getMainClassObject()->createPresets($location['country']);
                 }
                 $this->getMainClassObject()->createPresets($location['country'], $location['province']);
                 Debug::text('Creating presets for Country: ' . $location['country'] . ' Province: ' . $location['province'], __FILE__, __LINE__, __METHOD__, 9);
                 $already_processed_country[] = $location['country'];
             }
             $this->getProgressBarObject()->set($this->getAMFMessageID(), $i);
             $i++;
         }
         $this->getProgressBarObject()->set($this->getAMFMessageID(), $i++, TTi18n::getText('Creating Permissions...'));
         $this->getMainClassObject()->Permissions();
         $this->getMainClassObject()->UserDefaults();
         //Assign the current user to the only existing pay period schedule.
         $ppslf = TTnew('PayPeriodScheduleListFactory');
         $ppslf->getByCompanyId($this->getCurrentCompanyObject()->getId());
         if ($ppslf->getRecordCount() == 1) {
             $pps_obj = $ppslf->getCurrent();
             $pps_obj->setUser($this->getCurrentUserObject()->getId());
             Debug::text('Assigning current user to pay period schedule: ' . $pps_obj->getID(), __FILE__, __LINE__, __METHOD__, 9);
             if ($pps_obj->isValid()) {
                 $pps_obj->Save();
             }
         }
         $this->getCurrentCompanyObject()->setSetupComplete(TRUE);
         if ($this->getCurrentCompanyObject()->isValid()) {
             $this->getCurrentCompanyObject()->Save();
         }
         $this->getProgressBarObject()->stop($this->getAMFMessageID());
     }
     return TRUE;
 }
Exemplo n.º 9
0
 function _getFactoryOptions($name, $parent = NULL)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $bf = TTNew('DepartmentFactory');
             $retval = $bf->getOptions('columns');
             break;
         case 'import_options':
             $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'));
             break;
         case 'parse_hint':
             $retval = array();
             break;
     }
     return $retval;
 }
Exemplo n.º 10
0
 function _getFactoryOptions($name, $parent = NULL)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $baf = TTNew('BankAccountFactory');
             $retval = Misc::prependArray($this->getUserIdentificationColumns(), Misc::arrayIntersectByKey(array('transit', 'institution', 'account'), Misc::trimSortPrefix($baf->getOptions('columns'))));
             break;
         case 'column_aliases':
             //Used for converting column names after they have been parsed.
             $retval = array();
             break;
         case 'import_options':
             $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'));
             break;
         case 'parse_hint':
         case 'parse_hint':
             //$upf = TTnew('UserPreferenceFactory');
             $retval = array();
             break;
     }
     return $retval;
 }
Exemplo n.º 11
0
 function _getFactoryOptions($name, $parent = NULL)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $ppf = TTNew('PayPeriodFactory');
             $retval = Misc::arrayIntersectByKey(array('pay_period_schedule_id', 'start_date', 'end_date', 'transaction_date'), Misc::trimSortPrefix($ppf->getOptions('columns')));
             break;
         case 'column_aliases':
             //Used for converting column names after they have been parsed.
             $retval = array('pay_period_schedule' => 'pay_period_schedule_id');
             break;
         case 'import_options':
             $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'));
             break;
         case 'parse_hint':
         case 'parse_hint':
             $upf = TTnew('UserPreferenceFactory');
             $retval = array('start_date' => $upf->getOptions('date_format'), 'end_date' => $upf->getOptions('date_format'), 'transaction_date' => $upf->getOptions('date_format'));
             break;
     }
     return $retval;
 }
 function _getFactoryOptions($name, $parent = NULL)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $psaf = TTNew('PayStubAmendmentFactory');
             $retval = Misc::prependArray($this->getUserIdentificationColumns(), Misc::arrayIntersectByKey(array('status', 'type', 'pay_stub_entry_name', 'effective_date', 'amount', 'rate', 'units', 'description', 'ytd_adjustment'), Misc::trimSortPrefix($psaf->getOptions('columns'))));
             break;
         case 'column_aliases':
             //Used for converting column names after they have been parsed.
             $retval = array('status' => 'status_id', 'type' => 'type_id', 'pay_stub_entry_name' => 'pay_stub_entry_name_id');
             break;
         case 'import_options':
             $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'));
             break;
         case 'parse_hint':
         case 'parse_hint':
             $upf = TTnew('UserPreferenceFactory');
             $retval = array('effective_date' => $upf->getOptions('date_format'));
             break;
     }
     return $retval;
 }
Exemplo n.º 13
0
 function _getFactoryOptions($name, $parent = NULL)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $apf = TTNew('AccrualFactory');
             $retval = Misc::prependArray($this->getUserIdentificationColumns(), Misc::arrayIntersectByKey(array('accrual_policy', 'type', 'amount', 'date_stamp'), Misc::trimSortPrefix($apf->getOptions('columns'))));
             break;
         case 'column_aliases':
             //Used for converting column names after they have been parsed.
             $retval = array('type' => 'type_id', 'accrual_policy' => 'accrual_policy_id');
             break;
         case 'import_options':
             $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'));
             break;
         case 'parse_hint':
         case 'parse_hint':
             $upf = TTnew('UserPreferenceFactory');
             $retval = array('date_stamp' => $upf->getOptions('date_format'), 'amount' => $upf->getOptions('time_unit_format'));
             break;
     }
     return $retval;
 }
Exemplo n.º 14
0
 function _getFactoryOptions($name, $parent = NULL)
 {
     $retval = NULL;
     switch ($name) {
         case 'columns':
             $uwf = TTNew('UserWageFactory');
             $retval = Misc::prependArray($this->getUserIdentificationColumns(), Misc::arrayIntersectByKey(array('wage_group', 'type', 'wage', 'effective_date', 'hourly_rate', 'labor_burden_percent', 'weekly_time', 'note'), Misc::trimSortPrefix($uwf->getOptions('columns'))));
             break;
         case 'column_aliases':
             //Used for converting column names after they have been parsed.
             $retval = array('type' => 'type_id', 'wage_group' => 'wage_group_id');
             break;
         case 'import_options':
             $retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'));
             break;
         case 'parse_hint':
         case 'parse_hint':
             $upf = TTnew('UserPreferenceFactory');
             $retval = array('effective_date' => $upf->getOptions('date_format'), 'weekly_time' => $upf->getOptions('time_unit_format'));
             break;
     }
     return $retval;
 }
 function addLog($log_action)
 {
     return TTLog::addEntry($this->getId(), $log_action, TTi18n::getText('Company Deduction'), NULL, $this->getTable());
 }
Exemplo n.º 16
0
 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;
 }
Exemplo n.º 17
0
$action = Misc::findSubmitButton();
$action = strtolower($action);
switch ($action) {
    case 'submit':
        //Debug::setVerbosity(11);
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $fail_transaction = FALSE;
        if (TTDate::getDayDifference($data['start_date_stamp'], $data['end_date_stamp']) > 31) {
            Debug::Text('Date Range Exceeds 31 days, truncating', __FILE__, __LINE__, __METHOD__, 10);
            $sf->Validator->isTrue('date_stamp', FALSE, TTi18n::getText('Date range exceeds the maximum of 31 days'));
        }
        if (!(isset($filter_user_id) and is_array($filter_user_id) and count($filter_user_id) > 0)) {
            $sf->Validator->isTrue('user_id', FALSE, TTi18n::getText('Please select at least one employee'));
        }
        if (!($data['start_full_time_stamp'] != '' and $data['end_full_time_stamp'] != '' and $data['start_full_time_stamp'] >= time() - 86400 * 365 and $data['end_full_time_stamp'] <= time() + 86400 * 365)) {
            $sf->Validator->isTrue('date_stamp', FALSE, TTi18n::getText('Start or End dates are invalid'));
        }
        if ($sf->Validator->isValid()) {
            Redirect::Page(URLBuilder::getURL(array('action' => 'add_mass_schedule', 'filter_user_id' => $filter_user_id, 'data' => $data), '../progress_bar/ProgressBarControl.php'));
        }
    default:
        if ($action != 'submit' and !is_array($data)) {
            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
 function addLog($log_action)
 {
     return TTLog::addEntry($this->getId(), $log_action, TTi18n::getText('Employee Identification - Employee: ' . $this->getUser() . ' Type: ' . $this->getType()), NULL, $this->getTable());
 }
Exemplo n.º 19
0
    function getAPILastWageSearchByCompanyIdAndArrayCriteria($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['effective_date'])) {
            $filter_data['effective_date'] = TTDate::getTime();
        }
        if (isset($filter_data['include_user_id'])) {
            $filter_data['user_id'] = $filter_data['include_user_id'];
        }
        if (isset($filter_data['exclude_user_id'])) {
            $filter_data['exclude_id'] = $filter_data['exclude_user_id'];
        }
        $additional_order_fields = array('wage_group');
        if ($order == NULL) {
            $order = array('effective_date' => 'desc', 'wage_group_id' => 'asc', 'type_id' => 'asc');
            $strict = FALSE;
        } else {
            //Always sort by last name,first name after other columns
            if (!isset($order['effective_date'])) {
                $order['effective_date'] = 'desc';
            }
            $strict = TRUE;
        }
        //Debug::Arr($order,'Order Data:', __FILE__, __LINE__, __METHOD__,10);
        //Debug::Arr($filter_data,'Filter Data:', __FILE__, __LINE__, __METHOD__,10);
        $uf = new UserFactory();
        $bf = new BranchFactory();
        $df = new DepartmentFactory();
        $ugf = new UserGroupFactory();
        $utf = new UserTitleFactory();
        $cf = new CurrencyFactory();
        $wgf = new WageGroupFactory();
        $ph = array('effective_date' => $this->db->BindTimeStamp($filter_data['effective_date']), 'company_id' => $company_id);
        /*
        		$query = '
        					select a.*
        					from '. $this->getTable() .' as a,
        						(
        						select 	z.user_id, max(effective_date) as effective_date
        						from	'. $this->getTable() .' as z
        						where
        							z.effective_date <= ?
        							AND z.wage_group_id = 0
        							AND z.user_id in ('. $this->getListSQL( $user_id, $ph ) .')
        							AND ( z.deleted = 0 )
        						GROUP BY z.user_id
        						) as b,
        						'. $uf->getTable() .' as c
        					WHERE a.user_id = b.user_id
        						AND a.effective_date = b.effective_date
        						AND a.user_id = c.id
        						AND ( c.deleted = 0	AND a.deleted = 0)
        				';
        */
        $query = '
					select 	a.*,
							CASE WHEN a.wage_group_id = 0 THEN \'' . TTi18n::getText('-Default-') . '\' ELSE ab.name END as wage_group,
							b.first_name as first_name,
							b.last_name as last_name,
							b.country as country,
							b.province as province,

							c.id as default_branch_id,
							c.name as default_branch,
							d.id as default_department_id,
							d.name as default_department,
							e.id as group_id,
							e.name as user_group,
							f.id as title_id,
							f.name as title,
							g.id as currency_id,
							g.iso_code as iso_code,

							y.first_name as created_by_first_name,
							y.middle_name as created_by_middle_name,
							y.last_name as created_by_last_name,
							z.first_name as updated_by_first_name,
							z.middle_name as updated_by_middle_name,
							z.last_name as updated_by_last_name
					from 	(
								select 	uwf.user_id as user_id, uwf.wage_group_id as wage_group_id, max(effective_date) as effective_date
								from	' . $this->getTable() . ' as uwf
								where uwf.effective_date <= ? AND uwf.deleted = 0
								GROUP BY uwf.wage_group_id, uwf.user_id
							) as uwf_b

						LEFT JOIN ' . $this->getTable() . ' as a ON ( a.user_id = uwf_b.user_id AND a.wage_group_id = uwf_b.wage_group_id AND a.effective_date = uwf_b.effective_date )

						LEFT JOIN ' . $wgf->getTable() . ' as ab ON ( a.wage_group_id = ab.id AND ab.deleted = 0 )
						LEFT JOIN ' . $uf->getTable() . ' as b ON ( a.user_id = b.id AND b.deleted = 0 )

						LEFT JOIN ' . $bf->getTable() . ' as c ON ( b.default_branch_id = c.id AND c.deleted = 0)
						LEFT JOIN ' . $df->getTable() . ' as d ON ( b.default_department_id = d.id AND d.deleted = 0)
						LEFT JOIN ' . $ugf->getTable() . ' as e ON ( b.group_id = e.id AND e.deleted = 0 )
						LEFT JOIN ' . $utf->getTable() . ' as f ON ( b.title_id = f.id AND f.deleted = 0 )
						LEFT JOIN ' . $cf->getTable() . ' as g ON ( b.currency_id = g.id AND g.deleted = 0 )


						LEFT JOIN ' . $uf->getTable() . ' as y ON ( a.created_by = y.id AND y.deleted = 0 )
						LEFT JOIN ' . $uf->getTable() . ' as z ON ( a.updated_by = z.id AND z.deleted = 0 )
					where	b.company_id = ?
					';
        if (isset($filter_data['permission_children_ids']) and isset($filter_data['permission_children_ids'][0]) and !in_array(-1, (array) $filter_data['permission_children_ids'])) {
            $query .= ' AND a.user_id in (' . $this->getListSQL($filter_data['permission_children_ids'], $ph) . ') ';
        }
        if (isset($filter_data['id']) and isset($filter_data['id'][0]) and !in_array(-1, (array) $filter_data['id'])) {
            $query .= ' AND a.id in (' . $this->getListSQL($filter_data['id'], $ph) . ') ';
        }
        if (isset($filter_data['exclude_id']) and isset($filter_data['exclude_id'][0]) and !in_array(-1, (array) $filter_data['exclude_id'])) {
            $query .= ' AND a.id not in (' . $this->getListSQL($filter_data['exclude_id'], $ph) . ') ';
        }
        if (isset($filter_data['user_id']) and isset($filter_data['user_id'][0]) and !in_array(-1, (array) $filter_data['user_id'])) {
            $query .= ' AND a.user_id in (' . $this->getListSQL($filter_data['user_id'], $ph) . ') ';
        }
        if (isset($filter_data['type_id']) and isset($filter_data['type_id'][0]) and !in_array(-1, (array) $filter_data['type_id'])) {
            $query .= ' AND a.type_id in (' . $this->getListSQL($filter_data['type_id'], $ph) . ') ';
        }
        if (isset($filter_data['wage_group_id']) and isset($filter_data['wage_group_id'][0]) and !in_array(-1, (array) $filter_data['wage_group_id'])) {
            $query .= ' AND a.wage_group_id in (' . $this->getListSQL($filter_data['wage_group_id'], $ph) . ') ';
        }
        if (isset($filter_data['status_id']) and isset($filter_data['status_id'][0]) and !in_array(-1, (array) $filter_data['status_id'])) {
            $query .= ' AND b.status_id in (' . $this->getListSQL($filter_data['status_id'], $ph) . ') ';
        }
        if (isset($filter_data['group_id']) and isset($filter_data['group_id'][0]) and !in_array(-1, (array) $filter_data['group_id'])) {
            if (isset($filter_data['include_subgroups']) and (bool) $filter_data['include_subgroups'] == TRUE) {
                $uglf = new UserGroupListFactory();
                $filter_data['group_id'] = $uglf->getByCompanyIdAndGroupIdAndSubGroupsArray($company_id, $filter_data['group_id'], TRUE);
            }
            $query .= ' AND b.group_id in (' . $this->getListSQL($filter_data['group_id'], $ph) . ') ';
        }
        if (isset($filter_data['default_branch_id']) and isset($filter_data['default_branch_id'][0]) and !in_array(-1, (array) $filter_data['default_branch_id'])) {
            $query .= ' AND b.default_branch_id in (' . $this->getListSQL($filter_data['default_branch_id'], $ph) . ') ';
        }
        if (isset($filter_data['default_department_id']) and isset($filter_data['default_department_id'][0]) and !in_array(-1, (array) $filter_data['default_department_id'])) {
            $query .= ' AND b.default_department_id in (' . $this->getListSQL($filter_data['default_department_id'], $ph) . ') ';
        }
        if (isset($filter_data['title_id']) and isset($filter_data['title_id'][0]) and !in_array(-1, (array) $filter_data['title_id'])) {
            $query .= ' AND b.title_id in (' . $this->getListSQL($filter_data['title_id'], $ph) . ') ';
        }
        if (isset($filter_data['country']) and isset($filter_data['country'][0]) and !in_array(-1, (array) $filter_data['country'])) {
            $query .= ' AND b.country in (' . $this->getListSQL($filter_data['country'], $ph) . ') ';
        }
        if (isset($filter_data['province']) and isset($filter_data['province'][0]) and !in_array(-1, (array) $filter_data['province']) and !in_array('00', (array) $filter_data['province'])) {
            $query .= ' AND b.province in (' . $this->getListSQL($filter_data['province'], $ph) . ') ';
        }
        $query .= isset($filter_data['created_by']) ? $this->getWhereClauseSQL(array('a.created_by', 'y.first_name', 'y.last_name'), $filter_data['created_by'], 'user_id_or_name', $ph) : NULL;
        $query .= isset($filter_data['updated_by']) ? $this->getWhereClauseSQL(array('a.updated_by', 'z.first_name', 'z.last_name'), $filter_data['updated_by'], 'user_id_or_name', $ph) : NULL;
        $query .= '
						AND a.deleted = 0
					';
        $query .= $this->getWhereSQL($where);
        $query .= $this->getSortSQL($order, $strict, $additional_order_fields);
        $this->ExecuteSQL($query, $ph, $limit, $page);
        return $this;
    }
Exemplo n.º 20
0
 function addLog($log_action)
 {
     return TTLog::addEntry($this->getId(), $log_action, TTi18n::getText('ROE'), NULL, $this->getTable(), $this);
 }
Exemplo n.º 21
0
 function _preProcess()
 {
     $this->getProgressBarObject()->start($this->getAMFMessageID(), count($this->tmp_data['pay_stub_entry']), NULL, TTi18n::getText('Pre-Processing Data...'));
     //Merge time data with user data
     $key = 0;
     if (isset($this->tmp_data['pay_stub_entry'])) {
         foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $row) {
             if (isset($this->tmp_data['user'][$user_id])) {
                 $date_columns = TTDate::getReportDates(NULL, $row['date_stamp'], FALSE, $this->getUserObject(), array('pay_period_start_date' => $row['pay_period_start_date'], 'pay_period_end_date' => $row['pay_period_end_date'], 'pay_period_transaction_date' => $row['pay_period_transaction_date']));
                 $processed_data = array('user_id' => $user_id);
                 $this->data[] = array_merge($this->tmp_data['user'][$user_id], $row, $date_columns, $processed_data);
                 $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
                 $key++;
             }
         }
         unset($this->tmp_data, $row, $date_columns, $processed_data, $level_1, $level_2, $level_3);
     }
     //Debug::Arr($this->data, 'preProcess Data: ', __FILE__, __LINE__, __METHOD__,10);
     $this->form_data = $this->data;
     //Copy data to Form Data so group/sort doesn't affect it.
     return TRUE;
 }
Exemplo n.º 22
0
 /**
  * Run manual commands on timeclocks
  * @param string $command command name
  * @param array $data station IDs
  * @return array
  */
 function runManualCommand($command, $data)
 {
     if (is_numeric($data)) {
         $data = array($data);
     }
     if (!is_array($data)) {
         return $this->returnHandler(FALSE);
     }
     Debug::Text('Time Clock Command: ' . $command, __FILE__, __LINE__, __METHOD__, 10);
     Debug::Text('Received data for: ' . count($data) . ' Stations', __FILE__, __LINE__, __METHOD__, 10);
     Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__, 10);
     $src_rows = $this->stripReturnHandler($this->getStation(array('filter_data' => array('id' => $data)), TRUE));
     if (is_array($src_rows) and count($src_rows) > 0) {
         Debug::Arr($src_rows, 'SRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
         foreach ($src_rows as $key => $row) {
             //Skip any non-timeclock types.
             if ($row['type_id'] < 100) {
                 continue;
             }
             Debug::Text(' Type: ' . $row['type_id'] . ' Source: ' . $row['source'] . ' Port: ' . $row['port'] . ' Password: '******'password'], __FILE__, __LINE__, __METHOD__, 10);
             $tc = new TimeClock($row['type_id']);
             $tc->setIPAddress($row['source']);
             $tc->setPort($row['port']);
             //$tc->setUsername( $row['user_name'] );
             $tc->setPassword($row['password']);
             $slf = TTnew('StationListFactory');
             $slf->getByIdAndCompanyId($row['id'], $this->getCurrentCompanyObject()->getId());
             if ($slf->getRecordCount() == 1) {
                 $s_obj = $slf->getCurrent();
             }
             $s_obj->setLastPunchTimeStamp($s_obj->getLastPunchTimeStamp());
             if ($s_obj->getTimeZone() != '' and !is_numeric($s_obj->getTimeZone())) {
                 Debug::text('Setting Station TimeZone To: ' . $s_obj->getTimeZone(), __FILE__, __LINE__, __METHOD__, 10);
                 TTDate::setTimeZone($s_obj->getTimeZone());
             }
             $result_str = NULL;
             switch ($command) {
                 case 'test_connection':
                     if ($tc->testConnection() == TRUE) {
                         $result_str = TTi18n::gettext('Connection Succeeded!');
                     } else {
                         $result_str = TTi18n::gettext('Connection Failed!');
                     }
                     break;
                 case 'set_date':
                     TTDate::setTimeZone($row['time_zone_id'], $s_obj->getTimeZone());
                     if ($tc->setDate(time()) == TRUE) {
                         $result_str = TTi18n::gettext('Date Successfully Set To: ') . TTDate::getDate('DATE+TIME', time());
                     } else {
                         $result_str = TTi18n::gettext('Setting Date Failed!');
                     }
                     break;
                 case 'download':
                     if (isset($s_obj) and $tc->Poll($this->getCurrentCompanyObject(), $s_obj) == TRUE) {
                         $result_str = TTi18n::gettext('Download Data Succeeded!');
                         if ($s_obj->isValid()) {
                             $s_obj->Save(FALSE);
                         }
                     } else {
                         $result_str = TTi18n::gettext('Download Data Failed!');
                     }
                     break;
                 case 'upload':
                     if (isset($s_obj) and $tc->Push($this->getCurrentCompanyObject(), $s_obj) == TRUE) {
                         $result_str = TTi18n::gettext('Upload Data Succeeded!');
                         if ($s_obj->isValid()) {
                             $s_obj->Save(FALSE);
                         }
                     } else {
                         $result_str = TTi18n::gettext('Upload Data Failed!');
                     }
                     break;
                 case 'update_config':
                     if (isset($s_obj) and $tc->setModeFlag($s_obj->getModeFlag()) == TRUE) {
                         $result_str = TTi18n::gettext('Update Configuration Succeeded');
                     } else {
                         $result_str = TTi18n::gettext('Update Configuration Failed');
                     }
                     break;
                 case 'delete_data':
                     if (isset($s_obj) and $tc->DeleteAllData($s_obj) == TRUE) {
                         $result_str = TTi18n::gettext('Delete Data Succeeded!');
                         if ($s_obj->isValid()) {
                             $s_obj->Save(FALSE);
                         }
                     } else {
                         $result_str = TTi18n::gettext('Delete Data Failed!');
                     }
                     break;
                 case 'reset_last_punch_time_stamp':
                     $s_obj->setLastPunchTimeStamp(time());
                     if ($s_obj->isValid()) {
                         $s_obj->Save(FALSE);
                     }
                     $result_str = TTi18n::gettext('Reset Last Punch Time Succeeded!');
                     break;
                 case 'clear_last_punch_time_stamp':
                     $s_obj->setLastPunchTimeStamp(1);
                     if ($s_obj->isValid()) {
                         $s_obj->Save(FALSE);
                     }
                     $result_str = TTi18n::gettext('Clear Last Punch Time Succeeded!');
                     break;
                 case 'restart':
                     $tc->restart();
                     $result_str = TTi18n::gettext('Restart Succeeded!');
                     break;
                 case 'firmware':
                     if ($tc->setFirmware() == TRUE) {
                         $result_str = TTi18n::gettext('Firmware Update Succeeded!');
                     } else {
                         $result_str = TTi18n::gettext('Firmware Update Failed!');
                     }
                     break;
                 default:
                     $result_str = TTi18n::gettext('Invalid manual command!');
                     break;
             }
             TTLog::addEntry($s_obj->getId(), 500, TTi18n::getText('TimeClock Manual Command') . ': ' . ucwords(str_replace('_', ' ', $command)) . ' ' . TTi18n::getText('Result') . ': ' . $result_str, NULL, $s_obj->getTable());
             if (isset($s_obj)) {
                 $row['last_poll_date'] = $s_obj->getLastPollDate();
                 $row['last_push_date'] = $s_obj->getLastPushDate();
             }
             unset($s_obj, $slf);
         }
         return $this->returnHandler($result_str);
     }
     return $this->returnHandler(FALSE);
 }
 function addLog($log_action)
 {
     return TTLog::addEntry($this->getRecurringScheduleTemplateControl(), $log_action, TTi18n::getText('Recurring Schedule Week') . ': ' . $this->getWeek(), NULL, $this->getTable(), $this);
 }
Exemplo n.º 24
0
 /**
  * Delete one or more UserPreferences.
  * @param array $data UserPreference data
  * @return array
  */
 function deleteUserPreference($data)
 {
     if (is_numeric($data)) {
         $data = array($data);
     }
     if (!is_array($data)) {
         return $this->returnHandler(FALSE);
     }
     if (!$this->getPermissionObject()->Check('user_preference', 'enabled') or !($this->getPermissionObject()->Check('user_preference', 'delete') or $this->getPermissionObject()->Check('user_preference', 'delete_own') or $this->getPermissionObject()->Check('user_preference', 'delete_child'))) {
         return $this->getPermissionObject()->PermissionDenied();
     }
     Debug::Text('Received data for: ' . count($data) . ' UserPreferences', __FILE__, __LINE__, __METHOD__, 10);
     Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__, 10);
     $total_records = count($data);
     $validator_stats = array('total_records' => $total_records, 'valid_records' => 0);
     if (is_array($data)) {
         $this->getProgressBarObject()->start($this->getAMFMessageID(), $total_records);
         foreach ($data as $key => $id) {
             $primary_validator = new Validator();
             $lf = TTnew('UserPreferenceListFactory');
             $lf->StartTransaction();
             if (is_numeric($id)) {
                 //Modifying existing object.
                 //Get UserPreference object, so we can only modify just changed data for specific records if needed.
                 $lf->getByIdAndCompanyId($id, $this->getCurrentCompanyObject()->getId());
                 if ($lf->getRecordCount() == 1) {
                     //Object exists, check edit permissions
                     if ($this->getPermissionObject()->Check('user_preference', 'delete') or $this->getPermissionObject()->Check('user_preference', 'delete_own') and $this->getPermissionObject()->isOwner($lf->getCurrent()->getCreatedBy(), $lf->getCurrent()->getID()) === TRUE) {
                         Debug::Text('Record Exists, deleting record: ', $id, __FILE__, __LINE__, __METHOD__, 10);
                         $lf = $lf->getCurrent();
                     } else {
                         $primary_validator->isTrue('permission', FALSE, TTi18n::gettext('Delete permission denied'));
                     }
                 } else {
                     //Object doesn't exist.
                     $primary_validator->isTrue('id', FALSE, TTi18n::gettext('Delete permission denied, record does not exist'));
                 }
             } else {
                 $primary_validator->isTrue('id', FALSE, TTi18n::gettext('Delete permission denied, record does not exist'));
             }
             //Debug::Arr($lf, 'AData: ', __FILE__, __LINE__, __METHOD__, 10);
             $is_valid = $primary_validator->isValid();
             if ($is_valid == TRUE) {
                 //Check to see if all permission checks passed before trying to save data.
                 Debug::Text('Attempting to delete record...', __FILE__, __LINE__, __METHOD__, 10);
                 $lf->setDeleted(TRUE);
                 $is_valid = $lf->isValid();
                 if ($is_valid == TRUE) {
                     Debug::Text('Record Deleted...', __FILE__, __LINE__, __METHOD__, 10);
                     $save_result[$key] = $lf->Save();
                     $validator_stats['valid_records']++;
                 }
             }
             if ($is_valid == FALSE) {
                 Debug::Text('Data is Invalid...', __FILE__, __LINE__, __METHOD__, 10);
                 $lf->FailTransaction();
                 //Just rollback this single record, continue on to the rest.
                 if ($primary_validator->isValid() == FALSE) {
                     $validator[$key] = $primary_validator->getErrorsArray();
                 } else {
                     $validator[$key] = $lf->Validator->getErrorsArray();
                 }
             }
             $lf->CommitTransaction();
             $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
         }
         $this->getProgressBarObject()->stop($this->getAMFMessageID());
         if ($validator_stats['valid_records'] > 0 and $validator_stats['total_records'] == $validator_stats['valid_records']) {
             if ($validator_stats['total_records'] == 1) {
                 return $this->returnHandler($save_result[$key]);
                 //Single valid record
             } else {
                 return $this->returnHandler(TRUE, 'SUCCESS', TTi18n::getText('MULTIPLE RECORDS SAVED'), $save_result, $validator_stats);
                 //Multiple valid records
             }
         } else {
             return $this->returnHandler(FALSE, 'VALIDATION', TTi18n::getText('INVALID DATA'), $validator, $validator_stats);
         }
     }
     return $this->returnHandler(FALSE);
 }
Exemplo n.º 25
0
 /**
  * Allows currently logged in user to change their password.
  * @param string $current_password
  * @param string $new_password
  * @param string $new_password2
  * @param string $type
  * @return bool
  */
 function changePassword($current_password, $new_password, $new_password2, $type = 'web')
 {
     $ulf = TTnew('UserListFactory');
     $ulf->getByIdAndCompanyId($this->getCurrentUserObject()->getId(), $this->getCurrentCompanyObject()->getId());
     if ($ulf->getRecordCount() == 1) {
         $uf = $ulf->getCurrent();
         switch (strtolower($type)) {
             case 'quick_punch':
             case 'phone':
                 if ($this->getPermissionObject()->Check('user', 'edit_own_phone_password') == FALSE) {
                     return $this->getPermissionObject()->PermissionDenied();
                 }
                 $log_description = TTi18n::getText('Password - Phone');
                 if ($current_password != '') {
                     if ($uf->checkPhonePassword($current_password) !== TRUE) {
                         Debug::Text('Password check failed!', __FILE__, __LINE__, __METHOD__, 10);
                         $uf->Validator->isTrue('current_password', FALSE, TTi18n::gettext('Current password is incorrect'));
                     }
                 } else {
                     Debug::Text('Current password not specified', __FILE__, __LINE__, __METHOD__, 10);
                     $uf->Validator->isTrue('current_password', FALSE, TTi18n::gettext('Current password is incorrect'));
                 }
                 if ($new_password != '' or $new_password2 != '') {
                     if ($new_password == $new_password2) {
                         $uf->setPhonePassword($new_password);
                     } else {
                         $uf->Validator->isTrue('password', FALSE, TTi18n::gettext('Passwords don\'t match'));
                     }
                 } else {
                     $uf->Validator->isTrue('password', FALSE, TTi18n::gettext('Passwords don\'t match'));
                 }
                 break;
             case 'web':
                 if ($this->getPermissionObject()->Check('user', 'edit_own_password') == FALSE) {
                     return $this->getPermissionObject()->PermissionDenied();
                 }
                 $log_description = TTi18n::getText('Password - Web');
                 if ($current_password != '') {
                     if ($uf->checkPassword($current_password) !== TRUE) {
                         Debug::Text('Password check failed!', __FILE__, __LINE__, __METHOD__, 10);
                         $uf->Validator->isTrue('current_password', FALSE, TTi18n::gettext('Current password is incorrect'));
                     }
                 } else {
                     Debug::Text('Current password not specified', __FILE__, __LINE__, __METHOD__, 10);
                     $uf->Validator->isTrue('current_password', FALSE, TTi18n::gettext('Current password is incorrect'));
                 }
                 if ($new_password != '' or $new_password2 != '') {
                     if ($new_password == $new_password2) {
                         $uf->setPassword($new_password);
                     } else {
                         $uf->Validator->isTrue('password', FALSE, TTi18n::gettext('Passwords don\'t match'));
                     }
                 } else {
                     $uf->Validator->isTrue('password', FALSE, TTi18n::gettext('Passwords don\'t match'));
                 }
                 break;
         }
         if ($uf->isValid()) {
             if (DEMO_MODE == TRUE) {
                 //Return TRUE even in demo mode, but nothing happens.
                 return $this->returnHandler(TRUE);
             } else {
                 TTLog::addEntry($this->getCurrentUserObject()->getId(), 20, $log_description, NULL, $uf->getTable());
                 return $this->returnHandler($uf->Save());
                 //Single valid record
             }
         } else {
             return $this->returnHandler(FALSE, 'VALIDATION', TTi18n::getText('INVALID DATA'), $uf->Validator->getErrorsArray(), array('total_records' => 1, 'valid_records' => 0));
         }
     }
     return $this->returnHandler(FALSE);
 }
Exemplo n.º 26
0
 //Debug::setVerbosity(11);
 $init_progress_bar = TRUE;
 if ($init_progress_bar == TRUE) {
     InitProgressBar();
     $init_progress_bar = FALSE;
 }
 $progress_bar->setValue(0);
 $progress_bar->display();
 //This will be slightly off depending on which days of the week they choose.
 $total_punches = count($filter_user_id) * TTDate::getDays($data['end_punch_full_time_stamp'] - $data['start_punch_full_time_stamp']);
 Debug::Text('Total Punches: ' . $total_punches . ' Users: ' . count($filter_user_id) . ' Days: ' . TTDate::getDays($data['end_punch_full_time_stamp'] - $data['start_punch_full_time_stamp']), __FILE__, __LINE__, __METHOD__, 10);
 $pcf = TTnew('PunchControlFactory');
 $pf = TTnew('PunchFactory');
 $ulf = TTnew('UserListFactory');
 $pf->StartTransaction();
 TTLog::addEntry($current_user->getId(), 500, TTi18n::getText('Mass Punch: Time') . ': ' . TTDate::getDate('TIME', $data['start_punch_full_time_stamp']) . ' Total Employees: ' . count($filter_user_id) . ' Total Days: ' . round(TTDate::getDays($data['end_punch_full_time_stamp'] - $data['start_punch_full_time_stamp'])), $current_user->getId(), $pf->getTable());
 $time_stamp = $data['start_punch_full_time_stamp'];
 $x = 0;
 while ($time_stamp <= $data['end_punch_full_time_stamp']) {
     if (isset($data['dow'][TTDate::getDayOfWeek($time_stamp)]) and $data['dow'][TTDate::getDayOfWeek($time_stamp)] == 1) {
         foreach ($filter_user_id as $user_id) {
             $ulf->getByIdAndCompanyId($user_id, $current_company->getId());
             if ($ulf->getRecordCount() == 1) {
                 $user_obj = $ulf->getCurrent();
                 $user_generic_status_label = $user_obj->getFullName(TRUE) . ' @ ' . TTDate::getDate('DATE+TIME', $time_stamp);
             } else {
                 $user_obj = NULL;
                 $user_generic_status_label = 'N/A @ ' . TTDate::getDate('DATE+TIME', $time_stamp);
             }
             $pcf = TTnew('PunchControlFactory');
             $pf = TTnew('PunchFactory');
Exemplo n.º 27
0
 $dlf = TTnew('DepartmentListFactory');
 $department_options = $dlf->getByCompanyIdArray($current_company->getId());
 //Get verified timesheets
 //Ignore if more then one pay period is selected
 $verified_time_sheets = NULL;
 if (isset($pay_period_ids) and count($pay_period_ids) > 0) {
     $pptsvlf = TTnew('PayPeriodTimeSheetVerifyListFactory');
     $pptsvlf->getByPayPeriodIdAndCompanyId(array_keys($pay_period_ids), $current_company->getId());
     if ($pptsvlf->getRecordCount() > 0) {
         foreach ($pptsvlf as $pptsv_obj) {
             $verified_time_sheets[$pptsv_obj->getUser()][$pptsv_obj->getPayPeriod()] = $pptsv_obj->getStatus();
         }
     }
 }
 if (Misc::isSystemLoadValid() == FALSE) {
     echo TTi18n::getText('Please try again later...');
     exit;
 }
 if (isset($tmp_rows)) {
     $x = 0;
     foreach ($tmp_rows as $user_id => $data_a) {
         $user_obj = $ulf->getById($user_id)->getCurrent();
         foreach ($data_a as $pay_period_id => $data_b) {
             $rows[$x]['user_id'] = $user_obj->getId();
             $rows[$x]['full_name'] = $user_obj->getFullName(TRUE);
             $rows[$x]['employee_number'] = $user_obj->getEmployeeNumber();
             $rows[$x]['status'] = Option::getByKey($user_obj->getStatus(), $user_obj->getOptions('status'));
             //$rows[$x]['province'] = Option::getByKey($user_obj->getProvince(), $user_obj->getCompanyObject()->getOptions('province', $user_obj->getCountry() ) );
             //$rows[$x]['country'] = Option::getByKey($user_obj->getCountry(), $user_obj->getCompanyObject()->getOptions('country') );
             $rows[$x]['province'] = $user_obj->getProvince();
             $rows[$x]['country'] = $user_obj->getCountry();
 function addLog($log_action)
 {
     $u_obj = $this->getUserObject();
     if (is_object($u_obj)) {
         return TTLog::addEntry($this->getStation(), $log_action, TTi18n::getText('Employee') . ': ' . $u_obj->getFullName(FALSE, TRUE), NULL, $this->getTable());
     }
     return FALSE;
 }
Exemplo n.º 29
0
 function _preProcess()
 {
     $this->getProgressBarObject()->start($this->getAMFMessageID(), count($this->tmp_data['user']), NULL, TTi18n::getText('Pre-Processing Data...'));
     $key = 0;
     if (isset($this->tmp_data['user'])) {
         foreach ($this->tmp_data['user'] as $user_id => $row) {
             if (isset($row['hire_date'])) {
                 $hire_date_columns = TTDate::getReportDates('hire', TTDate::parseDateTime($row['hire_date']), FALSE, $this->getUserObject());
             } else {
                 $hire_date_columns = array();
             }
             if (isset($row['termination_date'])) {
                 $termination_date_columns = TTDate::getReportDates('termination', TTDate::parseDateTime($row['termination_date']), FALSE, $this->getUserObject());
             } else {
                 $termination_date_columns = array();
             }
             if (isset($row['birth_date'])) {
                 $birth_date_columns = TTDate::getReportDates('birth', TTDate::parseDateTime($row['birth_date']), FALSE, $this->getUserObject());
             } else {
                 $birth_date_columns = array();
             }
             if (isset($row['created_date'])) {
                 $created_date_columns = TTDate::getReportDates('created', TTDate::parseDateTime($row['created_date']), FALSE, $this->getUserObject());
             } else {
                 $created_date_columns = array();
             }
             if (isset($row['updated_date'])) {
                 $updated_date_columns = TTDate::getReportDates('updated', TTDate::parseDateTime($row['updated_date']), FALSE, $this->getUserObject());
             } else {
                 $updated_date_columns = array();
             }
             $processed_data = array();
             if (isset($this->tmp_data['user_preference'][$user_id])) {
                 $processed_data = array_merge($processed_data, $this->tmp_data['user_preference'][$user_id]);
             }
             if (isset($this->tmp_data['user_bank'][$user_id])) {
                 $processed_data = array_merge($processed_data, $this->tmp_data['user_bank'][$user_id]);
             }
             if (isset($this->tmp_data['user_wage'][$user_id])) {
                 $processed_data = array_merge($processed_data, $this->tmp_data['user_wage'][$user_id]);
             }
             $this->data[] = array_merge($row, $hire_date_columns, $termination_date_columns, $birth_date_columns, $created_date_columns, $updated_date_columns, $processed_data);
             $this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
             $key++;
         }
         unset($this->tmp_data, $row, $date_columns, $user_id, $hire_date_columns, $termination_date_columns, $birth_date_columns, $processed_data);
     }
     //Debug::Arr($this->data, 'preProcess Data: ', __FILE__, __LINE__, __METHOD__,10);
     return TRUE;
 }
Exemplo n.º 30
0
 /**
  * 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
             $mclf = new MessageControlListFactory();
             $unread_messages = $mclf->getNewMessagesByCompanyIdAndUserId($this->getCurrentCompanyObject()->getId(), $this->getCurrentUserObject()->getId());
             Debug::text('UnRead Messages: ' . $unread_messages, __FILE__, __LINE__, __METHOD__, 10);
             if ($unread_messages > 0) {
                 $retarr[] = array('delay' => 25, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: You have %1 new message(s) waiting, click here to read them now.', $unread_messages), 'destination' => array('menu_name' => 'Messages'));
             }
             unset($mclf, $unread_messages);
             if (DEMO_MODE == FALSE) {
                 $elf = new ExceptionListFactory();
                 $elf->getFlaggedExceptionsByUserIdAndPayPeriodStatus($this->getCurrentUserObject()->getId(), 10);
                 $display_exception_flag = FALSE;
                 if ($elf->getRecordCount() > 0) {
                     foreach ($elf as $e_obj) {
                         if ($e_obj->getColumn('severity_id') == 30) {
                             $display_exception_flag = 'red';
                         }
                         break;
                     }
                 }
                 if (isset($display_exception_flag) and $display_exception_flag !== FALSE) {
                     Debug::Text('Exception Flag to Display: ' . $display_exception_flag, __FILE__, __LINE__, __METHOD__, 10);
                     $retarr[] = array('delay' => 30, 'bg_color' => '#FFFF00', 'message' => TTi18n::getText('NOTICE: You have critical severity exceptions pending, click here to view them now.'), 'destination' => array('menu_name' => 'Exceptions'));
                 }
                 unset($elf, $e_obj, $display_exception_flag);
             }
             if (DEMO_MODE == FALSE and $this->getPermissionObject()->getLevel() >= 20 and ($this->getCurrentUserObject()->getWorkEmail() == '' and $this->getCurrentUserObject()->getHomeEmail() == '')) {
                 $retarr[] = array('delay' => 30, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: Please click here and enter an email address for your account, this is required to receive important notices and prevent your account from being locked out.'), 'destination' => array('menu_name' => 'Contact Information'));
             }
             break;
         default:
             break;
     }
     //Check timezone is proper.
     $current_user_prefs = $this->getCurrentUserObject()->getUserPreferenceObject();
     if ($current_user_prefs->setDateTimePreferences() == FALSE) {
         //Setting timezone failed, alert user to this fact.
         //WARNING: %1 was unable to set your time zone. Please contact your %1 administrator immediately.{/t} {if $permission->Check('company','enabled') AND $permission->Check('company','edit_own')}<a href="http://forums.timetrex.com/viewtopic.php?t=40">{t}For more information please click here.{/t}</a>{/if}
         if ($this->getPermissionObject()->Check('company', 'enabled') and $this->getPermissionObject()->Check('company', 'edit_own')) {
             $destination_url = 'http://www.timetrex.com/r.php?id=1010';
             $sub_message = TTi18n::getText('For more information please click here.');
         } else {
             $destination_url = NULL;
             $sub_message = NULL;
         }
         $retarr[] = array('delay' => -1, 'bg_color' => '#FF0000', 'message' => TTi18n::getText('WARNING: %1 was unable to set your time zone. Please contact your %1 administrator immediately.', APPLICATION_NAME) . ' ' . $sub_message, 'destination' => $destination_url);
         unset($destination_url, $sub_message);
     }
     return $retarr;
 }