// Fixed bug when associating Suppliers. Fixed StockCover
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11802 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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']));
|
||||
|
||||
Reference in New Issue
Block a user