Code Duplication    Length = 11-11 lines in 2 locations

code/model/UserDefinedForm.php 2 locations

@@ 537-547 (lines=11) @@
534
                            $expression = ($checkboxField || $radioField) ? '!($(this).is(":checked"))' : '$(this).val() == ""';
535
536
                            break;
537
                        case 'HasValue':
538
                            if ($checkboxField) {
539
                                $expression = '$(this).prop("checked")';
540
                            } elseif ($radioField) {
541
                                // We cannot simply get the value of the radio group, we need to find the checked option first.
542
                                $expression = '$(this).closest(".field, .control-group").find("input:checked").val()=="'. $rule->FieldValue .'"';
543
                            } else {
544
                                $expression = '$(this).val() == "'. $rule->FieldValue .'"';
545
                            }
546
547
                            break;
548
                        case 'ValueLessThan':
549
                            $expression = '$(this).val() < parseFloat("'. $rule->FieldValue .'")';
550
@@ 564-574 (lines=11) @@
561
                            $expression = '$(this).val() >= parseFloat("'. $rule->FieldValue .'")';
562
563
                            break;
564
                        default: // ==HasNotValue
565
                            if ($checkboxField) {
566
                                $expression = '!$(this).prop("checked")';
567
                            } elseif ($radioField) {
568
                                // We cannot simply get the value of the radio group, we need to find the checked option first.
569
                                $expression = '$(this).parents(".field, .control-group").find("input:checked").val()!="'. $rule->FieldValue .'"';
570
                            } else {
571
                                $expression = '$(this).val() != "'. $rule->FieldValue .'"';
572
                            }
573
574
                            break;
575
                    }
576
577
                    if (!isset($watch[$fieldToWatch])) {