diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8f2842b4651..24827ce0cd4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6162,22 +6162,16 @@ abstract class CommonObject $error = 0; - $fieldvalues = $this->set_save_query(); - unset($fieldvalues['rowid']); // We don't update this field, it is the key to define which record to update. + $now=dol_now(); + $fieldvalues = $this->set_save_query(); + if (array_key_exists('date_modification', $fieldvalues) && empty($fieldvalues['date_modification'])) $fieldvalues['date_modification']=$this->db->idate($now); + if (array_key_exists('fk_user_modif', $fieldvalues) && ! ($fieldvalues['fk_user_modif'] > 0)) $fieldvalues['fk_user_modif']=$user->id; + unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update. + + $keys=array(); foreach ($fieldvalues as $k => $v) { - if (is_array($key)){ - $i=array_search($k, $key); - if ( $i !== false) { - $where[] = $key[$i].'=' . $this->quote($v, $this->fields[$k]); - continue; - } - } else { - if ( $k == $key) { - $where[] = $k.'=' .$this->quote($v, $this->fields[$k]); - continue; - } - } + $keys[$k] = $k; $tmp[] = $k.'='.$this->quote($v, $this->fields[$k]); } @@ -6188,11 +6182,12 @@ abstract class CommonObject if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]=''; // This is an explicit foreign key field //var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1)); + /* if ($this->fields[$key]['notnull'] == 1 && empty($values[$key])) { $error++; $this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']); - } + }*/ } $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode( ',', $tmp ).' WHERE rowid='.$this->id ; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index e2a423e9ca4..fd0470c63f4 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -51,7 +51,7 @@ class FormAdmin * @param string $htmlname Name of HTML select * @param int $showauto Show 'auto' choice * @param array $filter Array of keys to exclude in list - * @param string $showempty 1=Add empty value or string to show + * @param string $showempty '1'=Add empty value or string to show * @param int $showwarning Show a warning if language is not complete * @param int $disabled Disable edit of select * @param string $morecss Add more css styles diff --git a/htdocs/website/index.php b/htdocs/website/index.php index cc095139d8f..5f5f17383c5 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1742,7 +1742,7 @@ if ($action == 'editmeta' || $action == 'create') print '