本文整理汇总了PHP中thebuggenie\core\entities\Status类的典型用法代码示例。如果您正苦于以下问题:PHP Status类的具体用法?PHP Status怎么用?PHP Status使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Status类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFixtures
public static function loadFixtures(\thebuggenie\core\entities\Scope $scope)
{
Category::loadFixtures($scope);
Priority::loadFixtures($scope);
Reproducability::loadFixtures($scope);
Resolution::loadFixtures($scope);
Severity::loadFixtures($scope);
Status::loadFixtures($scope);
Role::loadFixtures($scope);
ActivityType::loadFixtures($scope);
foreach (self::getTypes() as $type => $class) {
framework\Context::setPermission('set_datatype_' . $type, 0, 'core', 0, 0, 0, true, $scope->getID());
}
}
示例2: loadFixtures
public static function loadFixtures(\thebuggenie\core\entities\Scope $scope, \thebuggenie\core\entities\Workflow $workflow)
{
$steps = array();
$steps['new'] = array('name' => 'New', 'description' => 'A new issue, not yet handled', 'status_id' => Status::getByKeyish('new')->getID(), 'transitions' => array('investigateissue', 'confirmissue', 'rejectissue', 'acceptissue', 'resolveissue'), 'editable' => true, 'is_closed' => false);
$steps['investigating'] = array('name' => 'Investigating', 'description' => 'An issue that is being investigated, looked into or is by other means between new and unconfirmed state', 'status_id' => Status::getByKeyish('investigating')->getID(), 'transitions' => array('requestmoreinformation', 'confirmissue', 'rejectissue', 'acceptissue'), 'editable' => true, 'is_closed' => false);
$steps['confirmed'] = array('name' => 'Confirmed', 'description' => 'An issue that has been confirmed', 'status_id' => Status::getByKeyish('confirmed')->getID(), 'transitions' => array('acceptissue', 'assignissue', 'resolveissue'), 'editable' => false, 'is_closed' => false);
$steps['inprogress'] = array('name' => 'In progress', 'description' => 'An issue that is being adressed', 'status_id' => Status::getByKeyish('beingworkedon')->getID(), 'transitions' => array('rejectissue', 'markreadyfortesting', 'resolveissue'), 'editable' => false, 'is_closed' => false);
$steps['readyfortesting'] = array('name' => 'Ready for testing', 'description' => 'An issue that has been marked fixed and is ready for testing', 'status_id' => Status::getByKeyish('readyfortesting/qa')->getID(), 'transitions' => array('resolveissue', 'testissuesolution'), 'editable' => false, 'is_closed' => false);
$steps['testing'] = array('name' => 'Testing', 'description' => 'An issue where the proposed or implemented solution is currently being tested or approved', 'status_id' => Status::getByKeyish('testing/qa')->getID(), 'transitions' => array('acceptissuesolution', 'rejectissuesolution'), 'editable' => false, 'is_closed' => false);
$steps['rejected'] = array('name' => 'Rejected', 'description' => 'A closed issue that has been rejected', 'status_id' => Status::getByKeyish('notabug')->getID(), 'transitions' => array('reopenissue'), 'editable' => false, 'is_closed' => true);
$steps['closed'] = array('name' => 'Closed', 'description' => 'A closed issue', 'status_id' => null, 'transitions' => array('reopenissue'), 'editable' => false, 'is_closed' => true);
foreach ($steps as $key => $step) {
$step_object = new \thebuggenie\core\entities\WorkflowStep();
$step_object->setWorkflow($workflow);
$step_object->setName($step['name']);
$step_object->setDescription($step['description']);
$step_object->setLinkedStatusID($step['status_id']);
$step_object->setIsClosed($step['is_closed']);
$step_object->setIsEditable($step['editable']);
$step_object->save();
$steps[$key]['step'] = $step_object;
}
$transitions = WorkflowTransition::loadFixtures($scope, $workflow, $steps);
$transition = new \thebuggenie\core\entities\WorkflowTransition();
$step = $steps['new']['step'];
$transition->setOutgoingStep($step);
$transition->setName('Issue created');
$transition->setWorkflow($workflow);
$transition->setDescription('This is the initial transition for issues using this workflow');
$transition->save();
$workflow->setInitialTransition($transition);
$workflow->save();
foreach ($steps as $step) {
foreach ($step['transitions'] as $transition) {
$step['step']->addOutgoingTransition($transitions[$transition]);
}
}
}
示例3: loadFixtures
public function loadFixtures(\thebuggenie\core\entities\Scope $scope)
{
$steps = array();
$steps[] = array('name' => 'New', 'description' => 'A new issue, not yet handled', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('new')->getID(), 'editable' => true, 'is_closed' => false);
$steps[] = array('name' => 'Investigating', 'description' => 'An issue that is being investigated, looked into or is by other means between new and unconfirmed state', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('investigating')->getID(), 'editable' => true, 'is_closed' => false);
$steps[] = array('name' => 'Confirmed', 'description' => 'An issue that has been confirmed', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('confirmed')->getID(), 'editable' => false, 'is_closed' => false);
$steps[] = array('name' => 'In progress', 'description' => 'An issue that is being adressed', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('beingworkedon')->getID(), 'editable' => false, 'is_closed' => false);
$steps[] = array('name' => 'Ready for testing', 'description' => 'An issue that has been marked fixed and is ready for testing', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('readyfortesting/qa')->getID(), 'editable' => false, 'is_closed' => false);
$steps[] = array('name' => 'Testing', 'description' => 'An issue where the proposed or implemented solution is currently being tested or approved', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('testing/qa')->getID(), 'editable' => false, 'is_closed' => false);
$steps[] = array('name' => 'Rejected', 'description' => 'A closed issue that has been rejected', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('notabug')->getID(), 'editable' => false, 'is_closed' => true);
$steps[] = array('name' => 'Closed', 'description' => 'A closed issue', 'status_id' => null, 'editable' => false, 'is_closed' => true);
foreach ($steps as $step) {
$crit = $this->getCriteria();
$crit->addInsert(self::WORKFLOW_ID, 1);
$crit->addInsert(self::SCOPE, $scope->getID());
$crit->addInsert(self::NAME, $step['name']);
$crit->addInsert(self::DESCRIPTION, $step['description']);
$crit->addInsert(self::STATUS_ID, $step['status_id']);
$crit->addInsert(self::CLOSED, $step['is_closed']);
$crit->addInsert(self::EDITABLE, $step['editable']);
$this->doInsert($crit);
}
}
示例4: runDoImportCSV
//.........这里部分代码省略.........
// Now check user exists for postedby
if (array_key_exists(self::CSV_ISSUE_POSTED_BY, $activerow) && isset($activerow[self::CSV_ISSUE_POSTED_BY])) {
if (!is_numeric($activerow[self::CSV_ISSUE_POSTED_BY])) {
$errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be a number)', array('%col' => self::CSV_ISSUE_POSTED_BY, '%row' => $i + 1));
} else {
try {
entities\User::getB2DBTable()->selectByID($activerow[self::CSV_ISSUE_POSTED_BY]);
} catch (\Exception $e) {
$errors[] = $this->getI18n()->__('Row %row column %col: user does not exist', array('%col' => self::CSV_ISSUE_POSTED_BY, '%row' => $i + 1));
}
}
}
// Now check milestone exists and is valid
if (array_key_exists(self::CSV_ISSUE_MILESTONE, $activerow) && isset($activerow[self::CSV_ISSUE_MILESTONE])) {
if (!is_numeric($activerow[self::CSV_ISSUE_MILESTONE])) {
$errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be a number)', array('%col' => self::CSV_ISSUE_MILESTONE, '%row' => $i + 1));
} else {
try {
$milestonetmp = entities\Milestone::getB2DBTable()->selectById($activerow[self::CSV_ISSUE_MILESTONE]);
if ($milestonetmp->getProject()->getID() != $activerow[self::CSV_ISSUE_PROJECT]) {
$errors[] = $this->getI18n()->__('Row %row column %col: milestone does not apply to the specified project', array('%col' => self::CSV_ISSUE_MILESTONE, '%row' => $i + 1));
}
} catch (\Exception $e) {
$errors[] = $this->getI18n()->__('Row %row column %col: milestone does not exist', array('%col' => self::CSV_ISSUE_MILESTONE, '%row' => $i + 1));
}
}
}
// status
if (array_key_exists(self::CSV_ISSUE_STATUS, $activerow) && isset($activerow[self::CSV_ISSUE_STATUS])) {
if (!is_numeric($activerow[self::CSV_ISSUE_STATUS])) {
$errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be a number)', array('%col' => self::CSV_ISSUE_STATUS, '%row' => $i + 1));
} else {
try {
entities\Status::getB2DBTable()->selectById($activerow[self::CSV_ISSUE_STATUS]);
} catch (\Exception $e) {
$errors[] = $this->getI18n()->__('Row %row column %col: status does not exist', array('%col' => self::CSV_ISSUE_STATUS, '%row' => $i + 1));
}
}
}
// resolution
if (array_key_exists(self::CSV_ISSUE_RESOLUTION, $activerow) && isset($activerow[self::CSV_ISSUE_RESOLUTION])) {
if (!is_numeric($activerow[self::CSV_ISSUE_RESOLUTION])) {
$errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be a number)', array('%col' => self::CSV_ISSUE_RESOLUTION, '%row' => $i + 1));
} else {
try {
entities\Resolution::getB2DBTable()->selectById($activerow[self::CSV_ISSUE_RESOLUTION]);
} catch (\Exception $e) {
$errors[] = $this->getI18n()->__('Row %row column %col: resolution does not exist', array('%col' => self::CSV_ISSUE_RESOLUTION, '%row' => $i + 1));
}
}
}
// priority
if (array_key_exists(self::CSV_ISSUE_PRIORITY, $activerow) && isset($activerow[self::CSV_ISSUE_PRIORITY])) {
if (!is_numeric($activerow[self::CSV_ISSUE_PRIORITY])) {
$errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be a number)', array('%col' => self::CSV_ISSUE_PRIORITY, '%row' => $i + 1));
} else {
try {
entities\Priority::getB2DBTable()->selectById($activerow[self::CSV_ISSUE_PRIORITY]);
} catch (\Exception $e) {
$errors[] = $this->getI18n()->__('Row %row column %col: priority does not exist', array('%col' => self::CSV_ISSUE_PRIORITY, '%row' => $i + 1));
}
}
}
// category
if (array_key_exists(self::CSV_ISSUE_CATEGORY, $activerow) && isset($activerow[self::CSV_ISSUE_CATEGORY])) {
if (!is_numeric($activerow[self::CSV_ISSUE_CATEGORY])) {
示例5: __
echo __('Connected status');
?>
</label></dt>
<dd>
<select name="status_id" id="step_status">
<option value="0"<?php
if (!$step->hasLinkedStatus()) {
echo " selected";
}
?>
><?php
echo __('Not connected to a status');
?>
</option>
<?php
foreach (\thebuggenie\core\entities\Status::getAll() as $status) {
?>
<option value="<?php
echo $status->getID();
?>
"<?php
if ($step->hasLinkedStatus() && $step->getLinkedStatus()->getID() == $status->getID()) {
echo " selected";
}
?>
><?php
echo $status->getName();
?>
</option>
<?php
}
示例6: componentBoardColumnheader
public function componentBoardColumnheader()
{
$this->statuses = \thebuggenie\core\entities\Status::getAll();
}
示例7: _populateStatusCount
protected function _populateStatusCount()
{
if ($this->_statuscount === null) {
$this->_statuscount = array();
$this->_statuscount[0] = array('open' => 0, 'closed' => 0, 'percentage' => 0);
foreach (Status::getAll() as $status_id => $status) {
$this->_statuscount[$status_id] = array('open' => 0, 'closed' => 0, 'percentage' => 0);
}
foreach (tables\Issues::getTable()->getStatusCountByProjectID($this->getID()) as $status_id => $status_count) {
$this->_statuscount[$status_id] = $status_count;
}
}
}
示例8: getAvailableValues
public function getAvailableValues()
{
switch ($this->getFilterKey()) {
case 'issuetype':
return framework\Context::isProjectContext() ? framework\Context::getCurrentProject()->getIssuetypeScheme()->getIssuetypes() : Issuetype::getAll();
case 'status':
return Status::getAll();
case 'category':
return Category::getAll();
case 'priority':
return Priority::getAll();
case 'severity':
return Severity::getAll();
case 'reproducability':
return Reproducability::getAll();
case 'resolution':
return Resolution::getAll();
case 'project_id':
return \thebuggenie\core\entities\Project::getAll();
case 'build':
return $this->_getAvailableBuildChoices();
case 'component':
return $this->_getAvailableComponentChoices();
case 'edition':
return $this->_getAvailableEditionChoices();
case 'milestone':
return $this->_getAvailableMilestoneChoices();
case 'subprojects':
$filters = array();
$projects = Project::getIncludingAllSubprojectsAsArray(framework\Context::getCurrentProject());
foreach ($projects as $project) {
if ($project->getID() == framework\Context::getCurrentProject()->getID()) {
continue;
}
$filters[$project->getID()] = $project;
}
return $filters;
case 'owner_user':
case 'assignee_user':
case 'posted_by':
return $this->_getAvailableUserChoices();
case 'owner_team':
case 'assignee_team':
return $this->_getAvailableTeamChoices();
default:
$customdatatype = CustomDatatype::getByKey($this->getFilterKey());
if ($customdatatype instanceof \thebuggenie\core\entities\CustomDatatype && $customdatatype->hasCustomOptions()) {
return $customdatatype->getOptions();
} else {
switch ($this->getFilterType()) {
case CustomDatatype::COMPONENTS_CHOICE:
return $this->_getAvailableComponentChoices();
case CustomDatatype::RELEASES_CHOICE:
return $this->_getAvailableBuildChoices();
case CustomDatatype::EDITIONS_CHOICE:
return $this->_getAvailableEditionChoices();
case CustomDatatype::MILESTONE_CHOICE:
return $this->_getAvailableMilestoneChoices();
case CustomDatatype::USER_CHOICE:
return $this->_getAvailableUserChoices();
case CustomDatatype::TEAM_CHOICE:
return $this->_getAvailableTeamChoices();
case CustomDatatype::CLIENT_CHOICE:
return $this->_getAvailableClientChoices();
case CustomDatatype::STATUS_CHOICE:
return Status::getAll();
default:
return array();
}
}
}
}
示例9: catch
}
} catch (\Exception $e) {
}
try {
switch ($customdatatype->getType()) {
case \thebuggenie\core\entities\CustomDatatype::EDITIONS_CHOICE:
$new_object = \thebuggenie\core\entities\Edition::getB2DBTable()->selectById($new_value);
break;
case \thebuggenie\core\entities\CustomDatatype::COMPONENTS_CHOICE:
$new_object = \thebuggenie\core\entities\Component::getB2DBTable()->selectById($new_value);
break;
case \thebuggenie\core\entities\CustomDatatype::RELEASES_CHOICE:
$new_object = \thebuggenie\core\entities\Build::getB2DBTable()->selectById($new_value);
break;
case \thebuggenie\core\entities\CustomDatatype::STATUS_CHOICE:
$new_object = \thebuggenie\core\entities\Status::getB2DBTable()->selectById($new_value);
break;
}
} catch (\Exception $e) {
}
$old_value = is_object($old_object) ? $old_object->getName() : \thebuggenie\core\framework\Context::getI18n()->__('Unknown');
$new_value = is_object($new_object) ? $new_object->getName() : \thebuggenie\core\framework\Context::getI18n()->__('Unknown');
break;
default:
$old_item = null;
$new_item = null;
try {
$old_item = $old_value ? new \thebuggenie\core\entities\CustomDatatypeOption($old_value) : null;
} catch (\Exception $e) {
}
try {
示例10: _processChanges
protected function _processChanges()
{
$related_issues_to_save = array();
$changed_properties = $this->_getChangedProperties();
if (count($changed_properties)) {
$is_saved_estimated = false;
$is_saved_spent = false;
$is_saved_assignee = false;
$is_saved_owner = false;
foreach ($changed_properties as $property => $value) {
$compare_value = is_object($this->{$property}) ? $this->{$property}->getID() : $this->{$property};
$original_value = $value['original_value'];
if ($original_value != $compare_value) {
switch ($property) {
case '_title':
$this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_TITLE, framework\Context::getI18n()->__("Title updated"), $original_value, $compare_value);
break;
case '_shortname':
$this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_SHORTNAME, framework\Context::getI18n()->__("Issue label updated"), $original_value, $compare_value);
break;
case '_description':
$this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_DESCRIPTION, framework\Context::getI18n()->__("Description updated"), $original_value, $compare_value);
break;
case '_reproduction_steps':
$this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_REPRODUCTIONSTEPS, framework\Context::getI18n()->__("Reproduction steps updated"), $original_value, $compare_value);
break;
case '_category':
if ($original_value != 0) {
$old_name = ($old_item = \thebuggenie\core\entities\Category::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Not determined');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = $this->getCategory() instanceof Datatype ? $this->getCategory()->getName() : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_CATEGORY, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_pain_bug_type':
if ($original_value != 0) {
$old_name = ($old_item = self::getPainTypesOrLabel('pain_bug_type', $original_value)) ? $old_item : framework\Context::getI18n()->__('Not determined');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = ($new_item = self::getPainTypesOrLabel('pain_bug_type', $value['current_value'])) ? $new_item : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_BUG_TYPE, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_pain_effect':
if ($original_value != 0) {
$old_name = ($old_item = self::getPainTypesOrLabel('pain_effect', $original_value)) ? $old_item : framework\Context::getI18n()->__('Not determined');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = ($new_item = self::getPainTypesOrLabel('pain_effect', $value['current_value'])) ? $new_item : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_EFFECT, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_pain_likelihood':
if ($original_value != 0) {
$old_name = ($old_item = self::getPainTypesOrLabel('pain_likelihood', $original_value)) ? $old_item : framework\Context::getI18n()->__('Not determined');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = ($new_item = self::getPainTypesOrLabel('pain_likelihood', $value['current_value'])) ? $new_item : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_LIKELIHOOD, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_user_pain':
$this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_CALCULATED, $original_value . ' ⇒ ' . $value['current_value']);
break;
case '_status':
if ($original_value != 0) {
$old_name = ($old_item = \thebuggenie\core\entities\Status::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = $this->getStatus() instanceof Datatype ? $this->getStatus()->getName() : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_STATUS, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_reproducability':
if ($original_value != 0) {
$old_name = ($old_item = \thebuggenie\core\entities\Reproducability::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = $this->getReproducability() instanceof Datatype ? $this->getReproducability()->getName() : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_REPRODUCABILITY, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_priority':
if ($original_value != 0) {
$old_name = ($old_item = \thebuggenie\core\entities\Priority::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = $this->getPriority() instanceof Datatype ? $this->getPriority()->getName() : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_PRIORITY, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_assignee_team':
case '_assignee_user':
if (!$is_saved_assignee) {
$new_name = $this->getAssignee() instanceof \thebuggenie\core\entities\common\Identifiable ? $this->getAssignee()->getName() : framework\Context::getI18n()->__('Not assigned');
if ($this->getAssignee() instanceof \thebuggenie\core\entities\User) {
$this->startWorkingOnIssue($this->getAssignee());
}
$this->addLogEntry(tables\Log::LOG_ISSUE_ASSIGNED, $new_name);
//.........这里部分代码省略.........
示例11: componentProjectSettings
public function componentProjectSettings()
{
$this->statustypes = entities\Status::getAll();
}
示例12: __
?>
"<?php
if ($issue instanceof \thebuggenie\core\entities\Issue && $issue->getCustomField($field) instanceof \thebuggenie\core\entities\Milestone && $issue->getCustomField($field)->getID() == $choice->getID()) {
?>
selected<?php
}
?>
><?php
echo __($choice->getName());
?>
</option>
<?php
}
break;
case \thebuggenie\core\entities\CustomDatatype::STATUS_CHOICE:
foreach (\thebuggenie\core\entities\Status::getAll() as $choice) {
?>
<option value="<?php
echo $choice->getID();
?>
"<?php
if ($issue instanceof \thebuggenie\core\entities\Issue && $issue->getCustomField($field) instanceof \thebuggenie\core\entities\Edition && $issue->getCustomField($field)->getID() == $choice->getID()) {
?>
selected<?php
}
?>
><?php
echo __($choice->getName());
?>
</option>
<?php
示例13: runAddAffected
public function runAddAffected(framework\Request $request)
{
framework\Context::loadLibrary('ui');
try {
$issue = entities\Issue::getB2DBTable()->selectById($request['issue_id']);
$statuses = entities\Status::getAll();
switch ($request['item_type']) {
case 'edition':
if (!$issue->getProject()->isEditionsEnabled()) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Editions are disabled')));
} elseif (!$issue->canEditAffectedEditions()) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('You are not allowed to do this')));
}
$edition = entities\Edition::getB2DBTable()->selectById($request['which_item_edition']);
if (tables\IssueAffectsEdition::getTable()->getByIssueIDandEditionID($issue->getID(), $edition->getID())) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('%item is already affected by this issue', array('%item' => $edition->getName()))));
}
$result = $issue->addAffectedEdition($edition);
if ($result !== false) {
$itemtype = 'edition';
$item = $result;
$itemtypename = framework\Context::getI18n()->__('Edition');
$content = get_component_html('main/affecteditem', array('item' => $item, 'itemtype' => $itemtype, 'itemtypename' => $itemtypename, 'issue' => $issue, 'statuses' => $statuses));
}
$message = framework\Context::getI18n()->__('Edition <b>%edition</b> is now affected by this issue', array('%edition' => $edition->getName()), true);
break;
case 'component':
if (!$issue->getProject()->isComponentsEnabled()) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Components are disabled')));
} elseif (!$issue->canEditAffectedComponents()) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('You are not allowed to do this')));
}
$component = entities\Component::getB2DBTable()->selectById($request['which_item_component']);
if (tables\IssueAffectsComponent::getTable()->getByIssueIDandComponentID($issue->getID(), $component->getID())) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('%item is already affected by this issue', array('%item' => $component->getName()))));
}
$result = $issue->addAffectedComponent($component);
if ($result !== false) {
$itemtype = 'component';
$item = $result;
$itemtypename = framework\Context::getI18n()->__('Component');
$content = get_component_html('main/affecteditem', array('item' => $item, 'itemtype' => $itemtype, 'itemtypename' => $itemtypename, 'issue' => $issue, 'statuses' => $statuses));
}
$message = framework\Context::getI18n()->__('Component <b>%component</b> is now affected by this issue', array('%component' => $component->getName()), true);
break;
case 'build':
if (!$issue->getProject()->isBuildsEnabled()) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Releases are disabled')));
} elseif (!$issue->canEditAffectedBuilds()) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('You are not allowed to do this')));
}
$build = entities\Build::getB2DBTable()->selectById($request['which_item_build']);
if (tables\IssueAffectsBuild::getTable()->getByIssueIDandBuildID($issue->getID(), $build->getID())) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('%item is already affected by this issue', array('%item' => $build->getName()))));
}
$result = $issue->addAffectedBuild($build);
if ($result !== false) {
$itemtype = 'build';
$item = $result;
$itemtypename = framework\Context::getI18n()->__('Release');
$content = get_component_html('main/affecteditem', array('item' => $item, 'itemtype' => $itemtype, 'itemtypename' => $itemtypename, 'issue' => $issue, 'statuses' => $statuses));
}
$message = framework\Context::getI18n()->__('Release <b>%build</b> is now affected by this issue', array('%build' => $build->getName()), true);
break;
default:
throw new \Exception('Internal error');
}
$editions = array();
$components = array();
$builds = array();
if ($issue->getProject()->isEditionsEnabled()) {
$editions = $issue->getEditions();
}
if ($issue->getProject()->isComponentsEnabled()) {
$components = $issue->getComponents();
}
if ($issue->getProject()->isBuildsEnabled()) {
$builds = $issue->getBuilds();
}
$count = count($editions) + count($components) + count($builds);
return $this->renderJSON(array('content' => $content, 'message' => $message, 'itemcount' => $count));
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $e->getMessage()));
}
}
示例14: getLinkedStatus
/**
* Return this steps linked status if any
*
* @return \thebuggenie\core\entities\Status
*/
public function getLinkedStatus()
{
if (is_numeric($this->_status_id)) {
try {
$this->_status_id = \thebuggenie\core\entities\Status::getB2DBTable()->selectById($this->_status_id);
} catch (\Exception $e) {
$this->_status_id = null;
}
}
return $this->_status_id;
}
示例15: runBulkUpdateIssues
public function runBulkUpdateIssues(framework\Request $request)
{
$issue_ids = $request['issue_ids'];
$options = array('issue_ids' => array_values($issue_ids));
framework\Context::loadLibrary('common');
$options['last_updated'] = tbg_formatTime(time(), 20);
if (!empty($issue_ids)) {
$options['bulk_action'] = $request['bulk_action'];
switch ($request['bulk_action']) {
case 'assign_milestone':
$milestone = null;
if ($request['milestone'] == 'new') {
$milestone = new entities\Milestone();
$milestone->setProject(framework\Context::getCurrentProject());
$milestone->setName($request['milestone_name']);
$milestone->save();
$options['milestone_url'] = framework\Context::getRouting()->generate('agile_milestone', array('project_key' => $milestone->getProject()->getKey(), 'milestone_id' => $milestone->getID()));
} elseif ($request['milestone']) {
$milestone = new entities\Milestone($request['milestone']);
}
$milestone_id = $milestone instanceof entities\Milestone ? $milestone->getID() : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$issue->setMilestone($milestone_id);
$issue->save();
}
}
$options['milestone_id'] = $milestone_id;
$options['milestone_name'] = $milestone_id ? $milestone->getName() : '-';
break;
case 'set_status':
if (is_numeric($request['status'])) {
$status = new entities\Status($request['status']);
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$issue->setStatus($status->getID());
$issue->save();
}
}
$options['status'] = array('color' => $status->getColor(), 'name' => $status->getName(), 'id' => $status->getID());
}
break;
case 'set_severity':
if (is_numeric($request['severity'])) {
$severity = $request['severity'] ? new entities\Severity($request['severity']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$severity_id = $severity instanceof entities\Severity ? $severity->getID() : 0;
$issue->setSeverity($severity_id);
$issue->save();
}
}
$options['severity'] = array('name' => $severity instanceof entities\Severity ? $severity->getName() : '-', 'id' => $severity instanceof entities\Severity ? $severity->getID() : 0);
}
break;
case 'set_resolution':
if (is_numeric($request['resolution'])) {
$resolution = $request['resolution'] ? new entities\Resolution($request['resolution']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$resolution_id = $resolution instanceof entities\Resolution ? $resolution->getID() : 0;
$issue->setResolution($resolution_id);
$issue->save();
}
}
$options['resolution'] = array('name' => $resolution instanceof entities\Resolution ? $resolution->getName() : '-', 'id' => $resolution instanceof entities\Resolution ? $resolution->getID() : 0);
}
break;
case 'set_priority':
if (is_numeric($request['priority'])) {
$priority = $request['priority'] ? new entities\Priority($request['priority']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$priority_id = $priority instanceof entities\Priority ? $priority->getID() : 0;
$issue->setPriority($priority_id);
$issue->save();
}
}
$options['priority'] = array('name' => $priority instanceof entities\Priority ? $priority->getName() : '-', 'id' => $priority instanceof entities\Priority ? $priority->getID() : 0);
}
break;
case 'set_category':
if (is_numeric($request['category'])) {
$category = $request['category'] ? new entities\Category($request['category']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$category_id = $category instanceof entities\Category ? $category->getID() : 0;
$issue->setCategory($category_id);
$issue->save();
}
}
$options['category'] = array('name' => $category instanceof entities\Category ? $category->getName() : '-', 'id' => $category instanceof entities\Category ? $category->getID() : 0);
}
break;
//.........这里部分代码省略.........