Code Duplication    Length = 11-11 lines in 2 locations

code/model/UserDefinedForm.php 2 locations

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