Now checking for default value when inserting if no input supplied (only for integer...
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 1 Jan 2018 18:46:45 +0000 (13:46 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 1 Jan 2018 18:46:45 +0000 (13:46 -0500)
lib/GlmDataAbstract/DataAbstract.php

index f281b8e..5c1ee61 100644 (file)
@@ -177,6 +177,13 @@ abstract class GlmDataAbstract
             $in = $_REQUEST[$as];
         }
 
+        // If this is an insert and we don't have the value, is there a default
+        if ($in == '' && $op == 'i') {
+            if (isset($f['default'])) {
+                $in = ($f['default']);
+            }
+        }
+        
         // Check for required field
         if (isset($f['required']) && $f['required'] && trim($in) == '') {
             $this->inputFieldStatus = false;