コード例 #1
0
 /**
  * Returns all custom types available
  * 
  * @return array 
  */
 public static function getAll()
 {
     if (self::$_types === null) {
         self::$_types = TBGCustomFieldsTable::getTable()->getAll();
     }
     return self::$_types;
 }
コード例 #2
0
 /**
  * Returns all custom types available
  * 
  * @return array 
  */
 public static function getAll()
 {
     if (self::$_types === null) {
         self::$_types = array();
         if ($items = B2DB::getTable('TBGCustomFieldsTable')->getAll()) {
             foreach ($items as $row_id => $row) {
                 self::$_types[$row->get(TBGCustomFieldsTable::FIELD_KEY)] = TBGContext::factory()->TBGCustomDatatype($row_id, $row);
             }
         }
     }
     return self::$_types;
 }
コード例 #3
0
 public function _migrateData(\b2db\Table $old_table)
 {
     switch ($old_table->getVersion()) {
         case 1:
             if ($res = $old_table->doSelectAll()) {
                 $customdatatypes_table = TBGCustomDatatype::getB2DBTable();
                 $crit = $customdatatypes_table->getCriteria();
                 $crit->indexBy(TBGCustomFieldsTable::FIELD_KEY);
                 $customfields = $customdatatypes_table->select($crit);
                 while ($row = $res->getNextRow()) {
                     $key = $row->get('customfieldoptions.customfield_key');
                     $customfield = array_key_exists($key, $customfields) ? $customfields[$key] : null;
                     if ($customfield instanceof TBGCustomDatatype) {
                         $crit = $this->getCriteria();
                         $crit->addUpdate(self::CUSTOMFIELD_ID, $customfield->getID());
                         $this->doUpdateById($crit, $row->get(self::ID));
                     } else {
                         $this->doDeleteById($row->get(self::ID));
                     }
                 }
             }
             break;
     }
 }
コード例 #4
0
 /**
  *
  * @param \b2db\Criteria $crit
  * @param array|TBGSearchFilter $filters
  * @param \b2db\Criterion $ctn
  * @return null
  */
 public function addToCriteria($crit, $filters, $ctn = null)
 {
     $filter_key = $this->getFilterKey();
     if (in_array($this['operator'], array('=', '!=', '<=', '>=', '<', '>'))) {
         if ($filter_key == 'text') {
             if ($this['value'] != '') {
                 $searchterm = mb_strpos($this['value'], '%') !== false ? $this['value'] : "%{$this['value']}%";
                 if ($this['operator'] == '=') {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(TBGIssuesTable::TITLE, $searchterm, Criteria::DB_LIKE);
                     }
                     $ctn->addOr(TBGIssuesTable::DESCRIPTION, $searchterm, Criteria::DB_LIKE);
                     $ctn->addOr(TBGIssuesTable::REPRODUCTION_STEPS, $searchterm, Criteria::DB_LIKE);
                     $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
                 } else {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(TBGIssuesTable::TITLE, $searchterm, Criteria::DB_NOT_LIKE);
                     }
                     $ctn->addWhere(TBGIssuesTable::DESCRIPTION, $searchterm, Criteria::DB_NOT_LIKE);
                     $ctn->addWhere(TBGIssuesTable::REPRODUCTION_STEPS, $searchterm, Criteria::DB_NOT_LIKE);
                     $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
                 }
                 return $ctn;
             }
         } elseif (in_array($filter_key, self::getValidSearchFilters())) {
             if ($filter_key == 'subprojects') {
                 if (TBGContext::isProjectContext()) {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(TBGIssuesTable::PROJECT_ID, TBGContext::getCurrentProject()->getID());
                     }
                     if ($this->hasValue()) {
                         foreach ($this->getValues() as $value) {
                             switch ($value) {
                                 case 'all':
                                     $subprojects = TBGProject::getIncludingAllSubprojectsAsArray(TBGContext::getCurrentProject());
                                     foreach ($subprojects as $subproject) {
                                         if ($subproject->getID() == TBGContext::getCurrentProject()->getID()) {
                                             continue;
                                         }
                                         $ctn->addOr(TBGIssuesTable::PROJECT_ID, $subproject->getID());
                                     }
                                     break;
                                 case 'none':
                                 case '':
                                     break;
                                 default:
                                     $ctn->addOr(TBGIssuesTable::PROJECT_ID, (int) $value);
                                     break;
                             }
                         }
                     }
                     return $ctn;
                 }
             } elseif (in_array($filter_key, array('build', 'edition', 'component'))) {
                 switch ($filter_key) {
                     case 'component':
                         $tbl = TBGIssueAffectsComponentTable::getTable();
                         $fk = TBGIssueAffectsComponentTable::ISSUE;
                         break;
                     case 'edition':
                         $tbl = TBGIssueAffectsEditionTable::getTable();
                         $fk = TBGIssueAffectsEditionTable::ISSUE;
                         break;
                     case 'build':
                         $tbl = TBGIssueAffectsBuildTable::getTable();
                         $fk = TBGIssueAffectsBuildTable::ISSUE;
                         break;
                 }
                 $crit->addJoin($tbl, $fk, TBGIssuesTable::ID, array(array($tbl->getB2DBAlias() . '.' . $filter_key, $this->getValues())), \b2db\Criteria::DB_INNER_JOIN);
                 return null;
             } else {
                 if ($filter_key == 'project_id' && in_array('subprojects', $filters)) {
                     return null;
                 }
                 $values = $this->getValues();
                 $num_values = 0;
                 if ($filter_key == 'status') {
                     if ($this->hasValue('open')) {
                         $c = $crit->returnCriterion(TBGIssuesTable::STATE, TBGIssue::STATE_OPEN);
                         $num_values++;
                     }
                     if ($this->hasValue('closed')) {
                         $num_values++;
                         if (isset($c)) {
                             $c->addWhere(TBGIssuesTable::STATE, TBGIssue::STATE_CLOSED);
                         } else {
                             $c = $crit->returnCriterion(TBGIssuesTable::STATE, TBGIssue::STATE_CLOSED);
                         }
                     }
                     if (isset($c)) {
                         if (count($values) == $num_values) {
                             return $c;
                         } else {
                             $crit->addWhere($c);
                         }
                     }
                 }
                 $dbname = TBGIssuesTable::getTable()->getB2DBName();
                 foreach ($values as $value) {
                     $operator = $this['operator'];
                     $or = true;
                     if ($filter_key == 'status' && in_array($value, array('open', 'closed'))) {
                         continue;
                     } else {
                         $field = $dbname . '.' . $filter_key;
                         if ($operator == '!=' || in_array($filter_key, array('posted', 'last_updated'))) {
                             $or = false;
                         }
                     }
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion($field, $value, urldecode($operator));
                     } elseif ($or) {
                         $ctn->addOr($field, $value, urldecode($operator));
                     } else {
                         $ctn->addWhere($field, $value, urldecode($operator));
                     }
                 }
                 return $ctn;
             }
         } elseif (TBGCustomDatatype::doesKeyExist($filter_key)) {
             $customdatatype = TBGCustomDatatype::getByKey($filter_key);
             if (in_array($this->getFilterType(), TBGCustomDatatype::getInternalChoiceFieldsAsArray())) {
                 $tbl = clone TBGIssueCustomFieldsTable::getTable();
                 $crit->addJoin($tbl, TBGIssueCustomFieldsTable::ISSUE_ID, TBGIssuesTable::ID, array(array($tbl->getB2DBAlias() . '.customfields_id', $customdatatype->getID()), array($tbl->getB2DBAlias() . '.customfieldoption_id', $this->getValues())), \b2db\Criteria::DB_INNER_JOIN);
                 return null;
             } else {
                 foreach ($this->getValues() as $value) {
                     if ($customdatatype->hasCustomOptions()) {
                         if ($ctn === null) {
                             $ctn = $crit->returnCriterion(TBGIssueCustomFieldsTable::CUSTOMFIELDS_ID, $customdatatype->getID());
                             $ctn->addWhere(TBGIssueCustomFieldsTable::CUSTOMFIELDOPTION_ID, $value, $this['operator']);
                         } else {
                             $ctn->addOr(TBGIssueCustomFieldsTable::CUSTOMFIELDOPTION_ID, $value, $this['operator']);
                         }
                     } else {
                         if ($ctn === null) {
                             $ctn = $crit->returnCriterion(TBGIssueCustomFieldsTable::CUSTOMFIELDS_ID, $customdatatype->getID());
                             $ctn->addWhere(TBGIssueCustomFieldsTable::OPTION_VALUE, $value, $this['operator']);
                         } else {
                             $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $value, $this['operator']);
                         }
                     }
                 }
                 return $ctn;
             }
         }
     }
 }
コード例 #5
0
echo image_tag('spinning_16.gif', array('style' => 'margin-right: 5px; display: none;', 'id' => 'add_custom_type_indicator'));
?>
						</div>
						<label for="new_custom_field_name" style="width: 150px; display: inline-block;"><?php 
echo __('Add new issue field');
?>
</label>
						<input type="text" name="name" id="new_custom_field_name" style="width: 250px;">
						<br style="clear: both;">
						<label for="new_custom_field_name" style="width: 150px; display: inline-block;"><?php 
echo __('Field type');
?>
</label>
						<select id="new_custom_field_type" name="field_type" style="width: 400px;">
							<?php 
foreach (TBGCustomDatatype::getFieldTypes() as $type => $description) {
    ?>
								<option value="<?php 
    echo $type;
    ?>
"><?php 
    echo $description;
    ?>
</option>
							<?php 
}
?>
						</select>
						<br style="clear: both;">
					</form>
				</div>
