Done, thanks
This commit is contained in:
parent
9ba129aa0c
commit
5966170a0d
@ -4127,15 +4127,14 @@ abstract class CommonObject
|
|||||||
$extrafields = new ExtraFields($this->db);
|
$extrafields = new ExtraFields($this->db);
|
||||||
$target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element);
|
$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();
|
$new_array_options=array();
|
||||||
foreach ($this->array_options as $key => $value) {
|
foreach ($this->array_options as $key => $value) {
|
||||||
if (in_array(substr($key,8), array_keys($target_extrafields)))
|
if (in_array(substr($key,8), array_keys($target_extrafields)))
|
||||||
$new_array_options[$key] = $value;
|
$new_array_options[$key] = $value;
|
||||||
}
|
}
|
||||||
$this->array_options =$new_array_options;
|
|
||||||
|
foreach($new_array_options as $key => $value)
|
||||||
foreach($this->array_options as $key => $value)
|
|
||||||
{
|
{
|
||||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||||
$attributeType = $extrafields->attribute_type[$attributeKey];
|
$attributeType = $extrafields->attribute_type[$attributeKey];
|
||||||
@ -4198,7 +4197,7 @@ abstract class CommonObject
|
|||||||
$this->db->query($sql_del);
|
$this->db->query($sql_del);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
|
$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
|
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||||
// Add field of attribut
|
// Add field of attribut
|
||||||
@ -4206,7 +4205,7 @@ abstract class CommonObject
|
|||||||
$sql.=",".$attributeKey;
|
$sql.=",".$attributeKey;
|
||||||
}
|
}
|
||||||
$sql .= ") VALUES (".$this->id;
|
$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
|
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||||
// Add field o fattribut
|
// Add field o fattribut
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user