diff --git a/include/class.canned.php b/include/class.canned.php index 96fb712991c3e96d1414c710fb41fece4e13bd0d..457c6d8f904eaaf476bc3744422989f17c940169 100644 --- a/include/class.canned.php +++ b/include/class.canned.php @@ -203,8 +203,8 @@ class Canned { if($errors) return false; $sql=' updated=NOW() '. - ',dept_id='.db_input($vars['dept_id']?$vars['dept_id']:0). - ',isenabled='.db_input($vars['isenabled']?$vars['isenabled']:1). + ',dept_id='.db_input($vars['dept_id']?:0). + ',isenabled='.db_input($vars['isenabled']). ',title='.db_input($vars['title']). ',response='.db_input(Format::sanitize($vars['response'])). ',notes='.db_input(Format::sanitize($vars['notes'])); diff --git a/include/class.config.php b/include/class.config.php index 68704cd7b65523acb6f5610746b4e9741847c962..c7648749784d78131d94886e94994649b383644c 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -126,6 +126,15 @@ class Config { return false; return true; } + + function destroy() { + + $sql='DELETE FROM '.$this->table + .' WHERE `'.$this->section_column.'` = '.db_input($this->section); + + db_query($sql); + unset($this->session); + } } class OsticketConfig extends Config { diff --git a/include/class.dept.php b/include/class.dept.php index 0fb59d36faffdbb941275e3f364213062f955b4e..04a0e1b72a43cbd6eaa8ce203698961a0813bfca 100644 --- a/include/class.dept.php +++ b/include/class.dept.php @@ -50,6 +50,7 @@ class Dept { $this->id=$this->ht['dept_id']; $this->email=$this->sla=$this->manager=null; $this->getEmail(); //Auto load email struct. + $this->config = new Config('dept.'.$this->id); $this->members=$this->groups=array(); return true; @@ -99,29 +100,47 @@ class Dept { return count($this->getMembers()); } - function getMembers() { + function getMembers($criteria=null) { - if(!$this->members) { - $this->members = array(); + if(!$this->members || $criteria) { + $members = array(); $sql='SELECT DISTINCT s.staff_id FROM '.STAFF_TABLE.' s ' - .' LEFT JOIN '.GROUP_DEPT_TABLE.' g ON(s.group_id=g.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) ' .' INNER JOIN '.DEPT_TABLE.' d ON(d.dept_id=s.dept_id OR d.manager_id=s.staff_id - OR (d.dept_id=g.dept_id AND d.group_membership=1) + OR (d.dept_id=gd.dept_id AND d.group_membership=1) ) ' - .' WHERE d.dept_id='.db_input($this->getId()) - .' ORDER BY s.lastname, s.firstname'; + .' WHERE d.dept_id='.db_input($this->getId()); + + if ($criteria && $criteria['available']) + $sql .= ' AND + ( g.group_enabled=1 + AND s.isactive=1 + AND s.onvacation=0 ) '; + + $sql.=' ORDER BY s.lastname, s.firstname'; if(($res=db_query($sql)) && db_num_rows($res)) { while(list($id)=db_fetch_row($res)) - $this->members[] = Staff::lookup($id); + $members[$id] = Staff::lookup($id); } + + if ($criteria) + return $members; + + $this->members = $members; + } return $this->members; } + function getAvailableMembers() { + return $this->getMembers(array('available'=>1)); + } + function getSLAId() { return $this->ht['sla_id']; @@ -210,6 +229,9 @@ class Dept { return ($this->ht['noreply_autoresp']); } + function assignMembersOnly() { + return ($this->config->get('assign_members_only', 0)); + } function isGroupMembershipEnabled() { return ($this->ht['group_membership']); @@ -220,11 +242,9 @@ class Dept { } function getInfo() { - return $this->getHashtable(); + return $this->config->getInfo() + $this->getHashtable(); } - - function getAllowedGroups() { if($this->groups) return $this->groups; @@ -240,25 +260,26 @@ class Dept { return $this->groups; } - function updateAllowedGroups($groups) { + function updateSettings($vars) { - if($groups && is_array($groups)) { - foreach($groups as $k=>$id) { + // Groups allowes to access department + if($vars['groups'] && is_array($vars['groups'])) { + foreach($vars['groups'] as $k=>$id) { $sql='INSERT IGNORE INTO '.GROUP_DEPT_TABLE .' SET dept_id='.db_input($this->getId()).', group_id='.db_input($id); db_query($sql); } } - - $sql='DELETE FROM '.GROUP_DEPT_TABLE.' WHERE dept_id='.db_input($this->getId()); - if($groups && is_array($groups)) - $sql.=' AND group_id NOT IN('.implode(',', db_input($groups)).')'; + if($vars['groups'] && is_array($vars['groups'])) + $sql.=' AND group_id NOT IN ('.implode(',', db_input($vars['groups'])).')'; db_query($sql); - return true; + // Misc. config settings + $this->config->set('assign_members_only', $vars['assign_members_only']); + return true; } function update($vars, &$errors) { @@ -266,7 +287,7 @@ class Dept { if(!$this->save($this->getId(), $vars, $errors)) return false; - $this->updateAllowedGroups($vars['groups']); + $this->updateSettings($vars); $this->reload(); return true; @@ -298,6 +319,9 @@ class Dept { //Delete group access db_query('DELETE FROM '.GROUP_DEPT_TABLE.' WHERE dept_id='.db_input($id)); + + // Destrory config settings + $this->config->destroy(); } return $num; @@ -340,6 +364,8 @@ class Dept { if(($manager=$criteria['manager'])) $sql.=' AND manager_id='.db_input(is_object($manager)?$manager->getId():$manager); + $sql.=' ORDER BY dept_name'; + if(($res=db_query($sql)) && db_num_rows($res)) { while(list($id, $name)=db_fetch_row($res)) $depts[$id] = $name; @@ -353,8 +379,12 @@ class Dept { } function create($vars, &$errors) { - if(($id=self::save(0, $vars, $errors)) && ($dept=self::lookup($id))) - $dept->updateAllowedGroups($vars['groups']); + + if(!($id=self::save(0, $vars, $errors))) + return null; + + if (($dept=self::lookup($id))) + $dept->updateSettings($vars); return $id; } @@ -365,13 +395,6 @@ class Dept { if($id && $id!=$vars['id']) $errors['err']='Missing or invalid Dept ID (internal error).'; - if(!isset($vars['id']) - && (!$vars['email_id'] || !is_numeric($vars['email_id']))) - $errors['email_id']='Email selection required'; - - if(isset($vars['tpl_id']) && !is_numeric($vars['tpl_id'])) - $errors['tpl_id']='Template selection required'; - if(!$vars['name']) { $errors['name']='Name required'; } elseif(strlen($vars['name'])<4) { diff --git a/include/class.email.php b/include/class.email.php index 17c03532876a68f01b06e19a448cec389574b5a1..0bae5c95a8b644bf372d73b4fa825c008d6e070e 100644 --- a/include/class.email.php +++ b/include/class.email.php @@ -195,6 +195,15 @@ class Email { } + function __toString() { + + $email = $this->getEmail(); + if ($this->getName()) + $email = sprintf('%s <%s>', $this->getName(), $this->getEmail()); + + return $email; + } + /******* Static functions ************/ function getIdByEmail($email) { diff --git a/include/class.staff.php b/include/class.staff.php index ed6a0ae1da7167f2b9b37a6d1031d80051a35ef1..4b28b60929759f9d5a1c38ebcfa9cf63af55e8b5 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -93,12 +93,12 @@ class Staff extends AuthenticatedUser { return $this->__toString(); } - function getHastable() { + function getHashtable() { return $this->ht; } function getInfo() { - return $this->config->getInfo() + $this->getHastable(); + return $this->config->getInfo() + $this->getHashtable(); } // AuthenticatedUser implementation... @@ -585,6 +585,9 @@ class Staff extends AuthenticatedUser { //Cleanup Team membership table. db_query('DELETE FROM '.TEAM_MEMBER_TABLE.' WHERE staff_id='.db_input($this->getId())); + + // Destrory config settings + $this->config->destroy(); } Signal::send('model.deleted', $this); @@ -595,7 +598,7 @@ class Staff extends AuthenticatedUser { /**** Static functions ********/ function getStaffMembers($availableonly=false) { - $sql='SELECT s.staff_id,CONCAT_WS(", ",s.lastname, s.firstname) as name ' + $sql='SELECT s.staff_id, CONCAT_WS(" ", s.firstname, s.lastname) as name ' .' FROM '.STAFF_TABLE.' s '; if($availableonly) { diff --git a/include/class.ticket.php b/include/class.ticket.php index b08e6ff9066e11416cac1bfab054babc807a5f67..7de7e248001aee6f238da9903ebeb5e5e3f93f6a 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1428,7 +1428,7 @@ class Ticket { if(!is_object($staff) && !($staff=Staff::lookup($staff))) return false; - if(!$this->setStaffId($staff->getId())) + if (!$staff->isAvailable() || !$this->setStaffId($staff->getId())) return false; $this->onAssign($staff, $note, $alert); @@ -1442,7 +1442,7 @@ class Ticket { if(!is_object($team) && !($team=Team::lookup($team))) return false; - if(!$this->setTeamId($team->getId())) + if (!$team->isActive() || !$this->setTeamId($team->getId())) return false; //Clear - staff if it's a closed ticket diff --git a/include/class.user.php b/include/class.user.php index c6dfbe1a25f5d136b576b2a9bce97d0c8e421035..172399ab63ba032848ca373d21d0969803d0e29a 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -286,6 +286,7 @@ class User extends UserModel { User::_inspect(); class PersonsName { + var $format; var $parts; var $name; @@ -302,7 +303,14 @@ class PersonsName { 'original' => array('-- As Entered --', 'getOriginal'), ); - function __construct($name) { + function __construct($name, $format=null) { + global $cfg; + + if ($format && !isset(static::$formats[$format])) + $this->format = $format; + elseif($cfg) + $this->format = $cfg->getDefaultNameFormat(); + $this->parts = static::splitName($name); $this->name = $name; } @@ -391,10 +399,10 @@ class PersonsName { } function __toString() { - global $cfg; - $format = $cfg->getDefaultNameFormat(); - list(,$func) = static::$formats[$format]; + + @list(, $func) = static::$formats[$this->format]; if (!$func) $func = 'getFull'; + return call_user_func(array($this, $func)); } diff --git a/include/i18n/en_US/department.yaml b/include/i18n/en_US/department.yaml index 05ffc9d9ca54c86a5865bd2d317f561c0ced81a0..3de7de70b6a2965679f39a870e80460516d04206 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 2a001a4037d5864849f6e5b718227f7270c5648c..bcfec6c44915c2534a094a2386cd761ed88551dc 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); @@ -59,49 +62,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </td> </tr> <tr> - <td width="180" class="required"> - Email: - </td> - <td> - <select name="email_id"> - <option value="0">— Select Department Email —</option> - <?php - $sql='SELECT email_id,email,name FROM '.EMAIL_TABLE.' email ORDER by name'; - if(($res=db_query($sql)) && db_num_rows($res)){ - while(list($id,$email,$name)=db_fetch_row($res)){ - $selected=($info['email_id'] && $id==$info['email_id'])?'selected="selected"':''; - if($name) - $email=Format::htmlchars("$name <$email>"); - echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$email); - } - } - ?> - </select> - <span class="error">* <?php echo $errors['email_id']; ?></span> - </td> - </tr> - <tr> - <td width="180" class="required"> - Template: - </td> - <td> - <select name="tpl_id"> - <option value="0">— System Default —</option> - <?php - $sql='SELECT tpl_id,name FROM '.EMAIL_TEMPLATE_GRP_TABLE.' tpl WHERE isactive=1 ORDER by name'; - if(($res=db_query($sql)) && db_num_rows($res)){ - while(list($id,$name)=db_fetch_row($res)){ - $selected=($info['tpl_id'] && $id==$info['tpl_id'])?'selected="selected"':''; - echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$name); - } - } - ?> - </select> - <span class="error">* <?php echo $errors['tpl_id']; ?></span> - </td> - </tr> - <tr> - <td width="180" class="required"> + <td width="180"> SLA: </td> <td> @@ -120,7 +81,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </td> </tr> <tr> - <td width="180" class="required"> + <td width="180"> Manager: </td> <td> @@ -147,12 +108,70 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </td> <td> <input type="checkbox" name="group_membership" value="0" <?php echo $info['group_membership']?'checked="checked"':''; ?> > - Extend membership to groups with access. <i>(Alerts and notices will include groups)</i> + Extend membership to groups with access <em>(Alerts and + notices will include groups)</em> + </td> + </tr> + <tr> + <td>Ticket Assignment:</td> + <td> + <input type="checkbox" name="assign_members_only" <?php echo + $info['assign_members_only']?'checked="checked"':''; ?>> + Limit ticket assignment to department members + <!-- Help Tip: + Tickets can ONLY be assigned to department members (+ group members)--> + </td> + </tr> + <tr> + <th colspan="2"> + <em><strong>Email Settings</strong>: Outgoing email settings for the department.</em> + </th> + </tr> + <tr> + <td width="180"> + Outgoing Email: + </td> + <td> + <select name="email_id"> + <option value="0">— System Default —</option> + <?php + $sql='SELECT email_id,email,name FROM '.EMAIL_TABLE.' email ORDER by name'; + if(($res=db_query($sql)) && db_num_rows($res)){ + while(list($id,$email,$name)=db_fetch_row($res)){ + $selected=($info['email_id'] && $id==$info['email_id'])?'selected="selected"':''; + if($name) + $email=Format::htmlchars("$name <$email>"); + echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$email); + } + } + ?> + </select> + <span class="error">* <?php echo $errors['email_id']; ?></span> + </td> + </tr> + <tr> + <td width="180"> + Template Set: + </td> + <td> + <select name="tpl_id"> + <option value="0">— System Default —</option> + <?php + $sql='SELECT tpl_id,name FROM '.EMAIL_TEMPLATE_GRP_TABLE.' tpl WHERE isactive=1 ORDER by name'; + if(($res=db_query($sql)) && db_num_rows($res)){ + while(list($id,$name)=db_fetch_row($res)){ + $selected=($info['tpl_id'] && $id==$info['tpl_id'])?'selected="selected"':''; + echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$name); + } + } + ?> + </select> + <span class="error">* <?php echo $errors['tpl_id']; ?></span> </td> </tr> <tr> <th colspan="2"> - <em><strong>Auto Response Settings</strong>: Override global auto-response settings for tickets routed to the Dept.</em> + <em><strong>Autoresponder Settings</strong>: Override global auto-response settings for tickets routed to the department.</em> </th> </tr> <tr> diff --git a/include/staff/departments.inc.php b/include/staff/departments.inc.php index 23d6937e8c1f474997250370e4d0bd453f58771d..da9c74c5e3e3c3e3e38060e352eb4700b4812f34 100644 --- a/include/staff/departments.inc.php +++ b/include/staff/departments.inc.php @@ -54,7 +54,7 @@ else <caption><?php echo $showing; ?></caption> <thead> <tr> - <th width="7px"> </th> + <th width="7px"> </th> <th width="180"><a <?php echo $name_sort; ?> href="departments.php?<?php echo $qstr; ?>&sort=name">Name</a></th> <th width="80"><a <?php echo $type_sort; ?> href="departments.php?<?php echo $qstr; ?>&sort=type">Type</a></th> <th width="70"><a <?php echo $users_sort; ?>href="departments.php?<?php echo $qstr; ?>&sort=users">Users</a></th> @@ -68,17 +68,25 @@ else $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null; if($res && db_num_rows($res)): $defaultId=$cfg->getDefaultDeptId(); + $defaultEmailId = $cfg->getDefaultEmail()->getId(); + $defaultEmailAddress = (string) $cfg->getDefaultEmail(); while ($row = db_fetch_array($res)) { $sel=false; if($ids && in_array($row['dept_id'],$ids)) $sel=true; - - $row['email']=$row['email_name']?($row['email_name'].' <'.$row['email'].'>'):$row['email']; + + if ($row['email_id']) + $row['email']=$row['email_name']?($row['email_name'].' <'.$row['email'].'>'):$row['email']; + elseif($defaultEmailId) { + $row['email_id'] = $defaultEmailId; + $row['email'] = $defaultEmailAddress; + } + $default=($defaultId==$row['dept_id'])?' <small>(Default)</small>':''; ?> <tr id="<?php echo $row['dept_id']; ?>"> <td width=7px> - <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['dept_id']; ?>" + <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['dept_id']; ?>" <?php echo $sel?'checked="checked"':''; ?> <?php echo $default?'disabled="disabled"':''; ?> > </td> <td><a href="departments.php?id=<?php echo $row['dept_id']; ?>"><?php echo $row['dept_name']; ?></a> <?php echo $default; ?></td> @@ -91,7 +99,8 @@ else <?php } ?> </b> </td> - <td><a href="emails.php?id=<?php echo $row['email_id']; ?>"><?php echo $row['email']; ?></a></td> + <td><a href="emails.php?id=<?php echo $row['email_id']; ?>"><?php + echo Format::htmlchars($row['email']); ?></a> </td> <td><a href="staff.php?id=<?php echo $row['manager_id']; ?>"><?php echo $row['manager']; ?> </a></td> </tr> <?php diff --git a/include/staff/filter.inc.php b/include/staff/filter.inc.php index 74e72106859d68501fbc6e490d79a9ddf90a4869..2ca87dc4ccec23741c2e3a776acb300e05aeae1c 100644 --- a/include/staff/filter.inc.php +++ b/include/staff/filter.inc.php @@ -197,13 +197,16 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <select name="canned_response_id"> <option value="">— None —</option> <?php - $sql='SELECT canned_id,title FROM '.CANNED_TABLE - .' WHERE isenabled ORDER by title'; + $sql='SELECT canned_id, title, isenabled FROM '.CANNED_TABLE .' ORDER by title'; if ($res=db_query($sql)) { - while (list($id,$title)=db_fetch_row($res)) { + while (list($id, $title, $isenabled)=db_fetch_row($res)) { $selected=($info['canned_response_id'] && $id==$info['canned_response_id']) ? 'selected="selected"' : ''; + + if (!$isenabled) + $title .= ' (disabled)'; + echo sprintf('<option value="%d" %s>%s</option>', $id, $selected, $title); } @@ -281,32 +284,27 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <td> <select name="assign"> <option value="0">— Unassigned —</option> - - <?php - - - $sql=' SELECT staff_id,CONCAT_WS(", ",lastname,firstname) as name '. - ' FROM '.STAFF_TABLE.' WHERE isactive=1 ORDER BY name'; - - if(($res=db_query($sql)) && db_num_rows($res)){ + if (($users=Staff::getStaffMembers())) { echo '<OPTGROUP label="Staff Members">'; - while (list($id,$name) = db_fetch_row($res)){ + foreach($users as $id => $name) { + $name = new PersonsName($name); $k="s$id"; $selected = ($info['assign']==$k || $info['staff_id']==$id)?'selected="selected"':''; ?> <option value="<?php echo $k; ?>"<?php echo $selected; ?>><?php echo $name; ?></option> - - <?php } + <?php + } echo '</OPTGROUP>'; - } - $sql='SELECT team_id, name FROM '.TEAM_TABLE.' WHERE isenabled=1'; + $sql='SELECT team_id, isenabled, name FROM '.TEAM_TABLE .' ORDER BY name'; if(($res=db_query($sql)) && db_num_rows($res)){ echo '<OPTGROUP label="Teams">'; - while (list($id,$name) = db_fetch_row($res)){ + while (list($id, $isenabled, $name) = db_fetch_row($res)){ $k="t$id"; $selected = ($info['assign']==$k || $info['team_id']==$id)?'selected="selected"':''; + if (!$isenabled) + $name .= ' (disabled)'; ?> <option value="<?php echo $k; ?>"<?php echo $selected; ?>><?php echo $name; ?></option> <?php diff --git a/include/staff/helptopic.inc.php b/include/staff/helptopic.inc.php index 9e9a34d142369997a3ccc32cc499045b4716de9e..25f93c8be0d042e149d53c0e50e4e570f91f2ee1 100644 --- a/include/staff/helptopic.inc.php +++ b/include/staff/helptopic.inc.php @@ -193,25 +193,28 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <select name="assign"> <option value="0">— Unassigned —</option> <?php - $sql=' SELECT staff_id,CONCAT_WS(", ",lastname,firstname) as name '. - ' FROM '.STAFF_TABLE.' WHERE isactive=1 ORDER BY name'; - if(($res=db_query($sql)) && db_num_rows($res)){ + if (($users=Staff::getStaffMembers())) { echo '<OPTGROUP label="Staff Members">'; - while (list($id,$name) = db_fetch_row($res)){ + foreach ($users as $id => $name) { + $name = new PersonsName($name); $k="s$id"; $selected = ($info['assign']==$k || $info['staff_id']==$id)?'selected="selected"':''; ?> <option value="<?php echo $k; ?>"<?php echo $selected; ?>><?php echo $name; ?></option> - <?php } + <?php + } echo '</OPTGROUP>'; } - $sql='SELECT team_id, name FROM '.TEAM_TABLE.' WHERE isenabled=1'; + $sql='SELECT team_id, name, isenabled FROM '.TEAM_TABLE.' ORDER BY name'; if(($res=db_query($sql)) && db_num_rows($res)){ echo '<OPTGROUP label="Teams">'; - while (list($id,$name) = db_fetch_row($res)){ + while (list($id, $name, $isenabled) = db_fetch_row($res)){ $k="t$id"; $selected = ($info['assign']==$k || $info['team_id']==$id)?'selected="selected"':''; + + if (!$isenabled) + $name .= ' (disabled)'; ?> <option value="<?php echo $k; ?>"<?php echo $selected; ?>><?php echo $name; ?></option> <?php diff --git a/include/staff/slaplan.inc.php b/include/staff/slaplan.inc.php index 0aac8b778005cc61644f57f39fe77e4d07fcee7c..19e165d49f3b1660ed2e0eec301931adc06e15e5 100644 --- a/include/staff/slaplan.inc.php +++ b/include/staff/slaplan.inc.php @@ -62,16 +62,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <td> <input type="radio" name="isactive" value="1" <?php echo $info['isactive']?'checked="checked"':''; ?>><strong>Active</strong> <input type="radio" name="isactive" value="0" <?php echo !$info['isactive']?'checked="checked"':''; ?>>Disabled - <span class="error">* </span> - </td> - </tr> - <tr> - <td width="180"> - Priority Escalation: - </td> - <td> - <input type="checkbox" name="enable_priority_escalation" value="1" <?php echo $info['enable_priority_escalation']?'checked="checked"':''; ?> > - <strong>Enable</strong> priority escalation on overdue tickets. + <span class="error">* <?php echo $errors['isactive']; ?></span> </td> </tr> <tr> diff --git a/include/staff/slaplans.inc.php b/include/staff/slaplans.inc.php index 04566aee31bffdab2f5dc2e4b8cf3ddedfc3722e..ff6fa6abe5601bbbf84be2d35b8697b8c753e5f6 100644 --- a/include/staff/slaplans.inc.php +++ b/include/staff/slaplans.inc.php @@ -53,7 +53,7 @@ else <caption><?php echo $showing; ?></caption> <thead> <tr> - <th width="7"> </th> + <th width="7"> </th> <th width="320"><a <?php echo $name_sort; ?> href="slas.php?<?php echo $qstr; ?>&sort=name">Name</a></th> <th width="100"><a <?php echo $status_sort; ?> href="slas.php?<?php echo $qstr; ?>&sort=status">Status</a></th> <th width="130"><a <?php echo $period_sort; ?> href="slas.php?<?php echo $qstr; ?>&sort=period">Grace Period (hrs)</a></th> @@ -66,17 +66,24 @@ else $total=0; $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null; if($res && db_num_rows($res)): + $defaultId = $cfg->getDefaultSLAId(); while ($row = db_fetch_array($res)) { $sel=false; if($ids && in_array($row['id'],$ids)) $sel=true; + + $default = ''; + if ($row['id'] == $defaultId) + $default = '<small><em>(Default)</em></small>'; ?> <tr id="<?php echo $row['id']; ?>"> <td width=7px> - <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['id']; ?>" - <?php echo $sel?'checked="checked"':''; ?>> + <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['id']; ?>" + <?php echo $sel?'checked="checked"':''; ?>> </td> - <td> <a href="slas.php?id=<?php echo $row['id']; ?>"><?php echo Format::htmlchars($row['name']); ?></a></td> + <td> <a href="slas.php?id=<?php echo $row['id']; + ?>"><?php echo Format::htmlchars($row['name']); + ?></a> <?php echo $default; ?></td> <td><?php echo $row['isactive']?'Active':'<b>Disabled</b>'; ?></td> <td style="text-align:right;padding-right:35px;"><?php echo $row['grace_period']; ?> </td> <td> <?php echo Format::db_date($row['created']); ?></td> diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 4042692d48e075e196d4b8cbdedec5e15ff08a46..dcce0d8f88de96a0dcc70595057cb8a9a557dac6 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -802,16 +802,25 @@ $tcount+= $ticket->getNumNotes(); echo sprintf('<option value="%d">Claim Ticket (comments optional)</option>', $thisstaff->getId()); $sid=$tid=0; - if(($users=Staff::getAvailableStaffMembers())) { + + if ($dept->assignMembersOnly()) + $users = $dept->getAvailableMembers(); + else + $users = Staff::getAvailableStaffMembers(); + + if ($users) { echo '<OPTGROUP label="Staff Members ('.count($users).')">'; $staffId=$ticket->isAssigned()?$ticket->getStaffId():0; foreach($users as $id => $name) { if($staffId && $staffId==$id) continue; + if (!is_object($name)) + $name = new PersonsName($name); + $k="s$id"; echo sprintf('<option value="%s" %s>%s</option>', - $k,(($info['assignId']==$k)?'selected="selected"':''),$name); + $k,(($info['assignId']==$k)?'selected="selected"':''), $name); } echo '</OPTGROUP>'; } diff --git a/scp/slas.php b/scp/slas.php index 072b27792f8a8635479f6a4cf50fddbe01fad4eb..62875c08ffd94dd41ec77a6b5f7dc5eb983b5afd 100644 --- a/scp/slas.php +++ b/scp/slas.php @@ -73,7 +73,9 @@ if($_POST){ case 'delete': $i=0; foreach($_POST['ids'] as $k=>$v) { - if(($p=SLA::lookup($v)) && $p->delete()) + if (($p=SLA::lookup($v)) + && $p->getId() != $cfg->getDefaultSLAId() + && $p->delete()) $i++; } diff --git a/setup/inc/class.installer.php b/setup/inc/class.installer.php index cc18ba3e949ced04453f15205329a297b4315b84..249f40dfcb0a15d0990a36378641b9d68a22b664 100644 --- a/setup/inc/class.installer.php +++ b/setup/inc/class.installer.php @@ -248,9 +248,6 @@ class Installer extends SetupWizard { $sql='UPDATE '.PREFIX."email SET dept_id=$dept_id_1"; db_query($sql, false); - $sql='UPDATE '.PREFIX."department SET email_id=$support_email_id" - .", autoresp_email_id=$support_email_id"; - db_query($sql, false); global $cfg; $cfg = new OsticketConfig();