diff options
-rw-r--r-- | engine/lib/entities.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 7b5383dee..ad78b6f9e 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -192,13 +192,24 @@ remove_metadata($this->getGUID(), $name); $multiple = true; foreach ($value as $v) { - if (!create_metadata($this->getGUID(), $name, $v, $value_type, $this->getOwner(), $this->getAccessID(), $multiple)) return false; + if ((int) $this->guid > 0) { + if (!create_metadata($this->getGUID(), $name, $v, $value_type, $this->getOwner(), $this->getAccessID(), $multiple)) return false; + } else { + $this->temp_metadata[$name] = $value; + } } return true; } else - return create_metadata($this->getGUID(), $name, $value, $value_type, $this->getOwner(), $this->getAccessID()); + { + if ((int) $this->guid > 0) { + return create_metadata($this->getGUID(), $name, $value, $value_type, $this->getOwner(), $this->getAccessID()); + } else { + $this->temp_metadata[$name] = $value; + return true; + } + } } /** |