Adjust to new framework
[misc/hallinta-metro] / ordersatz_history.php
1 <?php
2   /*
3    Küchenbetreuer:
4    E-Mail-Adresse für Kopie
5    Telefonnr für Rückfragen:
6    Abholung am:
7    Abholung um Uhrzeit:
8
9    - Ordersatz auswählen || neuen Ordersatz erstellen || Ordersatz kopieren
10    - Ordersatz abschließen = PDF-Datei erzeugen, archivieren, per Mail, per Fax
11    */
12
13
14 $href = "new Rico.TableColumn.link('./?mask=metro__ordersatz_pos&id={0}')";
15
16 # INSERT INTO metro_ordersatz_pos (ordersatz,artikel,sys_user,sys_edit) SELECT ORDERID,id,'joey',now() FROM metro_artikel;
17 # DELETE FROM metro_ordersatz_pos WHERE ordersatz = ORDERID AND anzahl IS NULL
18 $mask = array(
19               'table' => 'metro_ordersatz',
20               'title' => 'Ordersatz auswählen / erstellen',
21               'where' => sprintf('owner = %d AND done IS NOT NULL', $_SESSION['sys']['uid']),
22               'list' => array(
23                               'id' => array(
24                                             'name' => 'ID',
25                                             'visible' => false,
26                                             ),
27                               'erstellt' => array(
28                                             'name' => 'Erstellt',
29                                             'width' => 85,
30                                             ),
31                               'name' => array(
32                                             'name' => 'Name',
33                                             'width' => 290,
34                                             'specs' => "filterUI: 't'",
35                                             ),
36                               'koch' => array(
37                                             'name' => 'Kochbetreuer',
38                                             'width' => 100,
39                                             'specs' => "filterUI: 't'",
40                                             'visible' => false,
41                                             ),
42                               'done' => array(
43                                             'name' => 'Abgeschlossen',
44                                             'width' => 90,
45                                             ),
46                               'datum' => array(
47                                             'name' => 'Einkauf am',
48                                             'width' => 130,
49                                             'sql' => "datum || ' ' || uhrzeit || ' Uhr'",
50                                             ),
51                               'link' => array(
52                                             'name' => 'Aktion',
53                                             'width' => 90,
54                                             'control' => $href,
55                                             'specs' => "ClassName: 'aligncenter'",
56                                             'sql' => "'anzeigen'",
57                                             ),
58                               ),
59               'edit' => array(
60                               'owner' => array(
61                                             'type' => 'hidden',
62                                             'default' => $_SESSION['sys']['uid'],
63                                             'required' => true,
64                                             ),
65                               'erstellt' => array(
66                                             'type' => 'hidden',
67                                             'subtype' => 'string',
68                                             'default' => date('Y-m-d'),
69                                             'required' => true,
70                                             ),
71                               'name' => array(
72                                             'name' => 'Name',
73                                             'type' => 'text',
74                                             'size' => 21,
75                                             'required' => true,
76                                             ),
77                               'koch' => array(
78                                             'name' => 'Kochbetreuer',
79                                             'type' => 'text',
80                                             'size' => 21,
81                                             'required' => true,
82                                             ),
83                               'email' => array(
84                                             'name' => 'E-Mail',
85                                             'type' => 'text',
86                                             'size' => 21,
87                                             'null' => true,
88                                             ),
89                               'telefon' => array(
90                                             'name' => 'Telefon für Rückfragen',
91                                             'type' => 'text',
92                                             'size' => 21,
93                                             'required' => true,
94                                             ),
95                               'datum' => array(
96                                             'name' => 'Abholdatum',
97                                             'type' => 'date',
98                                             'size' => 8,
99                                             'required' => true,
100                                             ),
101                               'uhrzeit' => array(
102                                             'name' => 'Ungefähre Uhrzeit der Abholung',
103                                             'type' => 'text',
104                                             'size' => 3,
105                                             'required' => true,
106                                             ),
107                               ),
108               'buttons' => array('delete' => false),
109               'postinsert' => ordersatz_insert,
110               );
111
112 function ordersatz_insert($id)
113 {
114   global $db;
115
116   $sql = sprintf("INSERT INTO metro_ordersatz_pos (ordersatz,artikel,sys_user,sys_edit) SELECT %d,id,%s,now() FROM metro_artikel",
117                  $id, $db->quote($_SESSION['sys']['login']));
118
119   $sth = $db->query($sql);
120 }
121
122 ?>