diff --git a/ProcessMaker/ImportExport/Exporters/ProcessExporter.php b/ProcessMaker/ImportExport/Exporters/ProcessExporter.php index e6bb7041cb..ee12fd3a67 100644 --- a/ProcessMaker/ImportExport/Exporters/ProcessExporter.php +++ b/ProcessMaker/ImportExport/Exporters/ProcessExporter.php @@ -58,12 +58,20 @@ public function export() : void // Screens if ($process->cancel_screen_id) { - $screen = Screen::findOrFail($process->cancel_screen_id); - $this->addDependent('cancel-screen', $screen, ScreenExporter::class); + $screen = Screen::find($process->cancel_screen_id); + if ($screen) { + $this->addDependent('cancel-screen', $screen, ScreenExporter::class); + } else { + \Log::debug("Cancel ScreenId: $process->cancel_screen_id not exists"); + } } if ($process->request_detail_screen_id) { - $screen = Screen::findOrFail($process->request_detail_screen_id); - $this->addDependent('request-detail-screen', $screen, ScreenExporter::class); + $screen = Screen::find($process->request_detail_screen_id); + if ($screen) { + $this->addDependent('request-detail-screen', $screen, ScreenExporter::class); + } else { + \Log::debug("Request Detail ScreenId: $process->request_detail_screen_id not exists"); + } } $this->exportSubprocesses(); @@ -301,14 +309,22 @@ private function exportScreens() $allowInterstitial = $element->getAttribute('pm:allowInterstitial'); if (is_numeric($screenId)) { - $screen = Screen::findOrFail($screenId); - $this->addDependent(DependentType::SCREENS, $screen, ScreenExporter::class, $meta); + $screen = Screen::find($screenId); + if ($screen) { + $this->addDependent(DependentType::SCREENS, $screen, ScreenExporter::class, $meta); + } else { + \Log::debug("ScreenId: $screenId not exists"); + } } // Let's check if interstitialScreen exist if (is_numeric($interstitialScreenId) && $allowInterstitial === 'true') { - $interstitialScreen = Screen::findOrFail($interstitialScreenId); - $this->addDependent(DependentType::INTERSTITIAL_SCREEN, $interstitialScreen, ScreenExporter::class, $meta); + $interstitialScreen = Screen::find($interstitialScreenId); + if ($interstitialScreen) { + $this->addDependent(DependentType::INTERSTITIAL_SCREEN, $interstitialScreen, ScreenExporter::class, $meta); + } else { + \Log::debug("Interstitial screenId: $interstitialScreenId not exists"); + } } } } @@ -343,8 +359,12 @@ private function exportScripts() $scriptId = $element->getAttribute('pm:scriptRef'); if (is_numeric($scriptId)) { - $script = Script::findOrFail($scriptId); - $this->addDependent(DependentType::SCRIPTS, $script, ScriptExporter::class, $meta); + $script = Script::find($scriptId); + if ($script) { + $this->addDependent(DependentType::SCRIPTS, $script, ScriptExporter::class, $meta); + } else { + \Log::debug("ScriptId: $scriptId not exists"); + } } } } diff --git a/ProcessMaker/ImportExport/Exporters/ScreenExporter.php b/ProcessMaker/ImportExport/Exporters/ScreenExporter.php index 7f45e044d7..bb59a0d5ee 100644 --- a/ProcessMaker/ImportExport/Exporters/ScreenExporter.php +++ b/ProcessMaker/ImportExport/Exporters/ScreenExporter.php @@ -80,7 +80,12 @@ private function getNestedScreens() : array $screenFinder = new ScreensInScreen(); foreach ($screenFinder->referencesToExport($this->model, [], null, false) as $screen) { try { - $screens[] = Screen::findOrFail($screen[1]); + $screen = Screen::find($screen[1]); + if ($screen) { + $screens[] = $screen; + } else { + \Log::debug("NestedScreen screenId: $screen[1] not exists"); + } } catch (ModelNotFoundException $error) { \Log::error($error->getMessage()); continue; diff --git a/resources/js/processes/export/DataProvider.js b/resources/js/processes/export/DataProvider.js index ae36ed882f..2bddf9adae 100644 --- a/resources/js/processes/export/DataProvider.js +++ b/resources/js/processes/export/DataProvider.js @@ -15,6 +15,7 @@ export default { return ProcessMaker.apiClient.post('/import/do-import', formData, { + timeout: 60_000, // 60 seconds headers: { 'Content-Type': 'multipart/form-data' }