Fix : implement separator extrafield - missing check on update
This commit is contained in:
parent
7a16e1b658
commit
ba0963ea7d
@ -2138,21 +2138,27 @@ abstract class CommonObject
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
|
||||
foreach($this->array_options as $key => $value)
|
||||
{
|
||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||
// Add field of attribut
|
||||
$sql.=",".substr($key,8); // Remove 'options_' prefix
|
||||
if ($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate
|
||||
$sql.=",".$attributeKey;
|
||||
}
|
||||
$sql .= ") VALUES (".$this->id;
|
||||
foreach($this->array_options as $key => $value)
|
||||
{
|
||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||
// Add field o fattribut
|
||||
if ($this->array_options[$key] != '')
|
||||
{
|
||||
$sql.=",'".$this->array_options[$key]."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.=",null";
|
||||
}
|
||||
if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate)
|
||||
{
|
||||
if ($this->array_options[$key] != '')
|
||||
{
|
||||
$sql.=",'".$this->array_options[$key]."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.=",null";
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.=")";
|
||||
|
||||
|
||||
@ -357,7 +357,6 @@ class ExtraFields
|
||||
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos,$param='')
|
||||
{
|
||||
$table=$elementtype.'_extrafields';
|
||||
|
||||
// Special case for not normalized table names
|
||||
if ($elementtype == 'member') $table='adherent_extrafields';
|
||||
elseif ($elementtype == 'company') $table='societe_extrafields';
|
||||
@ -385,8 +384,12 @@ class ExtraFields
|
||||
$lengthdb=$length;
|
||||
}
|
||||
$field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required?'NOT NULL':'NULL'));
|
||||
$result=$this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
|
||||
if ($result > 0)
|
||||
|
||||
if ($type != 'separate') // No table update when separate type
|
||||
{
|
||||
$result=$this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
|
||||
}
|
||||
if ($result > 0 || $type == 'separate')
|
||||
{
|
||||
if ($label)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user