Ejemplo n.º 1
0
 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $clientId = $session->get('client/id');
     $loggedInUserId = $session->get('user/id');
     $issueId = $request->get('id');
     $issueQueryParameters = array('issue_id' => $issueId);
     $issue = $this->getRepository(Issue::class)->getByParameters($issueQueryParameters, $loggedInUserId);
     $projectId = $issue['issue_project_id'];
     $issueProject = $this->getRepository(YongoProject::class)->getById($projectId);
     // before going further, check to is if the issue project belongs to the client
     if ($clientId != $issueProject['client_id']) {
         return new RedirectResponse('/general-settings/bad-link-access-denied');
     }
     $session->set('selected_product_id', SystemProduct::SYS_PRODUCT_YONGO);
     if ($request->request->has('move_issue_step_4')) {
         $currentDate = Util::getServerCurrentDateTime();
         $oldIssueData = $this->getRepository(Issue::class)->getByParameters(array('issue_id' => $issueId), $loggedInUserId);
         $oldIssueData['component'] = $this->getRepository(IssueComponent::class)->getByIssueIdAndProjectId($issueId, $projectId, 'array', 'name');
         if ($oldIssueData['component'] == null) {
             $oldIssueData['component'] = array();
         }
         $oldIssueData['affects_version'] = $this->getRepository(IssueVersion::class)->getByIssueIdAndProjectId($issueId, $projectId, Issue::ISSUE_AFFECTED_VERSION_FLAG, 'array', 'name');
         if ($oldIssueData['affects_version'] == null) {
             $oldIssueData['affects_version'] = array();
         }
         $oldIssueData['fix_version'] = $this->getRepository(IssueVersion::class)->getByIssueIdAndProjectId($issueId, $projectId, Issue::ISSUE_FIX_VERSION_FLAG, 'array', 'name');
         if ($oldIssueData['fix_version'] == null) {
             $oldIssueData['fix_version'] = array();
         }
         $this->getRepository(IssueComponent::class)->deleteByIssueId($issueId);
         $this->getRepository(IssueVersion::class)->deleteByIssueIdAndFlag($issueId, Issue::ISSUE_FIX_VERSION_FLAG);
         $this->getRepository(IssueVersion::class)->deleteByIssueIdAndFlag($issueId, Issue::ISSUE_AFFECTED_VERSION_FLAG);
         if ($session->has('move_issue/new_assignee')) {
             $this->getRepository(Issue::class)->updateAssigneeRaw($issueId, $session->get('move_issue/new_assignee'));
         }
         if (count($session->get('move_issue/new_component'))) {
             $this->getRepository(Issue::class)->addComponentVersion($issueId, $session->get('move_issue/new_component'), 'issue_component');
         }
         if (count($session->get('move_issue/new_fix_version'))) {
             $this->getRepository(Issue::class)->addComponentVersion($issueId, $session->get('move_issue/new_fix_version'), 'issue_version', Issue::ISSUE_FIX_VERSION_FLAG);
         }
         if (count($session->get('move_issue/new_affects_version'))) {
             $this->getRepository(Issue::class)->addComponentVersion($issueId, $session->get('move_issue/new_affects_version'), 'issue_version', Issue::ISSUE_AFFECTED_VERSION_FLAG);
         }
         $newProjectId = $session->get('move_issue/new_project');
         // move the issue
         $this->getRepository(Issue::class)->move($issueId, $newProjectId, $session->get('move_issue/new_type'), $session->get('move_issue/sub_task_new_issue_type'));
         $session->remove('move_issue');
         $newIssueData = $this->getRepository(Issue::class)->getByParameters(array('issue_id' => $issueId), $loggedInUserId);
         $fieldChanges = $this->getRepository(Issue::class)->computeDifference($oldIssueData, $newIssueData, array(), array());
         $this->getRepository(Issue::class)->updateHistory($issueId, $loggedInUserId, $fieldChanges, $currentDate);
         $issueEvent = new IssueEvent(null, null, IssueEvent::STATUS_UPDATE, array('oldIssueData' => $oldIssueData, 'fieldChanges' => $fieldChanges));
         $this->getLogger()->addInfo('MOVE Yongo issue ' . $oldIssueData['project_code'] . '-' . $oldIssueData['nr'], $this->getLoggerContext());
         UbirimiContainer::get()['dispatcher']->dispatch(YongoEvents::YONGO_ISSUE_EMAIL, $issueEvent);
         return new RedirectResponse(LinkHelper::getYongoIssueViewLinkJustHref($issueId));
     }
     $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Move Issue - ' . $issue['project_code'] . '-' . $issue['nr'] . ' ' . $issue['summary'];
     $previousData = $session->get('move_issue');
     $menuSelectedCategory = 'issue';
     $newStatusName = $this->getRepository(IssueSettings::class)->getById($session->get('move_issue/new_status'), 'status', 'name');
     $newProject = $this->getRepository(YongoProject::class)->getById($session->get('move_issue/new_project'));
     $newTypeName = $this->getRepository(IssueSettings::class)->getById($session->get('move_issue/new_type'), 'type', 'name');
     $issueComponents = $this->getRepository(IssueComponent::class)->getByIssueIdAndProjectId($issue['id'], $projectId);
     $issueFixVersions = $this->getRepository(IssueVersion::class)->getByIssueIdAndProjectId($issue['id'], $projectId, Issue::ISSUE_FIX_VERSION_FLAG);
     $issueAffectedVersions = $this->getRepository(IssueVersion::class)->getByIssueIdAndProjectId($issue['id'], $projectId, Issue::ISSUE_AFFECTED_VERSION_FLAG);
     $newIssueComponents = null;
     $newIssueFixVersions = null;
     $newIssueAffectsVersions = null;
     if (count($session->get('move_issue/new_component'))) {
         $newIssueComponents = $this->getRepository(IssueComponent::class)->getByIds($session->get('move_issue/new_component'));
     }
     if (count($session->get('move_issue/new_fix_version'))) {
         $newIssueFixVersions = $this->getRepository(IssueVersion::class)->getByIds($session->get('move_issue/new_fix_version'));
     }
     if (count($session->get('move_issue/new_affects_version'))) {
         $newIssueAffectsVersions = $this->getRepository(IssueVersion::class)->getByIds($session->get('move_issue/new_affects_version'));
     }
     $newUserAssignee = $this->getRepository(UbirimiUser::class)->getById($session->get('move_issue/new_assignee'));
     return $this->render(__DIR__ . '/../../../Resources/views/issue/move/MoveStep4.php', get_defined_vars());
 }
