update lagi

This commit is contained in:
2023-05-22 16:28:53 +07:00
parent 726cf2e192
commit 7c40b61a3c

View File

@@ -377,6 +377,14 @@ class MemberEnrollmentService
// $query->where('corporate_id', $corporate->id);
// })
->first();
if(empty($member)){
throw new ImportRowException(__('enrollment.PRINCIPAL_NOT_IN_MEMBER_ID'), 0, null, $row);
} else {
if ($member['record_type'] != 'P'){
throw new ImportRowException(__('enrollment.PRINCIPAL_ID_NOT_SAME_MEMBER_ID'), 0, null, $row);
}
}
if (empty($row['principal_id'])) {
throw new ImportRowException(__('enrollment.PRINCIPAL_ID_REQUIRED'), 0, null, $row);
}
@@ -386,12 +394,7 @@ class MemberEnrollmentService
if (!empty($row['relationship_with_principal']) && !in_array($row['relationship_with_principal'], ['H', 'W', 'D', 'S'])){
throw new ImportRowException(__('enrollment.RELATIONSHIP_WITH_PRICIPAL_NOT_VALID'), 0, null, $row);
}
if ($row['principal_id'] == $row['member_id']){
throw new ImportRowException(__('enrollment.PRINCIPAL_ID_NOT_SAME_MEMBER_ID'), 0, null, $row);
}
if ($member) {
throw new ImportRowException(__('enrollment.PRINCIPAL_ID_NOT_SAME_MEMBER_ID'), 0, null, $row);
}
}