X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fsimple_crud_class.inc;h=9ab24aa5ddb4dcc3204017e16b7fb44c82ff1298;hb=af03975abbd624d17cc6c4f61b71808a0a5c82ea;hp=40c8ebea6b29b5653b2a746284015329473dee33;hpb=19ddc3939071044c8e94b628f1d6a039f50cc493;p=fa-stable.git diff --git a/includes/ui/simple_crud_class.inc b/includes/ui/simple_crud_class.inc index 40c8ebea..9ab24aa5 100644 --- a/includes/ui/simple_crud_class.inc +++ b/includes/ui/simple_crud_class.inc @@ -111,7 +111,7 @@ class simple_crud { if (isset($_POST[$this->name.$m])) { unset($_POST['_focus']); // focus on first form entry $Ajax->activate($this->name.'_div'); - $val = @key($_POST[$this->name.$m]); + $val = is_array($_POST[$this->name.$m]) ? key($_POST[$this->name.$m]) : null; $this->selected_id = $val!==null ? @quoted_printable_decode($val) : $this->_none; return $m; } @@ -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;