public function runConfigureWorkflowStep(framework\Request $request) { $this->workflow = null; $this->step = null; try { $this->workflow = entities\Workflow::getB2DBTable()->selectById($request['workflow_id']); if ($request['mode'] == 'edit' && !$request->hasParameter('step_id')) { $this->step = new entities\WorkflowStep(); $this->step->setWorkflow($this->workflow); } else { $this->step = entities\WorkflowStep::getB2DBTable()->selectById($request['step_id']); } if ($request->isPost() && $request['mode'] == 'delete_outgoing_transitions') { $this->step->deleteOutgoingTransitions(); $this->forward(framework\Context::getRouting()->generate('configure_workflow_steps', array('workflow_id' => $this->workflow->getID()))); } if ($request->isPost() && $request['mode'] == 'delete' && !$this->step->hasIncomingTransitions()) { $this->step->deleteOutgoingTransitions(); $this->step->delete(); $this->forward(framework\Context::getRouting()->generate('configure_workflow_steps', array('workflow_id' => $this->workflow->getID()))); } elseif ($request->isPost() && ($request->hasParameter('edit') || $request['mode'] == 'edit')) { $this->step->setName($request['name']); $this->step->setDescription($request['description']); $this->step->setLinkedStatusID($request['status_id']); $this->step->setIsEditable((bool) $request['is_editable']); $this->step->setIsClosed((bool) ($request['state'] == entities\Issue::STATE_CLOSED)); $this->step->save(); $this->forward(framework\Context::getRouting()->generate('configure_workflow_step', array('workflow_id' => $this->workflow->getID(), 'step_id' => $this->step->getID()))); } } catch (\Exception $e) { $this->error = $this->getI18n()->__('This workflow / step does not exist'); } }