Done, thanks

This commit is contained in:
Bahfir Abbes 2016-07-15 10:43:01 +01:00 committed by GitHub
parent 9ba129aa0c
commit 5966170a0d

View File

@ -4127,15 +4127,14 @@ abstract class CommonObject
$extrafields = new ExtraFields($this->db);
$target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element);
//Eliminate copied source object extra_fiels that do not exist in target object
//Eliminate copied source object extra_fields that do not exist in target object
$new_array_options=array();
foreach ($this->array_options as $key => $value) {
if (in_array(substr($key,8), array_keys($target_extrafields)))
$new_array_options[$key] = $value;
}
$this->array_options =$new_array_options;
foreach($this->array_options as $key => $value)
foreach($new_array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
$attributeType = $extrafields->attribute_type[$attributeKey];
@ -4198,7 +4197,7 @@ abstract class CommonObject
$this->db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
foreach($this->array_options as $key => $value)
foreach($new_array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
// Add field of attribut
@ -4206,7 +4205,7 @@ abstract class CommonObject
$sql.=",".$attributeKey;
}
$sql .= ") VALUES (".$this->id;
foreach($this->array_options as $key => $value)
foreach($new_array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
// Add field o fattribut