Fixes
Some checks failed
Gitea Actions / Run-Tests-On-Amd64 (push) Failing after 41m50s
Gitea Actions / Merge (push) Successful in 7m6s
Gitea Actions / Run-Tests-On-Arm64 (push) Has been cancelled

This commit is contained in:
Thomas Peterson 2026-04-24 14:36:40 +02:00
parent cba13f9b54
commit 633a042136
9 changed files with 170 additions and 32 deletions

View File

@ -2433,7 +2433,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* length?: scalar|Param|null, // Default: 5
* width?: scalar|Param|null, // Default: 130
* height?: scalar|Param|null, // Default: 50
* font?: scalar|Param|null, // Default: "/data/www/new/vendor/gregwar/captcha-bundle/DependencyInjection/../Generator/Font/captcha.ttf"
* font?: scalar|Param|null, // Default: "/application/src/new/vendor/gregwar/captcha-bundle/DependencyInjection/../Generator/Font/captcha.ttf"
* keep_value?: scalar|Param|null, // Default: false
* charset?: scalar|Param|null, // Default: "abcdefhjkmnprstuvwxyz23456789"
* as_file?: scalar|Param|null, // Default: false

View File

@ -4,3 +4,8 @@ PSC\Shop\EntityBundle\Entity\Account:
account_2:
title: Bestes von Hier - Bio BGmbH
account_3:
title: Admin Account

View File

@ -12,7 +12,7 @@ PSC\Shop\EntityBundle\Entity\Contact:
zip: "17506"
street: "Musterstraße"
house_number: "24b"
account: '@account_1'
account: '@account_3'
contact_2:
username: test@shop.de

View File

@ -36,7 +36,7 @@ class Xml extends AbstractController
$engine->calc();
$output = new ContentOutput();
$output->json = json_decode($engine->generateJson(), true);
$output->json = $engine->generateJson();
$output->xml = $engine->generateXML(true);
$output->jsonGraph = json_decode($engine->getCalcGraph()->generateJsonGraph(), true);

View File

@ -14,6 +14,6 @@ class VersionTest extends WebTestCase
$this->assertResponseIsSuccessful();
$data = json_decode($client->getResponse()->getContent(), true);
$this->assertSame('2.3.5', $data['release']);
$this->assertSame('2.3.6', $data['release']);
}
}

View File

@ -0,0 +1,126 @@
<?php
namespace Plugins\Custom\PSC\CollectLayouter\Api;
use PSC\Shop\ContactBundle\Repository\ContactRepository;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Tests\RefreshDatabaseTrait;
class SaveContactTest extends WebTestCase
{
use RefreshDatabaseTrait;
private const PRODUCT_UUID = '01938686-0e4d-7da9-bae3-b2e1b1681f9f';
public function testSaveContactAsLoggedInUser(): void
{
$client = static::createClient();
$userRepository = static::getContainer()->get(ContactRepository::class);
$testUser = $userRepository->loadUserByUsername('admin@shop.de');
$client->loginUser($testUser, 'api');
$client->jsonRequest(
'PUT',
'/api/plugin/custom/psc/collectlayouter/savecontact/' . self::PRODUCT_UUID,
[
'data' => [
['name' => 'data[firstname][value]', 'value' => 'Max'],
['name' => 'data[firstname][enable]', 'value' => '1'],
],
],
[],
);
$this->assertResponseIsSuccessful();
$data = json_decode($client->getResponse()->getContent(), true);
self::assertTrue($data['success']);
}
public function testSaveContactWithoutUserStillReturnsSuccess(): void
{
$client = static::createClient();
$client->jsonRequest(
'PUT',
'/api/plugin/custom/psc/collectlayouter/savecontact/' . self::PRODUCT_UUID,
['data' => []],
[],
);
$this->assertResponseIsSuccessful();
$data = json_decode($client->getResponse()->getContent(), true);
self::assertTrue($data['success']);
}
public function testSaveCollectForExistingContact(): void
{
$client = static::createClient();
$userRepository = static::getContainer()->get(ContactRepository::class);
$adminUser = $userRepository->loadUserByUsername('admin@shop.de');
$client->loginUser($adminUser, 'api');
$targetContact = $userRepository->loadUserByUsername('test@shop.de');
$client->jsonRequest(
'PUT',
'/api/plugin/custom/psc/collectlayouter/savecontactcollect/' . self::PRODUCT_UUID . '/'
. $targetContact->getUuid(),
[
'data' => [
['name' => 'data[lastname][value]', 'value' => 'Mustermann'],
['name' => 'data[lastname][enable]', 'value' => '1'],
],
],
[],
);
$this->assertResponseIsSuccessful();
$data = json_decode($client->getResponse()->getContent(), true);
self::assertTrue($data['success']);
}
public function testSaveNewContact(): void
{
$client = static::createClient();
$client->jsonRequest(
'PUT',
'/api/plugin/custom/psc/collectlayouter/savenewcontact/' . self::PRODUCT_UUID,
[
'data' => [
['name' => 'data[firstname][value]', 'value' => 'Neuer'],
['name' => 'data[firstname][enable]', 'value' => '1'],
],
],
[],
);
$this->assertResponseIsSuccessful();
$data = json_decode($client->getResponse()->getContent(), true);
self::assertTrue($data['success']);
}
public function testSaveNewContactWithLogin(): void
{
$client = static::createClient();
$userRepository = static::getContainer()->get(ContactRepository::class);
$testUser = $userRepository->loadUserByUsername('admin@shop.de');
$client->loginUser($testUser, 'api');
$client->jsonRequest(
'PUT',
'/api/plugin/custom/psc/collectlayouter/savenewcontact/' . self::PRODUCT_UUID,
[
'data' => [
['name' => 'data[firstname][value]', 'value' => 'Neuer'],
['name' => 'data[firstname][enable]', 'value' => '1'],
],
],
[],
);
$this->assertResponseIsSuccessful();
$data = json_decode($client->getResponse()->getContent(), true);
self::assertTrue($data['success']);
}
}

