mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01: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;
|
||||
} else {
|
||||
$user = $payment->user;
|
||||
$contact = $client->contacts[0];
|
||||
$contact = count($client->contacts) ? $client->contacts[0] : '';
|
||||
$invitation = $payment->invoice->invitations[0];
|
||||
}
|
||||
|
||||
|
@ -710,6 +710,10 @@ class InvoiceRepository extends BaseRepository
|
||||
$client->load('contacts');
|
||||
$sendInvoiceIds = [];
|
||||
|
||||
if (! count($client->contacts)) {
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
foreach ($client->contacts as $contact) {
|
||||
if ($contact->send_invoice) {
|
||||
$sendInvoiceIds[] = $contact->id;
|
||||
|
@ -868,7 +868,7 @@ class ImportService
|
||||
$this->maps['client'][$name] = $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_ids'][$client->public_id] = $client->id;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user