perbaikan bug global loading HR dan Payroll

This commit is contained in:
Wian Drs
2026-09-14 12:05:53 +07:00
parent 63993ee76e
commit 5e1fd11410
9 changed files with 153 additions and 66 deletions
+33 -41
View File
@@ -407,75 +407,64 @@ class Employees extends MY_Controller {
// =========================================================
private function prepareData()
{
$nullableText = function ($value) {
$value = trim((string) $value);
return $value === '' || in_array(strtolower($value), array('undefined', 'null'), true)
? null
: $value;
};
$nullableId = function ($value) {
$value = (int) $value;
return $value > 0 ? $value : null;
};
$data = [
'nik' => trim($this->input->post('nik')),
'nik' => $nullableText($this->input->post('nik')),
'full_name' => trim(
$this->input->post('full_name')
),
'gender' => $this->input->post('gender'),
'gender' => $nullableText($this->input->post('gender')),
'birth_place' => trim(
$this->input->post('birth_place')
),
'birth_place' => $nullableText($this->input->post('birth_place')),
'birth_date' => $this->input->post('birth_date'),
'birth_date' => $nullableText($this->input->post('birth_date')),
'phone' => trim(
$this->input->post('phone')
),
'phone' => $nullableText($this->input->post('phone')),
'email' => trim(
$this->input->post('email')
),
'email' => $nullableText($this->input->post('email')),
'address' => trim(
$this->input->post('address')
),
'address' => $nullableText($this->input->post('address')),
'join_date' => $this->input->post('join_date'),
'resign_date' => $this->input->post('resign_date'),
'resign_date' => $nullableText($this->input->post('resign_date')),
'employment_status' => $this->input->post('employment_status'),
'marital_status' => $this->input->post('marital_status'),
'religion' => trim(
$this->input->post('religion')
),
'religion' => $nullableText($this->input->post('religion')),
'department_id' => $this->input->post('department_id'),
'department_id' => $nullableId($this->input->post('department_id')),
'position_id' => $this->input->post('position_id'),
'position_id' => $nullableId($this->input->post('position_id')),
'branch_id' => $this->input->post('branch_id'),
'branch_id' => $nullableId($this->input->post('branch_id')),
'bank_name' => trim(
$this->input->post('bank_name')
),
'bank_name' => $nullableText($this->input->post('bank_name')),
'bank_account_number' => trim(
$this->input->post('bank_account_number')
),
'bank_account_number' => $nullableText($this->input->post('bank_account_number')),
'bank_account_name' => trim(
$this->input->post('bank_account_name')
),
'bank_account_name' => $nullableText($this->input->post('bank_account_name')),
'bpjs_kesehatan_number' => trim(
$this->input->post('bpjs_kesehatan_number')
),
'bpjs_kesehatan_number' => $nullableText($this->input->post('bpjs_kesehatan_number')),
'bpjs_ketenagakerjaan_number' => trim(
$this->input->post('bpjs_ketenagakerjaan_number')
),
'bpjs_ketenagakerjaan_number' => $nullableText($this->input->post('bpjs_ketenagakerjaan_number')),
'fingerprint_user_id' => trim(
$this->input->post('fingerprint_user_id')
),
'fingerprint_user_id' => $nullableText($this->input->post('fingerprint_user_id')),
'is_active' => $this->input->post('is_active') === '0' ? 0 : 1
];
@@ -492,7 +481,10 @@ class Employees extends MY_Controller {
private function canEmployee($action)
{
return is_master_admin_user() || check_permission('hr_employees',$action) || check_permission('employees',$action);
return $this->session->userdata('role') === 'Admin'
|| is_master_admin_user()
|| check_permission('hr_employees',$action)
|| check_permission('employees',$action);
}
private function maskRestrictedSalary($employee)