// stock management : Supplier order is now supply order, employee and product is now historized for sttock movements and supply order

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10121 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
dSevere
2011-11-14 18:58:02 +00:00
parent 35150997c7
commit 5719c43481
20 changed files with 656 additions and 570 deletions
+75
View File
@@ -32,11 +32,31 @@
*/
class StockCore extends ObjectModel
{
/** @var int identifier of the warehouse */
public $id_warehouse;
/** @var int identifier of the product */
public $id_product;
/** @var int identifier of the product attribute if necessary */
public $id_product_attribute;
/** @var string Product reference */
public $reference;
/** @var int Product EAN13 */
public $ean13;
/** @var string UPC */
public $upc;
/** @var int the physical quantity in stock for the current product in the current warehouse */
public $physical_quantity;
/** @var int the usable quantity (for sale) of the current physical quantity */
public $usable_quantity;
/** @var int the unit price without tax forthe current product */
public $price_te;
protected $fieldsRequired = array(
@@ -54,6 +74,9 @@ class StockCore extends ObjectModel
'id_warehouse' => 'isUnsignedId',
'id_product' => 'isUnsignedId',
'id_product_attribute' => 'isUnsignedId',
'reference' => 'isReference',
'ean13' => 'isEan13',
'upc' => 'isUpc',
'physical_quantity' => 'isUnsignedInt',
'usable_quantity' => 'isInt',
'price_te' => 'isPrice',
@@ -68,9 +91,61 @@ class StockCore extends ObjectModel
$fields['id_warehouse'] = (int)$this->id_warehouse;
$fields['id_product'] = (int)$this->id_product;
$fields['id_product_attribute'] = (int)$this->id_product_attribute;
$fields['reference'] = pSQL($this->reference);
$fields['ean13'] = pSQL($this->ean13);
$fields['upc'] = pSQL($this->upc);
$fields['physical_quantity'] = (int)$this->physical_quantity;
$fields['usable_quantity'] = (int)$this->usable_quantity;
$fields['price_te'] = (float)round($this->price_te, 6);
return $fields;
}
/**
* @see ObjectModel::update()
*/
public function update($null_values = false)
{
$this->getProductInformations();
return parent::update($null_values);
}
/**
* @see ObjectModel::add()
*/
public function add($autodate = true, $null_values = false)
{
$this->getProductInformations();
return parent::add($autodate, $null_values);
}
/**
* Try to get reference, ean13 and upc information on current product
* and store it in stock for stock_mvt integrity and history use
*/
protected function getProductInformations()
{
if ((int)$this->id_product_attribute > 0)
{
$query = new DbQuery();
$query->select('reference, ean13, upc');
$query->from('product_attribute');
$query->where('id_product = '.(int)$this->id_product);
$query->where('id_product_attribute = '.(int)$this->id_product_attribute);
foreach (Db::getInstance()->executeS($query) as $row)
{
$this->reference = $row['reference'];
$this->ean13 = $row['ean13'];
$this->upc = $row['upc'];
}
}
else {
$product = new Product((int)$this->id_product);
$this->reference = $product->reference;
$this->ean13 = $product->ean13;
$this->upc = $product->upc;
}
}
}
+10 -3
View File
@@ -33,15 +33,22 @@
*/
class StockAvailableCore extends ObjectModel
{
/** @var int identifier of the current product */
public $id_product;
/** @var int identifier of product attribute if necessary */
public $id_product_attribute;
/** @var int the shop associated to the current product and corresponding quantity */
public $id_shop;
/** @var int the quantity available for sale */
public $quantity = 0;
/** @var bool determine if the available stock value depends on physical stock */
public $depends_on_stock = 0;
/*
* @var bool it was previously in Product class
*/
/** @var bool determine if a product is out of stock - it was previously in Product class */
public $out_of_stock = 0;
protected $fieldsRequired = array(
+5 -1
View File
@@ -72,6 +72,8 @@ class StockManagerCore implements StockManagerInterface
'last_wa' => null,
'current_wa' => null,
'id_employee' => $context->employee->id,
'employee_firstname' => $context->employee->firstname,
'employee_lastname' => $context->employee->lastname,
'sign' => 1
);
@@ -257,6 +259,8 @@ class StockManagerCore implements StockManagerInterface
'last_wa' => $stock->price_te,
'current_wa' => $stock->price_te,
'id_employee' => $context->employee->id,
'employee_firstname' => $context->employee->firstname,
'employee_lastname' => $context->employee->lastname,
'sign' => -1
);
$stock_params = array(
@@ -583,7 +587,7 @@ class StockManagerCore implements StockManagerInterface
*/
protected function calculateWA($stock, $quantity, $price_te)
{
return ((($stock->physical_quantity * $stock->price_te) + ($quantity * $price_te)) / ($stock->physical_quantity + $quantity));
return (float)Tools::ps_round(((($stock->physical_quantity * $stock->price_te) + ($quantity * $price_te)) / ($stock->physical_quantity + $quantity)), 6);
}
/**
+26
View File
@@ -28,9 +28,29 @@
class StockMvtCore extends ObjectModel
{
public $id;
/**
* @var string The creation date of the movement
*/
public $date_add;
/**
* @var int The employee id, responsible of the movement
*/
public $id_employee;
/**
* @since 1.5.0
* @var string The first name of the employee responsible of the movement
*/
public $employee_firstname;
/**
* @since 1.5.0
* @var string The last name of the employee responsible of the movement
*/
public $employee_lastname;
/**
* @since 1.5.0
* @var int The stock id on wtich the movement is applied
@@ -118,6 +138,8 @@ class StockMvtCore extends ObjectModel
protected $fieldsValidate = array(
'date_add' => 'isDate',
'id_employee' => 'isUnsignedId',
'employee_firstname' => 'isName',
'employee_lastname' => 'isName',
'id_stock' => 'isUnsignedId',
'physical_quantity' => 'isUnsignedInt',
'id_stock_mvt_reason' => 'isUnsignedId',
@@ -145,6 +167,8 @@ class StockMvtCore extends ObjectModel
$this->validateFields();
$fields['date_add'] = pSQL($this->date_add);
$fields['id_employee'] = (int)$this->id_employee;
$fields['employee_lastname'] = pSQL($this->employee_lastname);
$fields['employee_firstname'] = pSQL(Tools::ucfirst($this->employee_firstname));
$fields['id_stock'] = (int)$this->id_stock;
$fields['physical_quantity'] = (int)$this->physical_quantity;
$fields['id_stock_mvt_reason'] = (int)$this->id_stock_mvt_reason;
@@ -163,6 +187,7 @@ class StockMvtCore extends ObjectModel
public static function addMissingMvt($id_employee)
{
Tools::displayAsDeprecated();
/*
// Search missing stock movement on products without attributes
$sql = 'SELECT s.id_stock, (stock.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
FROM '._DB_PREFIX_.'product p
@@ -204,5 +229,6 @@ class StockMvtCore extends ObjectModel
$mvt->id_stock_mvt_reason = _STOCK_MOVEMENT_MISSING_REASON_;
$mvt->add();
}
*/
}
}
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 9991 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class SupplierOrderCore extends ObjectModel
class SupplyOrderCore extends ObjectModel
{
/**
* @var int Supplier
@@ -36,9 +36,9 @@ class SupplierOrderCore extends ObjectModel
public $id_supplier;
/**
* @var int Employee who initiated the order
* @var int The language id used on the delivery note
*/
public $id_employee;
public $id_lang;
/**
* @var int Warehouse where products will be delivered
@@ -48,7 +48,7 @@ class SupplierOrderCore extends ObjectModel
/**
* @var int State of the order
*/
public $id_supplier_order_state;
public $id_supply_order_state;
/**
* @var int Currency used for the order
@@ -112,9 +112,9 @@ class SupplierOrderCore extends ObjectModel
protected $fieldsRequired = array(
'id_supplier',
'id_employee',
'id_lang',
'id_warehouse',
'id_supplier_order_state',
'id_supply_order_state',
'id_currency',
'id_ref_currency',
'reference',
@@ -124,9 +124,9 @@ class SupplierOrderCore extends ObjectModel
protected $fieldsValidate = array(
'id_supplier' => 'isUnsignedId',
'id_employee' => 'isUnsignedId',
'id_lang' => 'isUnsignedId',
'id_warehouse' => 'isUnsignedId',
'id_supplier_order_state' => 'isUnsignedId',
'id_supply_order_state' => 'isUnsignedId',
'id_currency' => 'isUnsignedId',
'id_ref_currency' => 'isUnsignedId',
'reference' => 'isGenericName',
@@ -144,21 +144,21 @@ class SupplierOrderCore extends ObjectModel
/**
* @var string Database table name
*/
protected $table = 'supplier_order';
protected $table = 'supply_order';
/**
* @var string Database ID name
*/
protected $identifier = 'id_supplier_order';
protected $identifier = 'id_supply_order';
public function getFields()
{
$this->validateFields();
$fields['id_supplier'] = (int)$this->id_supplier;
$fields['id_employee'] = (int)$this->id_employee;
$fields['id_lang'] = (int)$this->id_lang;
$fields['id_warehouse'] = (int)$this->id_warehouse;
$fields['id_supplier_order_state'] = (int)$this->id_supplier_order_state;
$fields['id_supply_order_state'] = (int)$this->id_supply_order_state;
$fields['id_currency'] = (int)$this->id_currency;
$fields['id_ref_currency'] = (int)$this->id_ref_currency;
$fields['reference'] = pSQL($this->reference);
@@ -191,7 +191,7 @@ class SupplierOrderCore extends ObjectModel
}
/**
* @see ObjectModel::update()
* @see ObjectModel::add()
*/
public function add($autodate = true, $null_values = false)
{
@@ -263,7 +263,7 @@ class SupplierOrderCore extends ObjectModel
p.reference as reference,
p.ean13 as ean13');
$query->from('supplier_order_detail s');
$query->from('supply_order_detail s');
$query->innerjoin('product_lang pl ON (pl.id_product = s.id_product AND pl.id_lang = '.$id_lang.')');
@@ -273,9 +273,9 @@ class SupplierOrderCore extends ObjectModel
$query->leftjoin('attribute_lang al ON (al.id_attribute = atr.id_attribute AND al.id_lang = '.$id_lang.')');
$query->leftjoin('attribute_group_lang agl ON (agl.id_attribute_group = atr.id_attribute_group AND agl.id_lang = '.$id_lang.')');
$query->where('s.id_supplier_order = '.(int)$this->id);
$query->where('s.id_supply_order = '.(int)$this->id);
$query->groupBy('s.id_supplier_order_detail');
$query->groupBy('s.id_supply_order_detail');
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
}
@@ -293,12 +293,12 @@ class SupplierOrderCore extends ObjectModel
// build query
$query = new DbQuery();
$query->select('s.*');
$query->from('supplier_order_detail s');
$query->where('s.id_supplier_order = '.(int)$this->id);
$query->from('supply_order_detail s');
$query->where('s.id_supply_order = '.(int)$this->id);
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
return ObjectModel::hydrateCollection('SupplierOrderDetail', $results);
return ObjectModel::hydrateCollection('SupplyOrderDetail', $results);
}
@@ -311,8 +311,8 @@ class SupplierOrderCore extends ObjectModel
{
$query = new DbQuery();
$query->select('COUNT(*)');
$query->from('supplier_order_detail s');
$query->where('s.id_supplier_order = '.(int)$this->id);
$query->from('supply_order_detail s');
$query->where('s.id_supply_order = '.(int)$this->id);
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query) > 0);
}
@@ -327,8 +327,8 @@ class SupplierOrderCore extends ObjectModel
// build query
$query = new DbQuery();
$query->select('s.editable');
$query->from('supplier_order_state s');
$query->where('s.id_supplier_order_state = '.(int)$this->id_supplier_order_state);
$query->from('supply_order_state s');
$query->where('s.id_supply_order_state = '.(int)$this->id_supply_order_state);
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query) == 1);
}
@@ -343,8 +343,8 @@ class SupplierOrderCore extends ObjectModel
// build query
$query = new DbQuery();
$query->select('s.delivery_note');
$query->from('supplier_order_state s');
$query->where('s.id_supplier_order_state = '.(int)$this->id_supplier_order_state);
$query->from('supply_order_state s');
$query->where('s.id_supply_order_state = '.(int)$this->id_supply_order_state);
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query) == 1);
}
@@ -359,8 +359,8 @@ class SupplierOrderCore extends ObjectModel
// build query
$query = new DbQuery();
$query->select('s.receipt_state');
$query->from('supplier_order_state s');
$query->where('s.id_supplier_order_state = '.(int)$this->id_supplier_order_state);
$query->from('supply_order_state s');
$query->where('s.id_supply_order_state = '.(int)$this->id_supply_order_state);
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query) == 1);
}
@@ -372,10 +372,12 @@ class SupplierOrderCore extends ObjectModel
*/
protected function addHistory()
{
$history = new SupplierOrderHistory();
$history->id_supplier_order = $this->id;
$history->id_state = $this->id_supplier_order_state;
$history->id_employee = $this->id_employee;
$history = new SupplyOrderHistory();
$history->id_supply_order = $this->id;
$history->id_state = $this->id_supply_order_state;
$history->id_employee = (int)$this->context->employee->id;
$history->employee_firstname = pSQL($this->context->employee->firstname);
$history->employee_lastname = pSQL($this->context->employee->lastname);
$history->save();
}
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 10014 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -28,12 +28,12 @@
/**
* @since 1.5.0
*/
class SupplierOrderDetailCore extends ObjectModel
class SupplyOrderDetailCore extends ObjectModel
{
/**
* @var int Supplier order
* @var int Supply order
*/
public $id_supplier_order;
public $id_supply_order;
/**
* @var int Product ordered
@@ -45,13 +45,33 @@ class SupplierOrderDetailCore extends ObjectModel
*/
public $id_product_attribute;
/**
* @var string Product reference
*/
public $reference;
/**
* @var int Product name
*/
public $name;
/**
* @var int Product EAN13
*/
public $ean13;
/**
* @var string UPC
*/
public $upc;
/**
* @var int Currency used to buy this particular product
*/
public $id_currency;
/**
* @var float Exchange rate between $id_currency and SupplierOrder::$id_ref_currency, at the time
* @var float Exchange rate between $id_currency and SupplyOrder::$id_ref_currency, at the time
*/
public $exchange_rate;
@@ -107,20 +127,21 @@ class SupplierOrderDetailCore extends ObjectModel
public $price_ti = 0;
/**
* @var float Tax value of the given product after applying the global order discount (i.e. if SupplierOrder::discount_rate is set)
* @var float Tax value of the given product after applying the global order discount (i.e. if SupplyOrder::discount_rate is set)
*/
public $tax_value_with_order_discount = 0;
/**
* @var float This is like $price_with_discount_te, considering the global order discount.
* (i.e. if SupplierOrder::discount_rate is set)
* (i.e. if SupplyOrder::discount_rate is set)
*/
public $price_with_order_discount_te = 0;
protected $fieldsRequired = array(
'id_supplier_order',
'id_supply_order',
'id_product',
'id_product_attribute',
'name',
'id_currency',
'exchange_rate',
'unit_price_te',
@@ -137,9 +158,13 @@ class SupplierOrderDetailCore extends ObjectModel
);
protected $fieldsValidate = array(
'id_supplier_order' => 'isUnsignedId',
'id_supply_order' => 'isUnsignedId',
'id_product' => 'isUnsignedId',
'id_product_attribute' => 'isUnsignedId',
'reference' => 'isReference',
'name' => 'isGenericName',
'ean13' => 'isEan13',
'upc' => 'isUpc',
'id_currency' => 'isUnsignedId',
'exchange_rate' => 'isFloat',
'unit_price_te' => 'isPrice',
@@ -159,12 +184,12 @@ class SupplierOrderDetailCore extends ObjectModel
/**
* @var string Database table name
*/
protected $table = 'supplier_order_detail';
protected $table = 'supply_order_detail';
/**
* @var string Database ID name
*/
protected $identifier = 'id_supplier_order_detail';
protected $identifier = 'id_supply_order_detail';
/**
* @see ObjectModel::getFields()
@@ -173,9 +198,13 @@ class SupplierOrderDetailCore extends ObjectModel
{
$this->validateFields();
$fields['id_supplier_order'] = (int)$this->id_supplier_order;
$fields['id_supply_order'] = (int)$this->id_supply_order;
$fields['id_product'] = (int)$this->id_product;
$fields['id_product_attribute'] = (int)$this->id_product_attribute;
$fields['reference'] = pSQL($this->reference);
$fields['name'] = pSQL($this->name);
$fields['ean13'] = pSQL($this->ean13);
$fields['upc'] = pSQL($this->upc);
$fields['id_currency'] = (int)$this->id_currency;
$fields['exchange_rate'] = (float)$this->exchange_rate;
$fields['unit_price_te'] = (float)$this->unit_price_te;
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 9659 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -28,18 +28,28 @@
/**
* @since 1.5.0
*/
class SupplierOrderHistoryCore extends ObjectModel
class SupplyOrderHistoryCore extends ObjectModel
{
/**
* @var int Supplier order
* @var int Supply order
*/
public $id_supplier_order;
public $id_supply_order;
/**
* @var int Employee
*/
public $id_employee;
/**
* @var string The first name of the employee responsible of the movement
*/
public $employee_firstname;
/**
* @var string The last name of the employee responsible of the movement
*/
public $employee_lastname;
/**
* @var int State
*/
@@ -51,15 +61,17 @@ class SupplierOrderHistoryCore extends ObjectModel
public $date_add;
protected $fieldsRequired = array(
'id_supplier_order',
'id_supply_order',
'id_employee',
'id_state',
'date_add'
);
protected $fieldsValidate = array(
'id_supplier_order' => 'isUnsignedId',
'id_supply_order' => 'isUnsignedId',
'id_employee' => 'isUnsignedId',
'employee_firstname' => 'isName',
'employee_lastname' => 'isName',
'id_state' => 'isUnsignedId',
'date_add' => 'isDate'
);
@@ -67,19 +79,21 @@ class SupplierOrderHistoryCore extends ObjectModel
/**
* @var string Database table name
*/
protected $table = 'supplier_order_history';
protected $table = 'supply_order_history';
/**
* @var string Database ID name
*/
protected $identifier = 'id_supplier_order_history';
protected $identifier = 'id_supply_order_history';
public function getFields()
{
$this->validateFields();
$fields['id_supplier_order'] = (int)$this->id_supplier_order;
$fields['id_supply_order'] = (int)$this->id_supply_order;
$fields['id_employee'] = (int)$this->id_employee;
$fields['employee_lastname'] = pSQL($this->employee_lastname);
$fields['employee_firstname'] = pSQL(Tools::ucfirst($this->employee_firstname));
$fields['id_state'] = (int)$this->id_state;
$fields['date_add'] = pSQL($this->date_add);
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 9927 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -28,22 +28,32 @@
/**
* @since 1.5.0
*/
class SupplierOrderReceiptHistoryCore extends ObjectModel
class SupplyOrderReceiptHistoryCore extends ObjectModel
{
/**
* @var int Detail of the supplier order
* @var int Detail of the supply order
*/
public $id_supplier_order_detail;
public $id_supply_order_detail;
/**
* @var int Employee
*/
public $id_employee;
/**
* @var string The first name of the employee responsible of the movement
*/
public $employee_firstname;
/**
* @var string The last name of the employee responsible of the movement
*/
public $employee_lastname;
/**
* @var int State
*/
public $id_supplier_order_state;
public $id_supply_order_state;
/**
* @var int Quantity delivered
@@ -56,16 +66,18 @@ class SupplierOrderReceiptHistoryCore extends ObjectModel
public $date_add;
protected $fieldsRequired = array(
'id_supplier_order_detail',
'id_supplier_order_state',
'id_supply_order_detail',
'id_supply_order_state',
'id_employee',
'quantity'
);
protected $fieldsValidate = array(
'id_supplier_order_detail' => 'isUnsignedId',
'id_supplier_order_state' => 'isUnsignedId',
'id_supply_order_detail' => 'isUnsignedId',
'id_supply_order_state' => 'isUnsignedId',
'id_employee' => 'isUnsignedId',
'employee_firstname' => 'isName',
'employee_lastname' => 'isName',
'quantity' => 'isUnsignedInt',
'date_add' => 'isDate'
);
@@ -73,20 +85,22 @@ class SupplierOrderReceiptHistoryCore extends ObjectModel
/**
* @var string Database table name
*/
protected $table = 'supplier_order_receipt_history';
protected $table = 'supply_order_receipt_history';
/**
* @var string Database ID name
*/
protected $identifier = 'id_supplier_order_receipt_history';
protected $identifier = 'id_supply_order_receipt_history';
public function getFields()
{
$this->validateFields();
$fields['id_supplier_order_detail'] = (int)$this->id_supplier_order_detail;
$fields['id_supplier_order_state'] = (int)$this->id_supplier_order_state;
$fields['id_supply_order_detail'] = (int)$this->id_supply_order_detail;
$fields['id_supply_order_state'] = (int)$this->id_supply_order_state;
$fields['id_employee'] = (int)$this->id_employee;
$fields['employee_lastname'] = pSQL($this->employee_lastname);
$fields['employee_firstname'] = pSQL(Tools::ucfirst($this->employee_firstname));
$fields['quantity'] = (int)$this->quantity;
$fields['date_add'] = pSQL($this->date_add);
@@ -20,7 +20,7 @@
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @version Release: $Revision: 10019 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class SupplierOrderStateCore extends ObjectModel
class SupplyOrderStateCore extends ObjectModel
{
/**
* @var string Name of the state
@@ -81,12 +81,12 @@ class SupplierOrderStateCore extends ObjectModel
/**
* @var string Database table name
*/
protected $table = 'supplier_order_state';
protected $table = 'supply_order_state';
/**
* @var string Database ID name
*/
protected $identifier = 'id_supplier_order_state';
protected $identifier = 'id_supply_order_state';
/**
* @see ObjectModel::getFields()
@@ -114,21 +114,21 @@ class SupplierOrderStateCore extends ObjectModel
}
/**
* Gets the list of supplier order states
* Gets the list of supply order states
*
* @param int $id_state_referrer The state refferer id used to know what state is available after the current state refferer
* @param int $id_lang The language id
* @return array
*/
public static function getSupplierOrderStates($id_state_referrer = null, $id_lang = null)
public static function getSupplyOrderStates($id_state_referrer = null, $id_lang = null)
{
if ($id_lang == null)
$id_lang = Context::getContext()->language->id;
$query = new DbQuery();
$query->select('sl.name, s.id_supplier_order_state');
$query->from('supplier_order_state s');
$query->leftjoin('supplier_order_state_lang sl ON (s.id_supplier_order_state = sl.id_supplier_order_state AND sl.id_lang='.(int)$id_lang.')');
$query->select('sl.name, s.id_supply_order_state');
$query->from('supply_order_state s');
$query->leftjoin('supply_order_state_lang sl ON (s.id_supply_order_state = sl.id_supply_order_state AND sl.id_lang='.(int)$id_lang.')');
if (!is_null($id_state_referrer))
{
@@ -138,7 +138,7 @@ class SupplierOrderStateCore extends ObjectModel
$is_pending_receipt = false;
//check current state to see what state is available
$state = new SupplierOrderState((int)$id_state_referrer);
$state = new SupplyOrderState((int)$id_state_referrer);
if (Validate::isLoadedObject($state))
{
$is_receipt_state = $state->receipt_state;
@@ -147,7 +147,7 @@ class SupplierOrderStateCore extends ObjectModel
$is_pending_receipt = $state->pending_receipt;
}
$query->where('s.id_supplier_order_state <> '.$id_state_referrer);
$query->where('s.id_supply_order_state <> '.$id_state_referrer);
//check first if the order is editable
if ($is_editable)