PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.4.5
Fluent Support – Helpdesk & Customer Support Ticket System v2.4.5
2.4.5 2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 All 69 releases
← All changes | app/Services/Parser/ShortcodeParser.php +38 -1 1.5.1 → 2.4.5 View file →
@@ -63,13 +63,19 @@
63 63 if (isset($valueKeys[1])) {
64 64 $defaultValue = trim($valueKeys[1]);
65 65 }
66 66
67 + // Before the empty-data guard: with no agent (unassigned ticket, closed by
68 + // a workflow) the signature is empty, not a literal {{agent.signature}}.
69 + if ($dataKey == 'agent' && $valueKey == 'signature') {
70 + return $this->getAgentSignature($data);
71 + }
72 +
67 73 if(empty($data[$dataKey])) {
68 74 return $matches[0];
69 75 }
70 76
71 - if ($dataKey == 'customer' || $dataKey == 'agent') {
77 + if ($dataKey == 'customer' || $dataKey == 'agent' || $dataKey == 'assigner') {
72 78 return $this->getPersonValue($data[$dataKey], $valueKey, $defaultValue);
73 79 }
74 80
75 81 if($dataKey == 'ticket') {
@@ -88,8 +94,35 @@
88 94
89 95 return apply_filters('fluentsupport/smartcode_fallback_callback_' . $dataKey, $matches[0], $valueKey, $defaultValue, $data);
90 96 }
91 97
98 + /** Set while a signature renders: a signature naming itself, in any spelling, renders empty. */
99 + private static $renderingSignature = false;
100 +
101 + /**
102 + * {{agent.signature}}: the agent's signature when enabled, otherwise empty.
103 + * Its own smartcodes are filled from the same data.
104 + */
105 + protected function getAgentSignature($data)
106 + {
107 + if (self::$renderingSignature || empty($data['agent'])) {
108 + return '';
109 + }
110 +
111 + $signature = \FluentSupport\App\Services\Tickets\ResponseService::getAppendedSignature($data['agent']);
112 +
113 + if ($signature === '') {
114 + return '';
115 + }
116 +
117 + self::$renderingSignature = true;
118 + try {
119 + return $this->parse($signature, $data);
120 + } finally {
121 + self::$renderingSignature = false;
122 + }
123 + }
124 +
92 125 protected function getTicketData($ticket, $valueKey, $defaultValue)
93 126 {
94 127 $valueKeys = explode('.', $valueKey);
95 128
@@ -99,8 +132,12 @@
99 132 }
100 133
101 134 if($valueKey == 'admin_url') {
102 135 return Helper::getTicketAdminUrl($ticket);
136 + }
137 +
138 + if($valueKey == 'public_id') {
139 + return $ticket->display_ticket_number;
103 140 }
104 141
105 142 $accesors = ['id', 'title', 'content', 'priority', 'client_priority', 'status', 'created_at'];
106 143 if(in_array($valueKey, $accesors)) {