Clean up very slightly

This commit is contained in:
Dave Branton 2026-05-22 15:05:15 +12:00
parent 4af3cdb7ab
commit 7998918ae4
3 changed files with 2 additions and 56 deletions

View file

@ -128,7 +128,7 @@ class ToolsController extends AbstractController
}
#[Route(path: '/multi_build', name: 'tools_multi_build')]
public function multiBuild(LoggerInterface $logger, EntityManagerInterface $entityManager, Request $request): Response
public function multiBuild(EntityManagerInterface $entityManager, Request $request): Response
{
//$this->denyAccessUnlessGranted('@tools.multi_build');
$all_projects = $entityManager->getRepository(Project::class)->findAll();
@ -142,19 +142,15 @@ class ToolsController extends AbstractController
if ($form->isSubmitted())
{
if ($form->isValid())
{
$submitted = "YES";
{
foreach($all_projects as $p)
{
$count_for_project = $form->get($p->getID() . "_project")->getData() + 0;
$logger->Info("QTY", ['count_for_project'=>$count_for_project, 'name'=>$p->getName()]);
if ($count_for_project > 0)
{
$logger->Info("BOMSIZE", ['bomsize'=>count($p->getBomEntries())]);
foreach ($p->getBomEntries() as $bom_entry)
{
$part_id = $bom_entry->getPart()->getID();
$logger->Info("ISAPART", ['q'=>$bom_entry->getQuantity(), 'name'=>$bom_entry->getPart()->getName()]);
if (array_key_exists($part_id, $combined_bom))
{
$combined_bom[$part_id]['quantity'] += $bom_entry->getQuantity() * $count_for_project;
@ -170,7 +166,6 @@ class ToolsController extends AbstractController
foreach($combined_bom as $cb)
{
$total_instock = $cb['part']->getAmountSum();
$logger->Info("COMBINED BOM", ['total_instock'=>$total_instock, 'needed'=>$cb['quantity']]);
if ($total_instock < $cb['quantity'])
{
$needs_ordering[] = array('needed'=>($cb['quantity']-$total_instock), 'part'=>$cb['part']);

View file

@ -25,26 +25,16 @@ namespace App\Form\ProjectSystem;
use App\Services\InfoProviderSystem\ProviderRegistry;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\FormBuilderInterface;
use App\Entity\ProjectSystem\Project;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Psr\Log\LoggerInterface;
class ProjectMultiBuildType extends AbstractType
{
private LoggerInterface $logger;
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$this->logger->info("LEN {len}", ['len'=>count($options['projects'])]);
foreach($options['projects'] as $p)
{
$builder->add($p->getID() . '_project', NumberType::class, [

View file

@ -1,39 +0,0 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2023 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Helpers\Projects;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\ProjectSystem\Project;
use App\Entity\ProjectSystem\ProjectBOMEntry;
use App\Validator\Constraints\ProjectSystem\ValidProjectBuildRequest;
/**
* @see \App\Tests\Helpers\Projects\ProjectBuildRequestTest
*/
#[ValidProjectBuildRequest]
final class ProjectBuildRequest
{
}