From 39ff4f81c06b07b6fa0b60ad3c85f6da3d7a50cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 7 Dec 2025 20:25:39 +0100 Subject: [PATCH] Use image attachments as preview images for partkeepr imports Fixes issue #1115 --- .../PartKeeprImporter/PKImportHelperTrait.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php index 1e4cd3ba..64127341 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php @@ -150,6 +150,11 @@ trait PKImportHelperTrait $target->addAttachment($attachment); $this->em->persist($attachment); + + //If the attachment is an image, and the target has no master picture yet, set it + if ($attachment->isPicture() && $target->getMasterPictureAttachment() === null) { + $target->setMasterPictureAttachment($attachment); + } } $this->em->flush();