diff --git a/Modules/Internal/Services/MemberEnrollmentService.php b/Modules/Internal/Services/MemberEnrollmentService.php index 6184b807..e786a790 100755 --- a/Modules/Internal/Services/MemberEnrollmentService.php +++ b/Modules/Internal/Services/MemberEnrollmentService.php @@ -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); - } + }