Fix cloning virtual products
This commit is contained in:
parent
6eb16f66e0
commit
b79048e6bd
@ -2846,16 +2846,16 @@ class Product extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Clone links between products
|
* Clone links between products
|
||||||
*
|
*
|
||||||
* @param int $fromId Product id
|
* @param int $fromId Product id
|
||||||
* @param int $toId Product id
|
* @param int $toId Product id
|
||||||
* @return number
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function clone_associations($fromId, $toId)
|
function clone_associations($fromId, $toId)
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (rowid, fk_product_pere, fk_product_fils, qty)';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (fk_product_pere, fk_product_fils, qty)';
|
||||||
$sql.= " SELECT null, $toId, fk_product_fils, qty FROM ".MAIN_DB_PREFIX."product_association";
|
$sql.= " SELECT ".$toId.", fk_product_fils, qty FROM ".MAIN_DB_PREFIX."product_association";
|
||||||
$sql.= " WHERE fk_product_pere = '".$fromId."'";
|
$sql.= " WHERE fk_product_pere = '".$fromId."'";
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::clone_association', LOG_DEBUG);
|
dol_syslog(get_class($this).'::clone_association', LOG_DEBUG);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user