Code Duplication    Length = 11-11 lines in 2 locations

code/model/UserDefinedForm.php 2 locations

@@ 559-569 (lines=11) @@
556
                            $expression = ($checkboxField || $radioField) ? '!($(this).is(":checked"))' : '$(this).val() == ""';
557
558
                            break;
559
                        case 'HasValue':
560
                            if ($checkboxField) {
561
                                $expression = '$(this).prop("checked")';
562
                            } elseif ($radioField) {
563
                                // We cannot simply get the value of the radio group, we need to find the checked option first.
564
                                $expression = '$(this).parents(".field, .control-group").find("input:checked").val()=="'. $rule->FieldValue .'"';
565
                            } else {
566
                                $expression = '$(this).val() == "'. $rule->FieldValue .'"';
567
                            }
568
569
                            break;
570
                        case 'ValueLessThan':
571
                            $expression = '$(this).val() < parseFloat("'. $rule->FieldValue .'")';
572
@@ 586-596 (lines=11) @@
583
                            $expression = '$(this).val() >= parseFloat("'. $rule->FieldValue .'")';
584
585
                            break;
586
                        default: // ==HasNotValue
587
                            if ($checkboxField) {
588
                                $expression = '!$(this).prop("checked")';
589
                            } elseif ($radioField) {
590
                                // We cannot simply get the value of the radio group, we need to find the checked option first.
591
                                $expression = '$(this).parents(".field, .control-group").find("input:checked").val()!="'. $rule->FieldValue .'"';
592
                            } else {
593
                                $expression = '$(this).val() != "'. $rule->FieldValue .'"';
594
                            }
595
596
                            break;
597
                    }
598
599
                    if (!isset($watch[$fieldToWatch])) {