diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ddfb2780f3f83153c1aff506e69935e36c991fee..f1ec086cd03a5b2305fdc2410588212fa01a4902 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5023,7 +5023,7 @@ abstract class CommonObject */ public function createFromCloneCommon(User $user, $fromid) { - global $user; + global $user, $langs; $error = 0; @@ -5039,6 +5039,8 @@ abstract class CommonObject $object->id = 0; // Clear fields + $object->ref = "copy_of_".$object->ref; + $object->title = $langs->trans("CopyOf")." ".$object->title; // ... // Create clone @@ -5046,7 +5048,8 @@ abstract class CommonObject // Other options if ($result < 0) { - $error ++; + $error++; + $this->error = $object->error; $this->errors = $object->errors; dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); }