View File

@ -14,6 +14,7 @@ use PSC\Shop\EntityBundle\Document\Country;
use PSC\Shop\EntityBundle\Document\Instance;
use PSC\Shop\EntityBundle\Document\Order;
use PSC\Shop\EntityBundle\Document\Position;
use PSC\Shop\EntityBundle\Document\Product;
use PSC\Shop\EntityBundle\Document\Shop;
use PSC\Shop\MediaBundle\Document\Folder;
use PSC\Shop\MediaBundle\Document\Media;
@ -79,34 +80,19 @@ trait RefreshDatabaseTrait
'namespace' => '\\Plugin\\Custom\\PSC\\FormBuilder\\Plugin',
'pluginId' => '19ff3fd21de9dbd7452fd0a67c928759',
]);
$bulk->insert([
'name' => 'Form Based Layouter',
'installed' => true,
'shouldBeDeInstalled' => false,
'shouldBeInstalled' => false,
'path' => 'Custom/PSC/CollectLayouter',
'namespace' => '\\Plugin\\Custom\\PSC\\CollectLayouter\\Plugin',
'pluginId' => '51db3f03e98a9db1de5cf5e19dfe955c',
]);
$doc->getClient()->getManager()->executeBulkWrite('psc_test.Plugin', $bulk);
$doc->getSchemaManager()->dropDocumentCollection(Layout::class);
if (!$doc->getRepository(Plugin::class)->findOneBy(['pluginId' => '19ff3fd21de9dbd7452fd0a67c928758'])) {
$plugin = new Plugin();
$plugin->setInstalled(true);
$plugin->setPluginId('19ff3fd21de9dbd7452fd0a67c928758');
$plugin->setName('XML Kalkulations Produkt');
$plugin->setNamespace('\Plugin\System\PSC\XmlCalc\Plugin');
$plugin->setPath('System/PSC/XmlCalc');
$doc->persist($plugin);
$doc->flush();
$doc->clear();
}
if (!$doc->getRepository(Plugin::class)->findOneBy(['pluginId' => '19ff3fd21de9dbd7452fd0a67c928759'])) {
$plugin = new Plugin();
$plugin->setInstalled(true);
$plugin->setPluginId('19ff3fd21de9dbd7452fd0a67c928759');
$plugin->setName('FormBuilder');
$plugin->setNamespace('\Plugin\Custom\PSC\FormBuilder\Plugin');
$plugin->setPath('Custom/PSC/FormBuilder');
$doc->persist($plugin);
$doc->flush();
$doc->clear();
}
$instance = new Instance();
$instance->setAppId('1');
$instance->setInvoiceNumberStart(1);
@ -213,6 +199,20 @@ trait RefreshDatabaseTrait
$doc->flush();
$doc->clear();
$product = $em->getRepository(\PSC\Shop\EntityBundle\Entity\Product::class)->findOneBy([
'uuid' => '01938686-0e4d-7da9-bae3-b2e1b1681f9f',
]);
$productDoc = $doc->getRepository(Product::class)->findOneBy([
'uid' => $product->getUid(),
]);
if (!$productDoc) {
$productDoc = new Product();
$productDoc->setUid($product->getUid());
$doc->persist($productDoc);
$doc->flush();
}
return $kernel;
}
}

View File

@ -10,6 +10,7 @@ use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use Plugin\Custom\PSC\CollectLayouter\Dto\SaveContact\Input;
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
use PSC\Shop\AccountBundle\Model\Account;
use PSC\Shop\ContactBundle\Model\Role;
use PSC\Shop\ContactBundle\Transformer\Model\Contact;
use PSC\Shop\EntityBundle\Entity\Contact as PSCContact;
@ -124,12 +125,17 @@ class SaveContact extends AbstractController
$contact->setLocked(false);
$contact->addRole(new Role(id: 1));
$contact->addRole(new Role(id: 5));
if ($user = $this->getUser()) {
$account = new Account();
$account->setUid($this->getUser()->getAccount()->getUid());
$contact->setAccount($account);
}
$this->saveContactHelper->setSetting($setting);
$this->saveContactHelper->setContact($contact);
$this->saveContactHelper->setData($data);
$this->saveContactHelper->saveData();
return $this->json(['success' => true]);
return $this->json(['success' => true, 'account' => $contact->getAccount()->getUid()]);
}
}

View File

@ -1,11 +1,12 @@
info:
datum: 20.04.2026
datum: 24.04.2026
release: 2.3.6
changelog:
- version: 2.3.6
datum: 20.04.2026
datum: 24.04.2026
changes:
- "Form Based Layouter speichert jetzt die Firma vom angemeldeten Benutzer"
- "Kalk kann jetzt mit $Vxxx_staffel_value$V umgehen. Mit staffelCalc=\"$Vauflage$V\" kann in der Option die Grundlage der Staffel aus der Papierdatenbank übergeben werden."
- "Papierdatenbank Kommawerte"
- version: 2.3.5