Ejemplo n.º 1
0
 function setStatus($status)
 {
     $status = trim($status);
     $key = Option::getByValue($status, $this->getOptions('status'));
     if ($key !== FALSE) {
         $status = $key;
     }
     if ($this->Validator->inArrayKey('status', $status, TTi18n::gettext('Incorrect Status'), $this->getOptions('status'))) {
         $this->data['status_id'] = $status;
         return TRUE;
     }
     return FALSE;
 }
Ejemplo n.º 2
0
 function setAction($action)
 {
     $action = trim($action);
     $key = Option::getByValue($action, $this->getOptions('action'));
     if ($key !== FALSE) {
         $action = $key;
     }
     if ($this->Validator->inArrayKey('action', $action, TTi18n::gettext('Incorrect Action'), $this->getOptions('action'))) {
         $this->data['action_id'] = $action;
         return FALSE;
     }
     return FALSE;
 }
 function setType($type)
 {
     $type = trim($type);
     $key = Option::getByValue($type, $this->getOptions('type'));
     if ($key !== FALSE) {
         $type = $key;
     }
     if ($this->Validator->inArrayKey('type', $type, TTi18n::gettext('Incorrect Type'), $this->getOptions('type'))) {
         $this->data['type_id'] = $type;
         return TRUE;
     }
     return FALSE;
 }
 function setDefaultScheduleStatus($value)
 {
     $value = trim($value);
     $sf = new ScheduleFactory();
     $key = Option::getByValue($value, $sf->getOptions('status'));
     if ($key !== FALSE) {
         $value = $key;
     }
     if ($this->Validator->inArrayKey('default_schedule_status', $value, TTi18n::gettext('Incorrect Default Schedule Status'), $sf->getOptions('status'))) {
         $this->data['default_schedule_status_id'] = $value;
         return FALSE;
     }
     return FALSE;
 }
    function getByCompanyIDAndUserIdAndStatusAndStartDateAndEndDate($company_id, $user_id, $status, $start_date, $end_date)
    {
        if ($company_id == '') {
            return FALSE;
        }
        if ($user_id == '') {
            return FALSE;
        }
        if ($start_date == '') {
            return FALSE;
        }
        if ($end_date == '') {
            return FALSE;
        }
        if ($status == '') {
            return FALSE;
        }
        $key = Option::getByValue($status, $this->getOptions('status'));
        if ($key !== FALSE) {
            $status = $key;
        }
        $uf = new UserFactory();
        $udf = new UserDateFactory();
        $otpf = new OverTimePolicyFactory();
        $ph = array('company_id' => $company_id, 'user_id' => $user_id, 'status_id' => $status, 'start_date' => $this->db->BindDate($start_date), 'end_date' => $this->db->BindDate($end_date));
        //Order by a.over_time_policy last so we never leave the ordering up to the database. This can cause
        //the unit tests to fail between databases.
        //AND a.type_id != 40
        $query = '
					select 	a.*,
							b.date_stamp as user_date_stamp
					from	' . $this->getTable() . ' as a
					LEFT JOIN ' . $udf->getTable() . ' as b ON a.user_date_id = b.id
					LEFT JOIN ' . $uf->getTable() . ' as c ON b.user_id = c.id
					LEFT JOIN ' . $otpf->getTable() . ' as d ON a.over_time_policy_id = d.id
					where
						c.company_id = ?
						AND	b.user_id = ?
						AND a.status_id = ?
						AND a.type_id not in (40,100,110)
						AND b.date_stamp >= ?
						AND b.date_stamp <= ?
						AND ( a.deleted = 0 AND b.deleted = 0 )
					ORDER BY b.date_stamp asc, a.status_id asc, a.type_id asc, d.type_id desc, a.over_time_policy_id desc, a.premium_policy_id, a.total_time, a.id
					';
        $this->ExecuteSQL($query, $ph);
        return $this;
    }
 function setProductEdition($val)
 {
     $val = trim($val);
     $key = Option::getByValue($val, $this->getOptions('product_edition'));
     if ($key !== FALSE) {
         $val = $key;
     }
     if ($this->Validator->inArrayKey('product_edition', $val, TTi18n::gettext('Incorrect Product Edition'), $this->getOptions('product_edition'))) {
         $this->data['product_edition_id'] = $val;
         return TRUE;
     }
     return FALSE;
 }
    function getByStatus($status, $where = NULL, $order = NULL)
    {
        $key = Option::getByValue($status, $this->getOptions('status'));
        if ($key !== FALSE) {
            $status = $key;
        }
        if ($status == '') {
            return FALSE;
        }
        $ph = array('status_id' => $status);
        $query = '
					select 	*
					from	' . $this->getTable() . '

					where	status_id = ?
						AND deleted=0';
        $query .= $this->getWhereSQL($where);
        $query .= $this->getSortSQL($order);
        $this->rs = $this->db->Execute($query, $ph);
        return $this;
    }
    function getByUserIdAndFolder($user_id, $folder, $limit = NULL, $page = NULL, $where = NULL, $order = NULL)
    {
        if ($user_id == '') {
            return FALSE;
        }
        $strict = TRUE;
        if ($order == NULL) {
            $strict = FALSE;
            $order = array('a.status_id' => '= 10 desc', 'a.created_date' => 'desc');
        }
        //Folder is: INBOX, SENT
        $key = Option::getByValue($folder, $this->getOptions('folder'));
        if ($key !== FALSE) {
            $folder = $key;
        }
        $rf = new RequestFactory();
        $uf = new UserFactory();
        $udf = new UserDateFactory();
        $pptsvf = new PayPeriodTimeSheetVerifyFactory();
        $ph = array('user_id' => $user_id);
        $folder_sent_query = NULL;
        $folder_inbox_query = NULL;
        $folder_inbox_query_a = NULL;
        $folder_inbox_query_ab = NULL;
        $folder_inbox_query_b = NULL;
        $folder_inbox_query_c = NULL;
        if ($folder == 10) {
            $ph['id'] = $user_id;
            $ph['created_by1'] = $user_id;
            $ph['created_by2'] = $user_id;
            $ph['created_by3'] = $user_id;
            $ph['created_by4'] = $user_id;
            $folder_inbox_query = ' AND a.created_by != ?';
            $folder_inbox_query_a = ' OR d.id = ?';
            $folder_inbox_query_ab = ' OR e.user_id = ?';
            //$folder_inbox_query_b = ' OR a.parent_id in ( select parent_id FROM '. $this->getTable() .' WHERE created_by = '. $user_id .' ) ';
            $folder_inbox_query_b = ' OR a.parent_id in ( select parent_id FROM ' . $this->getTable() . ' WHERE created_by = ? AND parent_id != 0 ) ';
            $folder_inbox_query_c = ' OR a.parent_id in ( select id FROM ' . $this->getTable() . ' WHERE created_by = ? AND parent_id = 0 ) ';
        } elseif ($folder == 20) {
            $ph['created_by4'] = $user_id;
            $folder_sent_query = ' OR a.created_by = ?';
        }
        //Need to include all threads that user has posted to.
        $query = '
					SELECT a.*,
							CASE WHEN a.object_type_id = 5 THEN d.id WHEN a.object_type_id = 50 THEN c.user_id WHEN a.object_type_id = 90 THEN e.user_id END as sent_to_user_id
					FROM ' . $this->getTable() . ' as a
						LEFT JOIN ' . $uf->getTable() . ' as d ON a.object_type_id = 5 AND a.object_id = d.id
						LEFT JOIN ' . $uf->getTable() . ' as f ON a.created_by = f.id
						LEFT JOIN ' . $rf->getTable() . ' as b ON a.object_type_id = 50 AND a.object_id = b.id
						LEFT JOIN ' . $udf->getTable() . ' as c ON b.user_date_id = c.id
						LEFT JOIN ' . $pptsvf->getTable() . ' as e ON a.object_type_id = 90 AND a.object_id = e.id
					WHERE
							a.object_type_id in (5,50,90)
							AND
							(

								(
									(
										c.user_id = ?
										' . $folder_sent_query . '
										' . $folder_inbox_query_a . '
										' . $folder_inbox_query_ab . '
										' . $folder_inbox_query_b . '
										' . $folder_inbox_query_c . '
									)
									' . $folder_inbox_query . '
								)
							)

						AND ( a.deleted = 0 AND f.deleted = 0
								AND ( b.id IS NULL OR ( b.id IS NOT NULL AND b.deleted = 0 ) )
								AND ( c.id IS NULL OR ( c.id IS NOT NULL AND c.deleted = 0 ) )
								AND ( d.id IS NULL OR ( d.id IS NOT NULL AND d.deleted = 0 ) )
								AND ( e.id IS NULL OR ( e.id IS NOT NULL AND e.deleted = 0 ) )
								AND NOT ( b.id IS NULL AND c.id IS NULL AND d.id IS NULL AND e.id IS NULL )
							)
					';
        $query .= $this->getWhereSQL($where);
        $query .= $this->getSortSQL($order, $strict, array('sent_to_user_id'));
        //Debug::text('Query: '. $query , __FILE__, __LINE__, __METHOD__,9);
        if ($limit == NULL) {
            //Run query without limit
            $this->rs = $this->db->Execute($query, $ph);
        } else {
            $this->rs = $this->db->PageExecute($query, $limit, $page, $ph);
        }
        return $this;
    }
 function setType($type)
 {
     $type = trim($type);
     //$jif = new JobItemFactory();
     $key = Option::getByValue($type, $this->getOptions('type'));
     if ($key !== FALSE) {
         $type = $key;
     }
     if ($this->Validator->inArrayKey('type', $type, TTi18n::gettext('Incorrect Type'), $this->getOptions('type')) and $this->Validator->isTrue('type', $this->isUniqueType($type), TTi18n::gettext('Type already exists'))) {
         $this->data['type_id'] = $type;
         return FALSE;
     }
     return FALSE;
 }
