1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Fixes for contact API

This commit is contained in:
Hillel Coren 2017-03-27 11:36:48 +03:00
parent 89be0df8a3
commit ddc9df6650
2 changed files with 5 additions and 3 deletions

View File

@ -144,7 +144,7 @@ class ContactApiController extends BaseAPIController
$data = $request->input();
$data['public_id'] = $publicId;
$expense = $this->contactService->save($data, $request->entity());
$contact = $this->contactService->save($data, $request->entity());
return $this->itemResponse($contact);
}

View File

@ -6,11 +6,13 @@ use App\Models\Contact;
class ContactRepository extends BaseRepository
{
public function save($data)
public function save($data, $contact = false)
{
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
if (! $publicId || $publicId == '-1') {
if ($contact) {
// do nothing
} elseif (! $publicId || $publicId == '-1') {
$contact = Contact::createNew();
$contact->send_invoice = true;
$contact->client_id = $data['client_id'];