delete invoices (#1652)

* include all meta fields as template variables
* support invoice preview via command
* support deletion of generated invoices
This commit is contained in:
Kevin Papst
2020-04-23 12:19:07 +02:00
committed by GitHub
parent cfe0724620
commit 711139ad4c
20 changed files with 206 additions and 36 deletions

View File

@@ -39,6 +39,7 @@ class InvoiceModelDefaultHydratorTest extends TestCase
'invoice.currency',
'invoice.currency_symbol',
'invoice.vat',
'invoice.language',
'invoice.tax',
'invoice.tax_nc',
'invoice.tax_plain',
@@ -60,11 +61,19 @@ class InvoiceModelDefaultHydratorTest extends TestCase
'template.contact',
'template.payment_details',
'query.begin',
'query.day',
'query.end',
'query.day',
'query.month',
'query.month_number',
'query.year',
'query.begin_day',
'query.begin_month',
'query.begin_month_number',
'query.begin_year',
'query.end_day',
'query.end_month',
'query.end_month_number',
'query.end_year',
];
$givenKeys = array_keys($model);

View File

@@ -84,6 +84,7 @@ class DebugRendererTest extends TestCase
'invoice.currency_symbol',
'invoice.vat',
'invoice.tax',
'invoice.language',
'invoice.tax_nc',
'invoice.tax_plain',
'invoice.total_time',
@@ -109,6 +110,14 @@ class DebugRendererTest extends TestCase
'query.month',
'query.month_number',
'query.year',
'query.begin_day',
'query.begin_month',
'query.begin_month_number',
'query.begin_year',
'query.end_day',
'query.end_month',
'query.end_month_number',
'query.end_year',
'customer.id',
'customer.address',
'customer.name',

View File

@@ -115,6 +115,7 @@ trait RendererTestTrait
$template = new InvoiceTemplate();
$template->setTitle('a very *long* test invoice / template title with [special] character');
$template->setVat(19);
$template->setLanguage('en');
$project = new Project();
$project->setName('project name');

View File

@@ -69,9 +69,19 @@ class TextRendererTest extends KernelTestCase
foreach ($model->toArray() as $key => $value) {
if (null === $value || '' === $value) {
self::assertStringContainsString(sprintf("%s:\n\n", $key), $content);
self::assertStringContainsString(sprintf("%s\n", $key), $content);
} else {
self::assertStringContainsString(sprintf("%s:\n %s", $key, explode("\n", $value)[0]), $content);
self::assertStringContainsString(sprintf("%s\n %s", $key, explode("\n", $value)[0]), $content);
}
}
foreach ($model->getCalculator()->getEntries() as $entry) {
foreach ($model->itemToArray($entry) as $key => $value) {
if (null === $value || '' === $value) {
self::assertStringContainsString(sprintf("%s\n", $key), $content);
} else {
self::assertStringContainsString(sprintf("%s\n %s", $key, explode("\n", $value)[0]), $content);
}
}
}
self::assertEquals(\count($model->getCalculator()->getEntries()), substr_count($content, PHP_EOL . '---' . PHP_EOL));