mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-04 08:44:37 -04:00
Fixes for tests
This commit is contained in:
parent
4d12cb5db8
commit
d5b380d302
@ -377,7 +377,7 @@ class BaseExport
|
||||
protected array $expense_report_keys = [
|
||||
'amount' => 'expense.amount',
|
||||
'category' => 'expense.category_id',
|
||||
'client' => 'expense.client_id',
|
||||
// 'client' => 'expense.client_id',
|
||||
'custom_value1' => 'expense.custom_value1',
|
||||
'custom_value2' => 'expense.custom_value2',
|
||||
'custom_value3' => 'expense.custom_value3',
|
||||
@ -591,31 +591,33 @@ class BaseExport
|
||||
$manager->setSerializer(new ArraySerializer());
|
||||
$transformed_client = $manager->createData($transformed_client)->toArray();
|
||||
|
||||
if($column == 'name')
|
||||
if(in_array($column, ['client.name', 'name']))
|
||||
return $transformed_client['display_name'];
|
||||
|
||||
if($column == 'user_id')
|
||||
if(in_array($column, ['client.user_id', 'user_id']))
|
||||
return $entity->client->user->present()->name();
|
||||
|
||||
if($column == 'country_id')
|
||||
if(in_array($column, ['client.assigned_user_id', 'assigned_user_id']))
|
||||
return $entity->client->assigned_user->present()->name();
|
||||
|
||||
if(in_array($column, ['client.country_id', 'country_id']))
|
||||
return $entity->client->country ? ctrans("texts.country_{$entity->client->country->name}") : '';
|
||||
|
||||
if($column == 'shipping_country_id')
|
||||
if(in_array($column, ['client.shipping_country_id', 'shipping_country_id']))
|
||||
return $entity->client->shipping_country ? ctrans("texts.country_{$entity->client->shipping_country->name}") : '';
|
||||
|
||||
if($column == 'size_id')
|
||||
if(in_array($column, ['client.size_id', 'size_id']))
|
||||
return $entity->client->size?->name ?? '';
|
||||
|
||||
if($column == 'industry_id')
|
||||
if(in_array($column, ['client.industry_id', 'industry_id']))
|
||||
return $entity->client->industry?->name ?? '';
|
||||
|
||||
if ($column == 'currency_id') {
|
||||
if (in_array($column, ['client.currency_id', 'currency_id']))
|
||||
return $entity->client->currency() ? $entity->client->currency()->code : $entity->company->currency()->code;
|
||||
}
|
||||
|
||||
if($column == 'client.payment_terms') {
|
||||
|
||||
if(in_array($column, ['payment_terms', 'client.payment_terms']))
|
||||
return $entity->client->getSetting('payment_terms');
|
||||
}
|
||||
|
||||
|
||||
if(array_key_exists($column, $transformed_client))
|
||||
return $transformed_client[$column];
|
||||
|
@ -159,6 +159,10 @@ class ExpenseExport extends BaseExport
|
||||
$entity['expense.assigned_user'] = $expense->assigned_user ? $expense->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('expense.category_id', $this->input['report_keys'])) {
|
||||
$entity['expense.category_id'] = $expense->category ? $expense->category->name : '';
|
||||
}
|
||||
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
|
@ -106,6 +106,8 @@ class CreditsTest extends TestCase
|
||||
->assertDontSee('testing-number-01')
|
||||
->assertSee('testing-number-02')
|
||||
->assertSee('testing-number-03');
|
||||
|
||||
$user->forceDelete();
|
||||
}
|
||||
|
||||
public function testShowingCreditsWithNullDueDate()
|
||||
@ -173,5 +175,9 @@ class CreditsTest extends TestCase
|
||||
->assertSee('testing-number-01')
|
||||
->assertSee('testing-number-02')
|
||||
->assertSee('testing-number-03');
|
||||
|
||||
|
||||
$user->forceDelete();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -96,5 +96,9 @@ class InvoicesTest extends TestCase
|
||||
->set('status', ['paid'])
|
||||
->assertSee($paid->number)
|
||||
->assertDontSee($unpaid->number);
|
||||
|
||||
|
||||
$user->forceDelete();
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user