diff --git a/include/class.banlist.php b/include/class.banlist.php index 939ae179b1cc142950daf65cd4c25f301c99b651..ae7b894479f4e3c56c51c30487bf1cd8fc16e2c2 100644 --- a/include/class.banlist.php +++ b/include/class.banlist.php @@ -16,15 +16,15 @@ require_once "class.filter.php"; class Banlist { - + function add($email,$submitter='') { return self::getSystemBanList()->addRule('email','equal',$email); } - + function remove($email) { return self::getSystemBanList()->removeRule('email','equal',$email); } - + function isbanned($email) { return TicketFilter::isBanned($email); } @@ -49,7 +49,9 @@ class Banlist { 'name' => 'SYSTEM BAN LIST', 'isactive' => 1, 'match_all_rules' => false, - 'reject_ticket' => true, + 'actions' => array( + 'Nreject', + ), 'rules' => array(), 'notes' => __('Internal list for email banning. Do not remove') ), $errors); diff --git a/include/class.filter.php b/include/class.filter.php index bfd92285f33829e2093b6c9263ad6616cd53fd0d..ad3f6c043b2cb55c0d40b9779d084ed899653d5e 100644 --- a/include/class.filter.php +++ b/include/class.filter.php @@ -779,8 +779,6 @@ class TicketFilter { */ function apply(&$ticket) { foreach ($this->getMatchingFilterList() as $filter) { - if ($filter->rejectOnMatch()) - throw new RejectedException($filter, $ticket); $filter->apply($ticket, $this->vars); if ($filter->stopOnMatch()) break; } diff --git a/include/class.filter_action.php b/include/class.filter_action.php index 14b582a1294cae05a5a8133a563a3c62bdcd6b02..04dbcc16b4558782a005746adf5595ce5b245c2a 100644 --- a/include/class.filter_action.php +++ b/include/class.filter_action.php @@ -132,6 +132,27 @@ abstract class TriggerAction { abstract function getConfigurationOptions(); } +class FA_RejectTicket extends TriggerAction { + static $type = 'reject'; + static $name = /* trans */ 'Reject Ticket'; + + function apply(&$ticket, array $info) { + throw new RejectedException($filter, $ticket); + } + + function getConfigurationOptions() { + return array( + '' => new FreeTextField(array( + 'configuration' => array( + 'content' => sprintf('<span style="color:red"><b>%s</b></span>', + __('Reject Ticket')), + ) + )), + ); + } +} +FilterAction::register('FA_RejectTicket'); + class FA_UseReplyTo extends TriggerAction { static $type = 'replyto'; static $name = /* trans */ 'Reply-To Email'; diff --git a/include/class.forms.php b/include/class.forms.php index b101009c42239d20e358a75ec799fd67b50f312d..dfccf962c5d1e307fec038fd028f400c889de122 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -2759,11 +2759,18 @@ class FreeTextField extends FormField { class FreeTextWidget extends Widget { function render($options=array()) { $config = $this->field->getConfiguration(); - ?><div class=""><h3><?php - echo Format::htmlchars($this->field->getLocal('label')); - ?></h3><em><?php - echo Format::htmlchars($this->field->getLocal('hint')); - ?></em><div><?php + ?><div class=""><?php + if ($label = $this->field->getLocal('label')) { ?> + <h3><?php + echo Format::htmlchars($label); + ?></h3><?php + } + if ($hint = $this->field->getLocal('hint')) { ?> + <em><?php + echo Format::htmlchars($hint); + ?></em><?php + } ?> + <div><?php echo Format::viewableImages($config['content']); ?></div> </div> <?php diff --git a/include/staff/filter.inc.php b/include/staff/filter.inc.php index 169b845e6956ce5db35a5ef2bba56350d5381287..592289355651dd91621112dcd086033aad453fa2 100644 --- a/include/staff/filter.inc.php +++ b/include/staff/filter.inc.php @@ -171,16 +171,6 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); echo __('Can be overwridden by other filters depending on processing order.');?> </em> </th> </tr> - <tr> - <td width="180"> - <?php echo __('Reject Ticket');?>: - </td> - <td> - <input type="checkbox" name="reject_ticket" value="1" <?php echo $info['reject_ticket']?'checked="checked"':''; ?> > - <strong><font class="error"><?php echo __('Reject Ticket');?></font></strong> - <i class="help-tip icon-question-sign" href="#reject_ticket"></i> - </td> - </tr> </tbody> <tbody id="dynamic-actions"> <?php diff --git a/include/upgrader/streams/core/b26f29a6-00000000.cleanup.sql b/include/upgrader/streams/core/b26f29a6-00000000.cleanup.sql index d40218224f680e4852eb29ca6589d0eec15f02be..82a025fa7cee849a8a2d39e719e4cff8eb86ff4a 100644 --- a/include/upgrader/streams/core/b26f29a6-00000000.cleanup.sql +++ b/include/upgrader/streams/core/b26f29a6-00000000.cleanup.sql @@ -1,4 +1,5 @@ ALTER TABLE `%TABLE_PREFIX%filter` + DROP `reject_ticket`, DROP `use_replyto_email`, DROP `disable_autoresponder`, DROP `canned_response_id`, diff --git a/include/upgrader/streams/core/b26f29a6-00000000.patch.sql b/include/upgrader/streams/core/b26f29a6-00000000.patch.sql index 821b2cbbe3b2a28762263ddd1c9bf9a8a8f91c2c..aab8ff1992d836b95ea717a5e073d3c5a3b2418b 100644 --- a/include/upgrader/streams/core/b26f29a6-00000000.patch.sql +++ b/include/upgrader/streams/core/b26f29a6-00000000.patch.sql @@ -20,6 +20,12 @@ CREATE TABLE `%TABLE_PREFIX%filter_action` ( KEY `filter_id` (`filter_id`) ) DEFAULT CHARSET=utf8; +INSERT INTO `%TABLE_PREFIX%filter_action` + (`filter_id`, `type`, `configuration`, `updated`) + SELECT `id`, 'reject', '', `updated` + FROM `%TABLE_PREFIX%filter` + WHERE `reject_ticket` != 0; + INSERT INTO `%TABLE_PREFIX%filter_action` (`filter_id`, `type`, `configuration`, `updated`) SELECT `id`, 'replyto', '{"enable":true}', `updated` diff --git a/setup/inc/streams/core/install-mysql.sql b/setup/inc/streams/core/install-mysql.sql index 669f071e10ed72c9ab76baac3b8fd8e959b15524..d988d02b0c802d1f5ba76f71d4921283fb026c84 100644 --- a/setup/inc/streams/core/install-mysql.sql +++ b/setup/inc/streams/core/install-mysql.sql @@ -302,20 +302,6 @@ CREATE TABLE `%TABLE_PREFIX%filter` ( `status` int(11) unsigned NOT NULL DEFAULT '0', `match_all_rules` tinyint(1) unsigned NOT NULL default '0', `stop_onmatch` tinyint(1) unsigned NOT NULL default '0', - `reject_ticket` tinyint(1) unsigned NOT NULL default '0', - `use_replyto_email` tinyint(1) unsigned NOT NULL default '0', - `disable_autoresponder` tinyint(1) unsigned NOT NULL default '0', - `canned_response_id` int(11) unsigned NOT NULL default '0', - `email_id` int(10) unsigned NOT NULL default '0', - `status_id` int(10) unsigned NOT NULL default '0', - `priority_id` int(10) unsigned NOT NULL default '0', - `dept_id` int(10) unsigned NOT NULL default '0', - `staff_id` int(10) unsigned NOT NULL default '0', - `team_id` int(10) unsigned NOT NULL default '0', - `sla_id` int(10) unsigned NOT NULL default '0', - `form_id` int(11) unsigned NOT NULL default '0', - `topic_id` int(11) unsigned NOT NULL default '0', - `ext_id` varchar(11), `target` ENUM( 'Any', 'Web', 'Email', 'API' ) NOT NULL DEFAULT 'Any', `name` varchar(32) NOT NULL default '', `notes` text,