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