Refactor invoice PDF generation and VAT validation
- Updated PDF template to display a fixed software code instead of "SOFTWARE". - Changed VAT label to include tax label dynamically and set to 0% for certain conditions. - Enhanced JavaScript for VAT number validation with asynchronous checks against the VIES database. - Implemented debounce for VAT number input to optimize validation calls. - Updated country settings to include country codes for VAT validation. - Modified email sending functions in webhook handlers to use dynamic attachment names for invoices.
This commit is contained in:
@@ -1735,7 +1735,8 @@ function getProfile($profile, $permission){
|
||||
'software_download' => 'R',
|
||||
'software_available' => 'R',
|
||||
'history' => 'RU',
|
||||
'payment' => 'RU'
|
||||
'payment' => 'RU',
|
||||
'vat_check' => 'RU'
|
||||
];
|
||||
|
||||
// 1. Check if basic_permission_level is 4 (System-admin+) - always allow
|
||||
@@ -5725,7 +5726,7 @@ function generateSoftwareInvoice($invoice_data, $order_id, $language = 'US') {
|
||||
$lbl_quantity = $translations['quantity'] ?? 'Quantity';
|
||||
$lbl_price = $translations['price'] ?? 'Price';
|
||||
$lbl_subtotal = $translations['subtotal'] ?? 'Subtotal';
|
||||
$lbl_tax = $translations['tax'] ?? 'Tax';
|
||||
$lbl_tax = $translations['tax'] ?? 'Vat';
|
||||
$lbl_shipping = $translations['shipping'] ?? 'Shipping';
|
||||
$lbl_discount = $translations['discount'] ?? 'Discount';
|
||||
$lbl_total = $translations['total'] ?? 'Total';
|
||||
@@ -5865,7 +5866,8 @@ function generateCountriesFile($token){
|
||||
$countries[$tax['id']] = [
|
||||
'country' => $tax['country'] ?? '',
|
||||
'taxes' => $tax['rate'] ?? 0,
|
||||
'eu' => $tax['eu'] ?? 0
|
||||
'eu' => $tax['eu'] ?? 0,
|
||||
'country_code' => $tax['country_code'] ?? ''
|
||||
];
|
||||
}
|
||||
|
||||
@@ -5875,7 +5877,7 @@ function generateCountriesFile($token){
|
||||
$fileContent .= "// Generated on: " . date('Y-m-d H:i:s') . "\n\n";
|
||||
$fileContent .= "\$countries = [\n";
|
||||
foreach($countries as $id => $data){
|
||||
$fileContent .= " " . $id . " => ['country' => '" . addslashes($data['country']) . "', 'taxes' => " . $data['taxes'] . ",'eu' => " . $data['eu'] . "],\n";
|
||||
$fileContent .= " " . $id . " => ['country' => '" . addslashes($data['country']) . "', 'taxes' => " . $data['taxes'] . ",'eu' => " . $data['eu'] . ", 'country_code' => '" . addslashes($data['country_code']) . "'],\n";
|
||||
}
|
||||
$fileContent .= "];\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user