Merge pull request #5997 from fappels/develop-fix-modify-warehouse
Fix #5994 unable to update warehouse
This commit is contained in:
commit
e6a027911d
@ -176,10 +176,12 @@ class Entrepot extends CommonObject
|
||||
if (empty($id)) $id = $this->id;
|
||||
|
||||
// Check if new parent is already a child of current warehouse
|
||||
if(!empty($this->fk_parent)) {
|
||||
if(!empty($this->fk_parent))
|
||||
{
|
||||
$TChildWarehouses = array($id);
|
||||
$TChildWarehouses = $this->get_children_warehouses($this->id, $TChildWarehouses);
|
||||
if(in_array($this->fk_parent, $TChildWarehouses)) {
|
||||
if(in_array($this->fk_parent, $TChildWarehouses))
|
||||
{
|
||||
$this->error = 'ErrorCannotAddThisParentWarehouse';
|
||||
return -2;
|
||||
}
|
||||
@ -191,13 +193,13 @@ class Entrepot extends CommonObject
|
||||
$this->lieu=trim($this->lieu);
|
||||
|
||||
$this->address=trim($this->address);
|
||||
$this->zip=trim($this->zip);
|
||||
$this->town=trim($this->town);
|
||||
$this->country_id=($this->country_id > 0 ? $this->country_id : $this->country_id);
|
||||
$this->zip=trim($this->zip);
|
||||
$this->town=trim($this->town);
|
||||
$this->country_id=($this->country_id > 0 ? $this->country_id : 0);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";
|
||||
$sql .= " SET label = '" . $this->db->escape($this->libelle) ."'";
|
||||
$sql .= ", fk_parent = '" . (($this->fk_parent > 0) ? $this->fk_parent : 'NULL') ."'";
|
||||
$sql .= ", fk_parent = " . (($this->fk_parent > 0) ? $this->fk_parent : 'NULL');
|
||||
$sql .= ", description = '" . $this->db->escape($this->description) ."'";
|
||||
$sql .= ", statut = " . $this->statut;
|
||||
$sql .= ", lieu = '" . $this->db->escape($this->lieu) ."'";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user