Merge pull request #5843 from simnandez/3.8

FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object
This commit is contained in:
Juanjo Menent 2016-10-15 17:18:35 +02:00 committed by GitHub
commit 87e8ac51be

View File

@ -5,7 +5,7 @@
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -598,6 +598,7 @@ class Categorie extends CommonObject
{ {
$cat = new Categorie($this->db); $cat = new Categorie($this->db);
$cat->id = $objparent->fk_parent; $cat->id = $objparent->fk_parent;
if (!$cat->containsObject($type, $obj->id)) {
$result = $cat->add_type($obj, $type); $result = $cat->add_type($obj, $type);
if ($result < 0) if ($result < 0)
{ {
@ -607,6 +608,7 @@ class Categorie extends CommonObject
} }
} }
} }
}
else else
{ {
$error++; $error++;