Update module to new Hallinta system
[misc/hallinta-metro] / ordersatz.php
index 0d8f7e7..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;
@@ -42,12 +31,12 @@ $mask = array(
                              'name' => array(
                                            'name' => 'Name',
                                            'width' => 290,
-                                           'specs' => "filterUI: 't'",
+                                           'filter' => 't',
                                            ),
                              'koch' => array(
                                            'name' => 'Kochbetreuer',
                                            'width' => 100,
-                                           'specs' => "filterUI: 't'",
+                                           'filter' => 't',
                                            'visible' => false,
                                            ),
                              'datum' => array(
@@ -59,7 +48,7 @@ $mask = array(
                                            'name' => 'Aktion',
                                            'width' => 90,
                                            'control' => $href,
-                                           'specs' => "ClassName: 'aligncenter'",
+                                           'specs' => array('ClassName' => 'aligncenter'),
                                            'sql' => "'bearbeiten'",
                                            ),
                              ),
@@ -120,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);