Add sort column to improve listing
[misc/hallinta-metro] / ordersatz.php
index 34104b0..b70b3f0 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,22 +26,22 @@ $mask = array(
                                            ),
                              'erstellt' => array(
                                            'name' => 'Erstellt',
-                                           'width' => 70,
-                                           'specs' => "ClassName: 'alignrightpad', filterUI: 't'",
+                                           'width' => 85,
                                            ),
                              'name' => array(
                                            'name' => 'Name',
-                                           'width' => 250,
+                                           'width' => 290,
                                            'specs' => "filterUI: 't'",
                                            ),
                              'koch' => array(
                                            'name' => 'Kochbetreuer',
                                            'width' => 100,
                                            'specs' => "filterUI: 't'",
+                                           'visible' => false,
                                            ),
                              'datum' => array(
                                            'name' => 'Einkauf am',
-                                           'width' => 110,
+                                           'width' => 130,
                                            'sql' => "datum || ' ' || uhrzeit || ' Uhr'",
                                            ),
                              'link' => array(
@@ -78,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(
@@ -107,11 +96,12 @@ $mask = array(
                                            ),
                              'uhrzeit' => array(
                                            'name' => 'Ungefähre Uhrzeit der Abholung',
-                                           'type' => 'number',
+                                           'type' => 'text',
                                            'size' => 3,
                                            'required' => true,
                                            ),
                              ),
+             'buttons' => array('delete' => false),
              'postinsert' => ordersatz_insert,
              );
 
@@ -119,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);