Support boolean fields alias checkboxes
[misc/kostenrechnung] / ajax / ajax.php
index a0580ad..a709a03 100644 (file)
@@ -13,8 +13,10 @@ function fetch($mask)
 
   $row = pg_fetch_assoc($sth);
 
-  foreach ($mask['edit']['list'] as $field => $info)
-    if (array_key_exists('format', $info))
+  foreach ($mask['edit'] as $field => $info)
+    if ($info['type'] == 'boolean')
+      $row[$field] = $row[$field]?true:false;
+    elseif (array_key_exists('format', $info))
       $row[$field] = sprintf($info['format'], $row[$field]);
 
   return $row;