/** * Assign an issue to an epic * * @Route(url="/assign/issue/epic/:epic_id") * * @param framework\Request $request */ public function runAssignEpic(framework\Request $request) { try { $epic = \thebuggenie\core\entities\Issue::getB2DBTable()->selectById((int) $request['epic_id']); $issue = \thebuggenie\core\entities\Issue::getB2DBTable()->selectById((int) $request['issue_id']); $epic->addChildIssue($issue, true); return $this->renderJSON(array('issue_id' => $issue->getID(), 'epic_id' => $epic->getID(), 'closed_pct' => $epic->getEstimatedPercentCompleted(), 'num_child_issues' => $epic->countChildIssues(), 'estimate' => \thebuggenie\core\entities\Issue::getFormattedTime($epic->getEstimatedTime()), 'text_color' => $epic->getAgileTextColor())); } catch (\Exception $e) { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('error' => framework\Context::getI18n()->__('An error occured when trying to assign the issue to the epic'))); } }
<div class="results_summary"> <div class="summary_header"><?php echo __('In the group above (on this page)'); ?> </div> <?php echo __('Total number of issues: %number', array('%number' => '<span class="issue_count">' . $current_count . '</span>')); ?> <br> <?php echo __('Total estimated effort: %details', array('%details' => '<span class="issue_estimated_time_summary">' . \thebuggenie\core\entities\Issue::getFormattedTime($current_estimated_time, false) . '</span>')); ?> <br> <?php echo __('Total current effort: %details', array('%details' => '<span class="issue_spent_time_summary">' . \thebuggenie\core\entities\Issue::getFormattedTime($current_spent_time, false) . '</span>')); ?> <br> </div>
</td> <td class="sc_spent_time<?php if (!$issue->hasSpentTime()) { ?> faded_out<?php } ?> "<?php if (!in_array('spent_time', $visible_columns)) { ?> style="display: none;"<?php } ?> > <?php echo !$issue->hasSpentTime() ? '-' : \thebuggenie\core\entities\Issue::getFormattedTime($issue->getSpentTime(true, true)); ?> </td> <td class="smaller sc_last_updated" title="<?php echo tbg_formatTime($issue->getLastUpdatedTime(), 21); ?> "<?php if (!in_array('last_updated', $visible_columns)) { ?> style="display: none;"<?php } ?> ><?php echo tbg_formatTime($issue->getLastUpdatedTime(), 20); ?> </td>
/** * Formats log time * * @param $log * @param $previous_value * @param $current_value * @param bool $append_minutes * @param bool $subtract_hours * * @return string */ public static function formatTimeableLog($time, $previous_value, $current_value, $append_minutes = false, $subtract_hours = false) { if (!$append_minutes && !$subtract_hours) { return $time; } $old_time = unserialize($previous_value); $new_time = unserialize($current_value); if ($append_minutes) { if (isset($old_time['hours']) && isset($old_time['minutes'])) { $old_time['hours'] += (int) floor($old_time['minutes'] / 60); } if (isset($new_time['hours']) && isset($new_time['minutes'])) { $new_time['hours'] += (int) floor($new_time['minutes'] / 60); } } if ($subtract_hours) { if (isset($old_time['minutes'])) { $old_time['minutes'] = $old_time['minutes'] % 60; } if (isset($new_time['minutes'])) { $new_time['minutes'] = $new_time['minutes'] % 60; } } return \thebuggenie\core\entities\Issue::getFormattedTime($old_time) . ' ⇒ ' . \thebuggenie\core\entities\Issue::getFormattedTime($new_time); }
$sheet->setCellValueByColumnAndRow(4, $cc, $issue->getDescription()); $sheet->setCellValueByColumnAndRow(5, $cc, $issue->getReproductionSteps()); $sheet->setCellValueByColumnAndRow(6, $cc, $posted_by); $sheet->setCellValueByColumnAndRow(7, $cc, $assignee); $sheet->setCellValueByColumnAndRow(8, $cc, $status); $sheet->setCellValueByColumnAndRow(9, $cc, $category); $sheet->setCellValueByColumnAndRow(10, $cc, $priority); $sheet->setCellValueByColumnAndRow(11, $cc, $reproducability); $sheet->setCellValueByColumnAndRow(12, $cc, $severity); $sheet->setCellValueByColumnAndRow(13, $cc, $resolution); $sheet->setCellValueByColumnAndRow(14, $cc, $milestone); $sheet->setCellValueByColumnAndRow(15, $cc, tbg_formatTime($issue->getPosted(), 21)); $sheet->setCellValueByColumnAndRow(16, $cc, tbg_formatTime($issue->getLastUpdatedTime(), 21)); $sheet->setCellValueByColumnAndRow(17, $cc, $issue->getPercentCompleted() . '%'); $sheet->setCellValueByColumnAndRow(18, $cc, !$issue->hasEstimatedTime() ? '-' : \thebuggenie\core\entities\Issue::getFormattedTime($issue->getEstimatedTime(true, true))); $sheet->setCellValueByColumnAndRow(19, $cc, !$issue->hasSpentTime() ? '-' : \thebuggenie\core\entities\Issue::getFormattedTime($issue->getSpentTime(true, true))); $sheet->setCellValueByColumnAndRow(20, $cc, $issue->getUserpain()); $sheet->setCellValueByColumnAndRow(21, $cc, $issue->getVotes()); $start_column = 22; foreach ($custom_columns as $column) { $value = $issue->getCustomField($column->getKey()); switch ($column->getType()) { case \thebuggenie\core\entities\CustomDatatype::DATE_PICKER: $value = strtotime($value) !== false ? tbg_formatTime($value, 20) : ''; break; case \thebuggenie\core\entities\CustomDatatype::DROPDOWN_CHOICE_TEXT: case \thebuggenie\core\entities\CustomDatatype::RADIO_CHOICE: $value = $value instanceof \thebuggenie\core\entities\CustomDatatypeOption ? $value->getValue() : ''; break; case \thebuggenie\core\entities\CustomDatatype::CLIENT_CHOICE: case \thebuggenie\core\entities\CustomDatatype::COMPONENTS_CHOICE:
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); $is_saved_assignee = true; } break; case '_posted_by': $old_identifiable = $original_value ? \thebuggenie\core\entities\User::getB2DBTable()->selectById($original_value) : framework\Context::getI18n()->__('Unknown'); $old_name = $old_identifiable instanceof \thebuggenie\core\entities\User ? $old_identifiable->getName() : framework\Context::getI18n()->__('Unknown'); $new_name = $this->getPostedBy()->getName(); $this->addLogEntry(tables\Log::LOG_ISSUE_POSTED, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value); break; case '_being_worked_on_by_user': if ($original_value != 0) { $old_identifiable = \thebuggenie\core\entities\User::getB2DBTable()->selectById($original_value); $old_name = $old_identifiable instanceof \thebuggenie\core\entities\User ? $old_identifiable->getName() : framework\Context::getI18n()->__('Unknown'); } else { $old_name = framework\Context::getI18n()->__('Not being worked on'); } $new_name = $this->getUserWorkingOnIssue() instanceof \thebuggenie\core\entities\User ? $this->getUserWorkingOnIssue()->getName() : framework\Context::getI18n()->__('Not being worked on'); $this->addLogEntry(tables\Log::LOG_ISSUE_USERS, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value); break; case '_owner_team': case '_owner_user': if (!$is_saved_owner) { $new_name = $this->getOwner() instanceof \thebuggenie\core\entities\common\Identifiable ? $this->getOwner()->getName() : framework\Context::getI18n()->__('Not owned by anyone'); $this->addLogEntry(tables\Log::LOG_ISSUE_OWNED, $new_name); $is_saved_owner = true; } break; case '_percent_complete': $this->addLogEntry(tables\Log::LOG_ISSUE_PERCENT, $original_value . '% ⇒ ' . $this->getPercentCompleted() . '', $original_value, $compare_value); break; case '_resolution': if ($original_value != 0) { $old_name = ($old_item = \thebuggenie\core\entities\Resolution::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown'); } else { $old_name = framework\Context::getI18n()->__('Not determined'); } $new_name = $this->getResolution() instanceof Datatype ? $this->getResolution()->getName() : framework\Context::getI18n()->__('Not determined'); $this->addLogEntry(tables\Log::LOG_ISSUE_RESOLUTION, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value); break; case '_severity': if ($original_value != 0) { $old_name = ($old_item = \thebuggenie\core\entities\Severity::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown'); } else { $old_name = framework\Context::getI18n()->__('Not determined'); } $new_name = $this->getSeverity() instanceof Datatype ? $this->getSeverity()->getName() : framework\Context::getI18n()->__('Not determined'); $this->addLogEntry(tables\Log::LOG_ISSUE_SEVERITY, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value); break; case '_milestone': if ($original_value != 0) { $old_name = ($old_item = \thebuggenie\core\entities\Milestone::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Not determined'); } else { $old_name = framework\Context::getI18n()->__('Not determined'); } $new_name = $this->getMilestone() instanceof \thebuggenie\core\entities\Milestone ? $this->getMilestone()->getName() : framework\Context::getI18n()->__('Not determined'); $this->addLogEntry(tables\Log::LOG_ISSUE_MILESTONE, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value); $this->_milestone_order = 0; break; case '_issuetype': if ($original_value != 0) { $old_name = ($old_item = Issuetype::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown'); } else { $old_name = framework\Context::getI18n()->__('Unknown'); } $new_name = $this->getIssuetype() instanceof \thebuggenie\core\entities\Issuetype ? $this->getIssuetype()->getName() : framework\Context::getI18n()->__('Unknown'); $this->addLogEntry(tables\Log::LOG_ISSUE_ISSUETYPE, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value); break; case '_estimated_months': case '_estimated_weeks': case '_estimated_days': case '_estimated_hours': case '_estimated_points': if (!$is_saved_estimated) { $old_time = array('months' => $this->getChangedPropertyOriginal('_estimated_months'), 'weeks' => $this->getChangedPropertyOriginal('_estimated_weeks'), 'days' => $this->getChangedPropertyOriginal('_estimated_days'), 'hours' => $this->getChangedPropertyOriginal('_estimated_hours'), 'points' => $this->getChangedPropertyOriginal('_estimated_points')); $old_formatted_time = array_sum($old_time) > 0 ? Issue::getFormattedTime($old_time) : framework\Context::getI18n()->__('Not estimated'); $new_formatted_time = $this->hasEstimatedTime() ? Issue::getFormattedTime($this->getEstimatedTime()) : framework\Context::getI18n()->__('Not estimated'); $this->addLogEntry(tables\Log::LOG_ISSUE_TIME_ESTIMATED, $old_formatted_time . ' ⇒ ' . $new_formatted_time, serialize($old_time), serialize($this->getEstimatedTime())); $is_saved_estimated = true; } break; case '_spent_months': case '_spent_weeks': case '_spent_days': case '_spent_hours': case '_spent_points': if (!$is_saved_spent) { $old_time = array('months' => $this->getChangedPropertyOriginal('_spent_months'), 'weeks' => $this->getChangedPropertyOriginal('_spent_weeks'), 'days' => $this->getChangedPropertyOriginal('_spent_days'), 'hours' => round($this->getChangedPropertyOriginal('_spent_hours') / 100, 2), 'points' => $this->getChangedPropertyOriginal('_spent_points')); $old_formatted_time = array_sum($old_time) > 0 ? Issue::getFormattedTime($old_time) : framework\Context::getI18n()->__('No time spent'); $new_formatted_time = $this->hasSpentTime() ? Issue::getFormattedTime($this->getSpentTime()) : framework\Context::getI18n()->__('No time spent'); $this->addLogEntry(tables\Log::LOG_ISSUE_TIME_SPENT, $old_formatted_time . ' ⇒ ' . $new_formatted_time, serialize($old_time), serialize($this->getSpentTime())); $is_saved_spent = true; } break; case '_state': if ($this->isClosed()) { $this->addLogEntry(tables\Log::LOG_ISSUE_CLOSE); if ($this->getMilestone() instanceof \thebuggenie\core\entities\Milestone) { if ($this->getMilestone()->isSprint()) { if (!$this->getIssueType()->isTask()) { $this->setSpentPoints($this->getEstimatedPoints()); } else { if ($this->getSpentHours() < $this->getEstimatedHours()) { $this->setSpentHours($this->getEstimatedHours()); } foreach ($this->getParentIssues() as $parent_issue) { if ($parent_issue->checkTaskStates()) { $related_issues_to_save[$parent_issue->getID()] = true; } } } } $this->getMilestone()->updateStatus(); $this->getMilestone()->save(); } } else { $this->addLogEntry(tables\Log::LOG_ISSUE_REOPEN); } break; case '_blocking': if ($this->isBlocking()) { $this->addLogEntry(tables\Log::LOG_ISSUE_BLOCKED); } else { $this->addLogEntry(tables\Log::LOG_ISSUE_UNBLOCKED); } break; default: if (mb_substr($property, 0, 12) == '_customfield') { $key = mb_substr($property, 12); $customdatatype = CustomDatatype::getByKey($key); switch ($customdatatype->getType()) { case CustomDatatype::INPUT_TEXT: $new_value = $this->getCustomField($key) != '' ? $this->getCustomField($key) : framework\Context::getI18n()->__('Unknown'); $this->addLogEntry(tables\Log::LOG_ISSUE_CUSTOMFIELD_CHANGED, $key . ': ' . $new_value, $original_value, $compare_value); break; case CustomDatatype::INPUT_TEXTAREA_SMALL: case CustomDatatype::INPUT_TEXTAREA_MAIN: $new_value = $this->getCustomField($key) != '' ? $this->getCustomField($key) : framework\Context::getI18n()->__('Unknown'); $this->addLogEntry(tables\Log::LOG_ISSUE_CUSTOMFIELD_CHANGED, $key . ': ' . $new_value, $original_value, $compare_value); break; case CustomDatatype::EDITIONS_CHOICE: case CustomDatatype::COMPONENTS_CHOICE: case CustomDatatype::RELEASES_CHOICE: case CustomDatatype::MILESTONE_CHOICE: case CustomDatatype::STATUS_CHOICE: case CustomDatatype::TEAM_CHOICE: case CustomDatatype::USER_CHOICE: case CustomDatatype::CLIENT_CHOICE: $old_object = null; $new_object = null; try { switch ($customdatatype->getType()) { case CustomDatatype::EDITIONS_CHOICE: $old_object = Edition::getB2DBTable()->selectById($original_value); break; case CustomDatatype::COMPONENTS_CHOICE: $old_object = Component::getB2DBTable()->selectById($original_value); break; case CustomDatatype::RELEASES_CHOICE: $old_object = Build::getB2DBTable()->selectById($original_value); break; case CustomDatatype::MILESTONE_CHOICE: $old_object = Milestone::getB2DBTable()->selectById($original_value); break; case CustomDatatype::STATUS_CHOICE: $old_object = Status::getB2DBTable()->selectById($original_value); break; case CustomDatatype::TEAM_CHOICE: $old_object = Team::getB2DBTable()->selectById($original_value); break; case CustomDatatype::USER_CHOICE: $old_object = User::getB2DBTable()->selectById($original_value); break; case CustomDatatype::CLIENT_CHOICE: $old_object = Client::getB2DBTable()->selectById($original_value); break; } } catch (\Exception $e) { } try { switch ($customdatatype->getType()) { case CustomDatatype::EDITIONS_CHOICE: case CustomDatatype::COMPONENTS_CHOICE: case CustomDatatype::RELEASES_CHOICE: case CustomDatatype::MILESTONE_CHOICE: case CustomDatatype::STATUS_CHOICE: case CustomDatatype::TEAM_CHOICE: case CustomDatatype::USER_CHOICE: case CustomDatatype::CLIENT_CHOICE: $new_object = $this->getCustomField($key); break; } } catch (\Exception $e) { } $old_value = is_object($old_object) ? $old_object->getName() : framework\Context::getI18n()->__('Unknown'); $new_value = is_object($new_object) ? $new_object->getName() : framework\Context::getI18n()->__('Unknown'); $this->addLogEntry(tables\Log::LOG_ISSUE_CUSTOMFIELD_CHANGED, $key . ': ' . $old_value . ' ⇒ ' . $new_value, $original_value, $compare_value); break; default: $old_item = null; try { $old_item = $original_value ? new CustomDatatypeOption($original_value) : null; } catch (\Exception $e) { } $old_value = $old_item instanceof \thebuggenie\core\entities\CustomDatatypeOption ? $old_item->getName() : framework\Context::getI18n()->__('Unknown'); $new_value = $this->getCustomField($key) instanceof \thebuggenie\core\entities\CustomDatatypeOption ? $this->getCustomField($key)->getName() : framework\Context::getI18n()->__('Unknown'); $this->addLogEntry(tables\Log::LOG_ISSUE_CUSTOMFIELD_CHANGED, $key . ': ' . $old_value . ' ⇒ ' . $new_value, $original_value, $compare_value); break; } } break; } } } if ($is_saved_estimated) { tables\IssueEstimates::getTable()->saveEstimate($this->getID(), $this->_estimated_months, $this->_estimated_weeks, $this->_estimated_days, $this->_estimated_hours, $this->_estimated_points); } } return $related_issues_to_save; }
echo $epic->getStatus() instanceof \thebuggenie\core\entities\Datatype ? $epic->getStatus()->getColor() : '#FFF'; ?> ;" title="<?php echo $epic->getStatus() instanceof \thebuggenie\core\entities\Datatype ? $epic->getStatus()->getName() : __('Unknown'); ?> "> </div><?php echo $epic->getStatus() instanceof \thebuggenie\core\entities\Status ? $epic->getStatus()->getName() : __('Not determined'); ?> </dd> <dt><?php echo __('Estimate'); ?> </dt> <dd id="epic_<?php echo $epic->getID(); ?> _estimate"><?php echo \thebuggenie\core\entities\Issue::getFormattedTime($epic->getEstimatedTime(true, true)); ?> </dd> <dt><?php echo __('Child issues'); ?> </dt> <dd><?php echo __('%num_child_issues issue(s)', array('%num_child_issues' => '<span id="epic_' . $epic->getID() . '_child_issues_count">' . $epic->countChildIssues() . '</span>')); ?> </dd> </dl> </li>
?> _name"<?php if (!$issue->hasSpentTime()) { ?> style="display: none;"<?php } ?> > <a href="javascript:void(0)" onclick="TBG.Main.Helpers.Backdrop.show('<?php echo make_url('get_partial_for_backdrop', array('key' => 'issue_spenttimes', 'issue_id' => $issue->getID())); ?> ');" id="spent_time_<?php echo $issue->getID(); ?> _value"><?php echo \thebuggenie\core\entities\Issue::getFormattedTime($issue->getSpentTime()); ?> </a> </span> <span class="faded_out" id="no_spent_time_<?php echo $issue->getID(); ?> "<?php if ($issue->hasSpentTime()) { ?> style="display: none;"<?php } ?> ><?php echo __('No time spent'); ?>
/** * Reverts an issue field back to the original value * * @param \thebuggenie\core\framework\Request $request */ public function runIssueRevertField(framework\Request $request) { if ($issue_id = $request['issue_id']) { try { $issue = entities\Issue::getB2DBTable()->selectById($issue_id); } catch (\Exception $e) { $this->getResponse()->setHttpStatus(400); return $this->renderText('fail'); } } else { $this->getResponse()->setHttpStatus(400); return $this->renderText('no issue'); } $field = null; framework\Context::loadLibrary('common'); switch ($request['field']) { case 'description': $issue->revertDescription(); $issue->revertDescription_Syntax(); $field = array('id' => (int) ($issue->getDescription() != ''), 'name' => $issue->getParsedDescription(array('issue' => $issue)), 'form_value' => $issue->getDescription()); break; case 'reproduction_steps': $issue->revertReproduction_Steps(); $issue->revertReproduction_Steps_Syntax(); $field = array('id' => (int) ($issue->getReproductionSteps() != ''), 'name' => $issue->getParsedReproductionSteps(array('issue' => $issue)), 'form_value' => $issue->getReproductionSteps()); break; case 'title': $issue->revertTitle(); $field = array('id' => 1, 'name' => strip_tags($issue->getTitle())); break; case 'shortname': $issue->revertShortname(); $field = array('id' => 1, 'name' => strip_tags($issue->getShortname())); break; case 'category': $issue->revertCategory(); $field = $issue->getCategory() instanceof entities\Category ? array('id' => $issue->getCategory()->getID(), 'name' => $issue->getCategory()->getName()) : array('id' => 0); break; case 'resolution': $issue->revertResolution(); $field = $issue->getResolution() instanceof entities\Resolution ? array('id' => $issue->getResolution()->getID(), 'name' => $issue->getResolution()->getName()) : array('id' => 0); break; case 'severity': $issue->revertSeverity(); $field = $issue->getSeverity() instanceof entities\Severity ? array('id' => $issue->getSeverity()->getID(), 'name' => $issue->getSeverity()->getName()) : array('id' => 0); break; case 'reproducability': $issue->revertReproducability(); $field = $issue->getReproducability() instanceof entities\Reproducability ? array('id' => $issue->getReproducability()->getID(), 'name' => $issue->getReproducability()->getName()) : array('id' => 0); break; case 'priority': $issue->revertPriority(); $field = $issue->getPriority() instanceof entities\Priority ? array('id' => $issue->getPriority()->getID(), 'name' => $issue->getPriority()->getName()) : array('id' => 0); break; case 'percent_complete': $issue->revertPercentCompleted(); $field = $issue->getPercentCompleted(); break; case 'status': $issue->revertStatus(); $field = $issue->getStatus() instanceof entities\Status ? array('id' => $issue->getStatus()->getID(), 'name' => $issue->getStatus()->getName(), 'color' => $issue->getStatus()->getColor()) : array('id' => 0); break; case 'pain_bug_type': $issue->revertPainBugType(); $field = $issue->hasPainBugType() ? array('id' => $issue->getPainBugType(), 'name' => $issue->getPainBugTypeLabel(), 'user_pain' => $issue->getUserPain()) : array('id' => 0, 'user_pain' => $issue->getUserPain()); break; case 'pain_likelihood': $issue->revertPainLikelihood(); $field = $issue->hasPainLikelihood() ? array('id' => $issue->getPainLikelihood(), 'name' => $issue->getPainLikelihoodLabel(), 'user_pain' => $issue->getUserPain()) : array('id' => 0, 'user_pain' => $issue->getUserPain()); break; case 'pain_effect': $issue->revertPainEffect(); $field = $issue->hasPainEffect() ? array('id' => $issue->getPainEffect(), 'name' => $issue->getPainEffectLabel(), 'user_pain' => $issue->getUserPain()) : array('id' => 0, 'user_pain' => $issue->getUserPain()); break; case 'issuetype': $issue->revertIssuetype(); $field = $issue->getIssuetype() instanceof entities\Issuetype ? array('id' => $issue->getIssuetype()->getID(), 'name' => $issue->getIssuetype()->getName(), 'src' => htmlspecialchars(framework\Context::getWebroot() . 'images/' . $issue->getIssuetype()->getIcon() . '_small.png')) : array('id' => 0); $visible_fields = $issue->getIssuetype() instanceof entities\Issuetype ? $issue->getProject()->getVisibleFieldsArray($issue->getIssuetype()->getID()) : array(); return $this->renderJSON(array('ok' => true, 'issue_id' => $issue->getID(), 'field' => $field, 'visible_fields' => $visible_fields)); break; case 'milestone': $issue->revertMilestone(); $field = $issue->getMilestone() instanceof entities\Milestone ? array('id' => $issue->getMilestone()->getID(), 'name' => $issue->getMilestone()->getName()) : array('id' => 0); break; case 'estimated_time': $issue->revertEstimatedTime(); return $this->renderJSON(array('ok' => true, 'issue_id' => $issue->getID(), 'field' => $issue->hasEstimatedTime() ? array('id' => 1, 'name' => entities\Issue::getFormattedTime($issue->getEstimatedTime(true, true))) : array('id' => 0), 'values' => $issue->getEstimatedTime(true, true), 'percentbar' => $this->getComponentHTML('main/percentbar', array('percent' => $issue->getEstimatedPercentCompleted(), 'height' => 3)))); break; case 'spent_time': $issue->revertSpentTime(); return $this->renderJSON(array('ok' => true, 'issue_id' => $issue->getID(), 'field' => $issue->hasSpentTime() ? array('id' => 1, 'name' => entities\Issue::getFormattedTime($issue->getSpentTime(true, true))) : array('id' => 0), 'values' => $issue->getSpentTime(true, true))); break; case 'owned_by': $issue->revertOwner(); return $this->renderJSON(array('changed' => $issue->isOwnerChanged(), 'field' => $issue->isOwned() ? array('id' => $issue->getOwner()->getID(), 'name' => $issue->getOwner() instanceof entities\User ? $this->getComponentHTML('main/userdropdown', array('user' => $issue->getOwner())) : $this->getComponentHTML('main/teamdropdown', array('team' => $issue->getOwner()))) : array('id' => 0))); break; case 'assigned_to': $issue->revertAssignee(); return $this->renderJSON(array('changed' => $issue->isAssigneeChanged(), 'field' => $issue->isAssigned() ? array('id' => $issue->getAssignee()->getID(), 'name' => $issue->getAssignee() instanceof entities\User ? $this->getComponentHTML('main/userdropdown', array('user' => $issue->getAssignee())) : $this->getComponentHTML('main/teamdropdown', array('team' => $issue->getAssignee()))) : array('id' => 0))); break; case 'posted_by': $issue->revertPostedBy(); return $this->renderJSON(array('changed' => $issue->isPostedByChanged(), 'field' => array('id' => $issue->getPostedByID(), 'name' => $this->getComponentHTML('main/userdropdown', array('user' => $issue->getPostedBy()))))); break; default: if ($customdatatype = entities\CustomDatatype::getByKey($request['field'])) { $key = $customdatatype->getKey(); $revert_methodname = "revertCustomfield{$key}"; $issue->{$revert_methodname}(); if ($customdatatype->hasCustomOptions()) { $field = $issue->getCustomField($key) instanceof entities\CustomDatatypeOption ? array('value' => $issue->getCustomField($key)->getID(), 'name' => $issue->getCustomField($key)->getName()) : array('id' => 0); } else { switch ($customdatatype->getType()) { case entities\CustomDatatype::INPUT_TEXTAREA_MAIN: case entities\CustomDatatype::INPUT_TEXTAREA_SMALL: $field = $issue->getCustomField($key) != '' ? array('value' => $key, 'name' => tbg_parse_text($issue->getCustomField($key))) : array('id' => 0); break; default: $field = $issue->getCustomField($key) != '' ? array('value' => $key, 'name' => $issue->getCustomField($key)) : array('id' => 0); break; } } } break; } if ($field !== null) { return $this->renderJSON(array('ok' => true, 'issue_id' => $issue->getID(), 'field' => $field)); } else { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('error' => framework\Context::getI18n()->__('No valid field specified (%field)', array('%field' => $request['field'])))); } }
?> "> <td><?php echo tbg_formatTime($spent_time->getEditedAt(), 14); ?> </td> <td style="font-size: 0.9em;"><?php echo $spent_time->getActivityType() instanceof \thebuggenie\core\entities\ActivityType ? $spent_time->getActivityType()->getName() : '-'; ?> </td> <td><?php echo include_component('main/userdropdown', array('user' => $spent_time->getUser())); ?> </td> <td style="text-align: right;"><?php echo \thebuggenie\core\entities\Issue::getFormattedTime($spent_time->getSpentTime(true, true)); ?> </td> <td style="text-align: right;" class="button-group" <?php if ($spent_time->getComment()) { ?> rowspan="2"<?php } ?> > <a href="javascript:void(0);" style="float: none;" class="button button-silver last" onclick="TBG.Main.Helpers.Backdrop.show('<?php echo make_url('get_partial_for_backdrop', array('key' => 'issue_spenttime', 'entry_id' => $spent_time->getID())); ?> ');"><?php echo __('Edit'); ?>