cf54502a10b16c985ea28db17885d377226b6145
bernd some AJAX test

bernd authored 15 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 Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 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 15 years ago

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

bernd authored 15 years ago

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

bernd authored 15 years ago

21) {
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

22)   $string = db_escape_string(chop($string));
bernd some AJAX test

bernd authored 15 years ago

23)   $return = array();
bernd CRM still incomplete and un...

bernd authored 15 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 15 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 15 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 Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

33)   while ($entry = $result->fetch())
bernd some AJAX test

bernd authored 15 years ago

34)     $return[] = $entry['id'];
35) 
bernd CRM still incomplete and un...

bernd authored 15 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 Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

46)   while ($entry = $result->fetch())
bernd CRM still incomplete and un...

bernd authored 15 years ago

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

bernd authored 15 years ago

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

bernd authored 15 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();
Bernd Wurst Umstellung auf PDO-Datenban...

Bernd Wurst authored 10 years ago

59)   while ($x = $result->fetch())
bernd CRM still incomplete and un...

bernd authored 15 years ago

60)     array_push($ret, $x);
61)   DEBUG($ret);
62) 
63) }
64) 
65) 
66) 
67)