Code Duplication    Length = 11-11 lines in 2 locations

code/model/UserDefinedForm.php 2 locations

@@ 545-555 (lines=11) @@
542
                            $expression = ($checkboxField || $radioField) ? '!($(this).is(":checked"))' : '$(this).val() == ""';
543
544
                            break;
545
                        case 'HasValue':
546
                            if ($checkboxField) {
547
                                $expression = '$(this).prop("checked")';
548
                            } elseif ($radioField) {
549
                                // We cannot simply get the value of the radio group, we need to find the checked option first.
550
                                $expression = '$(this).parents(".field, .control-group").find("input:checked").val()=="'. $rule->FieldValue .'"';
551
                            } else {
552
                                $expression = '$(this).val() == "'. $rule->FieldValue .'"';
553
                            }
554
555
                            break;
556
                        case 'ValueLessThan':
557
                            $expression = '$(this).val() < parseFloat("'. $rule->FieldValue .'")';
558
@@ 572-582 (lines=11) @@
569
                            $expression = '$(this).val() >= parseFloat("'. $rule->FieldValue .'")';
570
571
                            break;
572
                        default: // ==HasNotValue
573
                            if ($checkboxField) {
574
                                $expression = '!$(this).prop("checked")';
575
                            } elseif ($radioField) {
576
                                // We cannot simply get the value of the radio group, we need to find the checked option first.
577
                                $expression = '$(this).parents(".field, .control-group").find("input:checked").val()!="'. $rule->FieldValue .'"';
578
                            } else {
579
                                $expression = '$(this).val() != "'. $rule->FieldValue .'"';
580
                            }
581
582
                            break;
583
                    }
584
585
                    if (!isset($watch[$fieldToWatch])) {