a2255c3252f9ced4c8d5d84607108ab4d571261a
[fa-stable.git] / manufacturing / includes / db / work_centres_db.inc
1 <?php
2
3 function add_work_centre($name, $description)
4 {
5         $sql = "INSERT INTO ".TB_PREF."workcentres (name, description)
6                 VALUES (".db_quote($name).",".db_quote($description).")";
7
8         db_query($sql, "could not add work centre");
9 }
10
11 function update_work_centre($type_id, $name, $description)
12 {
13         $sql = "UPDATE ".TB_PREF."workcentres SET name=".db_quote($name).", description=".db_quote($description)."
14                 WHERE id=$type_id";
15
16         db_query($sql, "could not update work centre");
17 }
18
19 function get_all_work_centres()
20 {
21         $sql = "SELECT * FROM ".TB_PREF."workcentres";
22
23         return db_query($sql, "could not get all work centres");
24 }
25
26 function get_work_centre($type_id)
27 {
28         $sql = "SELECT * FROM ".TB_PREF."workcentres WHERE id=$type_id";
29
30         $result = db_query($sql, "could not get work centre");
31
32         return db_fetch($result);
33 }
34
35 function delete_work_centre($type_id)
36 {
37         $sql="DELETE FROM ".TB_PREF."workcentres WHERE id=$type_id";
38
39         db_query($sql, "could not delete work centre");
40 }
41
42 ?>