Code Duplication    Length = 11-11 lines in 2 locations

code/model/UserDefinedForm.php 2 locations

@@ 522-532 (lines=11) @@
519
                            $expression = ($checkboxField || $radioField) ? '!($(this).is(":checked"))' : '$(this).val() == ""';
520
521
                            break;
522
                        case 'HasValue':
523
                            if ($checkboxField) {
524
                                $expression = '$(this).prop("checked")';
525
                            } elseif ($radioField) {
526
                                // We cannot simply get the value of the radio group, we need to find the checked option first.
527
                                $expression = '$(this).closest(".field, .control-group").find("input:checked").val()=="'. $rule->FieldValue .'"';
528
                            } else {
529
                                $expression = '$(this).val() == "'. $rule->FieldValue .'"';
530
                            }
531
532
                            break;
533
                        case 'ValueLessThan':
534
                            $expression = '$(this).val() < parseFloat("'. $rule->FieldValue .'")';
535
@@ 549-559 (lines=11) @@
546
                            $expression = '$(this).val() >= parseFloat("'. $rule->FieldValue .'")';
547
548
                            break;
549
                        default: // ==HasNotValue
550
                            if ($checkboxField) {
551
                                $expression = '!$(this).prop("checked")';
552
                            } elseif ($radioField) {
553
                                // We cannot simply get the value of the radio group, we need to find the checked option first.
554
                                $expression = '$(this).parents(".field, .control-group").find("input:checked").val()!="'. $rule->FieldValue .'"';
555
                            } else {
556
                                $expression = '$(this).val() != "'. $rule->FieldValue .'"';
557
                            }
558
559
                            break;
560
                    }
561
562
                    if (!isset($watch[$fieldToWatch])) {