コード例 #6
0
 public function findIssues($filters = array(), $results_per_page = 30, $offset = 0, $groupby = null, $grouporder = null)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::DELETED, false);
     if (count($filters) > 0) {
         $crit->addJoin(TBGIssueCustomFieldsTable::getTable(), TBGIssueCustomFieldsTable::ISSUE_ID, TBGIssuesTable::ID);
         foreach ($filters as $filter => $filter_info) {
             if (array_key_exists('value', $filter_info) && in_array($filter_info['operator'], array('=', '!=', '<=', '>=', '<', '>'))) {
                 if ($filter == 'text') {
                     if ($filter_info['value'] != '') {
                         $searchterm = strpos($filter_info['value'], '%') !== false ? $filter_info['value'] : "%{$filter_info['value']}%";
                         if ($filter_info['operator'] == '=') {
                             $ctn = $crit->returnCriterion(self::TITLE, $searchterm, B2DBCriteria::DB_LIKE);
                             $ctn->addOr(self::DESCRIPTION, $searchterm, B2DBCriteria::DB_LIKE);
                             $ctn->addOr(self::REPRODUCTION_STEPS, $searchterm, B2DBCriteria::DB_LIKE);
                             $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $searchterm, B2DBCriteria::DB_LIKE);
                         } else {
                             $ctn = $crit->returnCriterion(self::TITLE, $searchterm, B2DBCriteria::DB_NOT_LIKE);
                             $ctn->addWhere(self::DESCRIPTION, $searchterm, B2DBCriteria::DB_NOT_LIKE);
                             $ctn->addWhere(self::REPRODUCTION_STEPS, $searchterm, B2DBCriteria::DB_NOT_LIKE);
                             $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $searchterm, B2DBCriteria::DB_NOT_LIKE);
                         }
                         $crit->addWhere($ctn);
                     }
                 } elseif (in_array($filter, self::getValidSearchFilters())) {
                     $crit->addWhere($this->getB2DBName() . '.' . $filter, $filter_info['value'], $filter_info['operator']);
                 } elseif (TBGCustomDatatype::doesKeyExist($filter)) {
                     $customdatatype = TBGCustomDatatype::getByKey($filter);
                     $ctn = $crit->returnCriterion(TBGIssueCustomFieldsTable::CUSTOMFIELDS_ID, $customdatatype->getID());
                     $ctn->addWhere(TBGIssueCustomFieldsTable::OPTION_VALUE, $filter_info['value'], $filter_info['operator']);
                     $crit->addWhere($ctn);
                 }
             } else {
                 if (in_array($filter, self::getValidSearchFilters())) {
                     $first_val = array_shift($filter_info);
                     if ($filter == 'text') {
                         $filter_info = $first_val;
                         if ($filter_info['value'] != '') {
                             $searchterm = strpos($filter_info['value'], '%') !== false ? $filter_info['value'] : "%{$filter_info['value']}%";
                             if ($filter_info['operator'] == '=') {
                                 $ctn = $crit->returnCriterion(self::TITLE, $searchterm, B2DBCriteria::DB_LIKE);
                                 $ctn->addOr(self::DESCRIPTION, $searchterm, B2DBCriteria::DB_LIKE);
                                 $ctn->addOr(self::REPRODUCTION_STEPS, $searchterm, B2DBCriteria::DB_LIKE);
                             } else {
                                 $ctn = $crit->returnCriterion(self::TITLE, $searchterm, B2DBCriteria::DB_NOT_LIKE);
                                 $ctn->addWhere(self::DESCRIPTION, $searchterm, B2DBCriteria::DB_NOT_LIKE);
                                 $ctn->addWhere(self::REPRODUCTION_STEPS, $searchterm, B2DBCriteria::DB_NOT_LIKE);
                             }
                             $crit->addWhere($ctn);
                         }
                     } else {
                         $ctn = $crit->returnCriterion($this->getB2DBName() . '.' . $filter, $first_val['value'], $first_val['operator']);
                         if (count($filter_info) > 0) {
                             foreach ($filter_info as $single_filter) {
                                 if (in_array($single_filter['operator'], array('=', '<=', '>=', '<', '>'))) {
                                     $ctn->addOr($this->getB2DBName() . '.' . $filter, $single_filter['value'], $single_filter['operator']);
                                 } elseif ($single_filter['operator'] == '!=') {
                                     $ctn->addWhere($this->getB2DBName() . '.' . $filter, $single_filter['value'], $single_filter['operator']);
                                 }
                             }
                         }
                         $crit->addWhere($ctn);
                     }
                 } elseif (TBGCustomDatatype::doesKeyExist($filter)) {
                     $customdatatype = TBGCustomDatatype::getByKey($filter);
                     $first_val = array_shift($filter_info);
                     $ctn = $crit->returnCriterion(TBGIssueCustomFieldsTable::CUSTOMFIELDS_ID, $customdatatype->getID());
                     $ctn->addWhere(TBGIssueCustomFieldsTable::OPTION_VALUE, $first_val['value'], $first_val['operator']);
                     if (count($filter_info) > 0) {
                         foreach ($filter_info as $single_filter) {
                             if (in_array($single_filter['operator'], array('=', '!=', '<=', '>=', '<', '>'))) {
                                 $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $single_filter['value'], $single_filter['operator']);
                             }
                         }
                     }
                     $crit->addWhere($ctn);
                 }
             }
         }
     }
     $crit->addSelectionColumn(self::ID);
     $crit->setDistinct();
     if ($offset != 0) {
         $crit->setOffset($offset);
     }
     $crit2 = clone $crit;
     $count = $this->doCount($crit2);
     if ($count > 0) {
         if ($results_per_page != 0) {
             $crit->setLimit($results_per_page);
         }
         if ($offset != 0) {
             $crit->setOffset($offset);
         }
         if ($groupby !== null) {
             $grouporder = $grouporder !== null ? $grouporder == 'asc' ? B2DBCriteria::SORT_ASC : B2DBCriteria::SORT_DESC : B2DBCriteria::SORT_ASC;
             switch ($groupby) {
                 case 'category':
                     $crit->addSelectionColumn(TBGListTypesTable::NAME);
                     $crit->addOrderBy(TBGListTypesTable::NAME, $grouporder);
                     break;
                 case 'status':
                     $crit->addSelectionColumn(self::STATUS);
                     $crit->addOrderBy(self::STATUS, $grouporder);
                     break;
                 case 'milestone':
                     $crit->addSelectionColumn(self::MILESTONE);
                     $crit->addSelectionColumn(self::PERCENT_COMPLETE);
                     $crit->addOrderBy(self::MILESTONE, $grouporder);
                     $crit->addOrderBy(self::PERCENT_COMPLETE, 'desc');
                     break;
                 case 'assignee':
                     $crit->addSelectionColumn(self::ASSIGNED_TYPE);
                     $crit->addSelectionColumn(self::ASSIGNED_TO);
                     $crit->addOrderBy(self::ASSIGNED_TYPE);
                     $crit->addOrderBy(self::ASSIGNED_TO, $grouporder);
                     break;
                 case 'state':
                     $crit->addSelectionColumn(self::STATE);
                     $crit->addOrderBy(self::STATE, $grouporder);
                     break;
                 case 'severity':
                     $crit->addSelectionColumn(self::SEVERITY);
                     $crit->addOrderBy(self::SEVERITY, $grouporder);
                     break;
                 case 'user_pain':
                     $crit->addSelectionColumn(self::USER_PAIN);
                     $crit->addOrderBy(self::USER_PAIN, $grouporder);
                     break;
                 case 'votes':
                     $crit->addSelectionColumn(self::VOTES_TOTAL);
                     $crit->addOrderBy(self::VOTES_TOTAL, $grouporder);
                     break;
                 case 'resolution':
                     $crit->addSelectionColumn(self::RESOLUTION);
                     $crit->addOrderBy(self::RESOLUTION, $grouporder);
                     break;
                 case 'priority':
                     $crit->addSelectionColumn(self::PRIORITY);
                     $crit->addOrderBy(self::PRIORITY, $grouporder);
                     break;
                 case 'issuetype':
                     $crit->addJoin(TBGIssueTypesTable::getTable(), TBGIssueTypesTable::ID, self::ISSUE_TYPE);
                     $crit->addSelectionColumn(TBGIssueTypesTable::NAME);
                     $crit->addOrderBy(TBGIssueTypesTable::NAME, $grouporder);
                     break;
                 case 'edition':
                     $crit->addJoin(TBGIssueAffectsEditionTable::getTable(), TBGIssueAffectsEditionTable::ISSUE, self::ID);
                     $crit->addJoin(TBGEditionsTable::getTable(), TBGEditionsTable::ID, TBGIssueAffectsEditionTable::EDITION, array(), B2DBCriteria::DB_LEFT_JOIN, TBGIssueAffectsEditionTable::getTable());
                     $crit->addSelectionColumn(TBGEditionsTable::NAME);
                     $crit->addOrderBy(TBGEditionsTable::NAME, $grouporder);
                     break;
                 case 'build':
                     $crit->addJoin(TBGIssueAffectsBuildTable::getTable(), TBGIssueAffectsBuildTable::ISSUE, self::ID);
                     $crit->addJoin(TBGBuildsTable::getTable(), TBGBuildsTable::ID, TBGIssueAffectsBuildTable::BUILD, array(), B2DBCriteria::DB_LEFT_JOIN, TBGIssueAffectsBuildTable::getTable());
                     $crit->addSelectionColumn(TBGBuildsTable::NAME);
                     $crit->addOrderBy(TBGBuildsTable::NAME, $grouporder);
                     break;
                 case 'component':
                     $crit->addJoin(TBGIssueAffectsComponentTable::getTable(), TBGIssueAffectsComponentTable::ISSUE, self::ID);
                     $crit->addJoin(TBGComponentsTable::getTable(), TBGComponentsTable::ID, TBGIssueAffectsComponentTable::COMPONENT, array(), B2DBCriteria::DB_LEFT_JOIN, TBGIssueAffectsComponentTable::getTable());
                     $crit->addSelectionColumn(TBGComponentsTable::NAME);
                     $crit->addOrderBy(TBGComponentsTable::NAME, $grouporder);
                     break;
             }
         }
         $crit->addSelectionColumn(self::LAST_UPDATED);
         $crit->addOrderBy(self::LAST_UPDATED, 'asc');
         $res = $this->doSelect($crit, 'none');
         $ids = array();
         while ($row = $res->getNextRow()) {
             $ids[] = $row->get(self::ID);
         }
         $ids = array_reverse($ids);
         $crit2 = $this->getCriteria();
         $crit2->addWhere(self::ID, $ids, B2DBCriteria::DB_IN);
         $crit2->addOrderBy(self::ID, $ids);
         $res = $this->doSelect($crit2);
         return array($res, $count);
     } else {
         return array(null, 0);
     }
 }
コード例 #7
0
 /**
  * Return an array specifying visibility, requirement and choices for fields in issues
  * 
  * @param integer $issue_type
  * @param boolean $reportable[optional] Whether to only include fields that can be reported
  * 
  * @return array
  */
 protected function _getFieldsArray($issue_type, $reportable = true)
 {
     $issue_type = is_object($issue_type) ? $issue_type->getID() : $issue_type;
     if (!isset($this->_fieldsarrays[$issue_type][(int) $reportable])) {
         $retval = array();
         $res = B2DB::getTable('TBGIssueFieldsTable')->getBySchemeIDandIssuetypeID($this->getIssuetypeScheme()->getID(), $issue_type);
         if ($res) {
             $builtin_types = TBGDatatype::getAvailableFields(true);
             while ($row = $res->getNextRow()) {
                 if (!$reportable || (bool) $row->get(TBGIssueFieldsTable::REPORTABLE) == true) {
                     if ($reportable) {
                         if (in_array($row->get(TBGIssueFieldsTable::FIELD_KEY), $builtin_types) && (!$this->fieldPermissionCheck($row->get(TBGIssueFieldsTable::FIELD_KEY), $reportable) && !($row->get(TBGIssueFieldsTable::REQUIRED) && $reportable))) {
                             continue;
                         } elseif (!in_array($row->get(TBGIssueFieldsTable::FIELD_KEY), $builtin_types) && (!$this->fieldPermissionCheck($row->get(TBGIssueFieldsTable::FIELD_KEY), $reportable, true) && !($row->get(TBGIssueFieldsTable::REQUIRED) && $reportable))) {
                             continue;
                         }
                     }
                     $field_key = $row->get(TBGIssueFieldsTable::FIELD_KEY);
                     $retval[$field_key] = array('required' => (bool) $row->get(TBGIssueFieldsTable::REQUIRED), 'additional' => (bool) $row->get(TBGIssueFieldsTable::ADDITIONAL));
                     if (!in_array($field_key, $builtin_types)) {
                         $retval[$field_key]['custom'] = true;
                         $custom_type = TBGCustomDatatype::getByKey($field_key);
                         if ($custom_type instanceof TBGCustomDatatype) {
                             $retval[$field_key]['custom_type'] = $custom_type->getType();
                         } else {
                             unset($retval[$field_key]);
                         }
                     }
                 }
             }
             if (array_key_exists('user_pain', $retval)) {
                 $retval['pain_bug_type'] = array('required' => $retval['user_pain']['required']);
                 $retval['pain_likelihood'] = array('required' => $retval['user_pain']['required']);
                 $retval['pain_effect'] = array('required' => $retval['user_pain']['required']);
             }
             if ($reportable) {
                 foreach ($retval as $key => $return_details) {
                     if ($key == 'edition' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::EDITIONS_LIST, TBGCustomDatatype::EDITIONS_CHOICE))) {
                         $retval[$key]['values'] = array();
                         $retval[$key]['values'][''] = TBGContext::getI18n()->__('None');
                         foreach ($this->getEditions() as $edition) {
                             $retval[$key]['values'][$edition->getID()] = $edition->getName();
                         }
                         if (!$this->isEditionsEnabled() || empty($retval[$key]['values'])) {
                             if (!$retval[$key]['required']) {
                                 unset($retval[$key]);
                             } else {
                                 unset($retval[$key]['values']);
                             }
                         }
                         if (array_key_exists($key, $retval) && array_key_exists('values', $retval[$key])) {
                             asort($retval[$key]['values'], SORT_STRING);
                         }
                     } elseif ($key == 'status' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::EDITIONS_LIST, TBGCustomDatatype::STATUS_CHOICE))) {
                         $retval[$key]['values'] = array();
                         foreach (TBGStatus::getAll() as $status) {
                             $retval[$key]['values'][$status->getID()] = $status->getName();
                         }
                         if (empty($retval[$key]['values'])) {
                             if (!$retval[$key]['required']) {
                                 unset($retval[$key]);
                             } else {
                                 unset($retval[$key]['values']);
                             }
                         }
                         if (array_key_exists($key, $retval) && array_key_exists('values', $retval[$key])) {
                             asort($retval[$key]['values'], SORT_STRING);
                         }
                     } elseif ($key == 'component' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::COMPONENTS_LIST, TBGCustomDatatype::COMPONENTS_CHOICE))) {
                         $retval[$key]['values'] = array();
                         $retval[$key]['values'][''] = TBGContext::getI18n()->__('None');
                         foreach ($this->getComponents() as $component) {
                             $retval[$key]['values'][$component->getID()] = $component->getName();
                         }
                         if (!$this->isComponentsEnabled() || empty($retval[$key]['values'])) {
                             if (!$retval[$key]['required']) {
                                 unset($retval[$key]);
                             } else {
                                 unset($retval[$key]['values']);
                             }
                         }
                         if (array_key_exists($key, $retval) && array_key_exists('values', $retval[$key])) {
                             asort($retval[$key]['values'], SORT_STRING);
                         }
                     } elseif ($key == 'build' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::RELEASES_LIST, TBGCustomDatatype::RELEASES_CHOICE))) {
                         $retval[$key]['values'] = array();
                         $retval[$key]['values'][''] = TBGContext::getI18n()->__('None');
                         foreach ($this->getBuilds() as $build) {
                             $retval[$key]['values'][$build->getID()] = $build->getName() . ' (' . $build->getVersion() . ')';
                         }
                         if (!$this->isBuildsEnabled() || empty($retval[$key]['values'])) {
                             if (!$retval[$key]['required']) {
                                 unset($retval[$key]);
                             } else {
                                 unset($retval[$key]['values']);
                             }
                         }
                     }
                 }
             }
         }
         $this->_fieldsarrays[$issue_type][(int) $reportable] = $retval;
     }
     return $this->_fieldsarrays[$issue_type][(int) $reportable];
 }
コード例 #8
0
"><?php 
        echo $severity->getName();
        ?>
</option>
									<?php 
    }
    ?>
								</select>
								<a href="javascript:void(0);" class="img" onclick="$('severity_link').show();$('severity_additional_div').hide();$('severity_id_additional').setValue(0);"><?php 
    echo image_tag('undo.png', array('style' => 'float: none; margin-left: 5px;'));
    ?>
