Hi Cindy
This is a fresh install that I am using.
Printable View
Hi Cindy
This is a fresh install that I am using.
Deb, I'm getting an update for VAT4EU going. In the interim, you can edit that naughty line in the Vat4EuAdminObserver, changing the highlighted function:
toCode:$vat_info =
'<tr>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td><strong>' . VAT4EU_ENTRY_VAT_NUMBER . '</strong></td>' . PHP_EOL .
' <td>' . zen_draw_input_field('vat_number', zen_html_quotes($vat_number), 'size="45"') . $valid_indicator . $hidden_fields . '</td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
'</tr>' . PHP_EOL .
'<tr>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td><strong>' . VAT4EU_ENTRY_OVERRIDE_VALIDATION . '</strong></td>' . PHP_EOL .
' <td>' . zen_draw_checkbox_field('vat_number_override', '', ($vat_validated == VatValidation::VAT_ADMIN_OVERRIDE)) . '</td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
'</tr>' . PHP_EOL;
$p2 .= $vat_info;
break;
Code:$vat_info =
'<tr>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td><strong>' . VAT4EU_ENTRY_VAT_NUMBER . '</strong></td>' . PHP_EOL .
' <td>' . zen_draw_input_field('vat_number', zen_db_output($vat_number), 'size="45"') . $valid_indicator . $hidden_fields . '</td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
'</tr>' . PHP_EOL .
'<tr>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td><strong>' . VAT4EU_ENTRY_OVERRIDE_VALIDATION . '</strong></td>' . PHP_EOL .
' <td>' . zen_draw_checkbox_field('vat_number_override', '', ($vat_validated == VatValidation::VAT_ADMIN_OVERRIDE)) . '</td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
' <td> </td>' . PHP_EOL .
'</tr>' . PHP_EOL;
$p2 .= $vat_info;
break;
I've just submitted v2.0.3 of VAT4EU to the Zen Cart moderators for their review; I'll post back here once it's available for download.
This release contains changes associated with the following GitHub issue:
#6: Correct call to unknown zen_html_quotes function.
That works! :cool: Thanks Cindy.
And yes please, do let us know when the update is okayed.
:hug:
Now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2164
Hello,
This add-on is unfortunately not working for VAT-Numbers from Greece.
(It seems a little bit strange to me, I'm the first, who noticed this, but I haven't found any information about this 'bug' in this thread - please excuse me, if I've missed something)
The problem is: Greek VAT-Numbers are an exception, they're starting with 'EL', but not with 'GR' (short Country cobe by ISO)
The problem can be fixed, by adding the following code:
afterCode:$country_iso_code_2 = $country_iso_code_2 == 'GR' ? 'EL' : $country_iso_code_2;
in validateVatNumber method (file Vat4EuAdminObserver.php)Code:$country_iso_code_2 = $this->getCountryIsoCode2($countries_id);
...Or you can simply replace ISO-2 code for Greece (from "GR" to "EL") :-)
Thanks for that! I've opened an issue on the VAT4EU GitHub to track the associated change.
@yesaul, I chose to make a slightly different change so that the corrected validation would apply to both the admin and the storefront, changing /includes/classes/VatValidation.php:
Code:// -----
// The class constructor gathers the to-be-verified country-code (2-character ISO) and
// the associated VAT Number. The "VAT Number" value must include any country code
// prefix.
//
// Since we'll need the SOAP service to automatically validate the VAT Number, check now
// to see that the PHP installation includes that service, logging a warning if not.
//
public function __construct($countryCode, $vatNumber)
{
if (defined('VAT4EU_ENABLED') && VAT4EU_ENABLED == 'true') {
$this->debug = (defined('VAT4EU_DEBUG') && VAT4EU_DEBUG == 'true');
// -----
// Greek VAT numbers start with 'EL' instead of their country-code ('GR').
//
$this->countryCode = ($countryCode == 'GR') ? 'EL' : $countryCode;
$this->vatNumber = strtoupper($vatNumber);
if (!class_exists('SoapClient')) {
trigger_error('VAT Number validation not possible, "SoapClient" class is not available.', E_USER_WARNING);;
} else {
$this->soapInstalled = true;
try {
$this->_client = new SoapClient(self::WSDL, array('trace' => true) );
} catch(Exception $e) {
$this->soapInstalled = false;
trigger_error("VAT Number validation not possible, VAT Translation Error: " . $e->getMessage(), E_USER_WARNING);
}
}
$this->trace("__construct($countryCode, $vatNumber)");
}
}
@lat9, Sure, your solution is better :-)
But note: it is necessary also to replace 'EL' to 'GR' (or simply add 'GR') in VAT4EU_EU_COUNTRIES configuration key