mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add checks for contact
This commit is contained in:
parent
df3d2aeec3
commit
a483ce487a
@ -259,7 +259,7 @@ class ContactMailer extends Mailer
|
|||||||
$invitation = $payment->invitation;
|
$invitation = $payment->invitation;
|
||||||
} else {
|
} else {
|
||||||
$user = $payment->user;
|
$user = $payment->user;
|
||||||
$contact = $client->contacts[0];
|
$contact = count($client->contacts) ? $client->contacts[0] : '';
|
||||||
$invitation = $payment->invoice->invitations[0];
|
$invitation = $payment->invoice->invitations[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,6 +710,10 @@ class InvoiceRepository extends BaseRepository
|
|||||||
$client->load('contacts');
|
$client->load('contacts');
|
||||||
$sendInvoiceIds = [];
|
$sendInvoiceIds = [];
|
||||||
|
|
||||||
|
if (! count($client->contacts)) {
|
||||||
|
return $invoice;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($client->contacts as $contact) {
|
foreach ($client->contacts as $contact) {
|
||||||
if ($contact->send_invoice) {
|
if ($contact->send_invoice) {
|
||||||
$sendInvoiceIds[] = $contact->id;
|
$sendInvoiceIds[] = $contact->id;
|
||||||
|
@ -868,7 +868,7 @@ class ImportService
|
|||||||
$this->maps['client'][$name] = $client->id;
|
$this->maps['client'][$name] = $client->id;
|
||||||
$this->maps['client_ids'][$client->public_id] = $client->id;
|
$this->maps['client_ids'][$client->public_id] = $client->id;
|
||||||
}
|
}
|
||||||
if ($name = strtolower(trim($client->contacts[0]->email))) {
|
if (count($client->contacts) && $name = strtolower(trim($client->contacts[0]->email))) {
|
||||||
$this->maps['client'][$name] = $client->id;
|
$this->maps['client'][$name] = $client->id;
|
||||||
$this->maps['client_ids'][$client->public_id] = $client->id;
|
$this->maps['client_ids'][$client->public_id] = $client->id;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user