Added fields to search (id number, vat number, ...)

This commit is contained in:
Hillel Coren 2016-12-25 12:48:26 +02:00
parent 1a27e28ff5
commit e599b7ee89

View File

@ -125,7 +125,7 @@ class AccountRepository
if ($client->name) { if ($client->name) {
$data['clients'][] = [ $data['clients'][] = [
'value' => $client->name, 'value' => $client->name,
'tokens' => $client->name, 'tokens' => implode(',', [$client->name, $client->id_number, $client->vat_number, $client->work_phone]),
'url' => $client->present()->url, 'url' => $client->present()->url,
]; ];
} }
@ -146,27 +146,18 @@ class AccountRepository
} }
foreach ($client->contacts as $contact) { foreach ($client->contacts as $contact) {
if ($contact->getFullName()) { $data['contacts'][] = [
$data['contacts'][] = [ 'value' => $contact->getDisplayName(),
'value' => $contact->getDisplayName(), 'tokens' => implode(',', [$contact->first_name, $contact->last_name, $contact->email, $contact->phone]),
'tokens' => $contact->getDisplayName(), 'url' => $client->present()->url,
'url' => $client->present()->url, ];
];
}
if ($contact->email) {
$data['contacts'][] = [
'value' => $contact->email,
'tokens' => $contact->email,
'url' => $client->present()->url,
];
}
} }
foreach ($client->invoices as $invoice) { foreach ($client->invoices as $invoice) {
$entityType = $invoice->getEntityType(); $entityType = $invoice->getEntityType();
$data["{$entityType}s"][] = [ $data["{$entityType}s"][] = [
'value' => $invoice->getDisplayName() . ': ' . $client->getDisplayName(), 'value' => $invoice->getDisplayName() . ': ' . $client->getDisplayName(),
'tokens' => $invoice->getDisplayName() . ': ' . $client->getDisplayName(), 'tokens' => implode(',', [$invoice->invoice_number, $invoice->po_number]),
'url' => $invoice->present()->url, 'url' => $invoice->present()->url,
]; ];
} }