function vam_get_country_list($name, $selected = '', $parameters = '')
{
    $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
    //    Probleme mit register_globals=off -> erstmal nur auskommentiert. Kann u.U. gelцscht werden.
    $countries = vam_get_countriesList();
    for ($i = 0, $n = sizeof($countries); $i < $n; $i++) {
        $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
    }
    if (is_array($name)) {
        return vam_draw_pull_down_menuNote($name, $countries_array, $selected, $parameters);
    }
    return vam_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
}
function vam_get_country_name($country_id)
{
    $country_array = vam_get_countriesList($country_id);
    return $country_array['countries_name'];
}
Ejemplo n.º 3
0
 function validate_vatid($vat_id, $country_id)
 {
     $remove = array(' ', '-', '/', '\\', '.', ':', ',');
     $results = array(0 => '0', 1 => '1', 8 => '8', 9 => '9');
     //$results = array(0 => 'false', 1 => 'true', 8 => 'unknown country', 9 => 'unknown algorithm');
     $vat_id = trim(chop($vat_id));
     // sonderzeichen entfernen
     for ($i = 0; $i < count($remove); $i++) {
         $vat_id = str_replace($remove[$i], '', $vat_id);
     }
     // end for($i = 0; $i < count($remove)); $i++)
     // land bestimmen
     // RWS starts
     // Get country ISO code after $country_id
     $country_array = array();
     $country_array = vam_get_countriesList($country_id, true);
     $vat_id_country = strtolower($country_array['countries_iso_code_2']);
     // Check if $vat_id contains country code already. If not, add it to $vat_id
     $country = strtolower(substr($vat_id, 0, 2));
     if ($vat_id_country != $country) {
         $country = $vat_id_country;
         $vat_id = $country . $vat_id;
     }
     // RWS ends
     // je nach land anders behandeln
     switch ($country) {
         case 'ad':
             // andorra
             return $results[9];
         case 'be':
             // belgien
             return $results[$this->checkVatID_be($vat_id)];
         case 'bg':
             // bulgarien
             return $results[9];
         case 'dk':
             // daenemark
             return $results[$this->checkVatID_dk($vat_id)];
         case 'de':
             // deutschland
             return $results[$this->checkVatID_de($vat_id)];
         case 'ee':
             // estland
             return $results[$this->checkVatID_ee($vat_id)];
         case 'fi':
             // finnland
             return $results[$this->checkVatID_fi($vat_id)];
         case 'fr':
             // frankreich
             return $results[$this->checkVatID_fr($vat_id)];
         case 'gi':
             // gibraltar
             return $results[9];
         case 'el':
             // griechenland
             return $results[$this->checkVatID_el($vat_id)];
         case 'gb':
             // grossbrittanien
         // grossbrittanien
         case 'uk':
             // grossbrittanien
             return $results[$this->checkVatID_gb($vat_id)];
         case 'ie':
             // irland
             return $results[$this->checkVatID_ie($vat_id)];
         case 'is':
             // island
             return $results[9];
         case 'it':
             // italien
             return $results[$this->checkVatID_it($vat_id)];
         case 'lv':
             // lettland
             return $results[$this->checkVatID_lv($vat_id)];
         case 'lt':
             // litauen
             return $results[$this->checkVatID_lt($vat_id)];
         case 'lu':
             // luxemburg
             return $results[$this->checkVatID_lu($vat_id)];
         case 'mt':
             // malta
             return $results[$this->checkVatID_mt($vat_id)];
         case 'nl':
             // niederlande
             return $results[$this->checkVatID_nl($vat_id)];
         case 'no':
             // norwegen
             return $results[9];
         case 'at':
             // oesterreich
             return $results[$this->checkVatID_at($vat_id)];
         case 'pl':
             // polen
             return $results[$this->checkVatID_pl($vat_id)];
         case 'pt':
             // portugal
             return $results[$this->checkVatID_pt($vat_id)];
         case 'ro':
             // rumaenien
             return $results[9];
         case 'se':
             // schweden
             return $results[$this->checkVatID_se($vat_id)];
         case 'ch':
             // schweiz
             return $results[9];
         case 'sk':
             // slowakai
             return $results[$this->checkVatID_sk($vat_id)];
         case 'si':
             // slowenien
         // slowenien
         case 'sl':
             // welches ist richtig?
             return $results[$this->checkVatID_si($vat_id)];
         case 'es':
             // spanien
             return $results[$this->checkVatID_es($vat_id)];
         case 'cz':
             // tschechien
             return $results[$this->checkVatID_cz($vat_id)];
         case 'hu':
             // ungarn
             return $results[$this->checkVatID_hu($vat_id)];
         case 'cy':
             // zypern
             return $results[9];
         case 'r0':
             // canadian LUHN-10 code checking
         // canadian LUHN-10 code checking
         case 'r1':
         case 'r2':
         case 'r3':
         case 'r4':
         case 'r5':
         case 'r6':
         case 'r7':
         case 'r8':
         case 'r9':
             return $results[$this->checkVatID_c($vat_id)];
         default:
             return $results[8];
     }
 }
function vam_get_countries_with_iso_codes($countries_id)
{
    return vam_get_countriesList($countries_id, true);
}