Skip to content

Latest commit

 

History

History
2416 lines (1208 loc) · 58.4 KB

class.OrderDetailCore.md

File metadata and controls

2416 lines (1208 loc) · 58.4 KB

Class OrderDetailCore

Contents

Properties

Methods

Properties

$context

protected \Context $context = null

$customer

protected \Customer $customer = null

$definition

public mixed $definition = array('table' => 'order_detail', 'primary' => 'id_order_detail', 'fields' => array('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), 'id_shop' => 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'), 'reduction_amount_tax_incl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'reduction_amount_tax_excl' => 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'), 'tax_computation_method' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), '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'), 'purchase_supplier_price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice'), 'original_product_price' => array('type' => self::TYPE_FLOAT, 'validate' => 'isPrice')))

$discount_quantity_applied

public integer $discount_quantity_applied

$download_deadline

public \date $download_deadline

$download_hash

public string $download_hash

$download_nb

public integer $download_nb

$ecotax

public float $ecotax

$ecotax_tax_rate

public float $ecotax_tax_rate

$group_reduction

public float $group_reduction

$id_order

public integer $id_order

$id_order_detail

public integer $id_order_detail

$id_order_invoice

public integer $id_order_invoice

$id_shop

public integer $id_shop

$id_warehouse

public integer $id_warehouse

$original_product_price

public float $original_product_price

$outOfStock

protected boolean $outOfStock = false

$product_attribute_id

public integer $product_attribute_id

$product_ean13

public string $product_ean13

$product_id

public integer $product_id

$product_name

public string $product_name

$product_price

public float $product_price

$product_quantity

public integer $product_quantity

$product_quantity_discount

public float $product_quantity_discount

$product_quantity_in_stock

public integer $product_quantity_in_stock

$product_quantity_refunded

public integer $product_quantity_refunded

$product_quantity_reinjected

public integer $product_quantity_reinjected

$product_quantity_return

public integer $product_quantity_return

$product_reference

public string $product_reference

$product_supplier_reference

public string $product_supplier_reference

$product_upc

public string $product_upc

$product_weight

public float $product_weight

$purchase_supplier_price

public float $purchase_supplier_price

$reduction_amount

public float $reduction_amount

$reduction_amount_tax_excl

public float $reduction_amount_tax_excl

$reduction_amount_tax_incl

public float $reduction_amount_tax_incl

$reduction_percent

public float $reduction_percent

$specificPrice

protected \Address $specificPrice = null

$tax_calculator

protected \TaxCalculator $tax_calculator = null

$tax_computation_method

public float $tax_computation_method

$tax_name

public string $tax_name

$tax_rate

public float $tax_rate

$total_price_tax_excl

public float $total_price_tax_excl

$total_price_tax_incl

public float $total_price_tax_incl

$total_shipping_price_tax_excl

public float $total_shipping_price_tax_excl

$total_shipping_price_tax_incl

public float $total_shipping_price_tax_incl

$unit_price_tax_excl

public float $unit_price_tax_excl

$unit_price_tax_incl

public float $unit_price_tax_incl

$vat_address

protected \Address $vat_address = null

$webserviceParameters

protected mixed $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()), 'hidden_fields' => array('tax_rate', 'tax_name'), 'associations' => array('taxes' => array('resource' => 'tax', 'getter' => 'getWsTaxes', 'setter' => false, 'fields' => array('id' => array()))))

$db

protected \Db $db = false

$def

protected array $def

$fieldsRequired

protected mixed $fieldsRequired = array()

$fieldsRequiredDatabase

protected mixed $fieldsRequiredDatabase = null

$fieldsRequiredLang

protected mixed $fieldsRequiredLang = array()

$fieldsSize

protected mixed $fieldsSize = array()

$fieldsSizeLang

protected mixed $fieldsSizeLang = array()

$fieldsValidate

protected mixed $fieldsValidate = array()

$fieldsValidateLang

protected mixed $fieldsValidateLang = array()

$get_shop_from_context

protected mixed $get_shop_from_context = true

$id

public integer $id

$id_lang

protected integer $id_lang = null

$id_shop_list

public mixed $id_shop_list = null

$identifier

protected mixed $identifier

$image_dir

protected string $image_dir = null

$image_format

protected string $image_format = 'jpg'

$table

protected mixed $table

$tables

protected mixed $tables = array()

$update_fields

protected array $update_fields = null

Methods

__construct

mixed OrderDetailCore::__construct($id, $id_lang, $context)

Arguments

  • $id mixed
  • $id_lang mixed
  • $context mixed

add

boolean ObjectModelCore::add(boolean $autodate, boolean $null_values)

Add current object to database

Arguments

  • $autodate boolean
  • $null_values boolean

addFieldsRequiredDatabase

mixed ObjectModelCore::addFieldsRequiredDatabase($fields)

Arguments

  • $fields mixed

associateTo

boolean ObjectModelCore::associateTo(integer|array $id_shops)

This function associate an item to its context

Arguments

  • $id_shops integer|array

checkProductStock

mixed OrderDetailCore::checkProductStock(array $product, integer $id_order_state)

Check the order state

Arguments

  • $product array
  • $id_order_state integer

clearCache

mixed ObjectModelCore::clearCache($all)

Arguments

  • $all mixed

create

mixed OrderDetailCore::create(object $order, object $cart, array $product, $id_order_state, integer $id_order_invoice, boolean $use_taxes, $id_warehouse)

Create an order detail liable to an id_order

Arguments

  • $order object
  • $cart object
  • $product array
  • $id_order_state mixed
  • $id_order_invoice integer
  • $use_taxes boolean - set to false if you don't want to use taxes
  • $id_warehouse mixed

createList

mixed OrderDetailCore::createList(object $order, object $cart, $id_order_state, $product_list, integer $id_order_invoice, boolean $use_taxes, $id_warehouse)

Create a list of order detail for a specified id_order using cart

Arguments

  • $order object
  • $cart object
  • $id_order_state mixed
  • $product_list mixed
  • $id_order_invoice integer
  • $use_taxes boolean - set to false if you don't want to use taxes
  • $id_warehouse mixed

delete

mixed OrderDetailCore::delete()

deleteImage

boolean ObjectModelCore::deleteImage($force_delete)

Delete images associated with the object

Arguments

  • $force_delete mixed

deleteSelection

boolean ObjectModelCore::deleteSelection(array $selection)

Delete several objects from database

Arguments

  • $selection array

displayFieldName

mixed ObjectModelCore::displayFieldName($field, $class, $htmlentities, \Context $context)

Arguments

  • $field mixed
  • $class mixed
  • $htmlentities mixed
  • $context Context

duplicateObject

\new ObjectModelCore::duplicateObject()

Duplicate current object to database

duplicateShops

mixed ObjectModelCore::duplicateShops($id)

Arguments

  • $id mixed

existsInDatabase

boolean ObjectModelCore::existsInDatabase(integer $id_entity, string $table)

Specify if an ObjectModel is already in database

Arguments

  • $id_entity integer
  • $table string

formatFields

array ObjectModelCore::formatFields(integer $type, integer $id_lang)

Arguments

  • $type integer - FORMAT_COMMON or FORMAT_LANG or FORMAT_SHOP
  • $id_lang integer - If this parameter is given, only take lang fields

formatValue

mixed ObjectModelCore::formatValue(mixed $value, integer $type, $with_quotes)

Format a data

Arguments

  • $value mixed
  • $type integer
  • $with_quotes mixed

getAssociatedShops

array ObjectModelCore::getAssociatedShops()

Get the list of associated id_shop

getDefinition

array ObjectModelCore::getDefinition(string $class, string $field)

Get object definition

Arguments

  • $class string - Name of object
  • $field string - Name of field if we want the definition of one field only

getDownloadFromHash

mixed OrderDetailCore::getDownloadFromHash($hash)

Arguments

  • $hash mixed

getFieldByLang

mixed ObjectModelCore::getFieldByLang($field_name, null $id_lang)

Return the field value for the specified language if the field is multilang, else the field value.

Arguments

  • $field_name mixed
  • $id_lang null

getFields

array ObjectModelCore::getFields()

Prepare fields for ObjectModel class (add, update) All fields are verified (pSQL, intval.

..)

getFieldsLang

array ObjectModelCore::getFieldsLang()

Prepare multilang fields

getFieldsRequiredDatabase

mixed ObjectModelCore::getFieldsRequiredDatabase($all)

Arguments

  • $all mixed

getFieldsShop

array ObjectModelCore::getFieldsShop()

Prepare fields for multishop Fields are not validated here, we considere they are already validated in getFields() method, this not the best solution but this is the only one possible for retro compatibility.

getList

array OrderDetailCore::getList(integer $id_order)

Get a detailed order list of an id_order

Arguments

  • $id_order integer

getStockState

array OrderDetailCore::getStockState()

Get the state of the current stock product

getTaxCalculator

\TaxCalculator OrderDetailCore::getTaxCalculator()

Returns the tax calculator associated to this order detail.

getTaxCalculatorStatic

\TaxCalculator OrderDetailCore::getTaxCalculatorStatic(integer $id_order_detail)

Return the tax calculator associated to this order_detail

Arguments

  • $id_order_detail integer

getTranslationsFields

mixed ObjectModelCore::getTranslationsFields($fields_array)

Arguments

  • $fields_array mixed

getValidationRules

array ObjectModelCore::getValidationRules(string $class)

Returns object validation rules (fields validity)

Arguments

  • $class string - Child class name for static use (optional)

getWebserviceObjectList

mixed ObjectModelCore::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)

Arguments

  • $sql_join mixed
  • $sql_filter mixed
  • $sql_sort mixed
  • $sql_limit mixed

getWebserviceParameters

mixed ObjectModelCore::getWebserviceParameters($ws_params_attribute_name)

Arguments

  • $ws_params_attribute_name mixed

getWsTaxes

mixed OrderDetailCore::getWsTaxes()

