root/contributed_modules/modules/customerdb/functions.inc.php

Revision 7509, 2.6 kB (checked in by p_lindheimer, 3 years ago)

retrying the move of customerdb, inventorydb, gabcast again

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
Line 
1 <?php
2
3 function customerdb_list(){
4   $sql = "SELECT id, name FROM customerdb";
5   $results= sql($sql, "getAll");
6
7   foreach($results as $result){
8     $customers[] = array($result[0],$result[1]);
9   }
10   return isset($customers)?$customers:null;
11 }
12
13 function customerdb_get($extdisplay){
14   $sql="SELECT * FROM customerdb where id=$extdisplay";
15   $results=sql($sql, "getRow", DB_FETCHMODE_ASSOC);
16   return isset($results)?$results:null;
17 }
18
19 function customerdb_add($name, $addr1, $addr2, $city, $state, $zip, $sip, $did, $device, $ip, $serial, $account, $email, $username, $password){
20   $sql="INSERT INTO customerdb (name, addr1, addr2, city, state, zip, sip, did, device, ip, serial, account, email, username, password) values ('$name', '$addr1', '$addr2', '$city', '$state', '$zip', '$sip', '$did', '$device', '$ip', '$serial', '$account', '$email', '$username', '$password')";
21   sql($sql);
22 }
23
24 function customerdb_del($extdisplay){
25   $sql="DELETE FROM customerdb where id=$extdisplay";
26   sql($sql);
27 }
28
29 function customerdb_edit($extdisplay, $name, $addr1, $addr2, $city, $state, $zip, $sip, $did, $device, $ip, $serial, $account, $email, $username, $password){
30   $sql="UPDATE customerdb set name='$name' where id='$extdisplay'";
31   sql($sql);
32   $sql="UPDATE customerdb set addr1='$addr1' where id='$extdisplay'";
33   sql($sql);
34   $sql="UPDATE customerdb set addr2='$addr2' where id='$extdisplay'";
35   sql($sql);
36   $sql="UPDATE customerdb set city='$city' where id='$extdisplay'";
37   sql($sql);
38   $sql="UPDATE customerdb set state='$state' where id='$extdisplay'";
39   sql($sql);
40   $sql="UPDATE customerdb set zip='$zip' where id='$extdisplay'";
41   sql($sql);
42   $sql="UPDATE customerdb set sip='$sip' where id='$extdisplay'";
43   sql($sql);
44   $sql="UPDATE customerdb set did='$did' where id='$extdisplay'";
45   sql($sql);
46   $sql="UPDATE customerdb set device='$device' where id='$extdisplay'";
47   sql($sql);
48   $sql="UPDATE customerdb set serial='$serial' where id='$extdisplay'";
49   sql($sql);
50   $sql="UPDATE customerdb set ip='$ip' where id='$extdisplay'";
51   sql($sql);
52   $sql="UPDATE customerdb set account='$account' where id='$extdisplay'";
53   sql($sql);
54   $sql="UPDATE customerdb set email='$email' where id='$extdisplay'";
55   sql($sql);
56   $sql="UPDATE customerdb set username='$username' where id='$extdisplay'";
57   sql($sql);
58   $sql="UPDATE customerdb set password='$password' where id='$extdisplay'";
59   sql($sql);
60 }
61
62 function customerdb_getsip(){
63   $sql="SELECT DISTINCT id from sip order by id";
64   $results=sql($sql, "getAll");
65   return isset($results)?$results:null;
66 }
67
68 function customerdb_getdid(){
69   $sql="SELECT extension from incoming order by extension";
70   $results=sql($sql, "getAll");
71   return isset($results)?$results:null;
72 }
73 ?>
Note: See TracBrowser for help on using the browser.