Skip to content

Commit

Permalink
Merge pull request #4154 from ProcessMaker/bugfix/FOUR-4464
Browse files Browse the repository at this point in the history
Bugfix/FOUR-4464: Fixed datasource ID assignment on import process (FOR 4.1)
  • Loading branch information
marcoAntonioNina committed Nov 16, 2021
2 parents 681a37a + abda14d commit 62bc453
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ProcessMaker/Http/Controllers/Api/ProcessController.php
Expand Up @@ -296,7 +296,7 @@ public function update(Request $request, Process $process)
if ($request->has('task_notifications')) {
$this->saveTaskNotifications($process, $request);
}

// Catch errors to send more specific status
try {
$process->saveOrFail();
Expand Down Expand Up @@ -551,7 +551,7 @@ public function startProcesses(Request $request)
->filter(function ($eventDefinition) {
return $eventDefinition['$type'] == 'timerEventDefinition';
})->count() > 0;

// Filter out web entry start events
$eventIsWebEntry = false;
if (isset($event['config'])) {
Expand Down Expand Up @@ -851,6 +851,7 @@ public function import_ready($code)
*/
public function importAssignments(Process $process, Request $request)
{

//If we are specifying assignments...
if ($request->has('assignable')) {
$assignable = $request->input('assignable');
Expand Down Expand Up @@ -919,6 +920,9 @@ public function importAssignments(Process $process, Request $request)
$watcherIndex = intval($parts[1]);
$screen = Screen::findOrFail($screenId);
$watchers = $screen->watchers;
$scriptConfiguration = json_decode($watchers[$watcherIndex]['script_configuration'], true);
$scriptConfiguration['dataSource'] = strval($watcherDataSource['value']['id']);
$watchers[$watcherIndex]['script_configuration'] = json_encode($scriptConfiguration);
$watchers[$watcherIndex]['script_id'] = $watcherDataSource['value']['id'];
$watchers[$watcherIndex]['script'] = $watcherDataSource['value'];
$watchers[$watcherIndex]['script']['id'] = 'data_source-' . strval($watcherDataSource['value']['id']);
Expand Down

0 comments on commit 62bc453

Please sign in to comment.