Skip to content

Commit 8810cd6

Browse files
committed
fix(confition): hide garbage conditions
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
1 parent 397a912 commit 8810cd6

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

css/styles.css

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,9 @@ input[type = radio]:checked + label.label-radio .check {
457457
font-style: italic;
458458
margin: 0 4px;
459459
}
460+
461+
/* CONDITIONS */
462+
460463
.div_show_condition_field, .div_show_condition_operator,
461464
.div_show_condition_value, .div_show_condition_logic,
462465
.div_show_condition_add, .div_show_condition_remove {
@@ -491,12 +494,12 @@ input[type = radio]:checked + label.label-radio .check {
491494
width: 12px;
492495
vertical-align: middle;
493496
}
494-
/* jQuery UI Combobox*/
495-
.pq-select-multiple {
496-
display: inline-block;
497-
width: 85% !important;
497+
tr[data-itemtype="PluginFormcreatorCondition"] .div_show_condition_logic {
498+
visibility: hidden;
499+
}
500+
tr[data-itemtype="PluginFormcreatorCondition"] ~ tr[data-itemtype="PluginFormcreatorCondition"] .div_show_condition_logic {
501+
visibility: visible;
498502
}
499-
500503
.select2-container + select {
501504
display: none !important;
502505
}

inc/condition.class.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function export($remove_uuid = false) {
199199
* get conditions applied to an item
200200
*
201201
* @param PluginFormcreatorConditionnableInterface $item
202-
* @return array array of PluginFotrmcreatorCondition
202+
* @return PluginFotrmcreatorCondition[]
203203
*/
204204
public function getConditionsFromItem(PluginFormcreatorConditionnableInterface $item) {
205205
global $DB;
@@ -250,6 +250,10 @@ public function showConditionsForItem(CommonDBTM $item) {
250250
echo '</td>';
251251
echo '</tr>';
252252

253+
if ($item->fields['show_rule'] == PluginFormcreatorCondition::SHOW_RULE_ALWAYS) {
254+
return;
255+
}
256+
253257
// Get existing conditions for the item
254258
$conditions = $this->getConditionsFromItem($item);
255259
foreach ($conditions as $condition) {

js/scripts.js.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ function plugin_formcreator_toggleCondition(target) {
815815
function plugin_formcreator_addEmptyCondition(target) {
816816
var form = $(target).closest('form');
817817
var itemtype = form.attr('data-itemtype');
818-
// value if the hidden id input field
818+
// value of the hidden id input field
819819
var id = form.find('[name="id"]').val();
820820
var parentKey;
821821
var parentId;
@@ -834,13 +834,11 @@ function plugin_formcreator_addEmptyCondition(target) {
834834
data: data
835835
}).done(function (data) {
836836
$(target).parents('tr').after(data);
837-
$('.plugin_formcreator_logicRow .div_show_condition_logic').first().hide();
838837
});
839838
}
840839

841840
function plugin_formcreator_removeNextCondition(target) {
842841
$(target).parents('tr').remove();
843-
$('.plugin_formcreator_logicRow .div_show_condition_logic').first().hide();
844842
}
845843

846844
function plugin_formcreator_changeDropdownItemtype(rand) {

0 commit comments

Comments
 (0)