FIX When delete a product, llx_product_association rows are not deleted
This commit is contained in:
parent
7cd8b36cea
commit
b462e7b217
@ -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
|
||||
@ -1114,6 +1114,19 @@ class Product extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Delete from product_association
|
||||
if (!$error){
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_association";
|
||||
$sql.= " WHERE fk_product_pere = ".$this->rowid." OR fk_product_fils = ".$this->rowid;
|
||||
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)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user