Ejemplo n.º 2
0
                                            <option value="<?php 
    echo $status['linked_issue_status_id'];
    ?>
"><?php 
    echo $status['name'];
    ?>
</option>
                                        <?php 
}
?>
                                    </select>
                                </td>
                            </tr>
                        </table>
                        <hr size="1" />
                        <div align="left">
                            <button type="submit" name="move_issue_step_2" class="btn ubirimi-btn">Next</button>
                            <a class="btn ubirimi-btn" href="<?php 
echo LinkHelper::getYongoIssueViewLinkJustHref($issue['id']);
?>
">Cancel</a>
                        </div>
                    </form>
                </td>
            </tr>
        </table>
    </div>
    <?php 
require_once __DIR__ . '/../../_footer.php';
?>
</body>
Ejemplo n.º 3
0
 public static function drawYongoProjectCalendar($projectId, $month, $year, $userId)
 {
     /* draw table */
     $calendar = '<table cellpadding="0" cellspacing="0" class="calendar">';
     /* table headings */
     $headings = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
     $calendar .= '<tr>';
     $calendar .= '<td class="calendar-day-head">' . implode('</td><td class="calendar-day-head">', $headings) . '</td>';
     $calendar .= '</tr>';
     /* days and weeks vars now ... */
     $runningDay = date('w', mktime(0, 0, 0, $month, 1, $year));
     $daysInMonth = date('t', mktime(0, 0, 0, $month, 1, $year));
     $daysInThisWeek = 1;
     $dayCounter = 0;
     $dates_array = array();
     /* row for week one */
     $calendar .= '<tr class="calendar-row">';
     /* print "blank" days until the first of the current week */
     for ($x = 0; $x < $runningDay; $x++) {
         $calendar .= '<td class="calendar-day-np"> </td>';
         $daysInThisWeek++;
     }
     /* keep going with days.... */
     for ($list_day = 1; $list_day <= $daysInMonth; $list_day++) {
         $calendar .= '<td class="calendar-day" valign="top">';
         /* add in the day number */
         $calendar .= '<div class="day-number">' . $list_day . '</div>';
         $dayNr = $list_day;
         if ($list_day < 10) {
             $dayNr = '0' . $list_day;
         }
         $date = $year . '-' . $month . '-' . $dayNr;
         /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !!  IF MATCHES FOUND, PRINT THEM !! **/
         $issueQueryParameters = array('date_due' => $date, 'project' => $projectId);
         $issues = UbirimiContainer::get()['repository']->get(Issue::class)->getByParameters($issueQueryParameters, $userId);
         if ($issues) {
             $calendar .= '<div>Issues: <a href="/yongo/issue/search?project=' . $projectId . '&date_due_after=' . $date . '&date_due_before=' . $date . '">' . $issues->num_rows . '</a></div>';
             while ($issue = $issues->fetch_array(MYSQLI_ASSOC)) {
                 $calendar .= '<a class="calendar-issue-box" href="' . LinkHelper::getYongoIssueViewLinkJustHref($issue['id']) . '">';
                 $calendar .= '<span style="width: 19px; margin-right: 4px; margin-bottom: 4px; display: inline-block; background-color: ' . $issue['priority_color'] . '">&nbsp;</span>';
                 $calendar .= '<div style="display: none" class="calendar-issue-box-content">';
                 $calendar .= '<a href="/yongo/issue/' . $issue['id'] . '">' . $issue['project_code'] . '-' . $issue['nr'] . '</a> ' . $issue['summary'];
                 $calendar .= '<div>' . str_replace("\n", "<br />", $issue['description']) . '</div>';
                 $calendar .= '</div>';
                 $calendar .= '</a>';
             }
         }
         $calendar .= str_repeat('<p> </p>', 2);
         $calendar .= '</td>';
         if ($runningDay == 6) {
             $calendar .= '</tr>';
             if ($dayCounter + 1 != $daysInMonth) {
                 $calendar .= '<tr class="calendar-row">';
             }
             $runningDay = -1;
             $daysInThisWeek = 0;
         }
         $daysInThisWeek++;
         $runningDay++;
         $dayCounter++;
     }
     /* finish the rest of the days in the week */
     if ($daysInThisWeek < 8 && 8 - $daysInThisWeek != 7) {
         for ($x = 1; $x <= 8 - $daysInThisWeek; $x++) {
             $calendar .= '<td class="calendar-day-np"> </td>';
         }
     }
     /* final row */
     $calendar .= '</tr>';
     /* end the table */
     $calendar .= '</table>';
     /* all done, return result */
     return $calendar;
 }