Documentation

Vtiger_Discount_InventoryField extends Vtiger_Basic_InventoryField
in package

Inventory Discount Field Class.

Tags
copyright

YetiForce S.A.

license

YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)

author

Mariusz Krzaczkowski m.krzaczkowski@yetiforce.com

author

Radosław Skrzypczak r.skrzypczak@yetiforce.com

Table of Contents

FIELD_HIDDEN  = 5
Field hidden.
FIELD_READONLY  = 10
Field read-only.
FIELD_VISIBLE_EVERYWHERE  = 0
Field visible everywhere.
FIELD_VISIBLE_IN_DETAIL  = 2
Field visible in detail view.
$blocks  : mixed
$colSpan  : mixed
$columnName  : mixed
$customColumn  : mixed
$customMaximumLength  : mixed
$customPurifyType  : mixed
$dbType  : mixed
$defaultLabel  : mixed
$defaultValue  : mixed
$displayType  : mixed
$displayTypeBase  : mixed
$fieldDataType  : mixed
$maximumLength  : mixed
$moduleName  : mixed
$onlyOne  : mixed
$params  : mixed
$purifyType  : mixed
$summationValue  : mixed
$type  : mixed
$value  : array<string|int, mixed>
__construct()  : mixed
Constructor.
displayTypeBase()  : array<string|int, mixed>
Getting all values display Type.
get()  : mixed
Function to get the value for a given key.
getArray()  : array<string|int, mixed>
Function to get the array values for a given key.
getBlocks()  : mixed
getColSpan()  : mixed
getColumnName()  : string
Getting column name.
getCustomColumn()  : array<string|int, string>
Getting column name.
getData()  : array<string|int, mixed>
Function to get all the values of the Object.
getDBType()  : string
Getting database-type of field.
getDBValue()  : mixed
Gets database value.
getDefaultLabel()  : string
Getting default label.
getDefaultValue()  : mixed
getDisplayType()  : int
Gets display type.
getDisplayValue()  : string
Getting value to display.
getEditTemplateName()  : string
Get template name for edit.
getEditValue()  : string
Getting value to display.
getFieldDataType()  : mixed
getFieldInfo()  : array<string|int, mixed>
Get information about field.
getForHtml()  : mixed
Function to get the html encoded value for a given key.
getForSql()  : mixed
Function to get the value if its safe to use for SQL Query (column).
getInstance()  : self
Gets inventory field instance.
getKeys()  : array<string|int, string>
Function to get keys.
getListViewDisplayValue()  : mixed
Function to get the list value in display view.
getMapDetail()  : bool|Vtiger_Field_Model
Gets relation field.
getModuleName()  : string
Function returns module name.
getParams()  : array<string|int, mixed>
Getting all params values.
getParamsConfig()  : mixed
getPurifyType()  : array<string|int, mixed>
Gets purify type.
getRangeValues()  : mixed
getSummaryValuesFromData()  : mixed
getTemplateName()  : string
Getting template name.
getType()  : string
Getting field type.
getValue()  : string
Getting value.
getValueForSave()  : mixed
Gets value for save.
has()  : bool
Function to check if the key exists.
isEditable()  : bool
Function to check whether the current field is editable.
isEmpty()  : bool
Function to check if the key is empty.
isMandatory()  : bool
Function to check if the current field is mandatory or not.
isOnlyOne()  : bool
Getting onlyOne field.
isReadOnly()  : bool
Function checks if the field is read-only.
isRequired()  : bool
Field required to make an entry.
isSummary()  : mixed
isVisible()  : bool
Function to check whether the current field is visible.
isVisibleInDetail()  : bool
Function to check if field is visible in detail view.
modulesValues()  : array<string|int, mixed>
Getting value to display.
remove()  : mixed
Function to remove the value.
set()  : $this
Function to set the value for a given key.
setData()  : $this
Function to set all the values.
setDefaultDataConfig()  : mixed
Sets default data config.
setModuleName()  : Vtiger_Basic_InventoryField
Sets module name.
setValueToRecord()  : mixed
Sets value data.
validate()  : mixed
Verification of data.
getDiscountValue()  : float
Calculate the discount value.
getDiscountValueByType()  : float
Gets the discount by type.

Constants

FIELD_HIDDEN

Field hidden.

private mixed FIELD_HIDDEN = 5

FIELD_READONLY

Field read-only.

private mixed FIELD_READONLY = 10

FIELD_VISIBLE_EVERYWHERE

Field visible everywhere.

private mixed FIELD_VISIBLE_EVERYWHERE = 0

FIELD_VISIBLE_IN_DETAIL

Field visible in detail view.

