Fix generic clone function

This commit is contained in:
Laurent Destailleur 2017-07-21 13:38:49 +02:00
parent 5318e513c1
commit 6830fe4f91

View File

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