Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/FOUR-4464: Fixed datasource ID assignment on import process (FOR 4.1) #4154

Merged
merged 3 commits into from Nov 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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