</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() ? '-' : TBGIssue::getFormattedTime($issue->getSpentTime());
    ?>
					</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 
    }
    ?>
><span style="display: none;"><?php 
    echo $issue->getLastUpdatedTime();
    ?>
</span><?php 
?>
_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 TBGIssue::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');
?>
        echo html_entity_decode($severity, ENT_QUOTES, TBGContext::getI18n()->getCharset());
        ?>
","<?php 
        echo html_entity_decode($resolution, ENT_QUOTES, TBGContext::getI18n()->getCharset());
        ?>
","<?php 
        echo html_entity_decode($milestone, ENT_QUOTES, TBGContext::getI18n()->getCharset());
        ?>
","<?php 
        echo tbg_formatTime($issue->getLastUpdatedTime(), 21);
        ?>
","<?php 
        echo $percent;
        ?>
","<?php 
        echo TBGIssue::getFormattedTime($issue->getEstimatedTime());
        ?>
","<?php 
        echo $issue->getFormattedTime($issue->getSpentTime());
        ?>
","<?php 
        echo $issue->getUserpain();
        ?>
","<?php 
        echo $issue->getVotes();
        ?>
","<?php 
        echo str_replace('"', '\\"', html_entity_decode($issue->getDescription(), ENT_QUOTES, TBGContext::getI18n()->getCharset()));
        ?>
 ", "<?php 
        echo str_replace('"', '\\"', html_entity_decode($reproductionsteps, ENT_QUOTES, TBGContext::getI18n()->getCharset()));
    ?>
">
						<td><?php 
    echo tbg_formatTime($spent_time->getEditedAt(), 20);
    ?>
</td>
						<td style="font-size: 0.9em;"><?php 
    echo $spent_time->getActivityType() instanceof TBGActivityType ? $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 TBGIssue::getFormattedTime($spent_time->getSpentTime());
    ?>
</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');
    ?>
