diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index e7791dc197d..e475289c5b6 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -673,6 +673,7 @@ class FormSetupItem */ public $cssClass = ''; + /** * Constructor * @@ -904,7 +905,11 @@ class FormSetupItem $out .= $this->generateInputFieldColor(); } elseif ($this->type == 'yesno') { if (!empty($conf->use_javascript_ajax)) { - $out .= ajax_constantonoff($this->confKey); + $input = $this->fieldParams['input'] ?? array(); + $revertonoff = $this->fieldParams['revertonoff'] ? 1 : 0; + $forcereload = $this->fieldParams['forcereload'] ? 1 : 0; + + $out .= ajax_constantonoff($this->confKey, $input, $this->entity, $revertonoff, 0, $forcereload); } else { $out .= $this->form->selectyesno($this->confKey, $this->fieldValue, 1); } @@ -1218,7 +1223,10 @@ class FormSetupItem $out .= $this->generateOutputFieldColor(); } elseif ($this->type == 'yesno') { if (!empty($conf->use_javascript_ajax)) { - $out .= ajax_constantonoff($this->confKey, array(), $this->entity); // TODO possibility to add $input parameter + $revertonoff = $this->fieldParams['revertonoff'] ? 1 : 0; + $forcereload = $this->fieldParams['forcereload'] ? 1 : 0; + + $out .= ajax_constantonoff($this->confKey, array(), $this->entity, $revertonoff, 0, $forcereload); } else { if ($this->fieldValue == 1) { $out .= $langs->trans('yes'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 09b8215b2bc..af2627265b3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12450,7 +12450,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * ], * ] * // phpcs:enable - * @return string html button + * Example: array('attr' => array('class' => 'reposition')) + * @return string html button */ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = '', $id = '', $userRight = 1, $params = array()) {