Browse code

ensure two-character-country codes

Bernd Wurst authored on 16/11/2021 07:27:52
Showing 1 changed files
... ...
@@ -243,6 +243,12 @@ function save_contact($c)
243 243
     unset($c['lastchange']);
244 244
     unset($c['email']);
245 245
     $c['customer'] = (int) $_SESSION['customerinfo']['customerno'];
246
+    if ($c['country'] == 'D') {
247
+        $c['country'] = 'DE';
248
+    }
249
+    if (strlen($c['country']) != 2) {
250
+        system_failure('Bitte geben Sie das Land als Zwei-Buchstaben-K├╝rzel an.');
251
+    }
246 252
     if ($c['id']) {
247 253
         // Kontakt bestaht schon, Update
248 254
         db_query("UPDATE kundendaten.contacts SET nic_id=:nic_id, nic_handle=:nic_handle, salutation=:salutation, company=:company, name=:name, address=:address, zip=:zip, city=:city, country=:country, phone=:phone, mobile=:mobile, fax=:fax, pgp_id=:pgp_id, pgp_key=:pgp_key WHERE id=:id AND customer=:customer", $c);