﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking
1581	VAT-Validation-Klasse hard-codierte Country-Liste	noRiddle	somebody	"In der ''/includes/classes/vat_validation.php'' ist im folgenden switch-Block die EU-Countries-Liste hard-codiert aufgeführt:

{{{
     switch ($country_iso_code) {
        case 'AT':
        case 'BE':
        ...
          $t_result = $this->checkVatID_EU($vatNumber, $country_iso_code);
          break;
        default:
          $t_result = 8; //unknown country
          break;
      }
}}}

Ich bin der Meinung, daß man das ändern sollte, damit bliebe man flexiber (z.B. würde bei Brexit ein DB-Update ausreichen).

Z.B. so:
Im ''__construct()''

{{{
    $this->eu_countries = array();
    $eu_countries_qu = xtc_db_query(""SELECT c.countries_iso_code_2
                                       FROM countries c
                                       JOIN zones_to_geo_zones ztgz
                                         ON ztgz.zone_country_id = c.countries_id
                                      WHERE ztgz.geo_zone_id = 5
                                   ORDER BY c.countries_iso_code_2"");
    while($eu_countries_arr = xtc_db_fetch_array($eu_countries_qu)) {
        $this->eu_countries[] = $eu_countries_arr['countries_iso_code_2'];
    }
}}}

und im switch dann

{{{
      swith(true) {
        in_array($country_iso_code, $this->eu_countries):
          $t_result = $this->checkVatID_EU($vatNumber, $country_iso_code);
          break;
        default:
          $t_result = 8; //unknown country
          break;
      }
}}}

oder schlicht mit ''if else'' .

'''Oder ist die Gefahr zu groß, daß einer etwas bei den Steuerzonen und deren Länderzuordnung ändert, sodaß die ''geo_zone_id'' nicht mehr 5 ist ?'''


Gruß,
noRiddle"	Aufgabe	new	normal	modified-shop-2.1.0.0	Shop	2.0.4.2					
