Show accounting link on accounts that are linked

This commit is contained in:
Deon George
2022-08-19 20:12:08 +10:00
parent 1deda523b4
commit 71b252843c
4 changed files with 32 additions and 18 deletions

View File

@@ -40,7 +40,7 @@ class AccountingAccountSync implements ShouldQueue
public function handle()
{
$api = $this->to->provider->API($this->to);
$accounts = Account::get();
$accounts = Account::with(['user'])->get();
foreach ($api->getCustomers() as $customer) {
$ao = NULL;
@@ -54,7 +54,7 @@ class AccountingAccountSync implements ShouldQueue
$ao = $x->pop();
// Look based on Name
} elseif (($x=$accounts->filter(function($item) use ($customer) { return $item->company == $customer->companyname || $item->name == $customer->fullname; }))->count() === 1) {
} elseif (($x=$accounts->filter(function($item) use ($customer) { return $item->company == $customer->companyname || $item->name == $customer->fullname || $item->user->email == $customer->email; }))->count() === 1) {
$ao = $x->pop();
} else {