diff --git a/include/class.filter_action.php b/include/class.filter_action.php index 2e57ba5303d858bc773e982c52b6ac9f87763817..98d71d85ec55fc407dd3db3dd208c00eacc1d27a 100644 --- a/include/class.filter_action.php +++ b/include/class.filter_action.php @@ -220,10 +220,7 @@ class FA_DisableAutoResponse extends TriggerAction { function apply(&$ticket, array $info) { # TODO: Disable alerting # XXX: Does this imply turning it on as well? (via ->sendAlerts()) - $config = $this->getConfiguration(); - if ($config['enable']) { - $ticket['autorespond']=false; - } + $ticket['autorespond']=false; } function getConfigurationOptions() { diff --git a/include/class.thread.php b/include/class.thread.php index 7b5b94418e7583e4f5657a6b3705202356ba7dbd..9f32b0f90521fd8682bbdc27350c589c75b2143f 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -2566,10 +2566,6 @@ abstract class ThreadEntryAction { abstract function trigger(); - function getTicket() { - return $this->entry->getObject(); - } - function isEnabled() { return $this->isVisible(); } diff --git a/include/class.ticket.php b/include/class.ticket.php index b8e6b55828ccc48744fd19a67688b57a40c64d5c..86bc673892750bde1380ea282878a447d0083474 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -139,6 +139,16 @@ class TicketModel extends VerySimpleModel { /* @trans */ 'Ability to delete tickets'), ); + // Ticket Sources + static protected $sources = array( + 'Phone' => + /* @trans */ 'Phone', + 'Email' => + /* @trans */ 'Email', + 'Other' => + /* @trans */ 'Other', + ); + function getId() { return $this->ticket_id; } @@ -199,6 +209,10 @@ EOF; static function getPermissions() { return self::$perms; } + + static function getSources() { + return self::$sources; + } } RolePermission::register(/* @trans */ 'Tickets', TicketModel::getPermissions(), true); @@ -2881,7 +2895,11 @@ implements RestrictedAccess, Threadable { $stats['overdue'] += $S['count']; if ($S['staff_id'] == $id) $stats['assigned'] += $S['count']; - elseif ($S['team_id'] && $S['staff_id'] == 0) + elseif ($S['team_id'] + && $S['staff_id'] == 0 + && $teams + && in_array($S['team_id'], $teams)) + // Assigned to my team but uassigned to an agent $stats['assigned'] += $S['count']; } return $stats; @@ -3447,13 +3465,11 @@ implements RestrictedAccess, Threadable { return false; } - if ($vars['source'] && !in_array( - strtolower($vars['source']), array('email','phone','other')) - ) { - $errors['source'] = sprintf( - __('Invalid source given - %s'),Format::htmlchars($vars['source']) - ); - } + if (isset($vars['source']) // Check ticket source if provided + && !array_key_exists($vars['source'], Ticket::getSources())) + $errors['source'] = sprintf( __('Invalid source given - %s'), + Format::htmlchars($vars['source'])); + if (!$vars['uid']) { // Special validation required here diff --git a/include/staff/staffmembers.inc.php b/include/staff/staffmembers.inc.php index 7a1c75d815be2dc29248dff6569af29bc8a5bc86..be3d276f69cee3c2d2f625a03080551d056eb50b 100644 --- a/include/staff/staffmembers.inc.php +++ b/include/staff/staffmembers.inc.php @@ -22,7 +22,7 @@ if ($sort && $sortOptions[$sort]) { $order_column = $order_column ? $order_column : array('firstname', 'lastname'); -switch ($cfg->getClientNameFormat()) { +switch ($cfg->getAgentNameFormat()) { case 'last': case 'lastfirst': case 'legal': diff --git a/include/staff/teams.inc.php b/include/staff/teams.inc.php index e54adb993f659bb56f4135e9bf20b63b2b0fe630..ec1bfbfdbe7299b4c9fe4ca0fbf0d976d90072e7 100644 --- a/include/staff/teams.inc.php +++ b/include/staff/teams.inc.php @@ -95,7 +95,7 @@ $qstr .= '&order='.urlencode($order=='DESC' ? 'ASC' : 'DESC'); if ($count) { $teams = Team::objects() ->annotate(array( - 'members_count'=>SqlAggregate::COUNT('members', true), + 'members_count'=>SqlAggregate::COUNT('members__staff', true), )) ->order_by(sprintf('%s%s', strcasecmp($order, 'DESC') ? '' : '-', diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index 3173d7e92bb2004149bfa209aefc84760cdb675a..b8330a0f53b997a34bc54aa818cc16f16ed9bbde 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -129,9 +129,14 @@ if ($_POST) </td> <td> <select name="source"> - <option value="Phone" selected="selected"><?php echo __('Phone'); ?></option> - <option value="Email" <?php echo ($info['source']=='Email')?'selected="selected"':''; ?>><?php echo __('Email'); ?></option> - <option value="Other" <?php echo ($info['source']=='Other')?'selected="selected"':''; ?>><?php echo __('Other'); ?></option> + <?php + $source = $info['source'] ?: 'Phone'; + foreach (Ticket::getSources() as $k => $v) + echo sprintf('<option value="%s" %s>%s</option>', + $k, + ($source == $k ) ? 'selected="selected"' : '', + $v); + ?> </select> <font class="error"><b>*</b> <?php echo $errors['source']; ?></font> </td> diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 29a2d1fc1e490e094a7bfe27dd9fb4559ff0dc3d..16e22b0168cb1b3cdaa7d7e4c42bee11f501186b 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -350,7 +350,7 @@ if($ticket->isOverdue()) <td><?php echo Format::htmlchars($ticket->getSource()); - if($ticket->getIP()) + if (!strcasecmp($ticket->getSource(), 'Web') && $ticket->getIP()) echo ' <span class="faded">('.$ticket->getIP().')</span>'; ?> </td>