mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 18:03:37 +02:00
Only try to retrieve the targetLot from DB if the parameter is existing
This fixes an excpetion occuring during withdrawal of parts, when moving is disabled for the lot.
This commit is contained in:
parent
0dcdd252f5
commit
37fb895d67
1 changed files with 4 additions and 2 deletions
|
@ -350,8 +350,10 @@ class PartController extends AbstractController
|
||||||
if($partLot->getPart() !== $part) {
|
if($partLot->getPart() !== $part) {
|
||||||
throw new \RuntimeException("The origin partlot does not belong to the part!");
|
throw new \RuntimeException("The origin partlot does not belong to the part!");
|
||||||
}
|
}
|
||||||
//Try to determine the target lot (used for move actions)
|
|
||||||
$targetLot = $em->find(PartLot::class, $request->request->get('target_id'));
|
//Try to determine the target lot (used for move actions), if the parameter is existing
|
||||||
|
$targetId = $request->request->get('target_id', null);
|
||||||
|
$targetLot = $targetId ? $em->find(PartLot::class, $targetId) : null;
|
||||||
if ($targetLot && $targetLot->getPart() !== $part) {
|
if ($targetLot && $targetLot->getPart() !== $part) {
|
||||||
throw new \RuntimeException("The target partlot does not belong to the part!");
|
throw new \RuntimeException("The target partlot does not belong to the part!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue