Fix cloning virtual products

This commit is contained in:
Laurent Destailleur 2016-11-14 01:46:59 +01:00
parent 6eb16f66e0
commit b79048e6bd

View File

@ -2846,16 +2846,16 @@ class Product extends CommonObject
/**
* Clone links between products
*
* @param int $fromId Product id
* @param int $toId Product id
* @return number
* @param int $fromId Product id
* @param int $toId Product id
* @return int <0 if KO, >0 if OK
*/
function clone_associations($fromId, $toId)
{
$this->db->begin();
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (rowid, fk_product_pere, fk_product_fils, qty)';
$sql.= " SELECT null, $toId, fk_product_fils, qty FROM ".MAIN_DB_PREFIX."product_association";
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (fk_product_pere, fk_product_fils, qty)';
$sql.= " SELECT ".$toId.", fk_product_fils, qty FROM ".MAIN_DB_PREFIX."product_association";
$sql.= " WHERE fk_product_pere = '".$fromId."'";
dol_syslog(get_class($this).'::clone_association', LOG_DEBUG);