1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Search by client number (3.X) #1328

This commit is contained in:
Hillel Coren 2017-02-28 20:24:30 +02:00
parent 631a401e8c
commit 7ffbda80c5
4 changed files with 11 additions and 3 deletions

View File

@ -249,6 +249,6 @@ trait GeneratesNumbers
public function clientNumbersEnabled()
{
return $this->hasFeature(FEATURE_INVOICE_SETTINGS) && $this->client_number_counter;
return $this->hasFeature(FEATURE_INVOICE_SETTINGS) && $this->client_number_counter > 0;
}
}

View File

@ -32,6 +32,13 @@ class ClientDatatable extends EntityDatatable
return link_to("clients/{$model->public_id}", $model->email ?: '')->toHtml();
},
],
[
'id_number',
function ($model) {
return $model->id_number;
},
Auth::user()->account->clientNumbersEnabled()
],
[
'client_created_at',
function ($model) {

View File

@ -126,7 +126,7 @@ class AccountRepository
foreach ($clients as $client) {
if ($client->name) {
$data['clients'][] = [
'value' => $client->name,
'value' => ($account->clientNumbersEnabled() && $client->id_number ? $client->id_number . ': ' : '') . $client->name,
'tokens' => implode(',', [$client->name, $client->id_number, $client->vat_number, $client->work_phone]),
'url' => $client->present()->url,
];

View File

@ -51,7 +51,8 @@ class ClientRepository extends BaseRepository
'contacts.email',
'clients.deleted_at',
'clients.is_deleted',
'clients.user_id'
'clients.user_id',
'clients.id_number'
);
$this->applyFilters($query, ENTITY_CLIENT);