diff --git a/include/class.dept.php b/include/class.dept.php index d6d1fd9248d2aac08dd6bc6f2de3f786c6610dad..b8aaf8b459f588c4a2bf06f54215bec953a848f2 100644 --- a/include/class.dept.php +++ b/include/class.dept.php @@ -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; } diff --git a/include/class.group.php b/include/class.group.php index 6352289749de218a7841c40fa1cc4f8daf966d37..48fe6dba40031feb556783b88f72a42d7080041c 100644 --- a/include/class.group.php +++ b/include/class.group.php @@ -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(); diff --git a/include/class.i18n.php b/include/class.i18n.php index d5d524a9782d7d6ecd97d2e912937a5318476a0d..5941b44d444e5502933302ee1b1f753918a2cae9 100644 --- a/include/class.i18n.php +++ b/include/class.i18n.php @@ -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', ); diff --git a/include/i18n/en_US/department.yaml b/include/i18n/en_US/department.yaml index 3de7de70b6a2965679f39a870e80460516d04206..34d135a7d00c6859d7c92d3d6a7586e5d622447a 100644 --- a/include/i18n/en_US/department.yaml +++ b/include/i18n/en_US/department.yaml @@ -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 diff --git a/include/i18n/en_US/group.yaml b/include/i18n/en_US/group.yaml index bc65037e180922fbf221261ae4a9e2035a5cd681..66acefa239cab0722ed74bc0eb1dcc567926bc03 100644 --- a/include/i18n/en_US/group.yaml +++ b/include/i18n/en_US/group.yaml @@ -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