← All changes
|
app/Services/Integrations/FluentForm/FeedIntegration.php
+16
-14
1.10.0
→
2.4.5
View file →
| @@ -161,9 +161,9 @@ | ||
| 161 | 161 | ], |
| 162 | 162 | $this->getCustomField(), //Getting Fluent Support Custom Field To Map |
| 163 | 163 | [ |
| 164 | 164 | 'component' => 'html_info', |
| 165 | - 'html_info' => __('<h4>Please provide the ticket provider info. If user is logged in then it will use that info. For Public users you can set your customer info</h4>', 'fluent-support') | |
| 165 | + 'html_info' => '<h4>' . __('Please provide the ticket provider info. If user is logged in then it will use that info. For Public users you can set your customer info', 'fluent-support') . '</h4>' | |
| 166 | 166 | ], |
| 167 | 167 | [ |
| 168 | 168 | 'key' => 'CustomerFields', |
| 169 | 169 | 'require_list' => false, |
| @@ -192,9 +192,9 @@ | ||
| 192 | 192 | [ |
| 193 | 193 | 'key' => 'customer_other_fields', |
| 194 | 194 | 'require_list' => false, |
| 195 | 195 | 'label' => __('Customer Other Fields', 'fluent-support'), |
| 196 | - 'tips' => __('Select which Fluent Forms fields pair with their<br /> respective Fluent Support fields.'), | |
| 196 | + 'tips' => __('Select which Fluent Forms fields pair with their<br /> respective Fluent Support fields.', 'fluent-support'), | |
| 197 | 197 | 'field_label_remote' => __('Fluent Support Field', 'fluent-support'), |
| 198 | 198 | 'field_label_local' => __('Form Field', 'fluent-support'), |
| 199 | 199 | 'component' => 'dropdown_many_fields', |
| 200 | 200 | 'options' => $fieldOptions |
| @@ -245,9 +245,9 @@ | ||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | $fields[] = [ |
| 248 | 248 | 'key' => $customFieldValue['slug'], |
| 249 | - 'label' => __($customFieldValue['label'], 'fluent-support') | |
| 249 | + 'label' => $customFieldValue['label'] | |
| 250 | 250 | ]; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | $fields = array_map('array_filter', $fields); |
| @@ -292,9 +292,10 @@ | ||
| 292 | 292 | continue; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | if( $type=='checkbox' && array_key_exists($slug, $ticketCustomField)) { |
| 296 | - $ticketCustomField[$slug] = explode(',', Arr::get($ticketCustomField, $slug)); | |
| 296 | + $value = Arr::get($ticketCustomField, $slug, ''); | |
| 297 | + $ticketCustomField[$slug] = $value ? explode(',', (string)$value) : []; | |
| 297 | 298 | } else { |
| 298 | 299 | $ticketCustomField[$slug] = Arr::get($ticketCustomField, $slug); |
| 299 | 300 | } |
| 300 | 301 | } |
| @@ -301,13 +302,14 @@ | ||
| 301 | 302 | |
| 302 | 303 | $ticketData = [ |
| 303 | 304 | 'product_source' => 'local', |
| 304 | 305 | 'mailbox_id' => Arr::get($data, 'list_id'), |
| 305 | - 'title' => sanitize_text_field(wp_unslash(Arr::get($data, 'ticket_title'))), | |
| 306 | - 'content' => wp_unslash(wp_kses_post(Arr::get($data, 'ticket_content'))), | |
| 306 | + // Feed settings and entry values are stored unslashed, so sanitize only. | |
| 307 | + 'title' => sanitize_text_field(Arr::get($data, 'ticket_title')), | |
| 308 | + 'content' => wp_kses_post(Arr::get($data, 'ticket_content')), | |
| 307 | 309 | 'attachments' => sanitize_text_field(Arr::get($data, 'ticket_attachments')), |
| 308 | - 'client_priority' => strtolower(sanitize_text_field(Arr::get($data, 'client_priority'))), | |
| 309 | - 'priority' => strtolower(sanitize_text_field(Arr::get($data, 'client_priority'))), | |
| 310 | + 'client_priority' => strtolower(sanitize_text_field(Arr::get($data, 'client_priority', ''))), | |
| 311 | + 'priority' => strtolower(sanitize_text_field(Arr::get($data, 'client_priority', ''))), | |
| 310 | 312 | 'custom_fields' => $ticketCustomField, |
| 311 | 313 | 'source' => 'web' |
| 312 | 314 | ]; |
| 313 | 315 | |
| @@ -390,9 +392,10 @@ | ||
| 390 | 392 | |
| 391 | 393 | do_action('fluentform/log_data', [ |
| 392 | 394 | 'title' => $feed['settings']['name'], |
| 393 | 395 | 'status' => 'success', |
| 394 | - 'description' => __('Support ticket has been created at Fluent Support. Ticket ID: '.$ticket->id, 'fluent-support'), | |
| 396 | + // translators: %d is the ticket ID number | |
| 397 | + 'description' => sprintf(__('Support ticket has been created at Fluent Support. Ticket ID: %d', 'fluent-support'), $ticket->id), | |
| 395 | 398 | 'parent_source_id' => $form->id, |
| 396 | 399 | 'source_id' => $entry->id, |
| 397 | 400 | 'component' => $this->integrationKey, |
| 398 | 401 | 'source_type' => 'submission_item' |
| @@ -449,13 +452,12 @@ | ||
| 449 | 452 | 'is_media_library' => $isMediaLibrary, |
| 450 | 453 | 'attachment_id' => $attachmentId |
| 451 | 454 | ]); |
| 452 | 455 | } catch (\Exception $e) { |
| 453 | - error_log("Failed to create attachment record: " . $e->getMessage()); | |
| 456 | + | |
| 454 | 457 | } |
| 455 | 458 | } |
| 456 | 459 | } catch (\Exception $e) { |
| 457 | - error_log("Error processing attachment: " . $e->getMessage()); | |
| 458 | 460 | continue; |
| 459 | 461 | } |
| 460 | 462 | } |
| 461 | 463 | |
| @@ -479,12 +481,12 @@ | ||
| 479 | 481 | private function isBlockedCustomer($customerEmail) |
| 480 | 482 | { |
| 481 | 483 | $customer = Customer::where('email', $customerEmail)->first(); |
| 482 | 484 | |
| 483 | - if('inactive' == $customer->status || !$customer->status) { | |
| 484 | - return true; | |
| 485 | + if (!$customer) { | |
| 486 | + return false; | |
| 485 | 487 | } |
| 486 | 488 | |
| 487 | - return false; | |
| 489 | + return $customer->isBlocked(); | |
| 488 | 490 | } |
| 489 | 491 | |
| 490 | 492 | } |