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);
123 $result = parent::verifyFieldValue($fieldInfos, $key, $value);
124 if ($result && !$this->
isEmptyValue($fieldInfos, $value)) {
125 if (!self::$validator->isUrl($value)) {
147 return parent::verifyPostFieldValue($fieldInfos, $key, $keyPrefix, $keySuffix);
161 public function getPostFieldValue($fieldInfos, $key, $defaultValue =
null, $keyPrefix =
'', $keySuffix =
'')
163 $htmlName = $keyPrefix . $key . $keySuffix;
165 if (GETPOSTISSET($htmlName)) {
166 $value =
GETPOST($htmlName,
'alphanohtml');
168 $value = $defaultValue;
187 $htmlName = $keyPrefix . $key . $keySuffix;
189 if (GETPOSTISSET($htmlName)) {
190 $value =
GETPOST($htmlName,
'alpha');
192 $value = $defaultValue;
210 $alias = $fieldInfos->sqlAlias ??
't.';
212 return natural_search($alias . ($fieldInfos->nameInTable ?? $key), $value, 0);
isEmptyValue($fieldInfos, $value, $emptyValues=null)
Check if the value is deemed as empty.
sqlFilterSearchField($fieldInfos, $key, $value)
Get sql filter for search field.
verifyFieldValue($fieldInfos, $key, $value)
Verify if the field value is valid.
getInputCss($fieldInfos, $moreCss='', $defaultCss='')
Get input CSS.
printInputField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to put an input field into a page.
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.
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.
dol_print_url($url, $target='_blank', $max=32, $withpicto=0, $morecss='')
Show Url link.
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.