- foreach(array( 'resolution' ) as $c) {
+ foreach(array( 'resolution', 'ticketstate' ) as $c) {
$d = DB_DataObject::factory('core_enum');
$d->etype = $c;
$d->orderBy('seqid ASC, name ASC');
$this->elements[$c]->setOptions($d->fetchAll('id','name'));
}
-
+
+ if ($this->issue->project_id) {
+ $d = DB_DataObject::factory('mtrack_project_component');
+ $d->project_id = $this->issue->project_id;
+ $d->orderBy('name');
+ $d->whereAdd('deleted != 1');
+ $this->elements['component[]'] = new HTML_Template_Flexy_Element('select');
+ $this->elements['component[]']->setOptions($d->fetchAll('id', 'name'));
+ $ar = $this->issue->components();
+ $this->elements['component[]']->setValue(array_keys($ar));
+
+ }
+ if ($this->issue->project_id) {
+ $d = DB_DataObject::factory('mtrack_milestone');
+ $d->project_id = $this->issue->project_id;
+ $d->orderBy('(case when duedate is null then 1 else 0 end), duedate, name');
+ $d->whereAdd('completed != 1');
+ $d->whereAdd('deleted != 1');
+ $this->elements['milestone[]'] = new HTML_Template_Flexy_Element('select');
+ $this->elements['milestone[]']->setOptions($d->fetchAll('id', 'name'));
+ $ar = $this->issue->milestones();
+ $this->elements['milestone[]']->setValue(array_keys($ar));
+ }
+
// FIX ME - need to determine who the owner is..
// for a new issue it's the person who created it.
// later on it's an assignement???