// add another logs information
This commit is contained in:
@@ -2714,18 +2714,31 @@ class AdminControllerCore extends Controller
|
||||
else
|
||||
{
|
||||
$result = true;
|
||||
if ($this->deleted)
|
||||
foreach ($this->boxes as $id)
|
||||
{
|
||||
foreach ($this->boxes as $id)
|
||||
$to_delete = new $this->className($id);
|
||||
$delete_ok = true;
|
||||
if ($this->deleted)
|
||||
{
|
||||
$to_delete = new $this->className($id);
|
||||
$to_delete->deleted = 1;
|
||||
$result = $result && $to_delete->update();
|
||||
if (!$to_delete->update())
|
||||
{
|
||||
$result = false;
|
||||
$delete_ok = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!$to_delete->delete())
|
||||
{
|
||||
$result = false;
|
||||
$delete_ok = false;
|
||||
}
|
||||
|
||||
if ($delete_ok)
|
||||
Logger::addLog(sprintf($this->l('%s deletion'), $this->className), 1, null, $this->className, (int)$to_delete->id, true, (int)$this->context->employee->id);
|
||||
else
|
||||
$this->errors[] = sprintf(Tools::displayError('Can\'t delete #%d'), $id);
|
||||
}
|
||||
else
|
||||
$result = $object->deleteSelection(Tools::getValue($this->table.'Box'));
|
||||
|
||||
if ($result)
|
||||
$this->redirect_after = self::$currentIndex.'&conf=2&token='.$this->token;
|
||||
$this->errors[] = Tools::displayError('An error occurred while deleting this selection.');
|
||||
|
||||
@@ -2710,43 +2710,51 @@ class AdminImportControllerCore extends AdminController
|
||||
// If i am a superadmin, i can truncate table
|
||||
if (((Shop::isFeatureActive() && $this->context->employee->isSuperAdmin()) || !Shop::isFeatureActive()) && Tools::getValue('truncate'))
|
||||
$this->truncateTables((int)Tools::getValue('entity'));
|
||||
|
||||
$import_type = false;
|
||||
switch ((int)Tools::getValue('entity'))
|
||||
{
|
||||
case $this->entities[$this->l('Categories')]:
|
||||
case $this->entities[$import_type = $this->l('Categories')]:
|
||||
$this->categoryImport();
|
||||
break;
|
||||
case $this->entities[$this->l('Products')]:
|
||||
case $this->entities[$import_type = $this->l('Products')]:
|
||||
$import_type = $this->l('Categories');
|
||||
$this->productImport();
|
||||
break;
|
||||
case $this->entities[$this->l('Customers')]:
|
||||
case $this->entities[$import_type = $this->l('Customers')]:
|
||||
$this->customerImport();
|
||||
break;
|
||||
case $this->entities[$this->l('Addresses')]:
|
||||
case $this->entities[$import_type = $this->l('Addresses')]:
|
||||
$this->addressImport();
|
||||
break;
|
||||
case $this->entities[$this->l('Combinations')]:
|
||||
case $this->entities[$import_type = $this->l('Combinations')]:
|
||||
$this->attributeImport();
|
||||
break;
|
||||
case $this->entities[$this->l('Manufacturers')]:
|
||||
case $this->entities[$import_type = $this->l('Manufacturers')]:
|
||||
$this->manufacturerImport();
|
||||
break;
|
||||
case $this->entities[$this->l('Suppliers')]:
|
||||
case $this->entities[$import_type = $this->l('Suppliers')]:
|
||||
$this->supplierImport();
|
||||
break;
|
||||
// @since 1.5.0
|
||||
case $this->entities[$this->l('Supply Orders')]:
|
||||
case $this->entities[$import_type = $this->l('Supply Orders')]:
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
|
||||
$this->supplyOrdersImport();
|
||||
break;
|
||||
// @since 1.5.0
|
||||
case $this->entities[$this->l('Supply Order Details')]:
|
||||
case $this->entities[$import_type = $this->l('Supply Order Details')]:
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
|
||||
$this->supplyOrdersDetailsImport();
|
||||
break;
|
||||
default:
|
||||
$this->errors[] = $this->l('Please select what you would like to import');
|
||||
}
|
||||
if ($import_type !== false)
|
||||
{
|
||||
$log_message = sprintf($this->l('%s import'), $import_type);
|
||||
if (Tools::getValue('truncate'))
|
||||
$log_message .= ' '.$this->l('with truncate');
|
||||
Logger::addLog($log_message, 1, null, $import_type, null, true, (int)$this->context->employee->id);
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->errors[] = $this->l('You must upload a file in order to proceed to the next step');
|
||||
@@ -2806,4 +2814,4 @@ class AdminImportControllerCore extends AdminController
|
||||
die;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -739,7 +739,12 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->errors[] = sprintf(Tools::displayError('You cannot delete the product #%d because there is physical stock left.'), $product->id);
|
||||
}
|
||||
if (!count($this->errors))
|
||||
$success &= $product->delete();
|
||||
{
|
||||
if ($product->delete())
|
||||
Logger::addLog(sprintf($this->l('%s deletion'), $this->className), 1, null, $this->className, (int)$product->id, true, (int)$this->context->employee->id);
|
||||
else
|
||||
$success = false;
|
||||
}
|
||||
else
|
||||
$success = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user