Code Duplication    Length = 11-11 lines in 2 locations

code/model/UserDefinedForm.php 2 locations

@@ 515-525 (lines=11) @@
512
                            $expression = ($checkboxField || $radioField) ? '!($(this).is(":checked"))' : '$(this).val() == ""';
513
514
                            break;
515
                        case 'HasValue':
516
                            if ($checkboxField) {
517
                                $expression = '$(this).prop("checked")';
518
                            } elseif ($radioField) {
519
                                // We cannot simply get the value of the radio group, we need to find the checked option first.
520
                                $expression = '$(this).parents(".field, .control-group").find("input:checked").val()=="'. $rule->FieldValue .'"';
521
                            } else {
522
                                $expression = '$(this).val() == "'. $rule->FieldValue .'"';
523
                            }
524
525
                            break;
526
                        case 'ValueLessThan':
527
                            $expression = '$(this).val() < parseFloat("'. $rule->FieldValue .'")';
528
@@ 542-552 (lines=11) @@
539
                            $expression = '$(this).val() >= parseFloat("'. $rule->FieldValue .'")';
540
541
                            break;
542
                        default: // ==HasNotValue
543
                            if ($checkboxField) {
544
                                $expression = '!$(this).prop("checked")';
545
                            } elseif ($radioField) {
546
                                // We cannot simply get the value of the radio group, we need to find the checked option first.
547
                                $expression = '$(this).parents(".field, .control-group").find("input:checked").val()!="'. $rule->FieldValue .'"';
548
                            } else {
549
                                $expression = '$(this).val() != "'. $rule->FieldValue .'"';
550
                            }
551
552
                            break;
553
                    }
554
555
                    if (!isset($watch[$fieldToWatch])) {