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 =
'')
72 $moreCss = $this->
getInputCss($fieldInfos, $moreCss);
73 $autoFocus = $fieldInfos->inputAutofocus ?
' autofocus' :
'';
75 $htmlName = $keyPrefix . $key . $keySuffix;
77 return self::$form->inputType(
'text', $htmlName, (
string) $value, $htmlName, $moreCss, $moreAttrib . $autoFocus);
92 public function printOutputField($fieldInfos, $key, $value, $keyPrefix =
'', $keySuffix =
'', $moreCss =
'', $moreAttrib =
'')
106 public function getInputCss($fieldInfos, $moreCss =
'', $defaultCss =
'')
108 return parent::getInputCss($fieldInfos, $moreCss, $defaultCss ? $defaultCss :
'maxwidth75');
122 $result = parent::verifyFieldValue($fieldInfos, $key, $value);
123 if ($result && !$this->
isEmptyValue($fieldInfos, $value)) {
124 if (!self::$validator->isNumeric($value)) {
146 $htmlName = $keyPrefix . $key . $keySuffix;
147 $value =
GETPOST($htmlName,
'restricthtml');
148 $value = str_replace(
',',
'.', $value);
164 public function getPostFieldValue($fieldInfos, $key, $defaultValue =
null, $keyPrefix =
'', $keySuffix =
'')
166 $htmlName = $keyPrefix . $key . $keySuffix;
168 if (GETPOSTISSET($htmlName)) {
171 $value = $defaultValue;
190 $htmlName = $keyPrefix . $key . $keySuffix;
192 if (GETPOSTISSET($htmlName)) {
193 $value =
GETPOST($htmlName,
'alpha');
195 $value = $defaultValue;
213 $alias = $fieldInfos->sqlAlias ??
't.';
215 return natural_search($alias . ($fieldInfos->nameInTable ?? $key), $value, 1);
isEmptyValue($fieldInfos, $value, $emptyValues=null)
Check if the value is deemed as empty.
printOutputField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to show a field into a page.
printInputField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to put an input field into a page.
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.
getInputCss($fieldInfos, $moreCss='', $defaultCss='')
Get input CSS.
verifyPostFieldValue($fieldInfos, $key, $keyPrefix='', $keySuffix='')
Verify if the field value from GET/POST is valid.
getPostSearchFieldValue($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='')
Get search field value from GET/POST.
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.