mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-23 12:24:45 +02:00
Allow to retrieve price and shopping informations from info providers
This commit is contained in:
parent
c4439cc9db
commit
0cb46039dd
11 changed files with 348 additions and 4 deletions
|
@ -102,6 +102,9 @@ class StructuralEntityChoiceHelper
|
|||
$symbol = empty($choice->getIsoCode()) ? null : Currencies::getSymbol($choice->getIsoCode());
|
||||
$tmp['data-short'] = $options['short'] ? $symbol : $choice->getName();
|
||||
|
||||
//Show entities that are not added to DB yet separately from other entities
|
||||
$tmp['data-not_in_db_yet'] = $choice->getID() === null;
|
||||
|
||||
return $tmp + [
|
||||
'data-symbol' => $symbol,
|
||||
];
|
||||
|
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Form\Type\Helper;
|
||||
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
use App\Services\Trees\NodesListBuilder;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
@ -59,6 +60,12 @@ class StructuralEntityChoiceLoader extends AbstractChoiceLoader
|
|||
public function createNewEntitiesFromValue(string $value): array
|
||||
{
|
||||
if (!$this->options['allow_add']) {
|
||||
//Always allow the starting element to be added
|
||||
if ($this->starting_element !== null && $this->starting_element->getID() === null) {
|
||||
$this->entityManager->persist($this->starting_element);
|
||||
return [$this->starting_element];
|
||||
}
|
||||
|
||||
throw new \RuntimeException('Cannot create new entity, because allow_add is not enabled!');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue