Warnung gefixed
bernd

bernd commited on 2010-04-13 09:23:46
Zeige 1 geänderte Dateien mit 9 Einfügungen und 9 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1721 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -107,23 +107,23 @@ function get_customer_info($customer)
107 107
   if ($customerno != 0)
108 108
   {
109 109
     DEBUG('Looking up customerinfo for customer no. '.$customerno);
110
-    $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name FROM kundendaten.kunden WHERE id={$customerno} LIMIT 1;");
110
+    $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, COALESCE(email,email_rechnung,email_extern) AS email FROM kundendaten.kunden WHERE id={$customerno} LIMIT 1;");
111 111
   }
112 112
   else
113 113
   {
114 114
     $username = mysql_real_escape_string($customer);
115 115
     DEBUG('looking up customer info for username '.$username);
116
-    $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, email FROM kundendaten.kunden AS k JOIN system.v_useraccounts AS u ON (u.kunde=k.id) WHERE u.username='{$username}'");
116
+    $result = db_query("SELECT id, anrede, firma, CONCAT_WS(' ', vorname, nachname) AS name, COALESCE(email,email_rechnung,email_extern) AS email FROM kundendaten.kunden AS k JOIN system.v_useraccounts AS u ON (u.kunde=k.id) WHERE u.username='{$username}'");
117 117
   }
118 118
   if (@mysql_num_rows($result) == 0)
119 119
     system_failure("Konnte Kundendaten nicht auslesen!");
120
-  $data = mysql_fetch_object($result);
121
-
122
-  $ret['customerno'] = $data->id;
123
-  $ret['title'] = $data->anrede;
124
-  $ret['company'] = $data->firma;
125
-  $ret['name'] = $data->name;
126
-  $ret['email'] = $data->email;
120
+  $data = mysql_fetch_assoc($result);
121
+  DEBUG($data);
122
+  $ret['customerno'] = $data['id'];
123
+  $ret['title'] = $data['anrede'];
124
+  $ret['company'] = $data['firma'];
125
+  $ret['name'] = $data['name'];
126
+  $ret['email'] = $data['email'];
127 127
   
128 128
   return $ret;
129 129
 }
130 130