Code Duplication    Length = 14-15 lines in 2 locations

code/formfields/WorkflowFieldActionController.php 1 location

@@ 48-62 (lines=15) @@
45
		return new WorkflowFieldItemController($this, "new/$class", $record);
46
	}
47
48
	public function handleItem() {
49
		$id     = $this->request->param('ID');
50
		$defn   = $this->parent->Definition();
51
		$action = $defn->Actions()->byID($id);
52
53
		if(!$action) {
54
			$this->httpError(404);
55
		}
56
57
		if(!$action->canEdit()) {
58
			$this->httpError(403);
59
		}
60
61
		return new WorkflowFieldItemController($this, "item/$id", $action);
62
	}
63
64
	public function RootField() {
65
		return $this->parent;

code/formfields/WorkflowFieldTransitionController.php 1 location

@@ 47-60 (lines=14) @@
44
		return new WorkflowFieldItemController($this, "new/$parent", $transition);
45
	}
46
47
	public function handleItem() {
48
		$id    = $this->request->param('ID');
49
		$trans = WorkflowTransition::get()->byID($id);
50
51
		if(!$trans || $trans->Action()->WorkflowDefID != $this->RootField()->Definition()->ID) {
52
			$this->httpError(404);
53
		}
54
55
		if(!$trans->canEdit()) {
56
			$this->httpError(403);
57
		}
58
59
		return new WorkflowFieldItemController($this, "item/$id", $trans);
60
	}
61
62
	public function RootField() {
63
		return $this->parent;