Skip to content

Commit

Permalink
Merge pull request #5843 from simnandez/3.8
Browse files Browse the repository at this point in the history
FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object
  • Loading branch information
Juanjo Menent committed Oct 15, 2016
2 parents b19b624 + ffd486e commit 87e8ac5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions htdocs/categories/class/categorie.class.php
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* 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) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
Expand Down Expand Up @@ -592,17 +592,19 @@ function add_type($obj,$type)
{
if ($this->db->num_rows($resql) > 0)
{
$objparent = $this->db->fetch_object($resql);
$objparent = $this->db->fetch_object($resql);

if (!empty($objparent->fk_parent))
{
$cat = new Categorie($this->db);
$cat->id=$objparent->fk_parent;
$result=$cat->add_type($obj, $type);
if ($result < 0)
{
$this->error=$cat->error;
$error++;
$cat->id = $objparent->fk_parent;
if (!$cat->containsObject($type, $obj->id)) {
$result = $cat->add_type($obj, $type);
if ($result < 0)
{
$this->error = $cat->error;
$error++;
}
}
}
}
Expand Down

0 comments on commit 87e8ac5

Please sign in to comment.