PricecyField
class PricecyField extends CommonField (View source)
Class to pricecy field (price with currency)
Properties
| DoliDB | $db | from CommonField | |
| string | $error | from CommonField | |
| string[] | $errors | from CommonField | |
| string | $type | from CommonField | |
| string | $label | from CommonField | |
| static Form|null | $form | from CommonField | |
| static Validate|null | $validator | from CommonField | |
| array<int, mixed> | $emptyValues |
Methods
Check if the value is deemed as empty
Return HTML string to put an input search field into a page
Return HTML string to put an input field into a page
Return HTML string to show a field into a page
Get input CSS
Verify if the field value is valid
Verify if the field value from GET/POST is valid
Get field value from GET/POST
Get search field value from GET/POST
Get sql filter for search field
Get price and currency from value
Get alias and field name in table for price and currency
Details
__construct(DoliDB $db)
Constructor
static void
setForm(Form $form)
Set form used for print the field
static void
setValidator(Validate $validator)
Set validator used for check the field value
void
clearErrors()
clear errors
string
errorsToString(string $separator = ', ')
Method to output saved errors
bool
isEmptyValue(FieldInfos $fieldInfos, mixed $value, array<int, mixed> $emptyValues = null)
Check if the value is deemed as empty
string
printInputSearchField(FieldInfos $fieldInfos, string $key, mixed $value, string $keyPrefix = '', string $keySuffix = '', string $moreCss = '', string $moreAttrib = '')
Return HTML string to put an input search field into a page
string
printInputField(FieldInfos $fieldInfos, string $key, mixed $value, string $keyPrefix = '', string $keySuffix = '', string $moreCss = '', string $moreAttrib = '')
Return HTML string to put an input field into a page
string
printOutputField(FieldInfos $fieldInfos, string $key, mixed $value, string $keyPrefix = '', string $keySuffix = '', string $moreCss = '', string $moreAttrib = '')
Return HTML string to show a field into a page
getInputCss($fieldInfos, $moreCss = '', $defaultCss = '')
Get input CSS
bool
verifyFieldValue(FieldInfos $fieldInfos, string $key, mixed $value)
Verify if the field value is valid
bool
verifyPostFieldValue(FieldInfos $fieldInfos, string $key, string $keyPrefix = '', string $keySuffix = '')
Verify if the field value from GET/POST is valid
mixed
getPostFieldValue(FieldInfos $fieldInfos, string $key, mixed $defaultValue = null, string $keyPrefix = '', string $keySuffix = '')
Get field value from GET/POST
mixed
getPostSearchFieldValue(FieldInfos $fieldInfos, string $key, mixed $defaultValue = null, string $keyPrefix = '', string $keySuffix = '')
Get search field value from GET/POST
sqlFilterSearchField($fieldInfos, $key, $value)
Get sql filter for search field
array{price: float, currency: string}
getPriceAndCurrencyFromValue(FieldInfos $fieldInfos, string $value)
Get price and currency from value
array{aliasPrice: string, aliasCurrency: string, fieldPrice: string, fieldCurrency: string}
getPriceAndCurrencyAliasAndField(FieldInfos $fieldInfos, string $key)
Get alias and field name in table for price and currency