// normalize
This commit is contained in:
@@ -113,11 +113,12 @@ class StockCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get reference, ean13 and upc information on current product
|
||||
* and store it in stock for stock_mvt integrity and history use
|
||||
* Gets reference, ean13 and upc of the current product
|
||||
* Stores it in stock for stock_mvt integrity and history purposes
|
||||
*/
|
||||
protected function getProductInformations()
|
||||
{
|
||||
// if combinations
|
||||
if ((int)$this->id_product_attribute > 0)
|
||||
{
|
||||
$query = new DbQuery();
|
||||
@@ -125,15 +126,19 @@ class StockCore extends ObjectModel
|
||||
$query->from('product_attribute');
|
||||
$query->where('id_product = '.(int)$this->id_product);
|
||||
$query->where('id_product_attribute = '.(int)$this->id_product_attribute);
|
||||
$rows = Db::getInstance()->executeS($query);
|
||||
|
||||
foreach (Db::getInstance()->executeS($query) as $row)
|
||||
if (!is_array($rows))
|
||||
return;
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$this->reference = $row['reference'];
|
||||
$this->ean13 = $row['ean13'];
|
||||
$this->upc = $row['upc'];
|
||||
}
|
||||
}
|
||||
else
|
||||
else // else, simple product
|
||||
{
|
||||
$product = new Product((int)$this->id_product);
|
||||
if (Validate::isLoadedObject($product))
|
||||
|
||||
@@ -164,10 +164,12 @@ class StockMvtCore extends ObjectModel
|
||||
/**
|
||||
* @deprecated since 1.5.0
|
||||
*
|
||||
* This method no longer exists, and have no equivalent because the missing movements have to be handled by inventories.
|
||||
* This method no longer exists.
|
||||
* There is no equivalent or replacement, considering that this should be handled by inventories.
|
||||
*/
|
||||
public static function addMissingMvt($id_employee)
|
||||
{
|
||||
// display that this method is deprecated
|
||||
Tools::displayAsDeprecated();
|
||||
}
|
||||
|
||||
@@ -188,6 +190,7 @@ class StockMvtCore extends ObjectModel
|
||||
$movements = array();
|
||||
$quantity_total = 0;
|
||||
|
||||
// preps query
|
||||
$query = new DbQuery();
|
||||
$query->select('sm.*, s.id_warehouse');
|
||||
$query->from('stock_mvt', 'sm');
|
||||
@@ -195,11 +198,18 @@ class StockMvtCore extends ObjectModel
|
||||
$query->where('sm.sign = -1');
|
||||
$query->where('sm.id_order = '.(int)$id_order);
|
||||
$query->where('s.id_product = '.(int)$id_product.' AND s.id_product_attribute = '.(int)$id_product_attribute);
|
||||
|
||||
// if filer by warehouse
|
||||
if (!is_null($id_warehouse))
|
||||
$query->where('s.id_warehouse = '.(int)$id_warehouse);
|
||||
|
||||
// orders the movements by date
|
||||
$query->orderBy('date_add DESC');
|
||||
|
||||
// gets the result
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->query($query);
|
||||
|
||||
// fills the movements array
|
||||
while ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->nextRow($res))
|
||||
{
|
||||
if ($quantity_total >= $quantity)
|
||||
|
||||
Reference in New Issue
Block a user