Extra Kundenkontakt-Tabelle ist obsolet
bernd

bernd commited on 2010-02-03 15:47:12
Zeige 1 geänderte Dateien mit 1 Einfügungen und 67 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1652 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -7,66 +7,6 @@ require_once('inc/debug.php');
7 7
 require_once('class/keksdata.php');
8 8
 
9 9
 
10
-class ContactMethod extends KeksData
11
-{
12
-  function __construct($init = NULL)
13
-  {
14
-    $this->default_table = 'kundendaten.kundenkontakt';
15
-    $this->setup();
16
-    if ($init != NULL)
17
-      switch (gettype($init))
18
-      {
19
-        case 'string':
20
-          $this->loadByAddress($init);
21
-          break;
22
-        case 'integer':
23
-          $this->loadByID($init);
24
-          break;
25
-      }
26
-  }
27
-
28
-
29
-  function loadByAddress($name)
30
-  {
31
-    $name = mysql_real_escape_string($name);
32
-    DEBUG("Requested to load ContactMethod-object for address »{$name}«");
33
-    $res = $this->getData("*", "wert='{$name}' LIMIT 1");
34
-    if (count($res) < 1)
35
-    {
36
-      DEBUG('nothing found');
37
-      return false;
38
-    }
39
-    $this->parse($res[0]);
40
-    return true;
41
-  }
42
-
43
-
44
-  function loadByCustomer($cid, $comment = '')
45
-  {
46
-    $cid = (int) $cid;
47
-    $comment = mysql_real_escape_string($comment);
48
-    DEBUG("Requested to load ContactMethod-object for customer »{$cid}« (comment = {$comment})");
49
-    $res = $this->getData("*", "kundennr='{$cid}' AND (comment='{$comment}' OR (comment IS NULL AND '{$comment}'='')) LIMIT 1");
50
-    if (count($res) < 1)
51
-    {
52
-      DEBUG('nothing found');
53
-      return false;
54
-    }
55
-    $this->parse($res[0]);
56
-    return true;
57
-  }
58
-  
59
-  function parse($data)
60
-  {
61
-    foreach (array_keys($this->data) as $key)
62
-      if (array_key_exists($key, $data))
63
-        $this->data[$key] = $data[$key];
64
-  }
65
-
66
-}
67
-
68
-
69
-
70 10
 class Customer extends KeksData
71 11
 {
72 12
   function __construct($init = NULL)
... ...
@@ -85,14 +25,8 @@ class Customer extends KeksData
85 25
     $this->data['fullname'] = $data['vorname'].' '.$data['nachname'];
86 26
     if ($this->data['fullname'] == ' ')
87 27
       $this->data['fullname'] = $data['firma'];
88
-    $this->data['email'] = new ContactMethod();
89
-    $this->data['email']->loadByCustomer($this->data['id']);
90
-    $this->data['email_rechnung'] = new ContactMethod();
91
-    if (! $this->data['email_rechnung']->loadByCustomer($this->data['id'], 'rechnung'))
28
+    if (! $this->data['email_rechnung'])
92 29
       $this->data['email_rechnung'] = $this->data['email'];
93
-    $this->data['email_extern'] = new ContactMethod();
94
-    if (! $this->data['email_extern']->loadByCustomer($this->data['id'], 'extern'))
95
-      $this->data['email_extern'] = $this->data['email'];
96 30
   }
97 31
 
98 32
 }
99 33