// 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
+65 -101
View File
@@ -142,13 +142,61 @@ class OrderCore extends ObjectModel
/** @var string Object last modification date */
public $date_upd;
/** @var string Order reference
* This reference is not unique, but unique for a payment
/**
* @var string Order reference, this reference is not unique, but unique for a payment
*/
public $reference;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'orders',
'primary' => 'id_order',
'fields' => array(
'id_address_delivery' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_address_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_group_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_carrier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'secure_key' => array('type' => self::TYPE_STRING, 'validate' => 'isMd5'),
'payment' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
'module' => array('type' => self::TYPE_STRING),
'recyclable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'gift' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'gift_message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage'),
'total_discounts' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_discounts_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_discounts_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_paid' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
'total_paid_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_paid_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_paid_real' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
'total_products' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
'total_products_wt' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
'total_shipping' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_shipping_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_shipping_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'carrier_tax_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'total_wrapping' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_wrapping_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_wrapping_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'shipping_number' => array('type' => self::TYPE_STRING, 'validate' => 'isUrl'),
'conversion_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
'invoice_number' => array('type' => self::TYPE_INT),
'delivery_number' => array('type' => self::TYPE_INT),
'invoice_date' => array('type' => self::TYPE_DATE),
'delivery_date' => array('type' => self::TYPE_DATE),
'valid' => array('type' => self::TYPE_BOOL),
'reference' => array('type' => self::TYPE_STRING),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),
);
protected $webserviceParameters = array(
'objectMethods' => array('add' => 'addWs'),
@@ -181,111 +229,15 @@ class OrderCore extends ObjectModel
'product_quantity' => array('required' => true),
'product_name' => array('setter' => false),
'product_price' => array('setter' => false),
)),
)),
),
);
/* MySQL does not allow 'order' for a table name */
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'orders',
'primary' => 'id_order',
'fields' => array(
'id_address_delivery' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_address_invoice' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_cart' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_currency' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_group_shop' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'id_shop' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'id_lang' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_customer' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_carrier' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'secure_key' => array('type' => 'FILL_ME', 'validate' => 'isMd5'),
'payment' => array('type' => 'FILL_ME', 'validate' => 'isGenericName', 'required' => true),
'recyclable' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'gift' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'gift_message' => array('type' => 'FILL_ME', 'validate' => 'isMessage'),
'total_discounts' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_discounts_tax_incl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_discounts_tax_excl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_paid' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true),
'total_paid_tax_incl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_paid_tax_excl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_paid_real' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true),
'total_products' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true),
'total_products_wt' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true),
'total_shipping' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_shipping_tax_incl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_shipping_tax_excl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'carrier_tax_rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'total_wrapping' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_wrapping_tax_incl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_wrapping_tax_excl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'shipping_number' => array('type' => 'FILL_ME', 'validate' => 'isUrl'),
'conversion_rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat', 'required' => true),
),
);
protected $_taxCalculationMethod = PS_TAX_EXC;
protected static $_historyCache = array();
public function getFields()
{
if (!$this->id_lang)
$this->id_lang = Configuration::get('PS_LANG_DEFAULT');
$this->validateFields();
$fields['id_group_shop'] = (int)$this->id_group_shop;
$fields['id_shop'] = (int)$this->id_shop;
$fields['id_address_delivery'] = (int)($this->id_address_delivery);
$fields['id_address_invoice'] = (int)($this->id_address_invoice);
$fields['id_cart'] = (int)$this->id_cart;
$fields['id_currency'] = (int)($this->id_currency);
$fields['id_lang'] = (int)($this->id_lang);
$fields['id_customer'] = (int)($this->id_customer);
$fields['id_carrier'] = (int)($this->id_carrier);
$fields['secure_key'] = pSQL($this->secure_key);
$fields['payment'] = pSQL($this->payment);
$fields['module'] = pSQL($this->module);
$fields['conversion_rate'] = (float)($this->conversion_rate);
$fields['recyclable'] = (int)($this->recyclable);
$fields['gift'] = (int)($this->gift);
$fields['gift_message'] = pSQL($this->gift_message);
$fields['shipping_number'] = pSQL($this->shipping_number);
$fields['total_discounts'] = (float)($this->total_discounts);
$fields['total_discounts_tax_incl'] = (float)($this->total_discounts_tax_incl);
$fields['total_discounts_tax_excl'] = (float)($this->total_discounts_tax_excl);
$fields['total_paid'] = (float)($this->total_paid);
$fields['total_paid_tax_incl'] = (float)($this->total_paid_tax_incl);
$fields['total_paid_tax_excl'] = (float)($this->total_paid_tax_excl);
$fields['total_paid_real'] = (float)($this->total_paid_real);
$fields['total_products'] = (float)($this->total_products);
$fields['total_products_wt'] = (float)($this->total_products_wt);
$fields['total_shipping'] = (float)($this->total_shipping);
$fields['total_shipping_tax_incl'] = (float)($this->total_shipping_tax_incl);
$fields['total_shipping_tax_excl'] = (float)($this->total_shipping_tax_excl);
$fields['carrier_tax_rate'] = (float)($this->carrier_tax_rate);
$fields['total_wrapping'] = (float)($this->total_wrapping);
$fields['total_wrapping_tax_incl'] = (float)($this->total_wrapping_tax_incl);
$fields['total_wrapping_tax_excl'] = (float)($this->total_wrapping_tax_excl);
$fields['invoice_number'] = (int)($this->invoice_number);
$fields['delivery_number'] = (int)($this->delivery_number);
$fields['invoice_date'] = pSQL($this->invoice_date);
$fields['delivery_date'] = pSQL($this->delivery_date);
$fields['valid'] = (int)($this->valid) ? 1 : 0;
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
$fields['reference'] = pSQL($this->reference);
return $fields;
}
public function __construct($id = NULL, $id_lang = NULL)
{
parent::__construct($id, $id_lang);
@@ -298,6 +250,18 @@ class OrderCore extends ObjectModel
$this->_taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
}
/**
* @see ObjectModel::getFields()
* @return array
*/
public function getFields()
{
if (!$this->id_lang)
$this->id_lang = Configuration::get('PS_LANG_DEFAULT');
return parent::getFields();
}
public function getTaxCalculationMethod()
{
return (int)($this->_taxCalculationMethod);
+9 -29
View File
@@ -55,9 +55,6 @@ class OrderCarrierCore extends ObjectModel
/** @var string Object creation date */
public $date_add;
/**
* @see ObjectModel::$definition
*/
@@ -65,38 +62,21 @@ class OrderCarrierCore extends ObjectModel
'table' => 'order_carrier',
'primary' => 'id_order_carrier',
'fields' => array(
'id_order_carrier' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'id_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_carrier' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_order_invoice' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'weight' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'shipping_cost_tax_excl' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'shipping_cost_tax_incl' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'tracking_number' => array('type' => 'FILL_ME', 'validate' => 'isAnything'),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_carrier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_order_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'weight' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'shipping_cost_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'shipping_cost_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'tracking_number' => array('type' => self::TYPE_FLOAT, 'validate' => 'isAnything'),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),
);
protected $webserviceParameters = array(
protected $webserviceParameters = array(
'fields' => array(
'id_order' => array('xlink_resource' => 'orders'),
'id_carrier' => array('xlink_resource' => 'carriers'),
),
);
public function getFields()
{
$this->validateFields();
$fields['id_order'] = (int)$this->id_order;
$fields['id_carrier'] = (int)$this->id_carrier;
$fields['id_order_invoice'] = (int)$this->id_order_invoice;
$fields['weight'] = (float)$this->weight;
$fields['shipping_cost_tax_excl'] = (float)$this->shipping_cost_tax_excl;
$fields['shipping_cost_tax_incl'] = (float)$this->shipping_cost_tax_incl;
$fields['tracking_number'] = pSQL(($this->tracking_number));
$fields['date_add'] = pSQL($this->date_add);
return $fields;
}
}
+4 -20
View File
@@ -42,10 +42,6 @@ class OrderCartRuleCore extends ObjectModel
/** @var integer */
public $value;
/* MySQL does not allow 'order detail' for a table name */
/**
* @see ObjectModel::$definition
*/
@@ -53,28 +49,16 @@ class OrderCartRuleCore extends ObjectModel
'table' => 'order_cart_rule',
'primary' => 'id_order_cart_rule',
'fields' => array(
'id_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'name' => array('type' => 'FILL_ME', 'validate' => 'isGenericName', 'required' => true),
'value' => array('type' => 'FILL_ME', 'validate' => 'isInt', 'required' => true),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
'value' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
),
);
protected $webserviceParameters = array(
protected $webserviceParameters = array(
'fields' => array(
'id_order' => array('xlink_resource' => 'orders'),
),
);
public function getFields()
{
$this->validateFields();
$fields['id_order'] = (int)($this->id_order);
$fields['name'] = pSQL($this->name);
$fields['value'] = (int)($this->value);
return $fields;
}
}
+43 -88
View File
@@ -129,10 +129,6 @@ class OrderDetailCore extends ObjectModel
/** @var int Id warehouse */
public $id_warehouse;
/**
* @see ObjectModel::$definition
*/
@@ -140,53 +136,52 @@ class OrderDetailCore extends ObjectModel
'table' => 'order_detail',
'primary' => 'id_order_detail',
'fields' => array(
'id_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_order_invoice' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'id_warehouse' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'product_id' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'product_attribute_id' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'product_name' => array('type' => 'FILL_ME', 'validate' => 'isGenericName', 'required' => true),
'product_quantity' => array('type' => 'FILL_ME', 'validate' => 'isInt', 'required' => true),
'product_quantity_in_stock' => array('type' => 'FILL_ME', 'validate' => 'isInt'),
'product_quantity_return' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedInt'),
'product_quantity_refunded' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedInt'),
'product_quantity_reinjected' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedInt'),
'product_price' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true),
'reduction_percent' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'reduction_amount' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'group_reduction' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'product_quantity_discount' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'product_ean13' => array('type' => 'FILL_ME', 'validate' => 'isEan13'),
'product_upc' => array('type' => 'FILL_ME', 'validate' => 'isUpc'),
'product_reference' => array('type' => 'FILL_ME', 'validate' => 'isReference'),
'product_supplier_reference' => array('type' => 'FILL_ME', 'validate' => 'isReference'),
'product_weight' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'tax_name' => array('type' => 'FILL_ME', 'validate' => 'isGenericName'),
'tax_rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'ecotax' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'ecotax_tax_rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'discount_quantity_applied' => array('type' => 'FILL_ME', 'validate' => 'isInt'),
'download_hash' => array('type' => 'FILL_ME', 'validate' => 'isGenericName'),
'download_nb' => array('type' => 'FILL_ME', 'validate' => 'isInt'),
'download_deadline' => array('type' => 'FILL_ME', 'validate' => 'isDateFormat'),
'unit_price_tax_incl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'unit_price_tax_excl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_price_tax_incl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'total_price_tax_excl' => array('type' => 'FILL_ME', 'validate' => 'isPrice'),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_order_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'product_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'product_attribute_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'product_name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true),
'product_quantity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'product_quantity_in_stock' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'product_quantity_return' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'product_quantity_refunded' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'product_quantity_reinjected' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'product_price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
'reduction_percent' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'reduction_amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'group_reduction' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'product_quantity_discount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'product_ean13' => array('type' => self::TYPE_STRING, 'validate' => 'isEan13'),
'product_upc' => array('type' => self::TYPE_STRING, 'validate' => 'isUpc'),
'product_reference' => array('type' => self::TYPE_STRING, 'validate' => 'isReference'),
'product_supplier_reference' => array('type' => self::TYPE_STRING, 'validate' => 'isReference'),
'product_weight' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'tax_name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
'tax_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'ecotax' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'ecotax_tax_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat'),
'discount_quantity_applied' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'download_hash' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
'download_nb' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'download_deadline' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat'),
'unit_price_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'unit_price_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_price_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
'total_price_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'),
),
);
protected $webserviceParameters = array(
'fields' => array (
'id_order' => array('xlink_resource' => 'orders'),
'product_id' => array('xlink_resource' => 'products'),
'product_attribute_id' => array('xlink_resource' => 'combinations'),
'product_quantity_reinjected' => array(),
'group_reduction' => array(),
'discount_quantity_applied' => array(),
'download_hash' => array(),
'download_deadline' => array()
protected $webserviceParameters = array(
'fields' => array (
'id_order' => array('xlink_resource' => 'orders'),
'product_id' => array('xlink_resource' => 'products'),
'product_attribute_id' => array('xlink_resource' => 'combinations'),
'product_quantity_reinjected' => array(),
'group_reduction' => array(),
'discount_quantity_applied' => array(),
'download_hash' => array(),
'download_deadline' => array()
)
);
@@ -217,46 +212,6 @@ class OrderDetailCore extends ObjectModel
return parent::__construct($id, $id_lang, $id_shop);
}
public function getFields()
{
$this->validateFields();
$fields['id_order'] = (int)$this->id_order;
$fields['id_order_invoice'] = (int)$this->id_order_invoice;
$fields['id_warehouse'] = pSQL($this->id_warehouse);
$fields['product_id'] = (int)$this->product_id;
$fields['product_attribute_id'] = (int)$this->product_attribute_id;
$fields['product_name'] = pSQL($this->product_name);
$fields['product_quantity'] = (int)$this->product_quantity;
$fields['product_quantity_in_stock'] = (int)$this->product_quantity_in_stock;
$fields['product_quantity_return'] = (int)$this->product_quantity_return;
$fields['product_quantity_refunded'] = (int)$this->product_quantity_refunded;
$fields['product_quantity_reinjected'] = (int)$this->product_quantity_reinjected;
$fields['product_price'] = (float)$this->product_price;
$fields['reduction_percent'] = (float)$this->reduction_percent;
$fields['reduction_amount'] = (float)$this->reduction_amount;
$fields['group_reduction'] = (float)$this->group_reduction;
$fields['product_quantity_discount'] = (float)$this->product_quantity_discount;
$fields['product_ean13'] = pSQL($this->product_ean13);
$fields['product_upc'] = pSQL($this->product_upc);
$fields['product_reference'] = pSQL($this->product_reference);
$fields['product_supplier_reference'] = pSQL($this->product_supplier_reference);
$fields['product_weight'] = (float)$this->product_weight;
$fields['tax_name'] = pSQL($this->tax_name);
$fields['tax_rate'] = (float)$this->tax_rate;
$fields['ecotax'] = (float)$this->ecotax;
$fields['ecotax_tax_rate'] = (float)$this->ecotax_tax_rate;
$fields['download_hash'] = pSQL($this->download_hash);
$fields['download_nb'] = (int)$this->download_nb;
$fields['download_deadline'] = pSQL($this->download_deadline);
$fields['unit_price_tax_incl'] = (float)$this->unit_price_tax_incl;
$fields['unit_price_tax_excl'] = (float)$this->unit_price_tax_excl;
$fields['total_price_tax_incl'] = (float)$this->total_price_tax_incl;
$fields['total_price_tax_excl'] = (float)$this->total_price_tax_excl;
return $fields;
}
public static function getDownloadFromHash($hash)
{
if ($hash == '') return false;
+3
View File
@@ -25,6 +25,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* @deprecated 1.5.0
*/
class OrderDiscountCore extends OrderCartRule
{
public function __get($key)
+4 -18
View File
@@ -42,9 +42,6 @@ class OrderHistoryCore extends ObjectModel
/** @var string Object last modification date */
public $date_upd;
/**
* @see ObjectModel::$definition
*/
@@ -52,9 +49,10 @@ class OrderHistoryCore extends ObjectModel
'table' => 'order_history',
'primary' => 'id_order_history',
'fields' => array(
'id_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_order_state' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_employee' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId'),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_order_state' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),
);
@@ -67,18 +65,6 @@ class OrderHistoryCore extends ObjectModel
),
);
public function getFields()
{
$this->validateFields();
$fields['id_order'] = (int)$this->id_order;
$fields['id_order_state'] = (int)$this->id_order_state;
$fields['id_employee'] = (int)$this->id_employee;
$fields['date_add'] = pSQL($this->date_add);
return $fields;
}
public function changeIdOrderState($new_order_state, $id_order, $id_warehouse = null)
{
if ($new_order_state != NULL)
+13 -27
View File
@@ -66,9 +66,6 @@ class OrderInvoiceCore extends ObjectModel
/** @var intger */
public $date_add;
/**
* @see ObjectModel::$definition
*/
@@ -76,33 +73,22 @@ class OrderInvoiceCore extends ObjectModel
'table' => 'order_invoice',
'primary' => 'id_order_invoice',
'fields' => array(
'id_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'number' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'number' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'total_discount_tax_excl' =>array('type' => self::TYPE_FLOAT),
'total_discount_tax_incl' =>array('type' => self::TYPE_FLOAT),
'total_paid_tax_excl' => array('type' => self::TYPE_FLOAT),
'total_paid_tax_incl' => array('type' => self::TYPE_FLOAT),
'total_products' => array('type' => self::TYPE_FLOAT),
'total_products_wt' => array('type' => self::TYPE_FLOAT),
'total_shipping_tax_excl' =>array('type' => self::TYPE_FLOAT),
'total_shipping_tax_incl' =>array('type' => self::TYPE_FLOAT),
'total_wrapping_tax_excl' =>array('type' => self::TYPE_FLOAT),
'total_wrapping_tax_incl' =>array('type' => self::TYPE_FLOAT),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),
);
public function getFields()
{
$this->validateFields();
$fields['id_order'] = (int)$this->id_order;
$fields['number'] = (int)$this->number;
$fields['total_discount_tax_excl'] = (float)$this->total_discount_tax_excl;
$fields['total_discount_tax_incl'] = (float)$this->total_discount_tax_incl;
$fields['total_paid_tax_excl'] = (float)$this->total_paid_tax_excl;
$fields['total_paid_tax_incl'] = (float)$this->total_paid_tax_incl;
$fields['total_products'] = (float)$this->total_products;
$fields['total_products_wt'] = (float)$this->total_products_wt;
$fields['total_shipping_tax_excl'] = (float)$this->total_shipping_tax_excl;
$fields['total_shipping_tax_incl'] = (float)$this->total_shipping_tax_incl;
$fields['total_wrapping_tax_excl'] = (float)$this->total_wrapping_tax_excl;
$fields['total_wrapping_tax_incl'] = (float)$this->total_wrapping_tax_incl;
$fields['date_add'] = pSQL($this->date_add);
return $fields;
}
public function getProductsDetail()
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
+5 -16
View File
@@ -36,14 +36,6 @@ class OrderMessageCore extends ObjectModel
/** @var string Object creation date */
public $date_add;
/**
* @see ObjectModel::$definition
*/
@@ -52,8 +44,11 @@ class OrderMessageCore extends ObjectModel
'primary' => 'id_order_message',
'multilang' => true,
'fields' => array(
'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
'message' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isMessage', 'required' => true, 'size' => 1200),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields
'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
'message' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isMessage', 'required' => true, 'size' => 1200),
),
);
@@ -65,12 +60,6 @@ class OrderMessageCore extends ObjectModel
)
);
public function getFields()
{
$this->validateFields();
return array('date_add' => pSQL($this->date_add));
}
public function getTranslationsFieldsChild()
{
$this->validateFieldsLang();
+11 -31
View File
@@ -39,10 +39,6 @@ class OrderPaymentCore extends ObjectModel
public $card_holder;
public $date_add;
/**
* @see ObjectModel::$definition
*/
@@ -50,36 +46,20 @@ class OrderPaymentCore extends ObjectModel
'table' => 'order_payment',
'primary' => 'id_order_payment',
'fields' => array(
'id_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_currency' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'amount' => array('type' => 'FILL_ME', 'validate' => 'isPrice', 'required' => true),
'payment_method' => array('type' => 'FILL_ME', 'validate' => 'isName'),
'conversion_rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat'),
'transaction_id' => array('type' => 'FILL_ME', 'validate' => 'isAnything', 'size' => 254),
'card_number' => array('type' => 'FILL_ME', 'validate' => 'isAnything', 'size' => 254),
'card_brand' => array('type' => 'FILL_ME', 'validate' => 'isAnything', 'size' => 254),
'card_expiration' => array('type' => 'FILL_ME', 'validate' => 'isAnything', 'size' => 254),
'card_holder' => array('type' => 'FILL_ME', 'validate' => 'isAnything', 'size' => 254),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'amount' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice', 'required' => true),
'payment_method' => array('type' => self::TYPE_STRING, 'validate' => 'isName'),
'conversion_rate' => array('type' => self::TYPE_INT, 'validate' => 'isFloat'),
'transaction_id' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
'card_number' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
'card_brand' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
'card_expiration' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
'card_holder' => array('type' => self::TYPE_STRING, 'validate' => 'isAnything', 'size' => 254),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),
);
public function getFields()
{
$this->validateFields();
$fields['id_order'] = (int)($this->id_order);
$fields['id_currency'] = (int)($this->id_currency);
$fields['amount'] = (float)($this->amount);
$fields['payment_method'] = pSQL($this->payment_method);
$fields['transaction_id'] = pSQL($this->transaction_id);
$fields['card_number'] = pSQL($this->card_number);
$fields['card_brand'] = pSQL($this->card_brand);
$fields['card_expiration'] = pSQL($this->card_expiration);
$fields['card_holder'] = pSQL($this->card_holder);
$fields['date_add'] = pSQL($this->date_add);
return $fields;
}
public function add($autodate = true, $nullValues = false)
{
if (parent::add($autodate, $nullValues))
+6 -21
View File
@@ -48,9 +48,6 @@ class OrderReturnCore extends ObjectModel
/** @var string Object last modification date */
public $date_upd;
/**
* @see ObjectModel::$definition
*/
@@ -58,27 +55,15 @@ class OrderReturnCore extends ObjectModel
'table' => 'order_return',
'primary' => 'id_order_return',
'fields' => array(
'id_customer' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'question' => array('type' => 'FILL_ME', 'validate' => 'isMessage'),
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'question' => array('type' => self::TYPE_HTML, 'validate' => 'isMessage'),
'state' => array('type' => self::TYPE_STRING),
'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_customer'] = pSQL($this->id_customer);
$fields['id_order'] = pSQL($this->id_order);
$fields['state'] = pSQL($this->state);
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
// we don't want to use nl2br now because <br> will not pass Validation::isMessage()
$fields['question'] = pSQL($this->question, true);
return $fields;
}
public function addReturnDetail($orderDetailList, $productQtyList, $customizationIds, $customizationQtyInput)
{
/* Classic product return */
+4 -15
View File
@@ -33,11 +33,6 @@ class OrderReturnStateCore extends ObjectModel
/** @var string Display state in the specified color */
public $color;
/**
* @see ObjectModel::$definition
*/
@@ -46,19 +41,13 @@ class OrderReturnStateCore extends ObjectModel
'primary' => 'id_order_return_state',
'multilang' => true,
'fields' => array(
'color' => array('type' => 'FILL_ME', 'validate' => 'isColor'),
'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
'color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor'),
// Lang fields
'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
),
);
public function getFields()
{
$this->validateFields();
$fields['color'] = pSQL($this->color);
return $fields;
}
/**
* Check then return multilingual fields for database interaction
*
+9 -23
View File
@@ -57,9 +57,6 @@ class OrderSlipCore extends ObjectModel
/** @var string Object last modification date */
public $date_upd;
/**
* @see ObjectModel::$definition
*/
@@ -67,29 +64,18 @@ class OrderSlipCore extends ObjectModel
'table' => 'order_slip',
'primary' => 'id_order_slip',
'fields' => array(
'id_customer' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'id_order' => array('type' => 'FILL_ME', 'validate' => 'isUnsignedId', 'required' => true),
'conversion_rate' => array('type' => 'FILL_ME', 'validate' => 'isFloat', 'required' => true),
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'conversion_rate' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
'amount' => array('type' => self::TYPE_INT),
'shipping_cost' => array('type' => self::TYPE_INT),
'shipping_cost_amount' => array('type' => self::TYPE_FLOAT),
'partial' => array('type' => self::TYPE_INT),
'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_customer'] = (int)($this->id_customer);
$fields['id_order'] = (int)($this->id_order);
$fields['conversion_rate'] = (float)($this->conversion_rate);
$fields['amount'] = (int)($this->amount);
$fields['shipping_cost'] = (int)($this->shipping_cost);
$fields['shipping_cost_amount'] = (float)($this->shipping_cost_amount);
$fields['partial'] = (int)($this->partial);
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
return $fields;
}
public function addSlipDetail($orderDetailList, $productQtyList)
{
foreach ($orderDetailList as $key => $orderDetail)
+12 -28
View File
@@ -56,12 +56,6 @@ class OrderStateCore extends ObjectModel
/** @var boolean Shipped */
public $shipped;
/**
* @see ObjectModel::$definition
*/
@@ -70,17 +64,21 @@ class OrderStateCore extends ObjectModel
'primary' => 'id_order_state',
'multilang' => true,
'fields' => array(
'send_email' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'invoice' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'color' => array('type' => 'FILL_ME', 'validate' => 'isColor'),
'logable' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'shipped' => array('type' => 'FILL_ME', 'validate' => 'isBool'),
'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
'template' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isTplName', 'size' => 64),
'send_email' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'invoice' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor'),
'logable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'shipped' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'unremovable' =>array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'delivery' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'hidden' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
// Lang fields
'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
'template' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isTplName', 'size' => 64),
),
);
protected $webserviceParameters = array(
'fields' => array(
'unremovable' => array(),
@@ -89,20 +87,6 @@ class OrderStateCore extends ObjectModel
),
);
public function getFields()
{
$this->validateFields();
$fields['send_email'] = (int)$this->send_email;
$fields['invoice'] = (int)$this->invoice;
$fields['color'] = pSQL($this->color);
$fields['unremovable'] = (int)$this->unremovable;
$fields['logable'] = (int)$this->logable;
$fields['delivery'] = (int)$this->delivery;
$fields['hidden'] = (int)$this->hidden;
$fields['shipped'] = (int)$this->shipped;
return $fields;
}
/**
* Check then return multilingual fields for database interaction
*