From a10f036c477cfc010f2c568a47f83eef91d3e60f Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Tue, 6 May 2014 21:02:10 +0000
Subject: [PATCH] Extend department membership to groups by default

The setting is useful in making sure the staff members with access to the
department can get alerts and available as possible assignees.
---
 include/i18n/en_US/department.yaml | 3 +++
 include/staff/department.inc.php   | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/include/i18n/en_US/department.yaml b/include/i18n/en_US/department.yaml
index 05ffc9d9c..3de7de70b 100644
--- a/include/i18n/en_US/department.yaml
+++ b/include/i18n/en_US/department.yaml
@@ -17,6 +17,7 @@
   signature: |
     Support Department
   ispublic: 1
+  group_membership: 1
 
 - id: 2
   name: Sales
@@ -24,9 +25,11 @@
     Sales and Customer Retention
   ispublic: 1
   sla_id: 1
+  group_membership: 1
 
 - id: 3
   name: Maintenance
   signature: |
     Maintenance Department
   ispublic: 0
+  group_membership: 0
diff --git a/include/staff/department.inc.php b/include/staff/department.inc.php
index d8998bda5..99a571fec 100644
--- a/include/staff/department.inc.php
+++ b/include/staff/department.inc.php
@@ -19,6 +19,9 @@ if($dept && $_REQUEST['a']!='add') {
     $info['ispublic']=isset($info['ispublic'])?$info['ispublic']:1;
     $info['ticket_auto_response']=isset($info['ticket_auto_response'])?$info['ticket_auto_response']:1;
     $info['message_auto_response']=isset($info['message_auto_response'])?$info['message_auto_response']:1;
+    if (!isset($info['group_membership']))
+        $info['group_membership'] = 1;
+
     $qstr.='&a='.$_REQUEST['a'];
 }
 $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
-- 
GitLab