diff --git a/ProcessMaker/Http/Controllers/ProcessController.php b/ProcessMaker/Http/Controllers/ProcessController.php index 2d3f9264da..88b84fa293 100644 --- a/ProcessMaker/Http/Controllers/ProcessController.php +++ b/ProcessMaker/Http/Controllers/ProcessController.php @@ -250,7 +250,7 @@ public function triggerStartEventApi(Process $process, Request $request) $apiRequest = new ApiProcessController(); $response = $apiRequest->triggerStartEvent($process, $request); - return redirect('/requests/' . $response->id)->cookie('fromTriggerStartEvent', true, 1); + return redirect('/requests/' . $response->id . '?fromTriggerStartEvent='); } private function checkAuth() diff --git a/ProcessMaker/Http/Controllers/RequestController.php b/ProcessMaker/Http/Controllers/RequestController.php index f97c684602..8b0ffb0b8a 100644 --- a/ProcessMaker/Http/Controllers/RequestController.php +++ b/ProcessMaker/Http/Controllers/RequestController.php @@ -76,16 +76,22 @@ public function show(ProcessRequest $request, Media $mediaItems) $definition = $startEvent->getDefinition(); $allowInterstitial = false; if (isset($definition['allowInterstitial'])) { - $allowInterstitial = filter_var($definition['allowInterstitial'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + $allowInterstitial = filter_var( + $definition['allowInterstitial'], + FILTER_VALIDATE_BOOLEAN, + FILTER_NULL_ON_FAILURE + ); } - if ($allowInterstitial && $request->user_id == Auth::id() && request()->cookie('fromTriggerStartEvent')) { + if ($allowInterstitial && $request->user_id == Auth::id() && request()->has('fromTriggerStartEvent')) { $active = $request->tokens() ->where('user_id', Auth::id()) ->where('element_type', 'task') ->where('status', 'ACTIVE') ->orderBy('id')->first(); - return redirect(route('tasks.edit', ['task' => $active ? $active->getKey() : $startEvent->getKey()]))->withoutCookie('fromTriggerStartEvent'); + return redirect(route('tasks.edit', [ + 'task' => $active ? $active->getKey() : $startEvent->getKey() + ])); } } } diff --git a/ProcessMaker/Jobs/RefreshArtisanCaches.php b/ProcessMaker/Jobs/RefreshArtisanCaches.php index 719f3d8583..230767969e 100644 --- a/ProcessMaker/Jobs/RefreshArtisanCaches.php +++ b/ProcessMaker/Jobs/RefreshArtisanCaches.php @@ -40,6 +40,10 @@ public function handle() Artisan::call('config:cache', $options); } else { Artisan::call('queue:restart', $options); + + // We call this manually here since this job is dispatched + // automatically when the config *is* cached + RestartMessageConsumers::dispatchSync(); } } } diff --git a/ProcessMaker/Jobs/RestartMessageConsumers.php b/ProcessMaker/Jobs/RestartMessageConsumers.php new file mode 100644 index 0000000000..e71346d8d1 --- /dev/null +++ b/ProcessMaker/Jobs/RestartMessageConsumers.php @@ -0,0 +1,51 @@ + true, + ]); + + Log::info('Kafka Consumer(s) Restart Attempted', [ + 'exit_code' => $exitCode, + 'command_output' => Artisan::output(), + ]); + } +} diff --git a/ProcessMaker/Managers/ScreenBuilderManager.php b/ProcessMaker/Managers/ScreenBuilderManager.php index ebf8fc5597..54372b567a 100644 --- a/ProcessMaker/Managers/ScreenBuilderManager.php +++ b/ProcessMaker/Managers/ScreenBuilderManager.php @@ -2,8 +2,7 @@ namespace ProcessMaker\Managers; -use Illuminate\Support\Facades\Storage; -use ProcessMaker\Models\ScreenType; +use Illuminate\Foundation\PackageManifest; class ScreenBuilderManager { @@ -57,6 +56,11 @@ public function addPackageScripts($type = 'DISPLAY') $extensionsFile = 'screen-builder-' . strtolower($type) . '-components.js'; $directories = glob('vendor/processmaker/packages/*', GLOB_ONLYDIR); + $installed = app(PackageManifest::class)->list(); + $directories = array_values(array_filter($directories, function ($directory) use ($installed) { + $package = 'processmaker/' . basename($directory); + return in_array($package, $installed); + })); foreach ($directories as $directory) { $extensionsFullName = $directory . '/js/' . $extensionsFile; $files = glob($extensionsFullName); diff --git a/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php b/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php index dbd5ceb7c8..b5193cc38b 100644 --- a/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php +++ b/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php @@ -140,7 +140,6 @@ public function completeTask(Definitions $definitions, ExecutionInstanceInterfac // Get complementary information $version = $instance->process_version_id; $userId = $this->getCurrentUserId(); - $state = $this->serializeState($instance); // Dispatch complete task action $this->dispatchAction([ @@ -152,7 +151,7 @@ public function completeTask(Definitions $definitions, ExecutionInstanceInterfac 'element_id' => $token->element_id, 'data' => $data, ], - 'state' => $state, + 'collaboration_uuid' => $instance->collaboration_uuid, 'session' => [ 'user_id' => $userId, ], @@ -556,7 +555,7 @@ public function throwSignalEventRequest(ProcessRequest $request, $signalRef, arr /** * Retrieves IDs of all instances collaborating with the given instance. * - * This function compiles a list of IDs from execution instances associated + * This function compiles a list of IDs from execution instances associated * with the same process as the input instance, including the instance itself. * * @param ProcessRequest $instance The instance to find collaborators for. diff --git a/ProcessMaker/Providers/SettingServiceProvider.php b/ProcessMaker/Providers/SettingServiceProvider.php index 83381898e9..4fd761a5b9 100644 --- a/ProcessMaker/Providers/SettingServiceProvider.php +++ b/ProcessMaker/Providers/SettingServiceProvider.php @@ -7,6 +7,7 @@ use Illuminate\Support\ServiceProvider; use ProcessMaker\Events\MarkArtisanCachesAsInvalid; use ProcessMaker\Jobs\RefreshArtisanCaches; +use ProcessMaker\Jobs\RestartMessageConsumers; use ProcessMaker\Jobs\TerminateHorizon; use ProcessMaker\Models\Setting; use ProcessMaker\Repositories\ConfigRepository; @@ -19,14 +20,14 @@ class SettingServiceProvider extends ServiceProvider * * @var bool */ - protected static $shouldCacheConfiguration = false; + protected static bool $shouldCacheConfiguration = false; /** * Eloquent events which trigger configuration-related updates * * @var array */ - public static $listen = [ + public static array $listen = [ 'eloquent.saved: ' . Setting::class, 'eloquent.deleted: ' . Setting::class, ]; @@ -53,10 +54,11 @@ public function register(): void }); // When the config:cache command is run, we need to restart - // horizon to ensure they use the latest version of the - // cached configuration + // horizon and the message consumer(s) to ensure they use + // the latest version of the cached configuration $this->app['events']->listen(CommandFinished::class, function ($event) { if ($this->isCacheConfigCommand($event)) { + $this->restartMessageConsumers(); $this->restartHorizon(); } }); @@ -119,6 +121,23 @@ public function isCacheConfigCommand($event): bool return is_int(strpos($command, 'config:cache')); } + /** + * Restart the `processmaker:consume` commands to + * pick up new config changes + * + * @return void + */ + public function restartMessageConsumers(): void + { + // If there's already a job pending to restart the message consumers, + // then we don't need to queue another. The job itself checks which + // messaging service is configured and will restart the consumer for + // it appropriately + if (!job_pending($job = RestartMessageConsumers::class)) { + $job::dispatch(); + } + } + /** * Restart the horizon queue manager whenever the configuration is cached so ensure * the new configuration is picked up by the supervisor/queue processes. diff --git a/composer.json b/composer.json index 37ed837ab9..d4cefb3183 100644 --- a/composer.json +++ b/composer.json @@ -96,7 +96,7 @@ "Gmail" ], "processmaker": { - "build": "3daac8b4", + "build": "822678fc", "custom": { "package-ellucian-ethos": "1.14.1", "package-plaid": "1.3.1", @@ -148,7 +148,7 @@ "package-files": "1.11.2", "package-googleplaces": "1.9.0", "package-photo-video": "1.2.0", - "package-pm-blocks": "1.3.2", + "package-pm-blocks": "1.3.3", "package-process-documenter": "1.8.0", "package-process-optimization": "1.8.0", "package-product-analytics": "1.5.8", diff --git a/composer.lock b/composer.lock index a085c7c47b..3d998bb856 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b797eb8cf8faf7f1ddfb3e4ef766c551", + "content-hash": "6b841f0b22b24b3de469d7a53e28db07", "packages": [ { "name": "aws/aws-crt-php", diff --git a/config/services.php b/config/services.php index 895c32926c..2fd8fbd071 100644 --- a/config/services.php +++ b/config/services.php @@ -42,7 +42,7 @@ 'github' => [ 'base_url' => 'https://raw.githubusercontent.com/processmaker/', 'template_repo' => env('DEFAULT_TEMPLATE_REPO', 'process-templates'), - 'template_branch' => env('DEFAULT_TEMPLATE_BRANCH', 'main'), + 'template_branch' => env('DEFAULT_TEMPLATE_BRANCH', '2023-fall'), 'template_categories' => env('DEFAULT_TEMPLATE_CATEGORIES', 'accounting-and-finance,customer-success,human-resources,marketing-and-sales,operations,it'), ], diff --git a/package-lock.json b/package-lock.json index dd2879d115..0805a39630 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,9 +17,9 @@ "@fortawesome/free-solid-svg-icons": "^5.15.1", "@fortawesome/vue-fontawesome": "^0.1.9", "@panter/vue-i18next": "^0.15.2", - "@processmaker/modeler": "1.42.1", + "@processmaker/modeler": "1.42.2", "@processmaker/processmaker-bpmn-moddle": "0.14.1", - "@processmaker/screen-builder": "2.79.0", + "@processmaker/screen-builder": "2.79.1", "@processmaker/vue-form-elements": "0.49.4", "@processmaker/vue-multiselect": "2.2.0", "autoprefixer": "10.4.5", @@ -2760,9 +2760,9 @@ "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info." }, "node_modules/@processmaker/modeler": { - "version": "1.42.1", - "resolved": "https://registry.npmjs.org/@processmaker/modeler/-/modeler-1.42.1.tgz", - "integrity": "sha512-rt+D18aFXVcWOh/zMethf5hY1/7VwCrhotfyVRZj/TLj0xf16X4neuZUdyW+E/8sU5ckf471TU7gZkR1ArSp7w==", + "version": "1.42.2", + "resolved": "https://registry.npmjs.org/@processmaker/modeler/-/modeler-1.42.2.tgz", + "integrity": "sha512-dVT3iglqNI+dNUid4mnw/yD5MQyy6uPKgWm4dtNC6yBiw4jQTpXSYcwMj5vDuaQNbf0wC/MwQv06sk4pYudvYg==", "dependencies": { "@babel/plugin-proposal-private-methods": "^7.12.1", "@fortawesome/fontawesome-free": "^5.11.2", @@ -2989,9 +2989,9 @@ } }, "node_modules/@processmaker/screen-builder": { - "version": "2.79.0", - "resolved": "https://registry.npmjs.org/@processmaker/screen-builder/-/screen-builder-2.79.0.tgz", - "integrity": "sha512-gea+hUE4VA/27CEgAq+gWCOjbyuYN03fwq9tt4UAzoHuvni2ih2H/gkSGeO8qNLp1IRV7GV5vEfZ2Zh4cBBTUQ==", + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/@processmaker/screen-builder/-/screen-builder-2.79.1.tgz", + "integrity": "sha512-Ku1JmJVahHnUDjOqw5W/zR3cN34F4XUtC26kF0uXmGVvhPnMS+vLjRl8zYOCV2yXdziDL06LERjMbzQvgcyiJA==", "dependencies": { "axios-extensions": "^2.0.3", "lodash": "^4.17.21", @@ -23832,9 +23832,9 @@ "integrity": "sha512-eKnrt2mCtcYFhweNr20mOWSG0431BPPFnhYJEQd+D2/5ssWPaHVEEgD3YnUOmbg1gdRQdVe2rrxcdEvvPugB/A==" }, "@processmaker/modeler": { - "version": "1.42.1", - "resolved": "https://registry.npmjs.org/@processmaker/modeler/-/modeler-1.42.1.tgz", - "integrity": "sha512-rt+D18aFXVcWOh/zMethf5hY1/7VwCrhotfyVRZj/TLj0xf16X4neuZUdyW+E/8sU5ckf471TU7gZkR1ArSp7w==", + "version": "1.42.2", + "resolved": "https://registry.npmjs.org/@processmaker/modeler/-/modeler-1.42.2.tgz", + "integrity": "sha512-dVT3iglqNI+dNUid4mnw/yD5MQyy6uPKgWm4dtNC6yBiw4jQTpXSYcwMj5vDuaQNbf0wC/MwQv06sk4pYudvYg==", "requires": { "@babel/plugin-proposal-private-methods": "^7.12.1", "@fortawesome/fontawesome-free": "^5.11.2", @@ -23990,9 +23990,9 @@ } }, "@processmaker/screen-builder": { - "version": "2.79.0", - "resolved": "https://registry.npmjs.org/@processmaker/screen-builder/-/screen-builder-2.79.0.tgz", - "integrity": "sha512-gea+hUE4VA/27CEgAq+gWCOjbyuYN03fwq9tt4UAzoHuvni2ih2H/gkSGeO8qNLp1IRV7GV5vEfZ2Zh4cBBTUQ==", + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/@processmaker/screen-builder/-/screen-builder-2.79.1.tgz", + "integrity": "sha512-Ku1JmJVahHnUDjOqw5W/zR3cN34F4XUtC26kF0uXmGVvhPnMS+vLjRl8zYOCV2yXdziDL06LERjMbzQvgcyiJA==", "requires": { "axios-extensions": "^2.0.3", "lodash": "^4.17.21", diff --git a/package.json b/package.json index 68afe3942d..7bd7a55b9d 100644 --- a/package.json +++ b/package.json @@ -51,9 +51,9 @@ "@fortawesome/free-solid-svg-icons": "^5.15.1", "@fortawesome/vue-fontawesome": "^0.1.9", "@panter/vue-i18next": "^0.15.2", - "@processmaker/modeler": "1.42.1", + "@processmaker/modeler": "1.42.2", "@processmaker/processmaker-bpmn-moddle": "0.14.1", - "@processmaker/screen-builder": "2.79.0", + "@processmaker/screen-builder": "2.79.1", "@processmaker/vue-form-elements": "0.49.4", "@processmaker/vue-multiselect": "2.2.0", "autoprefixer": "10.4.5", diff --git a/resources/js/components/requests/card.vue b/resources/js/components/requests/card.vue index 3ed727a6a7..4fc5a044b0 100644 --- a/resources/js/components/requests/card.vue +++ b/resources/js/components/requests/card.vue @@ -79,11 +79,10 @@ export default { .then(response => { this.spin = 0; let instance = response.data; - this.$cookies.set('fromTriggerStartEvent', true, '1min'); if (this.$cookies.get("isMobile") === "true") { window.location = "/requests/mobile/" + instance.id; } else { - window.location = "/requests/" + instance.id; + window.location = `/requests/${instance.id}?fromTriggerStartEvent=`; } }).catch((err) => { this.disabled = false; diff --git a/resources/js/processes/screens/components/CreateScreenModal.vue b/resources/js/processes/screens/components/CreateScreenModal.vue index 7466406596..14b77402dc 100644 --- a/resources/js/processes/screens/components/CreateScreenModal.vue +++ b/resources/js/processes/screens/components/CreateScreenModal.vue @@ -78,7 +78,7 @@ v-if="isProjectsInstalled" v-model="formData.projects" :errors="errors.projects" - :projectId="projectId" + :project-id="projectId" :label="$t('Project')" :required="isProjectSelectionRequired" api-get="projects" @@ -161,13 +161,13 @@ export default { this.resetFormData(); this.resetErrors(); if (this.isQuickCreate === true) { - this.screenTypes = filterScreenType(); + this.screenTypes = filterScreenType() ?? this.types; // in any case the screenType if the only one, default to the first value if (Object.keys(this.screenTypes).length === 1) this.formData.type = Object.keys(this.screenTypes)[0]; } if (this.callFromAiModeler === true) { this.screenTypes = this.types; - } + } }, methods: { show() { @@ -193,10 +193,10 @@ export default { this.resetErrors(); }, close() { - this.$bvModal.hide('createScreen'); + this.$bvModal.hide("createScreen"); this.disabled = false; - this.$emit('reload'); - }, + this.$emit("reload"); + }, onSubmit() { this.resetErrors(); // single click diff --git a/resources/js/utils/filterScreenType.js b/resources/js/utils/filterScreenType.js index b6b55288e7..f5fc057c4c 100644 --- a/resources/js/utils/filterScreenType.js +++ b/resources/js/utils/filterScreenType.js @@ -2,8 +2,10 @@ import { ScreenTypes } from "../models/screens"; /** * Filter the screen types based on the task + * @return {?Object}; */ export function filterScreenType() { - const screen = new URLSearchParams(window.location.search).get("screenType").split(","); + const screen = new URLSearchParams(window.location.search).get("screenType")?.split(","); + if (!screen) return; return Object.fromEntries(Object.entries(ScreenTypes).filter(([key]) => screen.includes(key))); }