Beim synchronisieren der legacy-Kontakte: ermögliche leeren Namen
Bernd Wurst

Bernd Wurst commited on 2018-01-24 16:48:03
Zeige 1 geänderte Dateien mit 10 Einfügungen und 3 Löschungen.

... ...
@@ -151,9 +151,15 @@ function sync_legacy_contactdata()
151 151
     $cid = (int) $_SESSION['customerinfo']['customerno'];
152 152
     $kundenkontakte = get_kundenkontakte();
153 153
     $kunde = get_contact($kundenkontakte['kunde']);
154
+    $vorname = NULL;
155
+    $nachname = NULL;
156
+    if ($kunde['name']) {
157
+        $vorname = explode(' ', $kunde['name'], 2)[0];
158
+        $nachname = explode(' ', $kunde['name'], 2)[1];
159
+    }
154 160
     $args = array("firma" => $kunde['company'],
155
-            "vorname" => explode(' ', $kunde['name'], 2)[0],
156
-            "nachname" => explode(' ', $kunde['name'], 2)[1],
161
+            "vorname" => $vorname,
162
+            "nachname" => $nachname,
157 163
             "adresse" => $kunde['address'],
158 164
             "plz" => $kunde['zip'],
159 165
             "ort" => $kunde['city'],
... ...
@@ -301,7 +307,8 @@ function delete_contact($id) {
301 307
 
302 308
 
303 309
 function domainlist_by_contact($c) {
304
-    $result = db_query("SELECT id FROM kundendaten.domains WHERE owner=? OR admin_c=?", array($c['id'], $c['id']));
310
+    $cid = (int) $_SESSION['customerinfo']['customerno'];
311
+    $result = db_query("SELECT id FROM kundendaten.domains WHERE (owner=? OR admin_c=?) AND kunde=?", array($c['id'], $c['id'], $cid));
305 312
     $ret = array();
306 313
     while ($domain = $result->fetch()) {
307 314
         $ret[] = new Domain( (int) $domain['id'] );
308 315