diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a40c7ee799..11a2701ff84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### New features: +* Add middle name field to new contact and edit contact * Add backend and api for contact field labels * Add audit log when setting a contact's description * Add support for audit logs on a contact page diff --git a/CONTRIBUTORS b/CONTRIBUTORS index bce07dd612f..75a478d3470 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -43,3 +43,4 @@ Bryan Kam @lydgate Tom Granot-Scalosub @tomgs Chris Forrence @chrisforrence Mohammed Al-Sahaf @Mohammed90 +Ivan Kruchkoff @ivankruchkoff diff --git a/app/Http/Controllers/ContactsController.php b/app/Http/Controllers/ContactsController.php index 7d99078d661..a4ec0018575 100644 --- a/app/Http/Controllers/ContactsController.php +++ b/app/Http/Controllers/ContactsController.php @@ -200,6 +200,7 @@ public function store(Request $request) 'account_id' => auth()->user()->account->id, 'author_id' => auth()->user()->id, 'first_name' => $request->input('first_name'), + 'middle_name' => $request->input('middle_name', null), 'last_name' => $request->input('last_name', null), 'nickname' => $request->input('nickname', null), 'gender_id' => $request->input('gender'), @@ -394,6 +395,7 @@ public function update(Request $request, Contact $contact) 'account_id' => auth()->user()->account->id, 'contact_id' => $contact->id, 'first_name' => $request->input('firstname'), + 'middle_name' => $request->input('middlename', null), 'last_name' => $request->input('lastname', null), 'nickname' => $request->input('nickname', null), 'gender_id' => $request->input('gender'), diff --git a/resources/views/people/create.blade.php b/resources/views/people/create.blade.php index 05e43967030..96c7069edcd 100644 --- a/resources/views/people/create.blade.php +++ b/resources/views/people/create.blade.php @@ -41,6 +41,15 @@ +
+ + +
+
+
+ + +
+
+
+ + +
signIn(); + + $gender = factory(Gender::class)->create([ + 'account_id' => $user->account_id, + ]); + + $data = [ + 'first_name' => 'John', + 'last_name' => 'Doe', + 'middle_name' => 'Mike', + 'gender' => $gender->id, + ]; + + $response = $this->post('/people', $data); + + $response->assertStatus(302); + + $this->assertDatabaseHas('contacts', [ + 'first_name' => 'John', + 'last_name' => 'Doe', + 'middle_name' => 'Mike', + 'gender_id' => $gender->id, + ]); + } + /** @test */ public function it_gets_the_value() {