public function runConfigureWorkflowSteps(framework\Request $request) { $this->workflow = null; $this->mode = $request->getParameter('mode', 'list'); try { $this->workflow = entities\Workflow::getB2DBTable()->selectById($request['workflow_id']); // $transition = new entities\WorkflowTransition(); // $step = tables\WorkflowSteps::getTable()->selectById(9); // $transition->setOutgoingStep($step); // $transition->setName('Initial transition'); // $transition->setWorkflow($this->workflow); // $transition->setScope(framework\Context::getScope()); // $transition->setDescription('This is the initial transition for issues using this workflow'); // $transition->save(); // $this->workflow->setInitialTransition($transition); // $this->workflow->save(); if ($this->mode == 'copy_workflow') { if ($new_name = $request['new_name']) { $new_workflow = $this->workflow->copy($new_name); return $this->renderJSON(array('content' => $this->getComponentHTML('configuration/workflow', array('workflow' => $new_workflow)), 'total_count' => entities\Workflow::getCustomWorkflowsCount(), 'more_available' => framework\Context::getScope()->hasCustomWorkflowsAvailable())); } else { $this->error = $this->getI18n()->__('Please enter a valid name'); } } elseif ($this->mode == 'delete_workflow') { $this->workflow->delete(); return $this->renderJSON(array('success' => true, 'message' => $this->getI18n()->__('The workflow was deleted'), 'total_count' => entities\Workflow::getCustomWorkflowsCount(), 'more_available' => framework\Context::getScope()->hasCustomWorkflowsAvailable())); } } catch (\Exception $e) { if ($request->getRequestedFormat() == 'json') { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('success' => false, 'message' => $this->getI18n()->__('An error occured'), 'error' => $e->getMessage())); } else { $this->error = $this->getI18n()->__('This workflow does not exist'); } } }
public function setValuesFromRequest(\thebuggenie\core\framework\Request $request) { if ($request->hasParameter('predefined_search')) { $this->setPredefinedVariables($request['predefined_search']); } else { $this->_templatename = $request->hasParameter('template') && self::isTemplateValid($request['template']) ? $request['template'] : 'results_normal'; $this->_templateparameter = $request['template_parameter']; $this->_issues_per_page = in_array($request->getRequestedFormat(), array('csv', 'xlsx', 'ods')) ? 0 : $request->getParameter('issues_per_page', 50); $this->_offset = $request->getParameter('offset', 0); if ($request['quicksearch']) { $this->setSortFields(array(tables\Issues::LAST_UPDATED => 'desc')); if ($request['term']) { $request->setParameter('fs', array('text' => array('v' => $request['term'], 'o' => '='))); } } $this->_filters = SearchFilter::getFromRequest($request, $this); $this->_applies_to_project = framework\Context::getCurrentProject(); $this->_columns = $request->getParameter('columns'); $this->_sortfields = $request->getParameter('sortfields'); $this->_groupby = $request['groupby']; $this->_grouporder = $request->getParameter('grouporder', 'asc'); if (in_array($this->_templatename, array('results_userpain_singlepainthreshold', 'results_userpain_totalpainthreshold'))) { $this->_searchtitle = framework\Context::getI18n()->__('Showing "bug report" issues sorted by user pain, threshold set at %threshold', array('%threshold' => $this->_templateparameter)); $this->_issues_per_page = 0; $this->_groupby = 'user_pain'; $this->_grouporder = 'desc'; $this->_filters['issuetype'] = SearchFilter::createFilter('issuetype', array('operator' => '=', 'value' => join(',', tables\IssueTypes::getTable()->getBugReportTypeIDs()))); } elseif ($this->_templatename == 'results_votes') { $this->_searchtitle = framework\Context::getI18n()->__('Showing issues ordered by number of votes'); $this->_issues_per_page = $request->getParameter('issues_per_page', 100); $this->_groupby = 'votes'; $this->_grouporder = 'desc'; } } $this->_setupGenericFilters(); }