// Log for product deletion was missing

This commit is contained in:
Rémi Gaillard committed 2013-08-13 10:21:01 +02:00
1 parent da02895432
commit 9c523cf7eb
1 file changed
+5 -5
@@ -359,18 +359,17 @@ class AdminProductsControllerCore extends AdminController
$result = parent::loadObject($opt); $result = parent::loadObject($opt);
if ($result && Validate::isLoadedObject($this->object)) if ($result && Validate::isLoadedObject($this->object))
{ {
if (Shop::getContext() == Shop::CONTEXT_SHOP && !$this->object->isAssociatedToShop()) if (Shop::getContext() == Shop::CONTEXT_SHOP && Shop::isFeatureActive() && !$this->object->isAssociatedToShop())
{ {
$default_product = new Product((int)$this->object->id, false, null, (int)$this->object->id_shop_default); $default_product = new Product((int)$this->object->id, false, null, (int)$this->object->id_shop_default);
$def = ObjectModel::getDefinition($this->object); $def = ObjectModel::getDefinition($this->object);
foreach ($def['fields'] as $field_name => $row) foreach ($def['fields'] as $field_name => $row)
{ {
$fields_array = array(); if (is_array($default_product->$field_name))
if(is_array($default_product->$field_name)) foreach ($default_product->$field_name as $key => $fields_name)
foreach ($fields_array as $key => $fields_name)
$this->object->$field_name[$key] = ObjectModel::formatValue($fields_name, $def['fields'][$field_name]['type']); $this->object->$field_name[$key] = ObjectModel::formatValue($fields_name, $def['fields'][$field_name]['type']);
else else
$this->object->$field_name = ObjectModel::formatValue($this->object->$field_name, $def['fields'][$field_name]['type']); $this->object->$field_name = ObjectModel::formatValue($default_product->$field_name, $def['fields'][$field_name]['type']);
} }
} }
$this->object->loadStockData(); $this->object->loadStockData();
@@ -631,6 +630,7 @@ class AdminProductsControllerCore extends AdminController
{ {
$id_category = (int)Tools::getValue('id_category'); $id_category = (int)Tools::getValue('id_category');
$category_url = empty($id_category) ? '' : '&id_category='.(int)$id_category; $category_url = empty($id_category) ? '' : '&id_category='.(int)$id_category;
Logger::addLog(sprintf($this->l('%s deletion'), $this->className), 1, null, $this->className, (int)$object->id, true, (int)$this->context->employee->id);
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token.$category_url; $this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token.$category_url;
} }
else else