update import member
This commit is contained in:
@@ -1040,10 +1040,11 @@ class MemberEnrollmentService
|
|||||||
$division_id = $division->id;
|
$division_id = $division->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Bisa disini penyebab data dobel
|
// Bisa disini penyebab data dobel
|
||||||
$member->employeds()->updateOrCreate([
|
$member->employeds()->updateOrCreate([
|
||||||
'division_id' => $division_id
|
'member_id' => $member->id
|
||||||
], [
|
],[
|
||||||
'corporate_id' => $corporate->id,
|
'corporate_id' => $corporate->id,
|
||||||
'branch_code' => $row['branch_code'],
|
'branch_code' => $row['branch_code'],
|
||||||
'division_id' => $division_id ?? null,
|
'division_id' => $division_id ?? null,
|
||||||
@@ -1186,8 +1187,87 @@ class MemberEnrollmentService
|
|||||||
'sKTP' => $row['nric'] ?? null,
|
'sKTP' => $row['nric'] ?? null,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$name = explode(" ", $row['name']);
|
||||||
|
// First name
|
||||||
|
$first_name = isset($name[0]) ? $name[0] : '';
|
||||||
|
// Middle name
|
||||||
|
$middle_name = isset($name[1]) ? $name[1] : '';
|
||||||
|
// Last name
|
||||||
|
$last_name = '';
|
||||||
|
if (count($name) > 2) {
|
||||||
|
$last_name = implode(" ", array_slice($name, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($row['relationship_with_principal'] == 'H') {
|
||||||
|
$sMartialStatus = 6;
|
||||||
|
$nIDHubunganKeluarga = 3;
|
||||||
|
} else if ($row['relationship_with_principal'] == 'W') {
|
||||||
|
$sMartialStatus = 7;
|
||||||
|
$nIDHubunganKeluarga = 4;
|
||||||
|
} else if ($row['relationship_with_principal'] == 'S') {
|
||||||
|
$sMartialStatus = 4;
|
||||||
|
$nIDHubunganKeluarga = 5;
|
||||||
|
} else if ($row['relationship_with_principal'] == 'D') {
|
||||||
|
$sMartialStatus = 5;
|
||||||
|
$nIDHubunganKeluarga = 5;
|
||||||
|
} else {
|
||||||
|
$sMartialStatus = 0;
|
||||||
|
$nIDHubunganKeluarga = 0;
|
||||||
|
}
|
||||||
|
if ($row['sex'] == 'M') {
|
||||||
|
$nIDJenisKelamin = 1;
|
||||||
|
} else {
|
||||||
|
$nIDJenisKelamin = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$userLms = User::updateOrCreate(
|
||||||
|
[
|
||||||
|
'sPhone' => $row['telephone_mobile'],
|
||||||
|
'sEmail' => str_replace(' ', '', $row['email']),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'sFirstName' => $first_name,
|
||||||
|
'sLastName' => $middle_name . ' ' . $last_name, // Ubah ini dengan variabel yang sesuai dengan nama belakang (last name)
|
||||||
|
'sPhone' => $row['telephone_mobile'],
|
||||||
|
'sEmail' => str_replace(' ', '', $row['email']),
|
||||||
|
'nIDHubunganKeluarga' => $nIDHubunganKeluarga !== 0 ? $nIDHubunganKeluarga : null,
|
||||||
|
'dUpdateOn' => date('Y-m-d H:i:s'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$nIDUser = $userLms->nID;
|
||||||
|
$userLmsDetail = UserDetail::updateOrCreate(
|
||||||
|
['nIDUser' => $nIDUser],
|
||||||
|
[
|
||||||
|
'nIDUser' => $nIDUser,
|
||||||
|
// 'dTanggalLahir' => $row['date_of_birth'],
|
||||||
|
'dTanggalLahir' => $this->dateParser($row['date_of_birth']),
|
||||||
|
'dCreateOn' => date('Y-m-d H:i:s'),
|
||||||
|
'sMartialStatus' => $sMartialStatus != 0 ? $sMartialStatus : null,
|
||||||
|
'nIDJenisKelamin' => $nIDJenisKelamin,
|
||||||
|
'sCreateBy' => $nIDUser,
|
||||||
|
'sKTP' => $row['nric'] ?? null,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
UserInsurance::updateOrCreate(
|
||||||
|
['nIDUser' => $nIDUser],
|
||||||
|
[
|
||||||
|
'nIDInsurance' => 106,
|
||||||
|
'sNamaPeserta' => $row['name'],
|
||||||
|
'dStartDate' => $row['member_effective_date'],
|
||||||
|
'dExpireDate' => $row['member_expiry_date'],
|
||||||
|
'dTanggalLahir' => $row['date_of_birth'] ? $this->dateParser($row['date_of_birth']) : null,
|
||||||
|
'sNoPolis' => $row['member_id'],
|
||||||
|
'sVerificationCode' => (string) Uuid::uuid5(Uuid::NAMESPACE_DNS, $row['member_id'])
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!$memberPolicy) {
|
if (!$memberPolicy) {
|
||||||
throw new ImportRowException(__('enrollment.MEMBER_NOT_EXISTS', [
|
throw new ImportRowException(__('enrollment.MEMBER_NOT_EXISTS', [
|
||||||
'member_id' => $row['member_id'],
|
'member_id' => $row['member_id'],
|
||||||
|
|||||||
Reference in New Issue
Block a user