// Suppliers : Manage multiple suppliers for a product / product attribute + integration with supply orders
This commit is contained in:
@@ -155,7 +155,7 @@ class StockAvailableCore extends ObjectModel
|
||||
$quantity = $manager->getProductRealQuantities($id_product, $id_product_attribute, $warehouses, true);
|
||||
|
||||
$query = array(
|
||||
'table' => 'stock_available',
|
||||
'table' => _DB_PREFIX_.'stock_available',
|
||||
'data' => array('quantity' => $quantity),
|
||||
'type' => 'UPDATE',
|
||||
'where' => 'id_product = '.(int)$id_product.' AND id_product_attribute = '.(int)$id_product_attribute.' AND id_shop = '.(int)$id_shop
|
||||
@@ -167,7 +167,7 @@ class StockAvailableCore extends ObjectModel
|
||||
}
|
||||
|
||||
$query = array(
|
||||
'table' => 'stock_available',
|
||||
'table' => _DB_PREFIX_.'stock_available',
|
||||
'data' => array('quantity' => $total_quantity),
|
||||
'type' => 'UPDATE',
|
||||
'where' => 'id_product = '.(int)$id_product.' AND id_product_attribute = 0 AND id_shop = '.(int)$id_shop
|
||||
@@ -215,7 +215,7 @@ class StockAvailableCore extends ObjectModel
|
||||
$id_shop = Context::getContext()->shop->getID(true);
|
||||
|
||||
Db::getInstance()->autoExecute(
|
||||
'stock_available',
|
||||
_DB_PREFIX_.'stock_available',
|
||||
array('out_of_stock' => (int)$out_of_stock),
|
||||
'UPDATE',
|
||||
'id_product = '.(int)$id_product.' AND id_shop = '.(int)$id_shop
|
||||
|
||||
@@ -35,6 +35,11 @@ class SupplyOrderCore extends ObjectModel
|
||||
*/
|
||||
public $id_supplier;
|
||||
|
||||
/**
|
||||
* @var string Supplier Name
|
||||
*/
|
||||
public $supplier_name;
|
||||
|
||||
/**
|
||||
* @var int The language id used on the delivery note
|
||||
*/
|
||||
@@ -112,6 +117,7 @@ class SupplyOrderCore extends ObjectModel
|
||||
|
||||
protected $fieldsRequired = array(
|
||||
'id_supplier',
|
||||
'supplier_name',
|
||||
'id_lang',
|
||||
'id_warehouse',
|
||||
'id_supply_order_state',
|
||||
@@ -124,6 +130,7 @@ class SupplyOrderCore extends ObjectModel
|
||||
|
||||
protected $fieldsValidate = array(
|
||||
'id_supplier' => 'isUnsignedId',
|
||||
'supplier_name' => 'isCatalogName',
|
||||
'id_lang' => 'isUnsignedId',
|
||||
'id_warehouse' => 'isUnsignedId',
|
||||
'id_supply_order_state' => 'isUnsignedId',
|
||||
@@ -156,6 +163,7 @@ class SupplyOrderCore extends ObjectModel
|
||||
$this->validateFields();
|
||||
|
||||
$fields['id_supplier'] = (int)$this->id_supplier;
|
||||
$fields['supplier_name'] = pSQL($this->supplier_name);
|
||||
$fields['id_lang'] = (int)$this->id_lang;
|
||||
$fields['id_warehouse'] = (int)$this->id_warehouse;
|
||||
$fields['id_supply_order_state'] = (int)$this->id_supply_order_state;
|
||||
|
||||
@@ -50,6 +50,11 @@ class SupplyOrderDetailCore extends ObjectModel
|
||||
*/
|
||||
public $reference;
|
||||
|
||||
/**
|
||||
* @var string Product supplier reference
|
||||
*/
|
||||
public $supplier_reference;
|
||||
|
||||
/**
|
||||
* @var int Product name
|
||||
*/
|
||||
@@ -162,6 +167,7 @@ class SupplyOrderDetailCore extends ObjectModel
|
||||
'id_product' => 'isUnsignedId',
|
||||
'id_product_attribute' => 'isUnsignedId',
|
||||
'reference' => 'isReference',
|
||||
'supplier_reference' => 'isReference',
|
||||
'name' => 'isGenericName',
|
||||
'ean13' => 'isEan13',
|
||||
'upc' => 'isUpc',
|
||||
@@ -202,6 +208,7 @@ class SupplyOrderDetailCore extends ObjectModel
|
||||
$fields['id_product'] = (int)$this->id_product;
|
||||
$fields['id_product_attribute'] = (int)$this->id_product_attribute;
|
||||
$fields['reference'] = pSQL($this->reference);
|
||||
$fields['supplier_reference'] = pSQL($this->supplier_reference);
|
||||
$fields['name'] = pSQL($this->name);
|
||||
$fields['ean13'] = pSQL($this->ean13);
|
||||
$fields['upc'] = pSQL($this->upc);
|
||||
@@ -281,8 +288,9 @@ class SupplyOrderDetailCore extends ObjectModel
|
||||
if ($discount_rate != null && is_numeric($discount_rate) && (float)$discount_rate > 0)
|
||||
{
|
||||
// calculates new price, with global order discount, tax ecluded
|
||||
$this->price_with_order_discount_te = Tools::ps_round($this->price_with_discount_te - ($this->price_with_discount_te * ((float)$discount_rate / 100)),
|
||||
6);
|
||||
$discount_value = $this->price_with_discount_te - ($this->price_with_discount_te * ((float)$discount_rate / 100));
|
||||
|
||||
$this->price_with_order_discount_te = Tools::ps_round($discount_value, 6);
|
||||
|
||||
// calculates new tax value, with global order discount
|
||||
$this->tax_value_with_order_discount = Tools::ps_round($this->price_with_order_discount_te * ((float)$this->tax_rate / 100), 6);
|
||||
|
||||
Reference in New Issue
Block a user