Skip to content

Commit e4ef181

Browse files
committed
fix: remove unnecessary logging from sendPayload and parsePhoneFieldVariables methods
1 parent eb3938f commit e4ef181

1 file changed

Lines changed: 0 additions & 27 deletions

File tree

  • src/integrations/miscellaneous

src/integrations/miscellaneous/Sms.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -161,22 +161,15 @@ public function defineRules(): array
161161
*/
162162
public function sendPayload(Submission $submission): bool
163163
{
164-
Craft::info('sendPayload called for submission: ' . $submission->id, __METHOD__);
165-
166164
// Check if SMS Manager is installed
167165
if (!$this->isSmsManagerInstalled()) {
168166
Integration::error($this, Craft::t('formie-sms', 'SMS Manager plugin is not installed.'));
169-
Craft::error('SMS Manager plugin is not installed', __METHOD__);
170167
return false;
171168
}
172169

173-
Craft::info('SMS Manager is installed', __METHOD__);
174-
175170
// Get the submission's site language
176171
$originLanguage = $submission->getSite()->getLocale()->getLanguageID();
177172

178-
Craft::info("Language check - Origin: '{$originLanguage}', Filter: '{$this->language}'", __METHOD__);
179-
180173
// Check language filter
181174
if ($this->language !== 'any' && $originLanguage !== $this->language) {
182175
Craft::warning(
@@ -186,31 +179,22 @@ public function sendPayload(Submission $submission): bool
186179
return true; // Return true as this is expected behavior, not an error
187180
}
188181

189-
Craft::info('Language check passed', __METHOD__);
190-
191182
// Parse recipients
192183
$recipientsRaw = $this->renderMessage($this->recipients, $submission);
193184
$recipients = array_map('trim', explode(',', $recipientsRaw));
194185

195-
Craft::info('Parsed recipients: ' . json_encode($recipients), __METHOD__);
196-
197186
// Parse message
198187
$message = $this->renderMessage($this->message, $submission);
199188

200-
Craft::info('Parsed message: ' . substr($message, 0, 100), __METHOD__);
201-
202189
// Get the SMS service from SMS Manager
203190
$smsService = SmsManager::$plugin->sms;
204191

205192
// Send SMS to each recipient
206193
foreach ($recipients as $recipient) {
207194
if (empty($recipient)) {
208-
Craft::info('Skipping empty recipient', __METHOD__);
209195
continue;
210196
}
211197

212-
Craft::info("Attempting to send SMS to: {$recipient}", __METHOD__);
213-
214198
try {
215199
$result = $smsService->send(
216200
$recipient,
@@ -222,22 +206,17 @@ public function sendPayload(Submission $submission): bool
222206
$submission->id
223207
);
224208

225-
Craft::info("SMS send result for {$recipient}: " . ($result ? 'success' : 'failed'), __METHOD__);
226-
227209
if (!$result) {
228210
Integration::error($this, Craft::t('formie-sms', 'Failed to send SMS to {recipient}', [
229211
'recipient' => $recipient,
230212
]));
231213
}
232214
} catch (\Throwable $e) {
233-
Craft::error("SMS send exception: " . $e->getMessage(), __METHOD__);
234215
$exception = $e instanceof \Exception ? $e : new \Exception($e->getMessage(), (int) $e->getCode(), $e);
235216
Integration::apiError($this, $exception);
236217
}
237218
}
238219

239-
Craft::info('sendPayload completed', __METHOD__);
240-
241220
return true;
242221
}
243222

@@ -271,8 +250,6 @@ private function renderMessage(string $template, Submission $submission): string
271250
*/
272251
private function parsePhoneFieldVariables(string $template, Submission $submission): string
273252
{
274-
Craft::info('parsePhoneFieldVariables input: ' . substr($template, 0, 500), __METHOD__);
275-
276253
// Match phone field variable patterns in the rich text JSON
277254
// Pattern: "value":"{field.HANDLE.PROPERTY}" or "{field:HANDLE.PROPERTY}"
278255
// Different Formie versions use different separators (dot vs colon)
@@ -282,13 +259,9 @@ function($matches) use ($submission) {
282259
$fieldHandle = $matches[1];
283260
$property = $matches[2];
284261

285-
Craft::info("Phone field match: handle={$fieldHandle}, property={$property}", __METHOD__);
286-
287262
// Get the field value from submission
288263
$value = $submission->getFieldValue($fieldHandle);
289264

290-
Craft::info("Phone field value type: " . gettype($value) . ", value: " . json_encode($value), __METHOD__);
291-
292265
if ($value === null) {
293266
Craft::warning("Phone field '{$fieldHandle}' not found in submission", __METHOD__);
294267
return '';

0 commit comments

Comments
 (0)