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 $moreAttrib = trim((
string) $moreAttrib);
74 if (empty($moreAttrib)) $moreAttrib =
' ' . $moreAttrib;
75 $autoFocus = $fieldInfos->inputAutofocus ?
' autofocus' :
'';
76 $htmlName = $keyPrefix . $key . $keySuffix;
78 return self::$form->inputType(
'text', $htmlName, (
string) $value, $htmlName, $moreCss, $moreAttrib . $autoFocus);
93 public function printOutputField($fieldInfos, $key, $value, $keyPrefix =
'', $keySuffix =
'', $moreCss =
'', $moreAttrib =
'')
107 public function getInputCss($fieldInfos, $moreCss =
'', $defaultCss =
'')
109 return parent::getInputCss($fieldInfos, $moreCss, $defaultCss);
125 $result = parent::verifyFieldValue($fieldInfos, $key, $value);
126 if ($result && !$this->
isEmptyValue($fieldInfos, $value)) {
128 if (!filter_var($value, FILTER_VALIDATE_IP)) {
129 self::$validator->error = $langs->trans(
'RequireValidValue');
151 return parent::verifyPostFieldValue($fieldInfos, $key, $keyPrefix, $keySuffix);
165 public function getPostFieldValue($fieldInfos, $key, $defaultValue =
null, $keyPrefix =
'', $keySuffix =
'')
167 $htmlName = $keyPrefix . $key . $keySuffix;
169 if (GETPOSTISSET($htmlName)) {
170 $value =
GETPOST($htmlName,
'alphanohtml');
172 $value = $defaultValue;
192 $htmlName = $keyPrefix . $key . $keySuffix;
194 if (GETPOSTISSET($htmlName)) {
195 $value =
GETPOST($htmlName,
'alpha');
197 $value = $defaultValue;
215 $alias = $fieldInfos->sqlAlias ??
't.';
217 return natural_search($alias . ($fieldInfos->nameInTable ?? $key), $value, 0);
isEmptyValue($fieldInfos, $value, $emptyValues=null)
Check if the value is deemed as empty.
getPostSearchFieldValue($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='')
Get search field value from GET/POST.
printOutputField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to show a field into a page.
sqlFilterSearchField($fieldInfos, $key, $value)
Get sql filter for search field.
getInputCss($fieldInfos, $moreCss='', $defaultCss='')
Get input CSS.
verifyPostFieldValue($fieldInfos, $key, $keyPrefix='', $keySuffix='')
Verify if the field value from GET/POST is valid.
getPostFieldValue($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='')
Get field value from GET/POST.
printInputSearchField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to put an input search field into a page.
verifyFieldValue($fieldInfos, $key, $value)
Verify if the field value is valid.
printInputField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to put an input field into a page.
dol_print_ip($ip, $mode=0, $showname=0)
Return an IP formatted to be shown on screen.
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.