hasMultishopEntries

boolean ObjectModelCore::hasMultishopEntries()

Check if there is more than one entries in associated shop table for current entity

hydrate

mixed ObjectModelCore::hydrate(array $data, integer $id_lang)

Fill an object with given data. Data must be an array with this syntax: array(objProperty => value, objProperty2 => value, etc.)

Arguments

  • $data array
  • $id_lang integer

hydrateCollection

array ObjectModelCore::hydrateCollection(string $class, array $datas, integer $id_lang)

Fill (hydrate) a list of objects in order to get a collection of these objects

Arguments

  • $class string - Class of objects to hydrate
  • $datas array - List of data (multi-dimensional array)
  • $id_lang integer

incrementDownload

mixed OrderDetailCore::incrementDownload($id_order_detail, $increment)

Arguments

  • $id_order_detail mixed
  • $increment mixed

isAssociatedToShop

boolean ObjectModelCore::isAssociatedToShop(integer $id_shop)

Check if current object is associated to a shop

Arguments

  • $id_shop integer

isCurrentlyUsed

boolean ObjectModelCore::isCurrentlyUsed(string $table, boolean $has_active_column)

This method is allow to know if a entity is currently used

Arguments

  • $table string - name of table linked to entity
  • $has_active_column boolean - true if the table has an active column

isLangMultishop

mixed ObjectModelCore::isLangMultishop()

isMultishop

mixed ObjectModelCore::isMultishop()

makeTranslationFields

mixed ObjectModelCore::makeTranslationFields($fields, $fields_array, $id_language)

Arguments

  • $fields mixed
  • $fields_array mixed
  • $id_language mixed

save

boolean ObjectModelCore::save(boolean $null_values, boolean $autodate)

Save current object to database (add or update)

Arguments

  • $null_values boolean
  • $autodate boolean

saveTaxCalculator

boolean OrderDetailCore::saveTaxCalculator(\Order $order, $replace)

Save the tax calculator

Arguments

  • $order Order
  • $replace mixed

setContext

mixed OrderDetailCore::setContext($id_shop)

Arguments

  • $id_shop mixed

setDefinitionRetrocompatibility

mixed ObjectModelCore::setDefinitionRetrocompatibility()

Retrocompatibility for classes without $definition static Remove this in 1.6 !

setDetailProductPrice

mixed OrderDetailCore::setDetailProductPrice(object $order, object $cart, array $product)

Set detailed product price to the order detail

Arguments

  • $order object
  • $cart object
  • $product array

setFieldsToUpdate

mixed ObjectModelCore::setFieldsToUpdate(array $fields)

Set a list of specific fields to update array(field1 => true, field2 => false, langfield1 => array(1 => true, 2 => false))

Arguments

  • $fields array

setProductTax

mixed OrderDetailCore::setProductTax(object $order, array $product)

Apply tax to the product

Arguments

  • $order object
  • $product array

setShippingCost

mixed OrderDetailCore::setShippingCost(\Order $order, $product)

Set the additional shipping information

Arguments

  • $order Order
  • $product mixed

setSpecificPrice

mixed OrderDetailCore::setSpecificPrice(object $order, $product)

Set specific price of the product

Arguments

  • $order object
  • $product mixed

setVirtualProductInformation

mixed OrderDetailCore::setVirtualProductInformation($product)

Arguments

  • $product mixed

toggleStatus

boolean ObjectModelCore::toggleStatus()

Toggle object status in database

update

boolean ObjectModelCore::update(boolean $null_values)

Update current object to database

Arguments

  • $null_values boolean

updateMultishopTable

boolean ObjectModelCore::updateMultishopTable(string $classname, array $data, string $where, string $specific_where)

Update a table and splits the common datas and the shop datas

Arguments

  • $classname string
  • $data array
  • $where string
  • $specific_where string - Only executed for common table

updateTaxAmount

mixed OrderDetailCore::updateTaxAmount($order)

Arguments

  • $order mixed

validateControler

mixed ObjectModelCore::validateControler($htmlentities)

TODO: refactor rename all calls to this to validateController

Arguments

  • $htmlentities mixed

validateController

mixed ObjectModelCore::validateController($htmlentities)

Arguments

  • $htmlentities mixed

validateField

boolean|string ObjectModelCore::validateField(string $field, mixed $value, integer $id_lang)

Validate a single field

Arguments

  • $field string - Field name
  • $value mixed - Field value
  • $id_lang integer

validateFields

boolean|string ObjectModelCore::validateFields(boolean $die, boolean $error_return)

Check for fields validity before database interaction

Arguments

  • $die boolean
  • $error_return boolean

validateFieldsLang

boolean|string ObjectModelCore::validateFieldsLang(boolean $die, boolean $error_return)

Check for multilingual fields validity before database interaction

Arguments

  • $die boolean
  • $error_return boolean

validateFieldsRequiredDatabase

mixed ObjectModelCore::validateFieldsRequiredDatabase($htmlentities)

Arguments

  • $htmlentities mixed