public function hasCustomWorkflowsAvailable() { if ($this->isCustomWorkflowsEnabled()) { return $this->getMaxWorkflowsLimit() ? Workflow::getCustomWorkflowsCount() < $this->getMaxWorkflowsLimit() : true; } else { return false; } }
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'); } } }
<div class="content faded_out"> <p> <?php echo __('Workflow lets you define the lifecycle of an issue. You can define steps, transitions and more, that makes an issue move through its defined lifecycle.'); ?> <?php echo __('You can read more about how the workflow in The Bug Genie works and is set up in %link_to_wiki_workflow.', array('%link_to_wiki_workflow' => link_tag(make_url('publish_article', array('article_name' => 'TheBugGenie:Workflow')), 'TheBugGenie:Workflow'))); ?> </p> </div> <?php if (\thebuggenie\core\framework\Context::getScope()->getMaxWorkflowsLimit()) { ?> <div class="faded_out dark" style="margin: 12px 0;"> <?php echo __('This instance is currently using %num of max %max custom workflows', array('%num' => '<b id="current_workflow_num_count">' . \thebuggenie\core\entities\Workflow::getCustomWorkflowsCount() . '</b>', '%max' => '<b>' . \thebuggenie\core\framework\Context::getScope()->getMaxWorkflowsLimit() . '</b>')); ?> </div> <?php } ?> <br style="clear: both;"> <div class="tab_menu inset"> <ul id="workflow_menu"> <li<?php if ($selected_tab == 'workflows') { ?> class="selected"<?php } ?> ><?php