|
11 | 11 | use ProcessMaker\Models\User; |
12 | 12 | use ProcessMaker\Models\Process; |
13 | 13 | use ProcessMaker\Models\ProcessCategory; |
| 14 | +use ProcessMaker\Models\ProcessNotificationSetting; |
14 | 15 | use ProcessMaker\Models\Screen; |
15 | 16 | use ProcessMaker\Models\Script; |
16 | 17 | use Illuminate\Queue\SerializesModels; |
@@ -356,6 +357,33 @@ private function saveProcess($process) |
356 | 357 | $new->created_at = $this->formatDate($process->created_at); |
357 | 358 | $new->deleted_at = $this->formatDate($process->deleted_at); |
358 | 359 | $new->save(); |
| 360 | + |
| 361 | + foreach ($process->notifications as $notifiable => $notificationTypes) { |
| 362 | + foreach ($notificationTypes as $notificationType => $wanted) { |
| 363 | + if ($wanted === true) { |
| 364 | + $newNotification = new ProcessNotificationSetting; |
| 365 | + $newNotification->process_id = $new->id; |
| 366 | + $newNotification->notifiable_type = $notifiable; |
| 367 | + $newNotification->notification_type = $notificationType; |
| 368 | + $newNotification->save(); |
| 369 | + } |
| 370 | + } |
| 371 | + } |
| 372 | + |
| 373 | + foreach ($process->task_notifications as $elementId => $notifiables) { |
| 374 | + foreach ($notifiables as $notifiable => $notificationTypes) { |
| 375 | + foreach ($notificationTypes as $notificationType => $wanted) { |
| 376 | + if ($wanted === true) { |
| 377 | + $newNotification = new ProcessNotificationSetting; |
| 378 | + $newNotification->process_id = $new->id; |
| 379 | + $newNotification->element_id = $elementId; |
| 380 | + $newNotification->notifiable_type = $notifiable; |
| 381 | + $newNotification->notification_type = $notificationType; |
| 382 | + $newNotification->save(); |
| 383 | + } |
| 384 | + } |
| 385 | + } |
| 386 | + } |
359 | 387 |
|
360 | 388 | $this->definitions = $new->getDefinitions(); |
361 | 389 | $this->new['process'] = $new; |
|
0 commit comments