// Format definitions

This commit is contained in:
rMalie
2011-12-13 13:41:54 +00:00
parent a40f3c304c
commit c022f4e0e5
71 changed files with 710 additions and 1791 deletions
+9 -33
View File
@@ -59,12 +59,6 @@ class StockCore extends ObjectModel
/** @var int the unit price without tax forthe current product */
public $price_te;
/**
* @see ObjectModel::$definition
*/
@@ -72,36 +66,18 @@ class StockCore extends ObjectModel
'table' => 'stock',
'primary' => 'id_stock',
'fields' => array(
'id_warehouse' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_product' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_product_attribute' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'reference' => array('type' => 'FILL_ME', 'validate' => 'isReference'),
'ean13' => array('type' => 'FILL_ME', 'validate' => 'isEan13'),
'upc' => array('type' => 'FILL_ME', 'validate' => 'isUpc'),
'physical_quantity' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedInt', 'required' => true),
'usable_quantity' => array('type' => 'FILL_ME', 'validate' => 'isInt', 'required' => true),
'price_te' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true),
'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'reference' => array('type' => self::TYPE_STRING, 'validate' => 'isReference'),
'ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13'),
'upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc'),
'physical_quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'usable_quantity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'price_te' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
),
);
public function getFields()
{
$this->validateFields();
$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()
*/
+7 -28
View File
@@ -54,12 +54,6 @@ class StockAvailableCore extends ObjectModel
/** @var bool determine if a product is out of stock - it was previously in Product class */
public $out_of_stock = 0;
/**
* @see ObjectModel::$definition
*/
@@ -67,31 +61,16 @@ class StockAvailableCore extends ObjectModel
'table' => 'stock_available',
'primary' => 'id_stock_available',
'fields' => array(
'id_product' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_product_attribute' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_shop' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'id_group_shop' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'quantity' => array('type' => 'FILL_ME', 'validate' => 'isInt', 'required' => true),
'depends_on_stock' => array('type' => 'FILL_ME', 'validate' => 'isBool', 'required' => true),
'out_of_stock' => array('type' => 'FILL_ME', 'validate' => 'isInt', 'required' => true),
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_group_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'quantity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'depends_on_stock' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
'out_of_stock' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
),
);
public function getFields()
{
$this->validateFields();
$fields['id_product'] = (int)$this->id_product;
$fields['id_product_attribute'] = (int)$this->id_product_attribute;
$fields['id_shop'] = (int)$this->id_shop;
$fields['id_group_shop'] = (int)$this->id_group_shop;
$fields['quantity'] = (int)$this->quantity;
// booleans can NOT be inserted in an INTEGER database field
$fields['depends_on_stock'] = (int)(bool)$this->depends_on_stock;
$fields['out_of_stock'] = (int)$this->out_of_stock;
return $fields;
}
/**
* For a given {id_product, id_product_attribute and id_shop}, gets the stock available id associated
*
+14 -39
View File
@@ -129,28 +129,23 @@ class StockMvtCore extends ObjectModel
'table' => 'stock_mvt',
'primary' => 'id_stock_mvt',
'fields' => array(
'date_add' => array('type' => 'FILL_ME', 'validate' => 'isDate', 'required' => true),
'id_employee' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'employee_firstname' => array('type' => 'FILL_ME', 'validate' => 'isName'),
'employee_lastname' => array('type' => 'FILL_ME', 'validate' => 'isName'),
'id_stock' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'physical_quantity' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedInt', 'required' => true),
'id_stock_mvt_reason' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'id_supply_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'sign' => array('type' => 'FILL_ME', 'validate' => 'isInt', 'required' => true),
'last_wa' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'current_wa' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'price_te' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true),
'referer' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'employee_firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName'),
'employee_lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName'),
'id_stock' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'physical_quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'id_stock_mvt_reason' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_supply_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'sign' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'last_wa' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'current_wa' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'price_te' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
'referer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'required' => true),
),
);
protected $webserviceParameters = array(
'objectsNodeName' => 'stock_movements',
'objectNodeName' => 'stock_movement',
@@ -162,26 +157,6 @@ class StockMvtCore extends ObjectModel
),
);
public function getFields()
{
$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;
$fields['id_order'] = (int)$this->id_order;
$fields['id_supply_order'] = (int)$this->id_supply_order;
$fields['sign'] = (int)$this->sign;
$fields['last_wa'] = (float)Tools::ps_round($this->last_wa, 6);
$fields['current_wa'] = (float)Tools::ps_round($this->current_wa, 6);
$fields['price_te'] = (float)Tools::ps_round($this->price_te, 6);
$fields['referer'] = (int)$this->referer;
return $fields;
}
/**
* @deprecated since 1.5.0
*
+7 -16
View File
@@ -53,30 +53,21 @@ class StockMvtReasonCore extends ObjectModel
'primary' => 'id_stock_mvt_reason',
'multilang' => true,
'fields' => array(
'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
'sign' => array('type' => self::TYPE_INT),
'deleted' => array('type' => self::TYPE_BOOL),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields
'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
),
);
protected $webserviceParameters = array(
'objectsNodeName' => 'stock_movement_reasons',
'objectNodeName' => 'stock_movement_reason',
);
public function getFields()
{
$this->validateFields();
$fields['sign'] = (int)$this->sign;
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
$fields['deleted'] = (int)$this->deleted;
return $fields;
}
public function getTranslationsFieldsChild()
{
$this->validateFieldsLang();
+18 -49
View File
@@ -120,10 +120,6 @@ class SupplyOrderCore extends ObjectModel
*/
public $is_template = 0;
/**
* @var array Contains object definition
* @see ObjectModel::definition
@@ -135,54 +131,27 @@ class SupplyOrderCore extends ObjectModel
'table' => 'supply_order',
'primary' => 'id_supply_order',
'fields' => array(
'id_supplier' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'supplier_name' => array('type' => 'FILL_ME', 'validate' => 'isCatalogName', 'required' => true),
'id_lang' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_warehouse' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_supply_order_state' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_currency' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_ref_currency' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'reference' => array('type' => 'FILL_ME', 'validate' => 'isGenericName', 'required' => true),
'date_add' => array('type' => 'FILL_ME', 'validate' => 'isDate'),
'date_upd' => array('type' => 'FILL_ME', 'validate' => 'isDate'),
'date_delivery_expected' => array('type' => 'FILL_ME', 'validate' => 'isDate', 'required' => true),
'total_te' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_with_discount_te' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_ti' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_tax' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'discount_rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat', 'required' => true),
'discount_value_te' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'is_template' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'supplier_name' => array('type' => self::TYPE_STRING, 'validate' => 'isCatalogName', 'required' => true),
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_supply_order_state' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_ref_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'reference' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
'date_delivery_expected' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'required' => true),
'total_te' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_with_discount_te' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_ti' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_tax' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'discount_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
'discount_value_te' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'is_template' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),
);
public function getFields()
{
$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;
$fields['id_currency'] = (int)$this->id_currency;
$fields['id_ref_currency'] = (int)$this->id_ref_currency;
$fields['reference'] = pSQL($this->reference);
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
$fields['date_delivery_expected'] = pSQL($this->date_delivery_expected);
$fields['total_te'] = (float)$this->total_te;
$fields['total_with_discount_te'] = (float)$this->total_with_discount_te;
$fields['total_ti'] = (float)$this->total_ti;
$fields['total_tax'] = (float)$this->total_tax;
$fields['discount_rate'] = (float)$this->discount_rate;
$fields['discount_value_te'] = (float)$this->discount_value_te;
$fields['is_template'] = (int)(bool)$this->is_template;
return $fields;
}
/**
* @see ObjectModel::update()
*/