mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2026-03-03 00:47:02 +00:00
Updates for PEPPOL invoices
This commit is contained in:
@@ -112,11 +112,11 @@ class SwissQrGenerator
|
|||||||
// Add payment reference
|
// Add payment reference
|
||||||
// This is what you will need to identify incoming payments.
|
// This is what you will need to identify incoming payments.
|
||||||
|
|
||||||
if (stripos($this->invoice->number, "Live") === 0) {
|
if (stripos($this->invoice->number ?? '', "Live") === 0) {
|
||||||
// we're currently in preview status. Let's give a dummy reference for now
|
// we're currently in preview status. Let's give a dummy reference for now
|
||||||
$invoice_number = "123456789";
|
$invoice_number = "123456789";
|
||||||
} else {
|
} else {
|
||||||
$tempInvoiceNumber = $this->invoice->number;
|
$tempInvoiceNumber = $this->invoice->number ?? '';
|
||||||
$tempInvoiceNumber = preg_replace('/[^A-Za-z0-9]/', '', $tempInvoiceNumber);
|
$tempInvoiceNumber = preg_replace('/[^A-Za-z0-9]/', '', $tempInvoiceNumber);
|
||||||
// $tempInvoiceNumber = substr($tempInvoiceNumber, 1);
|
// $tempInvoiceNumber = substr($tempInvoiceNumber, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ class BaseModel extends Model
|
|||||||
|
|
||||||
public function numberFormatter()
|
public function numberFormatter()
|
||||||
{
|
{
|
||||||
$number = strlen($this->number) >= 1 ? $this->translate_entity() . "_" . $this->number : class_basename($this) . "_" . Str::random(5);
|
$number = strlen($this->number ?? '') >= 1 ? $this->translate_entity() . "_" . $this->number : class_basename($this) . "_" . Str::random(5);
|
||||||
|
|
||||||
$formatted_number = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $number);
|
$formatted_number = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $number);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ use App\Utils\Number;
|
|||||||
* App\Models\Invoice
|
* App\Models\Invoice
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property object|null $e_invoice
|
* @property object|array|null $e_invoice
|
||||||
* @property int $client_id
|
* @property int $client_id
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property int|null $location_id
|
* @property int|null $location_id
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class Peppol extends AbstractService
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private ?string $override_vat_number;
|
private string $override_vat_number = '';
|
||||||
|
|
||||||
/** @var array $InvoiceTypeCodes */
|
/** @var array $InvoiceTypeCodes */
|
||||||
private array $InvoiceTypeCodes = [
|
private array $InvoiceTypeCodes = [
|
||||||
@@ -657,7 +657,8 @@ class Peppol extends AbstractService
|
|||||||
$tax_type = 'S';
|
$tax_type = 'S';
|
||||||
break;
|
break;
|
||||||
case Product::PRODUCT_TYPE_REDUCED_TAX:
|
case Product::PRODUCT_TYPE_REDUCED_TAX:
|
||||||
$tax_type = 'AA';
|
// $tax_type = 'AA';
|
||||||
|
$tax_type = 'S'; //2026-01-14 - using AA breaks PEPPOL VALIDATION!!
|
||||||
break;
|
break;
|
||||||
case Product::PRODUCT_TYPE_EXEMPT:
|
case Product::PRODUCT_TYPE_EXEMPT:
|
||||||
$tax_type = 'E';
|
$tax_type = 'E';
|
||||||
@@ -759,10 +760,12 @@ class Peppol extends AbstractService
|
|||||||
$this->globalTaxCategories = [$taxCategory];
|
$this->globalTaxCategories = [$taxCategory];
|
||||||
|
|
||||||
if ($this->tax_category_id == 'O' && isset($this->p_invoice->AccountingSupplierParty->Party->PartyTaxScheme)) {
|
if ($this->tax_category_id == 'O' && isset($this->p_invoice->AccountingSupplierParty->Party->PartyTaxScheme)) {
|
||||||
|
nlog("unset 1");
|
||||||
unset($this->p_invoice->AccountingSupplierParty->Party->PartyTaxScheme);
|
unset($this->p_invoice->AccountingSupplierParty->Party->PartyTaxScheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->tax_category_id == 'O' && isset($this->p_invoice->AccountingCustomerParty->Party->PartyTaxScheme)) {
|
if ($this->tax_category_id == 'O' && isset($this->p_invoice->AccountingCustomerParty->Party->PartyTaxScheme)) {
|
||||||
|
nlog("unset 2");
|
||||||
unset($this->p_invoice->AccountingCustomerParty->Party->PartyTaxScheme);
|
unset($this->p_invoice->AccountingCustomerParty->Party->PartyTaxScheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1032,18 +1035,18 @@ class Peppol extends AbstractService
|
|||||||
$party->PartyName[] = $party_name;
|
$party->PartyName[] = $party_name;
|
||||||
|
|
||||||
if (strlen($this->company->settings->vat_number ?? '') > 1) {
|
if (strlen($this->company->settings->vat_number ?? '') > 1) {
|
||||||
|
|
||||||
$pi = new PartyIdentification();
|
$pi = new PartyIdentification();
|
||||||
$vatID = new ID();
|
$vatID = new ID();
|
||||||
$vatID->schemeID = $this->resolveScheme();
|
$vatID->schemeID = $this->resolveScheme();
|
||||||
$vatID->value = $this->override_vat_number ?? preg_replace("/[^a-zA-Z0-9]/", "", $this->invoice->company->settings->vat_number); //todo if we are cross border - switch to the supplier local vat number
|
$vatID->value = strlen($this->override_vat_number ?? '') > 1 ? $this->override_vat_number : preg_replace("/[^a-zA-Z0-9]/", "", $this->invoice->company->settings->vat_number); //todo if we are cross border - switch to the supplier local vat number
|
||||||
|
|
||||||
$pi->ID = $vatID;
|
$pi->ID = $vatID;
|
||||||
$party->PartyIdentification[] = $pi;
|
$party->PartyIdentification[] = $pi;
|
||||||
$pts = new \InvoiceNinja\EInvoice\Models\Peppol\PartyTaxSchemeType\PartyTaxScheme();
|
$pts = new \InvoiceNinja\EInvoice\Models\Peppol\PartyTaxSchemeType\PartyTaxScheme();
|
||||||
|
|
||||||
$companyID = new \InvoiceNinja\EInvoice\Models\Peppol\IdentifierType\CompanyID();
|
$companyID = new \InvoiceNinja\EInvoice\Models\Peppol\IdentifierType\CompanyID();
|
||||||
$companyID->value = $this->override_vat_number ?? preg_replace("/[^a-zA-Z0-9]/", "", $this->invoice->company->settings->vat_number);
|
$companyID->value = strlen($this->override_vat_number ?? '') > 1 ? $this->override_vat_number : preg_replace("/[^a-zA-Z0-9]/", "", $this->invoice->company->settings->vat_number); //todo if we are cross border - switch to the supplier local vat number
|
||||||
$pts->CompanyID = $companyID;
|
$pts->CompanyID = $companyID;
|
||||||
|
|
||||||
$ts = new TaxScheme();
|
$ts = new TaxScheme();
|
||||||
@@ -1498,9 +1501,9 @@ class Peppol extends AbstractService
|
|||||||
$category_id->value = $this->getTaxType($grouped_tax['tax_id']); // Standard rate
|
$category_id->value = $this->getTaxType($grouped_tax['tax_id']); // Standard rate
|
||||||
|
|
||||||
// Temp fix for reduced tax rate categorization.
|
// Temp fix for reduced tax rate categorization.
|
||||||
if($grouped_tax['tax_rate'] < 15 && $grouped_tax['tax_rate'] >= 0) {
|
// if($grouped_tax['tax_rate'] < 15 && $grouped_tax['tax_rate'] >= 0) {
|
||||||
$category_id->value = 'AA';
|
// $category_id->value = 'AA';
|
||||||
}
|
// }
|
||||||
|
|
||||||
$tax_category->ID = $category_id;
|
$tax_category->ID = $category_id;
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ parameters:
|
|||||||
- \Stripe\Collection
|
- \Stripe\Collection
|
||||||
reportUnmatchedIgnoredErrors: false
|
reportUnmatchedIgnoredErrors: false
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
|
- '#\Saxon\SaxonProcessor#'
|
||||||
- '#Array has 2 duplicate keys with value#'
|
- '#Array has 2 duplicate keys with value#'
|
||||||
- '#Call to an undefined method#'
|
- '#Call to an undefined method#'
|
||||||
- '#makeHidden#'
|
- '#makeHidden#'
|
||||||
|
|||||||
Reference in New Issue
Block a user