Ejemplo n.º 10
0
 function setAction($action)
 {
     $action = trim($action);
     //Use integer ID values instead.
     $key = Option::getByValue($action, $this->getOptions('action'));
     if ($key !== FALSE) {
         Debug::text('Text Action: ' . $action . ' Key: ' . $key, __FILE__, __LINE__, __METHOD__, 10);
         $action = $key;
     }
     if ($this->Validator->inArrayKey('action', $action, TTi18n::gettext('Incorrect Action'), $this->getOptions('action'))) {
         $this->data['action_id'] = $action;
         return FALSE;
     }
     return FALSE;
 }
 function setObjectType($type)
 {
     $type = trim($type);
     // i18n: passing 3rd param as false because object_type options do not use gettext
     $key = Option::getByValue($type, $this->getOptions('object_type'), false);
     if ($key !== FALSE) {
         $type = $key;
     }
     if ($this->Validator->inArrayKey('object_type', $type, TTi18n::gettext('Object Type is invalid'), $this->getOptions('object_type'))) {
         $this->data['object_type_id'] = $type;
         return FALSE;
     }
     return FALSE;
 }
Ejemplo n.º 12
0
 function setStatus($status)
 {
     $status = trim($status);
     $key = Option::getByValue($status, $this->getOptions('status'));
     if ($key !== FALSE) {
         $status = $key;
     }
     if ($this->Validator->inArrayKey('status', $status, TTi18n::gettext('Incorrect Status'), $this->getOptions('status'))) {
         $this->data['status_id'] = $status;
         Debug::Text('Setting status_id data...    ' . $this->data['status_id'], __FILE__, __LINE__, __METHOD__, 10);
         return TRUE;
     }
     return FALSE;
 }
 function setSeverity($value)
 {
     $value = trim($value);
     $key = Option::getByValue($value, $this->getOptions('severity'));
     if ($key !== FALSE) {
         $value = $key;
     }
     if ($this->Validator->inArrayKey('severity', $value, TTi18n::gettext('Incorrect Severity'), $this->getOptions('severity'))) {
         $this->data['severity_id'] = $value;
         return TRUE;
     }
     return FALSE;
 }
 function setLengthOfServiceUnit($value)
 {
     $value = trim($value);
     $key = Option::getByValue($value, $this->getOptions('length_of_service_unit'));
     if ($key !== FALSE) {
         $value = $key;
     }
     if ($this->Validator->inArrayKey('length_of_service_unit_id' . $this->getLabelID(), $value, TTi18n::gettext('Incorrect Length of service unit'), $this->getOptions('length_of_service_unit'))) {
         $this->data['length_of_service_unit_id'] = $value;
         return TRUE;
     }
     return FALSE;
 }
