function zen_verif_tva($num_tva)
{
    $num_tva = preg_replace('/ +/', "", $num_tva);
    $prefix = substr($num_tva, 0, 2);
    if (array_search($prefix, zen_get_tva_intracom_array()) === false) {
        return 'false';
    }
    $tva = substr($num_tva, 2);
    // 070208 BEGIN
    $opts = array('http' => array('method' => "POST", 'content' => "iso=" . $prefix . "&ms=" . $prefix . "&vat=" . $tva . "&BtnSubmitVat=Verify"));
    $context = stream_context_create($opts);
    // 070208 END
    $monfd = file_get_contents('http://ec.europa.eu/taxation_customs/vies/viesquer.do', null, $context);
    // 170810
    if (preg_match("/invalid VAT number/i", $monfd)) {
        return 'false';
    } elseif (preg_match("/valid VAT number/i", $monfd)) {
        return 'true';
    } else {
        $myVerif = 'no_verif';
    }
    return $myVerif;
}
     $messageStack->add('addressbook', ENTRY_LAST_NAME_ERROR);
 }
 // TVA_INTRACOM BEGIN
 if (ACCOUNT_COMPANY == 'true') {
     if ((int) ENTRY_COMPANY_MIN_LENGTH > 0 && strlen($company) < ENTRY_COMPANY_MIN_LENGTH) {
         $error = true;
         $messageStack->add('addressbook', ENTRY_COMPANY_ERROR);
     }
     if (strlen($tva_intracom) != 0) {
         if (strlen($company) < 1) {
             $error = true;
             $messageStack->add('addressbook', ENTRY_COMPANY_ERROR);
         }
         if (is_numeric($country)) {
             $country_code = zen_get_countries_with_iso_codes($country);
             $intracom_array = zen_get_tva_intracom_array();
             if (substr(strtoupper(trim($tva_intracom)), 0, 2) != $intracom_array[$country_code['countries_iso_code_2']]) {
                 $error = true;
                 $messageStack->add('addressbook', ENTRY_CONTROL_TVA_INTRACOM_COUNTRY);
             }
         }
         if (ENTRY_TVA_INTRACOM_CHECK == 'true') {
             $result_tva = zen_verif_tva(strtoupper(rtrim($tva_intracom)));
             if ($result_tva == 'false') {
                 $error = true;
                 $messageStack->add('addressbook', ENTRY_CONTROL_TVA_INTRACOM);
             } elseif ($result_tva == 'no_verif') {
                 $error = true;
                 $messageStack->add('addressbook', ENTRY_NO_VERIF_TVA_INTRACOM);
             }
         } elseif (strlen($tva_intracom) < ENTRY_TVA_INTRACOM_MIN_LENGTH) {
 }
 if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
     $error = true;
     $messageStack->add('checkout_address', ENTRY_STREET_ADDRESS_ERROR);
 }
 // TVA_INTRACOM BEGIN
 if (ACCOUNT_COMPANY == 'true') {
     if (strlen($company) != 0 && strlen($company) < ENTRY_COMPANY_MIN_LENGTH) {
         $error = true;
         $messageStack->add('checkout_address', ENTRY_COMPANY_ERROR);
     }
     if (ENTRY_TVA_INTRACOM_CHECK == 'true') {
         if (strlen($tva_intracom) != 0) {
             if (is_numeric($country)) {
                 $country_code = zen_get_countries_with_iso_codes($country);
                 if (array_search($country_code['countries_iso_code_2'], array_keys(zen_get_tva_intracom_array())) === false || array_search(substr(strtoupper(trim($tva_intracom)), 0, 2), zen_get_tva_intracom_array()) === false) {
                     $error = true;
                     $messageStack->add('checkout_address', ENTRY_CONTROL_TVA_INTRACOM_COUNTRY);
                 }
             }
             $result_tva = zen_verif_tva(strtoupper(rtrim($tva_intracom)));
             if ($result_tva == 'false') {
                 $error = true;
                 $messageStack->add('checkout_address', ENTRY_CONTROL_TVA_INTRACOM);
             } elseif ($result_tva == 'no_verif') {
                 $error = true;
                 $messageStack->add('checkout_address', ENTRY_NO_VERIF_TVA_INTRACOM);
             }
         }
     } else {
         if (strlen($tva_intracom) != 0 && strlen($tva_intracom) < ENTRY_TVA_INTRACOM_MIN_LENGTH) {