Quick Search in Top-Navigation: Hide deleted Customers #2029

This commit is contained in:
Hillel Coren 2018-04-12 22:51:10 +03:00
parent c85a3dc663
commit d9b4dced25

View File

@ -194,35 +194,37 @@ class AccountRepository
} }
foreach ($clients as $client) { foreach ($clients as $client) {
if ($client->name) { if (! $client->is_deleted) {
$data['clients'][] = [ if ($client->name) {
'value' => ($client->id_number ? $client->id_number . ': ' : '') . $client->name, $data['clients'][] = [
'tokens' => implode(',', [$client->name, $client->id_number, $client->vat_number, $client->work_phone]), 'value' => ($client->id_number ? $client->id_number . ': ' : '') . $client->name,
'url' => $client->present()->url, 'tokens' => implode(',', [$client->name, $client->id_number, $client->vat_number, $client->work_phone]),
]; 'url' => $client->present()->url,
} ];
}
if ($client->custom_value1) { if ($client->custom_value1) {
$data[$account->present()->customLabel('client1')][] = [ $data[$account->present()->customLabel('client1')][] = [
'value' => "{$client->custom_value1}: " . $client->getDisplayName(), 'value' => "{$client->custom_value1}: " . $client->getDisplayName(),
'tokens' => $client->custom_value1, 'tokens' => $client->custom_value1,
'url' => $client->present()->url, 'url' => $client->present()->url,
]; ];
} }
if ($client->custom_value2) { if ($client->custom_value2) {
$data[$account->present()->customLabel('client2')][] = [ $data[$account->present()->customLabel('client2')][] = [
'value' => "{$client->custom_value2}: " . $client->getDisplayName(), 'value' => "{$client->custom_value2}: " . $client->getDisplayName(),
'tokens' => $client->custom_value2, 'tokens' => $client->custom_value2,
'url' => $client->present()->url, 'url' => $client->present()->url,
]; ];
} }
foreach ($client->contacts as $contact) { foreach ($client->contacts as $contact) {
$data['contacts'][] = [ $data['contacts'][] = [
'value' => $contact->getSearchName(), 'value' => $contact->getSearchName(),
'tokens' => implode(',', [$contact->first_name, $contact->last_name, $contact->email, $contact->phone]), 'tokens' => implode(',', [$contact->first_name, $contact->last_name, $contact->email, $contact->phone]),
'url' => $client->present()->url, 'url' => $client->present()->url,
]; ];
}
} }
foreach ($client->invoices as $invoice) { foreach ($client->invoices as $invoice) {