1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Updates for translations

This commit is contained in:
David Bomba 2024-05-20 07:50:39 +10:00
parent fb9c3aca59
commit e8907beeab
7 changed files with 325 additions and 47 deletions

View File

@ -170,9 +170,9 @@ class PayPalRestPaymentDriver extends BaseDriver
$data['currency'] = $this->client->currency()->code;
// return render('gateways.paypal.ppcp.card', $data);
return render('gateways.paypal.ppcp.card', $data);
return render('gateways.paypal.pay', $data);
// return render('gateways.paypal.pay', $data);
}

View File

@ -5320,6 +5320,11 @@ $lang = array(
'task_round_to_nearest' => 'Round To Nearest',
'bulk_updated' => 'Successfully updated data',
'bulk_update' => 'Bulk Update',
'calculate' => 'Calculate',
'sum' => 'Sum',
'money' => 'Money',
'web_app' => 'Web App',
'desktop_app' => 'Desktop App',
);
return $lang;

View File

@ -5297,6 +5297,26 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette
'local_domain_help' => 'Domaine EHLO (facultatif)',
'port_help' => 'ex. 25,587,465',
'host_help' => 'ex. smtp.gmail.com',
'always_show_required_fields' => 'Permet l\'affichage des champs requis d\'un formulaire',
'always_show_required_fields_help' => 'Affiche toujours les champs requis d\'un formulaire au paiement',
'advanced_cards' => 'Cartes avancées',
'activity_140' => 'État de compte envoyé à :client',
'invoice_net_amount' => 'Montant net de la facture',
'round_to_minutes' => 'Arrondir aux minutes',
'1_minute' => '1 minute',
'5_minutes' => '5 minutes',
'15_minutes' => '15 minutes',
'30_minutes' => '30 minutes',
'1_hour' => '1 heure',
'1_day' => '1 jour',
'round_tasks' => 'Arrondir les tâches',
'round_tasks_help' => 'Arrondir les intervales à la sauvegarde des tâches',
'direction' => 'Direction',
'round_up' => 'Arrondir à hausse',
'round_down' => 'Arrondir à la baisse',
'task_round_to_nearest' => 'Arrondir au plus près',
'bulk_updated' => 'Les données ont été mises à jour',
'bulk_update' => 'Mise à jour groupée',
);
return $lang;

View File

@ -700,7 +700,7 @@ $lang = array(
'total_invoiced' => 'Total Invoiced',
'open_balance' => 'Open Balance',
'verify_email' => 'Please visit the link in the account confirmation email to verify your email address.',
'basic_settings' => 'Basic Settings',
'basic_settings' => '基本設定',
'pro' => 'Pro',
'gateways' => 'ペイメントゲートウェイ',
'next_send_on' => 'Send Next: :date',
@ -1344,7 +1344,7 @@ $lang = array(
'auto_bill_payment_method_credit_card' => 'クレジットカード',
'auto_bill_payment_method_paypal' => 'PayPal アカウント',
'auto_bill_notification_placeholder' => 'この請求書は、期日にて登録されているクレジットカードに自動的に請求されます。',
'payment_settings' => 'Payment Settings',
'payment_settings' => '支払い設定',
'on_send_date' => '発送日',
'on_due_date' => '支払期日',
@ -5300,6 +5300,26 @@ $lang = array(
'local_domain_help' => 'EHLO domain (optional)',
'port_help' => 'ie. 25,587,465',
'host_help' => 'ie. smtp.gmail.com',
'always_show_required_fields' => 'Allows show required fields form',
'always_show_required_fields_help' => 'Displays the required fields form always at checkout',
'advanced_cards' => 'Advanced Cards',
'activity_140' => 'Statement sent to :client',
'invoice_net_amount' => 'Invoice Net Amount',
'round_to_minutes' => 'Round To Minutes',
'1_minute' => '1 Minute',
'5_minutes' => '5 Minutes',
'15_minutes' => '15 Minutes',
'30_minutes' => '30 Minutes',
'1_hour' => '1 Hour',
'1_day' => '1 Day',
'round_tasks' => 'Round Tasks',
'round_tasks_help' => 'Round time intervals when saving tasks',
'direction' => 'Direction',
'round_up' => 'Round Up',
'round_down' => 'Round Down',
'task_round_to_nearest' => 'Round To Nearest',
'bulk_updated' => 'Successfully updated data',
'bulk_update' => 'Bulk Update',
);
return $lang;

View File

@ -171,15 +171,10 @@ class SquareCreditCard {
document.querySelector('input[name=token]').value = '';
});
// let toggleWithToken = document.querySelector(
// '.toggle-payment-with-token'
// );
// if (!toggleWithToken) {
document.getElementById('loader').classList.add('hidden');
document.getElementById('payment-list').classList.remove('hidden');
document.getElementById('toggle-payment-with-credit-card')?.click();
// }
});
}

