Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ProcessMaker/Http/Controllers/TaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function edit(ProcessRequestToken $task, string $preview = '')
$element = $task->getDefinition(true);
$screenFields = $screenVersion ? $screenVersion->screenFilteredFields() : [];
$taskDraftsEnabled = TaskDraft::draftsEnabled();

$isSmartExtractTask = $task->element_name === 'Manual Document Review';
// Remove screen parent to reduce the size of the response
$screen = $task->screen;
$screen['parent'] = null;
Expand Down Expand Up @@ -204,6 +204,7 @@ public function edit(ProcessRequestToken $task, string $preview = '')
'screenFields' => $screenFields,
'taskDraftsEnabled' => $taskDraftsEnabled,
'userConfiguration' => $userConfiguration,
'hitlEnabled' => config('smart-extract.hitl_enabled', false) && $isSmartExtractTask,
]);
}
}
Expand Down
26 changes: 25 additions & 1 deletion ProcessMaker/Http/Resources/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public function toArray($request)

$this->addAssignableUsers($array, $include);

$this->mergeHitlCaseNumber($array);

return $array;
}

Expand Down Expand Up @@ -114,6 +116,28 @@ private function addAssignableUsers(&$array, $include)
}
}

private function mergeHitlCaseNumber(array &$array): void
{
if (!config('smart-extract.hitl_enabled')) {
return;
}

if (!empty(data_get($array, 'process_request.case_number'))) {
return;
}

$this->processRequest->loadMissing('parentRequest');
$parentCaseNumber = $this->processRequest->parentRequest?->case_number;
if (!$parentCaseNumber) {
return;
}

data_set($array, 'process_request.case_number', $parentCaseNumber);
if (empty($array['case_number'])) {
$array['case_number'] = $parentCaseNumber;
}
}

