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