Fix: Contract clone don't work
This commit is contained in:
parent
c56074d48f
commit
daa4536f83
@ -8,7 +8,7 @@
|
|||||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -2253,11 +2253,11 @@ class Contrat extends CommonObject
|
|||||||
$this->context['createfromclone'] = 'createfromclone';
|
$this->context['createfromclone'] = 'createfromclone';
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$now = dol_now();
|
|
||||||
|
|
||||||
$this->fetch($this->id);
|
$this->fetch($this->id);
|
||||||
// Load dest object
|
// Load dest object
|
||||||
$clonedObj = clone $this;
|
$clonedObj = clone $this;
|
||||||
|
$clonedObj->socid = $socid;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
@ -2292,14 +2292,11 @@ class Contrat extends CommonObject
|
|||||||
$this->error = $clonedObj->error;
|
$this->error = $clonedObj->error;
|
||||||
$this->errors[] = $clonedObj->error;
|
$this->errors[] = $clonedObj->error;
|
||||||
} else {
|
} else {
|
||||||
// copy internal contacts
|
|
||||||
if ($clonedObj->copy_linked_contact($this, 'internal') < 0)
|
|
||||||
$error ++;
|
|
||||||
|
|
||||||
// copy external contacts if same company
|
// copy external contacts if same company
|
||||||
elseif ($this->socid == $clonedObj->socid) {
|
if ($this->socid == $clonedObj->socid) {
|
||||||
if ($clonedObj->copy_linked_contact($this, 'external') < 0)
|
if ($clonedObj->copy_linked_contact($this, 'external') < 0) {
|
||||||
$error ++;
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user