Currently, the local check for correct format of the VAT ID is not consistent over all countries. The printed error message on an incorrect format sometimes tells us that the correct format must be "CC + x characters", however for other countries just "1 block of x characters" (not mentioning the country code). These messages include an example VAT ID on the beginning, separated from the rest of the message by different characters: sometimes a TAB plus comma, some other times a space plus comma, other times just a space and so on.

The message output should be in a consistent format for all countries.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

roball’s picture

I have carefully reviewed the checking code in _vat_number_check_vat_format() for all 28 EU countries and made it consistent by the attached patch. The error message now always contains a format guide beginning with "CC + ", and has the example(s) separated in a new line. The text of the format guide is now translatable.

The patch also corrects format validation for Croatia and Greece. Greece was not validated at all, because its country code in the VAT ID number (EL) differs from the country's official ISO 3166-1 alpha-2 country code (GR). Croatia (HR) had code used from Hungary (HU).

The attached two screenshots show the difference of the error message before and after applying the patch.

dwkitchen’s picture

Status: Needs review » Fixed

Thanks for cleaning all those up and the issue with Greece using two country codes. At least we only use GB in UK.

roball’s picture

Perfect! Thank you very much for committing this patch. I think it was an important step to make this module mature.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.