Update module to new Hallinta system
[misc/hallinta-metro] / ordersatz.php
index 1e2f9e9..e099839 100644 (file)
    */
 
 
-function get_title($id)
-{
-  global $db;
-
-  $query = sprintf('SELECT name FROM metro_ordersatz WHERE id = %d', $id);
-  $sth = $db->query($query);
-  $row = $sth->fetch();
-  if ($row) return 'Ordersatz für ' . $row['name'];
-  else return 'Unbekannter Ordersatz';
-}
-
 $href = "new Rico.TableColumn.link('./?mask=metro__ordersatz_pos&id={0}')";
 
 # INSERT INTO metro_ordersatz_pos (ordersatz,artikel,sys_user,sys_edit) SELECT ORDERID,id,'joey',now() FROM metro_artikel;
@@ -37,30 +26,29 @@ $mask = array(
                                            ),
                              'erstellt' => array(
                                            'name' => 'Erstellt',
-                                           'width' => 70,
-                                           'specs' => "ClassName: 'alignrightpad'",
+                                           'width' => 85,
                                            ),
                              'name' => array(
                                            'name' => 'Name',
-                                           'width' => 250,
-                                           'specs' => "filterUI: 't'",
+                                           'width' => 290,
+                                           'filter' => 't',
                                            ),
                              'koch' => array(
                                            'name' => 'Kochbetreuer',
                                            'width' => 100,
-                                           'specs' => "filterUI: 't'",
+                                           'filter' => 't',
                                            'visible' => false,
                                            ),
                              'datum' => array(
                                            'name' => 'Einkauf am',
-                                           'width' => 110,
+                                           'width' => 130,
                                            'sql' => "datum || ' ' || uhrzeit || ' Uhr'",
                                            ),
                              'link' => array(
                                            'name' => 'Aktion',
                                            'width' => 90,
                                            'control' => $href,
-                                           'specs' => "ClassName: 'aligncenter'",
+                                           'specs' => array('ClassName' => 'aligncenter'),
                                            'sql' => "'bearbeiten'",
                                            ),
                              ),
@@ -79,25 +67,25 @@ $mask = array(
                              'name' => array(
                                            'name' => 'Name',
                                            'type' => 'text',
-                                           'size' => 25,
+                                           'size' => 21,
                                            'required' => true,
                                            ),
                              'koch' => array(
                                            'name' => 'Kochbetreuer',
                                            'type' => 'text',
-                                           'size' => 25,
+                                           'size' => 21,
                                            'required' => true,
                                            ),
                              'email' => array(
                                            'name' => 'E-Mail',
                                            'type' => 'text',
-                                           'size' => 25,
+                                           'size' => 21,
                                            'null' => true,
                                            ),
                              'telefon' => array(
                                            'name' => 'Telefon für Rückfragen',
                                            'type' => 'text',
-                                           'size' => 25,
+                                           'size' => 21,
                                            'required' => true,
                                            ),
                              'datum' => array(
@@ -108,7 +96,7 @@ $mask = array(
                                            ),
                              'uhrzeit' => array(
                                            'name' => 'Ungefähre Uhrzeit der Abholung',
-                                           'type' => 'number',
+                                           'type' => 'text',
                                            'size' => 3,
                                            'required' => true,
                                            ),
@@ -121,7 +109,8 @@ function ordersatz_insert($id)
 {
   global $db;
 
-  $sql = sprintf("INSERT INTO metro_ordersatz_pos (ordersatz,artikel,sys_user,sys_edit) SELECT %d,id,%s,now() FROM metro_artikel",
+  $sql = sprintf("INSERT INTO metro_ordersatz_pos (ordersatz,artikel,sys_user,sys_edit) SELECT %d,id,%s,now() " .
+                "FROM metro_artikel WHERE removed = 0",
                 $id, $db->quote($_SESSION['sys']['login']));
 
   $sth = $db->query($sql);