Skip to content

Commit

Permalink
Merge pull request #9787 from fmarcet/6.0
Browse files Browse the repository at this point in the history
FIX: When delete a product, llx_product_association rows are not deleted
  • Loading branch information
eldy committed Oct 19, 2018
2 parents 7cd8b36 + ffde353 commit 6fde6e4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion htdocs/product/class/product.class.php
Expand Up @@ -12,7 +12,7 @@
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Gustavo Novaro
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -1114,6 +1114,19 @@ function delete(User $user, $notrigger=0)
}
}

// Delete from product_association
if (!$error){
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_association";
$sql.= " WHERE fk_product_pere = ".$id." OR fk_product_fils = ".$id;
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
$result = $this->db->query($sql);
if (! $result)
{
$error++;
$this->errors[] = $this->db->lasterror();
}
}

// Delete product
if (! $error)
{
Expand Down

0 comments on commit 6fde6e4

Please sign in to comment.