Example #1
0
 /**
  * Get consistency errors
  * @param int $teamid
  * @return mixed[]
  */
 private function getTeamConsistencyErrors($teamid)
 {
     if (self::$logger->isDebugEnabled()) {
         self::$logger->debug("getTeamConsistencyErrors teamid={$teamid}");
     }
     // get team projects
     $issueList = TeamCache::getInstance()->getTeam($teamid)->getTeamIssueList(true, false);
     if (self::$logger->isDebugEnabled()) {
         self::$logger->debug("getTeamConsistencyErrors nbIssues=" . count($issueList));
     }
     #$ccheck = new ConsistencyCheck2($issueList);
     $ccheck = new ConsistencyCheck2($issueList, $teamid);
     $cerrList = $ccheck->check();
     $cerrs = NULL;
     if (count($cerrList) > 0) {
         $i = 0;
         foreach ($cerrList as $cerr) {
             $i += 1;
             if (NULL != $cerr->userId) {
                 $user = UserCache::getInstance()->getUser($cerr->userId);
             } else {
                 $user = NULL;
             }
             if (Issue::exists($cerr->bugId)) {
                 $issue = IssueCache::getInstance()->getIssue($cerr->bugId);
                 $summary = $issue->getSummary();
                 $projName = $issue->getProjectName();
                 $refExt = $issue->getTcId();
             } else {
                 $summary = '';
                 $projName = '';
             }
             $cerrs[$i] = array('userName' => isset($user) ? $user->getName() : '', 'issueURL' => NULL == $cerr->bugId ? '' : Tools::issueInfoURL($cerr->bugId, $summary), 'mantisURL' => NULL == $cerr->bugId ? '' : Tools::mantisIssueURL($cerr->bugId, $summary, true), 'extRef' => NULL == $refExt ? '' : $refExt, 'date' => NULL == $cerr->timestamp ? '' : date("Y-m-d", $cerr->timestamp), 'status' => NULL == $cerr->status ? '' : Constants::$statusNames[$cerr->status], 'severity' => $cerr->getLiteralSeverity(), 'project' => $projName, 'desc' => $cerr->desc, 'summary' => $summary);
         }
     }
     return $cerrs;
 }
Example #2
0
 /**
  * @return ConsistencyError2[]
  */
 public function getConsistencyErrors()
 {
     $issueSel = $this->getIssueSelection();
     $issueList = $issueSel->getIssueList();
     $ccheck = new ConsistencyCheck2($issueList, $this->teamid);
     return $ccheck->check();
 }
Example #3
0
 /**
  * @return ConsistencyError2[]
  */
 public function getConsistencyErrors()
 {
     $issueSel = $this->getIssueSelection();
     $issueList = $issueSel->getIssueList();
     $ccheck = new ConsistencyCheck2($issueList, $this->teamid);
     $cerrList = $ccheck->check();
     // check if sold days is set.
     if (0 != $this->totalSoldDays) {
         $checkTotalSoldDays = $this->getTotalSoldDays() - $this->getIssueSelection()->mgrEffortEstim - $this->getProvisionDays();
         $checkTotalSoldDays = round($checkTotalSoldDays, 2);
         if (0 != $checkTotalSoldDays) {
             $errMsg = T_("The total charge (MgrEffortEstim + Provisions) should be equal to the 'Sold Charge'") . ' (' . T_("balance") . " = {$checkTotalSoldDays} " . T_('days') . ')';
             $cerr = new ConsistencyError2(NULL, NULL, NULL, NULL, $errMsg);
             array_unshift($cerrList, $cerr);
         }
     }
     return $cerrList;
 }
