Create societe.class.php
This commit is contained in:
parent
94ca682cbf
commit
28487fac12
@ -3112,15 +3112,15 @@ class Societe extends CommonObject
|
|||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
if ($this->id) {
|
if ($this->id) {
|
||||||
// InfraS change (to avoid infinite loop)
|
// Check if the id we want to add as parent has not already one parent that is the current id we try to update
|
||||||
$sameparent = $this->validateFamilyTree($id, $this->id, 0);
|
$sameparent = $this->validateFamilyTree($id, $this->id, 0);
|
||||||
if ($sameparent < 0) {
|
if ($sameparent < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
} elseif ($sameparent == 1) {
|
} elseif ($sameparent == 1) {
|
||||||
setEventMessages('ParentCompanyIsAlreadyAChild', null, 'warnings');
|
setEventMessages('ParentCompanyToAddIsAlreadyAChildOfModifiedCompany', null, 'warnings');
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'societe SET parent = '.($id > 0 ? $id : 'null').' WHERE rowid = '.$this->id;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'societe SET parent = '.($id > 0 ? $id : 'null').' WHERE rowid = '.((int) $this->id);
|
||||||
dol_syslog(get_class($this).'::set_parent', LOG_DEBUG);
|
dol_syslog(get_class($this).'::set_parent', LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user