| @@ -241,10 +241,23 @@ | ||
| 241 | 241 | |
| 242 | 242 | return $data; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | + /** Store full custom-field messages in LONGTEXT while keeping legacy VARCHAR columns bounded. */ | |
| 245 | 246 | public static function createActivity($data) |
| 246 | 247 | { |
| 248 | + if (!empty($data['settings']['custom_field_id'])) { | |
| 249 | + $payload = []; | |
| 250 | + foreach (['column', 'old_value', 'new_value', 'description'] as $key) { | |
| 251 | + $payload[$key] = $data[$key] ?? null; | |
| 252 | + } | |
| 253 | + $data['settings']['custom_field_activity_payload'] = true; | |
| 254 | + $data['description'] = wp_json_encode($payload); | |
| 255 | + $data['column'] = Constant::ACTIVITY_CUSTOM_FIELD; | |
| 256 | + $data['old_value'] = null; | |
| 257 | + $data['new_value'] = null; | |
| 258 | + } | |
| 259 | + | |
| 247 | 260 | return Activity::create($data); |
| 248 | 261 | } |
| 249 | 262 | |
| 250 | 263 | public static function sanitizeTaskMeta($data) |
| @@ -335,8 +348,9 @@ | ||
| 335 | 348 | } |
| 336 | 349 | return fluent_boards_page_url() . 'boards/' . $boardId; |
| 337 | 350 | } |
| 338 | 351 | |
| 352 | + /** Format a CRM contact, avoiding a database lookup for unassociated tasks. */ | |
| 339 | 353 | public static function crm_contact($id) |
| 340 | 354 | { |
| 341 | 355 | if (!defined('FLUENTCRM')) { |
| 342 | 356 | return ''; |
| @@ -341,8 +355,12 @@ | ||
| 341 | 355 | if (!defined('FLUENTCRM')) { |
| 342 | 356 | return ''; |
| 343 | 357 | } |
| 344 | 358 | |
| 359 | + if (!$id) { | |
| 360 | + return null; | |
| 361 | + } | |
| 362 | + | |
| 345 | 363 | $contact = \FluentCrm\App\Models\Subscriber::with(['tags', 'lists'])->find($id); |
| 346 | 364 | |
| 347 | 365 | if (!$contact) { |
| 348 | 366 | return null; |
| @@ -710,8 +728,9 @@ | ||
| 710 | 728 | 'moved' => __('moved', 'fluent-boards'), |
| 711 | 729 | ]; |
| 712 | 730 | |
| 713 | 731 | $columnTranslations = [ |
| 732 | + Constant::ACTIVITY_CUSTOM_FIELD => __('custom field', 'fluent-boards'), | |
| 714 | 733 | 'task' => __('task', 'fluent-boards'), |
| 715 | 734 | 'description' => __('description', 'fluent-boards'), |
| 716 | 735 | 'board' => __('board', 'fluent-boards'), |
| 717 | 736 | 'assignee' => __('assignee', 'fluent-boards'), |