</a>
							</div>
						</li>
						<?php 
    foreach (TBGCustomDatatype::getAll() as $customdatatype) {
        ?>
							<li id="<?php 
        echo $customdatatype->getKey();
        ?>
_additional" style="display: none;">
								<?php 
        echo image_tag('icon_customdatatype.png');
        ?>
								<div id="<?php 
        echo $customdatatype->getKey();
        ?>
_link"<?php 
        if ($selected_customdatatype[$customdatatype->getKey()] !== null) {
            ?>
 style="display: none;"<?php 
コード例 #9
0
 public function _migrateData(\b2db\Table $old_table)
 {
     switch ($old_table->getVersion()) {
         case 1:
             if ($res = $old_table->doSelectAll()) {
                 $customfields = TBGCustomDatatype::getB2DBTable()->selectAll();
                 while ($row = $res->getNextRow()) {
                     $customfield_id = $row->get(self::CUSTOMFIELDS_ID);
                     $customfield = array_key_exists($customfield_id, $customfields) ? $customfields[$customfield_id] : null;
                     if ($customfield instanceof TBGCustomDatatype && $customfield->hasCustomOptions()) {
                         $customfieldoption = TBGCustomFieldOptionsTable::getTable()->getByValueAndCustomfieldID((int) $row->get(self::OPTION_VALUE), $customfield->getID());
                         if ($customfieldoption instanceof TBGCustomDatatypeOption) {
                             $crit = $this->getCriteria();
                             $crit->addUpdate(self::CUSTOMFIELDOPTION_ID, $customfieldoption->getID());
                             $crit->addUpdate(self::OPTION_VALUE, null);
                             $this->doUpdateById($crit, $row->get(self::ID));
                         } elseif ($row->get(self::ID)) {
                             $this->doDeleteById($row->get(self::ID));
                         }
                     }
                 }
             }
             break;
     }
 }
コード例 #10
0
 protected static function _cacheAvailablePermissions()
 {
     if (self::$_available_permissions === null) {
         $i18n = self::getI18n();
         self::$_available_permissions = array('user' => array(), 'general' => array(), 'project' => array());
         self::$_available_permissions['user']['canseeallissues'] = array('description' => $i18n->__('Can see issues reported by other users'), 'mode' => 'permissive');
         self::$_available_permissions['user']['canseegroupissues'] = array('description' => $i18n->__('Can see issues reported by users in the same group'), 'mode' => 'permissive');
         self::$_available_permissions['configuration']['cansaveconfig'] = array('description' => $i18n->__('Can access the configuration page and edit all configuration'), 'details' => array());
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Settings" configuration page'), 'target_id' => 12));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Settings" configuration page'), 'target_id' => 12));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Permissions" configuration page'), 'target_id' => 5));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Permissions" configuration page'), 'target_id' => 5));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Uploads" configuration page'), 'target_id' => 3));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Uploads" configuration page'), 'target_id' => 3));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Scopes" configuration page'), 'target_id' => 14));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Scopes" configuration page'), 'target_id' => 14));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Import" configuration page'), 'target_id' => 16));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Import" configuration page'), 'target_id' => 16));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Projects" configuration page'), 'target_id' => 10));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Projects" configuration page'), 'target_id' => 10));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Issue types" configuration page'), 'target_id' => 6));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Issue types" configuration page'), 'target_id' => 6));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Issue fields" configuration page'), 'target_id' => 4));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Issue fields" configuration page'), 'target_id' => 4));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Users, teams and groups" configuration page'), 'target_id' => 2));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Users, teams and groups" configuration page'), 'target_id' => 2));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('canviewconfig' => array('description' => $i18n->__('Read-only access: "Modules" and any module configuration page'), 'target_id' => 15));
         self::$_available_permissions['configuration']['cansaveconfig']['details'][] = array('cansaveconfig' => array('description' => $i18n->__('Read + write access: "Modules" configuration page and any modules'), 'target_id' => 15));
         self::$_available_permissions['general']['canfindissuesandsavesearches'] = array('description' => $i18n->__('Can search for issues and create saved searches'), 'details' => array());
         self::$_available_permissions['general']['canfindissuesandsavesearches']['details']['canfindissues'] = array('description' => $i18n->__('Can search for issues'));
         //self::$_available_permissions['general']['canfindissuesandsavesearches']['details']['cancreatesavedsearches'] = array('description' => $i18n->__('Can create saved searches'));
         self::$_available_permissions['general']['canfindissuesandsavesearches']['details']['cancreatepublicsearches'] = array('description' => $i18n->__('Can create saved searches that are public'));
         self::$_available_permissions['general']['caneditmainmenu'] = array('description' => $i18n->__('Can edit main menu'));
         self::$_available_permissions['pages']['page_home_access'] = array('description' => $i18n->__('Can access the frontpage'));
         self::$_available_permissions['pages']['page_dashboard_access'] = array('description' => $i18n->__('Can access the user dashboard'));
         self::$_available_permissions['pages']['page_search_access'] = array('description' => $i18n->__('Can access the search page'));
         self::$_available_permissions['pages']['page_about_access'] = array('description' => $i18n->__('Can access the "About" page'));
         self::$_available_permissions['pages']['page_account_access'] = array('description' => $i18n->__('Can access the "My account" page'));
         self::$_available_permissions['pages']['page_teamlist_access'] = array('description' => $i18n->__('Can see list of teams in header menu'));
         self::$_available_permissions['pages']['page_clientlist_access'] = array('description' => $i18n->__('Can access all clients'));
         self::$_available_permissions['project_pages']['page_project_allpages_access'] = array('description' => $i18n->__('Can access all project pages'), 'details' => array());
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_dashboard_access'] = array('description' => $i18n->__('Can access the project dashboard'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_planning_access'] = array('description' => $i18n->__('Can access the project planning page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_scrum_access'] = array('description' => $i18n->__('Can access the project scrum page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_issues_access'] = array('description' => $i18n->__('Can access the project issues search page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_roadmap_access'] = array('description' => $i18n->__('Can access the project roadmap page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_team_access'] = array('description' => $i18n->__('Can access the project team page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_statistics_access'] = array('description' => $i18n->__('Can access the project statistics page'));
         self::$_available_permissions['project_pages']['page_project_allpages_access']['details']['page_project_timeline_access'] = array('description' => $i18n->__('Can access the project timeline page'));
         self::$_available_permissions['project']['canseeproject'] = array('description' => $i18n->__('Can see that project exists'));
         self::$_available_permissions['project']['canseeprojecthierarchy'] = array('description' => $i18n->__('Can see complete project hierarchy'));
         self::$_available_permissions['project']['canseeprojecthierarchy']['details']['canseeallprojecteditions'] = array('description' => $i18n->__('Can see all editions'));
         self::$_available_permissions['project']['canseeprojecthierarchy']['details']['canseeallprojectcomponents'] = array('description' => $i18n->__('Can see all components'));
         self::$_available_permissions['project']['canseeprojecthierarchy']['details']['canseeallprojectbuilds'] = array('description' => $i18n->__('Can see all release'));
         self::$_available_permissions['project']['canseeprojecthierarchy']['details']['canseeallprojectmilestones'] = array('description' => $i18n->__('Can see all milestones'));
         self::$_available_permissions['project']['candoscrumplanning'] = array('description' => $i18n->__('Can manage stories, tasks, sprints and backlog on the sprint planning page'), 'details' => array());
         self::$_available_permissions['project']['candoscrumplanning']['details']['canaddscrumuserstories'] = array('description' => $i18n->__('Can add new user stories to the backlog on the sprint planning page'));
         self::$_available_permissions['project']['candoscrumplanning']['details']['candoscrumplanning_backlog'] = array('description' => $i18n->__('Can manage the backlog on the sprint planning page'));
         self::$_available_permissions['project']['candoscrumplanning']['details']['canaddscrumsprints'] = array('description' => $i18n->__('Can add sprints on the sprint planning page'));
         self::$_available_permissions['project']['candoscrumplanning']['details']['canassignscrumuserstoriestosprints'] = array('description' => $i18n->__('Can add stories to sprints on the sprint planning page'));
         self::$_available_permissions['project']['canmanageproject'] = array('description' => $i18n->__('Can manage project'));
         self::$_available_permissions['project']['canmanageproject']['details']['canmanageprojectreleases'] = array('description' => $i18n->__('Can manage project releases and components'));
         self::$_available_permissions['project']['canmanageproject']['details']['caneditprojectdetails'] = array('description' => $i18n->__('Can edit project details and settings'));
         self::$_available_permissions['edition']['canseeedition'] = array('description' => $i18n->__('Can see this edition'));
         self::$_available_permissions['component']['canseecomponent'] = array('description' => $i18n->__('Can see this component'));
         self::$_available_permissions['build']['canseebuild'] = array('description' => $i18n->__('Can see this release'));
         self::$_available_permissions['milestone']['canseemilestone'] = array('description' => $i18n->__('Can see this milestone'));
         self::$_available_permissions['issues']['canvoteforissues'] = array('description' => $i18n->__('Can vote for issues'));
         self::$_available_permissions['issues']['canlockandeditlockedissues'] = array('description' => $i18n->__('Can lock and edit locked issues'));
         self::$_available_permissions['issues']['cancreateandeditissues'] = array('description' => $i18n->__('Can create issues, edit basic information on issues reported by the user and close/re-open them'), 'details' => array());
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['cancreateissues'] = array('description' => $i18n->__('Can create new issues'), 'details' => array());
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['caneditissuebasicown'] = array('description' => $i18n->__('Can edit title and description on issues reported by the user'), 'details' => array());
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['caneditissuebasicown']['details']['caneditissuetitleown'] = array('description' => $i18n->__('Can edit issue title on issues reported by the user'));
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['caneditissuebasicown']['details']['caneditissuedescriptionown'] = array('description' => $i18n->__('Can edit issue description on issues reported by the user'));
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['caneditissuebasicown']['details']['caneditissuereproduction_stepsown'] = array('description' => $i18n->__('Can edit steps to reproduce on issues reported by the user'));
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['canclosereopenissuesown'] = array('description' => $i18n->__('Can close and reopen issues reported by the user'), 'details' => array());
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['canclosereopenissuesown']['details']['cancloseissuesown'] = array('description' => $i18n->__('Can close issues reported by the user'));
         self::$_available_permissions['issues']['cancreateandeditissues']['details']['canclosereopenissuesown']['details']['canreopenissuesown'] = array('description' => $i18n->__('Can re-open issues reported by the user'));
         self::$_available_permissions['issues']['caneditissue'] = array('description' => $i18n->__('Can delete, close, reopen and update any issue details and progress'), 'details' => array());
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuebasic'] = array('description' => $i18n->__('Can edit title and description on any issues'), 'details' => array());
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuebasic']['details']['caneditissuetitle'] = array('description' => $i18n->__('Can edit any issue title'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuebasic']['details']['caneditissuedescription'] = array('description' => $i18n->__('Can edit any issue description'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuebasic']['details']['caneditissuereproduction_steps'] = array('description' => $i18n->__('Can edit any issue steps to reproduce'));
         self::$_available_permissions['issues']['caneditissue']['details']['candeleteissues'] = array('description' => $i18n->__('Can delete issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['canclosereopenissues'] = array('description' => $i18n->__('Can close any issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['canclosereopenissues']['details']['cancloseissues'] = array('description' => $i18n->__('Can close any issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['canclosereopenissues']['details']['canreopenissues'] = array('description' => $i18n->__('Can re-open any issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueposted_by'] = array('description' => $i18n->__('Can edit issue posted by'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueowned_by'] = array('description' => $i18n->__('Can edit issue owned by'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueassigned_to'] = array('description' => $i18n->__('Can edit issue assigned_to'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuestatus'] = array('description' => $i18n->__('Can edit issue status'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuecategory'] = array('description' => $i18n->__('Can edit issue category'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuepriority'] = array('description' => $i18n->__('Can edit issue priority'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueseverity'] = array('description' => $i18n->__('Can edit issue severity'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuereproducability'] = array('description' => $i18n->__('Can edit issue reproducability'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueresolution'] = array('description' => $i18n->__('Can edit issue resolution'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissueestimated_time'] = array('description' => $i18n->__('Can estimate issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuespent_time'] = array('description' => $i18n->__('Can spend time working on issues'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuepercent_complete'] = array('description' => $i18n->__('Can edit issue percent complete'));
         self::$_available_permissions['issues']['caneditissue']['details']['caneditissuemilestone'] = array('description' => $i18n->__('Can set issue milestone'));
         self::$_available_permissions['issues']['caneditissuecustomfieldsown'] = array('description' => $i18n->__('Can change custom field values for issues reported by the user'), 'details' => array());
         self::$_available_permissions['issues']['caneditissuecustomfields'] = array('description' => $i18n->__('Can change custom field values for any issues'), 'details' => array());
         foreach (TBGCustomDatatype::getAll() as $cdf) {
             self::$_available_permissions['issues']['caneditissuecustomfieldsown']['details']['caneditissuecustomfields' . $cdf->getKey() . 'own'] = array('description' => $i18n->__('Can change custom field "%field_name%" for issues reported by the user', array('%field_name%' => $cdf->getDescription())));
             self::$_available_permissions['issues']['caneditissuecustomfields']['details']['caneditissuecustomfields' . $cdf->getKey()] = array('description' => $i18n->__('Can change custom field "%field_name%" for any issues', array('%field_name%' => $cdf->getDescription())));
         }
         self::$_available_permissions['issues']['canaddextrainformationtoissues'] = array('description' => $i18n->__('Can add/remove extra information (edition, component, release, links and files) to issues'), 'details' => array());
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddbuildsown'] = array('description' => $i18n->__('Can add releases / versions to list of affected versions for issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddbuilds'] = array('description' => $i18n->__('Can add releases / versions to list of affected versions for any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddcomponentsown'] = array('description' => $i18n->__('Can add components to list of affected components for issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddcomponents'] = array('description' => $i18n->__('Can add components to list of affected components for any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddeditionsown'] = array('description' => $i18n->__('Can add editions to list of affected editions for issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddeditions'] = array('description' => $i18n->__('Can add editions to list of affected editions for any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddlinkstoissuesown'] = array('description' => $i18n->__('Can add links to issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddlinkstoissues'] = array('description' => $i18n->__('Can add links to any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddfilestoissuesown'] = array('description' => $i18n->__('Can add files to and remove own files from issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddfilestoissues'] = array('description' => $i18n->__('Can add files to and remove own files from any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canremovefilesfromissuesown'] = array('description' => $i18n->__('Can remove any attachments from issues reported by the user'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canremovefilesfromissues'] = array('description' => $i18n->__('Can remove any attachments from any issues'));
         self::$_available_permissions['issues']['canaddextrainformationtoissues']['details']['canaddrelatedissues'] = array('description' => $i18n->__('Can add related issues to other issues'));
         self::$_available_permissions['issues']['canpostandeditcomments'] = array('description' => $i18n->__('Can see public comments, post new, edit own and delete own comments'), 'details' => array());
         self::$_available_permissions['issues']['canpostandeditcomments']['details']['canviewcomments'] = array('description' => $i18n->__('Can see public comments'));
         self::$_available_permissions['issues']['canpostandeditcomments']['details']['canpostcomments'] = array('description' => $i18n->__('Can post comments'));
         self::$_available_permissions['issues']['canpostandeditcomments']['details']['caneditcommentsown'] = array('description' => $i18n->__('Can edit own comments'));
         self::$_available_permissions['issues']['canpostandeditcomments']['details']['candeletecommentsown'] = array('description' => $i18n->__('Can delete own comments'));
         self::$_available_permissions['issues']['canpostseeandeditallcomments'] = array('description' => $i18n->__('Can see all comments (including non-public), post new, edit and delete all comments'), 'details' => array());
         self::$_available_permissions['issues']['canpostseeandeditallcomments']['details']['canseenonpubliccomments'] = array('description' => $i18n->__('Can see all comments including hidden'));
         self::$_available_permissions['issues']['canpostseeandeditallcomments']['details']['caneditcomments'] = array('description' => $i18n->__('Can edit all comments'));
         self::$_available_permissions['issues']['canpostseeandeditallcomments']['details']['candeletecomments'] = array('description' => $i18n->__('Can delete any comments'));
         self::$_available_permissions['pages']['page_account_access']['details']['canchangepassword'] = array('description' => $i18n->__('Can change own password'), 'mode' => 'permissive');
         //self::trigger('core', 'cachepermissions', array('permissions' => &self::$_available_permissions));
     }
 }
コード例 #11
0
 public function componentIssueTypeSchemeOptions()
 {
     $this->issuetype = TBGContext::factory()->TBGIssuetype($this->id);
     $this->scheme = TBGContext::factory()->TBGIssuetypeScheme($this->scheme_id);
     $this->builtinfields = TBGDatatype::getAvailableFields(true);
     $this->customtypes = TBGCustomDatatype::getAll();
     $this->visiblefields = $this->scheme->getVisibleFieldsForIssuetype($this->issuetype);
 }
コード例 #12
0
 protected function setupVariables()
 {
     $i18n = TBGContext::getI18n();
     $this->statuses = TBGStatus::getAll();
     $this->issuetypes = $this->issue->getProject()->getIssuetypeScheme()->getIssuetypes();
     $fields_list = array();
     $fields_list['category'] = array('title' => $i18n->__('Category'), 'visible' => $this->issue->isCategoryVisible(), 'changed' => $this->issue->isCategoryChanged(), 'merged' => $this->issue->isCategoryMerged(), 'name' => $this->issue->getCategory() instanceof TBGCategory ? $this->issue->getCategory()->getName() : '', 'name_visible' => (bool) ($this->issue->getCategory() instanceof TBGCategory), 'noname_visible' => (bool) (!$this->issue->getCategory() instanceof TBGCategory), 'icon' => false, 'change_tip' => $i18n->__('Click to change category'), 'change_header' => $i18n->__('Change category'), 'clear' => $i18n->__('Clear the category'), 'select' => $i18n->__('%clear_the_category% or click to select a new category', array('%clear_the_category%' => '')));
     if ($this->issue->isEditable() && $this->issue->canEditCategory()) {
         $fields_list['category']['choices'] = TBGCategory::getAll();
     }
     $fields_list['resolution'] = array('title' => $i18n->__('Resolution'), 'visible' => $this->issue->isResolutionVisible(), 'changed' => $this->issue->isResolutionChanged(), 'merged' => $this->issue->isResolutionMerged(), 'name' => $this->issue->getResolution() instanceof TBGResolution ? $this->issue->getResolution()->getName() : '', 'name_visible' => (bool) ($this->issue->getResolution() instanceof TBGResolution), 'noname_visible' => (bool) (!$this->issue->getResolution() instanceof TBGResolution), 'icon' => false, 'change_tip' => $i18n->__('Click to change resolution'), 'change_header' => $i18n->__('Change resolution'), 'clear' => $i18n->__('Clear the resolution'), 'select' => $i18n->__('%clear_the_resolution% or click to select a new resolution', array('%clear_the_resolution%' => '')));
     if ($this->issue->isUpdateable() && $this->issue->canEditResolution()) {
         $fields_list['resolution']['choices'] = TBGResolution::getAll();
     }
     $fields_list['priority'] = array('title' => $i18n->__('Priority'), 'visible' => $this->issue->isPriorityVisible(), 'changed' => $this->issue->isPriorityChanged(), 'merged' => $this->issue->isPriorityMerged(), 'name' => $this->issue->getPriority() instanceof TBGPriority ? $this->issue->getPriority()->getName() : '', 'name_visible' => (bool) ($this->issue->getPriority() instanceof TBGPriority), 'noname_visible' => (bool) (!$this->issue->getPriority() instanceof TBGPriority), 'icon' => false, 'change_tip' => $i18n->__('Click to change priority'), 'change_header' => $i18n->__('Change priority'), 'clear' => $i18n->__('Clear the priority'), 'select' => $i18n->__('%clear_the_priority% or click to select a new priority', array('%clear_the_priority%' => '')));
     if ($this->issue->isUpdateable() && $this->issue->canEditPriority()) {
         $fields_list['priority']['choices'] = TBGPriority::getAll();
     }
     $fields_list['reproducability'] = array('title' => $i18n->__('Reproducability'), 'visible' => $this->issue->isReproducabilityVisible(), 'changed' => $this->issue->isReproducabilityChanged(), 'merged' => $this->issue->isReproducabilityMerged(), 'name' => $this->issue->getReproducability() instanceof TBGReproducability ? $this->issue->getReproducability()->getName() : '', 'name_visible' => (bool) ($this->issue->getReproducability() instanceof TBGReproducability), 'noname_visible' => (bool) (!$this->issue->getReproducability() instanceof TBGReproducability), 'icon' => false, 'change_tip' => $i18n->__('Click to change reproducability'), 'change_header' => $i18n->__('Change reproducability'), 'clear' => $i18n->__('Clear the reproducability'), 'select' => $i18n->__('%clear_the_reproducability% or click to select a new reproducability', array('%clear_the_reproducability%' => '')));
     if ($this->issue->isEditable() && $this->issue->canEditReproducability()) {
         $fields_list['reproducability']['choices'] = TBGReproducability::getAll();
     }
     $fields_list['severity'] = array('title' => $i18n->__('Severity'), 'visible' => $this->issue->isSeverityVisible(), 'changed' => $this->issue->isSeverityChanged(), 'merged' => $this->issue->isSeverityMerged(), 'name' => $this->issue->getSeverity() instanceof TBGSeverity ? $this->issue->getSeverity()->getName() : '', 'name_visible' => (bool) ($this->issue->getSeverity() instanceof TBGSeverity), 'noname_visible' => (bool) (!$this->issue->getSeverity() instanceof TBGSeverity), 'icon' => false, 'change_tip' => $i18n->__('Click to change severity'), 'change_header' => $i18n->__('Change severity'), 'clear' => $i18n->__('Clear the severity'), 'select' => $i18n->__('%clear_the_severity% or click to select a new severity', array('%clear_the_severity%' => '')));
     if ($this->issue->isUpdateable() && $this->issue->canEditSeverity()) {
         $fields_list['severity']['choices'] = TBGSeverity::getAll();
     }
     $fields_list['milestone'] = array('title' => $i18n->__('Targetted for'), 'visible' => $this->issue->isMilestoneVisible(), 'changed' => $this->issue->isMilestoneChanged(), 'merged' => $this->issue->isMilestoneMerged(), 'name' => $this->issue->getMilestone() instanceof TBGMilestone ? $this->issue->getMilestone()->getName() : '', 'name_visible' => (bool) ($this->issue->getMilestone() instanceof TBGMilestone), 'noname_visible' => (bool) (!$this->issue->getMilestone() instanceof TBGMilestone), 'icon' => true, 'icon_name' => 'icon_milestones.png', 'change_tip' => $i18n->__('Click to change which milestone this issue is targetted for'), 'change_header' => $i18n->__('Set issue target / milestone'), 'clear' => $i18n->__('Set as not targetted'), 'select' => $i18n->__('%set_as_not_targetted% or click to set a new target milestone', array('%set_as_not_targetted%' => '')));
     if ($this->issue->isUpdateable() && $this->issue->canEditMilestone()) {
         $fields_list['milestone']['choices'] = $this->issue->getProject()->getAllMilestones();
     }
     $customfields_list = array();
     foreach (TBGCustomDatatype::getAll() as $key => $customdatatype) {
         $changed_methodname = "isCustomfield{$key}Changed";
         $merged_methodname = "isCustomfield{$key}Merged";
         $customfields_list[$key] = array('type' => $customdatatype->getType(), 'title' => $i18n->__($customdatatype->getDescription()), 'visible' => $this->issue->isFieldVisible($key), 'changed' => $this->issue->{$changed_methodname}(), 'merged' => $this->issue->{$merged_methodname}(), 'change_tip' => $i18n->__($customdatatype->getInstructions()), 'change_header' => $i18n->__($customdatatype->getDescription()), 'clear' => $i18n->__('Clear this field'), 'select' => $i18n->__('%clear_this_field% or click to set a new value', array('%clear_this_field%' => '')));
         if ($customdatatype->hasCustomOptions()) {
             $customfields_list[$key]['name'] = $this->issue->getCustomField($key) instanceof TBGCustomDatatypeOption ? $this->issue->getCustomField($key)->getName() : '';
             $customfields_list[$key]['name_visible'] = (bool) ($this->issue->getCustomField($key) instanceof TBGCustomDatatypeOption);
             $customfields_list[$key]['noname_visible'] = (bool) (!$this->issue->getCustomField($key) instanceof TBGCustomDatatypeOption);
             $customfields_list[$key]['choices'] = $customdatatype->getOptions();
         } else {
             $customfields_list[$key]['name'] = $this->issue->getCustomField($key);
             $customfields_list[$key]['name_visible'] = (bool) ($this->issue->getCustomField($key) != '');
             $customfields_list[$key]['noname_visible'] = (bool) ($this->issue->getCustomField($key) == '');
         }
     }
     $this->fields_list = $fields_list;
     $this->customfields_list = $customfields_list;
     if (isset($this->transition) && $this->transition->hasAction(TBGWorkflowTransitionAction::ACTION_ASSIGN_ISSUE)) {
         $available_assignees = array();
         foreach (TBGContext::getUser()->getTeams() as $team) {
             foreach ($team->getMembers() as $user) {
                 $available_assignees[$user->getID()] = $user->getNameWithUsername();
             }
         }
         foreach (TBGContext::getUser()->getFriends() as $user) {
             $available_assignees[$user->getID()] = $user->getNameWithUsername();
         }
         $this->available_assignees = $available_assignees;
     }
 }
コード例 #13
0
ファイル: TBGIssue.class.php プロジェクト: oparoz/thebuggenie
 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;
 }
コード例 #14
0
 /**
  * Save changes made to the issue since last time
  * 
  * @return boolean
  */
 public function _preSave($is_new)
 {
     if ($is_new) {
         if (!$this->_issue_no) {
             $this->_issue_no = TBGIssuesTable::getTable()->getNextIssueNumberForProductID($this->getProject()->getID());
         }
         if (!$this->_posted) {
             $this->_posted = NOW;
         }
         if (!$this->_last_updated) {
             $this->_last_updated = NOW;
         }
         if (!$this->_posted_by) {
             $this->_posted_by = TBGContext::getUser();
         }
         $step = $this->getProject()->getWorkflowScheme()->getWorkflowForIssuetype($this->getIssueType())->getFirstStep();
         $step->applyToIssue($this);
         return;
     }
     $this->_last_updated = NOW;
     $comment_lines = array();
     $related_issues_to_save = array();
     $is_saved_estimated = false;
     $is_saved_spent = false;
     $is_saved_assignee = false;
     $is_saved_owner = false;
     $changed_properties = $this->_getChangedProperties();
     if (count($changed_properties) == 0) {
         return false;
     }
     foreach ($changed_properties as $property => $value) {
         $compare_value = is_object($this->{$property}) ? $this->{$property}->getID() : $this->{$property};
         if ($value['original_value'] != $compare_value) {
             switch ($property) {
                 case '_title':
                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_UPDATE, TBGContext::getI18n()->__("Title updated"));
                     $comment_lines[] = TBGContext::getI18n()->__("This issue's title has been changed");
                     break;
                 case '_description':
                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_UPDATE, TBGContext::getI18n()->__("Description updated"));
                     $comment_lines[] = TBGContext::getI18n()->__("This issue's description has been changed");
                     break;
                 case '_reproduction_steps':
                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_REPRODUCABILITY, TBGContext::getI18n()->__("Reproduction steps updated"));
                     $comment_lines[] = TBGContext::getI18n()->__("This issue's reproduction steps has been changed");
                     break;
                 case '_category':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = TBGContext::factory()->TBGCategory($value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The category has been updated, from '''%previous_category%''' to '''%new_category%'''.", array('%previous_category%' => $old_name, '%new_category%' => $new_name));
                     break;
                 case '_pain_bug_type':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = self::getPainTypesOrLabel('pain_bug_type', $value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The triaging criteria 'bug type' has been updated, from '''%previous_name%''' to '''%new_name%'''.", array('%previous_name%' => $old_name, '%new_name%' => $new_name));
                     break;
                 case '_pain_effect':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = self::getPainTypesOrLabel('pain_effect', $value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The triaging criteria 'effect' has been updated, from '''%previous_name%''' to '''%new_name%'''.", array('%previous_name%' => $old_name, '%new_name%' => $new_name));
                     break;
                 case '_pain_likelihood':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = self::getPainTypesOrLabel('pain_likelihood', $value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The triaging criteria 'likelihood' has been updated, from '''%previous_name%''' to '''%new_name%'''.", array('%previous_name%' => $old_name, '%new_name%' => $new_name));
                     break;
                 case '_user_pain':
                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_PAIN_CALCULATED, $value['original_value'] . ' &rArr; ' . $value['current_value']);
                     $comment_lines[] = TBGContext::getI18n()->__("The calculated user pain has changed, from '''%previous_value%''' to '''%new_value%'''.", array('%previous_value%' => $value['original_value'], '%new_value%' => $value['current_value']));
                     break;
                 case '_status':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = TBGContext::factory()->TBGStatus($value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The status has been updated, from '''%previous_status%''' to '''%new_status%'''.", array('%previous_status%' => $old_name, '%new_status%' => $new_name));
                     break;
                 case '_reproducability':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = TBGContext::factory()->TBGReproducability($value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The reproducability has been updated, from '''%previous_reproducability%''' to '''%new_reproducability%'''.", array('%previous_reproducability%' => $old_name, '%new_reproducability%' => $new_name));
                     break;
                 case '_priority':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = TBGContext::factory()->TBGPriority($value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The priority has been updated, from '''%previous_priority%''' to '''%new_priority%'''.", array('%previous_priority%' => $old_name, '%new_priority%' => $new_name));
                     break;
                 case '_assigned_to':
                 case '_assigned_type':
                     if (!$is_saved_assignee) {
                         if ($value['original_value'] != 0) {
                             $old_identifiable = null;
                             if ($this->getChangedPropertyOriginal('_assigned_type') == TBGIdentifiableClass::TYPE_USER) {
                                 $old_identifiable = TBGContext::factory()->TBGUser($value['original_value']);
                             } elseif ($this->getChangedPropertyOriginal('_assigned_type') == TBGIdentifiableClass::TYPE_TEAM) {
                                 $old_identifiable = TBGContext::factory()->TBGTeam($value['original_value']);
                             }
                             $old_name = $old_identifiable instanceof TBGIdentifiableClass ? $old_identifiable->getName() : TBGContext::getI18n()->__('Unknown');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not assigned');
                         }
                         $new_name = $this->getAssignee() instanceof TBGIdentifiableClass ? $this->getAssignee()->getName() : TBGContext::getI18n()->__('Not assigned');
                         if (!$this->isAssigned() || $this->getAssigneeType() == TBGIdentifiableClass::TYPE_TEAM) {
                             $this->stopWorkingOnIssue();
                         } elseif ($this->getAssigneeType() == TBGIdentifiableClass::TYPE_USER) {
                             $this->startWorkingOnIssue($this->getAssignee());
                         }
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_ASSIGNED, $old_name . ' &rArr; ' . $new_name);
                         $comment_lines[] = TBGContext::getI18n()->__("The assignee has been changed, from '''%previous_name%''' to '''%new_name%'''.", array('%previous_name%' => $old_name, '%new_name%' => $new_name));
                         $is_saved_assignee = true;
                     }
                     break;
                 case '_posted_by':
                     $old_identifiable = $value['original_value'] ? TBGContext::factory()->TBGUser($value['original_value']) : TBGContext::getI18n()->__('Unknown');
                     $old_name = $old_identifiable instanceof TBGIdentifiableClass ? $old_identifiable->getName() : TBGContext::getI18n()->__('Unknown');
                     $new_name = $this->getPostedBy()->getName();
                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_POSTED, $old_name . ' &rArr; ' . $new_name);
                     $comment_lines[] = TBGContext::getI18n()->__("The issue's poster has been changed, from '''%previous_name%''' to '''%new_name%'''.", array('%previous_name%' => $old_name, '%new_name%' => $new_name));
                     break;
                 case '_being_worked_on_by_user':
                     if ($value['original_value'] != 0) {
                         $old_identifiable = TBGContext::factory()->TBGUser($value['original_value']);
                         $old_name = $old_identifiable instanceof TBGIdentifiableClass ? $old_identifiable->getName() : TBGContext::getI18n()->__('Unknown');
                     } else {
                         $old_name = TBGContext::getI18n()->__('Not being worked on');
                     }
                     $new_name = $this->getUserWorkingOnIssue() instanceof TBGIdentifiableClass ? $this->getUserWorkingOnIssue()->getName() : TBGContext::getI18n()->__('Not being worked on');
                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_USERS, $old_name . ' &rArr; ' . $new_name);
                     $comment_lines[] = TBGContext::getI18n()->__("Information about the user working on this issue has been changed, from '''%previous_name%''' to '''%new_name%'''.", array('%previous_name%' => $old_name, '%new_name%' => $new_name));
                     break;
                 case '_owner':
                 case '_owner_type':
                     if (!$is_saved_owner) {
                         if ($value['original_value'] != 0) {
                             $old_identifiable = null;
                             if ($this->getChangedPropertyOriginal('_owner_type') == TBGIdentifiableClass::TYPE_USER) {
                                 $old_identifiable = TBGContext::factory()->TBGUser($value['original_value']);
                             } elseif ($this->getChangedPropertyOriginal('_owner_type') == TBGIdentifiableClass::TYPE_TEAM) {
                                 $old_identifiable = TBGContext::factory()->TBGTeam($value['original_value']);
                             }
                             $old_name = $old_identifiable instanceof TBGIdentifiableClass ? $old_identifiable->getName() : TBGContext::getI18n()->__('Unknown');
                         } else {
                             $old_name = TBGContext::getI18n()->__('Not owned by anyone');
                         }
                         $new_name = $this->getOwner() instanceof TBGIdentifiableClass ? $this->getOwner()->getName() : TBGContext::getI18n()->__('Not owned by anyone');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_OWNED, $old_name . ' &rArr; ' . $new_name);
                         $comment_lines[] = TBGContext::getI18n()->__("The owner has been changed, from '''%previous_name%''' to '''%new_name%'''.", array('%previous_name%' => $old_name, '%new_name%' => $new_name));
                         $is_saved_owner = true;
                     }
                     break;
                 case '_percent_complete':
                     $this->addLogEntry(TBGLogTable::LOG_ISSUE_PERCENT, $value['original_value'] . '% &rArr; ' . $this->getPercentCompleted() . '%');
                     $comment_lines[] = TBGContext::getI18n()->__("This issue's progression has been updated to %percent_completed% percent completed.", array('%percent_completed%' => $this->getPercentCompleted()));
                     break;
                 case '_resolution':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = TBGContext::factory()->TBGResolution($value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The resolution has been updated, from '''%previous_resolution%''' to '''%new_resolution%'''.", array('%previous_resolution%' => $old_name, '%new_resolution%' => $new_name));
                     break;
                 case '_severity':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = TBGContext::factory()->TBGSeverity($value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The severity has been updated, from '''%previous_severity%''' to '''%new_severity%'''.", array('%previous_severity%' => $old_name, '%new_severity%' => $new_name));
                     break;
                 case '_milestone':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = TBGContext::factory()->TBGMilestone($value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The milestone has been updated, from '''%previous_milestone%''' to '''%new_milestone%'''.", array('%previous_milestone%' => $old_name, '%new_milestone%' => $new_name));
                     break;
                 case '_issuetype':
                     if ($value['original_value'] != 0) {
                         $old_name = ($old_item = TBGContext::factory()->TBGIssuetype($value['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);
                     $comment_lines[] = TBGContext::getI18n()->__("The issue type has been updated, from '''%previous_type%''' to '''%new_type%'''.", array('%previous_type%' => $old_name, '%new_type%' => $new_name));
                     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 ? $this->getFormattedTime($old_time) : TBGContext::getI18n()->__('Not estimated');
                         $new_formatted_time = $this->hasEstimatedTime() ? $this->getFormattedTime($this->getEstimatedTime()) : TBGContext::getI18n()->__('Not estimated');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_TIME_ESTIMATED, $old_formatted_time . ' &rArr; ' . $new_formatted_time);
                         $comment_lines[] = TBGContext::getI18n()->__("The issue has been (re-)estimated, from '''%previous_time%''' to '''%new_time%'''.", array('%previous_time%' => $old_formatted_time, '%new_time%' => $new_formatted_time));
                         $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 ? $this->getFormattedTime($old_time) : TBGContext::getI18n()->__('No time spent');
                         $new_formatted_time = $this->hasSpentTime() ? $this->getFormattedTime($this->getSpentTime()) : TBGContext::getI18n()->__('No time spent');
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_TIME_SPENT, $old_formatted_time . ' &rArr; ' . $new_formatted_time);
                         $comment_lines[] = TBGContext::getI18n()->__("Time spent on this issue, from '''%previous_time%''' to '''%new_time%'''.", array('%previous_time%' => $old_formatted_time, '%new_time%' => $new_formatted_time));
                         $is_saved_spent = true;
                     }
                     break;
                 case '_state':
                     if ($this->isClosed()) {
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_CLOSE);
                         $comment_lines[] = TBGContext::getI18n()->__("This issue has been closed");
                         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);
                         $comment_lines[] = TBGContext::getI18n()->__("This issue has been reopened");
                     }
                     break;
                 case '_blocking':
                     if ($this->isBlocking()) {
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_BLOCKED);
                         $comment_lines[] = TBGContext::getI18n()->__("This issue is now blocking the next release");
                     } else {
                         $this->addLogEntry(TBGLogTable::LOG_ISSUE_UNBLOCKED);
                         $comment_lines[] = TBGContext::getI18n()->__("This issue is no longer blocking the next release");
                     }
                     break;
                 default:
                     if (substr($property, 0, 12) == '_customfield') {
                         $key = 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, $new_value);
                                 $comment_lines[] = TBGContext::getI18n()->__("The custom field %customfield_name% has been changed to '''%new_value%'''.", array('%customfield_name%' => $customdatatype->getDescription(), '%new_value%' => $new_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, $new_value);
                                 $comment_lines[] = TBGContext::getI18n()->__("The custom field %customfield_name% has been changed.", array('%customfield_name%' => $customdatatype->getDescription()));
                                 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($value['original_value']);
                                             break;
                                         case TBGCustomDatatype::COMPONENTS_CHOICE:
                                             $old_object = TBGContext::factory()->TBGComponent($value['original_value']);
                                             break;
                                         case TBGCustomDatatype::RELEASES_CHOICE:
                                             $old_object = TBGContext::factory()->TBGBuild($value['original_value']);
                                         case TBGCustomDatatype::STATUS_CHOICE:
                                             $old_object = TBGContext::factory()->TBGStatus($value['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));
                                         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, $old_value . ' &rArr; ' . $new_value);
                                 $comment_lines[] = TBGContext::getI18n()->__("The custom field %customfield_name% has been updated, from '''%previous_value%''' to '''%new_value%'''.", array('%customfield_name%' => $customdatatype->getDescription(), '%previous_value%' => $old_value, '%new_value%' => $new_value));
                                 break;
                             default:
                                 $old_value = ($old_item = TBGCustomDatatypeOption::getByValueAndKey($value['original_value'], $key)) ? $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, $old_value . ' &rArr; ' . $new_value);
                                 $comment_lines[] = TBGContext::getI18n()->__("The custom field %customfield_name% has been updated, from '''%previous_value%''' to '''%new_value%'''.", array('%customfield_name%' => $customdatatype->getDescription(), '%previous_value%' => $old_value, '%new_value%' => $new_value));
                                 break;
                         }
                     }
                     break;
             }
         }
     }
     if (count($comment_lines) == 0) {
         $comment = TBGContext::getI18n()->__("The issue has been updated");
         $this->comment = $this->addSystemComment(TBGContext::getI18n()->__('Issue updated'), $comment, TBGContext::getUser()->getID());
         $this->comment_lines = $comment_lines;
     } else {
         $comment = TBGContext::getI18n()->__("The issue was updated with the following change(s):%list_of_changes%", array('%list_of_changes%' => "\n* " . join("\n* ", $comment_lines)), true);
         $this->comment = $this->addSystemComment(TBGContext::getI18n()->__('Issue updated'), $comment, TBGContext::getUser()->getID());
         $this->comment_lines = $comment_lines;
     }
     if ($is_saved_estimated) {
         B2DB::getTable('TBGIssueEstimates')->saveEstimate($this->getID(), $this->_estimated_months, $this->_estimated_weeks, $this->_estimated_days, $this->_estimated_hours, $this->_estimated_points);
     }
     if ($is_saved_spent) {
         B2DB::getTable('TBGIssueSpentTimes')->saveSpentTime($this->getID(), $this->_spent_months, $this->_spent_weeks, $this->_spent_days, $this->_spent_hours, $this->_spent_points);
     }
     $this->related_issues_to_save = $related_issues_to_save;
     $this->_clearChangedProperties();
 }
コード例 #15
0
 public function runAddFilter(TBGRequest $request)
 {
     if ($request->getParameter('filter_name') == 'project_id' && count(TBGProject::getAll()) == 0) {
         return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('No projects exist so this filter can not be added')));
     } elseif (in_array($request->getParameter('filter_name'), TBGIssuesTable::getValidSearchFilters()) || TBGCustomDatatype::doesKeyExist($request->getParameter('filter_name'))) {
         return $this->renderJSON(array('failed' => false, 'content' => $this->getComponentHTML('search/filter', array('filter' => $request->getParameter('filter_name'), 'key' => $request->getParameter('key', 0)))));
     } else {
         return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('This is not a valid search field')));
     }
 }
コード例 #16
0
 public static function getAvailableFields($builtin_only = false)
 {
     $builtin_types = array('description', 'reproduction_steps', 'status', 'category', 'resolution', 'priority', 'reproducability', 'percent_complete', 'severity', 'owner', 'assignee', 'edition', 'build', 'component', 'estimated_time', 'spent_time', 'milestone', 'user_pain', 'votes');
     if ($builtin_only) {
         return $builtin_types;
     }
     $customtypes = TBGCustomDatatype::getAll();
     $types = array_merge($builtin_types, array_keys($customtypes));
     return $types;
 }
コード例 #17
0
ファイル: _filter.inc.php プロジェクト: oparoz/thebuggenie
><?php 
        echo __('Closed');
        ?>
</option>
			</select>
			<?php 
        $show_button = true;
        ?>
		<?php 
    }
    ?>
	<?php 
} else {
    ?>
		<?php 
    $customdatatype = TBGCustomDatatype::getByKey($filter);
    ?>
		<label for="filter_<?php 
    echo $filter;
    ?>
_<?php 
    echo $key;
    ?>
"><?php 
    echo __($customdatatype->getDescription());
    ?>
</label>
		<select name="filters[<?php 
    echo $filter;
    ?>
][<?php 
コード例 #18
0
 protected function _setupReportIssueProperties()
 {
     $this->selected_issuetype = $this->selected_issuetype ?: null;
     $this->selected_edition = $this->selected_edition ?: null;
     $this->selected_build = $this->selected_build ?: null;
     $this->selected_milestone = $this->selected_milestone ?: null;
     $this->parent_issue = $this->parent_issue ?: null;
     $this->selected_component = $this->selected_component ?: null;
     $this->selected_category = $this->selected_category ?: null;
     $this->selected_status = $this->selected_status ?: null;
     $this->selected_resolution = $this->selected_resolution ?: null;
     $this->selected_priority = $this->selected_priority ?: null;
     $this->selected_reproducability = $this->selected_reproducability ?: null;
     $this->selected_severity = $this->selected_severity ?: null;
     $this->selected_estimated_time = $this->selected_estimated_time ?: null;
     $this->selected_spent_time = $this->selected_spent_time ?: null;
     $this->selected_percent_complete = $this->selected_percent_complete ?: null;
     $this->selected_pain_bug_type = $this->selected_pain_bug_type ?: null;
     $this->selected_pain_likelihood = $this->selected_pain_likelihood ?: null;
     $this->selected_pain_effect = $this->selected_pain_effect ?: null;
     $selected_customdatatype = $this->selected_customdatatype ?: array();
     foreach (TBGCustomDatatype::getAll() as $customdatatype) {
         $selected_customdatatype[$customdatatype->getKey()] = isset($selected_customdatatype[$customdatatype->getKey()]) ? $selected_customdatatype[$customdatatype->getKey()] : null;
     }
     $this->selected_customdatatype = $selected_customdatatype;
     $this->issuetype_id = $this->issuetype_id ?: null;
     $this->issue = $this->issue ?: null;
     $this->categories = TBGCategory::getAll();
     $this->severities = TBGSeverity::getAll();
     $this->priorities = TBGPriority::getAll();
     $this->reproducabilities = TBGReproducability::getAll();
     $this->resolutions = TBGResolution::getAll();
     $this->statuses = TBGStatus::getAll();
     $this->milestones = TBGContext::getCurrentProject()->getMilestonesForIssues();
 }
コード例 #19
0
ファイル: actions.class.php プロジェクト: oparoz/thebuggenie
 /**
  * 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']))));
     }
 }
コード例 #20
0
ファイル: actions.class.php プロジェクト: oparoz/thebuggenie
 public function runAddFilter(TBGRequest $request)
 {
     if ($request['filter_name'] == 'project_id' && count(TBGProject::getAll()) == 0) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => TBGContext::getI18n()->__('No projects exist so this filter can not be added')));
     } elseif (in_array($request['filter_name'], TBGSearchFilter::getValidSearchFilters()) || TBGCustomDatatype::doesKeyExist($request['filter_name'])) {
         return $this->renderJSON(array('content' => $this->getComponentHTML('search/filter', array('filter' => $request['filter_name'], 'key' => $request->getParameter('key', 0)))));
     } else {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => TBGContext::getI18n()->__('This is not a valid search field')));
     }
 }
コード例 #21
0
     }
     break;
 case TBGLogTable::LOG_ISSUE_POSTED:
     echo image_tag('icon_user.png');
     if ($item->hasChangeDetails()) {
         $previous_value = $item->getPreviousValue() ? ($old_item = TBGContext::factory()->TBGUser($item->getPreviousValue())) ? __($old_item->getName()) : __('Unknown') : __('Not determined');
         $new_value = $item->getCurrentValue() ? ($new_item = TBGContext::factory()->TBGUser($item->getCurrentValue())) ? __($new_item->getName()) : __('Unknown') : __('Not determined');
         echo __("Posted by changed: %previous_value => %new_value", array('%previous_value' => '<strong>' . $previous_value . '</strong>', '%new_value' => '<strong>' . $new_value . '</strong>'));
     }
     break;
 case TBGLogTable::LOG_ISSUE_CUSTOMFIELD_CHANGED:
     echo image_tag('icon_customdatatype.png');
     if ($item->hasChangeDetails()) {
         $key_data = explode(':', $item->getText());
         $key = $key_data[0];
         $customdatatype = TBGCustomDatatype::getByKey($key);
         if ($customdatatype instanceof TBGCustomDatatype) {
             $old_value = $item->getPreviousValue();
             $new_value = $item->getCurrentValue();
             switch ($customdatatype->getType()) {
                 case TBGCustomDatatype::INPUT_TEXT:
                 case TBGCustomDatatype::INPUT_TEXTAREA_SMALL:
                 case TBGCustomDatatype::INPUT_TEXTAREA_MAIN:
                     break;
                 case TBGCustomDatatype::DATE_PICKER:
                     $old_value = $old_value != null ? date('Y-m-d', (int) $old_value) : TBGContext::getI18n()->__('Not determined');
                     $new_value = $new_value != null ? date('Y-m-d', (int) $new_value) : TBGContext::getI18n()->__('Not determined');
                     break;
                 case TBGCustomDatatype::EDITIONS_CHOICE:
                 case TBGCustomDatatype::COMPONENTS_CHOICE:
                 case TBGCustomDatatype::RELEASES_CHOICE:
コード例 #22
0
 /**
  * Add or delete a custom type
  *
  * @param TBGRequest $request
  */
 public function runConfigureIssuefieldsCustomTypeAction(TBGRequest $request)
 {
     switch ($request->getParameter('mode')) {
         case 'add':
             if ($request->getParameter('name') != '') {
                 try {
                     $customtype = new TBGCustomDatatype();
                     $customtype->setName($request->getParameter('name'));
                     $customtype->setItemdata($request->getParameter('label'));
                     $customtype->setType($request->getParameter('field_type'));
                     $customtype->save();
                     return $this->renderJSON(array('failed' => false, 'title' => TBGContext::getI18n()->__('The custom field was added'), 'content' => $this->getComponentHTML('issuefields_customtype', array('type_key' => $customtype->getKey(), 'type' => $customtype))));
                 } catch (Exception $e) {
                     return $this->renderJSON(array('failed' => true, 'error' => $e->getMessage()));
                 }
             }
             return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('Please provide a valid name')));
             break;
         case 'update':
             if ($request->getParameter('name') != '') {
                 $customtype = TBGCustomDatatype::getByKey($request->getParameter('type'));
                 if ($customtype instanceof TBGCustomDatatype) {
                     $customtype->setDescription($request->getParameter('description'));
                     $customtype->setInstructions($request->getParameter('instructions'));
                     $customtype->setName($request->getParameter('name'));
                     $customtype->save();
                     return $this->renderJSON(array('failed' => false, 'title' => TBGContext::getI18n()->__('The custom field was updated'), 'description' => $customtype->getDescription(), 'instructions' => $customtype->getInstructions(), 'name' => $customtype->getName()));
                 }
                 return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('You need to provide a custom field key that already exists')));
             }
             return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('Please provide a valid name')));
             break;
         case 'delete':
             $customtype = TBGCustomDatatype::getByKey($request->getParameter('type'));
             if ($customtype instanceof TBGCustomDatatype) {
                 $customtype->delete();
                 return $this->renderJSON(array('failed' => false, 'title' => TBGContext::getI18n()->__('The custom field was deleted')));
             }
             return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('You need to provide a custom field key that already exists')));
             break;
     }
 }
