f12aba6daa6e2848a8ed60ea57b26874d6675f52
bernd some AJAX test

bernd authored 16 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Updated copyright notice (2...

Bernd Wurst authored 11 years ago

5) Written 2008-2013 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
bernd some AJAX test

bernd authored 16 years ago

16) 
17) require_once('inc/base.php');
18) 
19) 
bernd CRM still incomplete and un...

bernd authored 16 years ago

20) function find_customers($string) 
bernd some AJAX test

bernd authored 16 years ago

21) {
22)   $string = mysql_real_escape_string(chop($string));
23)   $return = array();
bernd CRM still incomplete and un...

bernd authored 16 years ago

24)   $result = db_query("SELECT k.id FROM kundendaten.kunden AS k LEFT JOIN kundendaten.kundenkontakt AS kk ".
25)                      "ON (kk.kundennr = k.id) LEFT JOIN system.useraccounts AS u ON (k.id=u.kunde) WHERE ".
bernd some AJAX test

bernd authored 16 years ago

26)                      "firma LIKE '%{$string}%' OR firma2 LIKE '%{$string}%' OR ".
27)                      "nachname LIKE '%{$string}%' OR vorname LIKE '%{$string}%' OR ".
28)                      "adresse LIKE '%{$string}%' OR adresse2 LIKE '%{$string}%' OR ".
29)                      "ort LIKE '%{$string}%' OR pgp_id LIKE '%{$string}%' OR ".
bernd CRM still incomplete and un...

bernd authored 16 years ago

30)                      "notizen LIKE '%{$string}%' OR kk.name LIKE '%{$string}%' OR ".
31)                      "kk.wert LIKE '%{$string}%' OR u.name LIKE '%{$string}%' OR ".
32)                      "u.username LIKE '%{$string}%' OR k.id='{$string}' OR u.uid='{$string}';");
bernd some AJAX test

bernd authored 16 years ago

33)   while ($entry = mysql_fetch_assoc($result))
34)     $return[] = $entry['id'];
35) 
bernd CRM still incomplete and un...

bernd authored 16 years ago

36)   return $return;
37) }
38) 
39) 
40) function find_users_for_customer($id)
41) {
42)   $id = (int) $id;
43)   $return = array();
44)   $result = db_query("SELECT uid, username FROM system.useraccounts WHERE ".
45)                      "kunde='{$id}';");
bernd some AJAX test

bernd authored 16 years ago

46)   while ($entry = mysql_fetch_assoc($result))
bernd CRM still incomplete and un...

bernd authored 16 years ago

47)     $return[$entry['uid']] = $entry['username'];
48) 
bernd some AJAX test

bernd authored 16 years ago

49)   return $return;
50) }
51) 
52) 
53) 
bernd CRM still incomplete and un...

bernd authored 16 years ago

54) function hosting_contracts($cid)
55) {
56)   $cid = (int) $cid;
57)   $result = db_query("SELECT u.username, werber, beschreibung, betrag, brutto, monate, anzahl, startdatum, startdatum + INTERVAL laufzeit MONTH - INTERVAL 1 DAY AS mindestlaufzeit, kuendigungsdatum, gesperrt, notizen FROM kundendaten.hosting AS h LEFT JOIN system.useraccounts AS u ON (h.hauptuser=u.uid) WHERE h.kunde=".$cid);
58)   $ret = array();
59)   while ($x = mysql_fetch_assoc($result))
60)     array_push($ret, $x);
61)   DEBUG($ret);
62) 
63) }
64) 
65) 
66) 
67)