Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0
Conflicts: htdocs/product/class/product.class.php
This commit is contained in:
commit
95d8faef04
@ -925,10 +925,26 @@ class Product extends CommonObject
|
|||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete from product_batch on product delete
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch';
|
||||||
|
$sql.= " WHERE fk_product_stock IN (";
|
||||||
|
$sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock';
|
||||||
|
$sql.= " WHERE fk_product = ".$id.")";
|
||||||
|
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
if (! $result)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delete all child tables
|
// Delete all child tables
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price','product_lot','product_batch');
|
$elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price','product_lot'); // product_batch is done before
|
||||||
foreach($elements as $table)
|
foreach($elements as $table)
|
||||||
{
|
{
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user