Update Bugs Fix Import
This commit is contained in:
@@ -335,7 +335,7 @@ class MemberEnrollmentService
|
||||
|
||||
public function validateDate($dateString, $dateFormat = 'Ymd'){
|
||||
$date = DateTime::createFromFormat($dateFormat, $dateString);
|
||||
if ($date && $date->format($dateFormat) == $dateString) {
|
||||
if ($date && ($date->format($dateFormat) == $dateString)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -437,32 +437,32 @@ class MemberEnrollmentService
|
||||
if (empty($row['member_effective_date'])) {
|
||||
throw new ImportRowException(__('enrollment.MEMBER_EFFECTIVE_REQUIRED'), 0, null, $row);
|
||||
}
|
||||
if(!$this->validateDate($row['member_effective_date'])){
|
||||
throw new ImportRowException(__('enrollment.INVALID_DATE', [
|
||||
'title' => $title['member_effective_date']
|
||||
]), 0, null, $row);
|
||||
}
|
||||
// if(!$this->validateDate($row['member_effective_date'])){
|
||||
// throw new ImportRowException(__('enrollment.INVALID_DATE', [
|
||||
// 'title' => $title['member_effective_date']
|
||||
// ]), 0, null, $row);
|
||||
// }
|
||||
|
||||
if (empty($row['member_expiry_date'])) {
|
||||
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_REQUIRED'), 0, null, $row);
|
||||
}
|
||||
if(!$this->validateDate($row['member_expiry_date'])){
|
||||
throw new ImportRowException(__('enrollment.INVALID_DATE', [
|
||||
'title' => $title['member_expiry_date']
|
||||
]), 0, null, $row);
|
||||
}
|
||||
// if(!$this->validateDate($row['member_expiry_date'])){
|
||||
// throw new ImportRowException(__('enrollment.INVALID_DATE', [
|
||||
// 'title' => $title['member_expiry_date']
|
||||
// ]), 0, null, $row);
|
||||
// }
|
||||
|
||||
// TODO EFFECTIVE DATE VALIDATION
|
||||
// if (empty($row['activation_date'])) {
|
||||
// throw new ImportRowException(__('enrollment.ACTIVATION_DATE_REQUIRED'), 0, null, $row);
|
||||
// }
|
||||
if(!empty($row['activation_date'])){
|
||||
if(!$this->validateDate($row['activation_date'])){
|
||||
throw new ImportRowException(__('enrollment.INVALID_DATE', [
|
||||
'title' => $title['activation_date']
|
||||
]), 0, null, $row);
|
||||
}
|
||||
}
|
||||
// if(!empty($row['activation_date'])){
|
||||
// if(!$this->validateDate($row['activation_date'])){
|
||||
// throw new ImportRowException(__('enrollment.INVALID_DATE', [
|
||||
// 'title' => $title['activation_date']
|
||||
// ]), 0, null, $row);
|
||||
// }
|
||||
// }
|
||||
// TODO FKTP VALIDATION
|
||||
// TODO FKRTL VALIDATION
|
||||
|
||||
@@ -495,22 +495,22 @@ class MemberEnrollmentService
|
||||
if (empty($row['date_of_birth'])) {
|
||||
throw new ImportRowException(__('enrollment.DATE_OF_BIRTH_REQUIRED'), 0, null, $row);
|
||||
}
|
||||
if(!$this->validateDate($row['date_of_birth'])){
|
||||
throw new ImportRowException(__('enrollment.INVALID_DATE', [
|
||||
'title' => $title['date_of_birth']
|
||||
]), 0, null, $row);
|
||||
}
|
||||
// if(!$this->validateDate($row['date_of_birth'])){
|
||||
// throw new ImportRowException(__('enrollment.INVALID_DATE', [
|
||||
// 'title' => $title['date_of_birth']
|
||||
// ]), 0, null, $row);
|
||||
// }
|
||||
|
||||
// if (empty($row['date_terminated'])) {
|
||||
// throw new ImportRowException(__('enrollment.DATE_OF_TERMINATED'), 0, null, $row);
|
||||
// }
|
||||
if (!empty($row['date_terminated'])) {
|
||||
if(!$this->validateDate($row['date_terminated'])){
|
||||
throw new ImportRowException(__('enrollment.INVALID_DATE', [
|
||||
'title' => $title['date_terminated']
|
||||
]), 0, null, $row);
|
||||
}
|
||||
}
|
||||
// if (!empty($row['date_terminated'])) {
|
||||
// if(!$this->validateDate($row['date_terminated'])){
|
||||
// throw new ImportRowException(__('enrollment.INVALID_DATE', [
|
||||
// 'title' => $title['date_terminated']
|
||||
// ]), 0, null, $row);
|
||||
// }
|
||||
// }
|
||||
// TODO DOB FORMAT VALIDATION
|
||||
|
||||
if (empty($row['sex'])) {
|
||||
@@ -705,6 +705,7 @@ class MemberEnrollmentService
|
||||
'gender' => Helper::genderPerson($row['sex']),
|
||||
'language' => $row['language'] ?? null,
|
||||
'race' => $row['race'] ?? null,
|
||||
'phone' => $row['telephone_mobile'] ?? null
|
||||
]
|
||||
);
|
||||
$member->person_id = $person->id;
|
||||
@@ -749,6 +750,7 @@ class MemberEnrollmentService
|
||||
'gender' => Helper::genderPerson($row['sex']),
|
||||
'language' => $row['language'] ?? null,
|
||||
'race' => $row['race'] ?? null,
|
||||
'phone' => $row['telephone_mobile'],
|
||||
]);
|
||||
$member->person_id = $person->id;
|
||||
$member->save();
|
||||
@@ -799,7 +801,7 @@ class MemberEnrollmentService
|
||||
}
|
||||
break;
|
||||
case "2": // Member Information Update (Without Replacement Card)
|
||||
|
||||
|
||||
// $this->validateRow($row);
|
||||
$member = Member::query()
|
||||
->where('member_id', $row['member_id'])
|
||||
@@ -812,7 +814,27 @@ class MemberEnrollmentService
|
||||
'policy_id' => $row['policy_number']
|
||||
]), 0, null, $row);
|
||||
}
|
||||
|
||||
|
||||
$person = Person::updateOrCreate(
|
||||
[
|
||||
'id' => $member->person_id
|
||||
],
|
||||
[
|
||||
'name' => $row['name'] ?? null,
|
||||
// 'birth_date' => $this->dateParser($row['date_of_birth']),
|
||||
'birth_date' => $row['date_of_birth'],
|
||||
'gender' => Helper::genderPerson($row['sex']),
|
||||
'language' => $row['language'] ?? null,
|
||||
'race' => $row['race'] ?? null,
|
||||
'phone' => $row['telephone_mobile']
|
||||
]
|
||||
);
|
||||
|
||||
$member->person_id = $person->id;
|
||||
$member->save();
|
||||
try {
|
||||
|
||||
$memberPolicy = MemberPolicy::query()
|
||||
->where('policy_id', $row['policy_number'])
|
||||
->where('member_id', $row['member_id'])
|
||||
|
||||
Reference in New Issue
Block a user