Add gender id to member
This commit is contained in:
parent
8c70ed7c16
commit
c0fe5623a8
|
@ -9,6 +9,10 @@ class Gender extends Model implements Nullable {
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
|
public static function getNullValue() {
|
||||||
|
return 23;
|
||||||
|
}
|
||||||
|
|
||||||
public static function fromNami($item) {
|
public static function fromNami($item) {
|
||||||
$item = collect($item)
|
$item = collect($item)
|
||||||
->only(['descriptor', 'id'])
|
->only(['descriptor', 'id'])
|
||||||
|
@ -25,7 +29,7 @@ class Gender extends Model implements Nullable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIsNullAttribute() {
|
public function getIsNullAttribute() {
|
||||||
return $this->attributes['name'] == 'keine Angabe';
|
return $this->attributes['id'] == self::getNullValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ class Member extends Model {
|
||||||
'telefon3' => 'work_phone',
|
'telefon3' => 'work_phone',
|
||||||
'telefax' => 'fax',
|
'telefax' => 'fax',
|
||||||
'email' => 'email',
|
'email' => 'email',
|
||||||
|
'geschlechtId' => 'gender_id',
|
||||||
'emailVertretungsberechtigter' => 'email_parents'
|
'emailVertretungsberechtigter' => 'email_parents'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -49,4 +50,8 @@ class Member extends Model {
|
||||||
parent::__construct($member);
|
parent::__construct($member);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getGenderIdAttribute() {
|
||||||
|
return $this->attributes['gender_id'] == Gender::getNullValue() ? null : $this->attributes['gender_id'];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,6 @@ interface Nullable {
|
||||||
|
|
||||||
public function getIsNullAttribute();
|
public function getIsNullAttribute();
|
||||||
|
|
||||||
|
public static function getNullValue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ class PullMemberTest extends TestCase
|
||||||
'fax' => ['fax', ['+55111', '+55222']],
|
'fax' => ['fax', ['+55111', '+55222']],
|
||||||
'email' => ['email', ['test@example.com', 'test2@example.com']],
|
'email' => ['email', ['test@example.com', 'test2@example.com']],
|
||||||
'email_parents' => ['email_parents', ['testp@example.com', 'test2p@example.com']],
|
'email_parents' => ['email_parents', ['testp@example.com', 'test2p@example.com']],
|
||||||
|
'gender_id' => ['gender_id', [19, null]],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
"zahlungsKonditionId": null,
|
"zahlungsKonditionId": null,
|
||||||
"zahlungsKondition": null
|
"zahlungsKondition": null
|
||||||
},
|
},
|
||||||
"geschlechtId": 19,
|
"geschlechtId": 23,
|
||||||
"land": "Deutschland",
|
"land": "Deutschland",
|
||||||
"email": "test2@example.com",
|
"email": "test2@example.com",
|
||||||
"telefon1": "+49668",
|
"telefon1": "+49668",
|
||||||
|
|
Loading…
Reference in New Issue