mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-14 14:19:33 +00:00
Stücklisten beim Löschen: Markieren von referenzierten Baugruppen als Hinweis vornehmen
This commit is contained in:
parent
4b722257d8
commit
dbeb4cc50a
1 changed files with 17 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ namespace App\Controller\AdminPages;
|
||||||
|
|
||||||
use App\DataTables\LogDataTable;
|
use App\DataTables\LogDataTable;
|
||||||
use App\Entity\AssemblySystem\Assembly;
|
use App\Entity\AssemblySystem\Assembly;
|
||||||
|
use App\Entity\AssemblySystem\AssemblyBOMEntry;
|
||||||
use App\Entity\Attachments\Attachment;
|
use App\Entity\Attachments\Attachment;
|
||||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||||
use App\Entity\Attachments\AttachmentUpload;
|
use App\Entity\Attachments\AttachmentUpload;
|
||||||
|
|
@ -469,6 +470,10 @@ abstract class BaseAdminController extends AbstractController
|
||||||
return $this->redirectToRoute($this->route_base.'_edit', ['id' => $entity->getID()]);
|
return $this->redirectToRoute($this->route_base.'_edit', ['id' => $entity->getID()]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if ($entity instanceof Assembly) {
|
||||||
|
$this->markReferencedBomEntry($entity);
|
||||||
|
}
|
||||||
|
|
||||||
if ($entity instanceof AbstractStructuralDBElement) {
|
if ($entity instanceof AbstractStructuralDBElement) {
|
||||||
$parent = $entity->getParent();
|
$parent = $entity->getParent();
|
||||||
|
|
||||||
|
|
@ -516,4 +521,16 @@ abstract class BaseAdminController extends AbstractController
|
||||||
|
|
||||||
return $exporter->exportEntityFromRequest($entity, $request);
|
return $exporter->exportEntityFromRequest($entity, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function markReferencedBomEntry(Assembly $referencedAssembly): void
|
||||||
|
{
|
||||||
|
$bomEntries = $this->entityManager->getRepository(AssemblyBOMEntry::class)->findBy(['referencedAssembly' => $referencedAssembly]);
|
||||||
|
|
||||||
|
foreach ($bomEntries as $entry) {
|
||||||
|
$entry->setReferencedAssembly(null);
|
||||||
|
$entry->setName($referencedAssembly->getName(). ' DELETED');
|
||||||
|
|
||||||
|
$this->entityManager->persist($entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue