Add personal application fields to members
This commit is contained in:
@@ -46,7 +46,7 @@ class ImportMembers extends Command
|
||||
|
||||
$header = array_map('trim', $header);
|
||||
|
||||
$expected = [
|
||||
$required = [
|
||||
'full_name',
|
||||
'email',
|
||||
'phone',
|
||||
@@ -60,7 +60,7 @@ class ImportMembers extends Command
|
||||
'membership_expires_at',
|
||||
];
|
||||
|
||||
foreach ($expected as $column) {
|
||||
foreach ($required as $column) {
|
||||
if (! in_array($column, $header, true)) {
|
||||
$this->error("Missing required column: {$column}");
|
||||
fclose($handle);
|
||||
@@ -82,8 +82,19 @@ class ImportMembers extends Command
|
||||
}
|
||||
|
||||
$fullName = trim($row[$indexes['full_name']] ?? '');
|
||||
$nationalId = trim($row[$indexes['national_id']] ?? '');
|
||||
$memberNumber = isset($indexes['member_number']) ? trim($row[$indexes['member_number']] ?? '') : '';
|
||||
$nationalId = isset($indexes['national_id']) ? trim($row[$indexes['national_id']] ?? '') : '';
|
||||
$phone = trim($row[$indexes['phone']] ?? '');
|
||||
$phoneHome = isset($indexes['phone_home']) ? trim($row[$indexes['phone_home']] ?? '') : '';
|
||||
$phoneFax = isset($indexes['phone_fax']) ? trim($row[$indexes['phone_fax']] ?? '') : '';
|
||||
$birthDate = isset($indexes['birth_date']) ? trim($row[$indexes['birth_date']] ?? '') : '';
|
||||
$gender = isset($indexes['gender']) ? trim($row[$indexes['gender']] ?? '') : '';
|
||||
$identityType = isset($indexes['identity_type']) ? trim($row[$indexes['identity_type']] ?? '') : '';
|
||||
$identityOtherText = isset($indexes['identity_other_text']) ? trim($row[$indexes['identity_other_text']] ?? '') : '';
|
||||
$occupation = isset($indexes['occupation']) ? trim($row[$indexes['occupation']] ?? '') : '';
|
||||
$employer = isset($indexes['employer']) ? trim($row[$indexes['employer']] ?? '') : '';
|
||||
$jobTitle = isset($indexes['job_title']) ? trim($row[$indexes['job_title']] ?? '') : '';
|
||||
$appliedAt = isset($indexes['applied_at']) ? trim($row[$indexes['applied_at']] ?? '') : '';
|
||||
$started = trim($row[$indexes['membership_started_at']] ?? '');
|
||||
$expires = trim($row[$indexes['membership_expires_at']] ?? '');
|
||||
$address1 = trim($row[$indexes['address_line_1']] ?? '');
|
||||
@@ -109,10 +120,21 @@ class ImportMembers extends Command
|
||||
$member = Member::updateOrCreate(
|
||||
['user_id' => $user->id],
|
||||
[
|
||||
'member_number' => $memberNumber !== '' ? $memberNumber : null,
|
||||
'full_name' => $fullName !== '' ? $fullName : $user->name,
|
||||
'email' => $email,
|
||||
'national_id' => $nationalId !== '' ? $nationalId : null,
|
||||
'phone' => $phone !== '' ? $phone : null,
|
||||
'phone_home' => $phoneHome !== '' ? $phoneHome : null,
|
||||
'phone_fax' => $phoneFax !== '' ? $phoneFax : null,
|
||||
'birth_date' => $birthDate !== '' ? $birthDate : null,
|
||||
'gender' => $gender !== '' ? $gender : null,
|
||||
'identity_type' => $identityType !== '' ? $identityType : null,
|
||||
'identity_other_text' => $identityOtherText !== '' ? $identityOtherText : null,
|
||||
'occupation' => $occupation !== '' ? $occupation : null,
|
||||
'employer' => $employer !== '' ? $employer : null,
|
||||
'job_title' => $jobTitle !== '' ? $jobTitle : null,
|
||||
'applied_at' => $appliedAt !== '' ? $appliedAt : null,
|
||||
'address_line_1' => $address1 ?: null,
|
||||
'address_line_2' => $address2 ?: null,
|
||||
'city' => $city ?: null,
|
||||
|
||||
Reference in New Issue
Block a user