diff --git a/app/DataProviders/FACT1.php b/app/DataProviders/FACT1.php deleted file mode 100644 index 3572e15253bb..000000000000 --- a/app/DataProviders/FACT1.php +++ /dev/null @@ -1,24 +0,0 @@ -has('einvoice')){ $ro = new Schema(); - $response_data['einvoice_schema'] = $ro('FACT1'); + $response_data['einvoice_schema'] = $ro('Peppol'); } diff --git a/app/Http/Controllers/StaticController.php b/app/Http/Controllers/StaticController.php index 71403d055d1b..a8a14939ae78 100644 --- a/app/Http/Controllers/StaticController.php +++ b/app/Http/Controllers/StaticController.php @@ -62,7 +62,7 @@ class StaticController extends BaseController if(request()->has('einvoice')){ $schema = new Schema(); - $response_data['einvoice_schema'] = $schema('FACT1'); + $response_data['einvoice_schema'] = $schema('Peppol'); } diff --git a/app/Http/ValidationRules/Invoice/LockedInvoiceRule.php b/app/Http/ValidationRules/Invoice/LockedInvoiceRule.php index 6a4d6ac198c2..169df7757f15 100644 --- a/app/Http/ValidationRules/Invoice/LockedInvoiceRule.php +++ b/app/Http/ValidationRules/Invoice/LockedInvoiceRule.php @@ -71,7 +71,7 @@ class LockedInvoiceRule implements Rule //if now is greater than the end of month the invoice was dated - do not modify case 'end_of_month': - if(\Carbon\Carbon::setTimezone($this->invoice->company->timezone()->name)->parse($this->invoice->date)->endOfMonth()->lte(now())) + if(\Carbon\Carbon::parse($this->invoice->date)->setTimezone($this->invoice->company->timezone()->name)->endOfMonth()->lte(now())) return false; return true; diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index def9c4fc733d..841f6207fc80 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -389,17 +389,17 @@ class NinjaMailerJob implements ShouldQueue $company = $this->company; - $smtp_host = $company->smtp_host; + $smtp_host = $company->smtp_host ?? ''; $smtp_port = $company->smtp_port; - $smtp_username = $company->smtp_username; - $smtp_password = $company->smtp_password; + $smtp_username = $company->smtp_username ?? ''; + $smtp_password = $company->smtp_password ?? ''; $smtp_encryption = $company->smtp_encryption ?? 'tls'; $smtp_local_domain = strlen($company->smtp_local_domain) > 2 ? $company->smtp_local_domain : null; $smtp_verify_peer = $company->smtp_verify_peer ?? true; - if(strlen($smtp_host ?? '') <= 1 || - strlen($smtp_username ?? '') <= 1 || - strlen($smtp_password ?? '') <= 1 + if(strlen($smtp_host) <= 1 || + strlen($smtp_username) <= 1 || + strlen($smtp_password) <= 1 ) { $this->nmo->settings->email_sending_method = 'default'; diff --git a/app/Services/EDocument/Standards/OrderXDocument.php b/app/Services/EDocument/Standards/OrderXDocument.php index ec63eb4029fc..63b63a901e4a 100644 --- a/app/Services/EDocument/Standards/OrderXDocument.php +++ b/app/Services/EDocument/Standards/OrderXDocument.php @@ -27,6 +27,7 @@ class OrderXDocument extends AbstractService public OrderDocumentBuilder $orderxdocument; /** @var \App\Models\Invoice | \App\Models\Quote | \App\Models\PurchaseOrder | \App\Models\Credit $document */ + public function __construct(public mixed $document, private readonly bool $returnObject = false, private array $tax_map = []) { } diff --git a/app/Services/Email/Email.php b/app/Services/Email/Email.php index ef8c2b2fe9aa..8b8162a278a3 100644 --- a/app/Services/Email/Email.php +++ b/app/Services/Email/Email.php @@ -616,17 +616,17 @@ class Email implements ShouldQueue $company = $this->company; - $smtp_host = $company->smtp_host; + $smtp_host = $company->smtp_host ?? ''; $smtp_port = $company->smtp_port; - $smtp_username = $company->smtp_username; - $smtp_password = $company->smtp_password; + $smtp_username = $company->smtp_username ?? ''; + $smtp_password = $company->smtp_password ?? ''; $smtp_encryption = $company->smtp_encryption ?? 'tls'; $smtp_local_domain = strlen($company->smtp_local_domain) > 2 ? $company->smtp_local_domain : null; $smtp_verify_peer = $company->smtp_verify_peer ?? true; - if(strlen($smtp_host ?? '') <= 1 || - strlen($smtp_username ?? '') <= 1 || - strlen($smtp_password ?? '') <= 1 + if(strlen($smtp_host) <= 1 || + strlen($smtp_username) <= 1 || + strlen($smtp_password) <= 1 ) { $this->email_object->settings->email_sending_method = 'default'; return $this->setMailDriver(); diff --git a/composer.lock b/composer.lock index 1caac998c3f2..c23ee1e7d0fc 100644 --- a/composer.lock +++ b/composer.lock @@ -1385,16 +1385,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.310.0", + "version": "3.311.1", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "8ac02d36c609c6507136e5996f60cfd5152b4fd7" + "reference": "90218b9372469babf294f97bdd764c9d47ec8a57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/8ac02d36c609c6507136e5996f60cfd5152b4fd7", - "reference": "8ac02d36c609c6507136e5996f60cfd5152b4fd7", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/90218b9372469babf294f97bdd764c9d47ec8a57", + "reference": "90218b9372469babf294f97bdd764c9d47ec8a57", "shasum": "" }, "require": { @@ -1474,9 +1474,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.310.0" + "source": "https://github.com/aws/aws-sdk-php/tree/3.311.1" }, - "time": "2024-06-04T18:05:36+00:00" + "time": "2024-06-06T18:05:50+00:00" }, { "name": "bacon/bacon-qr-code", @@ -4630,16 +4630,16 @@ }, { "name": "horstoeko/zugferd", - "version": "v1.0.51", + "version": "v1.0.53", "source": { "type": "git", "url": "https://github.com/horstoeko/zugferd.git", - "reference": "9e036d4a9660638b4f51d2babb397fcff29ef046" + "reference": "939e93ab2e84ec476735e5957f4db7e7d58880c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/horstoeko/zugferd/zipball/9e036d4a9660638b4f51d2babb397fcff29ef046", - "reference": "9e036d4a9660638b4f51d2babb397fcff29ef046", + "url": "https://api.github.com/repos/horstoeko/zugferd/zipball/939e93ab2e84ec476735e5957f4db7e7d58880c3", + "reference": "939e93ab2e84ec476735e5957f4db7e7d58880c3", "shasum": "" }, "require": { @@ -4699,9 +4699,9 @@ ], "support": { "issues": "https://github.com/horstoeko/zugferd/issues", - "source": "https://github.com/horstoeko/zugferd/tree/v1.0.51" + "source": "https://github.com/horstoeko/zugferd/tree/v1.0.53" }, - "time": "2024-05-31T17:20:07+00:00" + "time": "2024-06-05T16:49:22+00:00" }, { "name": "http-interop/http-factory-guzzle", @@ -5076,12 +5076,12 @@ "source": { "type": "git", "url": "https://github.com/invoiceninja/einvoice.git", - "reference": "d067c8d89e61c76d1ef122ce15b4ed950289d900" + "reference": "17c57fabb8f065d2782dfc432df9fb801136d82b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/d067c8d89e61c76d1ef122ce15b4ed950289d900", - "reference": "d067c8d89e61c76d1ef122ce15b4ed950289d900", + "url": "https://api.github.com/repos/invoiceninja/einvoice/zipball/17c57fabb8f065d2782dfc432df9fb801136d82b", + "reference": "17c57fabb8f065d2782dfc432df9fb801136d82b", "shasum": "" }, "require": { @@ -5122,7 +5122,7 @@ "source": "https://github.com/invoiceninja/einvoice/tree/main", "issues": "https://github.com/invoiceninja/einvoice/issues" }, - "time": "2024-06-04T22:01:40+00:00" + "time": "2024-06-07T00:28:18+00:00" }, { "name": "invoiceninja/inspector", @@ -18244,16 +18244,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.3", + "version": "1.11.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5" + "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e64220a05c1209fc856d58e789c3b7a32c0bb9a5", - "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9100a76ce8015b9aa7125b9171ae3a76887b6c82", + "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82", "shasum": "" }, "require": { @@ -18298,7 +18298,7 @@ "type": "github" } ], - "time": "2024-05-31T13:53:37+00:00" + "time": "2024-06-06T12:19:22+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/tests/Integration/Einvoice/Fact1Test.php b/tests/Integration/Einvoice/Fact1Test.php index 0cc647941476..cb24a7ead9d2 100644 --- a/tests/Integration/Einvoice/Fact1Test.php +++ b/tests/Integration/Einvoice/Fact1Test.php @@ -23,51 +23,51 @@ use Illuminate\Support\Facades\Cache; use Symfony\Component\Validator\Validation; use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\Encoder\XmlEncoder; -use Invoiceninja\Einvoice\Models\FACT1\ItemType\Item; +use Invoiceninja\Einvoice\Models\Peppol\ItemType\Item; use Symfony\Component\Serializer\Encoder\JsonEncoder; use Illuminate\Foundation\Testing\DatabaseTransactions; -use Invoiceninja\Einvoice\Models\FACT1\PartyType\Party; -use Invoiceninja\Einvoice\Models\FACT1\PriceType\Price; +use Invoiceninja\Einvoice\Models\Peppol\PartyType\Party; +use Invoiceninja\Einvoice\Models\Peppol\PriceType\Price; use Symfony\Component\PropertyInfo\PropertyInfoExtractor; -use Invoiceninja\Einvoice\Models\FACT1\ContactType\Contact; -use Invoiceninja\Einvoice\Models\FACT1\CountryType\Country; -use Invoiceninja\Einvoice\Models\FACT1\AmountType\TaxAmount; -use Invoiceninja\Einvoice\Models\FACT1\TaxTotalType\TaxTotal; +use Invoiceninja\Einvoice\Models\Peppol\ContactType\Contact; +use Invoiceninja\Einvoice\Models\Peppol\CountryType\Country; +use Invoiceninja\Einvoice\Models\Peppol\AmountType\TaxAmount; +use Invoiceninja\Einvoice\Models\Peppol\TaxTotalType\TaxTotal; use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; -use Invoiceninja\Einvoice\Models\FACT1\AmountType\PriceAmount; +use Invoiceninja\Einvoice\Models\Peppol\AmountType\PriceAmount; use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer; -use Invoiceninja\Einvoice\Models\FACT1\TaxSchemeType\TaxScheme; +use Invoiceninja\Einvoice\Models\Peppol\TaxSchemeType\TaxScheme; use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer; use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader; -use Invoiceninja\Einvoice\Models\FACT1\AddressType\PostalAddress; +use Invoiceninja\Einvoice\Models\Peppol\AddressType\PostalAddress; use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; -use Invoiceninja\Einvoice\Models\FACT1\InvoiceLineType\InvoiceLine; -use Invoiceninja\Einvoice\Models\FACT1\TaxScheme as FACT1TaxScheme; -use Invoiceninja\Einvoice\Models\FACT1\TaxSubtotalType\TaxSubtotal; -use Invoiceninja\Einvoice\Models\FACT1\QuantityType\InvoicedQuantity; +use Invoiceninja\Einvoice\Models\Peppol\InvoiceLineType\InvoiceLine; +use Invoiceninja\Einvoice\Models\Peppol\TaxScheme as PeppolTaxScheme; +use Invoiceninja\Einvoice\Models\Peppol\TaxSubtotalType\TaxSubtotal; +use Invoiceninja\Einvoice\Models\Peppol\QuantityType\InvoicedQuantity; use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer; -use Invoiceninja\Einvoice\Models\FACT1\AmountType\LineExtensionAmount; -use Invoiceninja\Einvoice\Models\FACT1\AmountType\PayableAmount; -use Invoiceninja\Einvoice\Models\FACT1\AmountType\TaxableAmount; -use Invoiceninja\Einvoice\Models\FACT1\AmountType\TaxExclusiveAmount; -use Invoiceninja\Einvoice\Models\FACT1\AmountType\TaxInclusiveAmount; +use Invoiceninja\Einvoice\Models\Peppol\AmountType\LineExtensionAmount; +use Invoiceninja\Einvoice\Models\Peppol\AmountType\PayableAmount; +use Invoiceninja\Einvoice\Models\Peppol\AmountType\TaxableAmount; +use Invoiceninja\Einvoice\Models\Peppol\AmountType\TaxExclusiveAmount; +use Invoiceninja\Einvoice\Models\Peppol\AmountType\TaxInclusiveAmount; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; -use Invoiceninja\Einvoice\Models\FACT1\PartyTaxSchemeType\PartyTaxScheme; +use Invoiceninja\Einvoice\Models\Peppol\PartyTaxSchemeType\PartyTaxScheme; use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter; -use Invoiceninja\Einvoice\Models\FACT1\MonetaryTotalType\LegalMonetaryTotal; -use Invoiceninja\Einvoice\Models\FACT1\PartyLegalEntityType\PartyLegalEntity; -use Invoiceninja\Einvoice\Models\FACT1\TaxCategoryType\ClassifiedTaxCategory; +use Invoiceninja\Einvoice\Models\Peppol\MonetaryTotalType\LegalMonetaryTotal; +use Invoiceninja\Einvoice\Models\Peppol\PartyLegalEntityType\PartyLegalEntity; +use Invoiceninja\Einvoice\Models\Peppol\TaxCategoryType\ClassifiedTaxCategory; use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata; -use Invoiceninja\Einvoice\Models\FACT1\CustomerPartyType\AccountingCustomerParty; -use Invoiceninja\Einvoice\Models\FACT1\SupplierPartyType\AccountingSupplierParty; -use Invoiceninja\Einvoice\Models\FACT1\PartyIdentificationType\PartyIdentification; -use Invoiceninja\Einvoice\Models\FACT1\TaxCategoryType\TaxCategory; +use Invoiceninja\Einvoice\Models\Peppol\CustomerPartyType\AccountingCustomerParty; +use Invoiceninja\Einvoice\Models\Peppol\SupplierPartyType\AccountingSupplierParty; +use Invoiceninja\Einvoice\Models\Peppol\PartyIdentificationType\PartyIdentification; +use Invoiceninja\Einvoice\Models\Peppol\TaxCategoryType\TaxCategory; /** * @test */ -class Fact1Test extends TestCase +class PeppolTest extends TestCase { use MockAccountData; use DatabaseTransactions; @@ -140,7 +140,7 @@ class Fact1Test extends TestCase $_invoice->service()->markSent()->save(); $calc = $_invoice->calc(); - $invoice = new \Invoiceninja\Einvoice\Models\FACT1\Invoice(); + $invoice = new \Invoiceninja\Einvoice\Models\Peppol\Invoice(); $invoice->UBLVersionID = '2.1'; $invoice->CustomizationID = 'urn:cen.eu:en16931:2017#compliant#urn:efactura.mfinante.ro:CIUS-RO:1.0.1'; $invoice->ID = $_invoice->number; @@ -298,7 +298,7 @@ class Fact1Test extends TestCase $i->Description = $item->notes; $i->Name = $item->product_key; - $tax_scheme = new FACT1TaxScheme(); + $tax_scheme = new PeppolTaxScheme(); $tax_scheme->ID = $item->tax_name1; $tax_scheme->Name = $item->tax_rate1;