fix(automations): replace %نام_کوچک before generic %نام in SMS templates

The name placeholder regex was matching the prefix of %نام_کوچک first, leaving _کوچک in the rendered message.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 21:51:57 +03:30
co-authored by Cursor
parent 995f6984ed
commit f5e66bf951
+2 -1
View File
@@ -142,8 +142,9 @@ class AutomationSender
]);
// الگوی پیامک/تنظیمات: %نام ، ٪نام ، % name ، %name%
$out = preg_replace('/[%٪]\s*(?:name|نام)[%٪]?/iu', $name, $out) ?? $out;
// نام_کوچک قبل از نام — وگرنه %نام داخل %نام_کوچک زودتر match می‌شود
$out = preg_replace('/[%٪]\s*(?:fname|نام_کوچک|نام‌کوچک)[%٪]?/iu', $fname, $out) ?? $out;
$out = preg_replace('/[%٪]\s*(?:name|نام)(?![_‌]?کوچک)[%٪]?/iu', $name, $out) ?? $out;
$out = preg_replace('/[%٪]\s*(?:mobile|موبایل)[%٪]?/iu', $mobile, $out) ?? $out;
return $out;