How i can edit in fields on employee list [SOLVED]

Discuss about how to use OrangeHRM
Post Reply
kw3rln
Posts: 4
Joined: Sun May 16, 2021 6:41 pm

How i can edit in fields on employee list [SOLVED]

Post by kw3rln » Sun May 16, 2021 6:49 pm

i want to change last 2 :

$header6->populateFromArray(array(
'name' => 'Sub Unit',
'width' => '15%',
'isSortable' => true,
'sortField' => 'SubDivision',
'elementType' => 'label',
'textAlignmentStyle' => 'left',
'elementProperty' => array('getter' => 'getSubDivision')
));

$header7->populateFromArray(array(
'name' => 'Supervisor',
'width' => '25%',
'isSortable' => true,
'sortField' => 'supervisor',
'elementType' => 'label',
'textAlignmentStyle' => 'left',
'elementProperty' => array('getter' => 'getSupervisorNames')

to getStartDate and getEndDate contract .. I tried in every way but with error .. what i need to edit to get the result ?

with 'elementProperty' => array('getter' => 'getStartDate ') not working ..

Thanks

rajitha
Posts: 48
Joined: Tue Feb 11, 2020 9:54 am

Re: How i can edit in fields on employee list [SOLVED]

Post by rajitha » Tue May 18, 2021 4:25 am

Hi
You may need to modify symfony/lib/model/doctrine/orangehrmPimPlugin/Employee.class.php and add whatever your method to get dates.
If you want to call deep attribute of an entity call like this (this is only example)

Code: Select all

with 'elementProperty' => array('getter' => array('getContract', 'getStartDate ')) 
if you are getting array of elements you may need to prepare as string,
find the example at symfony/lib/model/doctrine/orangehrmPimPlugin/Employee.class.php method getSupervisorNames

kw3rln
Posts: 4
Joined: Sun May 16, 2021 6:41 pm

Re: How i can edit in fields on employee list [SOLVED]

Post by kw3rln » Fri May 21, 2021 8:23 pm

i solved with this code:

public function getLastContractStartDate() {
if($this->getEmpNumber() != "") {
$contracts = $this->getEmployeeService()->getEmployee($this->getEmpNumber())->getContracts();
return str_replace('00:00:00','',$contracts[count($contracts) -1]->getStartDate());
}
return '';
}

public function getLastContractEndDate() {
if($this->getEmpNumber() != "") {
$contracts = $this->getEmployeeService()->getEmployee($this->getEmpNumber())->getContracts();
return str_replace('00:00:00','',$contracts[count($contracts) -1]->getEndDate());
}
return '';
}
}

but now i want to change date : yyyy-mm-dd to dd-mm-yyyy .. with default settings not work..

Post Reply