mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-16 05:14:35 +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
|
@ -57,6 +57,10 @@ class PartDataTableHelper
|
|||
if ($context->isNeedsReview()) {
|
||||
$icon = sprintf('<i class="fa-solid fa-ambulance fa-fw me-1" title="%s"></i>', $this->translator->trans('part.needs_review.badge'));
|
||||
}
|
||||
if ($context->getBuiltProject() !== null) {
|
||||
$icon = sprintf('<i class="fa-solid fa-box-archive fa-fw me-1" title="%s"></i>',
|
||||
$this->translator->trans('part.info.projectBuildPart.hint') . ': ' . $context->getBuiltProject()->getName());
|
||||
}
|
||||
|
||||
|
||||
return sprintf(
|
||||
|
|
|
@ -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