Skip to content
Snippets Groups Projects
Commit ea9f0e6e authored by Jared Hancock's avatar Jared Hancock
Browse files

dept: Allow saving of various alert recipient opts

As previously implemented, only "Department and group members" could be set
parent 0e29c8dd
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,10 @@ class Dept { ...@@ -24,6 +24,10 @@ class Dept {
var $ht; var $ht;
const ALERTS_DISABLED = 2;
const ALERTS_DEPT_AND_GROUPS = 1;
const ALERTS_DEPT_ONLY = 0;
function Dept($id) { function Dept($id) {
$this->id=0; $this->id=0;
$this->load($id); $this->load($id);
...@@ -108,9 +112,10 @@ class Dept { ...@@ -108,9 +112,10 @@ class Dept {
.' LEFT JOIN '.GROUP_TABLE.' g ON (g.group_id=s.group_id) ' .' LEFT JOIN '.GROUP_TABLE.' g ON (g.group_id=s.group_id) '
.' LEFT JOIN '.GROUP_DEPT_TABLE.' gd ON(s.group_id=gd.group_id) ' .' LEFT JOIN '.GROUP_DEPT_TABLE.' gd ON(s.group_id=gd.group_id) '
.' INNER JOIN '.DEPT_TABLE.' d .' INNER JOIN '.DEPT_TABLE.' d
ON(d.dept_id=s.dept_id ON ( d.dept_id=s.dept_id
OR d.manager_id=s.staff_id OR d.manager_id=s.staff_id
OR (d.dept_id=gd.dept_id AND d.group_membership=1) OR (d.dept_id=gd.dept_id AND d.group_membership='.
self::ALERTS_DEPT_AND_GROUPS.')
) ' ) '
.' WHERE d.dept_id='.db_input($this->getId()); .' WHERE d.dept_id='.db_input($this->getId());
...@@ -142,7 +147,7 @@ class Dept { ...@@ -142,7 +147,7 @@ class Dept {
} }
function getMembersForAlerts() { function getMembersForAlerts() {
if ($this->isGroupMembershipEnabled() == 2) { if ($this->isGroupMembershipEnabled() == self::ALERTS_DISABLED) {
// Disabled for this department // Disabled for this department
$rv = array(); $rv = array();
} }
...@@ -432,7 +437,7 @@ class Dept { ...@@ -432,7 +437,7 @@ class Dept {
.' ,manager_id='.db_input($vars['manager_id']?$vars['manager_id']:0) .' ,manager_id='.db_input($vars['manager_id']?$vars['manager_id']:0)
.' ,dept_name='.db_input(Format::striptags($vars['name'])) .' ,dept_name='.db_input(Format::striptags($vars['name']))
.' ,dept_signature='.db_input(Format::sanitize($vars['signature'])) .' ,dept_signature='.db_input(Format::sanitize($vars['signature']))
.' ,group_membership='.db_input(isset($vars['group_membership'])?1:0) .' ,group_membership='.db_input($vars['group_membership'])
.' ,ticket_auto_response='.db_input(isset($vars['ticket_auto_response'])?$vars['ticket_auto_response']:1) .' ,ticket_auto_response='.db_input(isset($vars['ticket_auto_response'])?$vars['ticket_auto_response']:1)
.' ,message_auto_response='.db_input(isset($vars['message_auto_response'])?$vars['message_auto_response']:1); .' ,message_auto_response='.db_input(isset($vars['message_auto_response'])?$vars['message_auto_response']:1);
......
...@@ -232,12 +232,15 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); ...@@ -232,12 +232,15 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
<td> <td>
<span> <span>
<select name="group_membership"> <select name="group_membership">
<option value="2" <?php echo $info['group_membership'] == 2 ?'selected="selected"':''; <?php foreach (array(
?>>No one (disable Alerts &amp; Notices)</option> Dept::ALERTS_DISABLED => "No one (disable Alerts &amp; Notices)",
<option value="0" <?php echo $info['group_membership'] == 0 ?'selected="selected"':''; Dept::ALERTS_DEPT_ONLY => "Department members only",
?>>Department members only</option> Dept::ALERTS_DEPT_AND_GROUPS => "Department and Group members",
<option value="1" <?php echo $info['group_membership'] == 1 ?'selected="selected"':''; ) as $mode=>$desc) { ?>
?>>Department and Group members</option> <option value="<?php echo $mode; ?>" <?php
if ($info['group_membership'] == $mode) echo 'selected="selected"';
?>><?php echo $desc; ?></option><?php
} ?>
</select> </select>
<i class="help-tip icon-question-sign" href="#group_membership"></i> <i class="help-tip icon-question-sign" href="#group_membership"></i>
</span> </span>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment