Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
T Timetrex
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Matthew Chavez
  • Timetrex
  • Wiki
  • Add Request

Last edited by matte0 Jun 25, 2021
Page history

Add Request

Add Timetrex Request

To add a request types in the Timetrex system.

  1. Open the payroll/classes/modules/hierarchy/AuthorizationFactory.class.php path.
  2. Add the new item to the switch statement.
	function _getFactoryOptions( $name ) {
		$retval = NULL;
		switch( $name ) {
			case 'object_type':
				$retval = array(
							90 => 'timesheet',
							200 => 'expense',
							1010 => 'request_punch',
							1045 => 'request_vacation_leave',
							1046 => 'request_sick_leave',
							1047 => 'request_call_approval',
							1048 => 'request_maternity_leave',
							1049 => 'request_paternity_leave',
							1052 => 'request_under_time',
							1053 => 'request_over_time',
							1056 => 'request_solo_parent_leave',
							1057 => 'request_shift_change',
							1061 => 'request_payroll_adjustment',
							1062 => 'request_emergency_leave',
							1063 => 'request_service_incentive_leave',
                            // ADD NEW REQUEST HERE WITH THE NEW ID
							// 1064 => 'request_new_requestName_here',
						);
				break;
			case 'columns':
				$retval = array(
         				'-1010-created_by' => TTi18n::gettext('Name'),
         				'-1020-created_date' => TTi18n::gettext('Date'),
         				'-1030-authorized' => TTi18n::gettext('Authorized',
                     	);
				break;
			case 'list_columns':
				$retval = Misc::arrayIntersectByKey( $this->getOptions('default_display_columns'), Misc::trimSortPrefix( $this->getOptions('columns') ) );
				break;
			case 'default_display_columns': 
				$retval = array(
      					'created_by',
      					'created_date',
      					'authorized',
      					);
				break;
			case 'unique_columns':
				$retval = array();
				break;
			case 'linked_columns':
				$retval = array();
				break;
		}
		return $retval;
	}

below the lines of the same file. Search for this function then add the case number according to the new ID.

	function getObjectHandler() {
		if ( is_object($this->obj_handler) ) {
			return $this->obj_handler;
		} else {
			switch ( $this->getObjectType() ) {
				case 90:
					$this->obj_handler = TTnew( 'PayPeriodTimeSheetVerifyListFactory' );
					break;
				case 200:
					$this->obj_handler = TTnew( 'UserExpenseListFactory' );
					break;
				case 50:
				case 1010:
				case 1045:
				case 1046:
				case 1047: 
				case 1048: 
				case 1049: 
				case 1052: 
				case 1053: 
				case 1057:
				case 1061:
				case 1062:
				case 1063:
				// case 1064: // ADD THE NEW CASE ID HERE
					$this->obj_handler = TTnew( 'RequestListFactory' );
					break;
			}
			return $this->obj_handler;
		}
	}
  1. Open the payroll/classes/modules/hierarchy/HierarchyObjectTypeFactory.class.php
  2. Add the new items to the switch statement
	function _getFactoryOptions( $name ) {
		//Attempt to get the edition of the currently logged in users company, so we can better tailor the columns to them.
		$product_edition_id = Misc::getCurrentCompanyProductEdition();
		$retval = NULL;
		switch( $name ) {
			case 'object_type':
				$retval = array(
							1010 => TTi18n::gettext('Request: Missed Punch'),
							1045 => TTi18n::gettext('Request: Vacation Leave'),
							1046 => TTi18n::gettext('Request: Sick Leave'),
							1047 => TTi18n::gettext('Request: Call Approval'),
							1048 => TTi18n::gettext('Request: Maternity Leave',
							1049 => TTi18n::gettext('Request: Paternity Leave',
							1052 => TTi18n::gettext('Request: Undertime'),
							1053 => TTi18n::gettext('Request: Overtime'),
							1054 => TTi18n::gettext('Request: Offset'),
							1056 => TTi18n::gettext('Request: Solo Parent Leave'),
							1057 => TTi18n::gettext('Request: Shift Change'),
							1061 => TTi18n::gettext('Request: Payroll Adjustment'),
							1062 => TTi18n::gettext('Request: Emergency Leave'),
							1063 => TTi18n::gettext('Request: Service Incentive Leave'),
							// 1064 => TTi18n::gettext('Request: New Request Here'),
							80 => TTi18n::gettext('Exception'),
							90 => TTi18n::gettext('TimeSheet'),
							100 => TTi18n::gettext('Permission'),
						);
				if ( $product_edition_id >= 25 ) {
					$retval[200] = TTi18n::gettext('Expense');
				}
				break;
			case 'short_object_type':
				$retval = array(
							1010 => TTi18n::gettext('R:Missed Punch'),
							1045 => TTi18n::gettext('R:Vacation Leave'),
							1046 => TTi18n::gettext('R:Sick Leave'),
							1047 => TTi18n::gettext('R:Call Approval'),
							1048 => TTi18n::gettext('R:Maternity Leave'),
							1049 => TTi18n::gettext('R:Paternity Leave'),
							1052 => TTi18n::gettext('R:Undertime'),
							1053 => TTi18n::gettext('R:Overtime'),
							1054 => TTi18n::gettext('R:Offset'),
							1056 => TTi18n::gettext('R:Solo Parent Leave'),
							1057 => TTi18n::gettext('R:Shift Change'),
							1061 => TTi18n::gettext('R:Payroll Adjustment'),
							1062 => TTi18n::gettext('R:Emergency Leave'),
							1063 => TTi18n::gettext('R:Request Service Incentive Leave'),
							// 1063 => TTi18n::gettext('R:New Request Here'),
							80 => TTi18n::gettext('Exception'),
							90 => TTi18n::gettext('TimeSheet'),
							100 => TTi18n::gettext('Permission'),
							200 => TTi18n::gettext('Expense'),
						);
				break;
		}
		return $retval;
	}
  1. Open the payroll/classes/modules/request/RequestFactory.class.php.
  2. Add the new items to the switch statement
function _getFactoryOptions( $name ) {
		$retval = NULL;
		switch( $name ) {
			case 'type':
				$retval = array(
							10 => TTi18n::gettext('Missed Punch'),
							45 => TTi18n::gettext('Vacation Leave'),
							46 => TTi18n::gettext('Sick Leave'),
							47 => TTi18n::gettext('Call Approval'),
							48 => TTi18n::gettext('Maternity Leave'),
							49 => TTi18n::gettext('Paternity Leave'),
							52 => TTi18n::gettext('Undertime'),
							53 => TTi18n::gettext('Overtime'),
							54 => TTi18n::gettext('Offset'),
							56 => TTi18n::gettext('Solo Parent Leave'),
							57 => TTi18n::gettext('Shift Change'),
							61 => TTi18n::gettext('Payroll Adjustment'),
							62 => TTi18n::gettext('Emergency Leave'),
							63 => TTi18n::gettext('Service Incentive Leave'),
							// 64 => TTi18n::gettext('New Request Here'),
						);
				break;
			case 'status':
				$retval = array(
							10 => TTi18n::gettext('INCOMPLETE'),
							20 => TTi18n::gettext('OPEN'),
							30 => TTi18n::gettext('PENDING'),
							40 => TTi18n::gettext('AUTHORIZATION OPEN'),
							50 => TTi18n::gettext('AUTHORIZED'), 
							55 => TTi18n::gettext('DECLINED'), 
							60 => TTi18n::gettext('DISABLED')
						);
				break;
			case 'columns':
				$retval = array(
							'-1010-first_name' => TTi18n::gettext('First Name'),
							'-1020-last_name' => TTi18n::gettext('Last Name'),
							'-1060-title' => TTi18n::gettext('Title'),
							'-1070-user_group' => TTi18n::gettext('Group'),
							'-1080-default_branch' => TTi18n::gettext('Branch'),
							'-1090-default_department' => TTi18n::gettext('Department'),
							'-1110-date_stamp' => TTi18n::gettext('Date'),
							'-1120-status' => TTi18n::gettext('Status'),
							'-1130-type' => TTi18n::gettext('Type'),
							'-1140-body' => TTi18n::gettext('Reason/Message'), 
							'-1150-approved_date' => TTi18n::gettext('Date Approved'),
							'-1160-approver_name' => TTi18n::gettext('Approved by'),
							'-2000-created_by' => TTi18n::gettext('Created By'),
							'-2010-created_date' => TTi18n::gettext('Created Date'),
							'-2020-updated_by' => TTi18n::gettext('Updated By'),
         				);
				break;
			case 'list_columns':
				$retval = Misc::arrayIntersectByKey( array('date_stamp', 'status', 'type'), Misc::trimSortPrefix( $this->getOptions('columns') ) );
				break;
			case 'default_display_columns': 
				$retval = array(
         					'first_name',
         					'last_name',
         					'type',
         					'date_stamp',
         					'status',
         					);
				break;
			case 'unique_columns': 
				$retval = array();
				break;
			case 'linked_columns': 
				$retval = array();
				break;
		}
		return $retval;
	}
  1. Open the payroll/classes/modules/core/AuthorizationFactory.class.php
  2. Add the new items to the switch statement
function _getFactoryOptions( $name ) {

		$retval = NULL;
		switch( $name ) {
			case 'object_type':
				$retval = array(
										90 => 'timesheet',
										200 => 'expense',
										1010 => 'request_punch',
										1045 => 'request_vacation_leave',
										1046 => 'request_sick_leave',
										1047 => 'request_call_approval',
										1048 => 'request_maternity_leave',
										1049 => 'request_paternity_leave',
										1052 => 'request_undertime',
										1053 => 'request_overtime',
										1054 => 'request_offset',
										1056 => 'solo_parent_leave',
										1057 => 'shift_change',
										1061 => 'request_payroll_adjustment',
										1062 => 'request_emergency_leave',
										1063 => 'request_service_incentive_leave',
										// 1064 => 'new_request_here',
									);
				break;
			case 'columns':
				$retval = array(
							'-1010-created_by' => TTi18n::gettext('Name'),
							'-1020-created_date' => TTi18n::gettext('Date'),
							'-1030-authorized' => TTi18n::gettext('Authorized'),
							);
				break;
			case 'list_columns':
				$retval = Misc::arrayIntersectByKey( $this->getOptions('default_display_columns'), Misc::trimSortPrefix( $this->getOptions('columns') ) );
				break;
			case 'default_display_columns': 
				$retval = array(
								'created_by',
								'created_date',
								'authorized',
								);
				break;
			case 'unique_columns': 
				$retval = array();
				break;
			case 'linked_columns': 
				$retval = array();
				break;
		}
		return $retval;
	}

Below the lines of the same file. Search for this function then add the case number according to the new ID.

	function getObjectHandler() {
		if ( is_object($this->obj_handler) ) {
			return $this->obj_handler;
		} else {
			switch ( $this->getObjectType() ) {
				case 90:
					$this->obj_handler = TTnew( 'PayPeriodTimeSheetVerifyListFactory' );
					break;
				case 200:
					$this->obj_handler = TTnew( 'UserExpenseListFactory' );
					break;
				case 1010:
				case 1045:
				case 1046:
				case 1047: 
				case 1048: 
				case 1049: 
				case 1052: 
				case 1053: 
				case 1054:
				case 1056:
				case 1057:
				case 1061:
				case 1062:
				case 1063:
				// case 1064: // New request id here
				case 1100:
					$this->obj_handler = TTnew( 'RequestListFactory' );
					break;
			}
			return $this->obj_handler;
		}
	}

Important Reminder:

The 2 files content:

  • payroll/classes/modules/hierarchy/AuthorizationFactory.class.php
  • payroll/classes/modules/core/AuthorizationFactory.class.php

Are almost identical so it is advisable to double check this files if both switches codes have been modified else the request will show in the drop down but will fail to be filed.

Clone repository
  • Add Request
  • Home