mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-12 11:24:31 +02:00
Mark the special project build status in part info page and parts tables
This commit is contained in:
parent
fdcd1b9d9d
commit
05c4adb928
6 changed files with 47 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue