X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fui%2Fsimple_crud_class.inc;h=f6375635ebaa6e3bcbac799342b099adbc50241b;hb=523b8c69689f9ceb978b422b3e65a7eb9c089b6f;hp=46b9fbfc3e040d5ac152dcee8c1f88013cf6a0c0;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/includes/ui/simple_crud_class.inc b/includes/ui/simple_crud_class.inc index 46b9fbfc..f6375635 100644 --- a/includes/ui/simple_crud_class.inc +++ b/includes/ui/simple_crud_class.inc @@ -26,7 +26,7 @@ class simple_crud { var $dec; // // - function simple_crud($name, $fields = null) + function __construct($name, $fields = null) { $this->name = $name; $this->pre_handlers = array( @@ -106,14 +106,12 @@ class simple_crud { { global $Ajax; - $sel_name = $this->name.'_id'; - // list controls lookup foreach (array_keys($this->pre_handlers) as $m) { 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; } @@ -211,9 +209,9 @@ class simple_crud { if ($async === 'both') { $async = 'default'; $cancel = 'cancel'; } - else if ($async === 'default') + elseif ($async === 'default') $cancel = true; - else if ($async === 'cancel') + elseif ($async === 'cancel') $async = true; echo "
"; @@ -256,10 +254,10 @@ class simple_crud { $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); } } //-------------------------- @@ -376,4 +374,3 @@ class simple_crud { } }; -?> \ No newline at end of file