Rerun. Attach documents: error message when attaching document on some php8 versions...
[fa-stable.git] / includes / ui / simple_crud_class.inc
index 2669bf043e0fbf51fd583ea87f999744f1d1eb69..9ab24aa5ddb4dcc3204017e16b7fb44c82ff1298 100644 (file)
@@ -251,13 +251,16 @@ class simple_crud {
                                $name = $fmt;
                                $fmt = array();
                        }
+                       if (is_string($fmt)) {
+                           $fmt = array('fmt' => $fmt);
+                       }
                        $post = isset($fmt['post']) ? $fmt['post'] : $name;
                        $fld = isset($fmt['fld']) ? $fmt['fld'] : $name;
 
-                       $value = $this->selected_id == $this->_none ? @$fmt['dflt'] :
+                       $value = $this->selected_id == $this->_none ? (isset($fmt['dflt']) ? $fmt['dflt'] : null) :
                                (is_array($this->data) ? $this->data[$fld]: $this->data->$fld);
 
-                       $_POST[$post] = $this->_format_output($value, @$fmt['fmt']);
+                       $_POST[$post] = $this->_format_output($value, isset($fmt['fmt']) ? $fmt['fmt'] : null);
                }
        }
        //--------------------------
@@ -270,6 +273,9 @@ class simple_crud {
                                $name = $fmt;
                                $fmt = array();
                        }
+                       if (is_string($fmt)) {
+                           $fmt = array('fmt' => $fmt);
+                       }
                        $post = isset($fmt['post']) ? $fmt['post'] : $name;
                        $fld = isset($fmt['fld']) ? $fmt['fld'] : $name;