NEW Can set parameters with setup type yesno.

This commit is contained in:
Laurent Destailleur
2024-10-12 01:50:18 +02:00
parent 4c3608331d
commit fc8e85158d
2 changed files with 12 additions and 3 deletions

View File

@@ -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');

View File

@@ -12450,6 +12450,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
* ],
* ]
* // phpcs:enable
* Example: array('attr' => array('class' => 'reposition'))
* @return string html button
*/
function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = '', $id = '', $userRight = 1, $params = array())