Example #4
0
 protected function display()
 {
     if (Tools::isConnectedUser()) {
         $user = UserCache::getInstance()->getUser($_SESSION['userid']);
         $teamid = $_SESSION['teamid'];
         $teamList = $user->getTeamList();
         if (count($teamList) > 0) {
             // --- define the list of tasks the user can display
             // All projects from teams where I'm a Developper or Manager AND Observer
             $allProject[0] = T_('(all)');
             $dTeamList = $user->getDevTeamList();
             $devProjList = count($dTeamList) > 0 ? $user->getProjectList($dTeamList, true, false) : array();
             $managedTeamList = $user->getManagedTeamList();
             $managedProjList = count($managedTeamList) > 0 ? $user->getProjectList($managedTeamList, true, false) : array();
             $oTeamList = $user->getObservedTeamList();
             $observedProjList = count($oTeamList) > 0 ? $user->getProjectList($oTeamList, true, false) : array();
             $projList = $allProject + $devProjList + $managedProjList + $observedProjList;
             // if 'support' is set in the URL, display graphs for 'with/without Support'
             $displaySupport = filter_input(INPUT_GET, 'support') ? true : false;
             if ($displaySupport) {
                 $this->smartyHelper->assign('support', $displaySupport);
             }
             if (filter_input(INPUT_GET, 'bugid')) {
                 $bug_id = Tools::getSecureGETIntValue('bugid', 0);
             } else {
                 if (isset($_SESSION['bugid'])) {
                     $bug_id = $_SESSION['bugid'];
                 } else {
                     $bug_id = 0;
                     unset($_SESSION['bugid']);
                 }
             }
             $bugs = NULL;
             $projects = NULL;
             if ($bug_id != 0) {
                 try {
                     $issue = IssueCache::getInstance()->getIssue($bug_id);
                     $defaultProjectid = $issue->getProjectId();
                     $bugs = SmartyTools::getBugs($defaultProjectid, $bug_id);
                     if (array_key_exists($defaultProjectid, $projList) && array_key_exists($bug_id, $bugs)) {
                         $consistencyErrors = NULL;
                         $ccheck = new ConsistencyCheck2(array($issue));
                         $cerrList = $ccheck->check();
                         if (0 != count($cerrList)) {
                             foreach ($cerrList as $cerr) {
                                 $consistencyErrors[] = array('severity' => $cerr->getLiteralSeverity(), 'severityColor' => $cerr->getSeverityColor(), 'desc' => $cerr->desc);
                             }
                             $this->smartyHelper->assign('ccheckButtonTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                             $this->smartyHelper->assign('ccheckBoxTitle', count($consistencyErrors) . ' ' . T_("Errors"));
                             $this->smartyHelper->assign('ccheckErrList', $consistencyErrors);
                         }
                         $this->smartyHelper->assign('isManager', $user->isTeamManager($teamid));
                         $this->smartyHelper->assign('isObserver', $user->isTeamObserver($teamid));
                         $isManagerView = array_key_exists($issue->getProjectId(), $managedProjList) ? true : false;
                         $isObserverView = array_key_exists($issue->getProjectId(), $observedProjList) ? true : false;
                         $this->smartyHelper->assign('issueGeneralInfo', IssueInfoTools::getIssueGeneralInfo($issue, $isManagerView || $isObserverView, $displaySupport));
                         $timeTracks = $issue->getTimeTracks();
                         $this->smartyHelper->assign('jobDetails', $this->getJobDetails($timeTracks));
                         $this->smartyHelper->assign('timeDrift', $this->getTimeDrift($issue));
                         $this->smartyHelper->assign('months', $this->getCalendar($issue, $timeTracks));
                         // set Commands I belong to
                         $parentCmds = $this->getParentCommands($issue);
                         $this->smartyHelper->assign('parentCommands', $parentCmds);
                         $this->smartyHelper->assign('nbParentCommands', count($parentCmds));
                     }
                     $projects = SmartyTools::getSmartyArray($projList, $defaultProjectid);
                     $_SESSION['projectid'] = $defaultProjectid;
                     $_SESSION['bugid'] = $bug_id;
                     // Dashboard
                     IssueInfoTools::dashboardSettings($this->smartyHelper, $issue, $this->session_userid, $this->teamid);
                 } catch (Exception $e) {
                     self::$logger->warn("issue {$bug_id} not found in mantis DB !");
                     unset($_SESSION['bugid']);
                 }
             } else {
                 try {
                     $defaultProjectid = 0;
                     if (isset($_SESSION['projectid']) && 0 != $_SESSION['projectid']) {
                         $defaultProjectid = $_SESSION['projectid'];
                         $bugs = SmartyTools::getBugs($defaultProjectid, $bug_id);
                     } else {
                         $bugs = SmartyTools::getBugs($defaultProjectid, $bug_id, $projList);
                     }
                     $projects = SmartyTools::getSmartyArray($projList, $defaultProjectid);
                 } catch (Exception $e) {
                     self::$logger->warn("issue {$bug_id} not found in mantis DB !");
                     unset($_SESSION['bugid']);
                 }
             }
             $this->smartyHelper->assign('bugs', $bugs);
             $this->smartyHelper->assign('projects', $projects);
         }
     }
 }
Example #5
0
 /**
  * Get consistency errors
  * @return mixed[]
  */
 private function getConsistencyErrors()
 {
     $consistencyErrors = array();
     // if null, array_merge fails !
     if (0 != $this->teamid) {
         // only this team's projects
         #$teamList = $this->teamList;
         $teamList = array($this->teamid => $this->teamList[$this->teamid]);
         // except disabled projects
         $projList = $this->session_user->getProjectList($teamList, true, false);
         $issueList = $this->session_user->getAssignedIssues($projList, true);
         $ccheck = new ConsistencyCheck2($issueList, $this->teamid);
         $cerrList = $ccheck->check();
         if (count($cerrList) > 0) {
             foreach ($cerrList as $cerr) {
                 if ($this->session_user->getId() == $cerr->userId) {
                     $issue = IssueCache::getInstance()->getIssue($cerr->bugId);
                     $titleAttr = array(T_('Project') => $issue->getProjectName(), T_('Summary') => $issue->getSummary());
                     $consistencyErrors[] = array('issueURL' => Tools::issueInfoURL($cerr->bugId, $titleAttr), 'status' => Constants::$statusNames[$cerr->status], 'desc' => $cerr->desc);
                 }
             }
         }
     }
     return $consistencyErrors;
 }
Example #6
0
 /**
  * get consistency errors
  * @return ConsistencyError2[]
  */
 public function getConsistencyErrors()
 {
     $ccheck = new ConsistencyCheck2($this->issueList);
     return $ccheck->check();
 }