View File

@ -12,6 +12,8 @@
namespace Tests\Integration\Einvoice;
use Tests\TestCase;
use Sabre\Xml\Reader;
use Sabre\Xml\Service;
use Invoiceninja\Einvoice\Models\FACT1\Invoice;
/**
@ -20,54 +22,177 @@ use Invoiceninja\Einvoice\Models\FACT1\Invoice;
class FACT1Test extends TestCase
{
public array $set = [];
protected function setUp(): void
{
parent::setUp();
}
public function testValidationFact1()
// public function testValidationFact1()
// {
// $files = [
// 'tests/Integration/Einvoice/samples/fact1.xml',
// ];
// foreach($files as $f) {
// $xml = file_get_contents($f);
// // Remove namespaces and prefixes
// $xmlWithoutNamespacesAndPrefixes = $this->removeNamespacesAndPrefixes($xml);
// // Output the result
// nlog($xmlWithoutNamespacesAndPrefixes);
// }
public function removeNamespacesFromArray($data)
{
$files = [
'tests/Integration/Einvoice/samples/fact1.xml',
];
foreach($files as $f) {
$xmlstring = file_get_contents($f);
// nlog($xmlstring);
$xml = simplexml_load_string($xmlstring, "SimpleXMLElement");
$json = json_encode($xml);
$payload = json_decode($json, true);
nlog($xml);
nlog($payload);
$validation_array = false;
try {
$rules = Invoice::getValidationRules($payload);
nlog($rules);
$this->assertIsArray($rules);
$payload = Invoice::from($payload)->toArray();
nlog($payload);
$this->assertIsArray($payload);
$validation_array = Invoice::validate($payload);
$this->assertIsArray($validation_array);
} catch(\Illuminate\Validation\ValidationException $e) {
nlog($e->errors());
if (is_array($data)) {
foreach ($data as &$item) {
if (isset($item['name'])) {
// Remove the namespace from the name
$item['name'] = preg_replace('/^\{\}(.+)/', '$1', $item['name']);
}
if (isset($item['value']) && is_array($item['value'])) {
// Recursively process child elements
$item['value'] = $this->removeNamespacesFromArray($item['value']);
}
if (isset($item['attributes'])) {
unset($item['attributes']);
// Process attributes if needed
// $item['attributes'] = array_map(function ($attr) {
// return preg_replace('/^\{\}(.+)/', '$1', $attr);
// }, $item['attributes']);
}
}
}
return $data;
}
$this->assertIsArray($validation_array);
function convertToKeyValue($data)
{
$result = [];
foreach ($data as $item) {
// Remove namespace prefix if present
$name = preg_replace('/^\{\}(.+)/', '$1', $item['name']);
$result[$name] = $item['value'];
}
return $result;
}
public function keyValueDeserializer(Reader $reader)
{
$values = [];
$reader->read();
$reader->next();
foreach ($reader->parseGetElements() as $element) {
// Strip the namespace prefix
echo "merp".PHP_EOL;
$name = preg_replace('/^\{\}.*/', '', $element['name']);
$values[$name] = $element['value'];
}
return $values;
}
public function testFactToArray()
{
$xml = file_get_contents('tests/Integration/Einvoice/samples/fact1_no_prefixes.xml');
$service = new Service();
// $service->elementMap = [
// '{}' => 'Sabre\Xml\Deserializer\keyValue',
// ];
// $service->elementMap = [
// '{}*' => function (Reader $reader) use ($service) {
// return $this->keyValueDeserializer($reader);
// }
// ];
$result = $this->removeNamespacesFromArray($service->parse($xml));
// Convert parsed XML to key-value array
if (isset($result['value']) && is_array($result['value'])) {
$keyValueArray = $this->convertToKeyValue($result['value']);
} else {
$keyValueArray = [];
}
// Output the result
nlog($keyValueArray);
// nlog($cleanedArray);
nlog($service->parse($xml));
}
// Output the result
// ($xmlWithoutNamespaces);
// $reader = new Reader();
// $service = new Service();
// $service->elementMap = [
// '*' => 'Sabre\Xml\Deserializer\keyValue',
// ];
// nlog($service->parse($xmlstring));
// $payload ='';
// // $reader->xml($xmlstring);
// // $payload = $reader->parse();
// // nlog($payload);
// $validation_array = false;
// try {
// $rules = Invoice::getValidationRules($payload);
// nlog($rules);
// $this->assertIsArray($rules);
// $payload = Invoice::from($payload)->toArray();
// nlog($payload);
// $this->assertIsArray($payload);
// $validation_array = Invoice::validate($payload);
// $this->assertIsArray($validation_array);
// } catch(\Illuminate\Validation\ValidationException $e) {
// nlog($e->errors());
// }
// $this->assertIsArray($validation_array);
// }
private function extractName($name): string
{
$pattern = '/\{[^{}]*\}([^{}]*)/';
if (preg_match($pattern, $name, $matches)) {
$extracted = $matches[1];
return $extracted;
}
return $name;
}
}

