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:
parent
89be0df8a3
commit
ddc9df6650
@ -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);
|
||||
}
|
||||
|
@ -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'];
|
||||
|
Loading…
Reference in New Issue
Block a user