From f5e66bf95126443293a13c3b27aefac2815a0c0a Mon Sep 17 00:00:00 2001 From: adonis Date: Mon, 24 Aug 2026 21:51:57 +0330 Subject: [PATCH] =?UTF-8?q?fix(automations):=20replace=20%=D9=86=D8=A7?= =?UTF-8?q?=D9=85=5F=DA=A9=D9=88=DA=86=DA=A9=20before=20generic=20%=D9=86?= =?UTF-8?q?=D8=A7=D9=85=20in=20SMS=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The name placeholder regex was matching the prefix of %نام_کوچک first, leaving _کوچک in the rendered message. Co-authored-by: Cursor --- app/Services/Automation/AutomationSender.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Services/Automation/AutomationSender.php b/app/Services/Automation/AutomationSender.php index 2b7f450..1efbb8b 100644 --- a/app/Services/Automation/AutomationSender.php +++ b/app/Services/Automation/AutomationSender.php @@ -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;