Skip to content

FOUR-24135 | Saved Images Are Not Displayed in an Imported Screen Template - #9068

Open
mcraeteisha wants to merge 3 commits into
developfrom
bugfix/FOUR-24135
Open

mcraeteisha wants to merge 3 commits into
developfrom
bugfix/FOUR-24135

Conversation

@mcraeteisha

@mcraeteisha mcraeteisha commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Issue

Ticket: FOUR-24135

This PR resolves an issue where screen template export did not include thumbnail images stored in the template's media collection, so imported templates opened with empty settings previews.

Solution

  • ScreenTemplatesExporter now embeds those images in the export payload and recreates them on import under
    st-{uuid}-media, which is the collection the settings UI reads.
  • Added a regression test that attaches a thumbnail, exports, deletes, imports, and asserts the imported template has media and a usable preview URL.

How To Test

Automated

  1. Run phpunit tests/Feature/Templates/Api/ScreenTemplateTest.php. Ensure all tests pass.

Manual

  1. Open Designer → Screens → My Templates.
  2. Open a screen template's settings and add thumbnail images.
  3. Save the screen template and confirm the images preview.
  4. Export the screen template.
  5. Import the exported file.
  6. Open the imported template's settings and confirm the images display.
  7. Export/import a template with no images and confirm import still succeeds.

ci:deploy

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@cursor

cursor Bot commented Sep 21, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes import/export behavior and embeds binary data in exports; scoped to screen templates but affects media storage paths and re-import idempotency via clearMediaCollection.

Overview
Fixes imported screen templates losing thumbnail/preview images by extending screen template export/import to carry media in the payload and restore it on import.

ScreenTemplatesExporter now serializes each file in the template’s media_collection (filename, custom properties, base64 contents) as a DependentType::MEDIA reference on export. On import it assigns media_collection to st-{uuid}-media, clears that collection, then recreates media from the embedded base64 so the settings UI can resolve template_media previews again.

The testImportExportScreenTemplate regression test attaches a thumbnail, round-trips export/import, asserts collection name, media count, preview URL, and on-disk file, and re-imports once to confirm media is not duplicated.

Reviewed by Cursor Bugbot for commit 9141fd5. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a8b2baf. Configure here.

Comment thread ProcessMaker/ImportExport/Exporters/ScreenTemplatesExporter.php
Prevent duplicate media when importing a screen template by clearing the existing media collection before adding new media.
@vladyrichter

Copy link
Copy Markdown

QA server K8S was successfully deployed https://ci-3263370d0d.engk8s.processmaker.net

@eiresendez eiresendez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working as expected 👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants