Mark the special project build status in part info page and parts tables

This commit is contained in:
Jan Böhmer 2022-12-29 16:56:24 +01:00
parent fdcd1b9d9d
commit 05c4adb928
6 changed files with 47 additions and 3 deletions

View file

@ -62,6 +62,13 @@ class PartPreviewGenerator
}
}
if (null !== $part->getBuiltProject()) {
$attachment = $part->getBuiltProject()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
$list[] = $attachment;
}
}
if (null !== $part->getCategory()) {
$attachment = $part->getCategory()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
@ -109,7 +116,7 @@ class PartPreviewGenerator
return $attachment;
}
//Otherwise check if the part has a footprint with a valid masterattachment
//Otherwise check if the part has a footprint with a valid master attachment
if (null !== $part->getFootprint()) {
$attachment = $part->getFootprint()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
@ -117,6 +124,14 @@ class PartPreviewGenerator
}
}
//With lowest priority use the master attachment of the project this part represents (when existing)
if (null !== $part->getBuiltProject()) {
$attachment = $part->getBuiltProject()->getMasterPictureAttachment();
if ($this->isAttachmentValidPicture($attachment)) {
return $attachment;
}
}
//If nothing is available return null
return null;
}