diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index af51d577b..4bd05ce3c 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2441,21 +2441,21 @@ class AdminProductsControllerCore extends AdminController { $params = explode('_', $key); - $wpl_id = WarehouseProductLocation::getIdByProductAndWarehouse($params[1], $params[2], $params[0]); + $wpl_id = (int)WarehouseProductLocation::getIdByProductAndWarehouse((int)$params[1], (int)$params[2], (int)$params[0]); if (empty($wpl_id)) { //create new record $warehouse_location_entity = new WarehouseProductLocation(); - $warehouse_location_entity->id_product = $params[1]; - $warehouse_location_entity->id_product_attribute = $params[2]; - $warehouse_location_entity->id_warehouse = $params[0]; + $warehouse_location_entity->id_product = (int)$params[1]; + $warehouse_location_entity->id_product_attribute = (int)$params[2]; + $warehouse_location_entity->id_warehouse = (int)$params[0]; $warehouse_location_entity->location = pSQL($location); $warehouse_location_entity->save(); } else { - $warehouse_location_entity = new WarehouseProductLocation($wpl_id); + $warehouse_location_entity = new WarehouseProductLocation((int)$wpl_id); $location = pSQL($location); @@ -2464,10 +2464,8 @@ class AdminProductsControllerCore extends AdminController $warehouse_location_entity->location = pSQL($location); $warehouse_location_entity->update(); } - break; } } - $this->confirmations[] = $this->l('Warehouses and location(s) of the product have been updated'); } } diff --git a/controllers/admin/AdminStockCoverController.php b/controllers/admin/AdminStockCoverController.php index d6fe6495c..ec5c5e3fe 100644 --- a/controllers/admin/AdminStockCoverController.php +++ b/controllers/admin/AdminStockCoverController.php @@ -159,7 +159,12 @@ class AdminStockCoverControllerCore extends AdminController else // infinity $data['coverage'] = '--'; - $data['qty_sold'] = $this->getQuantitySold($data['id_product'], $data['id'], $this->getCurrentCoveragePeriod()); + // computes quantity sold + $qty_sold = $this->getQuantitySold($data['id_product'], $data['id'], $this->getCurrentCoveragePeriod()); + if (!$qty_sold) + $data['qty_sold'] = '--'; + else + $data['qty_sold'] = $qty_sold; } echo Tools::jsonEncode(array('data'=> $datas, 'fields_display' => $this->fieldsDisplay)); @@ -236,7 +241,11 @@ class AdminStockCoverControllerCore extends AdminController $item['coverage'] = '--'; // computes quantity sold - $item['qty_sold'] = $this->getQuantitySold($item['id'], 0, $this->getCurrentCoveragePeriod()); + $qty_sold = $this->getQuantitySold($item['id'], 0, $this->getCurrentCoveragePeriod()); + if (!$qty_sold) + $item['qty_sold'] = '--'; + else + $item['qty_sold'] = $qty_sold; // removes 'details' action on products without attributes $this->addRowActionSkipList('details', array($item['id']));