Esempio n. 1
0
 /**
  * Add a related issue
  * 
  * @param TBGIssue $related_issue
  * 
  * @return boolean
  */
 public function addChildIssue(TBGIssue $related_issue)
 {
     if (!($row = TBGIssueRelationsTable::getTable()->getIssueRelation($this->getID(), $related_issue->getID()))) {
         $res = TBGIssueRelationsTable::getTable()->addChildIssue($this->getID(), $related_issue->getID());
         $this->_child_issues = null;
         $related_issue->addLogEntry(TBGLogTable::LOG_ISSUE_DEPENDS, TBGContext::getI18n()->__('%issuetype %issue_no now depends on the solution of this %this_issuetype', array('%this_issuetype' => $related_issue->getIssueType()->getName(), '%issuetype' => $this->getIssueType()->getName(), '%issue_no' => $this->getFormattedIssueNo())));
         $this->addLogEntry(TBGLogTable::LOG_ISSUE_DEPENDS, TBGContext::getI18n()->__('This %this_issuetype now depends on the solution of %issuetype %issue_no', array('%this_issuetype' => $this->getIssueType()->getName(), '%issuetype' => $related_issue->getIssueType()->getName(), '%issue_no' => $related_issue->getFormattedIssueNo())));
         return true;
     }
     return false;
 }
Esempio n. 2
0
 static function resultGrouping(TBGIssue $issue, $groupby, $cc, $prevgroup_id)
 {
     $i18n = TBGContext::getI18n();
     $showtablestart = false;
     $showheader = false;
     $groupby_id = 0;
     $groupby_description = '';
     if ($cc == 1) {
         $showtablestart = true;
     }
     if ($groupby != '') {
         switch ($groupby) {
             case 'category':
                 if ($issue->getCategory() instanceof TBGCategory) {
                     $groupby_id = $issue->getCategory()->getID();
                     $groupby_description = $issue->getCategory()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('Unknown');
                 }
                 break;
             case 'status':
                 if ($issue->getStatus() instanceof TBGStatus) {
                     $groupby_id = $issue->getStatus()->getID();
                     $groupby_description = $issue->getStatus()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('Unknown');
                 }
                 break;
             case 'severity':
                 if ($issue->getSeverity() instanceof TBGSeverity) {
                     $groupby_id = $issue->getSeverity()->getID();
                     $groupby_description = $issue->getSeverity()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('Unknown');
                 }
                 break;
             case 'resolution':
                 if ($issue->getResolution() instanceof TBGResolution) {
                     $groupby_id = $issue->getResolution()->getID();
                     $groupby_description = $issue->getResolution()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('Unknown');
                 }
                 break;
             case 'edition':
                 if ($issue->getEditions()) {
                     $groupby_id = $issue->getFirstAffectedEdition()->getID();
                     $groupby_description = $issue->getFirstAffectedEdition()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('None');
                 }
                 break;
             case 'build':
                 if ($issue->getBuilds()) {
                     $groupby_id = $issue->getFirstAffectedBuild()->getID();
                     $groupby_description = $issue->getFirstAffectedBuild()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('None');
                 }
                 break;
             case 'component':
                 if ($issue->getComponents()) {
                     $groupby_id = $issue->getFirstAffectedComponent()->getID();
                     $groupby_description = $issue->getFirstAffectedComponent()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('None');
                 }
                 break;
             case 'priority':
                 if ($issue->getPriority() instanceof TBGPriority) {
                     $groupby_id = $issue->getPriority()->getID();
                     $groupby_description = $issue->getPriority()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('Unknown');
                 }
                 break;
             case 'issuetype':
                 if ($issue->getIssueType() instanceof TBGIssuetype) {
                     $groupby_id = $issue->getIssueType()->getID();
                     $groupby_description = $issue->getIssueType()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('Unknown');
                 }
                 break;
             case 'milestone':
                 if ($issue->getMilestone() instanceof TBGMilestone) {
                     $groupby_id = $issue->getMilestone()->getID();
                     $groupby_description = $issue->getMilestone()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('Not targetted');
                 }
                 break;
             case 'assignee':
                 if ($issue->getAssignee() instanceof TBGIdentifiableClass) {
                     $groupby_id = $issue->getAssignee()->getID();
                     $groupby_description = $issue->getAssignee()->getName();
                 } else {
                     $groupby_id = 0;
                     $groupby_description = $i18n->__('Not assigned');
                 }
                 break;
             case 'state':
                 if ($issue->isClosed()) {
                     $groupby_id = TBGIssue::STATE_CLOSED;
                     $groupby_description = $i18n->__('Closed');
                 } else {
                     $groupby_id = TBGIssue::STATE_OPEN;
                     $groupby_description = $i18n->__('Open');
                 }
                 break;
         }
         if ($groupby_id !== $prevgroup_id) {
             $showtablestart = true;
             $showheader = true;
         }
         $prevgroup_id = $groupby_id;
     }
     return array($showtablestart, $showheader, $prevgroup_id, $groupby_description);
 }
 /**
  * Add a related issue
  * 
  * @param TBGIssue $related_issue
  * 
  * @return boolean
  */
 public function addChildIssue(TBGIssue $related_issue)
 {
     if (!($row = B2DB::getTable('TBGIssueRelationsTable')->getIssueRelation($this->getID(), $related_issue->getID()))) {
         $res = B2DB::getTable('TBGIssueRelationsTable')->addChildIssue($this->getID(), $related_issue->getID());
         $this->_child_issues = null;
         $related_issue->addLogEntry(TBGLogTable::LOG_ISSUE_DEPENDS, TBGContext::getI18n()->__('%issuetype% %issue_no% now depends on the solution of this %this_issuetype%', array('%this_issuetype%' => $related_issue->getIssueType()->getName(), '%issuetype%' => $this->getIssueType()->getName(), '%issue_no%' => $this->getFormattedIssueNo())));
         $related_issue->addSystemComment(TBGContext::getI18n()->__('Dependancy added'), TBGContext::getI18n()->__('%issuetype% %issue_no% now depends on the solution of this %this_issuetype%', array('%this_issuetype%' => $related_issue->getIssueType()->getName(), '%issuetype%' => $this->getIssueType()->getName(), '%issue_no%' => $this->getFormattedIssueNo())), TBGContext::getUser()->getID());
         $this->addLogEntry(TBGLogTable::LOG_ISSUE_DEPENDS, TBGContext::getI18n()->__('This %this_issuetype% now depends on the solution of %issuetype% %issue_no%', array('%this_issuetype%' => $this->getIssueType()->getName(), '%issuetype%' => $related_issue->getIssueType()->getName(), '%issue_no%' => $related_issue->getFormattedIssueNo())));
         $comment = $this->addSystemComment(TBGContext::getI18n()->__('Dependancy added'), TBGContext::getI18n()->__('This %this_issuetype% now depends on the solution of %issuetype% %issue_no%', array('%this_issuetype%' => $this->getIssueType()->getName(), '%issuetype%' => $related_issue->getIssueType()->getName(), '%issue_no%' => $related_issue->getFormattedIssueNo())), TBGContext::getUser()->getID());
         return $comment instanceof TBGComment ? $comment : true;
     }
     return false;
 }