update requst dan final log

This commit is contained in:
2023-11-29 14:18:35 +07:00
parent a04153fa2a
commit a208d5f11e
43 changed files with 6756 additions and 47 deletions

View File

@@ -581,6 +581,7 @@ class MemberEnrollmentService
"telephone_mobile" => $row['telephone_mobile'] ?? null,
"telephone_res" => $row['telephone_res'] ?? null,
"telephone_office" => $row['telephone_office'] ?? null,
"suspended" => $row['member_suspended'] ?? null,
];
// $this->validateRow($row);
if (!isset($corporate->currentPolicy) || $corporate->currentPolicy->code != $row['policy_number']) {
@@ -895,46 +896,46 @@ class MemberEnrollmentService
// }
// Update plan
$plans = explode(",",$row['plan_id']);
if (count($plans) > 0) {
foreach($plans as $d){
$plan = Plan::query()
->where('code', $d)
->where('corporate_id', $corporate->id)
->first();
if (!$plan) {
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
}
$member->memberPlans()->updateOrCreate([
'member_id' => $member->id,
'plan_id' => $plan->id,
],
[
'plan_id' => $plan->id,
'status' => 'active',
'start' => $this->dateParser($row['member_effective_date']),
'end' => $this->dateParser($row['member_expiry_date']),
]);
}
} else {
$plan = Plan::query()
->where('code', $row['plan_id'])
->where('corporate_id', $corporate->id)
->first();
if (!$plan) {
throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
}
$member->memberPlans()->updateOrCreate([
'member_id' => $member->id,
'plan_id' => $plan->id,
],
[
'plan_id' => $plan->id,
'status' => 'active',
'start' => $this->dateParser($row['member_effective_date']),
'end' => $this->dateParser($row['member_expiry_date']),
]);
}
// $plans = explode(",",$row['plan_id']);
// if (count($plans) > 0) {
// foreach($plans as $d){
// $plan = Plan::query()
// ->where('code', $d)
// ->where('corporate_id', $corporate->id)
// ->first();
// if (!$plan) {
// throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
// }
// $member->memberPlans()->updateOrCreate([
// 'member_id' => $member->id,
// 'plan_id' => $plan->id,
// ],
// [
// 'plan_id' => $plan->id,
// 'status' => 'active',
// 'start' => $this->dateParser($row['member_effective_date']),
// 'end' => $this->dateParser($row['member_expiry_date']),
// ]);
// }
// } else {
// $plan = Plan::query()
// ->where('code', $row['plan_id'])
// ->where('corporate_id', $corporate->id)
// ->first();
// if (!$plan) {
// throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
// }
// $member->memberPlans()->updateOrCreate([
// 'member_id' => $member->id,
// 'plan_id' => $plan->id,
// ],
// [
// 'plan_id' => $plan->id,
// 'status' => 'active',
// 'start' => $this->dateParser($row['member_effective_date']),
// 'end' => $this->dateParser($row['member_expiry_date']),
// ]);
// }
// end update plan