예제 #1
0
 protected function _populateWorkflowCount()
 {
     if ($this->_workflowstepcount === null) {
         $this->_workflowstepcount = array();
         $this->_workflowstepcount[0] = array('open' => 0, 'closed' => 0, 'percentage' => 0);
         foreach (WorkflowStep::getAllByWorkflowSchemeID($this->getWorkflowScheme()->getID()) as $workflow_step_id => $workflow_step) {
             $this->_workflowstepcount[$workflow_step_id] = array('open' => 0, 'closed' => 0, 'percentage' => 0);
         }
         foreach (tables\Issues::getTable()->getWorkflowStepCountByProjectID($this->getID()) as $workflow_step_id => $workflow_count) {
             $this->_workflowstepcount[$workflow_step_id] = $workflow_count;
         }
     }
 }
예제 #2
0
 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');
     }
 }
예제 #3
0
 public function setWorkflowStep(\thebuggenie\core\entities\WorkflowStep $step)
 {
     $this->_addChangedProperty('_workflow_step_id', $step->getID());
 }
예제 #4
0
 public function componentDashboardViewProjectStatistics()
 {
     switch ($this->view->getType()) {
         case entities\DashboardView::VIEW_PROJECT_STATISTICS_PRIORITY:
             $counts = framework\Context::getCurrentProject()->getPriorityCount();
             $items = entities\Priority::getAll();
             $key = 'priority';
             break;
         case entities\DashboardView::VIEW_PROJECT_STATISTICS_SEVERITY:
             $counts = framework\Context::getCurrentProject()->getSeverityCount();
             $items = entities\Severity::getAll();
             $key = 'priority';
             break;
         case entities\DashboardView::VIEW_PROJECT_STATISTICS_CATEGORY:
             $counts = framework\Context::getCurrentProject()->getCategoryCount();
             $items = entities\Category::getAll();
             $key = 'category';
             break;
         case entities\DashboardView::VIEW_PROJECT_STATISTICS_RESOLUTION:
             $counts = framework\Context::getCurrentProject()->getResolutionCount();
             $items = entities\Resolution::getAll();
             $key = 'resolution';
             break;
         case entities\DashboardView::VIEW_PROJECT_STATISTICS_STATUS:
             $counts = framework\Context::getCurrentProject()->getStatusCount();
             $items = entities\Status::getAll();
             $key = 'status';
             break;
         case entities\DashboardView::VIEW_PROJECT_STATISTICS_WORKFLOW_STEP:
             $counts = framework\Context::getCurrentProject()->getWorkflowCount();
             $items = entities\WorkflowStep::getAllByWorkflowSchemeID(framework\Context::getCurrentProject()->getWorkflowScheme()->getID());
             $key = 'workflowstep';
             break;
         case entities\DashboardView::VIEW_PROJECT_STATISTICS_STATE:
             $counts = framework\Context::getCurrentProject()->getStateCount();
             $items = array('open' => $this->getI18n()->__('Open'), 'closed' => $this->getI18n()->__('Closed'));
             $key = 'state';
             break;
     }
     $this->counts = $counts;
     $this->key = $key;
     $this->items = $items;
 }
예제 #5
0
 public function setWorkflowStep(WorkflowStep $step)
 {
     $this->_addChangedProperty('_workflow_step_id', $step->getID());
 }
예제 #6
0
 public static function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     $workflow = new \thebuggenie\core\entities\Workflow();
     $workflow->setName("Default workflow");
     $workflow->setDescription("This is the default workflow. It is used by all projects with no specific workflow selected, and for issue types with no specific workflow specified. This workflow cannot be edited or removed.");
     $workflow->setScope($scope->getID());
     $workflow->save();
     \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_DEFAULT_WORKFLOW, $workflow->getID(), 'core', $scope->getID());
     WorkflowStep::loadFixtures($scope, $workflow);
 }