/** * 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; }
function displayPage() { // relative path ("./" or "../") // absolute path is preferable for IE/W3C compatibility $rootWebSite = is_null(Constants::$codevURL) ? '../' : Constants::$codevURL; if ('/' !== substr($rootWebSite, -1)) { $rootWebSite .= '/'; } $rootMantisURL = is_null(Constants::$mantisURL) ? '../../mantis/' : Constants::$mantisURL; if ('/' !== substr($rootMantisURL, -1)) { $rootMantisURL .= '/'; } echo "<h1 class='center'>Manual steps</h1>"; echo "<div style='margin-top:6em;'>"; // check global configuration $cerrList = ConsistencyCheck2::checkMantisDefaultProjectWorkflow(); if (count($cerrList) > 0) { echo "<h2>" . T_("Create a default project workflow in Mantis") . "</h2>"; echo "<span class='help_font'>" . T_("The Mantis default workflow is not load in the database unless you change it with the Mantis administration GUI.") . "</span>"; echo '<ul>'; echo '<li>' . T_("Login to Mantis as 'Administrator'.") . '</li>'; echo '<li>' . T_("Select project 'All projects'") . '</li>'; echo '<li>' . T_("Go to") . " <a href=' " . $rootMantisURL . "manage_config_workflow_page.php' target='_blank't>" . T_("manage workflow transitions") . '</a></li>'; echo '<li>' . T_("Change the workflow (change one of the 'next status' checkboxes)") . '</li>'; echo '<li>' . T_("Click the 'Update Configuration' button") . '</li>'; echo '<li>' . T_("Rollback the workflow to the initial state") . '</li>'; echo '<li>' . T_("Click the 'Update Configuration' button again") . '</li>'; echo '</ul>'; echo '<br>'; } echo "<h2>" . T_("Check Mantis Plugins") . "</h2>"; echo '<ul>'; echo '<li>' . T_("Login to Mantis as 'Administrator'.") . '</li>'; echo '<li>' . T_("Go to") . " <a href=' " . $rootMantisURL . "manage_plugin_page.php' target='_blank't>" . T_("manage plugins") . '</a></li>'; echo '<li>' . T_('Check that the <b>CodevTT</b> plugin is installed and activated.') . '</li>'; echo '<li>' . T_('Check that the <b>FilterBugList</b> plugin is installed and activated') . '</li>'; echo '</ul>'; echo '<br>'; echo "<h2>" . T_("Install Firefox Greasemonkey addon") . "</h2>"; echo "<span class='help_font'>" . T_("Note: This step is optional") . "</span>"; echo "<ul>\n <li>" . T_("Install addon:") . " <a href='https://addons.mozilla.org/fr/firefox/addon/greasemonkey/' target='_blank't>greasemonkey</a></li>\n <li>" . T_("Load script:") . " <a href='" . $rootWebSite . "mantis_monkey.user.js' target='_blank't>mantis_monkey.user.js</a></li>\n </ul>"; echo "</div>"; echo "<div style='text-align: center;'>\n"; echo "<input type=button style='font-size:150%' value='" . T_("Done !") . "' onClick=\"location.href='install_step5.php'\">\n"; echo "</div>\n"; }
/** * @return ConsistencyError2[] */ public function getConsistencyErrors() { $issueSel = $this->getIssueSelection(); $issueList = $issueSel->getIssueList(); $ccheck = new ConsistencyCheck2($issueList, $this->teamid); return $ccheck->check(); }
/** * @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; }
/** * Initialize complex static variables * @static */ public static function staticInit() { self::$logger = Logger::getLogger(__CLASS__); self::$defaultCheckList = array('checkBacklogOnResolved' => 1, 'checkBadBacklog' => 1, 'checkEffortEstim' => 1, 'checkTimeTracksOnNewIssues' => 1, 'checkIssuesNotInCommand' => 0, 'checkCommandsNotInCommandset' => 0, 'checkCommandSetNotInServiceContract' => 0, 'checkUnassignedTasks' => 0, 'checkTimetracksOnRemovedIssues' => 0); self::$checkDescriptionList = array('checkBacklogOnResolved' => T_('Backlog on resolved issues should be 0'), 'checkBadBacklog' => T_('Backlog on unresolved issues should not be 0'), 'checkEffortEstim' => T_('EffortEstim should not be 0'), 'checkTimeTracksOnNewIssues' => T_('There should be no timetracks on "new" issues '), 'checkIssuesNotInCommand' => T_('Issues should be referenced in a Command'), 'checkCommandsNotInCommandset' => T_('Commands should be referenced in a CommandSet'), 'checkCommandSetNotInServiceContract' => T_('CommandSets should be referenced in a ServiceContract'), 'checkUnassignedTasks' => T_('Issues should be assigned to someone'), 'checkTimetracksOnRemovedIssues' => T_('Check timetracks on removed issues (not needed if mantis plugin is enabled)')); /* * checkMgrEffortEstim * It is now allowed to have MgrEE = 0 * tasks having MgrEE > 0 are tasks that have been initialy defined at the Command's creation. * tasks having MgrEE = 0 are internal_tasks */ }
/** * Get the consistency errors * @param int $teamid * @return mixed[][] */ private function getConsistencyErrors($teamid) { $issueList = TeamCache::getInstance()->getTeam($teamid)->getTeamIssueList(TRUE); $ccheck = new ConsistencyCheck2($issueList, $teamid); $cerrList = $ccheck->checkBadBacklog(); #$cerrList2 = $ccheck->checkUnassignedTasks(); $consistencyErrors = NULL; if (count($cerrList) > 0 || count($cerrList2) > 0) { $consistencyErrors = array(); foreach ($cerrList as $cerr) { $user = UserCache::getInstance()->getUser($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), 'issueStatus' => Constants::$statusNames[$cerr->status], 'date' => date("Y-m-d", $cerr->timestamp), 'user' => $user->getName(), 'severity' => $cerr->getLiteralSeverity(), 'severityColor' => $cerr->getSeverityColor(), 'desc' => $cerr->desc); } /* if (0 != count($cerrList2)) { $consistencyErrors[] = array( 'issueURL' => '', 'issueStatus' => '-', 'date' => '-', 'user' => '('.T_('unknown').')', 'severity' => T_('Warning'), 'severityColor' => 'color:orange', 'desc' => count($cerrList2).' '.T_('tasks are not assigned to anybody.') ); } */ } return $consistencyErrors; }
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); } } }
/** * Get consistency errors * @param TimeTracking $timeTracking * @return mixed[] */ private function getConsistencyErrors(TimeTracking $timeTracking) { $consistencyErrors = array(); // if null, array_merge fails ! $cerrList = ConsistencyCheck2::checkIncompleteDays($timeTracking); if (count($cerrList) > 0) { foreach ($cerrList as $cerr) { $user = UserCache::getInstance()->getUser($cerr->userId); $consistencyErrors[] = array('date' => date("Y-m-d", $cerr->timestamp), 'user' => $user->getName(), 'severity' => $cerr->getLiteralSeverity(), 'severityColor' => $cerr->getSeverityColor(), 'desc' => $cerr->desc); } } return $consistencyErrors; }
/** * 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; }
/** * get consistency errors * @return ConsistencyError2[] */ public function getConsistencyErrors() { $ccheck = new ConsistencyCheck2($this->issueList); return $ccheck->check(); }
/** * display missing imputations * * @param int $userid * @param int $team_id * @return mixed[] consistencyErrors */ private function getConsistencyErrors($userid, $team_id = NULL) { $user = UserCache::getInstance()->getUser($userid); $startTimestamp = $user->getArrivalDate($team_id); $endTimestamp = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $timeTracking = new TimeTracking($startTimestamp, $endTimestamp, $team_id); $cerrList = ConsistencyCheck2::checkIncompleteDays($timeTracking, $userid); $consistencyErrors = array(); if (count($cerrList) > 0) { foreach ($cerrList as $cerr) { // skip alerts on today if ($endTimestamp == $cerr->timestamp) { continue; } if ($userid == $cerr->userId) { $consistencyErrors[] = array('date' => date("Y-m-d", $cerr->timestamp), 'severity' => $cerr->getLiteralSeverity(), 'severityColor' => $cerr->getSeverityColor(), 'desc' => $cerr->desc); } } } return $consistencyErrors; }