mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Prevent creating clients without contacts
This commit is contained in:
parent
80010880bb
commit
252c6f0a56
@ -244,7 +244,9 @@ class Client extends EntityModel
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : (isset($data['id']) ? $data['id'] : false);
|
||||
|
||||
if ($publicId && $publicId != '-1') {
|
||||
// check if this client wasRecentlyCreated to ensure a new contact is
|
||||
// always created even if the request includes a contact id
|
||||
if (! $this->wasRecentlyCreated && $publicId && $publicId != '-1') {
|
||||
$contact = Contact::scope($publicId)->firstOrFail();
|
||||
} else {
|
||||
$contact = Contact::createNew();
|
||||
|
Loading…
Reference in New Issue
Block a user