Fix command select using key OR value for selected#3052
Open
Flobul wants to merge 3 commits intojeedom:developfrom
Open
Fix command select using key OR value for selected#3052Flobul wants to merge 3 commits intojeedom:developfrom
Flobul wants to merge 3 commits intojeedom:developfrom
Conversation
kwizer15
reviewed
Apr 20, 2025
| $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)); |
Contributor
There was a problem hiding this comment.
$keySelected (instead of $keySeclected)
| 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]) { |
| <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" /> |
Contributor
There was a problem hiding this comment.
Maybe a select input will be more appropriate.
Contributor
Author
There was a problem hiding this comment.
Sure.
Should be easier to understand, I think.
Contributor
|
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. |
Contributor
Author
|
For me, old system since this PR #2675 is buggy. |
| $cmdValue = $this->getCmdValue(); | ||
| if (is_object($cmdValue) && $cmdValue->getType() == 'info') { | ||
| if ($cmdValue->execCmd() == $coupleArray[0] || $cmdValue->execCmd() == $coupleArray[1]) { | ||
| $keySelected = intval($this->getConfiguration('listValueSelected', 0)); |
Contributor
There was a problem hiding this comment.
Suggested change
| $keySelected = intval($this->getConfiguration('listValueSelected', 0)); | |
| $keySelected = (int)$this->getConfiguration('listValueSelected', 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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