From 1c8e97c84a662960b4f0c62dd2a1fa68d21bee2e Mon Sep 17 00:00:00 2001
From: JediKev <kevin@enhancesoft.com>
Date: Tue, 26 Feb 2019 12:56:46 -0600
Subject: [PATCH] issue: Canned Response Variables

This addresses issue 4756 where the `%{recipient.ticket_link}` variable is
not being replaced when the canned response is loaded in the reply box; all
other link variables work. This is due to the recipient object not being
passed to the variableReplacer which means the ticket_link is not available.
This adds the recipient object to the variableReplacer so the ticket_link
variable is properly replaced like the others on load.
---
 include/ajax.tickets.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php
index 17799f212..678e4a4f6 100644
--- a/include/ajax.tickets.php
+++ b/include/ajax.tickets.php
@@ -364,7 +364,7 @@ class TicketsAjaxAPI extends AjaxController {
             $format.='.plain';
 
         $varReplacer = function (&$var) use($ticket) {
-            return $ticket->replaceVars($var);
+            return $ticket->replaceVars($var, array('recipient' => $ticket->getOwner()));
         };
 
         include_once(INCLUDE_DIR.'class.canned.php');
-- 
GitLab