diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 13afc43cb51..a3908df0adb 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -834,6 +834,8 @@ class FormSetupItem $out.= $this->generateInputFieldMultiSelect(); } elseif ($this->type == 'select') { $out.= $this->generateInputFieldSelect(); + } elseif ($this->type == 'selectUser') { + $out.= $this->generateInputFieldSelectUser(); } elseif ($this->type == 'textarea') { $out.= $this->generateInputFieldTextarea(); } elseif ($this->type== 'html') { @@ -993,6 +995,14 @@ class FormSetupItem return $this->form->selectarray($this->confKey, $this->fieldOptions, $this->fieldValue); } + /** + * @return string + */ + public function generateInputFieldSelectUser() + { + return $this->form->select_dolusers($this->fieldValue, $this->confKey); + } + /** * get the type : used for old module builder setup conf style conversion and tests * because this two class will quickly evolve it's important to not set or get directly $this->type (will be protected) so this method exist @@ -1067,6 +1077,8 @@ class FormSetupItem $out.= $this->generateOutputFieldMultiSelect(); } elseif ($this->type == 'select') { $out.= $this->generateOutputFieldSelect(); + } elseif ($this->type == 'selectUser') { + $out.= $this->generateOutputFieldSelectUser(); } elseif ($this->type== 'html') { $out.= $this->fieldValue; } elseif ($this->type== 'color') { @@ -1136,6 +1148,8 @@ class FormSetupItem /** + * generateOutputFieldMultiSelect + * * @return string */ public function generateOutputFieldMultiSelect() @@ -1157,6 +1171,8 @@ class FormSetupItem } /** + * generateOutputFieldColor + * * @return string */ public function generateOutputFieldColor() @@ -1165,6 +1181,8 @@ class FormSetupItem return $this->generateInputField(); } /** + * generateInputFieldColor + * * @return string */ public function generateInputFieldColor() @@ -1174,6 +1192,8 @@ class FormSetupItem } /** + * generateOutputFieldSelect + * * @return string */ public function generateOutputFieldSelect() @@ -1186,12 +1206,27 @@ class FormSetupItem return $outPut; } + /** + * generateOutputFieldSelectUser + * + * @return string + */ + public function generateOutputFieldSelectUser() + { + $outPut = ''; + $user = new User($this->db); + $user->fetch($this->fieldValue); + $outPut = $user->firstname . " " . $user->lastname; + return $outPut; + } + /* * METHODS FOR SETTING DISPLAY TYPE */ /** * Set type of input as string + * * @return self */ public function setAsString() @@ -1202,6 +1237,7 @@ class FormSetupItem /** * Set type of input as color + * * @return self */ public function setAsColor() @@ -1212,6 +1248,7 @@ class FormSetupItem /** * Set type of input as textarea + * * @return self */ public function setAsTextarea() @@ -1222,6 +1259,7 @@ class FormSetupItem /** * Set type of input as html editor + * * @return self */ public function setAsHtml() @@ -1232,6 +1270,7 @@ class FormSetupItem /** * Set type of input as emailtemplate selector + * * @param string $templateType email template type * @return self */ @@ -1243,6 +1282,7 @@ class FormSetupItem /** * Set type of input as thirdparty_type selector + * * @return self */ public function setAsThirdpartyType() @@ -1253,6 +1293,7 @@ class FormSetupItem /** * Set type of input as Yes + * * @return self */ public function setAsYesNo() @@ -1263,6 +1304,7 @@ class FormSetupItem /** * Set type of input as secure key + * * @return self */ public function setAsSecureKey() @@ -1273,6 +1315,7 @@ class FormSetupItem /** * Set type of input as product + * * @return self */ public function setAsProduct() @@ -1284,6 +1327,7 @@ class FormSetupItem /** * Set type of input as a category selector * TODO add default value + * * @param int $catType Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated. * @return self */ @@ -1294,8 +1338,8 @@ class FormSetupItem } /** - * Set type of input as a simple title - * no data to store + * Set type of input as a simple title. No data to store + * * @return self */ public function setAsTitle() @@ -1306,8 +1350,8 @@ class FormSetupItem /** - * Set type of input as a simple title - * no data to store + * Set type of input as a simple title. No data to store + * * @param array $fieldOptions A table of field options * @return self */ @@ -1322,8 +1366,8 @@ class FormSetupItem } /** - * Set type of input as a simple title - * no data to store + * Set type of input as a simple title. No data to store + * * @param array $fieldOptions A table of field options * @return self */ @@ -1336,4 +1380,15 @@ class FormSetupItem $this->type = 'select'; return $this; } + + /** + * Set type of input as a simple title. No data to store + * + * @return self + */ + public function setAsSelectUser() + { + $this->type = 'selectUser'; + return $this; + } }