View File

@ -0,0 +1,113 @@
<?xml version="1.0"?>
<Invoice>
<UBLVersionID>2.1</UBLVersionID>
<CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:efactura.mfinante.ro:CIUS-RO:1.0.1</CustomizationID>
<ID>ABC 0020</ID>
<IssueDate>2024-01-01</IssueDate>
<DueDate>2024-01-15</DueDate>
<InvoiceTypeCode>384</InvoiceTypeCode>
<DocumentCurrencyCode>RON</DocumentCurrencyCode>
<TaxCurrencyCode>RON</TaxCurrencyCode>
<AccountingSupplierParty>
<Party>
<PartyIdentification>
<ID>234234234</ID>
</PartyIdentification>
<PostalAddress>
<StreetName>This can be the full address , not just the street and street nr.</StreetName>
<CityName>SECTOR2</CityName>
<CountrySubentity>RO-B</CountrySubentity>
<Country>
<IdentificationCode>RO</IdentificationCode>
</Country>
</PostalAddress>
<PartyTaxScheme>
<CompanyID>RO234234234</CompanyID>
<TaxScheme>
<ID>VAT</ID>
</TaxScheme>
</PartyTaxScheme>
<PartyLegalEntity>
<RegistrationName>Some Copany Name</RegistrationName>
<CompanyID>J40/2222/2009</CompanyID>
</PartyLegalEntity>
<Contact>
<Name>Someone</Name>
<Telephone>88282819832</Telephone>
<ElectronicMail>some@email.com</ElectronicMail>
</Contact>
</Party>
</AccountingSupplierParty>
<AccountingCustomerParty>
<Party>
<PartyIdentification>
<ID>646546549</ID>
</PartyIdentification>
<PostalAddress>
<StreetName>This can be the full address , not just the street and street nr.</StreetName>
<CityName>SECTOR3</CityName>
<CountrySubentity>RO-B</CountrySubentity>
<Country>
<IdentificationCode>RO</IdentificationCode>
</Country>
</PostalAddress>
<PartyLegalEntity>
<RegistrationName>Some Comapny</RegistrationName>
<CompanyID>646546549</CompanyID>
</PartyLegalEntity>
<Contact>
<Name>Someone</Name>
<Telephone />
<ElectronicMail>some@email.com</ElectronicMail>
</Contact>
</Party>
</AccountingCustomerParty>
<PaymentMeans>
<PaymentMeansCode>42</PaymentMeansCode>
<PayeeFinancialAccount>
<ID>some account nr</ID>
<Name>Bank name</Name>
</PayeeFinancialAccount>
</PaymentMeans>
<TaxTotal>
<TaxAmount currencyID="RON">63.65</TaxAmount>
<TaxSubtotal>
<TaxableAmount currencyID="RON">335.00</TaxableAmount>
<TaxAmount currencyID="RON">63.65</TaxAmount>
<TaxCategory>
<ID>S</ID> // this is a speciffic identifier for the VAT type <Percent>
19</Percent>
<TaxScheme>
<ID>VAT</ID>
</TaxScheme>
</TaxCategory>
</TaxSubtotal>
</TaxTotal>
<LegalMonetaryTotal>
<LineExtensionAmount currencyID="RON">335.00</LineExtensionAmount>
<TaxExclusiveAmount currencyID="RON">335.00</TaxExclusiveAmount>
<TaxInclusiveAmount currencyID="RON">398.65</TaxInclusiveAmount>
<AllowanceTotalAmount currencyID="RON">0.00</AllowanceTotalAmount>
<PayableAmount currencyID="RON">398.65</PayableAmount>
</LegalMonetaryTotal>
<InvoiceLine>
<ID>1</ID>
<InvoicedQuantity unitCode="H87">1</InvoicedQuantity> // unitcode is a speciffic
identifier for the type of product <LineExtensionAmount currencyID="RON">
335.00</LineExtensionAmount>
<Item>
<Description>Some Description</Description>
<Name>Some product</Name>
<ClassifiedTaxCategory>
<ID>S</ID> // this is a speciffic identifier for the VAT type <Percent>
19</Percent>
<TaxScheme>
<ID>VAT</ID>
</TaxScheme>
</ClassifiedTaxCategory>
</Item>
<Price>
<PriceAmount currencyID="RON">335</PriceAmount>
</Price>
</InvoiceLine>
</Invoice>