24require_once DOL_DOCUMENT_ROOT .
'/core/class/fields/commonfield.class.php';
35 public $emptyValues = array(
'');
50 public function printInputSearchField($fieldInfos, $key, $value, $keyPrefix =
'', $keySuffix =
'', $moreCss =
'', $moreAttrib =
'')
52 $moreCss = $this->
getInputCss($fieldInfos, $moreCss);
53 $htmlName = $keyPrefix . $key . $keySuffix;
55 return self::$form->inputType(
'text', $htmlName, (
string) $value, $htmlName, $moreCss, $moreAttrib);
70 public function printInputField($fieldInfos, $key, $value, $keyPrefix =
'', $keySuffix =
'', $moreCss =
'', $moreAttrib =
'')
74 $moreCss = $this->
getInputCss($fieldInfos, $moreCss);
75 $autoFocus = $fieldInfos->inputAutofocus ?
' autofocus' :
'';
77 $htmlName = $keyPrefix . $key . $keySuffix;
79 return self::$form->inputType(
'text', $htmlName, (
string) $value, $htmlName, $moreCss, $moreAttrib . $autoFocus) . $langs->getCurrencySymbol($conf->currency);
94 public function printOutputField($fieldInfos, $key, $value, $keyPrefix =
'', $keySuffix =
'', $moreCss =
'', $moreAttrib =
'')
98 return !$this->
isEmptyValue($fieldInfos, $value) ?
price((
double) $value, 0, $langs, 0, 0, -1, $conf->currency) :
'';
110 public function getInputCss($fieldInfos, $moreCss =
'', $defaultCss =
'')
112 return parent::getInputCss($fieldInfos, $moreCss, $defaultCss ? $defaultCss :
'maxwidth75');
126 $result = parent::verifyFieldValue($fieldInfos, $key, $value);
127 if ($result && !$this->
isEmptyValue($fieldInfos, $value)) {
128 if (!self::$validator->isNumeric($value)) {
150 $htmlName = $keyPrefix . $key . $keySuffix;
151 $value =
GETPOST($htmlName,
'restricthtml');
152 $value = str_replace(
',',
'.', $value);
168 public function getPostFieldValue($fieldInfos, $key, $defaultValue =
null, $keyPrefix =
'', $keySuffix =
'')
170 $htmlName = $keyPrefix . $key . $keySuffix;
172 if (GETPOSTISSET($htmlName)) {
175 $value = $defaultValue;
194 $htmlName = $keyPrefix . $key . $keySuffix;
196 if (GETPOSTISSET($htmlName)) {
197 $value =
GETPOST($htmlName,
'alpha');
199 $value = $defaultValue;
217 $alias = $fieldInfos->sqlAlias ??
't.';
219 return natural_search($alias . ($fieldInfos->nameInTable ?? $key), $value, 1);
isEmptyValue($fieldInfos, $value, $emptyValues=null)
Check if the value is deemed as empty.
verifyPostFieldValue($fieldInfos, $key, $keyPrefix='', $keySuffix='')
Verify if the field value from GET/POST is valid.
printOutputField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to show a field into a page.
getPostSearchFieldValue($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='')
Get search field value from GET/POST.
verifyFieldValue($fieldInfos, $key, $value)
Verify if the field value is valid.
getPostFieldValue($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='')
Get field value from GET/POST.
sqlFilterSearchField($fieldInfos, $key, $value)
Get sql filter for search field.
printInputSearchField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to put an input search field into a page.
printInputField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to put an input field into a page.
getInputCss($fieldInfos, $moreCss='', $defaultCss='')
Get input CSS.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.