mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 11:04:30 -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
|
// check if this client wasRecentlyCreated to ensure a new contact is
|
||||||
// always created even if the request includes a contact id
|
// always created even if the request includes a contact id
|
||||||
if (! $this->wasRecentlyCreated && $publicId && $publicId != '-1') {
|
if (! $this->wasRecentlyCreated && $publicId && $publicId != '-1') {
|
||||||
$contact = Contact::scope($publicId)->firstOrFail();
|
$contact = Contact::scope($publicId)->whereClientId($this->id)->firstOrFail();
|
||||||
} else {
|
} else {
|
||||||
$contact = Contact::createNew();
|
$contact = Contact::createNew();
|
||||||
$contact->send_invoice = true;
|
$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);
|
$publicId = isset($data['public_id']) ? $data['public_id'] : (isset($data['id']) ? $data['id'] : false);
|
||||||
|
|
||||||
if ($publicId && $publicId != '-1') {
|
if (! $this->wasRecentlyCreated && $publicId && $publicId != '-1') {
|
||||||
$contact = VendorContact::scope($publicId)->firstOrFail();
|
$contact = VendorContact::scope($publicId)->whereVendorId($this->id)->firstOrFail();
|
||||||
} else {
|
} else {
|
||||||
$contact = VendorContact::createNew();
|
$contact = VendorContact::createNew();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user