/**
* Add the active users to the list of assigned users
*
Expand All @@ -131,7 +155,7 @@ private function addActiveAssignedUsers(array $users, array $assignedUsers)
->whereNotIn('status', Process::NOT_ASSIGNABLE_USER_STATUS)
->whereIn('id', $chunk)
->pluck('id')->toArray();
$assignedUsers = array_merge($assignedUsers,$activeUsers);
$assignedUsers = array_merge($assignedUsers, $activeUsers);
}

return $assignedUsers;
Expand Down
2 changes: 2 additions & 0 deletions ProcessMaker/ScriptRunners/ScriptMicroserviceRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ private function getEnvironmentVariables(User $user)
$variablesParameter['API_HOST'] = config('app.docker_host_url') . '/api/1.0';
$variablesParameter['APP_URL'] = config('app.docker_host_url');
$variablesParameter['API_SSL_VERIFY'] = (config('app.api_ssl_verify') ? '1' : '0');
$variablesParameter['SMART_EXTRACT_API_HOST'] = config('app.smart_extract_api_host');
$variablesParameter['SMART_EXTRACT_PM_API_TOKEN'] = config('app.smart_extract_api_token');
}

return $variablesParameter;
Expand Down
17 changes: 15 additions & 2 deletions ProcessMaker/Traits/TaskControllerIndexMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ private function excludeNonVisibleTasks($query, $request)
{
$nonSystem = filter_var($request->input('non_system'), FILTER_VALIDATE_BOOLEAN);
$allTasks = filter_var($request->input('all_tasks'), FILTER_VALIDATE_BOOLEAN);
$hitlEnabled = filter_var(config('smart-extract.hitl_enabled'), FILTER_VALIDATE_BOOLEAN);
$query->when(!$allTasks, function ($query) {
$query->where(function ($query) {
$query->where('element_type', '=', 'task');
Expand All @@ -163,8 +164,20 @@ private function excludeNonVisibleTasks($query, $request)
});
});
})
->when($nonSystem, function ($query) {
$query->nonSystem();
->when($nonSystem, function ($query) use ($hitlEnabled) {
if (!$hitlEnabled) {
$query->nonSystem();

return;
}

$query->where(function ($query) {
$query->nonSystem();
$query->orWhere(function ($query) {
$query->where('element_type', '=', 'task');
$query->where('element_name', '=', 'Manual Document Review');
});
});
});
}

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
"package-rpa": "1.1.1",
"package-savedsearch": "1.43.4",
"package-slideshow": "1.4.3",
"package-smart-extract": "dev-develop",
"package-signature": "1.15.2",
"package-testing": "1.8.1",
"package-translations": "2.14.4",
Expand Down
3 changes: 3 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,7 @@
'multitenancy' => env('MULTITENANCY', false),

'resources_core_path' => base_path('resources-core'),

'smart_extract_api_host' => env('SMART_EXTRACT_API_HOST', 'extract-api.processmaker.net'),
'smart_extract_api_token' => env('SMART_EXTRACT_PM_API_TOKEN', ''),
];
2 changes: 1 addition & 1 deletion resources/js/tasks/components/TasksList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ export default {
return `
<a href="${this.openTask(record, 1)}"
class="text-nowrap">
# ${processRequest.case_number || record.case_number}
# ${processRequest.case_number || record.case_number || ""}
</a>`;
},
formatCaseTitle(processRequest, record) {
Expand Down
1 change: 1 addition & 0 deletions resources/views/layouts/layoutnext.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class="main flex-grow-1 h-100
@endif

@yield('js')
@stack('scripts')

@isset($addons)
@foreach ($addons as $addon)
Expand Down
42 changes: 23 additions & 19 deletions resources/views/tasks/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,29 @@ class="nav-link">
<div id="tabContent" class="tab-content tw-flex tw-flex-col tw-grow tw-overflow-y-scroll">
<div id="tab-form" role="tabpanel" aria-labelledby="tab-form" class="tab-pane active show">
@can('update', $task)
<task
ref="task"
class="card border-0"
v-model="formData"
:initial-task-id="{{ $task->id }}"
:initial-request-id="{{ $task->process_request_id }}"
:screen-version="{{ $task->screen['id'] ?? null }}"
:user-id="{{ Auth::user()->id }}"
csrf-token="{{ csrf_token() }}"
initial-loop-context="{{ $task->getLoopContext() }}"
:wait-loading-listeners="true"
@task-updated="taskUpdated"
@updated-page-core="updatePage"
@submit="submit"
@completed="completed"
@@error="error"
@closed="closed"
@redirect="redirectToTask"
@form-data-changed="handleFormDataChange" />
@unless($hitlEnabled)
<task
ref="task"
class="card border-0"
v-model="formData"
:initial-task-id="{{ $task->id }}"
:initial-request-id="{{ $task->process_request_id }}"
:screen-version="{{ $task->screen['id'] ?? null }}"
:user-id="{{ Auth::user()->id }}"
csrf-token="{{ csrf_token() }}"
initial-loop-context="{{ $task->getLoopContext() }}"
:wait-loading-listeners="true"
@task-updated="taskUpdated"
@updated-page-core="updatePage"
@submit="submit"
@completed="completed"
@@error="error"
@closed="closed"
@redirect="redirectToTask"
@form-data-changed="handleFormDataChange" />
@else
@include('tasks.partials.hitl-iframe')
@endunless
@endcan
<div v-if="taskHasComments">
<timeline :commentable_id="task.id"
Expand Down
22 changes: 22 additions & 0 deletions resources/views/tasks/partials/hitl-iframe.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{-- Smart Extract Manual Edit content when HITL is enabled --}}
@php
// Note: This URL will be obtained from request data in future implementation.
$iframeSrc = null
@endphp

@if (!empty($iframeSrc))
<div
id="manual-edit-iframe-container"
style="position: relative; width: 100%; height: calc(100vh - 200px); border: none; margin: 0; padding: 0;"
>
<x-package-smart-extract::iframe-loader
:src="$iframeSrc"
:title="__('Smart Extract')"
loading-message="{{ __('Loading dashboard') }}"
/>
</div>
@else
<div class="alert alert-warning">
{{ __('No iframe source provided for Manual Edit.') }}
</div>
@endif
Loading