mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 22:34:31 -04:00
changes related to allow_clients
This commit is contained in:
parent
157037f56f
commit
1db0350273
@ -118,7 +118,7 @@ class ProcessBrevoInboundWebhook implements ShouldQueue
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
||||||
// brevo defines recipients as array to enable webhook processing as batches, we check all of them
|
// brevo defines recipients as array, we check all of them, to be sure
|
||||||
foreach ($this->input["Recipients"] as $recipient) {
|
foreach ($this->input["Recipients"] as $recipient) {
|
||||||
|
|
||||||
// match company
|
// match company
|
||||||
|
@ -229,15 +229,13 @@ class InboundMailEngine
|
|||||||
if ($this->company->inbound_mailbox_allow_company_users && $this->company->users()->where("email", $this->email->from)->exists())
|
if ($this->company->inbound_mailbox_allow_company_users && $this->company->users()->where("email", $this->email->from)->exists())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// from vendors (if active)
|
// from vendors
|
||||||
if ($this->company->inbound_mailbox_allow_vendors && $this->company->vendors()->where("invoicing_email", $this->email->from)->orWhere("invoicing_domain", $domain)->exists())
|
if ($this->company->inbound_mailbox_allow_vendors && $this->company->vendors()->where("invoicing_email", $this->email->from)->orWhere("invoicing_domain", $domain)->exists())
|
||||||
return true;
|
return true;
|
||||||
if ($this->company->inbound_mailbox_allow_vendors && $this->company->vendors()->contacts()->where("email", $this->email->from)->exists())
|
if ($this->company->inbound_mailbox_allow_vendors && $this->company->vendors()->contacts()->where("email", $this->email->from)->exists())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// from clients (if active)
|
// from clients
|
||||||
if ($this->company->inbound_mailbox_allow_clients && $this->company->clients()->where("invoicing_email", $this->email->from)->orWhere("invoicing_domain", $domain)->exists())
|
|
||||||
return true;
|
|
||||||
if ($this->company->inbound_mailbox_allow_clients && $this->company->clients()->contacts()->where("email", $this->email->from)->exists())
|
if ($this->company->inbound_mailbox_allow_clients && $this->company->clients()->contacts()->where("email", $this->email->from)->exists())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -246,14 +244,11 @@ class InboundMailEngine
|
|||||||
}
|
}
|
||||||
private function getClient()
|
private function getClient()
|
||||||
{
|
{
|
||||||
$parts = explode('@', $this->email->from);
|
// $parts = explode('@', $this->email->from);
|
||||||
$domain = array_pop($parts);
|
// $domain = array_pop($parts);
|
||||||
|
|
||||||
$client = Client::where("company_id", $this->company->id)->where("email", $domain)->first();
|
|
||||||
if ($client == null) {
|
|
||||||
$clientContact = ClientContact::where("company_id", $this->company->id)->where("email", $this->email->from)->first();
|
$clientContact = ClientContact::where("company_id", $this->company->id)->where("email", $this->email->from)->first();
|
||||||
$client = $clientContact->client();
|
$client = $clientContact->client();
|
||||||
}
|
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user