mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 20:50:06 +02:00
Dont change the original collection when calling getOrderdetails with $hide_obsolete = true
This caused the orderdetails tab to be hidden on part info, when the orderdetail was obsolete
This commit is contained in:
parent
28c09eb51d
commit
b0d29eaeaf
1 changed files with 4 additions and 8 deletions
|
@ -44,6 +44,7 @@ namespace App\Entity\Parts\PartTraits;
|
||||||
|
|
||||||
use App\Entity\PriceInformations\Orderdetail;
|
use App\Entity\PriceInformations\Orderdetail;
|
||||||
use App\Security\Annotations\ColumnSecurity;
|
use App\Security\Annotations\ColumnSecurity;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
use function count;
|
use function count;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
@ -129,14 +130,9 @@ trait OrderTrait
|
||||||
{
|
{
|
||||||
//If needed hide the obsolete entries
|
//If needed hide the obsolete entries
|
||||||
if ($hide_obsolete) {
|
if ($hide_obsolete) {
|
||||||
$orderdetails = $this->orderdetails;
|
return $this->orderdetails->filter(function (Orderdetail $orderdetail) {
|
||||||
foreach ($orderdetails as $key => $details) {
|
return ! $orderdetail->getObsolete();
|
||||||
if ($details->getObsolete()) {
|
});
|
||||||
unset($orderdetails[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $orderdetails;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->orderdetails;
|
return $this->orderdetails;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue