Skip to content
Merged
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
5 changes: 3 additions & 2 deletions ProcessMaker/ImportExport/Exporters/ScreenExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ private function getNestedScreens() : array
$screenFinder = new ScreensInScreen();
foreach ($screenFinder->referencesToExport($this->model, [], null, false) as $screen) {
try {
$screen = Screen::find($screen[1]);
$screenId = $screen[1];
$screen = Screen::find($screenId);
if ($screen) {
$screens[] = $screen;
} else {
\Log::debug("NestedScreen screenId: $screen[1] not exists");
\Log::debug("NestedScreen screenId: $screenId not exists");
}
} catch (ModelNotFoundException $error) {
\Log::error($error->getMessage());
Expand Down
24 changes: 24 additions & 0 deletions tests/Feature/ImportExport/Exporters/ScreenExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,28 @@ public function testAttemptToAddMultipleInterstials()
$newInterstitial = Screen::where('title', 'Default Interstitial 2')->firstOrFail();
$this->assertNull($newInterstitial->key);
}

public function testExportScreenWithMissingDependentScreen()
{
$screen = Screen::factory()->create([
'title' => 'Screen with missing dependent screen',
'key' => 'screen',
'config' => [
['items' => [
['component' => 'FormNestedScreen', 'config' => ['screen' => 9999999999]],
]],
],
]);

$exporter = new Exporter();
$exporter->exportScreen($screen);
$payload = $exporter->payload();

$screens = Arr::where($payload['export'], function ($value) {
return $value['type'] === 'Screen';
});

$this->assertCount(1, $screens);
$this->assertEquals($screen->uuid, Arr::first($screens)['attributes']['uuid']);
}
}