Ejemplo n.º 15
0
 function setStatus($status)
 {
     $status = trim($status);
     $key = Option::getByValue($status, $this->getOptions('status'));
     if ($key !== FALSE) {
         $status = $key;
     }
     $modify_status = FALSE;
     if ($this->getCurrentUserPermissionLevel() >= $this->getPermissionLevel()) {
         $modify_status = TRUE;
     } elseif ($this->getStatus() == $status) {
         //No modification made.
         $modify_status = TRUE;
     }
     if ($this->Validator->inArrayKey('status_id', $status, TTi18n::gettext('Incorrect Status'), $this->getOptions('status')) and $this->Validator->isTrue('status_id', $modify_status, TTi18n::gettext('Insufficient access to modify status for this employee'))) {
         $this->data['status_id'] = $status;
         return TRUE;
     }
     return FALSE;
 }
Ejemplo n.º 16
0
    function getByIdAndStatus($id, $status, $where = NULL, $order = NULL)
    {
        if ($id == '') {
            return FALSE;
        }
        $key = Option::getByValue($status, $this->getOptions('status'));
        if ($key !== FALSE) {
            $status = $key;
        }
        $ph = array('id' => $id, 'status' => $status);
        $query = '
					select 	*
					from	' . $this->getTable() . '
					where	id = ?
						AND status_id = ?
						AND deleted = 0';
        $this->ExecuteSQL($query, $ph);
        return $this;
    }
 function setPriority($priority = NULL)
 {
     $priority = trim($priority);
     if (empty($priority)) {
         $priority = 50;
     }
     $key = Option::getByValue($priority, $this->getOptions('priority'));
     if ($key !== FALSE) {
         $priority = $key;
     }
     if ($this->Validator->inArrayKey('priority', $priority, TTi18n::gettext('Invalid Priority'), $this->getOptions('priority'))) {
         $this->data['priority_id'] = $priority;
         return FALSE;
     }
     return FALSE;
 }
 function getPresetPermissions($preset, $preset_flags)
 {
     $key = Option::getByValue($preset, $this->getOptions('preset'));
     if ($key !== FALSE) {
         $preset = $key;
     }
     if (getTTProductEdition() != TT_PRODUCT_PROFESSIONAL) {
         $preset_flags = array();
     }
     /*
     										10 => 'Regular Employee',
     										20 => 'Supervisor',
     										30 => 'Payroll Administrator',
     										40 => 'Administrator'
     */
     Debug::Text('Preset: ' . $preset, __FILE__, __LINE__, __METHOD__, 10);
     Debug::Arr($preset_flags, 'Preset Flags... ', __FILE__, __LINE__, __METHOD__, 10);
     if (!isset($preset) or $preset == '' or $preset == -1) {
         Debug::Text('No Preset set... Skipping!', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     $preset_permissions_40 = array();
     $preset_permissions_30 = array();
     $preset_permissions_20 = array();
     $preset_permissions_18 = array();
     $preset_permissions_10 = array();
     switch ($preset) {
         case 40:
             //Can do everything
             $preset_permissions_40 = array('user' => array('timeclock_admin' => TRUE), 'policy_group' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'schedule_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'meal_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'break_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'over_time_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'premium_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'accrual_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'absence_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'round_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'exception_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'holiday_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'currency' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'branch' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'department' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE, 'assign' => TRUE), 'station' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE, 'assign' => TRUE), 'report' => array(), 'hierarchy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'round_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'other_field' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'currency' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'permission' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE));
             if (isset($preset_flags['invoice']) and $preset_flags['invoice'] == 1) {
                 Debug::Text('Applying Invoice Permissions for Admin Preset', __FILE__, __LINE__, __METHOD__, 10);
                 $invoice_preset_permissions_40 = array('invoice_config' => array('enabled' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE));
                 $preset_permissions_40 = array_merge_recursive($preset_permissions_40, $invoice_preset_permissions_40);
                 unset($invoice_preset_permissions_40);
             } else {
                 Debug::Text('NOT Applying Invoice Permissions for Admin Preset', __FILE__, __LINE__, __METHOD__, 10);
             }
         case 30:
             //Payroll Admin, can do wages, taxes, etc...
             $preset_permissions_30 = array('company' => array('enabled' => TRUE, 'view_own' => TRUE, 'edit_own' => TRUE, 'edit_own_bank' => TRUE), 'user' => array('add' => TRUE, 'edit_bank' => TRUE, 'view_sin' => TRUE), 'user_tax_deduction' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'roe' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'company_tax_deduction' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'pay_stub_account' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'pay_stub' => array('view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'pay_stub_amendment' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'wage' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'pay_period_schedule' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE, 'assign' => TRUE), 'report' => array('view_pay_stub_summary' => TRUE, 'view_payroll_export' => TRUE, 'view_remittance_summary' => TRUE, 'view_system_log' => TRUE, 'view_employee_summary' => TRUE, 'view_wages_payable_summary' => TRUE, 'view_t4_summary' => TRUE, 'view_generic_tax_summary' => TRUE, 'view_form941' => TRUE, 'view_form940' => TRUE, 'view_form940ez' => TRUE, 'view_form1099misc' => TRUE, 'view_formW2' => TRUE, 'view_general_ledger_summary' => TRUE));
             if (isset($preset_flags['invoice']) and $preset_flags['invoice'] == 1) {
                 Debug::Text('Applying Invoice Permissions for Payroll Admin Preset', __FILE__, __LINE__, __METHOD__, 10);
                 $invoice_preset_permissions_30 = array('product' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'tax_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'shipping_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'area_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'payment_gateway' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'invoice_report' => array('enabled' => TRUE, 'view_transaction_summary' => TRUE));
                 $preset_permissions_30 = array_merge_recursive($preset_permissions_30, $invoice_preset_permissions_30);
                 unset($invoice_preset_permissions_30);
             } else {
                 Debug::Text('NOT Applying Invoice Permissions for Payroll Admin Preset', __FILE__, __LINE__, __METHOD__, 10);
             }
         case 20:
             //Supervisor (All Employees), can see all schedules and shifts, and can do authorizations
             $preset_permissions_20 = array('user' => array('view' => TRUE, 'edit' => TRUE, 'enroll' => TRUE, 'delete' => TRUE), 'user_preference' => array('edit' => TRUE), 'recurring_schedule_template' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'recurring_schedule' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'punch' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'absence' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'accrual' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'request' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'schedule' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'message' => array('send_to_any' => TRUE));
             //
             // Most of this is done on level 18;
             //
             if (isset($preset_flags['job']) and $preset_flags['job'] == 1) {
                 Debug::Text('Applying Job Permissions for Supervisor Preset', __FILE__, __LINE__, __METHOD__, 10);
                 $job_preset_permissions_20 = array('job' => array('view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'job_item' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE));
                 $preset_permissions_20 = array_merge_recursive($preset_permissions_20, $job_preset_permissions_20);
                 unset($job_preset_permissions_20);
             } else {
                 Debug::Text('NOT Applying Job Permissions for Supervisor Preset', __FILE__, __LINE__, __METHOD__, 10);
             }
         case 18:
             //Supervisor (Suborindates Only), can see all schedules and shifts, and can do authorizations
             $preset_permissions_18 = array('user' => array('view_child' => TRUE, 'edit_child' => TRUE, 'edit_advanced' => TRUE, 'enroll_child' => TRUE, 'delete_child' => TRUE, 'edit_pay_period_schedule' => TRUE, 'edit_policy_group' => TRUE, 'edit_hierarchy' => TRUE), 'user_preference' => array('edit_child' => TRUE), 'recurring_schedule_template' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'recurring_schedule' => array('enabled' => TRUE, 'view_child' => TRUE, 'add' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'punch' => array('view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE, 'authorize' => TRUE), 'absence' => array('add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'accrual' => array('view_child' => TRUE, 'add' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'request' => array('view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE, 'authorize' => TRUE), 'schedule' => array('add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'authorization' => array('enabled' => TRUE, 'view' => TRUE), 'message' => array('add_advanced' => TRUE, 'send_to_child' => TRUE), 'report' => array('enabled' => TRUE, 'view_active_shift' => TRUE, 'view_user_information' => TRUE, 'view_user_detail' => TRUE, 'view_timesheet_summary' => TRUE, 'view_punch_summary' => TRUE, 'view_accrual_balance_summary' => TRUE, 'view_user_barcode' => TRUE));
             if (isset($preset_flags['job']) and $preset_flags['job'] == 1) {
                 Debug::Text('Applying Job Permissions for Supervisor Preset', __FILE__, __LINE__, __METHOD__, 10);
                 $job_preset_permissions_18 = array('job' => array('view_own' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'job_item' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'job_report' => array('enabled' => TRUE, 'view_job_summary' => TRUE, 'view_job_analysis' => TRUE, 'view_job_payroll_analysis' => TRUE, 'view_job_barcode' => TRUE));
                 $preset_permissions_18 = array_merge_recursive($preset_permissions_18, $job_preset_permissions_18);
                 unset($job_preset_permissions_18);
             } else {
                 Debug::Text('NOT Applying Job Permissions for Supervisor Preset', __FILE__, __LINE__, __METHOD__, 10);
             }
             if (isset($preset_flags['invoice']) and $preset_flags['invoice'] == 1) {
                 Debug::Text('Applying Invoice Permissions for Supervisor Preset', __FILE__, __LINE__, __METHOD__, 10);
                 $invoice_preset_permissions_18 = array('client' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'client_payment' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'transaction' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'invoice' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE));
                 $preset_permissions_18 = array_merge_recursive($preset_permissions_18, $invoice_preset_permissions_18);
                 unset($invoice_preset_permissions_18);
             } else {
                 Debug::Text('NOT Applying Invoice Permissions for Supervisor Preset', __FILE__, __LINE__, __METHOD__, 10);
             }
             if (isset($preset_flags['document']) and $preset_flags['document'] == 1) {
                 Debug::Text('Applying Document Permissions for Supervisor Preset', __FILE__, __LINE__, __METHOD__, 10);
                 $document_preset_permissions_18 = array('document' => array('add' => TRUE, 'view_private' => TRUE, 'edit' => TRUE, 'edit_private' => TRUE, 'delete' => TRUE, 'delete_private' => TRUE));
                 $preset_permissions_18 = array_merge_recursive($preset_permissions_18, $document_preset_permissions_18);
                 unset($document_preset_permissions_18);
             } else {
                 Debug::Text('NOT Applying Document Permissions for Supervisor Preset', __FILE__, __LINE__, __METHOD__, 10);
             }
         case 10:
             $preset_permissions_10 = array('system' => array('login' => TRUE), 'user' => array('enabled' => TRUE, 'view_own' => TRUE, 'edit_own' => TRUE, 'edit_own_bank' => TRUE), 'user_preference' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'pay_stub' => array('enabled' => TRUE, 'view_own' => TRUE), 'accrual' => array('enabled' => TRUE, 'view_own' => TRUE), 'request' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'schedule' => array('enabled' => TRUE, 'view_own' => TRUE), 'punch' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'verify_time_sheet' => TRUE, 'punch_in_out' => TRUE, 'edit_transfer' => TRUE, 'edit_branch' => TRUE, 'edit_department' => TRUE, 'edit_note' => TRUE, 'edit_other_id1' => TRUE, 'edit_other_id2' => TRUE, 'edit_other_id3' => TRUE, 'edit_other_id4' => TRUE, 'edit_other_id5' => TRUE), 'absence' => array('enabled' => TRUE, 'view_own' => TRUE), 'message' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'help' => array('enabled' => TRUE, 'view' => TRUE));
             if (isset($preset_flags['job']) and $preset_flags['job'] == 1) {
                 Debug::Text('Applying Job Permissions for Regular Preset', __FILE__, __LINE__, __METHOD__, 10);
                 $job_preset_permissions_10 = array('punch' => array('edit_job' => TRUE, 'edit_job_item' => TRUE, 'edit_quantity' => TRUE, 'edit_bad_quantity' => TRUE), 'job' => array('enabled' => TRUE));
                 $preset_permissions_10 = array_merge_recursive($preset_permissions_10, $job_preset_permissions_10);
                 unset($job_preset_permissions_10);
             } else {
                 Debug::Text('NOT Applying Job Permissions for Regular Preset', __FILE__, __LINE__, __METHOD__, 10);
             }
             if (isset($preset_flags['document']) and $preset_flags['document'] == 1) {
                 Debug::Text('Applying Document Permissions for Regular Preset', __FILE__, __LINE__, __METHOD__, 10);
                 $document_preset_permissions_10 = array('document' => array('enabled' => TRUE, 'view' => TRUE));
                 $preset_permissions_10 = array_merge_recursive($preset_permissions_10, $document_preset_permissions_10);
                 unset($document_preset_permissions_10);
             } else {
                 Debug::Text('NOT Applying Document Permissions for Regular Preset', __FILE__, __LINE__, __METHOD__, 10);
             }
     }
     //Merge all permissions
     $preset_permissions = array_merge_recursive($preset_permissions_10, $preset_permissions_18, $preset_permissions_20, $preset_permissions_30, $preset_permissions_40);
     //var_dump($preset_permissions);
     return $preset_permissions;
 }
 function setObjectType($id)
 {
     $id = trim($id);
     $key = Option::getByValue($id, $this->getOptions('object_type'));
     if ($key !== FALSE) {
         $type = $key;
     }
     if ($this->Validator->inArrayKey('object_type', $id, TTi18n::gettext('Object Type is invalid'), $this->getOptions('object_type')) and $this->Validator->isTrue('object_type', $this->isUniqueObjectType($id), TTi18n::gettext('Object Type is already assigned to another hierarchy'))) {
         $this->data['object_type_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
Ejemplo n.º 20
0
    function getSumByPayPeriodIdAndStatusAndBeforeDate($pay_period_id, $status, $before_date, $where = NULL, $order = NULL)
    {
        $key = Option::getByValue($status, $this->getOptions('status'));
        if ($key !== FALSE) {
            $status = $key;
        }
        $af = new AuthorizationFactory();
        $udf = new UserDateFactory();
        $uf = new UserFactory();
        $ph = array('pay_period_id' => $pay_period_id, 'status_id' => $status, 'before_date' => $this->db->BindDate($before_date));
        $query = '
					select 	count(*)
					from	' . $this->getTable() . ' as a,
							' . $udf->getTable() . ' as b
					where	a.user_date_id = b.id
						AND b.pay_period_id = ?
						AND	a.status_id = ?
						AND b.date_stamp <= ?
						AND ( a.deleted = 0 AND b.deleted = 0 )
				';
        $query .= $this->getWhereSQL($where);
        $query .= $this->getSortSQL($order);
        //$this->rs = $this->db->PageExecute($query, $limit, $page);
        $total = $this->db->GetOne($query, $ph);
        if ($total === FALSE) {
            $total = 0;
        }
        Debug::text('Total: ' . $total, __FILE__, __LINE__, __METHOD__, 10);
        return $total;
    }
 function setTimeZone($time_zone)
 {
     $time_zone = trim($time_zone);
     $key = Option::getByValue($time_zone, $this->getTimeZoneOptions());
     if ($key !== FALSE) {
         $time_zone = $key;
     }
     if ($this->Validator->inArrayKey('time_zone', $time_zone, TTi18n::gettext('Incorrect time zone'), $this->getTimeZoneOptions())) {
         $this->data['time_zone'] = $time_zone;
         return TRUE;
     }
     return FALSE;
 }
    function getByUserIdAndStatusAndType($user_id, $status, $type, $order = NULL)
    {
        if ($user_id == '') {
            return FALSE;
        }
        if ($status == '') {
            return FALSE;
        }
        if ($type == '') {
            return FALSE;
        }
        $status_key = Option::getByValue($status, $this->getOptions('status'));
        if ($status_key !== FALSE) {
            $status = $status_key;
        }
        $type_key = Option::getByValue($type, $this->getOptions('type'));
        if ($type_key !== FALSE) {
            $type = $type_key;
        }
        $ulf = new UserListFactory();
        $ulf->getById($user_id);
        if ($ulf->getRecordCount() != 1) {
            return FALSE;
        }
        $sugf = new StationUserGroupFactory();
        $sbf = new StationBranchFactory();
        $sdf = new StationDepartmentFactory();
        $siuf = new StationIncludeUserFactory();
        $seuf = new StationExcludeUserFactory();
        $uf = new UserFactory();
        $ph = array('user_id_a' => $user_id, 'company_id' => $ulf->getCurrent()->getCompany(), 'status' => $status, 'type' => $type);
        $query = '
					select 	a.*
					from 	' . $this->getTable() . ' as a
						LEFT JOIN ' . $uf->getTable() . ' as z ON z.id = ?
					where a.company_id = ?
						AND a.status_id = ?
						AND a.type_id = ?
						AND
							(
								(
									(
										a.user_group_selection_type_id = 10
											OR ( a.user_group_selection_type_id = 20 AND z.group_id in ( select b.group_id from ' . $sugf->getTable() . ' as b WHERE a.id = b.station_id ) )
											OR ( a.user_group_selection_type_id = 30 AND z.group_id not in ( select b.group_id from ' . $sugf->getTable() . ' as b WHERE a.id = b.station_id ) )
									)
									AND
									(
										a.branch_selection_type_id = 10
											OR ( a.branch_selection_type_id = 20 AND z.default_branch_id in ( select c.branch_id from ' . $sbf->getTable() . ' as c WHERE a.id = c.station_id ) )
											OR ( a.branch_selection_type_id = 30 AND z.default_branch_id not in ( select c.branch_id from ' . $sbf->getTable() . ' as c WHERE a.id = c.station_id ) )
									)
									AND
									(
										a.department_selection_type_id = 10
											OR ( a.department_selection_type_id = 20 AND z.default_department_id in ( select d.department_id from ' . $sdf->getTable() . ' as d WHERE a.id = d.station_id ) )
											OR ( a.department_selection_type_id = 30 AND z.default_department_id not in ( select d.department_id from ' . $sdf->getTable() . ' as d WHERE a.id = d.station_id ) )
									)
									AND z.id not in ( select f.user_id from ' . $seuf->getTable() . ' as f WHERE a.id = f.station_id )
								)
								OR z.id in ( select e.user_id from ' . $siuf->getTable() . ' as e WHERE a.id = e.station_id )
							)
						AND ( a.deleted = 0 AND z.deleted = 0 )
						ORDER BY lower(a.source) = \'any\' desc, lower(station_id) = \'any\' desc
						';
        //Try to order the SQL query to hit wildcard stations first.
        //$query .= $this->getSortSQL( $order, $strict );
        //Debug::text('Query: '. $query, __FILE__, __LINE__, __METHOD__, 10);
        //Debug::arr($ph, 'PH: ', __FILE__, __LINE__, __METHOD__, 10);
        $this->rs = $this->db->Execute($query, $ph);
        return $this;
    }
 function setStartWeekDay($value)
 {
     $value = trim($value);
     $upf = new UserPreferenceFactory();
     $key = Option::getByValue($value, $upf->getOptions('start_week_day'));
     if ($key !== FALSE) {
         $value = $key;
     }
     if ($this->Validator->inArrayKey('start_week_day', $value, TTi18n::gettext('Incorrect day to start a week on'), $upf->getOptions('start_week_day'))) {
         $this->data['start_week_day'] = $value;
         return FALSE;
     }
     return FALSE;
 }
 function setSecondaryTransactionDayOfMonth($val)
 {
     $val = trim($val);
     $key = Option::getByValue($val, TTDate::getDayOfMonthArray());
     if ($key !== FALSE) {
         $val = $key;
     }
     if ($val == -1 or $val == '' or $val == 0 or $this->Validator->inArrayKey('secondary_transaction_day_of_month', $val, TTi18n::gettext('Incorrect secondary transaction day of month'), TTDate::getDayOfMonthArray())) {
         $this->data['secondary_transaction_day_of_month'] = $val;
         return TRUE;
     }
     return FALSE;
 }
Ejemplo n.º 25
0
 function setAutoDetectType($value)
 {
     $value = trim($value);
     $key = Option::getByValue($value, $this->getOptions('auto_detect_type'));
     if ($key !== FALSE) {
         $value = $key;
     }
     if ($this->Validator->inArrayKey('auto_detect_type', $value, TTi18n::gettext('Incorrect Auto-Detect Type'), $this->getOptions('auto_detect_type'))) {
         $this->data['auto_detect_type_id'] = $value;
         return FALSE;
     }
     return FALSE;
 }
Ejemplo n.º 26
0
    function getLastEntryByUserIdAndActionAndTable($user_id, $action, $table_name)
    {
        if ($user_id == '') {
            return FALSE;
        }
        if ($action == '') {
            return FALSE;
        }
        if ($table_name == '') {
            return FALSE;
        }
        $action_key = Option::getByValue($action, $this->getOptions('action'));
        if ($action_key !== FALSE) {
            $action = $action_key;
        }
        $ph = array('user_id' => $user_id, 'table_name' => $table_name, 'action_id' => $action);
        $query = '
					select 	*
					from	' . $this->getTable() . '
					where	user_id = ?
						AND table_name = ?
						AND action_id = ?
					ORDER BY date desc
					LIMIT 1
					';
        //$query .= $this->getWhereSQL( $where );
        //$query .= $this->getSortSQL( $order );
        $this->ExecuteSQL($query, $ph);
        return $this;
    }
Ejemplo n.º 27
0
    function getByScriptNameAndStatus($script_name, $status, $where = NULL, $order = NULL)
    {
        if ($script_name == '') {
            return FALSE;
        }
        if ($status == '') {
            return FALSE;
        }
        $status_key = Option::getByValue($status, $this->getOptions('status'));
        if ($status_key !== FALSE) {
            $status = $status_key;
        }
        $hgcf = new HelpGroupControlFactory();
        $hg = new HelpGroupFactory();
        $ph = array('script_name' => $script_name, 'status_id' => $status);
        $query = '
					select 	a.*, b.name as group_name
					from	' . $this->getTable() . ' as a,
							' . $hgcf->getTable() . ' as b,
							' . $hg->getTable() . ' as c
					where	b.id = c.help_group_control_id
							AND c.help_id = a.id
							AND b.script_name = ?
							AND a.status_id = ?
							AND a.deleted=0
							AND b.deleted=0
					ORDER BY a.type_id desc, c.order_value asc
						';
        $query .= $this->getWhereSQL($where);
        $query .= $this->getSortSQL($order);
        $this->ExecuteSQL($query, $ph);
        return $this;
    }
Ejemplo n.º 28
0
 function getPresetPermissions($preset, $preset_flags = array())
 {
     $key = Option::getByValue($preset, $this->getOptions('preset'));
     if ($key !== FALSE) {
         $preset = $key;
     }
     $preset_flags[] = 0;
     //Always add system presets.
     asort($preset_flags);
     Debug::Text('Preset: ' . $preset, __FILE__, __LINE__, __METHOD__, 10);
     Debug::Arr($preset_flags, 'Preset Flags... ', __FILE__, __LINE__, __METHOD__, 10);
     if (!isset($preset) or $preset == '' or $preset == -1) {
         Debug::Text('No Preset set... Skipping!', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     $preset_permissions = array(10 => array(0 => array('system' => array('login' => TRUE), 'user' => array('enabled' => TRUE, 'view_own' => TRUE, 'edit_own' => TRUE, 'edit_own_password' => TRUE, 'edit_own_phone_password' => TRUE), 'user_preference' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'request' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'message' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'help' => array('enabled' => TRUE, 'view' => TRUE)), 10 => array('schedule' => array('enabled' => TRUE, 'view_own' => TRUE), 'accrual' => array('enabled' => TRUE, 'view_own' => TRUE), 'absence' => array('enabled' => TRUE, 'view_own' => TRUE)), 20 => array('punch' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'verify_time_sheet' => TRUE, 'punch_in_out' => TRUE, 'edit_transfer' => TRUE, 'edit_branch' => TRUE, 'edit_department' => TRUE, 'edit_note' => TRUE, 'edit_other_id1' => TRUE, 'edit_other_id2' => TRUE, 'edit_other_id3' => TRUE, 'edit_other_id4' => TRUE, 'edit_other_id5' => TRUE), 'accrual' => array('enabled' => TRUE, 'view_own' => TRUE), 'absence' => array('enabled' => TRUE, 'view_own' => TRUE)), 30 => array('user' => array('enabled' => TRUE, 'edit_own_bank' => TRUE), 'pay_stub' => array('enabled' => TRUE, 'view_own' => TRUE)), 40 => array('punch' => array('edit_job' => TRUE, 'edit_job_item' => TRUE, 'edit_quantity' => TRUE, 'edit_bad_quantity' => TRUE), 'job' => array('enabled' => TRUE)), 50 => array('document' => array('enabled' => TRUE, 'view' => TRUE)), 60 => array(), 70 => array(), 75 => array(), 80 => array('user_expense' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'delete_own' => TRUE))), 12 => array(20 => array('punch' => array('edit_own' => TRUE, 'delete_own' => TRUE), 'absence' => array('add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE))), 18 => array(0 => array('user' => array('add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'edit_advanced' => TRUE, 'enroll_child' => TRUE, 'delete_child' => TRUE, 'edit_pay_period_schedule' => TRUE, 'edit_permission_group' => TRUE, 'edit_policy_group' => TRUE, 'edit_hierarchy' => TRUE), 'user_preference' => array('view_child' => TRUE, 'edit_child' => TRUE), 'request' => array('view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE, 'authorize' => TRUE), 'authorization' => array('enabled' => TRUE, 'view' => TRUE), 'message' => array('add_advanced' => TRUE, 'send_to_child' => TRUE), 'report' => array('enabled' => TRUE, 'view_user_information' => TRUE, 'view_user_detail' => TRUE, 'view_user_barcode' => TRUE), 'report_custom_column' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE)), 10 => array('schedule' => array('add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE, 'edit_branch' => TRUE, 'edit_department' => TRUE), 'recurring_schedule_template' => array('enabled' => TRUE, 'view_own' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'recurring_schedule' => array('enabled' => TRUE, 'view_child' => TRUE, 'add' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'absence' => array('add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE, 'edit_branch' => TRUE, 'edit_department' => TRUE), 'accrual' => array('add' => TRUE, 'view_child' => TRUE, 'edit_own' => FALSE, 'edit_child' => TRUE, 'delete_own' => FALSE, 'delete_child' => TRUE), 'report' => array('view_schedule_summary' => TRUE, 'view_accrual_balance_summary' => TRUE)), 20 => array('punch' => array('view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE, 'authorize' => TRUE), 'absence' => array('add' => TRUE, 'view_child' => TRUE, 'edit_own' => FALSE, 'edit_child' => TRUE, 'edit_branch' => TRUE, 'edit_department' => TRUE, 'delete_own' => FALSE, 'delete_child' => TRUE), 'accrual' => array('view_child' => TRUE, 'add' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'report' => array('view_active_shift' => TRUE, 'view_timesheet_summary' => TRUE, 'view_punch_summary' => TRUE, 'view_exception_summary' => TRUE, 'view_accrual_balance_summary' => TRUE)), 30 => array(), 40 => array('schedule' => array('edit_job' => TRUE, 'edit_job_item' => TRUE), 'absence' => array('edit_job' => TRUE, 'edit_job_item' => TRUE), 'job' => array('add' => TRUE, 'view_own' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'job_item' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'job_report' => array('enabled' => TRUE, 'view_job_summary' => TRUE, 'view_job_analysis' => TRUE, 'view_job_payroll_analysis' => TRUE, 'view_job_barcode' => TRUE)), 50 => array('document' => array('add' => TRUE, 'view_private' => TRUE, 'edit' => TRUE, 'edit_private' => TRUE, 'delete' => TRUE, 'delete_private' => TRUE)), 60 => array('client' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'client_payment' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'transaction' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'invoice' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE)), 70 => array('user_contact' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'qualification' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'user_education' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'user_license' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'user_skill' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'user_membership' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'user_language' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'kpi' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'user_review' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'hr_report' => array('enabled' => TRUE, 'user_qualification' => TRUE, 'user_review' => TRUE)), 75 => array('job_vacancy' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'job_applicant' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'job_application' => array('enabled' => TRUE, 'add' => TRUE, 'view_child' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE), 'recruitment_report' => array('enabled' => TRUE, 'user_recruitment' => TRUE)), 80 => array('user_expense' => array('view_child' => TRUE, 'add' => TRUE, 'edit_child' => TRUE, 'delete_child' => TRUE, 'authorize' => TRUE))), 20 => array(0 => array('user' => array('view' => TRUE, 'edit' => TRUE, 'enroll' => TRUE, 'delete' => TRUE), 'user_preference' => array('view' => TRUE, 'edit' => TRUE), 'request' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'message' => array('send_to_any' => TRUE)), 10 => array('schedule' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'recurring_schedule_template' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'recurring_schedule' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'absence' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'accrual' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE)), 20 => array('punch' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'absence' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE, 'edit_own' => TRUE, 'delete_own' => TRUE), 'accrual' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE)), 30 => array(), 40 => array('job' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'job_item' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE)), 50 => array(), 60 => array(), 70 => array('user_contact' => array('add' => TRUE, 'view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'qualification' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'user_education' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'user_license' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'user_skill' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'user_membership' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'user_language' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'kpi' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'user_review' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE)), 75 => array('job_vacancy' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'job_applicant' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'job_application' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE)), 80 => array('user_expense' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE))), 25 => array(0 => array(), 10 => array(), 20 => array(), 30 => array(), 40 => array(), 50 => array(), 60 => array(), 70 => array('qualification' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE)), 75 => array(), 80 => array()), 30 => array(0 => array('company' => array('enabled' => TRUE, 'view_own' => TRUE, 'edit_own' => TRUE, 'edit_own_bank' => TRUE), 'user' => array('add' => TRUE, 'edit_bank' => TRUE, 'view_sin' => TRUE), 'wage' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'pay_period_schedule' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE, 'assign' => TRUE), 'report' => array('view_system_log' => TRUE, 'view_employee_summary' => TRUE)), 10 => array(), 20 => array(), 30 => array('user_tax_deduction' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'roe' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'company_tax_deduction' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'pay_stub_account' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'pay_stub' => array('view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'pay_stub_amendment' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'report' => array('view_pay_stub_summary' => TRUE, 'view_payroll_export' => TRUE, 'view_remittance_summary' => TRUE, 'view_wages_payable_summary' => TRUE, 'view_t4_summary' => TRUE, 'view_generic_tax_summary' => TRUE, 'view_form941' => TRUE, 'view_form940' => TRUE, 'view_form940ez' => TRUE, 'view_form1099misc' => TRUE, 'view_formW2' => TRUE, 'view_affordable_care' => TRUE, 'view_general_ledger_summary' => TRUE)), 40 => array(), 50 => array(), 60 => array('product' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'tax_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'shipping_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'area_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'payment_gateway' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'invoice_report' => array('enabled' => TRUE, 'view_transaction_summary' => TRUE)), 70 => array(), 75 => array(), 80 => array('report' => array('view_expense' => TRUE))), 40 => array(0 => array('user' => array('timeclock_admin' => TRUE), 'policy_group' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'schedule_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'meal_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'break_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'over_time_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'premium_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'accrual_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'absence_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'round_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'exception_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'holiday_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'round_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'currency' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'branch' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'department' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE, 'assign' => TRUE), 'station' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE, 'assign' => TRUE), 'report' => array(), 'hierarchy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'other_field' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'permission' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE), 'report_custom_column' => array('view' => TRUE, 'edit' => TRUE, 'delete' => TRUE)), 10 => array(), 20 => array(), 30 => array(), 40 => array(), 50 => array(), 60 => array('invoice_config' => array('enabled' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE)), 70 => array(), 75 => array(), 80 => array('expense_policy' => array('enabled' => TRUE, 'view' => TRUE, 'add' => TRUE, 'edit' => TRUE, 'delete' => TRUE))));
     $retarr = array();
     //Loop over each preset adding the permissions together for that preset and the role that is selected.
     $preset_options = array_keys(Misc::trimSortPrefix($this->getOptions('preset')));
     if (is_array($preset_options)) {
         foreach ($preset_options as $preset_option) {
             if (isset($preset_permissions[$preset_option]) and $preset_option <= $preset) {
                 foreach ($preset_flags as $preset_flag) {
                     if (isset($preset_permissions[$preset_option][$preset_flag])) {
                         Debug::Text('Applying Preset: ' . $preset_option . ' Preset Flag: ' . $preset_flag, __FILE__, __LINE__, __METHOD__, 10);
                         $retarr = Misc::arrayMergeRecursive($retarr, $preset_permissions[$preset_option][$preset_flag]);
                     }
                 }
             }
         }
     }
     return $retarr;
 }
Ejemplo n.º 29
0
 function setCode($value)
 {
     $value = trim($value);
     $key = Option::getByValue($value, $this->getOptions('code'));
     if ($key !== FALSE) {
         $value = $key;
     }
     if ($this->Validator->inArrayKey('code_id', $value, TTi18n::gettext('Incorrect code'), $this->getOptions('code'))) {
         $this->data['code_id'] = $value;
         return FALSE;
     }
     return FALSE;
 }
 function preSave()
 {
     //Check the locale, if its not english, we need to make sure the selected dateformat is correct for the language, or else force it.
     if ($this->getLanguage() != 'en') {
         if (Option::getByValue($this->getDateFormat(), $this->getOptions('other_date_format')) == FALSE) {
             //Force a change of date format
             $this->setDateFormat('d/m/Y');
             Debug::text('Language changed and date format doesnt match any longer, forcing it to: d/m/Y', __FILE__, __LINE__, __METHOD__, 10);
         } else {
             Debug::text('Date format doesnt need fixing...', __FILE__, __LINE__, __METHOD__, 10);
         }
     }
     return TRUE;
 }