From f50394e19485303a2a1207b2e761aa50b104f210 Mon Sep 17 00:00:00 2001 From: Kevin Thorne <kevinthorne7@yahoo.com> Date: Sun, 14 Feb 2016 14:32:49 -0600 Subject: [PATCH] Fix New Ticket Cancel Button Fixes the cancel button from doing nothing to making it delete the draft of the fields and redirect agents to ticket queue or clients to main page. --- include/client/open.inc.php | 2 +- include/staff/ticket-open.inc.php | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/client/open.inc.php b/include/client/open.inc.php index ea0a100e7..80cc3456b 100644 --- a/include/client/open.inc.php +++ b/include/client/open.inc.php @@ -116,7 +116,7 @@ if ($info['topicId'] && ($topic=Topic::lookup($info['topicId']))) { $('.richtext').each(function() { var redactor = $(this).data('redactor'); if (redactor && redactor.opts.draftDelete) - redactor.deleteDraft(); + redactor.draft.deleteDraft(); }); window.location.href='index.php';"> </p> diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index 6041f5573..8eda359ad 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -385,13 +385,9 @@ print $response_form->getField('attachments')->render(); <input type="submit" name="submit" value="<?php echo _P('action-button', 'Open');?>"> <input type="reset" name="reset" value="<?php echo __('Reset');?>"> <input type="button" name="cancel" value="<?php echo __('Cancel');?>" onclick="javascript: - $('.richtext').each(function() { - var redactor = $(this).data('redactor'); - if (redactor && redactor.opts.draftDelete) - redactor.deleteDraft(); - }); - window.location.href='tickets.php'; - "> + $(this.form).find('textarea.richtext') + .redactor('draft.deleteDraft'); + window.location.href='tickets.php'; " /> </p> </form> <script type="text/javascript"> -- GitLab