private mixed FIELD_VISIBLE_IN_DETAIL = 2

Properties

$blocks

protected mixed $blocks = [1]

$colSpan

protected mixed $colSpan = 10

$columnName

protected mixed $columnName = 'discount'

$customColumn

protected mixed $customColumn = ['discountparam' => 'string']

$customMaximumLength

protected mixed $customMaximumLength = ['discountparam' => 255]

$customPurifyType

protected mixed $customPurifyType = ['discountparam' => \App\Purifier::TEXT]

$dbType

protected mixed $dbType = 'decimal(28,8) DEFAULT 0'

$defaultLabel

protected mixed $defaultLabel = 'LBL_DISCOUNT'

$defaultValue

protected mixed $defaultValue = 0

$displayType

protected mixed $displayType = self::FIELD_VISIBLE_EVERYWHERE

$displayTypeBase

protected mixed $displayTypeBase = ['LBL_DISPLAYTYPE_ALL' => self::FIELD_VISIBLE_EVERYWHERE, 'LBL_DISPLAYTYPE_ONLY_DETAIL' => self::FIELD_VISIBLE_IN_DETAIL, 'LBL_DISPLAYTYPE_HIDDEN' => self::FIELD_HIDDEN, 'LBL_DISPLAYTYPE_READONLY' => self::FIELD_READONLY]

$fieldDataType

protected mixed $fieldDataType = 'inventory'

$maximumLength

protected mixed $maximumLength = '99999999999999999999'

$moduleName

protected mixed $moduleName = ''

$onlyOne

protected mixed $onlyOne = \true

$params

protected mixed $params = []

$purifyType

protected mixed $purifyType = \App\Purifier::NUMBER

$summationValue

protected mixed $summationValue = \true

$type

protected mixed $type = 'Discount'

$value

protected array<string|int, mixed> $value

Values

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $values = [] ]) : mixed
Parameters
$values : array<string|int, mixed> = []
Return values
mixed

displayTypeBase()

Getting all values display Type.

public displayTypeBase() : array<string|int, mixed>
Return values
array<string|int, mixed>

get()

Function to get the value for a given key.

public get(string $key) : mixed
Parameters
$key : string
Return values
mixed

Value for the given key

getArray()

Function to get the array values for a given key.

public getArray(string $key[, array<string|int, mixed> $value = [] ]) : array<string|int, mixed>
Parameters
$key : string
$value : array<string|int, mixed> = []
Return values
array<string|int, mixed>

getBlocks()

public getBlocks() : mixed
Return values
mixed

getColSpan()

public getColSpan() : mixed
Return values
mixed

getColumnName()

Getting column name.

public getColumnName() : string
Return values
string

columnName

getCustomColumn()

Getting column name.

public getCustomColumn() : array<string|int, string>
Return values
array<string|int, string>

customColumn

getData()

Function to get all the values of the Object.

public getData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDBType()

Getting database-type of field.

public getDBType() : string
Return values
string

dbType

getDBValue()

Gets database value.

public getDBValue(mixed $value[, string|null $name = '' ]) : mixed
Parameters
$value : mixed
$name : string|null = ''
Return values
mixed

getDefaultLabel()

Getting default label.

public getDefaultLabel() : string
Return values
string

defaultLabel

getDefaultValue()

public getDefaultValue() : mixed
Return values
mixed

getDisplayType()

Gets display type.

public getDisplayType() : int
Return values
int

getDisplayValue()

Getting value to display.

public getDisplayValue(mixed $value[, array<string|int, mixed> $rowData = [] ][, bool $rawText = false ]) : string
Parameters
$value : mixed
$rowData : array<string|int, mixed> = []
$rawText : bool = false
Return values
string

getEditTemplateName()

Get template name for edit.

public getEditTemplateName() : string
Return values
string

getEditValue()

Getting value to display.

public getEditValue(mixed $value) : string
Parameters
$value : mixed
Return values
string

getFieldDataType()

public getFieldDataType() : mixed
Return values
mixed

getFieldInfo()

Get information about field.

public getFieldInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

getForHtml()

Function to get the html encoded value for a given key.

public getForHtml(string $key) : mixed
Parameters
$key : string
Return values
mixed

getForSql()

Function to get the value if its safe to use for SQL Query (column).

public getForSql(string $key[, bool $skipEmtpy = true ]) : mixed
Parameters
$key : string
$skipEmtpy : bool = true

Skip the check if string is empty

Return values
mixed

Value for the given key

getInstance()

Gets inventory field instance.

public static getInstance(string $moduleName[, string|null $type = 'Basic' ]) : self
Parameters
$moduleName : string
$type : string|null = 'Basic'
Tags
throws
AppException
Return values
self

