f12aba6daa6e2848a8ed60ea57b26874d6675f52
bernd Su-Login für Admins

bernd authored 17 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 Su-Login für Admins

bernd authored 17 years ago

16) 
bernd AJAXified

bernd authored 16 years ago

17) require_once('inc/base.php');
bernd Su-Login für Admins

bernd authored 17 years ago

18) 
19) function list_system_users()
20) {
21)   require_role(ROLE_SYSADMIN);
22) 
23)   $result = db_query("SELECT uid,username FROM system.v_useraccounts ORDER BY username");
24)   
25)   $ret = array();
26)   while ($item = mysql_fetch_object($result))
27)     array_push($ret, $item);
28)   return $ret;
29) }
30) 
31) 
32) function list_customers()
33) {
34)   require_role(ROLE_SYSADMIN);
35) 
36)   $result = db_query("SELECT id, IF(firma IS NULL, CONCAT_WS(' ', vorname, nachname), CONCAT(firma, ' (', CONCAT_WS(' ', vorname, nachname), ')')) AS name FROM kundendaten.kunden");
37)   
38)   $ret = array();
39)   while ($item = mysql_fetch_object($result))
40)     array_push($ret, $item);
41)   return $ret;
42) }
43) 
44) 
bernd AJAXified

bernd authored 16 years ago

45) function find_customers($string) 
46) {
47)   $string = mysql_real_escape_string(chop($string));
48)   $return = array();
bernd Tabelle 'kundenkontakt' kom...

bernd authored 14 years ago

49)   $result = db_query("SELECT k.id FROM kundendaten.kunden AS k LEFT JOIN system.useraccounts AS u ON (k.id=u.kunde) WHERE ".
bernd AJAXified

bernd authored 16 years ago

50)                      "firma LIKE '%{$string}%' OR firma2 LIKE '%{$string}%' OR ".
51)                      "nachname LIKE '%{$string}%' OR vorname LIKE '%{$string}%' OR ".
52)                      "adresse LIKE '%{$string}%' OR adresse2 LIKE '%{$string}%' OR ".
53)                      "ort LIKE '%{$string}%' OR pgp_id LIKE '%{$string}%' OR ".
bernd Tabelle 'kundenkontakt' kom...

bernd authored 14 years ago

54)                      "notizen LIKE '%{$string}%' OR email_rechnung LIKE '%{$string}%' OR ".
55)                      "email LIKE '%{$string}%' OR email_extern LIKE '%{$string}%' OR u.name LIKE '%{$string}%' OR ".
bernd AJAXified

bernd authored 16 years ago

56)                      "u.username LIKE '%{$string}%' OR k.id='{$string}' OR u.uid='{$string}';");
57)   while ($entry = mysql_fetch_assoc($result))
58)     $return[] = $entry['id'];
59) 
bernd Finde Kunden auch anhand vo...

bernd authored 15 years ago

60)   $result = db_query("SELECT kunde FROM kundendaten.domains WHERE kunde IS NOT NULL AND (
61)                       domainname LIKE '%{$string}%' OR CONCAT_WS('.', domainname, tld) LIKE '%{$string}%'
62)                       )");
63) 
64)   while ($entry = mysql_fetch_assoc($result))
65)     $return[] = $entry['kunde'];
66)