mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add 3 autonomous regions of spain
This commit is contained in:
parent
c812be495c
commit
02d93356aa
@ -108,7 +108,7 @@ class BankTransactionFilters extends QueryFilters
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count($debit_or_withdrawal_array) >= 1) {
|
if (count($debit_or_withdrawal_array) >= 1) {
|
||||||
$query->orWhereIn('base_type', $debit_or_withdrawal_array);
|
$query->whereIn('base_type', $debit_or_withdrawal_array);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -11,15 +11,16 @@
|
|||||||
|
|
||||||
namespace App\Services\EDocument\Standards;
|
namespace App\Services\EDocument\Standards;
|
||||||
|
|
||||||
use App\Exceptions\PeppolValidationException;
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
|
use App\Models\Product;
|
||||||
use App\Helpers\Invoice\Taxer;
|
use App\Helpers\Invoice\Taxer;
|
||||||
use App\Services\AbstractService;
|
use App\Services\AbstractService;
|
||||||
use App\Helpers\Invoice\InvoiceSum;
|
use App\Helpers\Invoice\InvoiceSum;
|
||||||
use InvoiceNinja\EInvoice\EInvoice;
|
use InvoiceNinja\EInvoice\EInvoice;
|
||||||
use App\Utils\Traits\NumberFormatter;
|
use App\Utils\Traits\NumberFormatter;
|
||||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||||
|
use App\Exceptions\PeppolValidationException;
|
||||||
use App\Services\EDocument\Standards\Peppol\RO;
|
use App\Services\EDocument\Standards\Peppol\RO;
|
||||||
use InvoiceNinja\EInvoice\Models\Peppol\PaymentMeans;
|
use InvoiceNinja\EInvoice\Models\Peppol\PaymentMeans;
|
||||||
use InvoiceNinja\EInvoice\Models\Peppol\ItemType\Item;
|
use InvoiceNinja\EInvoice\Models\Peppol\ItemType\Item;
|
||||||
@ -503,7 +504,8 @@ class Peppol extends AbstractService
|
|||||||
private function getTaxType($item): string
|
private function getTaxType($item): string
|
||||||
{
|
{
|
||||||
$tax_type = null;
|
$tax_type = null;
|
||||||
switch ($name) {
|
|
||||||
|
switch ($item->tax_id) {
|
||||||
case Product::PRODUCT_TYPE_SERVICE:
|
case Product::PRODUCT_TYPE_SERVICE:
|
||||||
case Product::PRODUCT_TYPE_DIGITAL:
|
case Product::PRODUCT_TYPE_DIGITAL:
|
||||||
case Product::PRODUCT_TYPE_PHYSICAL:
|
case Product::PRODUCT_TYPE_PHYSICAL:
|
||||||
@ -523,13 +525,13 @@ class Peppol extends AbstractService
|
|||||||
}
|
}
|
||||||
$eu_states = ["AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "EL", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE", "IS", "LI", "NO", "CH"];
|
$eu_states = ["AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "EL", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE", "IS", "LI", "NO", "CH"];
|
||||||
if (empty($tax_type)) {
|
if (empty($tax_type)) {
|
||||||
if ((in_array($this->document->company->country()->iso_3166_2, $eu_states) && in_array($this->document->client->country->iso_3166_2, $eu_states)) && $this->document->company->country()->iso_3166_2 != $this->document->client->country->iso_3166_2) {
|
if ((in_array($this->company->country()->iso_3166_2, $eu_states) && in_array($this->invoice->client->country->iso_3166_2, $eu_states)) && $this->document->company->country()->iso_3166_2 != $this->document->client->country->iso_3166_2) {
|
||||||
$tax_type = 'K';
|
$tax_type = 'K';
|
||||||
} elseif (!in_array($this->document->client->country->iso_3166_2, $eu_states)) {
|
} elseif (!in_array($this->invoice->client->country->iso_3166_2, $eu_states)) {
|
||||||
$tax_type = 'O';
|
$tax_type = 'O';
|
||||||
} elseif ($this->document->client->country->iso_3166_2 == "ES-CN") {
|
} elseif ($this->invoice->client->country->iso_3166_2 == "ES-CN") {
|
||||||
$tax_type = 'L';
|
$tax_type = 'L';
|
||||||
} elseif (in_array($this->document->client->country->iso_3166_2, ["ES-CE", "ES-ML"])) {
|
} elseif (in_array($this->invoice->client->country->iso_3166_2, ["ES-CE", "ES-ML"])) {
|
||||||
$tax_type = 'M';
|
$tax_type = 'M';
|
||||||
} else {
|
} else {
|
||||||
$tax_type = 'S';
|
$tax_type = 'S';
|
||||||
|
@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use App\Models\Country;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
|
||||||
|
$regions = [
|
||||||
|
[
|
||||||
|
'id' => 1000, // INE code for Canary Islands
|
||||||
|
'capital' => 'Las Palmas de Gran Canaria / Santa Cruz de Tenerife',
|
||||||
|
'citizenship' => 'Spanish',
|
||||||
|
'country_code' => 'ES',
|
||||||
|
'currency' => 'Euro',
|
||||||
|
'currency_code' => 'EUR',
|
||||||
|
'currency_sub_unit' => 'cent',
|
||||||
|
'full_name' => 'Canary Islands',
|
||||||
|
'iso_3166_2' => 'ES-CN',
|
||||||
|
'iso_3166_3' => 'ESP', // Spain's ISO 3166-3 code
|
||||||
|
'name' => 'Canary Islands',
|
||||||
|
'region_code' => '142',
|
||||||
|
'sub_region_code' => '024',
|
||||||
|
'eea' => true,
|
||||||
|
'swap_postal_code' => false,
|
||||||
|
'swap_currency_symbol' => false,
|
||||||
|
'thousand_separator' => '.',
|
||||||
|
'decimal_separator' => ',',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 1001, // INE code for Ceuta
|
||||||
|
'capital' => 'Ceuta',
|
||||||
|
'citizenship' => 'Spanish',
|
||||||
|
'country_code' => 'ES',
|
||||||
|
'currency' => 'Euro',
|
||||||
|
'currency_code' => 'EUR',
|
||||||
|
'currency_sub_unit' => 'cent',
|
||||||
|
'full_name' => 'Ceuta',
|
||||||
|
'iso_3166_2' => 'ES-CE',
|
||||||
|
'iso_3166_3' => 'ESP', // Spain's ISO 3166-3 code
|
||||||
|
'name' => 'Ceuta',
|
||||||
|
'region_code' => '142',
|
||||||
|
'sub_region_code' => '020',
|
||||||
|
'eea' => true,
|
||||||
|
'swap_postal_code' => false,
|
||||||
|
'swap_currency_symbol' => false,
|
||||||
|
'thousand_separator' => '.',
|
||||||
|
'decimal_separator' => ',',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 1002, // INE code for Melilla
|
||||||
|
'capital' => 'Melilla',
|
||||||
|
'citizenship' => 'Spanish',
|
||||||
|
'country_code' => 'ES',
|
||||||
|
'currency' => 'Euro',
|
||||||
|
'currency_code' => 'EUR',
|
||||||
|
'currency_sub_unit' => 'cent',
|
||||||
|
'full_name' => 'Melilla',
|
||||||
|
'iso_3166_2' => 'ES-ML',
|
||||||
|
'iso_3166_3' => 'ESP', // Spain's ISO 3166-3 code
|
||||||
|
'name' => 'Melilla',
|
||||||
|
'region_code' => '142',
|
||||||
|
'sub_region_code' => '021',
|
||||||
|
'eea' => true,
|
||||||
|
'swap_postal_code' => false,
|
||||||
|
'swap_currency_symbol' => false,
|
||||||
|
'thousand_separator' => '.',
|
||||||
|
'decimal_separator' => ',',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
Model::unguard();
|
||||||
|
|
||||||
|
foreach ($regions as $region) {
|
||||||
|
Country::create($region);
|
||||||
|
}
|
||||||
|
|
||||||
|
Model::reguard();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
};
|
@ -29,7 +29,7 @@ class CountriesSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
Model::unguard();
|
Model::unguard();
|
||||||
|
|
||||||
$countries = json_decode($this->countries, 1);
|
$countries = json_decode($this->countries, true);
|
||||||
|
|
||||||
foreach($countries as $country)
|
foreach($countries as $country)
|
||||||
{
|
{
|
||||||
|
@ -5328,6 +5328,9 @@ $lang = array(
|
|||||||
'payment_failed' => 'Payment Failed',
|
'payment_failed' => 'Payment Failed',
|
||||||
'ssl_host_override' => 'SSL Host Override',
|
'ssl_host_override' => 'SSL Host Override',
|
||||||
'upload_logo_short' => 'Upload Logo',
|
'upload_logo_short' => 'Upload Logo',
|
||||||
|
'country_Melilla' => 'Melilla',
|
||||||
|
'country_Ceuta' => 'Ceuta',
|
||||||
|
'country_Canary Islands' => 'Canary Islands',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $lang;
|
return $lang;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user