getKeys()

Function to get keys.

public getKeys() : array<string|int, string>
Return values
array<string|int, string>

getListViewDisplayValue()

Function to get the list value in display view.

public getListViewDisplayValue(mixed $value[, array<string|int, mixed> $rowData = [] ][, bool $rawText = false ]) : mixed
Parameters
$value : mixed
$rowData : array<string|int, mixed> = []
$rawText : bool = false
Return values
mixed

getMapDetail()

Gets relation field.

public getMapDetail(string $related) : bool|Vtiger_Field_Model
Parameters
$related : string
Tags
throws
AppException
Return values
bool|Vtiger_Field_Model

getModuleName()

Function returns module name.

public getModuleName() : string
Return values
string

getParams()

Getting all params values.

public getParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

getParamsConfig()

public getParamsConfig() : mixed
Return values
mixed

getPurifyType()

Gets purify type.

public getPurifyType() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRangeValues()

public getRangeValues() : mixed
Return values
mixed

getSummaryValuesFromData()

public getSummaryValuesFromData(mixed $data) : mixed
Parameters
$data : mixed
Return values
mixed

getTemplateName()

Getting template name.

public getTemplateName(mixed $view, mixed $moduleName) : string
Parameters
$view : mixed
$moduleName : mixed
Return values
string

templateName

getType()

Getting field type.

public getType() : string
Return values
string

getValue()

Getting value.

public getValue(type $value) : string
Parameters
$value : type
Return values
string

getValueForSave()

Gets value for save.

public getValueForSave(array<string|int, mixed> $item[, bool $userFormat = false ][, string $column = null ]) : mixed
Parameters
$item : array<string|int, mixed>
$userFormat : bool = false
$column : string = null
Return values
mixed

has()

Function to check if the key exists.

public has(string $key) : bool
Parameters
$key : string
Return values
bool

isEditable()

Function to check whether the current field is editable.

public isEditable() : bool
Return values
bool

isEmpty()

Function to check if the key is empty.

public isEmpty(string $key) : bool
Parameters
$key : string
Return values
bool

isMandatory()

Function to check if the current field is mandatory or not.

public isMandatory() : bool
Return values
bool

isOnlyOne()

Getting onlyOne field.

public isOnlyOne() : bool
Return values
bool

isReadOnly()

Function checks if the field is read-only.

public isReadOnly() : bool
Return values
bool

isRequired()

Field required to make an entry.

public isRequired() : bool
Return values
bool

isSummary()

public isSummary() : mixed
Return values
mixed

isVisible()

Function to check whether the current field is visible.

public isVisible() : bool
Return values
bool

isVisibleInDetail()

Function to check if field is visible in detail view.

public isVisibleInDetail() : bool
Return values
bool

modulesValues()

Getting value to display.

public modulesValues() : array<string|int, mixed>
Return values
array<string|int, mixed>

remove()

Function to remove the value.

public remove(string $key) : mixed
Parameters
$key : string
Return values
mixed

set()

Function to set the value for a given key.

public set(string $key, mixed $value) : $this
Parameters
$key : string
$value : mixed
Return values
$this

setData()

Function to set all the values.

public setData(mixed $values) : $this
Parameters
$values : mixed
Return values
$this

setDefaultDataConfig()

Sets default data config.

public setDefaultDataConfig() : mixed
Return values
mixed

setValueToRecord()

Sets value data.

public setValueToRecord(Vtiger_Record_Model $recordModel, array<string|int, mixed> $item, bool $userFormat) : mixed
Parameters
$recordModel : Vtiger_Record_Model
$item : array<string|int, mixed>
$userFormat : bool
Tags
throws
AppException
throws
Security
Return values
mixed

validate()

Verification of data.

public validate(mixed $value, string $columnName, bool $isUserFormat[, mixed $originalValue = null ]) : mixed
Parameters
$value : mixed
$columnName : string
$isUserFormat : bool
$originalValue : mixed = null
Return values
mixed

getDiscountValue()

Calculate the discount value.

private getDiscountValue(array<string|int, mixed> $discountParam, float $totalPrice, string $mode) : float
Parameters
$discountParam : array<string|int, mixed>
$totalPrice : float
$mode : string

0-can not be combined, 1-summary, 2-cascade

Return values
float

getDiscountValueByType()

Gets the discount by type.

private getDiscountValueByType(string $aggregationType, array<string|int, mixed> $discountParam, float $totalPrice) : float
Parameters
$aggregationType : string
$discountParam : array<string|int, mixed>
$totalPrice : float
Return values
float

        

Search results