コード例 #23
0
 public function componentSearchbuilder()
 {
     $this->templates = TBGSavedSearch::getTemplates();
     $this->filters = $this->appliedfilters;
     $this->nondatecustomfields = TBGCustomDatatype::getAllExceptTypes(array(TBGCustomDatatype::DATE_PICKER));
     $this->datecustomfields = TBGCustomDatatype::getByFieldType(TBGCustomDatatype::DATE_PICKER);
     $i18n = TBGContext::getI18n();
     $this->columns = array('title' => $i18n->__('Issue title'), 'issuetype' => $i18n->__('Issue type'), 'assigned_to' => $i18n->__('Assigned to'), 'status' => $i18n->__('Status'), 'resolution' => $i18n->__('Resolution'), 'category' => $i18n->__('Category'), 'severity' => $i18n->__('Severity'), 'percent_complete' => $i18n->__('Percent completed'), 'reproducability' => $i18n->__('Reproducability'), 'priority' => $i18n->__('Priority'), 'components' => $i18n->__('Component(s)'), 'milestone' => $i18n->__('Milestone'), 'estimated_time' => $i18n->__('Estimate'), 'spent_time' => $i18n->__('Time spent'), 'last_updated' => $i18n->__('Last updated time'), 'comments' => $i18n->__('Number of comments'));
     $groupoptions = array();
     if (!TBGContext::isProjectContext()) {
         $groupoptions['project_id'] = $i18n->__('Project');
     }
     $groupoptions['milestone'] = $i18n->__('Milestone');
     $groupoptions['assignee'] = $i18n->__("Who's assigned");
     $groupoptions['state'] = $i18n->__('State (open or closed)');
     $groupoptions['status'] = $i18n->__('Status');
     $groupoptions['category'] = $i18n->__('Category');
     $groupoptions['priority'] = $i18n->__('Priority');
     $groupoptions['severity'] = $i18n->__('Severity');
     $groupoptions['resolution'] = $i18n->__('Resolution');
     $groupoptions['issuetype'] = $i18n->__('Issue type');
     $groupoptions['edition'] = $i18n->__('Edition');
     $groupoptions['build'] = $i18n->__('Release');
     $groupoptions['component'] = $i18n->__('Component');
     $this->groupoptions = $groupoptions;
 }