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

bug: Fix installer initial data load

parent b1ab57f9
No related branches found
No related tags found
No related merge requests found
...@@ -368,9 +368,15 @@ class Dept extends VerySimpleModel { ...@@ -368,9 +368,15 @@ class Dept extends VerySimpleModel {
return self::getDepartments(array('publiconly'=>true)); return self::getDepartments(array('publiconly'=>true));
} }
static function create($vars, &$errors) { static function create($vars, &$errors=array()) {
$dept = parent::create($vars); $dept = parent::create($vars);
$dept->create = SqlFunction::NOW(); $dept->created = SqlFunction::NOW();
return $dept;
}
static function __create($vars, &$errors) {
$dept = self::create($vars);
$dept->save();
return $dept; return $dept;
} }
......
...@@ -164,6 +164,15 @@ class Group extends VerySimpleModel { ...@@ -164,6 +164,15 @@ class Group extends VerySimpleModel {
return $group; return $group;
} }
static function __create($vars, &$errors) {
$g = self::create($vars);
$g->save();
if ($vars['depts'])
$g->updateDeptAccess($vars['depts']);
return $g;
}
function save($refetch=false) { function save($refetch=false) {
if ($this->dirty) { if ($this->dirty) {
$this->updated = SqlFunction::NOW(); $this->updated = SqlFunction::NOW();
......
...@@ -49,7 +49,7 @@ class Internationalization { ...@@ -49,7 +49,7 @@ class Internationalization {
function loadDefaultData() { function loadDefaultData() {
# notrans -- do not translate the contents of this array # notrans -- do not translate the contents of this array
$models = array( $models = array(
'department.yaml' => 'Dept::create', 'department.yaml' => 'Dept::__create',
'sla.yaml' => 'SLA::create', 'sla.yaml' => 'SLA::create',
'form.yaml' => 'DynamicForm::create', 'form.yaml' => 'DynamicForm::create',
'list.yaml' => 'DynamicList::create', 'list.yaml' => 'DynamicList::create',
...@@ -63,7 +63,7 @@ class Internationalization { ...@@ -63,7 +63,7 @@ class Internationalization {
// Ticket // Ticket
'ticket_status.yaml' => 'TicketStatus::__create', 'ticket_status.yaml' => 'TicketStatus::__create',
// Note that group requires department // Note that group requires department
'group.yaml' => 'Group::create', 'group.yaml' => 'Group::__create',
'file.yaml' => 'AttachmentFile::create', 'file.yaml' => 'AttachmentFile::create',
'sequence.yaml' => 'Sequence::__create', 'sequence.yaml' => 'Sequence::__create',
); );
......
...@@ -12,24 +12,24 @@ ...@@ -12,24 +12,24 @@
# The very first group listed in this document will be the primary # The very first group listed in this document will be the primary
# department of the initial staff member -- the administrator. # department of the initial staff member -- the administrator.
--- ---
- id: 1 - dept_id: 1
name: Support dept_name: Support
signature: | dept_signature: |
Support Department Support Department
ispublic: 1 ispublic: 1
group_membership: 1 group_membership: 1
- id: 2 - dept_id: 2
name: Sales dept_name: Sales
signature: | dept_signature: |
Sales and Customer Retention Sales and Customer Retention
ispublic: 1 ispublic: 1
sla_id: 1 sla_id: 1
group_membership: 1 group_membership: 1
- id: 3 - dept_id: 3
name: Maintenance dept_name: Maintenance
signature: | dept_signature: |
Maintenance Department Maintenance Department
ispublic: 0 ispublic: 0
group_membership: 0 group_membership: 0
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
# The very first group listed in this document will be the primary group of # The very first group listed in this document will be the primary group of
# the initial staff member -- the administrator. # the initial staff member -- the administrator.
--- ---
- isactive: 1 - group_enabled: 1
name: Lion Tamers group_name: Lion Tamers
notes: | notes: |
System overlords. These folks (initially) have full control to all the System overlords. These folks (initially) have full control to all the
departments they have access to. departments they have access to.
...@@ -50,8 +50,8 @@ ...@@ -50,8 +50,8 @@
depts: [1, 2, 3] depts: [1, 2, 3]
- isactive: 1 - group_enabled: 1
name: Elephant Walkers group_name: Elephant Walkers
notes: | notes: |
Inhabitants of the ivory tower Inhabitants of the ivory tower
can_create_tickets: 1 can_create_tickets: 1
...@@ -67,8 +67,8 @@ ...@@ -67,8 +67,8 @@
depts: [1, 2, 3] depts: [1, 2, 3]
- isactive: 1 - group_enabled: 1
name: Flea Trainers group_name: Flea Trainers
notes: | notes: |
Lowly staff members Lowly staff members
can_create_tickets: 1 can_create_tickets: 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment