// Fixed totally unexplicable behavior
This commit is contained in:
+14
-15
@@ -535,29 +535,28 @@ abstract class ObjectModelCore
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
$object_id = Db::getInstance()->Insert_ID();
|
$object_id = Db::getInstance()->Insert_ID();
|
||||||
|
|
||||||
if (isset($definition['multilang']) && $definition['multilang'])
|
if (isset($definition['multilang']) && $definition['multilang'])
|
||||||
{
|
{
|
||||||
$res = Db::getInstance()->executeS('
|
$result = Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.bqSQL($definition['table']).'_lang`
|
FROM `'._DB_PREFIX_.bqSQL($definition['table']).'_lang`
|
||||||
WHERE `'.bqSQL($definition['primary']).'` = '.(int)$this->id
|
WHERE `'.bqSQL($definition['primary']).'` = '.(int)$this->id);
|
||||||
);
|
if (!$result)
|
||||||
|
|
||||||
if (!$res)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach ($res as $lang => &$row)
|
foreach ($result as &$row)
|
||||||
foreach ($row as $field => &$value)
|
foreach ($row as $field => &$value)
|
||||||
if (isset($definition['fields'][$field]))
|
if (isset($definition['fields'][$field]))
|
||||||
$value = ObjectModel::formatValue($value, $definition['fields'][$field]['type']);
|
$value = ObjectModel::formatValue($value, $definition['fields'][$field]['type']);
|
||||||
|
|
||||||
foreach ($res as $row)
|
// Keep $row2, you cannot use $row because there is an unexplicated conflict with the previous usage of this variable
|
||||||
|
foreach ($result as $row2)
|
||||||
{
|
{
|
||||||
$row[$definition['primary']] = (int)$object_id;
|
$row2[$definition['primary']] = (int)$object_id;
|
||||||
if (!Db::getInstance()->insert($definition['table'].'_lang', $row))
|
if (!Db::getInstance()->insert($definition['table'].'_lang', $row2))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$object_duplicated = new $definition['classname']((int)$object_id);
|
$object_duplicated = new $definition['classname']((int)$object_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user