Skip to content
Snippets Groups Projects
Commit 02766c64 authored by Peter Rotich's avatar Peter Rotich
Browse files

Use AbstractForm for Internal Task Form

parent 68cc8f91
Branches
Tags
No related merge requests found
...@@ -1273,33 +1273,36 @@ class TaskForm extends DynamicForm { ...@@ -1273,33 +1273,36 @@ class TaskForm extends DynamicForm {
return static::$instance; return static::$instance;
} }
static function getInternalForm($source=null) { static function getInternalForm($source=null, $options=array()) {
if (!isset(static::$internalForm)) if (!isset(static::$internalForm))
static::$internalForm = new SimpleForm(self::getInternalFields(), $source); static::$internalForm = new TaskInternalForm($source, $options);
return static::$internalForm; return static::$internalForm;
} }
}
class TaskInternalForm
extends AbstractForm {
static $layout = 'GridFormLayout';
function buildFields() {
static function getInternalFields() { $fields = array(
return array(
'dept_id' => new DepartmentField(array( 'dept_id' => new DepartmentField(array(
'id'=>1, 'id'=>1,
'label' => __('Department'), 'label' => __('Department'),
'flags' => hexdec(0X450F3),
'required' => true, 'required' => true,
'layout' => new GridFluidCell(6), 'layout' => new GridFluidCell(6),
)), )),
'staff_id' => new AssigneeField(array( 'staff_id' => new AssigneeField(array(
'id'=>2, 'id'=>2,
'label' => __('Assignee'), 'label' => __('Assignee'),
'flags' => hexdec(0X450F3),
'required' => false, 'required' => false,
'layout' => new GridFluidCell(6), 'layout' => new GridFluidCell(6),
)), )),
'duedate' => new DatetimeField(array( 'duedate' => new DatetimeField(array(
'id' => 3, 'id' => 3,
'label' => __('Due Date'), 'label' => __('Due Date'),
'flags' => hexdec(0X450B3),
'required' => false, 'required' => false,
'configuration' => array( 'configuration' => array(
'min' => Misc::gmtime(), 'min' => Misc::gmtime(),
...@@ -1310,6 +1313,14 @@ class TaskForm extends DynamicForm { ...@@ -1310,6 +1313,14 @@ class TaskForm extends DynamicForm {
)), )),
); );
$mode = @$this->options['mode'];
if ($mode && $mode == 'edit') {
unset($fields['dept_id']);
unset($fields['staff_id']);
}
return $fields;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment