Skip to content

Latest commit

 

History

History
1600 lines (775 loc) · 33.4 KB

class.StockMvtWSCore.md

File metadata and controls

1600 lines (775 loc) · 33.4 KB

Class StockMvtWSCore

Webservice entity for stock movements

Contents

Constants

Properties

Methods

Constants

HAS_MANY

const HAS_MANY = 2

HAS_ONE

const HAS_ONE = 1

List of association types

TYPE_BOOL

const TYPE_BOOL = 2

TYPE_DATE

const TYPE_DATE = 5

TYPE_FLOAT

const TYPE_FLOAT = 4

TYPE_HTML

const TYPE_HTML = 6

TYPE_INT

const TYPE_INT = 1

List of field types

TYPE_NOTHING

const TYPE_NOTHING = 7

TYPE_STRING

const TYPE_STRING = 3

Properties

$current_wa

public float $current_wa = null

$date_add

public string $date_add

$def

protected array $def

$definition

public array $definition = array()

$ean13

public string $ean13

$employee_firstname

public string $employee_firstname

$employee_lastname

public string $employee_lastname

$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

private mixed $get_shop_from_context = true

$id

public integer $id

$id_currency

public integer $id_currency

$id_employee

public integer $id_employee

$id_lang

protected integer $id_lang = null

$id_order

public integer $id_order = null

$id_product

public integer $id_product

$id_product_attribute

public integer $id_product_attribute

$id_shop

protected mixed $id_shop = null

$id_stock

public integer $id_stock

$id_stock_mvt_reason

public integer $id_stock_mvt_reason

$id_supply_order

public integer $id_supply_order = null

$id_warehouse

public integer $id_warehouse

$identifier

protected mixed $identifier

$image_dir

protected string $image_dir = null

$image_format

protected string $image_format = 'jpg'

$last_wa

public float $last_wa = null

$management_type

public string $management_type

$physical_quantity

public integer $physical_quantity

$price_te

public float $price_te

$product_name

public mixed $product_name

$reference

public string $reference

$referer

public integer $referer

$sign

public integer $sign

$table

protected mixed $table

$tables

protected mixed $tables = array()

$tables_assoc

protected Array $tables_assoc = array('id_product' => array('table' => 's'), 'id_product_attribute' => array('table' => 's'), 'id_warehouse' => array('table' => 's'), 'id_currency' => array('table' => 's'), 'management_type' => array('table' => 'w'), 'ean13' => array('table' => 's'), 'upc' => array('table' => 's'), 'reference' => array('table' => 's'))

Associations tables for attributes that require different tables than stated in ObjectModel::definition

$upc

public string $upc

$webserviceParameters

protected array $webserviceParameters = array()

Methods

__construct

mixed StockMvtWSCore::__construct(integer $id, integer $id_lang, integer $id_shop)

Build object

Arguments

  • $id integer - Existing object id in order to load object (optional)
  • $id_lang integer - Required if object is multilingual (optional)
  • $id_shop integer - ID shop for objects with multishop on langs

add

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

Add current object to database

Arguments

  • $autodate boolean
  • $null_values boolean

addFieldsRequiredDatabase

mixed StockMvtWSCore::addFieldsRequiredDatabase($fields)

Arguments

  • $fields mixed

associateTo

boolean StockMvtWSCore::associateTo(integer|array $id_shops, string $type)

This function associate an item to its context

Arguments

  • $id_shops integer|array
  • $type string

clearCache

mixed StockMvtWSCore::clearCache($all)

Arguments

  • $all mixed

delete

boolean StockMvtWSCore::delete()

Delete current object from database

deleteImage

boolean StockMvtWSCore::deleteImage()

Delete images associated with the object

deleteSelection

boolean StockMvtWSCore::deleteSelection(array $selection)

Delete several objects from database

Arguments

  • $selection array

displayFieldName

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

Arguments

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

duplicateShops

mixed StockMvtWSCore::duplicateShops($id)

Arguments

  • $id mixed

existsInDatabase

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

Specify if an ObjectModel is already in database

Arguments

  • $id_entity integer
  • $table string

formatFields

array StockMvtWSCore::formatFields(integer $id_lang)

Arguments

  • $id_lang integer - If this parameter is given, only take lang fields

formatValue

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

Format a data

Arguments

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

getDefinition

array StockMvtWSCore::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

getFieldByLang

mixed StockMvtWSCore::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 StockMvtWSCore::getFields()

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

..)

getFieldsLang

array StockMvtWSCore::getFieldsLang()

Prepare multilang fields

getFieldsRequiredDatabase

mixed StockMvtWSCore::getFieldsRequiredDatabase($all)

Arguments

  • $all mixed

getTranslationsFields

mixed StockMvtWSCore::getTranslationsFields($fields_array)

Arguments

  • $fields_array mixed

getValidationRules

array StockMvtWSCore::getValidationRules(string $class)

Returns object validation rules (fields validity)

Arguments

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

getWSProductName

mixed StockMvtWSCore::getWSProductName()

Webservice : getter for the product name

getWebserviceObjectList

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

Arguments

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

getWebserviceParameters

mixed StockMvtWSCore::getWebserviceParameters($ws_params_attribute_name)

Arguments

  • $ws_params_attribute_name mixed

hydrate

mixed StockMvtWSCore::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 StockMvtWSCore::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

isAssociatedToGroupShop

boolean StockMvtWSCore::isAssociatedToGroupShop(integer $id_group_shop)

Check if current object is associated to a group shop

Arguments

  • $id_group_shop integer

isAssociatedToShop

boolean StockMvtWSCore::isAssociatedToShop(integer $id_shop)

Check if current object is associated to a shop

Arguments

  • $id_shop integer

isCurrentlyUsed

boolean StockMvtWSCore::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 StockMvtWSCore::isLangMultishop()

makeTranslationFields

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

Arguments

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

save

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

Save current object to database (add or update)

Arguments

  • $null_values boolean
  • $autodate boolean

setDefinitionRetrocompatibility

mixed StockMvtWSCore::setDefinitionRetrocompatibility()

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

toggleStatus

boolean StockMvtWSCore::toggleStatus()

Toggle object status in database

update

boolean StockMvtWSCore::update(boolean $null_values)

Update current object to database

Arguments

  • $null_values boolean

validateControler

mixed StockMvtWSCore::validateControler($htmlentities)

TODO: refactor rename all calls to this to validateController

Arguments

  • $htmlentities mixed

validateController

mixed StockMvtWSCore::validateController($htmlentities)

Arguments

  • $htmlentities mixed

validateField

boolean|string StockMvtWSCore::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 StockMvtWSCore::validateFields(boolean $die, boolean $error_return)

Check for fields validity before database interaction

Arguments

  • $die boolean
  • $error_return boolean

validateFieldsLang

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

Check for multilingual fields validity before database interaction

Arguments

  • $die boolean
  • $error_return boolean