Skip to content

Commit

Permalink
Done, thanks
Browse files Browse the repository at this point in the history
  • Loading branch information
bafbes committed Jul 15, 2016
1 parent 9ba129a commit 5966170
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -4127,15 +4127,14 @@ function insertExtraFields()
$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];
Expand Down Expand Up @@ -4198,15 +4197,15 @@ function insertExtraFields()
$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
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)
foreach($new_array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
// Add field o fattribut
Expand Down

0 comments on commit 5966170

Please sign in to comment.