-
Notifications
You must be signed in to change notification settings - Fork 317
Fix command select using key OR value for selected #3052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: alpha
Are you sure you want to change the base?
Conversation
core/class/cmd.class.php
Outdated
@@ -1671,7 +1671,8 @@ public function toHtml($_version = 'dashboard', $_options = '') { | |||
$coupleArray = explode('|', $element); | |||
$cmdValue = $this->getCmdValue(); | |||
if (is_object($cmdValue) && $cmdValue->getType() == 'info') { | |||
if ($cmdValue->execCmd() == $coupleArray[0] || $cmdValue->execCmd() == $coupleArray[1]) { | |||
$keySeclected = intval($this->getConfiguration('listValueSelected', 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$keySelected (instead of $keySeclected)
core/class/cmd.class.php
Outdated
@@ -1671,7 +1671,8 @@ public function toHtml($_version = 'dashboard', $_options = '') { | |||
$coupleArray = explode('|', $element); | |||
$cmdValue = $this->getCmdValue(); | |||
if (is_object($cmdValue) && $cmdValue->getType() == 'info') { | |||
if ($cmdValue->execCmd() == $coupleArray[0] || $cmdValue->execCmd() == $coupleArray[1]) { | |||
$keySeclected = intval($this->getConfiguration('listValueSelected', 0)); | |||
if ($cmdValue->execCmd() == $coupleArray[$keySeclected]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$keySelected
<div class="form-group"> | ||
<label class="col-xs-4 control-label">{{Sélection par index de valeur}}</label> | ||
<div class="col-xs-8"> | ||
<input type="checkbox" class="cmdAttr" data-l1key="configuration" data-l2key="listValueSelected" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a select input will be more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
Should be easier to understand, I think.
On the other hand, it could potentially break the existing system. I think we should make sure that if this is not configured, we keep the old behavior. |
For me, old system since this PR #2675 is buggy. |
Fix command select on widget using key AND value for selected value.
Give the choice to use key or value from #listValue#
Description
When #listValue# has same kind of value for key/value (i.e.
1|7;2|6;3|5;4|4;5|3;6|2;7|1
), using the actuel condition broke the selected value.Suggested changelog entry
Add option in command configuration to choose between key and value for the selected listValue
Related issues/external references
Fixes #
Fix bug introduced here #2675
Types of changes
PR checklist