Code Duplication    Length = 14-14 lines in 2 locations

code/templates/WorkflowTemplate.php 2 locations

@@ 387-400 (lines=14) @@
384
		}
385
		
386
		// Deal with User relations on target object
387
		if($hasUsers) {
388
			if($clear) {
389
				$relName = $userRelationName[0];
390
				$object->$relName()->removeAll();
391
			}
392
			if(isset($source['users']) && is_array($source['users'])) {
393
				foreach ($source['users'] as $user) {
394
					$email = Convert::raw2sql($user['email']);
395
					if($_user = DataObject::get_one('Member', "Email = '".$email."'")) {
396
						$object->Users()->add($_user);
397
					}
398
				}			
399
			}
400
		}	
401
		
402
		// Deal with Group relations on target object
403
		if($hasGroups) {
@@ 403-416 (lines=14) @@
400
		}	
401
		
402
		// Deal with Group relations on target object
403
		if($hasGroups) {
404
			if($clear) {
405
				$relName = $groupRelationName[0];
406
				$object->$relName()->removeAll();
407
			}			
408
			if(isset($source['groups']) && is_array($source['groups'])) {
409
				foreach ($source['groups'] as $group) {
410
					$title = Convert::raw2sql($group['title']);
411
					if($_group = DataObject::get_one('Group', "Title = '".$title."'")) {
412
						$object->Groups()->add($_group);
413
					}
414
				}
415
			}
416
		}		
417
	}
418
}
419