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 +33 -0 2.3.0 → 2.4.5 View file →
@@ -63,8 +63,14 @@
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
@@ -86,8 +92,35 @@
86 92 return $this->getBusinessValue($valueKey, $defaultValue, $business);
87 93 }
88 94
89 95 return apply_filters('fluentsupport/smartcode_fallback_callback_' . $dataKey, $matches[0], $valueKey, $defaultValue, $data);
96 + }
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 + }
90 123 }
91 124
92 125 protected function getTicketData($ticket, $valueKey, $defaultValue)
93 126 {