mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 08:21:34 +02:00
Try to merge e-invoice in as many cases as possible.
This commit is contained in:
parent
dd17119fd6
commit
5f929f7a6c
@ -13,6 +13,7 @@ namespace App\Jobs\Entity;
|
||||
|
||||
use App\Exceptions\FilePermissionsFailure;
|
||||
use App\Jobs\Invoice\CreateEInvoice;
|
||||
use App\Jobs\Invoice\MergeEInvoice;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Credit;
|
||||
use App\Models\CreditInvitation;
|
||||
@ -214,6 +215,8 @@ class CreateEntityPdf implements ShouldQueue
|
||||
}
|
||||
if ($this->entity_string == "invoice" && $this->client->getSetting('enable_e_invoice')){
|
||||
(new CreateEInvoice($this->entity))->handle();
|
||||
(new MergeEInvoice($this->entity))->handle();
|
||||
|
||||
}
|
||||
$this->invitation = null;
|
||||
// $this->entity = null;
|
||||
|
@ -77,6 +77,7 @@ class ZipInvoices implements ShouldQueue
|
||||
(new CreateEntityPdf($invoice->invitations()->first()))->handle();
|
||||
if ($invoice->client->getSetting('enable_e_invoice')){
|
||||
(new CreateEInvoice($invoice))->handle();
|
||||
(new MergeEInvoice($invoice))->handle();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -44,6 +44,8 @@ class GetInvoiceEInvoice extends AbstractService
|
||||
|
||||
if (! $file) {
|
||||
$file_path = (new CreateEInvoice($this->invoice))->handle();
|
||||
(new \App\Jobs\Invoice\MergeEInvoice($this->invoice))->handle();
|
||||
|
||||
}
|
||||
|
||||
return $file_path;
|
||||
|
@ -468,6 +468,7 @@ class InvoiceService
|
||||
if ($invitation->invoice->client->getSetting('enable_e_invoice') && $invitation instanceof InvoiceInvitation)
|
||||
{
|
||||
(new CreateEInvoice($invitation->invoice))->handle();
|
||||
(new MergeEInvoice($invitation->invoice))->run();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -42,9 +42,10 @@ class EInvoiceTest extends TestCase
|
||||
$this->company->e_invoice_type = "EN16931";
|
||||
$this->invoice->client->routing_id = 'DE123456789';
|
||||
$this->invoice->client->save();
|
||||
$xinvoice = (new CreateEInvoice($this->invoice))->handle();
|
||||
$this->assertNotNull($xinvoice);
|
||||
$this->assertTrue(Storage::exists($xinvoice));
|
||||
$e_invoice = (new CreateEInvoice($this->invoice))->handle();
|
||||
(new \App\Jobs\Invoice\MergeEInvoice($this->invoice))->handle();
|
||||
$this->assertNotNull($e_invoice);
|
||||
$this->assertTrue(Storage::exists($e_invoice));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,9 +57,8 @@ class EInvoiceTest extends TestCase
|
||||
$this->invoice->client->routing_id = 'DE123456789';
|
||||
$this->invoice->client->save();
|
||||
|
||||
$xinvoice = (new CreateEInvoice($this->invoice))->handle();
|
||||
nlog(Storage::path($xinvoice));
|
||||
$document = ZugferdDocumentReader::readAndGuessFromFile(Storage::path($xinvoice));
|
||||
$e_invoice = (new CreateEInvoice($this->invoice))->handle();
|
||||
$document = ZugferdDocumentReader::readAndGuessFromFile(Storage::path($e_invoice));
|
||||
$document->getDocumentInformation($documentno, $documenttypecode, $documentdate, $documentcurrency, $taxcurrency, $taxname, $documentlangeuage, $rest);
|
||||
$this->assertEquals($this->invoice->number, $documentno);
|
||||
}
|
||||
@ -70,6 +70,7 @@ class EInvoiceTest extends TestCase
|
||||
{
|
||||
$pdf = (new CreateEntityPdf($this->invoice->invitations()->first()))->handle();
|
||||
(new CreateEInvoice($this->invoice))->handle();
|
||||
(new \App\Jobs\Invoice\MergeEInvoice($this->invoice))->handle();
|
||||
$document = ZugferdDocumentReader::readAndGuessFromFile($pdf);
|
||||
$document->getDocumentInformation($documentno, $documenttypecode, $documentdate, $documentcurrency, $taxcurrency, $taxname, $documentlangeuage, $rest);
|
||||
$this->assertEquals($this->invoice->number, $documentno);
|
||||
|
Loading…
Reference in New Issue
Block a user