25require_once DOL_DOCUMENT_ROOT .
'/core/class/fields/commonsellistfield.class.php';
36 public $emptyValues = array(
'', array());
51 public function printInputSearchField($fieldInfos, $key, $value, $keyPrefix =
'', $keySuffix =
'', $moreCss =
'', $moreAttrib =
'')
55 $moreCss = $this->
getInputCss($fieldInfos, $moreCss);
56 $moreAttrib = trim((
string) $moreAttrib);
57 if (empty($moreAttrib)) {
58 $moreAttrib =
' ' . $moreAttrib;
60 $htmlName = $keyPrefix . $key . $keySuffix;
62 $optionsList = array();
63 $options = $this->
getOptions($fieldInfos, $key);
64 foreach ($options as $optionKey => $optionInfos) {
65 $options[$optionKey] = $optionInfos[
'label'];
68 return self::$form->multiselectarray($htmlName, $optionsList, $value, 0, 0, $moreCss, 0, 0, $moreAttrib,
'',
'', (
int) (!empty(
$conf->use_javascript_ajax) && !
getDolGlobalString(
'MAIN_EXTRAFIELDS_DISABLE_SELECT2')));
83 public function printInputField($fieldInfos, $key, $value, $keyPrefix =
'', $keySuffix =
'', $moreCss =
'', $moreAttrib =
'')
87 $moreCss = $this->
getInputCss($fieldInfos, $moreCss);
88 $moreAttrib = trim((
string) $moreAttrib);
89 if (empty($moreAttrib)) {
90 $moreAttrib =
' ' . $moreAttrib;
92 $placeHolder = $fieldInfos->inputPlaceholder;
93 if (!empty($placeHolder)) {
96 $autoFocus = $fieldInfos->inputAutofocus ?
' autofocus' :
'';
97 $htmlName = $keyPrefix . $key . $keySuffix;
98 $selectedValue = is_null($value) || $this->
isEmptyValue($fieldInfos, $value) ?
'' : (
string) $value;
101 $objectId = isset($fieldInfos->otherParams[
'objectId']) ? (int) $fieldInfos->otherParams[
'objectId'] : (isset($fieldInfos->object) && is_object($fieldInfos->object) ? $fieldInfos->object->id : 0);
102 $objectType = isset($fieldInfos->otherParams[
'objectType']) ? (int) $fieldInfos->otherParams[
'objectType'] : (isset($fieldInfos->object) && is_object($fieldInfos->object) ? $fieldInfos->object->element :
'');
103 $printMode = empty($fieldInfos->mode) ?
'view' : $fieldInfos->mode;
104 $options = $this->
getOptions($fieldInfos, $key,
false,
false, $selectedValue);
108 'objecttype' => $objectType,
109 'objectid' => $objectId,
111 'mode' => $printMode,
112 'value' => $selectedValue,
113 'dependencyvalue' =>
'',
116 $out = self::$form->inputSelectAjax($htmlName, $options, $selectedValue, self::$ajaxUrl, $ajaxData, $moreCss, $moreAttrib . $placeHolder . $autoFocus);
118 $options = $this->
getOptions($fieldInfos, $key,
true);
120 $out = self::$form->selectarray($htmlName, $options, $selectedValue, 0, 0, 0, $moreAttrib . $placeHolder . $autoFocus, 0, 0, 0,
'', $moreCss);
138 public function printOutputField($fieldInfos, $key, $value, $keyPrefix =
'', $keySuffix =
'', $moreCss =
'', $moreAttrib =
'')
143 $options = $this->
getOptions($fieldInfos, $key,
false,
false, $value);
144 if (isset($options[$value])) {
145 $out = $options[$value][
'label'];
148 if ($optionParams[
'tableName'] ==
'categorie' && !empty($optionParams[
'categoryType'])) {
149 require_once DOL_DOCUMENT_ROOT .
'/categories/class/categorie.class.php';
151 $c->fetch((
int) $value);
152 $color =
' style="background: #' . (
$c->color ?
$c->color :
'bbb') .
';"';
153 $label =
img_object(
'',
'category') .
' ' . $value;
154 $out =
'<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr"><li class="select2-search-choice-dolibarr noborderoncategories"' . $color .
'>' . $label .
'</li></ul></div>';
173 public function getInputCss($fieldInfos, $moreCss =
'', $defaultCss =
'')
175 return parent::getInputCss($fieldInfos, $moreCss, $defaultCss ? $defaultCss :
'minwidth400');
189 $result = parent::verifyFieldValue($fieldInfos, $key, $value);
190 if ($result && !$this->
isEmptyValue($fieldInfos, $value)) {
192 if (!self::$validator->isInDb($value, $optionParams[
'tableName'], $optionParams[
'keyField'])) {
214 $htmlName = $keyPrefix . $key . $keySuffix;
215 $value =
GETPOST($htmlName,
'restricthtml');
216 $value = trim($value);
232 public function getPostFieldValue($fieldInfos, $key, $defaultValue =
null, $keyPrefix =
'', $keySuffix =
'')
234 $htmlName = $keyPrefix . $key . $keySuffix;
236 if (GETPOSTISSET($htmlName)) {
237 $value =
GETPOST($htmlName,
'alphanohtml');
239 $value = $defaultValue;
258 $htmlName = $keyPrefix . $key . $keySuffix;
260 if (GETPOSTISSET($htmlName)) {
261 $value =
GETPOST($htmlName,
'array');
263 $value = $defaultValue;
280 if (!empty($value) && is_array($value)) {
281 $alias = $fieldInfos->sqlAlias ??
't.';
282 $field = $this->db->sanitize($alias . ($fieldInfos->nameInTable ?? $key));
284 $sanitizedSqlIn =
"'" . implode(
"','", array_map(array($this->db,
'escape'), $value)) .
"'";
285 $sqlPartialCond =
" AND " . $field .
" IN (" . $sanitizedSqlIn .
")";
286 return $sqlPartialCond;
302 public function getOptions($fieldInfos, $key, $addEmptyValue =
false, $reload =
false, $selectedValues = array())
304 return parent::getOptions($fieldInfos, $key, $addEmptyValue, $reload, $selectedValues);
Class to manage categories.
isEmptyValue($fieldInfos, $value, $emptyValues=null)
Check if the value is deemed as empty.
Class to common sellist field.
getOptionsParams($options)
Get all parameters in the options.
getInputCss($fieldInfos, $moreCss='', $defaultCss='')
Get input CSS.
getPostFieldValue($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='')
Get field value from GET/POST.
verifyFieldValue($fieldInfos, $key, $value)
Verify if the field value is valid.
sqlFilterSearchField($fieldInfos, $key, $value)
Get sql filter for search field.
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.
verifyPostFieldValue($fieldInfos, $key, $keyPrefix='', $keySuffix='')
Verify if the field value from GET/POST is valid.
getOptions($fieldInfos, $key, $addEmptyValue=false, $reload=false, $selectedValues=array())
Get list of options.
printInputSearchField($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='')
Return HTML string to put an input search field into a page.
getPostSearchFieldValue($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='')
Get search field value from GET/POST.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php