Support option values as strings as well
[misc/kostenrechnung] / ajax / ajax.php
index a5a8a12..5095ca6 100644 (file)
@@ -74,7 +74,7 @@ function save($mask)
 
     if ($info['type'] == 'boolean') {
       $update[] = sprintf("%s=%d", $field, $_POST[$field] == 'on'?1:0);
-    } elseif ($info['type'] == 'number' || $info['type'] == 'select') {
+    } elseif ($info['type'] == 'number' || ($info['type'] == 'select' && $info['options_string'] !== true)) {
       if (empty($_POST[$field]) && $info['null'] === true)
         $update[] = sprintf("%s=NULL", $field);
       else
@@ -123,7 +123,7 @@ function insert($mask)
     if ($info['type'] == 'boolean') {
       $fields[] = $field;
       $values[] = $_POST[$field] == 'on'?1:0;
-    } elseif ($info['type'] == 'number' || $info['type'] == 'select') {
+    } elseif ($info['type'] == 'number' || ($info['type'] == 'select' && $info['options_string'] !== true)) {
       $fields[] = $field;
       if (empty($_POST[$field]) && $info['null'] === true)
        $values[] = 'NULL';