Code Duplication    Length = 11-11 lines in 2 locations

code/model/UserDefinedForm.php 2 locations

@@ 457-467 (lines=11) @@
454
							$expression = ($checkboxField || $radioField) ? '!($(this).is(":checked"))' : '$(this).val() == ""';
455
456
							break;
457
						case 'HasValue':
458
							if ($checkboxField) {
459
								$expression = '$(this).prop("checked")';
460
							} else if ($radioField) {
461
								// We cannot simply get the value of the radio group, we need to find the checked option first.
462
								$expression = '$(this).parents(".field, .control-group").find("input:checked").val()=="'. $rule->FieldValue .'"';
463
							} else {
464
								$expression = '$(this).val() == "'. $rule->FieldValue .'"';
465
							}
466
467
							break;
468
						case 'ValueLessThan':
469
							$expression = '$(this).val() < parseFloat("'. $rule->FieldValue .'")';
470
@@ 484-494 (lines=11) @@
481
							$expression = '$(this).val() >= parseFloat("'. $rule->FieldValue .'")';
482
483
							break;
484
						default: // ==HasNotValue
485
							if ($checkboxField) {
486
								$expression = '!$(this).prop("checked")';
487
							} else if ($radioField) {
488
								// We cannot simply get the value of the radio group, we need to find the checked option first.
489
								$expression = '$(this).parents(".field, .control-group").find("input:checked").val()!="'. $rule->FieldValue .'"';
490
							} else {
491
								$expression = '$(this).val() != "'. $rule->FieldValue .'"';
492
							}
493
494
							break;
495
					}
496
497
					if(!isset($watch[$fieldToWatch])) {