From 694221d2ebad1734dab4aaea0e5d411f0a8a75cf Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 27 Jan 2014 15:36:57 -0600 Subject: [PATCH] Drop `subject` and `body` from filters They are only available for tickets arriving via the email channel. All other channel (including email) use the new ticket form to record the subject and body, which are mapped to the 'Issue Summary' and 'Issue Details' fields respectively Structure the drop-down list for the `what` column to be future-minded concerning custom user data matching. --- include/class.dynamic_forms.php | 2 +- include/class.filter.php | 6 +++--- include/staff/filter.inc.php | 7 +++---- .../streams/core/f1ccd3bb-f5692e24.patch.sql | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 27e4a0afe..a2bef2a62 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -271,7 +271,7 @@ class TicketForm extends DynamicForm { } } // Add fields from the standard ticket form to the ticket filterable fields -Filter::addSupportedMatches('Custom Fields', function() { +Filter::addSupportedMatches('Ticket Data', function() { $matches = array(); foreach (TicketForm::getInstance()->getFields() as $f) { if (!$f->hasData()) diff --git a/include/class.filter.php b/include/class.filter.php index d295c240c..8854ea89e 100644 --- a/include/class.filter.php +++ b/include/class.filter.php @@ -19,11 +19,11 @@ class Filter { var $ht; static $match_types = array( - 'Basic Fields' => array( + 'User Information' => array( 'name' => 'Name', 'email' => 'Email', - 'subject' => 'Subject', - 'body' => 'Body/Text', + ), + 'Email Meta-Data' => array( 'reply-to' => 'Reply-To Email', 'reply-to-name' => 'Reply-To Name', ), diff --git a/include/staff/filter.inc.php b/include/staff/filter.inc.php index 37ac6c699..74e721068 100644 --- a/include/staff/filter.inc.php +++ b/include/staff/filter.inc.php @@ -121,7 +121,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); for($i=1; $i<=$n; $i++){ ?> <tr id="r<?php echo $i; ?>"> <td colspan="2"> - <div style="width:700px; float:left;"> + <div> <select name="rule_w<?php echo $i; ?>"> <option value="">— Select One ‐</option> <?php @@ -143,15 +143,14 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); } ?> </select> - <input type="text" size="30" name="rule_v<?php echo $i; ?>" value="<?php echo $info["rule_v$i"]; ?>"> + <input type="text" size="60" name="rule_v<?php echo $i; ?>" value="<?php echo $info["rule_v$i"]; ?>"> <span class="error"> <?php echo $errors["rule_$i"]; ?></span> - </div> <?php if($info["rule_w$i"] || $info["rule_h$i"] || $info["rule_v$i"]){ ?> <div style="float:right;text-align:right;padding-right:20px;"><a href="#" class="clearrule">(clear)</a></div> <?php } ?> - <div class="clear"></div> + </div> </td> </tr> <?php diff --git a/include/upgrader/streams/core/f1ccd3bb-f5692e24.patch.sql b/include/upgrader/streams/core/f1ccd3bb-f5692e24.patch.sql index ddf764696..fab41f1bc 100644 --- a/include/upgrader/streams/core/f1ccd3bb-f5692e24.patch.sql +++ b/include/upgrader/streams/core/f1ccd3bb-f5692e24.patch.sql @@ -22,6 +22,24 @@ ALTER TABLE `%TABLE_PREFIX%filter_rule` ALTER TABLE `%TABLE_PREFIX%ticket_collaborator` CHANGE `isactive` `isactive` tinyint(1) NOT NULL DEFAULT '1'; +-- There is no `subject` available in the filter::apply method for anything but email +UPDATE `%TABLE_PREFIX%filter_rule` + SET `what` = CONCAT('field.', ( + SELECT field.`id` FROM `%TABLE_PREFIX%form_field` field + JOIN `%TABLE_PREFIX%form` form ON (field.form_id = form.id) + WHERE field.`name` = 'subject' AND form.`type` = 'T' + )) + WHERE `what` = 'subject'; + +-- There is no `body` available in the filter::apply method for anything but emails +UPDATE `%TABLE_PREFIX%filter_rule` + SET `what` = CONCAT('field.', ( + SELECT field.`id` FROM `%TABLE_PREFIX%form_field` field + JOIN `%TABLE_PREFIX%form` form ON (field.form_id = form.id) + WHERE field.`name` = 'message' AND form.`type` = 'T' + )) + WHERE `what` = 'body'; + -- Finished with patch UPDATE `%TABLE_PREFIX%config` SET `value` = 'f5692e24c7afba7ab6168dde0b3bb3c8' -- GitLab