mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 08:24:39 -04:00
Add check to prevent changing contact’s client id
This commit is contained in:
parent
08aed19f9a
commit
c7f5a5cd9c
@ -262,7 +262,7 @@ class Client extends EntityModel
|
||||
// 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();
|
||||
$contact = Contact::scope($publicId)->whereClientId($this->id)->firstOrFail();
|
||||
} else {
|
||||
$contact = Contact::createNew();
|
||||
$contact->send_invoice = true;
|
||||
|
@ -216,8 +216,8 @@ class Vendor extends EntityModel
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : (isset($data['id']) ? $data['id'] : false);
|
||||
|
||||
if ($publicId && $publicId != '-1') {
|
||||
$contact = VendorContact::scope($publicId)->firstOrFail();
|
||||
if (! $this->wasRecentlyCreated && $publicId && $publicId != '-1') {
|
||||
$contact = VendorContact::scope($publicId)->whereVendorId($this->id)->firstOrFail();
|
||||
} else {
|
||||
$contact = VendorContact::createNew();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user