Example #5
0
 /**
  * Reverts an issue field back to the original value
  * 
  * @param TBGRequest $request
  */
 public function runIssueRevertField(TBGRequest $request)
 {
     if ($issue_id = $request['issue_id']) {
         try {
             $issue = TBGContext::factory()->TBGIssue($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;
     TBGContext::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 'category':
             $issue->revertCategory();
             $field = $issue->getCategory() instanceof TBGCategory ? array('id' => $issue->getCategory()->getID(), 'name' => $issue->getCategory()->getName()) : array('id' => 0);
             break;
         case 'resolution':
             $issue->revertResolution();
             $field = $issue->getResolution() instanceof TBGResolution ? array('id' => $issue->getResolution()->getID(), 'name' => $issue->getResolution()->getName()) : array('id' => 0);
             break;
         case 'severity':
             $issue->revertSeverity();
             $field = $issue->getSeverity() instanceof TBGSeverity ? array('id' => $issue->getSeverity()->getID(), 'name' => $issue->getSeverity()->getName()) : array('id' => 0);
             break;
         case 'reproducability':
             $issue->revertReproducability();
             $field = $issue->getReproducability() instanceof TBGReproducability ? array('id' => $issue->getReproducability()->getID(), 'name' => $issue->getReproducability()->getName()) : array('id' => 0);
             break;
         case 'priority':
             $issue->revertPriority();
             $field = $issue->getPriority() instanceof TBGPriority ? 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 TBGStatus ? 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 TBGIssuetype ? array('id' => $issue->getIssuetype()->getID(), 'name' => $issue->getIssuetype()->getName(), 'src' => htmlspecialchars(TBGContext::getTBGPath() . 'iconsets/' . TBGSettings::getThemeName() . '/' . $issue->getIssuetype()->getIcon() . '_small.png')) : array('id' => 0);
             $visible_fields = $issue->getIssuetype() instanceof TBGIssuetype ? $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 TBGMilestone ? 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' => TBGIssue::getFormattedTime($issue->getEstimatedTime())) : array('id' => 0), 'values' => $issue->getEstimatedTime()));
             break;
         case 'spent_time':
             $issue->revertSpentTime();
             return $this->renderJSON(array('ok' => true, 'issue_id' => $issue->getID(), 'field' => $issue->hasSpentTime() ? array('id' => 1, 'name' => TBGIssue::getFormattedTime($issue->getSpentTime())) : array('id' => 0), 'values' => $issue->getSpentTime()));
             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 TBGUser ? $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 TBGUser ? $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 = TBGCustomDatatype::getByKey($request['field'])) {
                 $key = $customdatatype->getKey();
                 $revert_methodname = "revertCustomfield{$key}";
                 $issue->{$revert_methodname}();
                 if ($customdatatype->hasCustomOptions()) {
                     $field = $issue->getCustomField($key) instanceof TBGCustomDatatypeOption ? array('value' => $issue->getCustomField($key)->getID(), 'name' => $issue->getCustomField($key)->getName()) : array('id' => 0);
                 } else {
                     switch ($customdatatype->getType()) {
                         case TBGCustomDatatype::INPUT_TEXTAREA_MAIN:
                         case TBGCustomDatatype::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' => TBGContext::getI18n()->__('No valid field specified (%field)', array('%field' => $request['field']))));
     }
 }
<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">' . TBGIssue::getFormattedTime($current_estimated_time, false) . '</span>'));
?>
<br>
	<?php 
echo __('Total current effort: %details', array('%details' => '<span class="issue_spent_time_summary">' . TBGIssue::getFormattedTime($current_spent_time, false) . '</span>'));
?>
<br>
</div>
Example #7
0
 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(TBGLogTable::LOG_ISSUE_UPDATE_TITLE, TBGContext::getI18n()->__("Title updated"), $original_value, $compare_value);
                         break;
                     case '_description':
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_UPDATE_DESCRIPTION, TBGContext::getI18n()->__("Description updated"), $original_value, $compare_value);
                         break;
                     case '_reproduction_steps':
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_UPDATE_REPRODUCTIONSTEPS, TBGContext::getI18n()->__("Reproduction steps updated"), $original_value, $compare_value);
                         break;
                     case '_category':
                         if ($original_value != 0) {
                             $old_name = ($old_item = TBGContext::factory()->TBGCategory($original_value)) ? $old_item->getName() : TBGContext::getI18n()->__('Not determined');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getCategory() instanceof TBGDatatype ? $this->getCategory()->getName() : TBGContext::getI18n()->__('Not determined');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_CATEGORY, $old_name . ' &rArr; ' . $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 : TBGContext::getI18n()->__('Not determined');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not determined');
                         }
                         $new_name = ($new_item = self::getPainTypesOrLabel('pain_bug_type', $value['current_value'])) ? $new_item : TBGContext::getI18n()->__('Not determined');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_PAIN_BUG_TYPE, $old_name . ' &rArr; ' . $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 : TBGContext::getI18n()->__('Not determined');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not determined');
                         }
                         $new_name = ($new_item = self::getPainTypesOrLabel('pain_effect', $value['current_value'])) ? $new_item : TBGContext::getI18n()->__('Not determined');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_PAIN_EFFECT, $old_name . ' &rArr; ' . $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 : TBGContext::getI18n()->__('Not determined');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not determined');
                         }
                         $new_name = ($new_item = self::getPainTypesOrLabel('pain_likelihood', $value['current_value'])) ? $new_item : TBGContext::getI18n()->__('Not determined');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_PAIN_LIKELIHOOD, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_user_pain':
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_PAIN_CALCULATED, $original_value . ' &rArr; ' . $value['current_value']);
                         break;
                     case '_status':
                         if ($original_value != 0) {
                             $old_name = ($old_item = TBGContext::factory()->TBGStatus($original_value)) ? $old_item->getName() : TBGContext::getI18n()->__('Unknown');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getStatus() instanceof TBGDatatype ? $this->getStatus()->getName() : TBGContext::getI18n()->__('Not determined');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_STATUS, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_reproducability':
                         if ($original_value != 0) {
                             $old_name = ($old_item = TBGContext::factory()->TBGReproducability($original_value)) ? $old_item->getName() : TBGContext::getI18n()->__('Unknown');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getReproducability() instanceof TBGDatatype ? $this->getReproducability()->getName() : TBGContext::getI18n()->__('Not determined');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_REPRODUCABILITY, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_priority':
                         if ($original_value != 0) {
                             $old_name = ($old_item = TBGContext::factory()->TBGPriority($original_value)) ? $old_item->getName() : TBGContext::getI18n()->__('Unknown');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getPriority() instanceof TBGDatatype ? $this->getPriority()->getName() : TBGContext::getI18n()->__('Not determined');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_PRIORITY, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_assignee_team':
                     case '_assignee_user':
                         if (!$is_saved_assignee) {
                             $new_name = $this->getAssignee() instanceof TBGIdentifiable ? $this->getAssignee()->getName() : TBGContext::getI18n()->__('Not assigned');
                             if ($this->getAssignee() instanceof TBGUser) {
                                 $this->startWorkingOnIssue($this->getAssignee());
                             }
                             $this->addLogEntry(TBGLogTable::LOG_ISSUE_ASSIGNED, $new_name);
                             $is_saved_assignee = true;
                         }
                         break;
                     case '_posted_by':
                         $old_identifiable = $original_value ? TBGContext::factory()->TBGUser($original_value) : TBGContext::getI18n()->__('Unknown');
                         $old_name = $old_identifiable instanceof TBGUser ? $old_identifiable->getName() : TBGContext::getI18n()->__('Unknown');
                         $new_name = $this->getPostedBy()->getName();
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_POSTED, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_being_worked_on_by_user':
                         if ($original_value != 0) {
                             $old_identifiable = TBGContext::factory()->TBGUser($original_value);
                             $old_name = $old_identifiable instanceof TBGUser ? $old_identifiable->getName() : TBGContext::getI18n()->__('Unknown');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not being worked on');
                         }
                         $new_name = $this->getUserWorkingOnIssue() instanceof TBGUser ? $this->getUserWorkingOnIssue()->getName() : TBGContext::getI18n()->__('Not being worked on');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_USERS, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_owner_team':
                     case '_owner_user':
                         if (!$is_saved_owner) {
                             $new_name = $this->getOwner() instanceof TBGIdentifiable ? $this->getOwner()->getName() : TBGContext::getI18n()->__('Not owned by anyone');
                             $this->addLogEntry(TBGLogTable::LOG_ISSUE_OWNED, $new_name);
                             $is_saved_owner = true;
                         }
                         break;
                     case '_percent_complete':
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_PERCENT, $original_value . '% &rArr; ' . $this->getPercentCompleted() . '', $original_value, $compare_value);
                         break;
                     case '_resolution':
                         if ($original_value != 0) {
                             $old_name = ($old_item = TBGContext::factory()->TBGResolution($original_value)) ? $old_item->getName() : TBGContext::getI18n()->__('Unknown');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getResolution() instanceof TBGDatatype ? $this->getResolution()->getName() : TBGContext::getI18n()->__('Not determined');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_RESOLUTION, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_severity':
                         if ($original_value != 0) {
                             $old_name = ($old_item = TBGContext::factory()->TBGSeverity($original_value)) ? $old_item->getName() : TBGContext::getI18n()->__('Unknown');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getSeverity() instanceof TBGDatatype ? $this->getSeverity()->getName() : TBGContext::getI18n()->__('Not determined');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_SEVERITY, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         break;
                     case '_milestone':
                         if ($original_value != 0) {
                             $old_name = ($old_item = TBGContext::factory()->TBGMilestone($original_value)) ? $old_item->getName() : TBGContext::getI18n()->__('Not determined');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not determined');
                         }
                         $new_name = $this->getMilestone() instanceof TBGMilestone ? $this->getMilestone()->getName() : TBGContext::getI18n()->__('Not determined');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_MILESTONE, $old_name . ' &rArr; ' . $new_name, $original_value, $compare_value);
                         $this->_milestone_order = 0;
                         break;
                     case '_issuetype':
                         if ($original_value != 0) {
                             $old_name = ($old_item = TBGContext::factory()->TBGIssuetype($original_value)) ? $old_item->getName() : TBGContext::getI18n()->__('Unknown');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Unknown');
                         }
                         $new_name = $this->getIssuetype() instanceof TBGIssuetype ? $this->getIssuetype()->getName() : TBGContext::getI18n()->__('Unknown');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_ISSUETYPE, $old_name . ' &rArr; ' . $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 ? TBGIssue::getFormattedTime($old_time) : TBGContext::getI18n()->__('Not estimated');
                             $new_formatted_time = $this->hasEstimatedTime() ? TBGIssue::getFormattedTime($this->getEstimatedTime()) : TBGContext::getI18n()->__('Not estimated');
                             $this->addLogEntry(TBGLogTable::LOG_ISSUE_TIME_ESTIMATED, $old_formatted_time . ' &rArr; ' . $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' => $this->getChangedPropertyOriginal('_spent_hours'), 'points' => $this->getChangedPropertyOriginal('_spent_points'));
                             $old_formatted_time = array_sum($old_time) > 0 ? TBGIssue::getFormattedTime($old_time) : TBGContext::getI18n()->__('No time spent');
                             $new_formatted_time = $this->hasSpentTime() ? TBGIssue::getFormattedTime($this->getSpentTime()) : TBGContext::getI18n()->__('No time spent');
                             $this->addLogEntry(TBGLogTable::LOG_ISSUE_TIME_SPENT, $old_formatted_time . ' &rArr; ' . $new_formatted_time, serialize($old_time), serialize($this->getSpentTime()));
                             $is_saved_spent = true;
                         }
                         break;
                     case '_state':
                         if ($this->isClosed()) {
                             $this->addLogEntry(TBGLogTable::LOG_ISSUE_CLOSE);
                             if ($this->getMilestone() instanceof TBGMilestone) {
                                 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();
                             }
                         } else {
                             $this->addLogEntry(TBGLogTable::LOG_ISSUE_REOPEN);
                         }
                         break;
                     case '_blocking':
                         if ($this->isBlocking()) {
                             $this->addLogEntry(TBGLogTable::LOG_ISSUE_BLOCKED);
                         } else {
                             $this->addLogEntry(TBGLogTable::LOG_ISSUE_UNBLOCKED);
                         }
                         break;
                     default:
                         if (mb_substr($property, 0, 12) == '_customfield') {
                             $key = mb_substr($property, 12);
                             $customdatatype = TBGCustomDatatype::getByKey($key);
                             switch ($customdatatype->getType()) {
                                 case TBGCustomDatatype::INPUT_TEXT:
                                     $new_value = $this->getCustomField($key) != '' ? $this->getCustomField($key) : TBGContext::getI18n()->__('Unknown');
                                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_CUSTOMFIELD_CHANGED, $key . ': ' . $new_value, $original_value, $compare_value);
                                     break;
                                 case TBGCustomDatatype::INPUT_TEXTAREA_SMALL:
                                 case TBGCustomDatatype::INPUT_TEXTAREA_MAIN:
                                     $new_value = $this->getCustomField($key) != '' ? $this->getCustomField($key) : TBGContext::getI18n()->__('Unknown');
                                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_CUSTOMFIELD_CHANGED, $key . ': ' . $new_value, $original_value, $compare_value);
                                     break;
                                 case TBGCustomDatatype::EDITIONS_CHOICE:
                                 case TBGCustomDatatype::COMPONENTS_CHOICE:
                                 case TBGCustomDatatype::RELEASES_CHOICE:
                                 case TBGCustomDatatype::STATUS_CHOICE:
                                     $old_object = null;
                                     $new_object = null;
                                     try {
                                         switch ($customdatatype->getType()) {
                                             case TBGCustomDatatype::EDITIONS_CHOICE:
                                                 $old_object = TBGContext::factory()->TBGEdition($original_value);
                                                 break;
                                             case TBGCustomDatatype::COMPONENTS_CHOICE:
                                                 $old_object = TBGContext::factory()->TBGComponent($original_value);
                                                 break;
                                             case TBGCustomDatatype::RELEASES_CHOICE:
                                                 $old_object = TBGContext::factory()->TBGBuild($original_value);
                                                 break;
                                             case TBGCustomDatatype::STATUS_CHOICE:
                                                 $old_object = TBGContext::factory()->TBGStatus($original_value);
                                                 break;
                                         }
                                     } catch (Exception $e) {
                                     }
                                     try {
                                         switch ($customdatatype->getType()) {
                                             case TBGCustomDatatype::EDITIONS_CHOICE:
                                                 $new_object = TBGContext::factory()->TBGEdition($this->getCustomField($key));
                                                 break;
                                             case TBGCustomDatatype::COMPONENTS_CHOICE:
                                                 $new_object = TBGContext::factory()->TBGComponent($this->getCustomField($key));
                                                 break;
                                             case TBGCustomDatatype::RELEASES_CHOICE:
                                                 $new_object = TBGContext::factory()->TBGBuild($this->getCustomField($key));
                                                 break;
                                             case TBGCustomDatatype::STATUS_CHOICE:
                                                 $new_object = TBGContext::factory()->TBGStatus($this->getCustomField($key));
                                                 break;
                                         }
                                     } catch (Exception $e) {
                                     }
                                     $old_value = is_object($old_object) ? $old_object->getName() : TBGContext::getI18n()->__('Unknown');
                                     $new_value = is_object($new_object) ? $new_object->getName() : TBGContext::getI18n()->__('Unknown');
                                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_CUSTOMFIELD_CHANGED, $key . ': ' . $old_value . ' &rArr; ' . $new_value, $original_value, $compare_value);
                                     break;
                                 default:
                                     $old_item = null;
                                     try {
                                         $old_item = $original_value ? new TBGCustomDatatypeOption($original_value) : null;
                                     } catch (Exception $e) {
                                     }
                                     $old_value = $old_item instanceof TBGCustomDatatypeOption ? $old_item->getName() : TBGContext::getI18n()->__('Unknown');
                                     $new_value = $this->getCustomField($key) instanceof TBGCustomDatatypeOption ? $this->getCustomField($key)->getName() : TBGContext::getI18n()->__('Unknown');
                                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_CUSTOMFIELD_CHANGED, $key . ': ' . $old_value . ' &rArr; ' . $new_value, $original_value, $compare_value);
                                     break;
                             }
                         }
                         break;
                 }
             }
         }
         if ($is_saved_estimated) {
             TBGIssueEstimates::getTable()->saveEstimate($this->getID(), $this->_estimated_months, $this->_estimated_weeks, $this->_estimated_days, $this->_estimated_hours, $this->_estimated_points);
         }
     }
     return $related_issues_to_save;
 }