-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathnotification.php
More file actions
779 lines (675 loc) · 21.6 KB
/
notification.php
File metadata and controls
779 lines (675 loc) · 21.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
<?php
/**
* @package Tjnotifications
* @subpackage com_tjnotifications
*
* @copyright Copyright (C) 2009 - 2020 Techjoomla. All rights reserved.
* @license http:/www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Date\Date;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Component\ComponentHelper;
BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/models');
require_once JPATH_ADMINISTRATOR . '/components/com_tjnotifications/defines.php';
/**
* notification model.
*
* @since 1.6
*/
class TjnotificationsModelNotification extends AdminModel
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @since 3.2
*/
public function __construct($config = array())
{
$config['event_after_save'] = 'tjnOnAfterSaveNotificationTemplate';
parent::__construct($config);
}
/**
* Returns a reference to the a Table object, always creating it.
*
* @param string $type The table type to instantiate
* @param string $prefix A prefix for the table class name. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JTable|boolean
*
* @since 1.6
*/
public function getTable($type='Notification',$prefix='tjnotificationTable',$config=array())
{
// Get the table.
return Table::getInstance($type, $prefix, $config);
}
/**
* Method to get the record form.
*
* @param array $data An optional array of data for the form to interogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return JForm A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm(
'com_tjnotifications.notification',
'notification',
array
(
'control' => 'jform',
'load_data' => $loadData
)
);
if (empty($form))
{
return false;
}
return $form;
}
/**
* Batch copy items to a new category or current.
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
* @since 1.0
*/
protected function loadFormData()
{
$extension = Factory::getApplication()->input->getCmd('extension', '');
$parts = explode('.', $extension);
// Extract the component name
$this->setState('filter.component', $parts[0]);
// Extract the optional section name
$this->setState('filter.section', (count($parts) > 1) ? $parts[1] : null);
// Check the session for previously entered form data.
$data = Factory::getApplication()->getUserState(
'com_tjnotifications.edit.tjnotifications.data',
array()
);
if (empty($data))
{
$data = $this->getItem();
}
return $data;
}
/**
* Method to create notifications templates.
*
* @param array $templates An array of data for the notifications templates.
*
* @return Boolean true or false
*
* @since 1.6
*/
public function createTemplates($templates)
{
$data = $templates;
$date = new Date;
if (empty($data['created_on']))
{
$data['created_on'] = $date->format(Text::_('DATE_FORMAT_FILTER_DATETIME'));
}
// To save data of replacement tags
if (!empty($data['replacement_tags']))
{
$data['replacement_tags'] = json_encode($data['replacement_tags']);
}
if (!empty($data))
{
$this->save($data);
return true;
}
else
{
return false;
}
}
/**
* Method to delete notification template
*
* @param array &$cid An array of record primary keys.
*
* @return void
*
* @since 1.0
*/
public function delete(&$cid)
{
$db = Factory::getDbo();
$value = array();
$model = AdminModel::getInstance('Notification', 'TJNotificationsModel');
$user = Factory::getUser();
if (empty($user->authorise('core.delete', 'com_tjnotifications')))
{
throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}
foreach ($cid as $id)
{
$data = $model->getItem($id);
if ($data->core == 0)
{
$deleteQuery = $db->getQuery(true);
$conditions = array(
$db->qn('template_id') . '=' . (int) $id
);
$deleteQuery->delete($db->quoteName('#__tj_notification_template_configs'));
$deleteQuery->where($conditions);
$db->setQuery($deleteQuery);
$db->execute();
$deleteQuery = $db->getQuery(true);
$conditions = array(
$db->quoteName('client') . ' = ' . $db->quote($data->client),
$db->quoteName('key') . ' = ' . $db->quote($data->key)
);
$deleteQuery->delete($db->quoteName('#__tj_notification_user_exclusions'));
$deleteQuery->where($conditions);
$db->setQuery($deleteQuery);
$result = $db->execute();
if ($result)
{
$value[] = 1;
parent::delete($data->id);
PluginHelper::importPlugin('tjnotification');
Factory::getApplication()->triggerEvent('onAfterTjnDeleteNotificationTemplate', array($data));
}
}
else
{
$value[] = 0;
}
}
return $value;
}
/**
* Method to get existing keys
*
* @param string $client client.
*
* @return array
*
* @since 1.0
*/
public function getKeys($client)
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('key'));
$query->from($db->quoteName('#__tj_notification_templates'));
$query->where($db->quoteName('client') . ' = ' . $db->quote($client));
$db->setQuery($query);
return $db->loadColumn();
}
/**
* Method to get tag replacement count
*
* @param string $key Template key.
* @param string $client client.
*
* @return integer replacement tags count
*
* @since 1.0.4
*/
public function getReplacementTagsCount($key, $client)
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('replacement_tags'));
$query->from($db->quoteName('#__tj_notification_templates'));
$query->where($db->quoteName('client') . ' = ' . $db->quote($client));
$query->where($db->quoteName('key') . ' = ' . $db->quote($key));
$db->setQuery($query);
$replacementTags = $db->loadResult();
return count((array) json_decode($replacementTags));
}
/**
* Method to replace tags if they are changed
*
* @param array $data template data
*
* @return void
*
* @since 1.0.4
*/
public function updateReplacementTags($data)
{
if (!empty($data['replacement_tags']))
{
$replacementTags = json_encode($data['replacement_tags']);
}
else
{
return;
}
$db = Factory::getDbo();
$query = $db->getQuery(true);
// Fields to update.
$fields = array(
$db->quoteName('replacement_tags') . ' = ' . $db->quote($replacementTags)
);
// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('client') . ' = ' . $db->quote($data['client']),
$db->quoteName('key') . ' = ' . $db->quote($data['key'])
);
$query->update($db->quoteName('#__tj_notification_templates'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
}
/**
* Method to save notification data
*
* @param ARRAY $data notification data
*
* @return mixed Template ID
*
* @since 1.0.0
*/
public function save($data)
{
$isNew = true;
// 1 - save template first
if (!empty($data))
{
$date = Factory::getDate();
if ($data['id'])
{
$data['updated_on'] = $date->toSql(true);
}
else
{
$data['created_on'] = $date->toSql(true);
}
if (!empty($data['replacement_tags']))
{
$data['replacement_tags'] = json_encode($data['replacement_tags']);
}
}
if (!parent::save($data))
{
return false;
}
else
{
$db = Factory::getDbo();
// IMPORTANT to set new id in state, it is fetched in controller later
// Get current Template id - Fix for existing records
if (!empty($data['id']))
{
$templateId = $data['id'];
$isNew = false;
}
else
{
$templateId = $db->insertid();
}
$this->setState('com_tjnotifications.edit.notification.id', $templateId);
$this->setState('com_tjnotifications.edit.notification.new', $isNew);
}
if (empty($templateId))
{
$this->setError(Text::_('COM_TJNOTIFICATIONS_ERROR_TEMPLATE_ID_MISSING'));
return false;
}
// Get DB
$db = Factory::getDbo();
// Get global configs
$notificationsParams = ComponentHelper::getParams('com_tjnotifications');
$webhookUrls = $notificationsParams->get('webhook_url');
$webhookUrls = array_column((array) $webhookUrls, 'url');
// 2 - save backend specific config
$backendsArray = explode(',', TJNOTIFICATIONS_CONST_BACKENDS_ARRAY);
foreach ($backendsArray as $keyBackend => $backend)
{
// 2.1 Check if current backend exists in posted data
// If not $data['email'] or $data['sms']
if (empty($data[$backend]) || !isset($data[$backend][$backend . 'fields']))
{
continue;
}
// Validate backend data structure
if (!is_array($data[$backend][$backend . 'fields']))
{
continue;
}
// Eg: Get count of $data['email']['emailfields'] or $data['sms']['smsfields']
if (count($data[$backend][$backend . 'fields']) == 0)
{
continue;
}
$idsToBeDeleted = array();
$idsToBeStored = array();
// For current template, get existing lang. sepcific template for current backend
$existingBackendConfigs = $this->getExistingTemplates($data['id'], $backend);
// 2.2 Find existing template config entries to be deleted (i.e. language specific templates removed by user)
foreach ($data[$backend][$backend . 'fields'] as $backendName => $backendFieldValues)
{
// Webhook stuff starts here
if ($backend == 'webhook' && $data[$backend]['state'])
{
// If not using global webhook URLs & custom webhooks URLs are also empty
if (empty($backendFieldValues['use_global_webhook_url']) && empty($backendFieldValues['webhook_url']))
{
$this->setError(Text::_('COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_CUSTOM_WEBHOOK_URLS'));
return false;
}
// If using global webhook URL & the global URLs are empty
elseif ($backendFieldValues['use_global_webhook_url'] && empty($webhookUrls[0]))
{
$this->setError(Text::_('COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_GLOBAL_WEBHOOK_URLS'));
return false;
}
}
// Webhook stuff ends here
// Iterate through each lang. specific config entry
foreach ($existingBackendConfigs as $existingBackendConfig)
{
$existingBackendConfigId = json_decode(json_encode($existingBackendConfig->id), true);
$existingBackendConfigTempId = json_decode(json_encode($existingBackendConfig->template_id), true);
$existingBackendConfigLang = json_decode(json_encode($existingBackendConfig->language), true);
// If there is existing template then return to form view.
if ($existingBackendConfigLang == $backendFieldValues['language']
&& $existingBackendConfigTempId == $templateId
&& $existingBackendConfigId != $backendFieldValues['id'])
{
$this->setError(Text::_('COM_TJNOTIFICATIONS_TEMPLATE_ERR_MSG_TEMPLATE_EXISTS'));
return false;
}
// Find to be deleted or saved
if (($existingBackendConfigId == $backendFieldValues['id'] || $existingBackendConfigLang == "*" )
|| $existingBackendConfigId == empty($backendFieldValues['id']))
{
$idsToBeStored[] = $backendFieldValues['id'];
}
else
{
$idsToBeDeleted[] = $existingBackendConfigId;
}
}
}
// Array of backend specific template configs id to be deleted
$backendConfigIdsToBeDeleted = array_diff($idsToBeDeleted, $idsToBeStored);
// Function call to delete template configs
$this->deleteBackendConfigs($backendConfigIdsToBeDeleted);
// 2.3 Common data for saving
$date = Factory::getDate();
$currentDateTime = $date->toSql(true);
// Always use current datetime for backend configs to avoid empty string issues
$createdOn = $currentDateTime;
$updatedOn = $currentDateTime;
// 2.4 try saving all backend specific configs
// This has repeatable data eg: $data['email']['emailfields'] or $data['sms']['smsfields']
foreach ($data[$backend][$backend . 'fields'] as $backendName => $backendFieldValues)
{
// Validate backend field values
if (!is_array($backendFieldValues) || empty($backendFieldValues))
{
continue;
}
$templateConfigTable = Table::getInstance('Template', 'TjnotificationTable', array('dbo', $db));
$isExistingRecord = $templateConfigTable->load(array('template_id' => $templateId, 'backend' => $backend));
// Non-repeat data
$templateConfigTable->template_id = $templateId;
$templateConfigTable->backend = $backend;
$templateConfigTable->state = $data[$backend]['state'];
// Set datetime fields with proper values
// For existing records, only update the updated_on field
if ($isExistingRecord && !empty($templateConfigTable->created_on))
{
$templateConfigTable->updated_on = $updatedOn;
// Keep existing created_on value
}
else
{
// For new records, set both created_on and updated_on
$templateConfigTable->created_on = $createdOn;
$templateConfigTable->updated_on = $updatedOn;
}
// Get params data
// State, emailfields / smsfields
$nonParamsFields = array('state', $backend . 'fields');
$params = array();
foreach ($data[$backend] as $fieldKey => $fieldValue)
{
if (!in_array($fieldKey, $nonParamsFields) && !empty($data[$backend][$fieldKey]))
{
$params[$fieldKey] = $data[$backend][$fieldKey];
}
}
$templateConfigTable->params = json_encode($params);
// Repeatable data
$templateConfigTable->subject = !empty($backendFieldValues['subject']) ? $backendFieldValues['subject']: '';
$templateConfigTable->body = $backendFieldValues['body'];
$templateConfigTable->language = $backendFieldValues['language'];
$templateConfigTable->is_override = 0;
// Webhook stuff starts here
// Add URLs for webhook
$templateConfigTable->webhook_url = !empty($backendFieldValues['webhook_url']) ? json_encode($backendFieldValues['webhook_url']): '';
$templateConfigTable->use_global_webhook_url = !empty($backendFieldValues['use_global_webhook_url']) ? $backendFieldValues['use_global_webhook_url']: 0;
// Webhook stuff ends here
if (!empty($backendFieldValues['provider_template_id']))
{
$templateConfigTable->provider_template_id = $backendFieldValues['provider_template_id'];
}
// Save backend in config table
try
{
if (empty($backendFieldValues['id']))
{
if (!$templateConfigTable->save($templateConfigTable))
{
$this->setError(Text::sprintf('COM_TJNOTIFICATIONS_ERROR_SAVE_BACKEND_CONFIG', $backend, $templateConfigTable->getError()));
return false;
}
}
else
{
$templateConfigTable->id = $backendFieldValues['id'];
if (!$templateConfigTable->save($templateConfigTable))
{
$this->setError(Text::sprintf('COM_TJNOTIFICATIONS_ERROR_SAVE_BACKEND_CONFIG', $backend, $templateConfigTable->getError()));
return false;
}
}
}
catch (Exception $e)
{
$this->setError(Text::sprintf('COM_TJNOTIFICATIONS_ERROR_SAVE_BACKEND_CONFIG', $backend, $e->getMessage()));
return false;
}
}
}
return true;
}
/**
* Method to get an object.
*
* @param integer $id The id of the object to get.
*
* @return mixed Object on success, false on failure.
*/
public function getItem($id = null)
{
$item = parent::getItem($id);
if (empty($item->id))
{
return $item;
}
$backendsArray = explode(',', TJNOTIFICATIONS_CONST_BACKENDS_ARRAY);
foreach ($backendsArray as $keyBackend => $backend)
{
$db = Factory::getDBO();
$backendConfigsQuery = $db->getQuery(true);
$backendConfigsQuery->select('ntc.*');
$backendConfigsQuery->where(
$db->qn('ntc.template_id') . '=' . (int) $item->id .
' AND ' . $db->quoteName('backend') . " = '" . $backend . "'"
);
$backendConfigsQuery->from($db->qn('#__tj_notification_template_configs', 'ntc'));
$db->setQuery($backendConfigsQuery);
$backendConfigsList = $db->loadObjectlist();
if (empty($backendConfigsList))
{
continue;
}
// We can get common config for current backend from any backend config for current template ID
$singleBackendRow = $backendConfigsList[0];
// Define non-params fields - state, emailfields / smsfields
$nonParamsFields = array('state', $backend . 'fields');
// Start setting backend specific data for edit
$item->$backend = array();
if (version_compare(phpversion(), '7.4.0', '<'))
{
$item->{$backend}['state'] = $singleBackendRow->state;
// Get params for current backend from any backend config for current template ID
$json = (array) json_decode($singleBackendRow->params);
foreach ($json as $fieldKey => $fieldValue)
{
if (!in_array($fieldKey, $nonParamsFields))
{
$item->{$backend}[$fieldKey] = $fieldValue;
}
}
// Last, set all config rows list as repeatable data
$item->{$backend}[$backend . 'fields'] = $backendConfigsList;
}
else
{
$item->$backend['state'] = $singleBackendRow->state;
// Get params for current backend from any backend config for current template ID
$json = (array) json_decode($singleBackendRow->params);
foreach ($json as $fieldKey => $fieldValue)
{
if (!in_array($fieldKey, $nonParamsFields))
{
$item->$backend[$fieldKey] = $fieldValue;
}
}
// Last, set all config rows list as repeatable data
$item->$backend[$backend . 'fields'] = $backendConfigsList;
}
}
return $item;
}
/**
* get notification templates of component
*
* @param integer $templateId Notification template ID
* @param string $backend Backend name
*
* @return array
*
* @since 2.1
*/
public function getExistingTemplates($templateId, $backend)
{
$db = Factory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select('`id`,`language`,`template_id`');
$query->from($db->quoteName('#__tj_notification_template_configs'));
$query->where(
$db->quoteName('template_id') . ' = ' . $db->quote($templateId) .
' AND ' . $db->quoteName('backend') . " = '" . $backend . "'"
);
$db->setQuery($query);
return $db->loadObjectList();
}
/**
* Method to delete templates if they are deleted from form view
*
* @param array $backendConfigIdsToBeDeleted template data
*
* @return void
*
* @since 1.0.4
*/
public function deleteBackendConfigs($backendConfigIdsToBeDeleted)
{
if (!empty($backendConfigIdsToBeDeleted))
{
foreach ($backendConfigIdsToBeDeleted as $entry)
{
$db = Factory::getDBO();
$deleteQuery = $db->getQuery(true);
$conditions = array(
$db->qn('id') . '=' . (int) $entry);
$deleteQuery->delete($db->quoteName('#__tj_notification_template_configs'));
$deleteQuery->where($conditions);
$db->setQuery($deleteQuery);
$db->execute();
}
}
}
/**
* Method to replace tags if they are changed
*
* @param array $template This is single template array of data
* @param string $client client like com_jgive
*
* @return void
*
* @since 2.0.1
*/
public function updateTemplates($template, $client)
{
Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables');
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('id', 'key')));
$query->from($db->quoteName('#__tj_notification_templates', 'temp'));
$query->order($db->quoteName('id') . ' ASC');
$query->where($db->quoteName('client') . ' = ' . $db->quote($client));
$query->where($db->quoteName('key') . ' = ' . $db->quote($template['key']));
$db->setQuery($query);
$templateKeyIdObj = $db->loadObject();
if (!empty($templateKeyIdObj))
{
$query = $db->getQuery(true);
$query->select('backend');
$query->from($db->quoteName('#__tj_notification_template_configs', 'con'));
$query->where($db->quoteName('con.template_id') . ' = ' . (int) $templateKeyIdObj->id);
$db->setQuery($query);
$existingBackends = $db->loadColumn();
$backendsArray = explode(',', TJNOTIFICATIONS_CONST_BACKENDS_ARRAY);
$remainTemplateBackends = array_values(array_diff($backendsArray, $existingBackends));
if (!empty($remainTemplateBackends))
{
foreach ($remainTemplateBackends as $key => $value)
{
if ($template['key'] == $templateKeyIdObj->key)
{
$db = Factory::getDBO();
$templateConfigTable = Table::getInstance('Template', 'TjnotificationTable', array('dbo', $db));
$templateConfigTable->template_id = $templateKeyIdObj->id;
$templateConfigTable->backend = $value;
$templateConfigTable->subject = (!empty($template[$value][$value . 'fields'][$value . 'fields0']['subject']))
? $template[$value][$value . 'fields'][$value . 'fields0']['subject'] : '';
$templateConfigTable->body = $template[$value][$value . 'fields'][$value . 'fields0']['body'];
$templateConfigTable->state = $template[$value]['state'];
$templateConfigTable->created_on = Factory::getDate('now')->toSQL();
$templateConfigTable->updated_on = '';
$templateConfigTable->is_override = 0;
$templateConfigTable->params = json_encode([]);
$templateConfigTable->save($templateConfigTable);
}
}
}
}
}
}