Skip to content

Commit 39ff4f8

Browse files
committed
Use image attachments as preview images for partkeepr imports
Fixes issue #1115
1 parent c60b406 commit 39ff4f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ protected function importAttachments(array $data, string $table_name, string $ta
150150

151151
$target->addAttachment($attachment);
152152
$this->em->persist($attachment);
153+
154+
//If the attachment is an image, and the target has no master picture yet, set it
155+
if ($attachment->isPicture() && $target->getMasterPictureAttachment() === null) {
156+
$target->setMasterPictureAttachment($attachment);
157+
}
153158
}
154159

155160
$this->em->flush();

0 commit comments

Comments
 (0)