mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Client Export
This commit is contained in:
parent
1127f3ea5f
commit
a4a03cc3ed
@ -75,7 +75,8 @@ class BaseExport
|
||||
|
||||
protected array $client_report_keys = [
|
||||
"name" => "client.name",
|
||||
"user" => "client.user_id",
|
||||
"user" => "client.user",
|
||||
"assigned_user" => "client.assigned_user",
|
||||
"balance" => "client.balance",
|
||||
"paid_to_date" => "client.paid_to_date",
|
||||
"currency" => "client.currency_id",
|
||||
@ -796,6 +797,7 @@ class BaseExport
|
||||
|
||||
$header[] = "{$prefix} " . ctrans("texts.{$key}");
|
||||
}
|
||||
nlog($header);
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
@ -82,7 +82,6 @@ class ClientExport extends BaseExport
|
||||
];
|
||||
|
||||
public array $forced_keys = [
|
||||
'status',
|
||||
];
|
||||
|
||||
public function __construct(Company $company, array $input)
|
||||
@ -144,11 +143,11 @@ class ClientExport extends BaseExport
|
||||
$keyval = array_search($key, $this->entity_keys);
|
||||
|
||||
if (is_array($parts) && $parts[0] == 'client' && array_key_exists($parts[1], $transformed_client)) {
|
||||
$entity[$keyval] = $transformed_client[$parts[1]];
|
||||
$entity[$key] = $transformed_client[$parts[1]];
|
||||
} elseif (is_array($parts) && $parts[0] == 'contact' && array_key_exists($parts[1], $transformed_contact)) {
|
||||
$entity[$keyval] = $transformed_contact[$parts[1]];
|
||||
$entity[$key] = $transformed_contact[$parts[1]];
|
||||
} else {
|
||||
$entity[$keyval] = '';
|
||||
$entity[$key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,6 +156,14 @@ class ClientExport extends BaseExport
|
||||
|
||||
private function decorateAdvancedFields(Client $client, array $entity) :array
|
||||
{
|
||||
if (in_array('client.user', $this->input['report_keys'])) {
|
||||
$entity['client.user'] = $client->user->present()->name();
|
||||
}
|
||||
|
||||
if (in_array('client.assigned_user', $this->input['report_keys'])) {
|
||||
$entity['client.assigned_user'] = $client->assigned_user ? $client->user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('client.country_id', $this->input['report_keys'])) {
|
||||
$entity['country'] = $client->country ? ctrans("texts.country_{$client->country->name}") : '';
|
||||
}
|
||||
@ -173,8 +180,6 @@ class ClientExport extends BaseExport
|
||||
$entity['industry_id'] = $client->industry ? ctrans("texts.industry_{$client->industry->name}") : '';
|
||||
}
|
||||
|
||||
$entity['status'] = $this->calculateStatus($client);
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
|
@ -135,19 +135,6 @@ class InvoiceFilters extends QueryFilters
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function without_deleted_clients(): Builder
|
||||
{
|
||||
return $this->builder->whereHas('client', function ($query) {
|
||||
$query->where('is_deleted', 0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
* @return Builder
|
||||
|
Loading…
x
Reference in New Issue
Block a user