This commit is contained in:
Thomas Peterson 2025-09-01 16:59:14 +02:00
parent 3f1d28b9da
commit 1199cc6901
90 changed files with 2807 additions and 1944 deletions

View File

@ -64,8 +64,8 @@ server {
try_files $uri @sfFront; try_files $uri @sfFront;
} }
#location /w2p/ { # location /w2p/ {
# proxy_pass http://tp:8080/w2p/; #j proxy_pass http://tp:8080/w2p/;
# proxy_temp_path /tmp/proxy; # proxy_temp_path /tmp/proxy;
#} #}

View File

@ -85,6 +85,8 @@ RUN pecl install imagick \
RUN docker-php-ext-install -j$(nproc) pdo_mysql RUN docker-php-ext-install -j$(nproc) pdo_mysql
# Install opcache # Install opcache
RUN docker-php-ext-install -j$(nproc) opcache RUN docker-php-ext-install -j$(nproc) opcache
RUN apt-get install wget
RUN wget -qO - https://packages.sury.org/php/README.txt | bash -x
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
libc-client-dev libkrb5-dev libldap2-dev && \ libc-client-dev libkrb5-dev libldap2-dev && \
rm -r /var/lib/apt/lists/* rm -r /var/lib/apt/lists/*

View File

@ -8,9 +8,9 @@ use LogicException;
use Port\Csv\CsvWriter; use Port\Csv\CsvWriter;
use Port\Reader\ArrayReader; use Port\Reader\ArrayReader;
use PSC\Backend\ToolsBundle\Export\Writer\ExcelWriter; use PSC\Backend\ToolsBundle\Export\Writer\ExcelWriter;
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface; use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface;
use PSC\Backend\ToolsBundle\Service\ExporterRegistry; use PSC\Backend\ToolsBundle\Service\ExporterRegistry;
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Form; use Symfony\Component\Form\Form;
@ -28,8 +28,9 @@ class OrderExporter implements ExporterInterface, ConfigurableElementInterface
private $_formFactory = null; private $_formFactory = null;
private $_entityManager = null; private $_entityManager = null;
private $_shopService = null; private $_shopService = null;
/** @var Form */ /** @var Form */
private $_form = null; private $_form = null;
function __construct(FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, Shop $shopService) function __construct(FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, Shop $shopService)
{ {
$this->_formFactory = $formFactory; $this->_formFactory = $formFactory;
@ -52,8 +53,8 @@ class OrderExporter implements ExporterInterface, ConfigurableElementInterface
public function getForm(FormBuilderInterface $builder, $form_options) public function getForm(FormBuilderInterface $builder, $form_options)
{ {
$builder->add("from", DateType::class, array('label' => 'Von', 'attr' => array('class' => 'form-element'))); $builder->add('from', DateType::class, ['label' => 'Von', 'attr' => ['class' => 'form-element']]);
$builder->add("to", DateType::class, array('label' => 'Bis', 'attr' => array('class' => 'form-element'))); $builder->add('to', DateType::class, ['label' => 'Bis', 'attr' => ['class' => 'form-element']]);
} }
public function getGroup() public function getGroup()
@ -73,32 +74,41 @@ class OrderExporter implements ExporterInterface, ConfigurableElementInterface
{ {
$formData = $this->_form->getData(); $formData = $this->_form->getData();
$orderRepository = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order'); $orderRepository = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order');
$qb = $orderRepository->createQueryBuilder('o') $qb = $orderRepository
->createQueryBuilder('o')
->leftJoin('o.contact', 'c') ->leftJoin('o.contact', 'c')
->where("o.created >= :from and o.created <= :to and o.shop = :shop") ->where('o.created >= :from and o.created <= :to and o.shop = :shop')
->setParameter('from', $formData['from']) ->setParameter('from', $formData['from'])
->setParameter('to', $formData['to']) ->setParameter('to', $formData['to'])
->setParameter('shop', $this->_shopService->getSelectedShop()->getId()) ->setParameter('shop', $this->_shopService->getSelectedShop()->getId())
->getQuery(); ->getQuery();
$temp = array(); $temp = [];
$rows = $qb->getResult(); $rows = $qb->getResult();
$temp[] = [
'uid',
'alias',
'created',
'status',
'brutto',
'package',
'contact',
];
foreach ($rows as $row) { foreach ($rows as $row) {
$temp[] = array( $temp[] = [
$row->getUID(), $row->getUID(),
$row->getAlias(), $row->getAlias(),
$row->getCreated()->format('Y-m-d H:i:s'), $row->getCreated()->format('Y-m-d H:i:s'),
$row->getStatus(), $row->getStatus(),
$row->getBrutto(), $row->getBrutto(),
$row->getPackage(), $row->getPackage(),
$row->getContact()->getUsername() $row->getContact()->getUsername(),
); ];
} }
$reader = new ArrayReader($temp); $reader = new ArrayReader($temp);
$writer = new CsvWriter(); $writer = new CsvWriter();
$writer->setStream(fopen('php://output', 'w')); $writer->setStream(fopen('php://output', 'w'));
$response = new StreamedResponse(function () use ($reader, $writer) { $response = new StreamedResponse(function () use ($reader, $writer) {
foreach ($reader as $row) { foreach ($reader as $row) {
$writer->writeItem($row); $writer->writeItem($row);
} }

View File

@ -6,9 +6,9 @@ use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use LogicException; use LogicException;
use PSC\Backend\ToolsBundle\Export\Writer\ExcelWriter; use PSC\Backend\ToolsBundle\Export\Writer\ExcelWriter;
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface; use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface;
use PSC\Backend\ToolsBundle\Service\ExporterRegistry; use PSC\Backend\ToolsBundle\Service\ExporterRegistry;
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Form; use Symfony\Component\Form\Form;
@ -27,8 +27,12 @@ class OrderposExporter implements ExporterInterface, ConfigurableElementInterfac
private $_shopService = null; private $_shopService = null;
/** @var Form */ /** @var Form */
private $_form = null; private $_form = null;
public function __construct(FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, Shop $shopService)
{ public function __construct(
FormFactoryInterface $formFactory,
EntityManagerInterface $entityManager,
Shop $shopService,
) {
$this->_formFactory = $formFactory; $this->_formFactory = $formFactory;
$this->_entityManager = $entityManager; $this->_entityManager = $entityManager;
$this->_shopService = $shopService; $this->_shopService = $shopService;
@ -49,8 +53,8 @@ class OrderposExporter implements ExporterInterface, ConfigurableElementInterfac
public function getForm(FormBuilderInterface $builder, $form_options) public function getForm(FormBuilderInterface $builder, $form_options)
{ {
$builder->add("from", DateType::class, array('label' => 'Von', 'attr' => array('class' => 'form-element'))); $builder->add('from', DateType::class, ['label' => 'Von', 'attr' => ['class' => 'form-element']]);
$builder->add("to", DateType::class, array('label' => 'Bis', 'attr' => array('class' => 'form-element'))); $builder->add('to', DateType::class, ['label' => 'Bis', 'attr' => ['class' => 'form-element']]);
} }
public function getGroup() public function getGroup()
@ -71,19 +75,30 @@ class OrderposExporter implements ExporterInterface, ConfigurableElementInterfac
$em = $this->_entityManager; $em = $this->_entityManager;
$form = $this->_form; $form = $this->_form;
$response = new StreamedResponse(function () use ($em, $form) { $response = new StreamedResponse(function () use ($em, $form) {
$formData = $form->getData(); $formData = $form->getData();
$orderRepository = $em->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos'); $orderRepository = $em->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos');
$results = $orderRepository->createQueryBuilder('o') $results = $orderRepository
->where("o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop") ->createQueryBuilder('o')
->where('o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop')
->setParameter('from', $formData['from']) ->setParameter('from', $formData['from'])
->setParameter('to', $formData['to']) ->setParameter('to', $formData['to'])
->setParameter('shop', $this->_shopService->getSelectedShop()->getId()) ->setParameter('shop', $this->_shopService->getSelectedShop()->getId())
->getQuery()->iterate(); ->getQuery()
->iterate();
$handle = fopen('php://output', 'r+'); $handle = fopen('php://output', 'r+');
fputcsv($handle, [
'uid',
'alias',
'created',
'status',
'brutto',
'package',
'contact',
'product_uid',
'product_title',
]);
while (false !== ($row = $results->next())) { while (false !== ($row = $results->next())) {
fputcsv($handle, array( fputcsv($handle, [
$row[0]->getOrder()->getUID(), $row[0]->getOrder()->getUID(),
$row[0]->getOrder()->getAlias(), $row[0]->getOrder()->getAlias(),
$row[0]->getOrder()->getCreated()->format('Y-m-d H:i:s'), $row[0]->getOrder()->getCreated()->format('Y-m-d H:i:s'),
@ -92,8 +107,8 @@ class OrderposExporter implements ExporterInterface, ConfigurableElementInterfac
$row[0]->getOrder()->getPackage(), $row[0]->getOrder()->getPackage(),
$row[0]->getOrder()->getContact()->getUsername(), $row[0]->getOrder()->getContact()->getUsername(),
$row[0]->getProduct()->getUid(), $row[0]->getProduct()->getUid(),
$row[0]->getProduct()->getTitle() $row[0]->getProduct()->getTitle(),
)); ]);
$em->detach($row[0]); $em->detach($row[0]);
} }

View File

@ -35,15 +35,16 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class AccountType extends AbstractType class AccountType extends AbstractType
{ {
/** /**
* @var Field * @var Field
*/ */
protected $fields; protected $fields;
/** /**
* @var General * @var General
*/ */
protected $general; protected $general;
protected $shop = null; protected $shop = null;
protected $formFactory; protected $formFactory;
public function __construct(Shop $shop, Field $fields, FormFactoryInterface $formFactory, General $general) public function __construct(Shop $shop, Field $fields, FormFactoryInterface $formFactory, General $general)
{ {
$this->fields = $fields; $this->fields = $fields;
@ -61,39 +62,37 @@ class AccountType extends AbstractType
$builder $builder
->add('title', TextType::class, ['label' => 'Name']) ->add('title', TextType::class, ['label' => 'Name'])
->add( ->add('payments', EntityType::class, [
'payments', EntityType::class, array(
'class' => 'PSC\Shop\EntityBundle\Entity\Payment', 'class' => 'PSC\Shop\EntityBundle\Entity\Payment',
'choice_label' => 'title', 'choice_label' => 'title',
'choice_value' => 'uid', 'choice_value' => 'uid',
'required' => false, 'required' => false,
'multiple' => true, 'multiple' => true,
'query_builder' => function (EntityRepository $er) { 'query_builder' => function (EntityRepository $er) {
return $er
return $er->createQueryBuilder('u') ->createQueryBuilder('u')
->where('u.shop = :shop')->andWhere('u.private = 1')->setParameter('shop', $this->shop->getSelectedShop()->getId()); ->where('u.shop = :shop')
} ->andWhere('u.private = 1')
) ->setParameter('shop', $this->shop->getSelectedShop()->getId());
) },
->add( ])
'shippings', EntityType::class, array( ->add('shippings', EntityType::class, [
'class' => 'PSC\Shop\EntityBundle\Entity\Shipping', 'class' => 'PSC\Shop\EntityBundle\Entity\Shipping',
'choice_label' => 'title', 'choice_label' => 'title',
'choice_value' => 'uid', 'choice_value' => 'uid',
'required' => false, 'required' => false,
'multiple' => true, 'multiple' => true,
'query_builder' => function (EntityRepository $er) { 'query_builder' => function (EntityRepository $er) {
return $er
return $er->createQueryBuilder('u') ->createQueryBuilder('u')
->where('u.shop = :shop')->andWhere('u.private = 1')->setParameter('shop', $this->shop->getSelectedShop()->getId()); ->where('u.shop = :shop')
} ->andWhere('u.private = 1')
) ->setParameter('shop', $this->shop->getSelectedShop()->getId());
) },
->add( ])
'productGroups', EntityType::class, array( ->add('productGroups', EntityType::class, [
'class' => 'PSC\Shop\EntityBundle\Entity\Productgroup', 'class' => 'PSC\Shop\EntityBundle\Entity\Productgroup',
'choice_label' => function (Productgroup $choice, $key, $value) { 'choice_label' => function (Productgroup $choice, $key, $value) {
if ($choice->isEnable()) { if ($choice->isEnable()) {
return $choice->getTitle(); return $choice->getTitle();
} else { } else {
@ -104,71 +103,71 @@ class AccountType extends AbstractType
'required' => false, 'required' => false,
'multiple' => true, 'multiple' => true,
'query_builder' => function (EntityRepository $er) { 'query_builder' => function (EntityRepository $er) {
return $er
return $er->createQueryBuilder('u') ->createQueryBuilder('u')
->where('u.shop = :shop')->andWhere('u.private = 1')->setParameter('shop', $this->shop->getSelectedShop()->getId()); ->where('u.shop = :shop')
} ->andWhere('u.private = 1')
) ->setParameter('shop', $this->shop->getSelectedShop()->getId());
) },
->add( ])
'parent', EntityType::class, array( ->add('parent', EntityType::class, [
'class' => 'PSC\Shop\EntityBundle\Entity\Account', 'class' => 'PSC\Shop\EntityBundle\Entity\Account',
'choice_label' => 'title', 'choice_label' => 'title',
'choice_value' => 'uid', 'choice_value' => 'uid',
'multiple' => false, 'multiple' => false,
'required' => false, 'required' => false,
'query_builder' => function (EntityRepository $er) { 'query_builder' => function (EntityRepository $er) {
return $er
return $er->createQueryBuilder('u') ->createQueryBuilder('u')
->join('u.shops', 's') ->join('u.shops', 's')
->where('s.uid = :shop')->setParameter('shop', $this->shop->getSelectedShop()->getId()); ->where('s.uid = :shop')
} ->setParameter('shop', $this->shop->getSelectedShop()->getId());
) },
) ])
->add( ->add('productsOrg', EntityType::class, [
'productsOrg', EntityType::class, array(
'class' => 'PSC\Shop\EntityBundle\Entity\Product', 'class' => 'PSC\Shop\EntityBundle\Entity\Product',
'choice_label' => 'nrTitle', 'choice_label' => 'nrTitle',
'multiple' => true, 'multiple' => true,
'required' => false, 'required' => false,
'query_builder' => function (EntityRepository $er) { 'query_builder' => function (EntityRepository $er) {
return $er
return $er->createQueryBuilder('u') ->createQueryBuilder('u')
->where('u.shop = :shop')->andWhere('u.private = 1 AND u.originalProduct = 0')->setParameter('shop', $this->shop->getSelectedShop()->getId()); ->where('u.shop = :shop')
} ->andWhere('u.private = 1 AND u.originalProduct = 0')
) ->setParameter('shop', $this->shop->getSelectedShop()->getId());
) },
->add( ])
'productsSub', EntityType::class, array( ->add('productsSub', EntityType::class, [
'class' => 'PSC\Shop\EntityBundle\Entity\Product', 'class' => 'PSC\Shop\EntityBundle\Entity\Product',
'choice_label' => 'nrTitle', 'choice_label' => 'nrTitle',
'required' => false, 'required' => false,
'multiple' => true, 'multiple' => true,
'query_builder' => function (EntityRepository $er) { 'query_builder' => function (EntityRepository $er) {
return $er
return $er->createQueryBuilder('u') ->createQueryBuilder('u')
->where('u.shop = :shop')->andWhere('u.private = 1 AND u.originalProduct != 0')->setParameter('shop', $this->shop->getSelectedShop()->getId()); ->where('u.shop = :shop')
} ->andWhere('u.private = 1 AND u.originalProduct != 0')
) ->setParameter('shop', $this->shop->getSelectedShop()->getId());
) },
->add( ])
'cms', EntityType::class, array( ->add('cms', EntityType::class, [
'class' => 'PSC\Shop\EntityBundle\Entity\Cms', 'class' => 'PSC\Shop\EntityBundle\Entity\Cms',
'choice_label' => 'title', 'choice_label' => 'title',
'choice_value' => 'uid', 'choice_value' => 'uid',
'multiple' => true, 'multiple' => true,
'required' => false, 'required' => false,
'query_builder' => function (EntityRepository $er) use ($tempCms) { 'query_builder' => function (EntityRepository $er) use ($tempCms) {
return $er
return $er->createQueryBuilder('u') ->createQueryBuilder('u')
->where('(u.shop = :shop OR u.uid in (' . implode(",", $tempCms) . '))')->andWhere('u.private = 1')->setParameter('shop', $this->shop->getSelectedShop()->getId()); ->where('(u.shop = :shop OR u.uid in (' . implode(',', $tempCms) . '))')
} ->andWhere('u.private = 1')
) ->setParameter('shop', $this->shop->getSelectedShop()->getId());
) },
])
->add('appendix', TextType::class, ['required' => false, 'label' => 'additive']) ->add('appendix', TextType::class, ['required' => false, 'label' => 'additive'])
->add('locked', CheckboxType::class, ['required' => false, 'label' => 'Locked']) ->add('locked', CheckboxType::class, ['required' => false, 'label' => 'Locked'])
->add('street', TextType::class, ['required' => false, 'label' => 'street']) ->add('street', TextType::class, ['required' => false, 'label' => 'street'])
->add('destrict', TextType::class, ['required' => false, 'label' => 'district']) ->add('district', TextType::class, ['required' => false, 'label' => 'district'])
->add('zip', TextType::class, ['required' => false, 'label' => 'zip']) ->add('zip', TextType::class, ['required' => false, 'label' => 'zip'])
->add('city', TextType::class, ['required' => false, 'label' => 'city']) ->add('city', TextType::class, ['required' => false, 'label' => 'city'])
->add('state', TextType::class, ['required' => false, 'label' => 'state']) ->add('state', TextType::class, ['required' => false, 'label' => 'state'])
@ -176,50 +175,50 @@ class AccountType extends AbstractType
->add('email', TextType::class, ['required' => false, 'label' => 'Email']) ->add('email', TextType::class, ['required' => false, 'label' => 'Email'])
->add('houseNumber', TextType::class, ['required' => false, 'label' => 'housenumber']) ->add('houseNumber', TextType::class, ['required' => false, 'label' => 'housenumber'])
->add('homepage', TextType::class, ['required' => false, 'label' => 'Homepage']) ->add('homepage', TextType::class, ['required' => false, 'label' => 'Homepage'])
->add('extraSettings', TextareaType::class, array('required' => false, 'label' => 'extrasettings')) ->add('extraSettings', TextareaType::class, ['required' => false, 'label' => 'extrasettings'])
->add('phoneAreaCode', TextType::class, ['required' => false, 'label' => 'Countrycode']) ->add('phoneAreaCode', TextType::class, ['required' => false, 'label' => 'Countrycode'])
->add('phonePrefix', TextType::class, ['required' => false, 'label' => 'prefix']) ->add('phonePrefix', TextType::class, ['required' => false, 'label' => 'prefix'])
->add('phone', TextType::class, ['required' => false, 'label' => 'number']) ->add('phone', TextType::class, ['required' => false, 'label' => 'number'])
->add('phoneAppendix', TextType::class, ['required' => false, 'label' => 'extension']) ->add('phoneAppendix', TextType::class, ['required' => false, 'label' => 'extension'])
->add('priceFactor', NumberType::class, [
->add( 'required' => false,
'priceFactor', NumberType::class, array('required' => false, 'label' => 'factor', 'scale' => 2, 'html5' => true, 'label' => 'factor',
'attr' => array( 'scale' => 2,
'html5' => true,
'attr' => [
'min' => -0.01, 'min' => -0.01,
'max' => 2.00, 'max' => 2.00,
'step' => 0.01, 'step' => 0.01,
)) ],
) ])
->add('mobileAreaCode', TextType::class, ['required' => false, 'label' => 'Countrycode']) ->add('mobileAreaCode', TextType::class, ['required' => false, 'label' => 'Countrycode'])
->add('mobilePrefix', TextType::class, ['required' => false, 'label' => 'prefix']) ->add('mobilePrefix', TextType::class, ['required' => false, 'label' => 'prefix'])
->add('mobile', TextType::class, ['required' => false, 'label' => 'number']) ->add('mobile', TextType::class, ['required' => false, 'label' => 'number'])
->add('mobileAppendix', TextType::class, ['required' => false, 'label' => 'extension']) ->add('mobileAppendix', TextType::class, ['required' => false, 'label' => 'extension'])
->add('faxAreaCode', TextType::class, ['required' => false, 'label' => 'Countrycode']) ->add('faxAreaCode', TextType::class, ['required' => false, 'label' => 'Countrycode'])
->add('faxPrefix', TextType::class, ['required' => false, 'label' => 'prefix']) ->add('faxPrefix', TextType::class, ['required' => false, 'label' => 'prefix'])
->add('fax', TextType::class, ['required' => false, 'label' => 'number']) ->add('fax', TextType::class, ['required' => false, 'label' => 'number'])
->add('faxAppendix', TextType::class, ['required' => false, 'label' => 'extension']) ->add('faxAppendix', TextType::class, ['required' => false, 'label' => 'extension'])
->add('alternativAreaCode', TextType::class, ['required' => false, 'label' => 'Countrycode']) ->add('alternativAreaCode', TextType::class, ['required' => false, 'label' => 'Countrycode'])
->add('alternativType', TextType::class, ['required' => false, 'label' => 'Typ']) ->add('alternativType', TextType::class, ['required' => false, 'label' => 'Typ'])
->add('alternativ', TextType::class, ['required' => false, 'label' => 'number']) ->add('alternativ', TextType::class, ['required' => false, 'label' => 'number'])
->add('alternativAppendix', TextType::class, ['required' => false, 'label' => 'extension']) ->add('alternativAppendix', TextType::class, ['required' => false, 'label' => 'extension'])
->add('bankKtoName', TextType::class, ['required' => false, 'label' => 'accountowner']) ->add('bankKtoName', TextType::class, ['required' => false, 'label' => 'accountowner'])
->add('bankKTO', TextType::class, ['required' => false, 'label' => 'accountnumber']) ->add('bankKTO', TextType::class, ['required' => false, 'label' => 'accountnumber'])
->add('bankBLZ', TextType::class, ['required' => false, 'label' => 'bankcode']) ->add('bankBLZ', TextType::class, ['required' => false, 'label' => 'bankcode'])
->add('bankIban', TextType::class, ['required' => false, 'label' => 'Iban']) ->add('bankIban', TextType::class, ['required' => false, 'label' => 'Iban'])
->add('bankBic', TextType::class, ['required' => false, 'label' => 'BIC']) ->add('bankBic', TextType::class, ['required' => false, 'label' => 'BIC'])
->add('bankName', TextType::class, ['required' => false, 'label' => 'bankname']) ->add('bankName', TextType::class, ['required' => false, 'label' => 'bankname'])
->add('ustid', TextType::class, ['required' => false, 'label' => 'VatId']) ->add('ustid', TextType::class, ['required' => false, 'label' => 'VatId'])
->add('typ', ChoiceType::class, ['choices' => $this->general->getAccountTypes(),'translation_domain' => 'general', 'required' => false, 'label' => 'Typ']) ->add('typ', ChoiceType::class, [
'choices' => $this->general->getAccountTypes(),
'translation_domain' => 'general',
'required' => false,
'label' => 'Typ',
])
->add('image', MediaType::class, ['required' => false, 'label' => 'pic']) ->add('image', MediaType::class, ['required' => false, 'label' => 'pic'])
->add('templateSwitch', TextType::class, ['required' => false, 'label' => 'Alternatetemplate']) ->add('templateSwitch', TextType::class, ['required' => false, 'label' => 'Alternatetemplate'])
->add('information', TextareaType::class, ['required' => false, 'label' => 'information']) ->add('information', TextareaType::class, ['required' => false, 'label' => 'information'])
->add('megaCode', TextType::class, ['required' => false, 'label' => 'MegaCode']) ->add('megaCode', TextType::class, ['required' => false, 'label' => 'MegaCode'])
->add('hotelName', TextType::class, ['required' => false, 'label' => 'Hotelname']) ->add('hotelName', TextType::class, ['required' => false, 'label' => 'Hotelname'])
->add('subHotelName', TextType::class, ['required' => false, 'label' => 'SubHotelname']) ->add('subHotelName', TextType::class, ['required' => false, 'label' => 'SubHotelname'])
@ -231,23 +230,32 @@ class AccountType extends AbstractType
->add('handelsRegister', TextType::class, ['required' => false, 'label' => 'commercialregister']) ->add('handelsRegister', TextType::class, ['required' => false, 'label' => 'commercialregister'])
->add('hrb', TextType::class, ['required' => false, 'label' => 'HRB']) ->add('hrb', TextType::class, ['required' => false, 'label' => 'HRB'])
->add('vorsitz', TextType::class, ['required' => false, 'label' => 'ChairmanoftheBoard']) ->add('vorsitz', TextType::class, ['required' => false, 'label' => 'ChairmanoftheBoard'])
->add('salutation1', ChoiceType::class, [
->add('salutation1', ChoiceType::class, ['choices' => $this->general->getSalutation(),'translation_domain' => 'general', 'required' => false, 'label' => 'salutation1']) 'choices' => $this->general->getSalutation(),
'translation_domain' => 'general',
'required' => false,
'label' => 'salutation1',
])
->add('firstname1', TextType::class, ['required' => false, 'label' => 'firsname1']) ->add('firstname1', TextType::class, ['required' => false, 'label' => 'firsname1'])
->add('lastname1', TextType::class, ['required' => false, 'label' => 'lastname1']) ->add('lastname1', TextType::class, ['required' => false, 'label' => 'lastname1'])
->add('salutation2', ChoiceType::class, ['choices' => $this->general->getSalutation(),'translation_domain' => 'general', 'required' => false, 'label' => 'salutation2']) ->add('salutation2', ChoiceType::class, [
'choices' => $this->general->getSalutation(),
'translation_domain' => 'general',
'required' => false,
'label' => 'salutation2',
])
->add('firstname2', TextType::class, ['required' => false, 'label' => 'firsname2']) ->add('firstname2', TextType::class, ['required' => false, 'label' => 'firsname2'])
->add('lastname2', TextType::class, ['required' => false, 'label' => 'lastname2']) ->add('lastname2', TextType::class, ['required' => false, 'label' => 'lastname2'])
->add('calcValue1', TextType::class, ['required' => false, 'label' => 'value1']) ->add('calcValue1', TextType::class, ['required' => false, 'label' => 'value1'])
->add('calcValue2', TextType::class, ['required' => false, 'label' => 'value2']); ->add('calcValue2', TextType::class, ['required' => false, 'label' => 'value2']);
/** /**
* @var \PSC\System\PluginBundle\Form\Interfaces\Field $field * @var \PSC\System\PluginBundle\Form\Interfaces\Field $field
*/ */
foreach ($this->fields->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Account) as $field) { foreach ($this->fields->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Account) as $field) {
$builder->add($field->buildForm($this->formFactory->createNamedBuilder($field->getGroup()), $options)); $builder->add($field->buildForm($this->formFactory->createNamedBuilder($field->getGroup()), $options));
} }
$builder->add('save', SubmitType::class, array('label' => 'save')); $builder->add('save', SubmitType::class, ['label' => 'save']);
} }
public function getName() public function getName()
@ -257,12 +265,10 @@ class AccountType extends AbstractType
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults( $resolver->setDefaults([
array(
'data_class' => 'PSC\Shop\EntityBundle\Entity\Account', 'data_class' => 'PSC\Shop\EntityBundle\Entity\Account',
'cms' => [], 'cms' => [],
'translation_domain' => 'core_account_create_and_edit' 'translation_domain' => 'core_account_create_and_edit',
) ]);
);
} }
} }

View File

@ -145,11 +145,11 @@
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<div class="row mb-3"> <div class="row mb-3">
{{ form_label(form.destrict) }} {{ form_label(form.district) }}
<div class="col-md-8"> <div class="col-md-8">
{{ form_widget(form.destrict) }} {{ form_widget(form.district) }}
</div> </div>
{{ form_errors(form.destrict) }} {{ form_errors(form.district) }}
</div> </div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

View File

@ -145,11 +145,11 @@
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
<div class="row mb-3"> <div class="row mb-3">
{{ form_label(form.destrict) }} {{ form_label(form.district) }}
<div class="col-md-8"> <div class="col-md-8">
{{ form_widget(form.destrict) }} {{ form_widget(form.district) }}
</div> </div>
{{ form_errors(form.destrict) }} {{ form_errors(form.district) }}
</div> </div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

View File

@ -14,7 +14,7 @@ street: Straße
housenumber: Hausnummer housenumber: Hausnummer
zip: PLZ zip: PLZ
city: Ort city: Ort
destrict: Bezirk district: Bezirk
state: Bundesland state: Bundesland
country: Land country: Land
Phonenumber: Telefonnummer Phonenumber: Telefonnummer

View File

@ -12,7 +12,7 @@ street: Street
housenumber: House number housenumber: House number
zip: Zip/Postal Code zip: Zip/Postal Code
city: City city: City
destrict: Destrict district: District
state: State state: State
country: Country country: Country
Phonenumber: Phone Number Phonenumber: Phone Number
@ -30,4 +30,4 @@ additiveone: Additive 1
additivetwo: Additive 2 additivetwo: Additive 2
customernumber: Customer number customernumber: Customer number
vatid: Vat ID vatid: Vat ID
save: Save save: Save

View File

@ -12,7 +12,7 @@ housenumber: Hausnummer
zip: PLZ zip: PLZ
city: Ort city: Ort
vatid: USt-IdNr. vatid: USt-IdNr.
destrict: Bezirk district: Bezirk
state: Bundesland state: Bundesland
country: Land country: Land
homepage: Homepage homepage: Homepage

View File

@ -11,7 +11,7 @@ housenumber: House number
zip: Zip/Postal Code zip: Zip/Postal Code
city: City city: City
vatid: VAT ID vatid: VAT ID
destrict: Destrict district: District
state: State state: State
country: Country country: Country
homepage: Homepage homepage: Homepage
@ -120,4 +120,4 @@ grossprice: Gross Price
status: Status status: Status
details: Details details: Details
yes: Yes yes: Yes
no: No no: No

View File

@ -463,12 +463,12 @@
<div class="col-md-3"> <div class="col-md-3">
<div class="row mb-3"> <div class="row mb-3">
<div class="col-md-4"> <div class="col-md-4">
{{ form_label(form.destrict) }} {{ form_label(form.district) }}
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
{{ form_widget(form.destrict) }} {{ form_widget(form.district) }}
</div> </div>
{{ form_errors(form.destrict) }} {{ form_errors(form.district) }}
</div> </div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

View File

@ -435,12 +435,12 @@
<div class="col-md-3"> <div class="col-md-3">
<div class="row mb-3"> <div class="row mb-3">
<div class="col-md-4"> <div class="col-md-4">
{{ form_label(form.destrict) }} {{ form_label(form.district) }}
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
{{ form_widget(form.destrict) }} {{ form_widget(form.district) }}
</div> </div>
{{ form_errors(form.destrict) }} {{ form_errors(form.district) }}
</div> </div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

View File

@ -13,22 +13,32 @@ use PSC\Shop\MediaBundle\Service\MediaManager;
use PSC\Shop\MediaBundle\Transformer\Media as PSCMedia; use PSC\Shop\MediaBundle\Transformer\Media as PSCMedia;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
class Contact readonly class Contact
{ {
public function __construct(private readonly MediaManager $mediaManager, private readonly ContactRepository $contactRepository, private readonly Shop $shopService, private readonly EntityManagerInterface $entityManager, private readonly DocumentManager $documentManager, private readonly PSCMedia $mediaTransformer, private readonly Account $accountTransformer) public function __construct(
{ private MediaManager $mediaManager,
} private ContactRepository $contactRepository,
private Shop $shopService,
private EntityManagerInterface $entityManager,
private DocumentManager $documentManager,
private PSCMedia $mediaTransformer,
private Account $accountTransformer,
) {}
public function toDb(\PSC\Shop\ContactBundle\Model\Contact $contact): void public function toDb(\PSC\Shop\ContactBundle\Model\Contact $contact): void
{ {
if ($contact->getUuid() !== "") { if ($contact->getUuid() !== '') {
/** @var \PSC\Shop\EntityBundle\Entity\Contact $contactEntity */ /** @var \PSC\Shop\EntityBundle\Entity\Contact $contactEntity */
$contactEntity = $this->contactRepository->findOneBy(['uuid' => $contact->getUuid()]); $contactEntity = $this->contactRepository->findOneBy(['uuid' => $contact->getUuid()]);
$contactDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)->findOneBy(['uid' => $contactEntity->getUid()]); $contactDoc = $this->documentManager
->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)
->findOneBy(['uid' => $contactEntity->getUid()]);
} else { } else {
if ($contact->getUid() !== 0) { if ($contact->getUid() !== 0) {
$contactEntity = $this->contactRepository->findOneBy(['uid' => $contact->getUuid()]); $contactEntity = $this->contactRepository->findOneBy(['uid' => $contact->getUuid()]);
$contactDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)->findOneBy(['uid' => $contactEntity->getUid()]); $contactDoc = $this->documentManager
->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)
->findOneBy(['uid' => $contactEntity->getUid()]);
} else { } else {
$contactEntity = new \PSC\Shop\EntityBundle\Entity\Contact(); $contactEntity = new \PSC\Shop\EntityBundle\Entity\Contact();
$contactDoc = new \PSC\Shop\EntityBundle\Document\Contact(); $contactDoc = new \PSC\Shop\EntityBundle\Document\Contact();
@ -46,55 +56,55 @@ class Contact
if (count($shops) > 0) { if (count($shops) > 0) {
$contactEntity->setShops($shops); $contactEntity->setShops($shops);
} }
if ($contact->getEmail() != "") { if ($contact->getEmail() != '') {
$contactEntity->setEmail($contact->getEmail()); $contactEntity->setEmail($contact->getEmail());
} }
$contactEntity->setEnable(true); $contactEntity->setEnable(true);
$contactEntity->setFirstname((string)$contact->getLayouterData()->getFirstname()); $contactEntity->setFirstname((string) $contact->getLayouterData()->getFirstname());
$contactEntity->setCompany((string)$contact->getLayouterData()->getCompany()); $contactEntity->setCompany((string) $contact->getLayouterData()->getCompany());
$contactEntity->setCompany2((string)$contact->getLayouterData()->getCompany2()); $contactEntity->setCompany2((string) $contact->getLayouterData()->getCompany2());
$contactEntity->setLastname((string)$contact->getLayouterData()->getLastname()); $contactEntity->setLastname((string) $contact->getLayouterData()->getLastname());
$contactEntity->setZip((string)$contact->getLayouterData()->getZip()); $contactEntity->setZip((string) $contact->getLayouterData()->getZip());
$contactEntity->setCity((string)$contact->getLayouterData()->getCity()); $contactEntity->setCity((string) $contact->getLayouterData()->getCity());
$contactEntity->setStreet((string)$contact->getLayouterData()->getStreet()); $contactEntity->setStreet((string) $contact->getLayouterData()->getStreet());
$contactEntity->setHouseNumber((string)$contact->getLayouterData()->getHouseNumber()); $contactEntity->setHouseNumber((string) $contact->getLayouterData()->getHouseNumber());
$contactEntity->setHomepage((string)$contact->getLayouterData()->getHomepage()); $contactEntity->setHomepage((string) $contact->getLayouterData()->getHomepage());
if ($contact->getLayouterData()->getImage1() != null) { if ($contact->getLayouterData()->getImage1() != null) {
$contactEntity->setImage((string)$contact->getLayouterData()->getImage1()->getUuid()); $contactEntity->setImage((string) $contact->getLayouterData()->getImage1()->getUuid());
} }
if ($contact->getLayouterData()->getImage2() != null) { if ($contact->getLayouterData()->getImage2() != null) {
$contactEntity->setImage2((string)$contact->getLayouterData()->getImage2()->getUuid()); $contactEntity->setImage2((string) $contact->getLayouterData()->getImage2()->getUuid());
} }
$contactEntity->setBirthday((string)$contact->getLayouterData()->getBirthday()); $contactEntity->setBirthday((string) $contact->getLayouterData()->getBirthday());
$contactEntity->setKostenstellung((string)$contact->getLayouterData()->getKst()); $contactEntity->setKostenstellung((string) $contact->getLayouterData()->getKst());
$contactEntity->setState((string)$contact->getLayouterData()->getState()); $contactEntity->setState((string) $contact->getLayouterData()->getState());
$contactEntity->setDestrict((string)$contact->getLayouterData()->getDistrict()); $contactEntity->setDistrict((string) $contact->getLayouterData()->getDistrict());
$contactEntity->setPhoneAreaCode((string)$contact->getLayouterData()->getPhoneAreaCode()); $contactEntity->setPhoneAreaCode((string) $contact->getLayouterData()->getPhoneAreaCode());
$contactEntity->setPhoneAppendix((string)$contact->getLayouterData()->getPhoneAppendix()); $contactEntity->setPhoneAppendix((string) $contact->getLayouterData()->getPhoneAppendix());
$contactEntity->setPhone((string)$contact->getLayouterData()->getPhone()); $contactEntity->setPhone((string) $contact->getLayouterData()->getPhone());
$contactEntity->setPhonePrefix((string)$contact->getLayouterData()->getPhonePrefix()); $contactEntity->setPhonePrefix((string) $contact->getLayouterData()->getPhonePrefix());
$contactEntity->setMobileAreaCode((string)$contact->getLayouterData()->getMobileAreaCode()); $contactEntity->setMobileAreaCode((string) $contact->getLayouterData()->getMobileAreaCode());
$contactEntity->setMobileAppendix((string)$contact->getLayouterData()->getMobileAppendix()); $contactEntity->setMobileAppendix((string) $contact->getLayouterData()->getMobileAppendix());
$contactEntity->setMobile((string)$contact->getLayouterData()->getMobile()); $contactEntity->setMobile((string) $contact->getLayouterData()->getMobile());
$contactEntity->setMobilePrefix((string)$contact->getLayouterData()->getMobilePrefix()); $contactEntity->setMobilePrefix((string) $contact->getLayouterData()->getMobilePrefix());
$contactEntity->setFaxAreaCode((string)$contact->getLayouterData()->getFaxAreaCode()); $contactEntity->setFaxAreaCode((string) $contact->getLayouterData()->getFaxAreaCode());
$contactEntity->setFaxPrefix((string)$contact->getLayouterData()->getFaxPrefix()); $contactEntity->setFaxPrefix((string) $contact->getLayouterData()->getFaxPrefix());
$contactEntity->setFax((string)$contact->getLayouterData()->getFax()); $contactEntity->setFax((string) $contact->getLayouterData()->getFax());
$contactEntity->setFaxAppendix((string)$contact->getLayouterData()->getFaxAppendix()); $contactEntity->setFaxAppendix((string) $contact->getLayouterData()->getFaxAppendix());
$contactEntity->setCountry((string)$contact->getCountryCode()); $contactEntity->setCountry((string) $contact->getCountryCode());
$contactEntity->setPosition((string)$contact->getLayouterData()->getPosition()); $contactEntity->setPosition((string) $contact->getLayouterData()->getPosition());
$contactEntity->setFunction((string)$contact->getLayouterData()->getFunction()); $contactEntity->setFunction((string) $contact->getLayouterData()->getFunction());
$contactEntity->setAbteilung((string)$contact->getLayouterData()->getAbteilung()); $contactEntity->setAbteilung((string) $contact->getLayouterData()->getAbteilung());
$contactEntity->setTitle((string)$contact->getLayouterData()->getTitle()); $contactEntity->setTitle((string) $contact->getLayouterData()->getTitle());
$contactEntity->setUstid((string)$contact->getLayouterData()->getUstid()); $contactEntity->setUstid((string) $contact->getLayouterData()->getUstid());
$contactEntity->setEnable($contact->isEnable()); $contactEntity->setEnable($contact->isEnable());
$contactEntity->setLocked($contact->isLocked()); $contactEntity->setLocked($contact->isLocked());
$contactEntity->setCollectingOrders($contact->isCollectingOrders()); $contactEntity->setCollectingOrders($contact->isCollectingOrders());
@ -107,7 +117,7 @@ class Contact
for ($i = 1; $i <= 24; $i++) { for ($i = 1; $i <= 24; $i++) {
$setMethod = 'setCustom' . $i; $setMethod = 'setCustom' . $i;
$getMethod = 'getCustom'. $i; $getMethod = 'getCustom' . $i;
if (method_exists($contactDoc, $setMethod) && method_exists($contact, $getMethod)) { if (method_exists($contactDoc, $setMethod) && method_exists($contact, $getMethod)) {
$contactDoc->$setMethod($contact->$getMethod()); $contactDoc->$setMethod($contact->$getMethod());
@ -118,7 +128,9 @@ class Contact
$roles = []; $roles = [];
/** @var Role $role */ /** @var Role $role */
foreach ($contact->getRoles() as $role) { foreach ($contact->getRoles() as $role) {
$role = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Role')->findOneByUid($role->getId()); $role = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Role')
->findOneByUid($role->getId());
$roles[] = $role; $roles[] = $role;
} }
$contactEntity->setRolesForm($roles); $contactEntity->setRolesForm($roles);
@ -133,9 +145,13 @@ class Contact
$contact->setUuid($contactEntity->getUuid()); $contact->setUuid($contactEntity->getUuid());
} }
public function fromDb(\PSC\Shop\ContactBundle\Model\Contact $contact, \PSC\Shop\EntityBundle\Entity\Contact $contactEntity): void public function fromDb(
{ \PSC\Shop\ContactBundle\Model\Contact $contact,
$contactDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)->findOneBy(['uid' => $contactEntity->getUid()]); \PSC\Shop\EntityBundle\Entity\Contact $contactEntity,
): void {
$contactDoc = $this->documentManager
->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)
->findOneBy(['uid' => $contactEntity->getUid()]);
if (!$contactDoc) { if (!$contactDoc) {
$contactDoc = new \PSC\Shop\EntityBundle\Document\Contact(); $contactDoc = new \PSC\Shop\EntityBundle\Document\Contact();
$contactDoc->setUid($contactEntity->getUid()); $contactDoc->setUid($contactEntity->getUid());
@ -147,91 +163,90 @@ class Contact
} }
$contact->setAccount($account); $contact->setAccount($account);
$contact->setUuid((string)$contactEntity->getUuid()); $contact->setUuid((string) $contactEntity->getUuid());
$contact->setEmail((string)$contactEntity->getEmail()); $contact->setEmail((string) $contactEntity->getEmail());
$contact->setUid((int)$contactEntity->getUid()); $contact->setUid((int) $contactEntity->getUid());
$contact->setUsername((string)$contactEntity->getEmail()); $contact->setUsername((string) $contactEntity->getEmail());
$contact->setCreated($contactEntity->getCreatedAt()); $contact->setCreated($contactEntity->getCreatedAt());
$contact->setUpdated($contactEntity->getUpdatedAt()); $contact->setUpdated($contactEntity->getUpdatedAt());
$contact->setCustomerNumber((string)$contactDoc->getKundenNr()); $contact->setCustomerNumber((string) $contactDoc->getKundenNr());
$contact->setLocked((bool)$contactEntity->isLocked()); $contact->setLocked((bool) $contactEntity->isLocked());
$contact->setEnable((bool)$contactEntity->isEnabled()); $contact->setEnable((bool) $contactEntity->isEnabled());
$contact->setCollectingOrders((bool)$contactEntity->getCollectingOrders()); $contact->setCollectingOrders((bool) $contactEntity->getCollectingOrders());
$contact->setAccountType($contactDoc->getAccountType()); $contact->setAccountType($contactDoc->getAccountType());
$contact->setCustom1((string)$contactDoc->getCustom1()); $contact->setCustom1((string) $contactDoc->getCustom1());
$contact->setCustom2((string)$contactDoc->getCustom2()); $contact->setCustom2((string) $contactDoc->getCustom2());
$contact->setCustom3((string)$contactDoc->getCustom3()); $contact->setCustom3((string) $contactDoc->getCustom3());
$contact->setCustom4((string)$contactDoc->getCustom4()); $contact->setCustom4((string) $contactDoc->getCustom4());
$contact->setCustom5((string)$contactDoc->getCustom5()); $contact->setCustom5((string) $contactDoc->getCustom5());
$contact->setCustom6((string)$contactDoc->getCustom6()); $contact->setCustom6((string) $contactDoc->getCustom6());
$contact->setCustom7((string)$contactDoc->getCustom7()); $contact->setCustom7((string) $contactDoc->getCustom7());
$contact->setCustom8((string)$contactDoc->getCustom8()); $contact->setCustom8((string) $contactDoc->getCustom8());
$contact->setCustom9((string)$contactDoc->getCustom9()); $contact->setCustom9((string) $contactDoc->getCustom9());
$contact->setCustom10((string)$contactDoc->getCustom10()); $contact->setCustom10((string) $contactDoc->getCustom10());
$contact->setCustom11((string)$contactDoc->getCustom11()); $contact->setCustom11((string) $contactDoc->getCustom11());
$contact->setCustom12((string)$contactDoc->getCustom12()); $contact->setCustom12((string) $contactDoc->getCustom12());
$contact->setCustom13((string)$contactDoc->getCustom13()); $contact->setCustom13((string) $contactDoc->getCustom13());
$contact->setCustom14((string)$contactDoc->getCustom14()); $contact->setCustom14((string) $contactDoc->getCustom14());
$contact->setCustom15((string)$contactDoc->getCustom15()); $contact->setCustom15((string) $contactDoc->getCustom15());
$contact->setCustom16((string)$contactDoc->getCustom16()); $contact->setCustom16((string) $contactDoc->getCustom16());
$contact->setCustom17((string)$contactDoc->getCustom17()); $contact->setCustom17((string) $contactDoc->getCustom17());
$contact->setCustom18((string)$contactDoc->getCustom18()); $contact->setCustom18((string) $contactDoc->getCustom18());
$contact->setCustom19((string)$contactDoc->getCustom19()); $contact->setCustom19((string) $contactDoc->getCustom19());
$contact->setCustom20((string)$contactDoc->getCustom20()); $contact->setCustom20((string) $contactDoc->getCustom20());
$contact->setCustom21((string)$contactDoc->getCustom21()); $contact->setCustom21((string) $contactDoc->getCustom21());
$contact->setCustom22((string)$contactDoc->getCustom22()); $contact->setCustom22((string) $contactDoc->getCustom22());
$contact->setCustom23((string)$contactDoc->getCustom23()); $contact->setCustom23((string) $contactDoc->getCustom23());
$contact->setCustom24((string)$contactDoc->getCustom24()); $contact->setCustom24((string) $contactDoc->getCustom24());
$contact->setCountryCode((string)$contactEntity->getCountry()); $contact->setCountryCode((string) $contactEntity->getCountry());
$contact->getLayouterData()->setCompany((string)$contactEntity->getCompany()); $contact->getLayouterData()->setCompany((string) $contactEntity->getCompany());
$contact->getLayouterData()->setCompany2((string)$contactEntity->getCompany2()); $contact->getLayouterData()->setCompany2((string) $contactEntity->getCompany2());
$contact->getLayouterData()->setFirstname((string)$contactEntity->getFirstname()); $contact->getLayouterData()->setFirstname((string) $contactEntity->getFirstname());
$contact->getLayouterData()->setLastname((string)$contactEntity->getLastname()); $contact->getLayouterData()->setLastname((string) $contactEntity->getLastname());
$contact->getLayouterData()->setStreet((string)$contactEntity->getStreet()); $contact->getLayouterData()->setStreet((string) $contactEntity->getStreet());
$contact->getLayouterData()->setHouseNumber((string)$contactEntity->getHouseNumber()); $contact->getLayouterData()->setHouseNumber((string) $contactEntity->getHouseNumber());
$contact->getLayouterData()->setZip((string)$contactEntity->getZip()); $contact->getLayouterData()->setZip((string) $contactEntity->getZip());
$contact->getLayouterData()->setCity((string)$contactEntity->getCity()); $contact->getLayouterData()->setCity((string) $contactEntity->getCity());
$contact->getLayouterData()->setHomepage((string)$contactEntity->getHomepage()); $contact->getLayouterData()->setHomepage((string) $contactEntity->getHomepage());
$contact->getLayouterData()->setPhoneAppendix((string)$contactEntity->getPhoneAppendix()); $contact->getLayouterData()->setPhoneAppendix((string) $contactEntity->getPhoneAppendix());
$contact->getLayouterData()->setPhoneAreaCode((string)$contactEntity->getPhoneAreaCode()); $contact->getLayouterData()->setPhoneAreaCode((string) $contactEntity->getPhoneAreaCode());
$contact->getLayouterData()->setPhonePrefix((string)$contactEntity->getPhonePrefix()); $contact->getLayouterData()->setPhonePrefix((string) $contactEntity->getPhonePrefix());
$contact->getLayouterData()->setPhone((string)$contactEntity->getPhone()); $contact->getLayouterData()->setPhone((string) $contactEntity->getPhone());
$contact->getLayouterData()->setMobileAppendix((string)$contactEntity->getMobileAppendix()); $contact->getLayouterData()->setMobileAppendix((string) $contactEntity->getMobileAppendix());
$contact->getLayouterData()->setMobileAreaCode((string)$contactEntity->getMobileAreaCode()); $contact->getLayouterData()->setMobileAreaCode((string) $contactEntity->getMobileAreaCode());
$contact->getLayouterData()->setMobilePrefix((string)$contactEntity->getMobilePrefix()); $contact->getLayouterData()->setMobilePrefix((string) $contactEntity->getMobilePrefix());
$contact->getLayouterData()->setMobile((string)$contactEntity->getMobile()); $contact->getLayouterData()->setMobile((string) $contactEntity->getMobile());
$contact->getLayouterData()->setFaxAppendix((string)$contactEntity->getFaxAppendix()); $contact->getLayouterData()->setFaxAppendix((string) $contactEntity->getFaxAppendix());
$contact->getLayouterData()->setFaxAreaCode((string)$contactEntity->getFaxAreaCode()); $contact->getLayouterData()->setFaxAreaCode((string) $contactEntity->getFaxAreaCode());
$contact->getLayouterData()->setFaxPrefix((string)$contactEntity->getFaxPrefix()); $contact->getLayouterData()->setFaxPrefix((string) $contactEntity->getFaxPrefix());
$contact->getLayouterData()->setFax((string)$contactEntity->getFax()); $contact->getLayouterData()->setFax((string) $contactEntity->getFax());
$contact->getLayouterData()->setUstid((string) $contactEntity->getUstid());
$contact->getLayouterData()->setUstid((string)$contactEntity->getUstid()); $contact->getLayouterData()->setFunction((string) $contactEntity->getFunction());
$contact->getLayouterData()->setFunction((string)$contactEntity->getFunction()); $contact->getLayouterData()->setPosition((string) $contactEntity->getPosition());
$contact->getLayouterData()->setPosition((string)$contactEntity->getPosition()); $contact->getLayouterData()->setAbteilung((string) $contactEntity->getAbteilung());
$contact->getLayouterData()->setAbteilung((string)$contactEntity->getAbteilung()); $contact->getLayouterData()->setTitle((string) $contactEntity->getTitle());
$contact->getLayouterData()->setTitle((string)$contactEntity->getTitle());
$contact->getLayouterData()->setSettings($contactDoc->getLayouterSettings()); $contact->getLayouterData()->setSettings($contactDoc->getLayouterSettings());
$contact->getLayouterData()->setCountryCode((string)$contactDoc->getLayouterCountryCode()); $contact->getLayouterData()->setCountryCode((string) $contactDoc->getLayouterCountryCode());
$contact->getLayouterData()->setCountryName((string)$contactDoc->getLayouterCountryName()); $contact->getLayouterData()->setCountryName((string) $contactDoc->getLayouterCountryName());
$contact->getLayouterData()->setBirthday((string)$contactEntity->getBirthday()); $contact->getLayouterData()->setBirthday((string) $contactEntity->getBirthday());
$contact->getLayouterData()->setKst((string)$contactEntity->getKostenstellung()); $contact->getLayouterData()->setKst((string) $contactEntity->getKostenstellung());
$contact->getLayouterData()->setUstid((string)$contactEntity->getUstid()); $contact->getLayouterData()->setUstid((string) $contactEntity->getUstid());
$contact->getLayouterData()->setDistrict((string)$contactEntity->getDestrict()); $contact->getLayouterData()->setDistrict((string) $contactEntity->getDistrict());
$contact->getLayouterData()->setState((string)$contactEntity->getState()); $contact->getLayouterData()->setState((string) $contactEntity->getState());
$contact->getLayouterData()->setEmail((string)$contactDoc->getLayouterEmail()); $contact->getLayouterData()->setEmail((string) $contactDoc->getLayouterEmail());
if ($contactEntity->getImage() != "") { if ($contactEntity->getImage() != '') {
$media = $this->mediaManager->getMedia($contactEntity->getImage()); $media = $this->mediaManager->getMedia($contactEntity->getImage());
if ($media) { if ($media) {
$mediaModel = new Media(); $mediaModel = new Media();
@ -239,7 +254,7 @@ class Contact
$contact->getLayouterData()->setImage1($mediaModel); $contact->getLayouterData()->setImage1($mediaModel);
} }
} }
if ($contactEntity->getImage2() != "") { if ($contactEntity->getImage2() != '') {
$media = $this->mediaManager->getMedia($contactEntity->getImage2()); $media = $this->mediaManager->getMedia($contactEntity->getImage2());
if ($media) { if ($media) {
$mediaModel = new Media(); $mediaModel = new Media();

View File

@ -13,9 +13,9 @@
namespace PSC\Shop\EntityBundle\Document; namespace PSC\Shop\EntityBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field; use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;
use Doctrine\ODM\MongoDB\Mapping\Annotations\Id; use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
#[Document] #[Document]
class Product class Product
@ -272,6 +272,11 @@ class Product
#[Field(type: 'bool')] #[Field(type: 'bool')]
protected $uploadProvidedDownload = false; protected $uploadProvidedDownload = false;
#[Field(type: 'string')]
protected null|string $aribaUnitOfMeasure = '';
#[Field(type: 'string')]
protected null|string $aribaUNSPSC = '';
/** /**
* @var string $uploadProvidedFile; * @var string $uploadProvidedFile;
@ -289,7 +294,7 @@ class Product
*/ */
public function getSalesUnit(): int public function getSalesUnit(): int
{ {
return (int)$this->salesUnit; return (int) $this->salesUnit;
} }
/** /**
@ -305,7 +310,7 @@ class Product
*/ */
public function getBaseUnit(): int public function getBaseUnit(): int
{ {
return (int)$this->baseUnit; return (int) $this->baseUnit;
} }
/** /**
@ -321,7 +326,7 @@ class Product
*/ */
public function getPackagingUnit(): int public function getPackagingUnit(): int
{ {
return (int)$this->packagingUnit; return (int) $this->packagingUnit;
} }
/** /**
@ -763,14 +768,11 @@ class Product
return $this->collectingOrdersAccountFilter; return $this->collectingOrdersAccountFilter;
} }
/** /**
* @return array * @return array
*/ */
public function getPluginSettings() public function getPluginSettings()
{ {
return $this->pluginSettings; return $this->pluginSettings;
} }
@ -790,16 +792,16 @@ class Product
*/ */
public function setPluginSettingModule($module, $key, $value) public function setPluginSettingModule($module, $key, $value)
{ {
$this->pluginSettings[$module ] [$key] = $value; $this->pluginSettings[$module][$key] = $value;
} }
public function getPluginSettingModule($module, $key) public function getPluginSettingModule($module, $key)
{ {
if (!isset($this->pluginSettings[$module ]) || !isset($this->pluginSettings[$module ] [$key])) { if (!isset($this->pluginSettings[$module]) || !isset($this->pluginSettings[$module][$key])) {
return null; return null;
} }
return $this->pluginSettings[$module ] [$key]; return $this->pluginSettings[$module][$key];
} }
/** /**
@ -879,7 +881,7 @@ class Product
*/ */
public function getUploadFromLatestOrderInitalStatus(): int public function getUploadFromLatestOrderInitalStatus(): int
{ {
return (int)$this->uploadFromLatestOrderInitalStatus; return (int) $this->uploadFromLatestOrderInitalStatus;
} }
/** /**
@ -895,7 +897,7 @@ class Product
*/ */
public function isUploadFromLatestOrder(): bool public function isUploadFromLatestOrder(): bool
{ {
return (bool)$this->uploadFromLatestOrder; return (bool) $this->uploadFromLatestOrder;
} }
/** /**
@ -911,7 +913,7 @@ class Product
*/ */
public function getUploadProvidedInitalStatus(): int public function getUploadProvidedInitalStatus(): int
{ {
return (int)$this->uploadProvidedInitalStatus; return (int) $this->uploadProvidedInitalStatus;
} }
/** /**
@ -927,7 +929,7 @@ class Product
*/ */
public function isUploadProvided(): bool public function isUploadProvided(): bool
{ {
return (bool)$this->uploadProvided; return (bool) $this->uploadProvided;
} }
/** /**
@ -943,7 +945,7 @@ class Product
*/ */
public function getUploadProvidedFile(): string public function getUploadProvidedFile(): string
{ {
return (string)$this->uploadProvidedFile; return (string) $this->uploadProvidedFile;
} }
/** /**
@ -1024,11 +1026,31 @@ class Product
public function isRawText(): bool public function isRawText(): bool
{ {
return (bool)$this->rawText; return (bool) $this->rawText;
} }
public function setRawText(bool $var): void public function setRawText(bool $var): void
{ {
$this->rawText = $var; $this->rawText = $var;
} }
public function setAribaUNSPSC(null|string $aribaUNSPSC): void
{
$this->aribaUNSPSC = $aribaUNSPSC;
}
public function getAribaUNSPSC(): null|string
{
return $this->aribaUNSPSC;
}
public function setAribaUnitOfMeasure(null|string $aribaUnitOfMeasure): void
{
$this->aribaUnitOfMeasure = $aribaUnitOfMeasure;
}
public function getAribaUnitOfMeasure(): null|string
{
return $this->aribaUnitOfMeasure;
}
} }

View File

@ -13,8 +13,8 @@
namespace PSC\Shop\EntityBundle\Entity; namespace PSC\Shop\EntityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/** /**
* Account * Account
@ -34,214 +34,214 @@ class Account
protected $priceFactor; protected $priceFactor;
protected $extraSettings; protected $extraSettings;
/** /**
* Id der Firma * Id der Firma
* *
* @var integer * @var integer
*/ */
#[ORM\Column(name: 'id', type: 'integer')] #[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')] #[ORM\GeneratedValue(strategy: 'AUTO')]
protected $uid; protected $uid;
/** /**
* Titel der Firma * Titel der Firma
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'company', type: 'string', length: 255)] #[ORM\Column(name: 'company', type: 'string', length: 255)]
protected $title; protected $title;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'appendix', type: 'string', length: 255)] #[ORM\Column(name: 'appendix', type: 'string', length: 255)]
protected $appendix; protected $appendix;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'street', type: 'string', length: 255)] #[ORM\Column(name: 'street', type: 'string', length: 255)]
protected $street; protected $street;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'destrict', type: 'string', length: 255)] #[ORM\Column(name: 'destrict', type: 'string', length: 255)]
protected $destrict; protected $district;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'zip', type: 'string', length: 255)] #[ORM\Column(name: 'zip', type: 'string', length: 255)]
protected $zip; protected $zip;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'city', type: 'string', length: 255)] #[ORM\Column(name: 'city', type: 'string', length: 255)]
protected $city; protected $city;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'state', type: 'string', length: 255)] #[ORM\Column(name: 'state', type: 'string', length: 255)]
protected $state; protected $state;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'country', type: 'string', length: 255)] #[ORM\Column(name: 'country', type: 'string', length: 255)]
protected $country; protected $country;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'email', type: 'string', length: 255)] #[ORM\Column(name: 'email', type: 'string', length: 255)]
protected $email; protected $email;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'house_number', type: 'string', length: 255)] #[ORM\Column(name: 'house_number', type: 'string', length: 255)]
protected $houseNumber; protected $houseNumber;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'homepage', type: 'string', length: 255)] #[ORM\Column(name: 'homepage', type: 'string', length: 255)]
protected $homepage; protected $homepage;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'phone_lv', type: 'string', length: 255)] #[ORM\Column(name: 'phone_lv', type: 'string', length: 255)]
protected $phoneAreaCode; protected $phoneAreaCode;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'phone_vorwahl', type: 'string', length: 255)] #[ORM\Column(name: 'phone_vorwahl', type: 'string', length: 255)]
protected $phonePrefix; protected $phonePrefix;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'phone', type: 'string', length: 255)] #[ORM\Column(name: 'phone', type: 'string', length: 255)]
protected $phone; protected $phone;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'phone_durchwahl', type: 'string', length: 255)] #[ORM\Column(name: 'phone_durchwahl', type: 'string', length: 255)]
protected $phoneAppendix; protected $phoneAppendix;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'mobile_lv', type: 'string', length: 255)] #[ORM\Column(name: 'mobile_lv', type: 'string', length: 255)]
protected $mobileAreaCode; protected $mobileAreaCode;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'mobile_vorwahl', type: 'string', length: 255)] #[ORM\Column(name: 'mobile_vorwahl', type: 'string', length: 255)]
protected $mobilePrefix; protected $mobilePrefix;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'mobile', type: 'string', length: 255)] #[ORM\Column(name: 'mobile', type: 'string', length: 255)]
protected $mobile; protected $mobile;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'mobile_durchwahl', type: 'string', length: 255)] #[ORM\Column(name: 'mobile_durchwahl', type: 'string', length: 255)]
protected $mobileAppendix; protected $mobileAppendix;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'fax_lv', type: 'string', length: 255)] #[ORM\Column(name: 'fax_lv', type: 'string', length: 255)]
protected $faxAreaCode; protected $faxAreaCode;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'fax_vorwahl', type: 'string', length: 255)] #[ORM\Column(name: 'fax_vorwahl', type: 'string', length: 255)]
protected $faxPrefix; protected $faxPrefix;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'fax', type: 'string', length: 255)] #[ORM\Column(name: 'fax', type: 'string', length: 255)]
protected $fax; protected $fax;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'fax_durchwahl', type: 'string', length: 255)] #[ORM\Column(name: 'fax_durchwahl', type: 'string', length: 255)]
protected $faxAppendix; protected $faxAppendix;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'alternativ_lv', type: 'string', length: 255)] #[ORM\Column(name: 'alternativ_lv', type: 'string', length: 255)]
protected $alternativAreaCode; protected $alternativAreaCode;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'alternativ_type', type: 'string', length: 255)] #[ORM\Column(name: 'alternativ_type', type: 'string', length: 255)]
protected $alternativType; protected $alternativType;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'alternativ', type: 'string', length: 255)] #[ORM\Column(name: 'alternativ', type: 'string', length: 255)]
protected $alternativ; protected $alternativ;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'alternativ_durchwahl', type: 'string', length: 255)] #[ORM\Column(name: 'alternativ_durchwahl', type: 'string', length: 255)]
protected $alternativAppendix; protected $alternativAppendix;
/** /**
* Vorgänger der Firma * Vorgänger der Firma
*/ */
#[ORM\ManyToOne(targetEntity: 'Account', inversedBy: 'children')] #[ORM\ManyToOne(targetEntity: 'Account', inversedBy: 'children')]
#[ORM\JoinColumn(name: 'filiale_id', referencedColumnName: 'id')] #[ORM\JoinColumn(name: 'filiale_id', referencedColumnName: 'id')]
protected $parent; protected $parent;
/** /**
* Vorgänger der Firma * Vorgänger der Firma
* *
* @var int * @var int
*/ */
#[ORM\Column(name: 'filiale_id', type: 'integer', nullable: true)] #[ORM\Column(name: 'filiale_id', type: 'integer', nullable: true)]
protected $parentId = 0; protected $parentId = 0;
/** /**
* Unterfirmen der Firma * Unterfirmen der Firma
*/ */
#[ORM\OneToMany(targetEntity: 'Account', mappedBy: 'parent')] #[ORM\OneToMany(targetEntity: 'Account', mappedBy: 'parent')]
protected $children; protected $children;
/** /**
* Gesperter Account * Gesperter Account
* *
* @var boolean * @var boolean
*/ */
#[ORM\Column(name: 'locked', type: 'boolean')] #[ORM\Column(name: 'locked', type: 'boolean')]
protected $locked; protected $locked;
/** /**
* Benutze Account als Rechnungsadresse * Benutze Account als Rechnungsadresse
* *
* @var boolean * @var boolean
*/ */
#[ORM\Column(name: 'use_account_as_invoice', type: 'boolean')] #[ORM\Column(name: 'use_account_as_invoice', type: 'boolean')]
protected $useAccountAsInvoiceAddress; protected $useAccountAsInvoiceAddress;
/** /**
* Install * Install
* *
* @var int * @var int
*/ */
#[ORM\ManyToOne(targetEntity: 'Install')] #[ORM\ManyToOne(targetEntity: 'Install')]
#[ORM\JoinColumn(name: 'install_id', referencedColumnName: 'id')] #[ORM\JoinColumn(name: 'install_id', referencedColumnName: 'id')]
protected $install; protected $install;
@ -276,171 +276,171 @@ class Account
#[ORM\ManyToMany(targetEntity: 'Productgroup', inversedBy: 'accounts')] #[ORM\ManyToMany(targetEntity: 'Productgroup', inversedBy: 'accounts')]
public $productGroups; public $productGroups;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'bank_name', type: 'string', length: 255)] #[ORM\Column(name: 'bank_name', type: 'string', length: 255)]
protected $bankKtoName; protected $bankKtoName;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'bank_kto', type: 'string', length: 255)] #[ORM\Column(name: 'bank_kto', type: 'string', length: 255)]
protected $bankKTO; protected $bankKTO;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'bank_blz', type: 'string', length: 255)] #[ORM\Column(name: 'bank_blz', type: 'string', length: 255)]
protected $bankBLZ; protected $bankBLZ;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'bank_iban', type: 'string', length: 255)] #[ORM\Column(name: 'bank_iban', type: 'string', length: 255)]
protected $bankIban; protected $bankIban;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'bank_bic', type: 'string', length: 255)] #[ORM\Column(name: 'bank_bic', type: 'string', length: 255)]
protected $bankBic; protected $bankBic;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'bank_bank_name', type: 'string', length: 255)] #[ORM\Column(name: 'bank_bank_name', type: 'string', length: 255)]
protected $bankName; protected $bankName;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'usid', type: 'string', length: 255)] #[ORM\Column(name: 'usid', type: 'string', length: 255)]
protected $ustid; protected $ustid;
/** /**
* *
* @var int * @var int
*/ */
#[ORM\Column(name: 'typ', type: 'integer', length: 2)] #[ORM\Column(name: 'typ', type: 'integer', length: 2)]
protected $typ; protected $typ;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'logo1', type: 'string', length: 255)] #[ORM\Column(name: 'logo1', type: 'string', length: 255)]
protected $image; protected $image;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'template_switch', type: 'string', length: 255)] #[ORM\Column(name: 'template_switch', type: 'string', length: 255)]
protected $templateSwitch; protected $templateSwitch;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'informations', type: 'string')] #[ORM\Column(name: 'informations', type: 'string')]
protected $information; protected $information;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'mega_code', type: 'string', length: 255)] #[ORM\Column(name: 'mega_code', type: 'string', length: 255)]
protected $megaCode; protected $megaCode;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'hotel_name', type: 'string', length: 255)] #[ORM\Column(name: 'hotel_name', type: 'string', length: 255)]
protected $hotelName; protected $hotelName;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'sub_hotel_name', type: 'string', length: 255)] #[ORM\Column(name: 'sub_hotel_name', type: 'string', length: 255)]
protected $subHotelName; protected $subHotelName;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'email_gm', type: 'string', length: 255)] #[ORM\Column(name: 'email_gm', type: 'string', length: 255)]
protected $emailGm; protected $emailGm;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'zimmer', type: 'string', length: 255)] #[ORM\Column(name: 'zimmer', type: 'string', length: 255)]
protected $room; protected $room;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'gz', type: 'string', length: 255)] #[ORM\Column(name: 'gz', type: 'string', length: 255)]
protected $gz; protected $gz;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'gf', type: 'string', length: 255)] #[ORM\Column(name: 'gf', type: 'string', length: 255)]
protected $gf; protected $gf;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'gsitz', type: 'string', length: 255)] #[ORM\Column(name: 'gsitz', type: 'string', length: 255)]
protected $gSitz; protected $gSitz;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'handelsregister', type: 'string', length: 255)] #[ORM\Column(name: 'handelsregister', type: 'string', length: 255)]
protected $handelsRegister; protected $handelsRegister;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'hrb', type: 'string', length: 255)] #[ORM\Column(name: 'hrb', type: 'string', length: 255)]
protected $hrb; protected $hrb;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'vorsitz', type: 'string', length: 255)] #[ORM\Column(name: 'vorsitz', type: 'string', length: 255)]
protected $vorsitz; protected $vorsitz;
/** /**
* *
* @var int * @var int
*/ */
#[ORM\Column(name: 'anrede1', type: 'integer', length: 2)] #[ORM\Column(name: 'anrede1', type: 'integer', length: 2)]
protected $salutation1; protected $salutation1;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'firstname1', type: 'string', length: 255)] #[ORM\Column(name: 'firstname1', type: 'string', length: 255)]
protected $firstname1; protected $firstname1;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'lastname1', type: 'string', length: 255)] #[ORM\Column(name: 'lastname1', type: 'string', length: 255)]
protected $lastname1; protected $lastname1;
/** /**
* *
* @var int * @var int
*/ */
#[ORM\Column(name: 'anrede2', type: 'integer', length: 2)] #[ORM\Column(name: 'anrede2', type: 'integer', length: 2)]
protected $salutation2; protected $salutation2;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'firstname2', type: 'string', length: 255)] #[ORM\Column(name: 'firstname2', type: 'string', length: 255)]
protected $firstname2; protected $firstname2;
/** /**
* *
* @var string * @var string
*/ */
#[ORM\Column(name: 'lastname2', type: 'string', length: 255)] #[ORM\Column(name: 'lastname2', type: 'string', length: 255)]
protected $lastname2; protected $lastname2;
@ -450,11 +450,10 @@ class Account
#[ORM\ManyToMany(targetEntity: 'Cms', inversedBy: 'accounts')] #[ORM\ManyToMany(targetEntity: 'Cms', inversedBy: 'accounts')]
public $cms; public $cms;
/** /**
* Constructor * Constructor
* @param null $id * @param null $id
*/ */
public function __construct($id = null) public function __construct($id = null)
{ {
$this->children = new ArrayCollection(); $this->children = new ArrayCollection();
@ -530,9 +529,9 @@ class Account
*/ */
public function getArray() public function getArray()
{ {
return array( return [
'title' => $this->getTitle() 'title' => $this->getTitle(),
); ];
} }
/** /**
@ -671,20 +670,14 @@ class Account
$this->street = $street; $this->street = $street;
} }
/** public function getDistrict(): string
* @return string
*/
public function getDestrict()
{ {
return $this->destrict; return (string) $this->district;
} }
/** public function setDistrict($district): void
* @param string $destrict
*/
public function setDestrict($destrict)
{ {
$this->destrict = $destrict; $this->district = $district;
} }
/** /**

View File

@ -187,12 +187,12 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
* *
* @param string $email Emailadresse * @param string $email Emailadresse
*/ */
public function __construct($email = "") public function __construct($email = '')
{ {
$this->createdAt = new \DateTime(); $this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime(); $this->updatedAt = new \DateTime();
$this->uuid = Uuid::uuid4(); $this->uuid = Uuid::uuid4();
if ($email == "") { if ($email == '') {
$this->setEmail($this->uuid); $this->setEmail($this->uuid);
} else { } else {
$this->setEmail($email); $this->setEmail($email);
@ -251,7 +251,7 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
$this->username = $username; $this->username = $username;
} }
public function getPassword(): ?string public function getPassword(): null|string
{ {
return $this->password; return $this->password;
} }
@ -263,7 +263,7 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
*/ */
public function setPassword($password) public function setPassword($password)
{ {
if ($password != "") { if ($password != '') {
$this->password = $password; $this->password = $password;
} }
} }
@ -280,13 +280,12 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
public function asArray() public function asArray()
{ {
return array( return [
'id' => $this->getId(), 'id' => $this->getId(),
'email' => $this->getUsername() 'email' => $this->getUsername(),
); ];
} }
/** /**
* Returns the salt that was originally used to encode the password. * Returns the salt that was originally used to encode the password.
* *
@ -339,6 +338,7 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
* *
* @return string * @return string
*/ */
#[\Override]
public function __toString() public function __toString()
{ {
return $this->getEmail(); return $this->getEmail();
@ -474,7 +474,7 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
* @var string * @var string
*/ */
#[ORM\Column(name: 'self_destrict', type: 'string', length: 255, nullable: true)] #[ORM\Column(name: 'self_destrict', type: 'string', length: 255, nullable: true)]
private $destrict; private $district;
/** /**
* @var string * @var string
@ -508,7 +508,7 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
#[ORM\Column(name: 'self_foto', type: 'string', length: 255, nullable: true)] #[ORM\Column(name: 'self_foto', type: 'string', length: 255, nullable: true)]
private $image; private $image;
#
#[ORM\Column(name: 'foto', type: 'string', length: 255, nullable: true)] #[ORM\Column(name: 'foto', type: 'string', length: 255, nullable: true)]
private $image2; private $image2;
@ -922,7 +922,6 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
$this->ustid = $ustid; $this->ustid = $ustid;
} }
/** /**
* @return ContactAddress * @return ContactAddress
*/ */
@ -1062,16 +1061,16 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
public function anonymisieren() public function anonymisieren()
{ {
$this->setFirstname("anonym"); $this->setFirstname('anonym');
$this->setLastname("anonym"); $this->setLastname('anonym');
$this->setAbteilung("anonym"); $this->setAbteilung('anonym');
$this->setStreet("anonym"); $this->setStreet('anonym');
$this->setHouseNumber("anonym"); $this->setHouseNumber('anonym');
$this->setZip("anonym"); $this->setZip('anonym');
$this->setCity("anonym"); $this->setCity('anonym');
$this->setCountry("anonym"); $this->setCountry('anonym');
$this->setPosition("anonym"); $this->setPosition('anonym');
$this->setPhone("anonym"); $this->setPhone('anonym');
$this->setPhoneAreaCode(''); $this->setPhoneAreaCode('');
$this->setPhonePrefix(''); $this->setPhonePrefix('');
$this->setPhoneAppendix(''); $this->setPhoneAppendix('');
@ -1088,8 +1087,8 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
$this->setName('anonym@anonym.de'); $this->setName('anonym@anonym.de');
$this->setEnable(false); $this->setEnable(false);
$this->setPassword('anonym'); $this->setPassword('anonym');
$this->setImage(""); $this->setImage('');
$this->setImage2(""); $this->setImage2('');
} }
/** /**
@ -1627,17 +1626,14 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
/** /**
* @return string * @return string
*/ */
public function getDestrict() public function getDistrict()
{ {
return $this->destrict; return $this->district;
} }
/** public function setDistrict($district)
* @param string $destrict
*/
public function setDestrict($destrict)
{ {
$this->destrict = $destrict; $this->district = $district;
} }
/** /**
@ -1783,6 +1779,7 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
{ {
$this->abteilung = $abteilung; $this->abteilung = $abteilung;
} }
/** /**
* @return string * @return string
*/ */
@ -2341,28 +2338,28 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
public function getRolesAsString() public function getRolesAsString()
{ {
$temp = array(); $temp = [];
foreach ($this->roles as $row) { foreach ($this->roles as $row) {
if ($row->getLevel() == 10 || $row->getLevel() == 20) { if ($row->getLevel() == 10 || $row->getLevel() == 20) {
$temp[] = "ROLE_USER"; $temp[] = 'ROLE_USER';
} }
if ($row->getLevel() == 25) { if ($row->getLevel() == 25) {
$temp[] = "ROLE_PRODUCT_EDITOR"; $temp[] = 'ROLE_PRODUCT_EDITOR';
} }
if ($row->getLevel() == 30) { if ($row->getLevel() == 30) {
$temp[] = "ROLE_SHOP_OPERATOR"; $temp[] = 'ROLE_SHOP_OPERATOR';
} }
if ($row->getLevel() == 35) { if ($row->getLevel() == 35) {
$temp[] = "ROLE_PRODUCTION"; $temp[] = 'ROLE_PRODUCTION';
} }
if ($row->getLevel() == 40) { if ($row->getLevel() == 40) {
$temp[] = "ROLE_ADMIN"; $temp[] = 'ROLE_ADMIN';
} }
if ($row->getLevel() == 50) { if ($row->getLevel() == 50) {
$temp[] = "ROLE_SYSTEM_ADMIN"; $temp[] = 'ROLE_SYSTEM_ADMIN';
} }
if (!in_array($row->getLevel(), [10,20,25,30,35,40,50,0])) { if (!in_array($row->getLevel(), [10, 20, 25, 30, 35, 40, 50, 0])) {
$temp[] = $row->getTitle(); $temp[] = $row->getTitle();
} }
} }
@ -2699,7 +2696,7 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
'id' => $this->getId(), 'id' => $this->getId(),
'email' => $this->getEmail(), 'email' => $this->getEmail(),
'password' => $this->getPassword(), 'password' => $this->getPassword(),
'roles' => $this->getRolesForm() 'roles' => $this->getRolesForm(),
]; ];
} }
@ -2709,19 +2706,20 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
$this->setEmail($data['email']); $this->setEmail($data['email']);
$this->setPassword($data['password']); $this->setPassword($data['password']);
$this->setRolesForm($data['roles']); $this->setRolesForm($data['roles']);
} }
#[\Override]
public function serialize() public function serialize()
{ {
return serialize([ return serialize([
'id' => $this->getId(), 'id' => $this->getId(),
'email' => $this->getEmail(), 'email' => $this->getEmail(),
'password' => $this->getPassword(), 'password' => $this->getPassword(),
'roles' => $this->getRolesForm() 'roles' => $this->getRolesForm(),
]); ]);
} }
#[\Override]
public function unserialize($data) public function unserialize($data)
{ {
$unserialized = unserialize($data); $unserialized = unserialize($data);

View File

@ -54,6 +54,9 @@ class Product
protected $weight; protected $weight;
protected $rawText = false; protected $rawText = false;
protected $text; protected $text;
protected null|string $aribaUnitOfMeasure = '';
protected null|string $aribaUNSPSC = '';
/** /**
* @var integer * @var integer
*/ */
@ -127,7 +130,7 @@ class Product
*/ */
public function isUploadProvidedDownload(): bool public function isUploadProvidedDownload(): bool
{ {
return (bool)$this->uploadProvidedDownload; return (bool) $this->uploadProvidedDownload;
} }
/** /**
@ -213,7 +216,6 @@ class Product
#[ORM\Column(name: 'sub_title', type: 'string', length: 255)] #[ORM\Column(name: 'sub_title', type: 'string', length: 255)]
protected $subTitle; protected $subTitle;
/** /**
* Art des Product * Art des Product
* *
@ -885,8 +887,8 @@ class Product
*/ */
public function __construct() public function __construct()
{ {
$this->enable = false; $this->enable = false;
$this->notBuy = false; $this->notBuy = false;
$this->private = false; $this->private = false;
$this->displayNotInOverview = false; $this->displayNotInOverview = false;
$this->uuid = UUID::uuid4(); $this->uuid = UUID::uuid4();
@ -906,48 +908,45 @@ class Product
*/ */
public function getExportArray() public function getExportArray()
{ {
return [
return array( 'id' => (string) $this->getId(),
'id' => (string)$this->getId(), 'uid' => (string) $this->getUID(),
'uid' => (string)$this->getUID(), 'uuid' => (string) $this->getUUID(),
'uuid' => (string)$this->getUUID(), 'title' => (string) $this->getTitle(),
'title' => (string)$this->getTitle(), 'subTitle' => (string) $this->getSubTitle(),
'subTitle' => (string)$this->getSubTitle(), 'textArt' => (string) $this->getTextArt(),
'textArt' => (string)$this->getTextArt(), 'textFormat' => (string) $this->getTextFormat(),
'textFormat' => (string)$this->getTextFormat(), 'nrExtern' => (string) $this->getNrExtern(),
'nrExtern' => (string)$this->getNrExtern(), 'nrIntern' => (string) $this->getNrIntern(),
'nrIntern' => (string)$this->getNrIntern(), 'ablaufDatum' => $this->ablaufDatum == null ? '' : $this->ablaufDatum->format('d.m.Y'),
'ablaufDatum' => ($this->ablaufDatum == null) ? '' : $this->ablaufDatum->format("d.m.Y"), 'ansprechPartner' => (string) $this->ansprechPartner,
'ansprechPartner' => (string)$this->ansprechPartner, 'preis' => (string) $this->getPrice(),
'preis' => (string)$this->getPrice(), 'enable' => (string) $this->isEnable(),
'enable' => (string)$this->isEnable(), 'shopId' => (string) $this->getShop()->getUid(),
'shopId' => (string)$this->getShop()->getUid(), 'productType' => (string) $this->getType(),
'productType' => (string)$this->getType(), 'isStock' => $this->isStock() ? '1' : '0',
'isStock' => $this->isStock() ? "1" : "0", 'stockCount' => (string) $this->getStockCount(),
'stockCount' => (string)$this->getStockCount(), 'stockMinCount' => (string) $this->getStockMinCount(),
'stockMinCount' => (string)$this->getStockMinCount(), 'stockPlace' => (string) $this->getStockPlace(),
'stockPlace' => (string)$this->getStockPlace(), 'stockMaxBuy' => (string) $this->getStockMaxBuy(),
'stockMaxBuy' => (string)$this->getStockMaxBuy(), 'buyed' => (string) $this->getBuyed(),
'buyed' => (string)$this->getBuyed(), 'printPartnerEmail' => (string) $this->getPrintPartnerEmail(),
'printPartnerEmail' => (string)$this->getPrintPartnerEmail(), 'zusatzAbmessung' => (string) $this->getZusatzAbmessung(),
'zusatzAbmessung' => (string)$this->getZusatzAbmessung(), 'zusatzDesigner' => (string) $this->getZusatzDesigner(),
'zusatzDesigner' => (string)$this->getZusatzDesigner(), 'zusatzShipping' => (string) $this->getZusatzShipping(),
'zusatzShipping' => (string)$this->getZusatzShipping(), 'custom1' => (string) $this->getCustom1(),
'custom1' => (string)$this->getCustom1(), 'custom2' => (string) $this->getCustom2(),
'custom2' => (string)$this->getCustom2(), 'custom3' => (string) $this->getCustom3(),
'custom3' => (string)$this->getCustom3(), 'custom4' => (string) $this->getCustom4(),
'custom4' => (string)$this->getCustom4(), 'custom5' => (string) $this->getCustom5(),
'custom5' => (string)$this->getCustom5(), 'custom6' => (string) $this->getCustom6(),
'custom6' => (string)$this->getCustom6(), 'custom7' => (string) $this->getCustom7(),
'custom7' => (string)$this->getCustom7(), 'custom8' => (string) $this->getCustom8(),
'custom8' => (string)$this->getCustom8(), 'custom9' => (string) $this->getCustom9(),
'custom9' => (string)$this->getCustom9(), 'custom10' => (string) $this->getCustom10(),
'custom10' => (string)$this->getCustom10(), 'custom11' => (string) $this->getCustom11(),
'custom11' => (string)$this->getCustom11(), 'custom12' => (string) $this->getCustom12(),
'custom12' => (string)$this->getCustom12(), ];
);
} }
/** /**
@ -975,33 +974,33 @@ class Product
* *
* @return string * @return string
*/ */
#[\Override]
public function __toString() public function __toString()
{ {
return $this->getTitle(); return $this->getTitle();
} }
public function getTitle(): ?string public function getTitle(): null|string
{ {
return $this->title; return $this->title;
} }
public function getTitleSubTitle(): ?string public function getTitleSubTitle(): null|string
{ {
return $this->title . ' ' . $this->subTitle; return $this->title . ' ' . $this->subTitle;
} }
public function setTitle(null|string $title): void
public function setTitle(?string $title): void
{ {
$this->title = $title; $this->title = $title;
} }
public function getSubTitle(): ?string public function getSubTitle(): null|string
{ {
return $this->subTitle; return $this->subTitle;
} }
public function setSubTitle(?string $subTitle): void public function setSubTitle(null|string $subTitle): void
{ {
$this->subTitle = $subTitle; $this->subTitle = $subTitle;
} }
@ -1280,7 +1279,7 @@ class Product
public function hasCalcXml() public function hasCalcXml()
{ {
return ($this->calcXml != "" && strpos($this->calcXml, "artikel") !== false); return $this->calcXml != '' && str_contains($this->calcXml, 'artikel');
} }
/** /**
@ -1320,8 +1319,8 @@ class Product
*/ */
public function getLangData() public function getLangData()
{ {
if ($this->langData == "") { if ($this->langData == '') {
return array(); return [];
} }
return json_decode($this->langData, true); return json_decode($this->langData, true);
} }
@ -1332,7 +1331,7 @@ class Product
public function setLangData($langData) public function setLangData($langData)
{ {
if (!is_array($langData)) { if (!is_array($langData)) {
$langData = array(); $langData = [];
} }
$this->langData = json_encode($langData); $this->langData = json_encode($langData);
} }
@ -1359,7 +1358,7 @@ class Product
public function getPackageFormat() public function getPackageFormat()
{ {
if ($this->packageFormat === null) { if ($this->packageFormat === null) {
return ""; return '';
} }
return $this->packageFormat; return $this->packageFormat;
} }
@ -2841,7 +2840,7 @@ class Product
*/ */
public function getSetConfig(bool $asArray = false) public function getSetConfig(bool $asArray = false)
{ {
if ($this->setConfig != "") { if ($this->setConfig != '') {
$setConfig = json_decode($this->setConfig, $asArray); $setConfig = json_decode($this->setConfig, $asArray);
if (is_array($setConfig) && count($setConfig) > 0) { if (is_array($setConfig) && count($setConfig) > 0) {
@ -2965,7 +2964,7 @@ class Product
*/ */
public function getBaseUnit(): int public function getBaseUnit(): int
{ {
return (int)$this->baseUnit; return (int) $this->baseUnit;
} }
/** /**
@ -2981,7 +2980,7 @@ class Product
*/ */
public function getSalesUnit(): int public function getSalesUnit(): int
{ {
return (int)$this->salesUnit; return (int) $this->salesUnit;
} }
/** /**
@ -2997,7 +2996,7 @@ class Product
*/ */
public function getPackagingUnit(): int public function getPackagingUnit(): int
{ {
return (int)$this->packagingUnit; return (int) $this->packagingUnit;
} }
/** /**
@ -3013,7 +3012,7 @@ class Product
*/ */
public function isUploadFromLatestOrder(): bool public function isUploadFromLatestOrder(): bool
{ {
return (bool)$this->uploadFromLatestOrder; return (bool) $this->uploadFromLatestOrder;
} }
/** /**
@ -3029,7 +3028,7 @@ class Product
*/ */
public function getUploadFromLatestOrderInitalStatus(): int public function getUploadFromLatestOrderInitalStatus(): int
{ {
return (int)$this->uploadFromLatestOrderInitalStatus; return (int) $this->uploadFromLatestOrderInitalStatus;
} }
/** /**
@ -3045,7 +3044,7 @@ class Product
*/ */
public function isUploadProvided(): bool public function isUploadProvided(): bool
{ {
return (bool)$this->uploadProvided; return (bool) $this->uploadProvided;
} }
/** /**
@ -3061,7 +3060,7 @@ class Product
*/ */
public function getUploadProvidedFile(): string public function getUploadProvidedFile(): string
{ {
return (string)$this->uploadProvidedFile; return (string) $this->uploadProvidedFile;
} }
/** /**
@ -3077,7 +3076,7 @@ class Product
*/ */
public function getUploadProvidedInitalStatus(): int public function getUploadProvidedInitalStatus(): int
{ {
return (int)$this->uploadProvidedInitalStatus; return (int) $this->uploadProvidedInitalStatus;
} }
/** /**
@ -3139,13 +3138,34 @@ class Product
{ {
$this->noIndex = $noIndex; $this->noIndex = $noIndex;
} }
public function isRawText(): bool public function isRawText(): bool
{ {
return (bool)$this->rawText; return (bool) $this->rawText;
} }
public function setRawText(bool $rawText): void public function setRawText(bool $rawText): void
{ {
$this->rawText = $rawText; $this->rawText = $rawText;
} }
public function setAribaUnitOfMeasure(null|string $aribaUnitOfMeasure): void
{
$this->aribaUnitOfMeasure = $aribaUnitOfMeasure;
}
public function getAribaUnitOfMeasure(): null|string
{
return $this->aribaUnitOfMeasure;
}
public function setAribaUNSPSC(null|string $aribaUNSPSC): void
{
$this->aribaUNSPSC = $aribaUNSPSC;
}
public function getAribaUNSPSC(): null|string
{
return $this->aribaUNSPSC;
}
} }

View File

@ -27,7 +27,7 @@ class All extends AbstractController
description: 'get all media', description: 'get all media',
content: new JsonContent(ref: new Model(type: PSCAll::class)), content: new JsonContent(ref: new Model(type: PSCAll::class)),
)] )]
#[Route(path: '/media/all{:uuid}', methods: ['GET'])] #[Route(path: '/media/all', methods: ['GET'])]
#[Tag('Media')] #[Tag('Media')]
#[IsGranted('ROLE_ADMIN')] #[IsGranted('ROLE_ADMIN')]
#[Security(name: 'Bearer')] #[Security(name: 'Bearer')]

View File

@ -51,6 +51,7 @@ class AllFolderPage extends AbstractController
$f = new PSCMedia(); $f = new PSCMedia();
$f->setTitle($media->getTitle()); $f->setTitle($media->getTitle());
$f->setUrl($media->getUrl()); $f->setUrl($media->getUrl());
$f->setUuid($media->getId());
$output->data[] = $f; $output->data[] = $f;
} }
return $this->json($output); return $this->json($output);

View File

@ -0,0 +1,29 @@
<?php
namespace PSC\Shop\MediaBundle\Api;
use Doctrine\ODM\MongoDB\DocumentManager;
use Knp\Component\Pager\PaginatorInterface;
use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Shop\MediaBundle\Model\Media;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Attribute\Route;
class One extends AbstractController
{
public function __construct(
private readonly DocumentManager $dm,
private readonly PaginatorInterface $paginator,
) {}
#[Response(response: 200, description: 'get media', content: new JsonContent(ref: new Model(type: Media::class)))]
#[Route(path: '/media/{uuid}', methods: ['GET'])]
#[Tag('Media')]
public function one(string $uuid): string
{
return $this->json(new Media());
}
}

View File

@ -3,22 +3,22 @@
namespace PSC\Shop\MediaBundle\Api; namespace PSC\Shop\MediaBundle\Api;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Nelmio\ApiDocBundle\Annotation\Model;
use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Annotations as OA;
use PSC\Shop\MediaBundle\Document\Embed\Variant; use PSC\Shop\MediaBundle\Document\Embed\Variant;
use PSC\Shop\MediaBundle\Document\Media; use PSC\Shop\MediaBundle\Document\Media;
use PSC\Shop\MediaBundle\Model\Media as MediaModel;
use PSC\Shop\MediaBundle\Helper\MediaManager; use PSC\Shop\MediaBundle\Helper\MediaManager;
use PSC\Shop\MediaBundle\Model\Media as MediaModel;
use PSC\Shop\MediaBundle\Service\MediaManager as PSCMediaManager; use PSC\Shop\MediaBundle\Service\MediaManager as PSCMediaManager;
use PSC\Shop\MediaBundle\Transformer\Media as PSCMedia; use PSC\Shop\MediaBundle\Transformer\Media as PSCMedia;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use OpenApi\Annotations as OA;
use Nelmio\ApiDocBundle\Annotation\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Nelmio\ApiDocBundle\Annotation\Model;
class UploadVariant extends AbstractController class UploadVariant extends AbstractController
{ {
@ -28,7 +28,7 @@ class UploadVariant extends AbstractController
* @OA\Response( * @OA\Response(
* response=200, * response=200,
* description="media", * description="media",
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\MediaBundle\Model\Media::class)) * @OA\JsonContent(ref=\PSC\Shop\MediaBundle\Model\Media::class)
* ) * )
* @OA\RequestBody( * @OA\RequestBody(
* description="This is a request body", * description="This is a request body",
@ -61,13 +61,19 @@ class UploadVariant extends AbstractController
* @Security(name="Bearer") * @Security(name="Bearer")
*/ */
#[Route(path: '/variant/create', methods: ['POST'])] #[Route(path: '/variant/create', methods: ['POST'])]
public function create(PSCMediaManager $mediaService, PSCMedia $mediaTransformer, MediaManager $mediaManager, Shop $shopService, DocumentManager $documentManager, Request $req): JsonResponse public function create(
{ PSCMediaManager $mediaService,
PSCMedia $mediaTransformer,
MediaManager $mediaManager,
Shop $shopService,
DocumentManager $documentManager,
Request $req,
): JsonResponse {
$mediaVariant = new Variant(); $mediaVariant = new Variant();
$media = $mediaService->getMedia($req->get('uuid')); $media = $mediaService->getMedia($req->get('uuid'));
$handler = $mediaManager->getHandlerForType('pdf'); $handler = $mediaManager->getHandlerForType('pdf');
$helper = $handler->getFormHelper($mediaVariant); $helper = $handler->getFormHelper($mediaVariant);
$mediaVariant->setContent($req->files->get('file')); $mediaVariant->setContent($req->files->get('file'));
$mediaVariant->setSettings($req->get('settings')); $mediaVariant->setSettings($req->get('settings'));
$handler->prepareMedia($mediaVariant); $handler->prepareMedia($mediaVariant);
@ -79,5 +85,4 @@ class UploadVariant extends AbstractController
$mediaTransformer->fromDb($mediaModel, $media); $mediaTransformer->fromDb($mediaModel, $media);
return $this->json($mediaModel); return $this->json($mediaModel);
} }
} }

View File

@ -3,17 +3,14 @@
namespace PSC\Shop\PaymentBundle\Api; namespace PSC\Shop\PaymentBundle\Api;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Security;
use PSC\Shop\EntityBundle\Entity\Payment; use PSC\Shop\EntityBundle\Entity\Payment;
use PSC\Shop\PaymentBundle\Dto\All\Output; use PSC\Shop\PaymentBundle\Dto\All\Output;
use PSC\Shop\PaymentBundle\Model\Payment as PSCPayment; use PSC\Shop\PaymentBundle\Model\Payment as PSCPayment;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
use OpenApi\Annotations as OA;
use Nelmio\ApiDocBundle\Annotation\Model;
use Nelmio\ApiDocBundle\Annotation\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class All extends AbstractController class All extends AbstractController
@ -24,28 +21,29 @@ class All extends AbstractController
private TokenStorageInterface $tokenStorage; private TokenStorageInterface $tokenStorage;
public function __construct(EntityManagerInterface $entityManager, Shop $shopService, TokenStorageInterface $tokenStorage) public function __construct(
{ EntityManagerInterface $entityManager,
Shop $shopService,
TokenStorageInterface $tokenStorage,
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->shopService = $shopService; $this->shopService = $shopService;
$this->tokenStorage = $tokenStorage; $this->tokenStorage = $tokenStorage;
} }
/** #[Response(
* get all payments response: 200,
* description: 'get payments',
* @OA\Response( content: new JsonContent(ref: new Model(type: Output::class)),
* response=200, )]
* description="payments", #[Tag(name: 'Payment')]
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\PaymentBundle\Dto\All\Output::class))
* )
* @OA\Tag(name="Payment")
*/
#[Route(path: '/', methods: ['GET'])] #[Route(path: '/', methods: ['GET'])]
public function all(): JsonResponse public function all(): JsonResponse
{ {
$output = []; $output = [];
$result = $this->entityManager->getRepository(Payment::class)->findBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0]); $result = $this->entityManager
->getRepository(Payment::class)
->findBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0]);
/** Payment $payment */ /** Payment $payment */
foreach ($result as $payment) { foreach ($result as $payment) {
@ -58,17 +56,13 @@ class All extends AbstractController
return $this->json(new Output($output)); return $this->json(new Output($output));
} }
/** #[Response(
* get all payments by Shop Uuid response: 200,
* description: 'get payments by shops',
* @OA\Response( content: new JsonContent(ref: new Model(type: Output::class)),
* response=200, )]
* description="payments", #[Tag(name: 'Payment')]
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\PaymentBundle\Dto\All\Output::class)) #[Security(name: 'Bearer')]
* )
* @OA\Tag(name="Payment")
* @Security(name="Bearer")
*/
#[Route(path: '/by/shop/{shopUuid}', methods: ['GET'])] #[Route(path: '/by/shop/{shopUuid}', methods: ['GET'])]
#[IsGranted('ROLE_SHOP')] #[IsGranted('ROLE_SHOP')]
public function byShops(string $shopUuid): JsonResponse public function byShops(string $shopUuid): JsonResponse
@ -89,23 +83,21 @@ class All extends AbstractController
return $this->json(new Output($output)); return $this->json(new Output($output));
} }
/** #[Response(
* get all payments response: 200,
* description: 'get my payments ',
* @OA\Response( content: new JsonContent(ref: new Model(type: Output::class)),
* response=200, )]
* description="get my payments", #[Tag(name: 'Payment')]
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\PaymentBundle\Dto\All\Output::class)) #[Security(name: 'Bearer')]
* )
* @OA\Tag(name="Payment")
* @Security(name="Bearer")
*/
#[Route(path: '/my', methods: ['GET'])] #[Route(path: '/my', methods: ['GET'])]
#[IsGranted('ROLE_USER')] #[IsGranted('ROLE_USER')]
public function my(): JsonResponse public function my(): JsonResponse
{ {
$output = []; $output = [];
$result = $this->entityManager->getRepository(Payment::class)->findBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0]); $result = $this->entityManager
->getRepository(Payment::class)
->findBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0]);
/** Payment $payment */ /** Payment $payment */
foreach ($result as $payment) { foreach ($result as $payment) {

View File

@ -3,39 +3,40 @@
namespace PSC\Shop\PaymentBundle\Api; namespace PSC\Shop\PaymentBundle\Api;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Shop\EntityBundle\Entity\Payment as PSCPayment; use PSC\Shop\EntityBundle\Entity\Payment as PSCPayment;
use PSC\Shop\PaymentBundle\Model\Payment; use PSC\Shop\PaymentBundle\Model\Payment;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use OpenApi\Annotations as OA;
use Nelmio\ApiDocBundle\Annotation\Model;
class One extends AbstractController class One extends AbstractController
{ {
private EntityManagerInterface $entityManager; private EntityManagerInterface $entityManager;
private Shop $shopService; private Shop $shopService;
public function __construct(EntityManagerInterface $entityManager, Shop $shopService) public function __construct(EntityManagerInterface $entityManager, Shop $shopService)
{ {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->shopService = $shopService; $this->shopService = $shopService;
} }
/** #[Response(
* get one payment response: 200,
* description: 'get Payment',
* @OA\Response( content: new JsonContent(ref: new Model(type: Payment::class)),
* response=200, )]
* description="orders", #[Tag(name: 'Payment')]
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\PaymentBundle\Model\Payment::class))
* )
* @OA\Tag(name="Payment")
*/
#[Route(path: '/{id}', methods: ['GET'])] #[Route(path: '/{id}', methods: ['GET'])]
public function one(string $id) public function one(string $id)
{ {
$result = $this->entityManager->getRepository(PSCPayment::class)->findOneBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0, 'uid' => $id]); $result = $this->entityManager
->getRepository(PSCPayment::class)
->findOneBy(['shop' => $this->shopService->getShopByDomain(), 'private' => 0, 'uid' => $id]);
if ($result) { if ($result) {
$output = new Payment(); $output = new Payment();
$output->setTitle($result->getTitle()); $output->setTitle($result->getTitle());

View File

@ -1,23 +1,12 @@
<?php <?php
/**
* PrintshopCreator Suite
*
* PHP Version 5.3
*
* @author Thomas Peterson <info@thomas-peterson.de>
* @copyright 2012-2013 PrintshopCreator GmbH
* @license Private
* @link http://www.printshopcreator.de
*/
namespace PSC\Shop\ProductBundle\Controller\Backend\Product; namespace PSC\Shop\ProductBundle\Controller\Backend\Product;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Knp\Component\Pager\PaginatorInterface;
use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\Entity;
use Knp\Component\Pager\PaginatorInterface;
use PSC\Shop\EntityBundle\Document\Queue; use PSC\Shop\EntityBundle\Document\Queue;
use PSC\Shop\EntityBundle\Document\Shop; use PSC\Shop\EntityBundle\Document\Shop;
use PSC\Shop\EntityBundle\Entity\Account; use PSC\Shop\EntityBundle\Entity\Account;
@ -29,21 +18,22 @@ use PSC\Shop\ProductBundle\Document\Product\History as PSCHistory;
use PSC\Shop\ProductBundle\Form\Backend\Product\ProductType; use PSC\Shop\ProductBundle\Form\Backend\Product\ProductType;
use PSC\Shop\ProductBundle\PSCShopProductBundle; use PSC\Shop\ProductBundle\PSCShopProductBundle;
use PSC\System\PluginBundle\Form\Chain\Field; use PSC\System\PluginBundle\Form\Chain\Field;
use PSC\System\PluginBundle\Model\PluginButtonArea;
use PSC\System\SettingsBundle\Document\LogEntry; use PSC\System\SettingsBundle\Document\LogEntry;
use PSC\System\SettingsBundle\Form\Backend\CopyType; use PSC\System\SettingsBundle\Form\Backend\CopyType;
use PSC\System\SettingsBundle\Service\History; use PSC\System\SettingsBundle\Service\History;
use PSC\System\SettingsBundle\Service\Log; use PSC\System\SettingsBundle\Service\Log;
use PSC\System\SettingsBundle\Service\Status;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use PSC\System\SettingsBundle\Service\Status; use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\SecurityContext;
/** /**
* DashboardController fürs Backend * DashboardController fürs Backend
@ -68,20 +58,17 @@ class EditController extends AbstractController
#[Route(path: '/edit/save/lang/data/{uid}', name: 'backend_production_product_edit_save_lang_data')] #[Route(path: '/edit/save/lang/data/{uid}', name: 'backend_production_product_edit_save_lang_data')]
public function saveLangDataAction(Request $request, EntityManagerInterface $entityManager, $uid) public function saveLangDataAction(Request $request, EntityManagerInterface $entityManager, $uid)
{ {
$product = $entityManager $product = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(['uid' => $uid]);
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(['uid' => $uid]);
if ($product) { if ($product) {
$tmp = $product->getLangData(); $tmp = $product->getLangData();
$tmp[$request->getPayload()->get('langcode')] = [ $tmp[$request->getPayload()->get('langcode')] = [
'title' => $request->getPayload()->get('title'), 'title' => $request->getPayload()->get('title'),
'einleitung' => $request->getPayload()->get('einleitung'), 'einleitung' => $request->getPayload()->get('einleitung'),
'text_art' => $request->getPayload()->get('text_art'), 'text_art' => $request->getPayload()->get('text_art'),
'info' => $request->getPayload()->get('info'), 'info' => $request->getPayload()->get('info'),
'uuid' => Uuid::uuid4() 'uuid' => Uuid::uuid4(),
]; ];
$product->setLangData($tmp); $product->setLangData($tmp);
@ -103,14 +90,19 @@ class EditController extends AbstractController
#[Route(path: '/edit/add/lang/data/{uid}', name: 'backend_production_product_edit_add_lang_data')] #[Route(path: '/edit/add/lang/data/{uid}', name: 'backend_production_product_edit_add_lang_data')]
public function addLangDataAction(Request $request, EntityManagerInterface $entityManager, $uid) public function addLangDataAction(Request $request, EntityManagerInterface $entityManager, $uid)
{ {
$product = $entityManager $product = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(['uid' => $uid]);
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(['uid' => $uid]);
if ($product) { if ($product) {
$tmp = $product->getLangData(); $tmp = $product->getLangData();
if (!isset($tmp[$request->getPayload()->get('langcode')])) { if (!isset($tmp[$request->getPayload()->get('langcode')])) {
$tmp[$request->getPayload()->get('langcode')] = ['title' => $product->getTitle(), 'einleitung' => '', 'text_art' => '', 'info' => '', 'uuid' => Uuid::uuid4()]; $tmp[$request->getPayload()->get('langcode')] = [
'title' => $product->getTitle(),
'einleitung' => '',
'text_art' => '',
'info' => '',
'uuid' => Uuid::uuid4(),
];
$product->setLangData($tmp); $product->setLangData($tmp);
$entityManager->persist($product); $entityManager->persist($product);
@ -132,11 +124,10 @@ class EditController extends AbstractController
#[Route(path: '/edit/fetch/lang/data/{uid}', name: 'backend_production_product_edit_fetch_lang_data')] #[Route(path: '/edit/fetch/lang/data/{uid}', name: 'backend_production_product_edit_fetch_lang_data')]
public function fetchLangDataAction(Request $request, EntityManagerInterface $entityManager, $uid) public function fetchLangDataAction(Request $request, EntityManagerInterface $entityManager, $uid)
{ {
$product = $entityManager $product = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(['uid' => $uid]);
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(['uid' => $uid]);
if ($product) { if ($product) {
$tmp = array(); $tmp = [];
foreach ($product->getLangData() as $key => $row) { foreach ($product->getLangData() as $key => $row) {
$tmp[] = [ $tmp[] = [
@ -145,7 +136,7 @@ class EditController extends AbstractController
'einleitung' => $row['einleitung'], 'einleitung' => $row['einleitung'],
'text_art' => $row['text_art'], 'text_art' => $row['text_art'],
'info' => $row['info'], 'info' => $row['info'],
'uuid' => $row['uuid'] 'uuid' => $row['uuid'],
]; ];
} }
@ -166,25 +157,30 @@ class EditController extends AbstractController
* @throws \Doctrine\ORM\ORMException * @throws \Doctrine\ORM\ORMException
*/ */
#[Route(path: '/edit/check/url/{url}', name: 'backend_production_product_check_url')] #[Route(path: '/edit/check/url/{url}', name: 'backend_production_product_check_url')]
public function checkUrlAction(Request $request, EntityManagerInterface $entityManager, \PSC\System\SettingsBundle\Service\Shop $shopService, $url) public function checkUrlAction(
{ Request $request,
EntityManagerInterface $entityManager,
\PSC\System\SettingsBundle\Service\Shop $shopService,
$url,
) {
/** /**
* @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop * @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop
*/ */
$selectedShop = $shopService->getSelectedShop(); $selectedShop = $shopService->getSelectedShop();
$products = $entityManager $products = $entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findBy(array('enable' => 1, 'url' => $url, 'shop' => $selectedShop)); ->getRepository('PSC\Shop\EntityBundle\Entity\Product')
->findBy(['enable' => 1, 'url' => $url, 'shop' => $selectedShop]);
if (count($products) > 0) { if (count($products) > 0) {
$tmp = array(); $tmp = [];
/** /**
* @var Product $product * @var Product $product
*/ */
foreach ($products as $product) { foreach ($products as $product) {
$tmp[] = $product->getTitle(); $tmp[] = $product->getTitle();
} }
return new JsonResponse(['success' => true, 'found' => true, 'error' => implode(", ", $tmp)]); return new JsonResponse(['success' => true, 'found' => true, 'error' => implode(', ', $tmp)]);
} }
return new JsonResponse(['success' => true, 'found' => false]); return new JsonResponse(['success' => true, 'found' => false]);
@ -214,34 +210,40 @@ class EditController extends AbstractController
\PSC\System\SettingsBundle\Service\Shop $shopService, \PSC\System\SettingsBundle\Service\Shop $shopService,
DocumentManager $documentManager, DocumentManager $documentManager,
SessionInterface $session, SessionInterface $session,
$type $type,
) { ) {
$customFields = $fieldService->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Product); $customFields = $fieldService->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Product);
$customGroups = $fieldService->getGroups(\PSC\System\PluginBundle\Form\Interfaces\Field::Product); $customGroups = $fieldService->getGroups(\PSC\System\PluginBundle\Form\Interfaces\Field::Product);
/** /**
* @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop * @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop
*/ */
$selectedShop = $shopService->getSelectedShop(); $selectedShop = $shopService->getSelectedShop();
/** /**
* @var Shop $shop * @var Shop $shop
*/ */
$shop = $documentManager $shop = $documentManager
->getRepository('PSC\Shop\EntityBundle\Document\Shop') ->getRepository('PSC\Shop\EntityBundle\Document\Shop')
->findOneBy(array('uid' => (string) $selectedShop->getUid())); ->findOneBy(['uid' => (string) $selectedShop->getUid()]);
$articlegroups = $entityManager $articlegroups = $entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Productgroup')->findBy(array('parent' => 0, 'shop' => $selectedShop)); ->getRepository('PSC\Shop\EntityBundle\Entity\Productgroup')
->findBy(['parent' => 0, 'shop' => $selectedShop]);
$customProductFields = $fieldService->getProductFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Product, $type); $customProductFields = $fieldService->getProductFields(
$customProductGroups = $fieldService->getProductGroups(\PSC\System\PluginBundle\Form\Interfaces\Field::Product, $type); \PSC\System\PluginBundle\Form\Interfaces\Field::Product,
$type,
);
$customProductGroups = $fieldService->getProductGroups(
\PSC\System\PluginBundle\Form\Interfaces\Field::Product,
$type,
);
/** /**
* @var Domain[] $domains * @var Domain[] $domains
*/ */
$domains = $entityManager $domains = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Domain')->getAllByShopId($selectedShop);
->getRepository('PSC\Shop\EntityBundle\Entity\Domain')->getAllByShopId($selectedShop);
$product = new Product(); $product = new Product();
$product->setShop($selectedShop); $product->setShop($selectedShop);
@ -292,28 +294,34 @@ class EditController extends AbstractController
$productDoc->setSalesUnit($product->getSalesUnit()); $productDoc->setSalesUnit($product->getSalesUnit());
$productDoc->setBaseUnit($product->getBaseUnit()); $productDoc->setBaseUnit($product->getBaseUnit());
$productDoc->setUploadFromLatestOrder($product->isUploadFromLatestOrder()); $productDoc->setUploadFromLatestOrder($product->isUploadFromLatestOrder());
$productDoc->setUploadFromLatestOrderInitalStatus((int)$product->getUploadFromLatestOrderInitalStatus()); $productDoc->setUploadFromLatestOrderInitalStatus((int) $product->getUploadFromLatestOrderInitalStatus());
$productDoc->setUploadProvided($product->isUploadProvided()); $productDoc->setUploadProvided($product->isUploadProvided());
$productDoc->setUploadProvidedDownload($product->isUploadProvidedDownload()); $productDoc->setUploadProvidedDownload($product->isUploadProvidedDownload());
$productDoc->setUploadProvidedFile($product->getUploadProvidedFile()); $productDoc->setUploadProvidedFile($product->getUploadProvidedFile());
$productDoc->setUploadProvidedInitalStatus((int)$product->getUploadProvidedInitalStatus()); $productDoc->setUploadProvidedInitalStatus((int) $product->getUploadProvidedInitalStatus());
$productDoc->setCustomTabEnable($product->isCustomTabEnable()); $productDoc->setCustomTabEnable($product->isCustomTabEnable());
$productDoc->setHintEnable($product->isHintEnable()); $productDoc->setHintEnable($product->isHintEnable());
$productDoc->setAsRequest($product->isAsRequest()); $productDoc->setAsRequest($product->isAsRequest());
$productDoc->setRawText($product->isRawText()); $productDoc->setRawText($product->isRawText());
$productDoc->setAribaUNSPSC($product->getAribaUNSPSC());
$productDoc->setAribaUnitOfMeasure($product->getAribaUnitOfMeasure());
$documentManager->persist($productDoc); $documentManager->persist($productDoc);
$documentManager->flush(); $documentManager->flush();
$session->getFlashBag()->add( $session->getFlashBag()->add('success', 'Product \'' . $product->getTitle() . '\' has been created!');
'success', $this->logService->createLogEntry(
'Product \'' . $product->getTitle() . '\' has been created!' $selectedShop,
$this->getUser(),
LogEntry::INFO,
PSCShopProductBundle::class,
$product->getTitle(),
'Product has been created',
); );
$this->logService->createLogEntry($selectedShop, $this->getUser(), LogEntry::INFO, PSCShopProductBundle::class, $product->getTitle(), "Product has been created");
return $this->redirectToRoute('backend_production_product_edit', ['uuid' => $product->getUUID()]); return $this->redirectToRoute('backend_production_product_edit', ['uuid' => $product->getUUID()]);
} }
return array( return [
'domain' => $domains[0]->getHost(), 'domain' => $domains[0]->getHost(),
'form' => $form->createView(), 'form' => $form->createView(),
'product' => $product, 'product' => $product,
@ -323,8 +331,8 @@ class EditController extends AbstractController
'customProductFields' => $customProductFields, 'customProductFields' => $customProductFields,
'customProductGroups' => $customProductGroups, 'customProductGroups' => $customProductGroups,
'customGroups' => $customGroups, 'customGroups' => $customGroups,
'selectedShop' => $selectedShop 'selectedShop' => $selectedShop,
); ];
} }
/** /**
@ -358,43 +366,59 @@ class EditController extends AbstractController
\PSC\System\SettingsBundle\Service\Shop $shopService, \PSC\System\SettingsBundle\Service\Shop $shopService,
Status $statusService, Status $statusService,
\PSC\Shop\OrderBundle\Service\Order $orderService, \PSC\Shop\OrderBundle\Service\Order $orderService,
$uuid $uuid,
) { ) {
$customFields = $fieldService->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Product); $customFields = $fieldService->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Product);
$customGroups = $fieldService->getGroups(\PSC\System\PluginBundle\Form\Interfaces\Field::Product); $customGroups = $fieldService->getGroups(\PSC\System\PluginBundle\Form\Interfaces\Field::Product);
$customButtons = $fieldService->getButtons(
\PSC\System\PluginBundle\Form\Interfaces\Button::Product,
PluginButtonArea::Global,
);
/** /**
* @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop * @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop
*/ */
$selectedShop = $shopService->getSelectedShop(); $selectedShop = $shopService->getSelectedShop();
/** /**
* @var Shop $shop * @var Shop $shop
*/ */
$shop = $documentManager $shop = $documentManager
->getRepository('PSC\Shop\EntityBundle\Document\Shop') ->getRepository('PSC\Shop\EntityBundle\Document\Shop')
->findOneBy(array('uid' => (string) $selectedShop->getUid())); ->findOneBy(['uid' => (string) $selectedShop->getUid()]);
/** /**
* @var Product $product * @var Product $product
*/ */
$product = $entityManager $product = $entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $uuid, 'shop' => $selectedShop)); ->getRepository('PSC\Shop\EntityBundle\Entity\Product')
->findOneBy(['uuid' => $uuid, 'shop' => $selectedShop]);
/** /**
* @var \PSC\Shop\EntityBundle\Document\Product $productDoc * @var \PSC\Shop\EntityBundle\Document\Product $productDoc
*/ */
$productDoc = $documentManager $productDoc = $documentManager
->getRepository('PSC\Shop\EntityBundle\Document\Product') ->getRepository('PSC\Shop\EntityBundle\Document\Product')
->findOneBy(array('uid' => (string) $product->getUid())); ->findOneBy(['uid' => (string) $product->getUid()]);
$articlegroups = $entityManager $articlegroups = $entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Productgroup')->findBy(array('parent' => 0, 'shop' => $selectedShop)); ->getRepository('PSC\Shop\EntityBundle\Entity\Productgroup')
->findBy(['parent' => 0, 'shop' => $selectedShop]);
$customProductFields = $fieldService->getProductFields(
\PSC\System\PluginBundle\Form\Interfaces\Field::Product,
$product->getType(),
);
$customProductGroups = $fieldService->getProductGroups(
\PSC\System\PluginBundle\Form\Interfaces\Field::Product,
$product->getType(),
);
$customProductButtons = $fieldService->getProductButtons(
\PSC\System\PluginBundle\Form\Interfaces\Button::Product,
$product->getType(),
PluginButtonArea::Global,
);
$customProductFields = $fieldService->getProductFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Product, $product->getType());
$customProductGroups = $fieldService->getProductGroups(\PSC\System\PluginBundle\Form\Interfaces\Field::Product, $product->getType());
$product->setUpdatedAt(new \DateTime()); $product->setUpdatedAt(new \DateTime());
if (!$request->isMethod('POST') && $productDoc) { if (!$request->isMethod('POST') && $productDoc) {
@ -433,8 +457,8 @@ class EditController extends AbstractController
$product->setBaseUnit($productDoc->getBaseUnit()); $product->setBaseUnit($productDoc->getBaseUnit());
$product->setNoIndex($productDoc->isNoIndex()); $product->setNoIndex($productDoc->isNoIndex());
$product->setUploadFromLatestOrder($productDoc->isUploadFromLatestOrder()); $product->setUploadFromLatestOrder($productDoc->isUploadFromLatestOrder());
$product->setUploadFromLatestOrderInitalStatus((int)$productDoc->getUploadFromLatestOrderInitalStatus()); $product->setUploadFromLatestOrderInitalStatus((int) $productDoc->getUploadFromLatestOrderInitalStatus());
$product->setUploadProvidedInitalStatus((int)$productDoc->getUploadProvidedInitalStatus()); $product->setUploadProvidedInitalStatus((int) $productDoc->getUploadProvidedInitalStatus());
$product->setUploadProvided($productDoc->isUploadProvided()); $product->setUploadProvided($productDoc->isUploadProvided());
$product->setUploadProvidedDownload($productDoc->isUploadProvidedDownload()); $product->setUploadProvidedDownload($productDoc->isUploadProvidedDownload());
$product->setUploadProvidedFile($productDoc->getUploadProvidedFile()); $product->setUploadProvidedFile($productDoc->getUploadProvidedFile());
@ -442,6 +466,8 @@ class EditController extends AbstractController
$product->setHintEnable($productDoc->isHintEnable()); $product->setHintEnable($productDoc->isHintEnable());
$product->setAsRequest($productDoc->isAsRequest()); $product->setAsRequest($productDoc->isAsRequest());
$product->setRawText($productDoc->isRawText()); $product->setRawText($productDoc->isRawText());
$product->setAribaUNSPSC($productDoc->getAribaUNSPSC());
$product->setAribaUnitOfMeasure($productDoc->getAribaUnitOfMeasure());
} elseif (!$productDoc) { } elseif (!$productDoc) {
$productDoc = new \PSC\Shop\EntityBundle\Document\Product(); $productDoc = new \PSC\Shop\EntityBundle\Document\Product();
$productDoc->setAblaufDatum($product->getAblaufDatum()); $productDoc->setAblaufDatum($product->getAblaufDatum());
@ -479,16 +505,18 @@ class EditController extends AbstractController
$productDoc->setSalesUnit($product->getSalesUnit()); $productDoc->setSalesUnit($product->getSalesUnit());
$productDoc->setBaseUnit($product->getBaseUnit()); $productDoc->setBaseUnit($product->getBaseUnit());
$productDoc->setUploadFromLatestOrder($product->isUploadFromLatestOrder()); $productDoc->setUploadFromLatestOrder($product->isUploadFromLatestOrder());
$productDoc->setUploadFromLatestOrderInitalStatus((int)$product->getUploadFromLatestOrderInitalStatus()); $productDoc->setUploadFromLatestOrderInitalStatus((int) $product->getUploadFromLatestOrderInitalStatus());
$productDoc->setUploadProvided($product->isUploadProvided()); $productDoc->setUploadProvided($product->isUploadProvided());
$productDoc->setUploadProvidedDownload($product->isUploadProvidedDownload()); $productDoc->setUploadProvidedDownload($product->isUploadProvidedDownload());
$productDoc->setUploadProvidedFile($product->getUploadProvidedFile()); $productDoc->setUploadProvidedFile($product->getUploadProvidedFile());
$productDoc->setUploadProvidedInitalStatus((int)$product->getUploadProvidedInitalStatus()); $productDoc->setUploadProvidedInitalStatus((int) $product->getUploadProvidedInitalStatus());
$productDoc->setCustomTabEnable($product->isCustomTabEnable()); $productDoc->setCustomTabEnable($product->isCustomTabEnable());
$productDoc->setHintEnable($product->isHintEnable()); $productDoc->setHintEnable($product->isHintEnable());
$productDoc->setAsRequest($product->isAsRequest()); $productDoc->setAsRequest($product->isAsRequest());
$productDoc->setNoIndex($product->isNoIndex()); $productDoc->setNoIndex($product->isNoIndex());
$productDoc->setRawText($product->isRawText()); $productDoc->setRawText($product->isRawText());
$productDoc->setAribaUNSPSC($product->getAribaUNSPSC());
$productDoc->setAribaUnitOfMeasure($product->getAribaUnitOfMeasure());
$documentManager->persist($productDoc); $documentManager->persist($productDoc);
$documentManager->flush(); $documentManager->flush();
@ -528,8 +556,8 @@ class EditController extends AbstractController
$product->setSalesUnit($productDoc->getSalesUnit()); $product->setSalesUnit($productDoc->getSalesUnit());
$product->setBaseUnit($productDoc->getBaseUnit()); $product->setBaseUnit($productDoc->getBaseUnit());
$product->setUploadFromLatestOrder($productDoc->isUploadFromLatestOrder()); $product->setUploadFromLatestOrder($productDoc->isUploadFromLatestOrder());
$product->setUploadFromLatestOrderInitalStatus((int)$productDoc->getUploadFromLatestOrderInitalStatus()); $product->setUploadFromLatestOrderInitalStatus((int) $productDoc->getUploadFromLatestOrderInitalStatus());
$product->setUploadProvidedInitalStatus((int)$productDoc->getUploadProvidedInitalStatus()); $product->setUploadProvidedInitalStatus((int) $productDoc->getUploadProvidedInitalStatus());
$product->setUploadProvided($productDoc->isUploadProvided()); $product->setUploadProvided($productDoc->isUploadProvided());
$product->setUploadProvidedDownload($productDoc->isUploadProvidedDownload()); $product->setUploadProvidedDownload($productDoc->isUploadProvidedDownload());
$product->setUploadProvidedFile($productDoc->getUploadProvidedFile()); $product->setUploadProvidedFile($productDoc->getUploadProvidedFile());
@ -537,16 +565,21 @@ class EditController extends AbstractController
$product->setHintEnable($productDoc->isHintEnable()); $product->setHintEnable($productDoc->isHintEnable());
$product->setAsRequest($productDoc->isAsRequest()); $product->setAsRequest($productDoc->isAsRequest());
$product->setRawText($productDoc->isRawText()); $product->setRawText($productDoc->isRawText());
$product->setAribaUNSPSC($productDoc->getAribaUNSPSC());
$product->setAribaUnitOfMeasure($productDoc->getAribaUnitOfMeasure());
} }
if ($request->isMethod('POST') && $productDoc) { if ($request->isMethod('POST') && $productDoc) {
$product->setPluginSettings($productDoc->getPluginSettings()); $product->setPluginSettings($productDoc->getPluginSettings());
} }
$form = $this->createForm(ProductType::class, $product, ['productType' => intval($product->getType()), 'productDoc' => $productDoc, 'product' => $product]); $form = $this->createForm(ProductType::class, $product, [
'productType' => intval($product->getType()),
'productDoc' => $productDoc,
'product' => $product,
]);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$productDoc->setAnsprechPartner($product->getAnsprechPartner()); $productDoc->setAnsprechPartner($product->getAnsprechPartner());
$productDoc->setAblaufDatum($product->getAblaufDatum()); $productDoc->setAblaufDatum($product->getAblaufDatum());
$productDoc->setZusatzAbmessung($product->getZusatzAbmessung()); $productDoc->setZusatzAbmessung($product->getZusatzAbmessung());
@ -582,75 +615,82 @@ class EditController extends AbstractController
$productDoc->setBaseUnit($product->getBaseUnit()); $productDoc->setBaseUnit($product->getBaseUnit());
$productDoc->setSalesUnit($product->getSalesUnit()); $productDoc->setSalesUnit($product->getSalesUnit());
$productDoc->setUploadFromLatestOrder($product->isUploadFromLatestOrder()); $productDoc->setUploadFromLatestOrder($product->isUploadFromLatestOrder());
$productDoc->setUploadFromLatestOrderInitalStatus((int)$product->getUploadFromLatestOrderInitalStatus()); $productDoc->setUploadFromLatestOrderInitalStatus((int) $product->getUploadFromLatestOrderInitalStatus());
$productDoc->setUploadProvided($product->isUploadProvided()); $productDoc->setUploadProvided($product->isUploadProvided());
$productDoc->setUploadProvidedDownload($product->isUploadProvidedDownload()); $productDoc->setUploadProvidedDownload($product->isUploadProvidedDownload());
$productDoc->setUploadProvidedFile($product->getUploadProvidedFile()); $productDoc->setUploadProvidedFile($product->getUploadProvidedFile());
$productDoc->setUploadProvidedInitalStatus((int)$product->getUploadProvidedInitalStatus()); $productDoc->setUploadProvidedInitalStatus((int) $product->getUploadProvidedInitalStatus());
$productDoc->setCustomTabEnable($product->isCustomTabEnable()); $productDoc->setCustomTabEnable($product->isCustomTabEnable());
$productDoc->setHintEnable($product->isHintEnable()); $productDoc->setHintEnable($product->isHintEnable());
$productDoc->setAsRequest($product->isAsRequest()); $productDoc->setAsRequest($product->isAsRequest());
$productDoc->setRawText($product->isRawText()); $productDoc->setRawText($product->isRawText());
$productDoc->setAribaUNSPSC($product->getAribaUNSPSC());
$productDoc->setAribaUnitOfMeasure($product->getAribaUnitOfMeasure());
$this->historyService->createHistoryEntry(new PSCHistory((string)$product->getUID()), $product, $productDoc); $this->historyService->createHistoryEntry(
new PSCHistory((string) $product->getUID()),
$product,
$productDoc,
);
$entityManager->persist($product); $entityManager->persist($product);
$entityManager->flush(); $entityManager->flush();
$documentManager->persist($productDoc); $documentManager->persist($productDoc);
$documentManager->flush(); $documentManager->flush();
$session->getFlashBag()->add( $session->getFlashBag()->add('success', 'Product \'' . $product->getTitle() . '\' has been updated!');
'success', $this->logService->createLogEntry(
'Product \'' . $product->getTitle() . '\' has been updated!' $selectedShop,
$this->getUser(),
LogEntry::INFO,
PSCShopProductBundle::class,
$product->getTitle(),
'Product has been updated',
); );
$this->logService->createLogEntry($selectedShop, $this->getUser(), LogEntry::INFO, PSCShopProductBundle::class, $product->getTitle(), "Product has been updated");
} }
/** /**
* @var Domain[] $domains * @var Domain[] $domains
*/ */
$domains = $entityManager $domains = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Domain')->getAllByShopId($selectedShop);
->getRepository('PSC\Shop\EntityBundle\Entity\Domain')->getAllByShopId($selectedShop);
$userRepository = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order'); $userRepository = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order');
$qb = $userRepository->createQueryBuilder('orders') $qb = $userRepository
->createQueryBuilder('orders')
->leftJoin('orders.positions', 'pos') ->leftJoin('orders.positions', 'pos')
->leftJoin('pos.product', 'product') ->leftJoin('pos.product', 'product')
->andwhere('(pos.product = :product_id OR product.originalProduct = :product_id)')->setParameter("product_id", $product->getUid()) ->andwhere('(pos.product = :product_id OR product.originalProduct = :product_id)')
->setParameter('product_id', $product->getUid())
->orderBy('orders.uid', 'desc'); ->orderBy('orders.uid', 'desc');
$qbCount = $userRepository->createQueryBuilder('orders') $qbCount = $userRepository
->createQueryBuilder('orders')
->select('count(orders.uid)') ->select('count(orders.uid)')
->leftJoin('orders.positions', 'pos') ->leftJoin('orders.positions', 'pos')
->leftJoin('pos.product', 'product') ->leftJoin('pos.product', 'product')
->andwhere('(pos.product = :product_id OR product.originalProduct = :product_id)')->setParameter("product_id", $product->getUid()) ->andwhere('(pos.product = :product_id OR product.originalProduct = :product_id)')
->setParameter('product_id', $product->getUid())
->orderBy('orders.uid', 'desc'); ->orderBy('orders.uid', 'desc');
$query = $qb->getQuery(); $query = $qb->getQuery();
$count = $qbCount->getQuery()->getSingleScalarResult(); $count = $qbCount->getQuery()->getSingleScalarResult();
$query->setHint('knp_paginator.count', $count); $query->setHint('knp_paginator.count', $count);
$pagination2 = $paginator->paginate( $pagination2 = $paginator->paginate($query, $request->query->getInt('pages_order', 1), 15, [
$query, 'distinct' => false,
$request->query->getInt('pages_order', 1), 'pageParameterName' => 'pages_order',
15, 'sortFieldParameterName' => 'sorts',
[ ]);
'distinct' => false,
'pageParameterName' => 'pages_order',
'sortFieldParameterName' => 'sorts'
]
);
$subProduct = false; $subProduct = false;
if ($product->getOriginalProduct() != 0) { if ($product->getOriginalProduct() != 0) {
$subProduct = $entityManager->getRepository(Product::class)->find($product->getOriginalProduct()); $subProduct = $entityManager->getRepository(Product::class)->find($product->getOriginalProduct());
} }
return array( return [
'domain' => $domains[0]->getHost(), 'domain' => $domains[0]->getHost(),
'form' => $form->createView(), 'form' => $form->createView(),
'product' => $product, 'product' => $product,
@ -658,15 +698,16 @@ class EditController extends AbstractController
'shopDoc' => $shop, 'shopDoc' => $shop,
'customFields' => $customFields, 'customFields' => $customFields,
'customProductFields' => $customProductFields, 'customProductFields' => $customProductFields,
'customProductButtons' => $customProductButtons,
'customProductGroups' => $customProductGroups, 'customProductGroups' => $customProductGroups,
'customGroups' => $customGroups, 'customGroups' => $customGroups,
'selectedShop' => $selectedShop, 'selectedShop' => $selectedShop,
'changes' => $this->historyService->getHistory(new PSCHistory(), (string)$product->getUid()), 'changes' => $this->historyService->getHistory(new PSCHistory(), (string) $product->getUid()),
'pagination2' => $pagination2, 'pagination2' => $pagination2,
'orderStatuse' => $statusService, 'orderStatuse' => $statusService,
'orderService' => $orderService, 'orderService' => $orderService,
'subProduct' => $subProduct 'subProduct' => $subProduct,
); ];
} }
/** /**
@ -686,24 +727,25 @@ class EditController extends AbstractController
\PSC\System\SettingsBundle\Service\Shop $shopService, \PSC\System\SettingsBundle\Service\Shop $shopService,
EntityManagerInterface $entityManager, EntityManagerInterface $entityManager,
SessionInterface $session, SessionInterface $session,
$uuid $uuid,
) { ) {
/** /**
* @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop * @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop
*/ */
$selectedShop = $shopService->getSelectedShop(); $selectedShop = $shopService->getSelectedShop();
/** /**
* @var Product $product * @var Product $product
*/ */
$product = $entityManager $product = $entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $uuid, 'shop' => $selectedShop)); ->getRepository('PSC\Shop\EntityBundle\Entity\Product')
->findOneBy(['uuid' => $uuid, 'shop' => $selectedShop]);
$sql = 'select count(article_id) as sum from orderspos where article_id = :article_id'; $sql = 'select count(article_id) as sum from orderspos where article_id = :article_id';
$stmt = $entityManager->getConnection()->prepare($sql); $stmt = $entityManager->getConnection()->prepare($sql);
$result = $stmt->executeQuery(array('article_id' => $product->getUID())); $result = $stmt->executeQuery(['article_id' => $product->getUID()]);
$count = (int)$result->fetchOne(); $count = (int) $result->fetchOne();
$form = $this->createForm(DeleteType::class); $form = $this->createForm(DeleteType::class);
@ -714,22 +756,25 @@ class EditController extends AbstractController
$title = $product->getTitle(); $title = $product->getTitle();
$entityManager->remove($product); $entityManager->remove($product);
$entityManager->flush(); $entityManager->flush();
$session->getFlashBag()->add( $session->getFlashBag()->add('success', 'Product \'' . $title . '\' has been deleted!');
'success', $this->logService->createLogEntry(
'Product \'' . $title . '\' has been deleted!' $selectedShop,
$this->getUser(),
LogEntry::INFO,
PSCShopProductBundle::class,
$product->getTitle(),
'Product has been deleted',
); );
$this->logService->createLogEntry($selectedShop, $this->getUser(), LogEntry::INFO, PSCShopProductBundle::class, $product->getTitle(), "Product has been deleted");
return $this->redirectToRoute('psc_shop_product_backend_list'); return $this->redirectToRoute('psc_shop_product_backend_list');
} }
return $this->redirectToRoute('psc_shop_product_backend_list'); return $this->redirectToRoute('psc_shop_product_backend_list');
} }
return [
return array(
'product' => $product, 'product' => $product,
'count' => $count, 'count' => $count,
'form' => $form->createView() 'form' => $form->createView(),
); ];
} }
/** /**
@ -746,21 +791,26 @@ class EditController extends AbstractController
*/ */
#[Route(path: '/{uuid}/copy', name: 'psc_shop_product_backend_edit_copy')] #[Route(path: '/{uuid}/copy', name: 'psc_shop_product_backend_edit_copy')]
#[Template] #[Template]
public function copyAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, \PSC\Shop\ProductBundle\Service\Product $productService, EntityManagerInterface $entityManager, $uuid) public function copyAction(
{ Request $request,
\PSC\System\SettingsBundle\Service\Shop $shopService,
\PSC\Shop\ProductBundle\Service\Product $productService,
EntityManagerInterface $entityManager,
$uuid,
) {
$obj = ['which' => 1]; $obj = ['which' => 1];
/** /**
* @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop * @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop
*/ */
$selectedShop = $shopService->getSelectedShop(); $selectedShop = $shopService->getSelectedShop();
/** /**
* @var Product $product * @var Product $product
*/ */
$product = $entityManager $product = $entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $uuid, 'shop' => $selectedShop)); ->getRepository('PSC\Shop\EntityBundle\Entity\Product')
->findOneBy(['uuid' => $uuid, 'shop' => $selectedShop]);
$form = $this->createForm(CopyType::class, $obj); $form = $this->createForm(CopyType::class, $obj);
@ -779,6 +829,6 @@ class EditController extends AbstractController
} }
} }
return array('form' => $form->createView(), 'product' => $product); return ['form' => $form->createView(), 'product' => $product];
} }
} }

View File

@ -96,6 +96,8 @@ class ProductType extends AbstractType
->add('notBuy', CheckboxType::class, ['required' => false, 'label' => 'notshoworderbtn']) ->add('notBuy', CheckboxType::class, ['required' => false, 'label' => 'notshoworderbtn'])
->add('notEdit', CheckboxType::class, ['required' => false, 'label' => 'Sellasproduct']) ->add('notEdit', CheckboxType::class, ['required' => false, 'label' => 'Sellasproduct'])
->add('url', TextType::class, ['required' => true, 'label' => 'Url']) ->add('url', TextType::class, ['required' => true, 'label' => 'Url'])
->add('aribaUNSPSC', TextType::class, ['required' => false, 'label' => 'Ariba UNSPSC Identifikation'])
->add('aribaUnitOfMeasure', TextType::class, ['required' => false, 'label' => 'Ariba UnitOfMeasure'])
->add('title', TextType::class) ->add('title', TextType::class)
->add('subTitle', TextType::class, ['required' => false, 'label' => 'subTitle']) ->add('subTitle', TextType::class, ['required' => false, 'label' => 'subTitle'])
->add('createdAt', DatePickerType::class, ['disabled' => true]) ->add('createdAt', DatePickerType::class, ['disabled' => true])

View File

@ -235,6 +235,25 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-4">
<div class="row mb-3">
{{ form_label(form.aribaUnitOfMeasure) }}
<div class="col-md-8">
{{ form_widget(form.aribaUnitOfMeasure) }}
</div>
</div>
</div>
<div class="col-md-4">
<div class="row mb-3">
{{ form_label(form.aribaUNSPSC) }}
<div class="col-md-8">
{{ form_widget(form.aribaUNSPSC) }}
</div>
</div>
</div>
</div>
</div> </div>
<div class="tab-pane" id="groups" role="tabpanel"> <div class="tab-pane" id="groups" role="tabpanel">
<div class="row mb-3"> <div class="row mb-3">

View File

@ -25,6 +25,10 @@ a[href^="#formlayouter"] {display:none;}
<a href="{{ path("backend_production_product_permission_index", {product: product.uuid}) }}" class="btn btn-default btn-sm"><i class="fa fa-lg fa-fw fa-key"></i> {{ 'opening'|trans }}</a> <a href="{{ path("backend_production_product_permission_index", {product: product.uuid}) }}" class="btn btn-default btn-sm"><i class="fa fa-lg fa-fw fa-key"></i> {{ 'opening'|trans }}</a>
<a href="{{ path("backend_production_product_stock_index", {product: product.uuid}) }}" class="btn btn-default btn-sm"><i class="fa fa-lg fa-fw fa-building"></i> {{ 'Warehousemanagement'|trans }}</a> <a href="{{ path("backend_production_product_stock_index", {product: product.uuid}) }}" class="btn btn-default btn-sm"><i class="fa fa-lg fa-fw fa-building"></i> {{ 'Warehousemanagement'|trans }}</a>
<a href="{{ path("backend_production_product_product_set", {product: product.uuid}) }}" class="btn btn-default btn-sm"><i class="fa fa-lg fa-fw fa-boxes"></i> {{ 'Product-Set'|trans }}</a> <a href="{{ path("backend_production_product_product_set", {product: product.uuid}) }}" class="btn btn-default btn-sm"><i class="fa fa-lg fa-fw fa-boxes"></i> {{ 'Product-Set'|trans }}</a>
{% for customButton in customProductButtons %}
{{ customButton.setProduct(product).render()|raw }}
{% endfor %}
</div> </div>
</div> </div>
</div> </div>
@ -250,6 +254,24 @@ a[href^="#formlayouter"] {display:none;}
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-4">
<div class="row mb-3">
{{ form_label(form.aribaUnitOfMeasure) }}
<div class="col-md-8">
{{ form_widget(form.aribaUnitOfMeasure) }}
</div>
</div>
</div>
<div class="col-md-4">
<div class="row mb-3">
{{ form_label(form.aribaUNSPSC) }}
<div class="col-md-8">
{{ form_widget(form.aribaUNSPSC) }}
</div>
</div>
</div>
</div>
</div> </div>
<div class="tab-pane" id="groups" role="tabpanel"> <div class="tab-pane" id="groups" role="tabpanel">
<div class="row mb-3"> <div class="row mb-3">

View File

@ -22,22 +22,40 @@ class FormPass implements CompilerPassInterface
$taggedServices = $container->findTaggedServiceIds('psc.backend.custom.fields'); $taggedServices = $container->findTaggedServiceIds('psc.backend.custom.fields');
foreach ($taggedServices as $id => $tags) { foreach ($taggedServices as $id => $tags) {
if (isset($tags[0]['productType'])) { if (isset($tags[0]['productType'])) {
$definition->addMethodCall('addProductField', array(new Reference($id), intval($tags[0]['productType']))); $definition->addMethodCall('addProductField', [
new Reference($id),
intval($tags[0]['productType']),
]);
} elseif (isset($tags[0]['themeType'])) { } elseif (isset($tags[0]['themeType'])) {
$definition->addMethodCall('addThemeField', array(new Reference($id), $tags[0]['themeType'])); $definition->addMethodCall('addThemeField', [new Reference($id), $tags[0]['themeType']]);
} else { } else {
$definition->addMethodCall('addField', array(new Reference($id))); $definition->addMethodCall('addField', [new Reference($id)]);
} }
} }
$taggedServices = $container->findTaggedServiceIds('psc.backend.custom.groups'); $taggedServices = $container->findTaggedServiceIds('psc.backend.custom.groups');
foreach ($taggedServices as $id => $tags) { foreach ($taggedServices as $id => $tags) {
if (isset($tags[0]['productType'])) { if (isset($tags[0]['productType'])) {
$definition->addMethodCall('addProductGroup', array(new Reference($id), intval($tags[0]['productType']))); $definition->addMethodCall('addProductGroup', [
new Reference($id),
intval($tags[0]['productType']),
]);
} elseif (isset($tags[0]['themeType'])) { } elseif (isset($tags[0]['themeType'])) {
$definition->addMethodCall('addThemeGroup', array(new Reference($id), $tags[0]['themeType'])); $definition->addMethodCall('addThemeGroup', [new Reference($id), $tags[0]['themeType']]);
} else { } else {
$definition->addMethodCall('addGroup', array(new Reference($id))); $definition->addMethodCall('addGroup', [new Reference($id)]);
}
}
$taggedServices = $container->findTaggedServiceIds('psc.backend.custom.buttons');
foreach ($taggedServices as $id => $tags) {
if (isset($tags[0]['productType'])) {
$definition->addMethodCall('addProductButton', [
new Reference($id),
intval($tags[0]['productType']),
]);
} else {
$definition->addMethodCall('addButton', [new Reference($id)]);
} }
} }
@ -50,7 +68,7 @@ class FormPass implements CompilerPassInterface
$taggedServices = $container->findTaggedServiceIds('psc.backend.custom.section'); $taggedServices = $container->findTaggedServiceIds('psc.backend.custom.section');
foreach ($taggedServices as $id => $tags) { foreach ($taggedServices as $id => $tags) {
$defSection->addMethodCall('add', array(new Reference($id))); $defSection->addMethodCall('add', [new Reference($id)]);
} }
} }
} }

View File

@ -3,12 +3,19 @@
namespace PSC\System\PluginBundle\Form\Chain; namespace PSC\System\PluginBundle\Form\Chain;
use PSC\System\PluginBundle\Form\Interfaces\Group; use PSC\System\PluginBundle\Form\Interfaces\Group;
use PSC\System\PluginBundle\Model\PluginButtonArea;
class Field class Field
{ {
/** @var \PSC\System\PluginBundle\Form\Interfaces\Field[] */ /** @var \PSC\System\PluginBundle\Form\Interfaces\Field[] */
private $fields = []; private $fields = [];
/** @var \PSC\System\PluginBundle\Form\Interfaces\Button[] */
private $buttons = [];
/** @var \PSC\System\PluginBundle\Form\Interfaces\Button[] */
private $specialProductButtons = [];
/** @var Group[] */ /** @var Group[] */
private $groups = []; private $groups = [];
@ -24,14 +31,12 @@ class Field
/** @var Group[] */ /** @var Group[] */
private $specialThemeGroups = []; private $specialThemeGroups = [];
public function __construct() public function __construct() {}
{
}
public function addField(\PSC\System\PluginBundle\Form\Interfaces\Field $field) public function addField(\PSC\System\PluginBundle\Form\Interfaces\Field $field)
{ {
if (!isset($this->fields[$field->getModule()])) { if (!isset($this->fields[$field->getModule()])) {
$this->fields[$field->getModule()] = array(); $this->fields[$field->getModule()] = [];
} }
$this->fields[$field->getModule()][] = $field; $this->fields[$field->getModule()][] = $field;
@ -40,29 +45,48 @@ class Field
public function addGroup(\PSC\System\PluginBundle\Form\Interfaces\Group $group) public function addGroup(\PSC\System\PluginBundle\Form\Interfaces\Group $group)
{ {
if (!isset($this->groups[$group->getModule()])) { if (!isset($this->groups[$group->getModule()])) {
$this->groups[$group->getModule()] = array(); $this->groups[$group->getModule()] = [];
} }
$this->groups[$group->getModule()][] = $group; $this->groups[$group->getModule()][] = $group;
} }
public function addButton(\PSC\System\PluginBundle\Form\Interfaces\Button $button)
{
if (!isset($this->buttons[$button->getModule()])) {
$this->buttons[$button->getModule()] = [];
}
$this->buttons[$button->getModule()][] = $button;
}
public function addProductField(\PSC\System\PluginBundle\Form\Interfaces\Field $field, $productType = 0) public function addProductField(\PSC\System\PluginBundle\Form\Interfaces\Field $field, $productType = 0)
{ {
if (!isset($this->specialProductFields[$field->getModule()])) { if (!isset($this->specialProductFields[$field->getModule()])) {
$this->specialProductFields[$field->getModule()] = array(); $this->specialProductFields[$field->getModule()] = [];
} }
if (!isset($this->specialProductFields[$field->getModule()][$productType])) { if (!isset($this->specialProductFields[$field->getModule()][$productType])) {
$this->specialProductFields[$field->getModule()][$productType] = array(); $this->specialProductFields[$field->getModule()][$productType] = [];
} }
$this->specialProductFields[$field->getModule()][$productType][] = $field; $this->specialProductFields[$field->getModule()][$productType][] = $field;
} }
public function addThemeField(\PSC\System\PluginBundle\Form\Interfaces\Field $field, $themeType = "") public function addProductButton(\PSC\System\PluginBundle\Form\Interfaces\Button $button, $productType = 0)
{
if (!isset($this->specialProductButtons[$button->getModule()])) {
$this->specialProductButtons[$button->getModule()] = [];
}
if (!isset($this->specialProductButtons[$button->getModule()][$productType])) {
$this->specialProductButtons[$button->getModule()][$productType] = [];
}
$this->specialProductButtons[$button->getModule()][$productType][] = $button;
}
public function addThemeField(\PSC\System\PluginBundle\Form\Interfaces\Field $field, $themeType = '')
{ {
if (!isset($this->specialThemeFields[$field->getModule()])) { if (!isset($this->specialThemeFields[$field->getModule()])) {
$this->specialThemeFields[$field->getModule()] = array(); $this->specialThemeFields[$field->getModule()] = [];
} }
if (!isset($this->specialThemeFields[$field->getModule()][$themeType])) { if (!isset($this->specialThemeFields[$field->getModule()][$themeType])) {
$this->specialThemeFields[$field->getModule()][$themeType] = array(); $this->specialThemeFields[$field->getModule()][$themeType] = [];
} }
$this->specialThemeFields[$field->getModule()][$themeType][] = $field; $this->specialThemeFields[$field->getModule()][$themeType][] = $field;
} }
@ -70,21 +94,21 @@ class Field
public function addProductGroup(\PSC\System\PluginBundle\Form\Interfaces\Group $group, $productType = 0) public function addProductGroup(\PSC\System\PluginBundle\Form\Interfaces\Group $group, $productType = 0)
{ {
if (!isset($this->specialProductGroups[$group->getModule()])) { if (!isset($this->specialProductGroups[$group->getModule()])) {
$this->specialProductGroups[$group->getModule()] = array(); $this->specialProductGroups[$group->getModule()] = [];
} }
if (!isset($this->specialProductGroups[$group->getModule()][$productType])) { if (!isset($this->specialProductGroups[$group->getModule()][$productType])) {
$this->specialProductGroups[$group->getModule()][$productType] = array(); $this->specialProductGroups[$group->getModule()][$productType] = [];
} }
$this->specialProductGroups[$group->getModule()][$productType][] = $group; $this->specialProductGroups[$group->getModule()][$productType][] = $group;
} }
public function addThemeGroup(\PSC\System\PluginBundle\Form\Interfaces\Group $group, $themeType = "") public function addThemeGroup(\PSC\System\PluginBundle\Form\Interfaces\Group $group, $themeType = '')
{ {
if (!isset($this->specialThemeGroups[$group->getModule()])) { if (!isset($this->specialThemeGroups[$group->getModule()])) {
$this->specialThemeGroups[$group->getModule()] = array(); $this->specialThemeGroups[$group->getModule()] = [];
} }
if (!isset($this->specialThemeGroups[$group->getModule()][$themeType])) { if (!isset($this->specialThemeGroups[$group->getModule()][$themeType])) {
$this->specialThemeGroups[$group->getModule()][$themeType] = array(); $this->specialThemeGroups[$group->getModule()][$themeType] = [];
} }
$this->specialThemeGroups[$group->getModule()][$themeType][] = $group; $this->specialThemeGroups[$group->getModule()][$themeType][] = $group;
} }
@ -101,10 +125,45 @@ class Field
return $this->groups; return $this->groups;
} }
public function getButtons($module = false, PluginButtonArea $area = PluginButtonArea::Global)
{
if ($module) {
if (!isset($this->buttons[$module])) {
return [];
}
return $this->buttons[$module];
}
return $this->buttons;
}
public function getProductButtons(
$module = false,
int $productType = 0,
PluginButtonArea $area = PluginButtonArea::Global,
) {
if ($module) {
if (
!isset($this->specialProductButtons[$module]) ||
!isset($this->specialProductButtons[$module][intval($productType)])
) {
return [];
}
return array_filter($this->specialProductButtons[$module][intval($productType)], function ($e) use ($area) {
return $e->getArea() == $area;
});
}
return $this->specialProductGroups;
}
public function getProductGroups($module = false, $productType = 0) public function getProductGroups($module = false, $productType = 0)
{ {
if ($module) { if ($module) {
if (!isset($this->specialProductGroups[$module]) || !isset($this->specialProductGroups[$module][intval($productType)])) { if (
!isset($this->specialProductGroups[$module]) ||
!isset($this->specialProductGroups[$module][intval($productType)])
) {
return []; return [];
} }
return $this->specialProductGroups[$module][intval($productType)]; return $this->specialProductGroups[$module][intval($productType)];
@ -113,7 +172,7 @@ class Field
return $this->specialProductGroups; return $this->specialProductGroups;
} }
public function getThemeGroups($module = false, $themeType = "") public function getThemeGroups($module = false, $themeType = '')
{ {
if ($module) { if ($module) {
if (!isset($this->specialThemeGroups[$module]) || !isset($this->specialThemeGroups[$module][$themeType])) { if (!isset($this->specialThemeGroups[$module]) || !isset($this->specialThemeGroups[$module][$themeType])) {
@ -140,7 +199,10 @@ class Field
public function getProductFields($module = false, $productType = 0) public function getProductFields($module = false, $productType = 0)
{ {
if ($module) { if ($module) {
if (!isset($this->specialProductFields[$module]) || !isset($this->specialProductFields[$module][intval($productType)])) { if (
!isset($this->specialProductFields[$module]) ||
!isset($this->specialProductFields[$module][intval($productType)])
) {
return []; return [];
} }
return $this->specialProductFields[$module][$productType]; return $this->specialProductFields[$module][$productType];
@ -149,7 +211,7 @@ class Field
return $this->specialProductFields; return $this->specialProductFields;
} }
public function getThemeFields($module = false, $themeType = "") public function getThemeFields($module = false, $themeType = '')
{ {
if ($module) { if ($module) {
if (!isset($this->specialThemeFields[$module]) || !isset($this->specialThemeFields[$module][$themeType])) { if (!isset($this->specialThemeFields[$module]) || !isset($this->specialThemeFields[$module][$themeType])) {

View File

@ -0,0 +1,28 @@
<?php
namespace PSC\System\PluginBundle\Form\Interfaces;
use PSC\System\PluginBundle\Model\PluginButtonArea;
interface Button
{
const Cms = 1;
const Product = 2;
const Shipping = 3;
const Payment = 4;
const Productgroup = 5;
const News = 6;
const Account = 7;
const Contact = 8;
const Shop = 9;
const Order = 10;
const Voucher = 11;
const Theme = 12;
const System = 13;
public function getModule(): int;
public function getArea(): PluginButtonArea;
public function render(): string;
}

View File

@ -0,0 +1,8 @@
<?php
namespace PSC\System\PluginBundle\Model;
enum PluginButtonArea
{
case Global;
}

View File

@ -47,5 +47,10 @@ class UploadTest extends WebTestCase
$media = json_decode($client->getResponse()->getContent(), true); $media = json_decode($client->getResponse()->getContent(), true);
self::assertSame('kenney.jpg', $media['title']); self::assertSame('kenney.jpg', $media['title']);
self::assertIsString($media['uuid']);
$client->request('GET', '/api/media/' . $media['uuid'], [], []);
$this->assertResponseIsSuccessful();
} }
} }

View File

@ -32,4 +32,25 @@ class PreviewTest extends WebTestCase
self::assertSame(1200, $data['netto']); self::assertSame(1200, $data['netto']);
} }
public function testRowPreview(): void
{
$client = static::createClient();
$client->jsonRequest(
'POST',
'/api/plugin/system/psc/xmlcalc/product/pd',
[
'shop' => '771a1176-d531-48ed-93b8-eec1fd4b917f',
'json' => json_decode(
'[ { "uuid": "2b6de5b2-4dac-4258-8a07-83c14552b7b8", "name": "40a3bdad-e4ae-4b3b-a9be-9c6d07b8ec43", "options": [ { "id": "03f105fe-a403-4b66-81b0-05e1e5b912e7", "type": 7, "dependencys": [], "columns": [ { "id": "c7ebdb8d-70ce-4aad-bfa6-2ee8433bc1a1", "type": 8, "dependencys": [], "options": [ { "id": "0f99f3db-43ec-48b2-809b-538ddb472fb3", "type": 6, "dependencys": [], "default": "Headline", "name": "", "variant": "1" } ] }, { "id": "66eac063-4c3a-4fc4-a5fb-eeaa78c32d06", "type": 8, "dependencys": [], "options": [ { "id": "b972c84c-1943-46a7-8e9d-09d7a4ad8fdb", "type": 6, "dependencys": [], "default": "Headline", "name": "", "variant": "1" } ] } ] } ] } ]',
),
'values' => [],
],
[],
);
$this->assertResponseIsSuccessful();
$data = json_decode($client->getResponse()->getContent(), true);
}
} }

View File

@ -0,0 +1 @@
@jsr:registry=https://npm.jsr.io

View File

@ -7,6 +7,7 @@
"@codemirror/lang-json": "^6.0.2", "@codemirror/lang-json": "^6.0.2",
"@codemirror/lang-php": "^6.0.2", "@codemirror/lang-php": "^6.0.2",
"@codemirror/lang-xml": "^6.1.0", "@codemirror/lang-xml": "^6.1.0",
"@std/async": "npm:@jsr/std__async",
"@tailwindcss/vite": "^4.1.10", "@tailwindcss/vite": "^4.1.10",
"@vueuse/core": "^13.6.0", "@vueuse/core": "^13.6.0",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
@ -274,6 +275,8 @@
"@sindresorhus/merge-streams": ["@sindresorhus/merge-streams@4.0.0", "", {}, "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ=="], "@sindresorhus/merge-streams": ["@sindresorhus/merge-streams@4.0.0", "", {}, "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ=="],
"@std/async": ["@jsr/std__async@1.0.14", "https://npm.jsr.io/~/11/@jsr/std__async/1.0.14.tgz", {}, "sha512-aIG8W3TOmW+lKdAJA5w56qASu9EiUmBXbhW6eAlSEUBid+KVESGqQygFFg+awt/c8K+qobVM6M/u3SbIy0NyUQ=="],
"@swc/helpers": ["@swc/helpers@0.5.17", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A=="], "@swc/helpers": ["@swc/helpers@0.5.17", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A=="],
"@tailwindcss/node": ["@tailwindcss/node@4.1.10", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "enhanced-resolve": "^5.18.1", "jiti": "^2.4.2", "lightningcss": "1.30.1", "magic-string": "^0.30.17", "source-map-js": "^1.2.1", "tailwindcss": "4.1.10" } }, "sha512-2ACf1znY5fpRBwRhMgj9ZXvb2XZW8qs+oTfotJ2C5xR0/WNL7UHZ7zXl6s+rUqedL1mNi+0O+WQr5awGowS3PQ=="], "@tailwindcss/node": ["@tailwindcss/node@4.1.10", "", { "dependencies": { "@ampproject/remapping": "^2.3.0", "enhanced-resolve": "^5.18.1", "jiti": "^2.4.2", "lightningcss": "1.30.1", "magic-string": "^0.30.17", "source-map-js": "^1.2.1", "tailwindcss": "4.1.10" } }, "sha512-2ACf1znY5fpRBwRhMgj9ZXvb2XZW8qs+oTfotJ2C5xR0/WNL7UHZ7zXl6s+rUqedL1mNi+0O+WQr5awGowS3PQ=="],

View File

@ -13,6 +13,7 @@
"@codemirror/lang-json": "^6.0.2", "@codemirror/lang-json": "^6.0.2",
"@codemirror/lang-php": "^6.0.2", "@codemirror/lang-php": "^6.0.2",
"@codemirror/lang-xml": "^6.1.0", "@codemirror/lang-xml": "^6.1.0",
"@std/async": "npm:@jsr/std__async",
"@tailwindcss/vite": "^4.1.10", "@tailwindcss/vite": "^4.1.10",
"@vueuse/core": "^13.6.0", "@vueuse/core": "^13.6.0",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",

View File

@ -3,16 +3,20 @@ import Gui from './components/Gui.vue'
import { onMounted } from 'vue' import { onMounted } from 'vue'
import { useItemStore } from './stores/Items' import { useItemStore } from './stores/Items'
import { useGlobalStore } from './stores/Global' import { useGlobalStore } from './stores/Global'
import Mode from './model/Mode'
onMounted(() => { onMounted(() => {
const itemStore = useItemStore() const itemStore = useItemStore()
const globalStore = useGlobalStore() const globalStore = useGlobalStore()
const params = new URLSearchParams(window.location.search) const params = new URLSearchParams(window.location.search)
const uuid = params.get('uuid') const uuid: string|null = params.get('uuid')
const shopUuid = params.get('shop') const shopUuid: string|null = params.get('shop')
const mode = params.get('mode') const mode: string|null = params.get('mode')
globalStore.setShopUuid(shopUuid)
globalStore.setMode(mode) globalStore.setShopUuid(shopUuid!)
if(mode) {
let x: number = parseInt(mode!)
globalStore.setMode(x as Mode)
}
if (uuid) { if (uuid) {
globalStore.setProductUuid(uuid) globalStore.setProductUuid(uuid)
globalStore.loadConfigFromProductApi(uuid).then(data => { globalStore.loadConfigFromProductApi(uuid).then(data => {
@ -21,23 +25,11 @@ onMounted(() => {
globalStore.loadFormulaAnalyserDataFromApi(uuid) globalStore.loadFormulaAnalyserDataFromApi(uuid)
} }
let debounceTimer: number;
const debounce = (func: Function, delay: number) => {
return function(this: any, ...args: any[]) {
clearTimeout(debounceTimer);
debounceTimer = setTimeout(() => func.apply(this, args), delay);
};
};
const debouncedLoadPreview = debounce((json: object[]) => {
globalStore.loadPreview(json);
}, 500);
itemStore.$subscribe((mutation, state) => { itemStore.$subscribe((mutation, state) => {
const json = itemStore.loadJSON(); const json = itemStore.loadJSON();
globalStore.saveDesign(json); globalStore.saveDesign(json);
debouncedLoadPreview(json);
}); });
}) })
</script> </script>

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue'; import { ref } from 'vue';
import { Button } from '../../ui/button'; import { Button } from '../../ui/button';
import { import {
Dialog, Dialog,

View File

@ -1,8 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue';
import MediaElement from '../../../model/MediaElement'; import MediaElement from '../../../model/MediaElement';
import { computed } from 'vue'; import { computed, onMounted } from 'vue';
import { ImageOff } from 'lucide-vue-next' import { ImageOff } from 'lucide-vue-next'
import { fetchMediaUrl } from '../../../lib/api';
const props = defineProps<{ const props = defineProps<{
modelValue: MediaElement modelValue: MediaElement
@ -10,11 +10,20 @@ const props = defineProps<{
let emit = defineEmits(['update:modelValue']); let emit = defineEmits(['update:modelValue']);
const theModel = computed<InputElement>({ const theModel = computed<MediaElement>({
get: () => props.modelValue, get: () => props.modelValue,
set: (value) => emit('update:modelValue', value), set: (value) => emit('update:modelValue', value),
}); });
onMounted(async () => {
if (theModel.value.default && !theModel.value.url) {
try {
theModel.value.url = await fetchMediaUrl(theModel.value.default);
} catch (error) {
console.error('Failed to fetch media URL', error);
}
}
});
</script> </script>
<template> <template>

View File

@ -7,7 +7,7 @@ import { Button } from '../../../components/ui/button'
import { ref, watch, h } from 'vue' import { ref, watch, h } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
const { locale, t } = useI18n() const { locale } = useI18n()
const globalStore = useGlobalStore() const globalStore = useGlobalStore()
let previewMode = ref(false) let previewMode = ref(false)
@ -101,4 +101,4 @@ const renderIcon = (icon: any) => {
</template> </template>
<style scoped> <style scoped>
</style> </style>

View File

@ -29,6 +29,7 @@ const emit = defineEmits(['select-media']);
const folders = ref<Folder[]>([]); const folders = ref<Folder[]>([]);
const selectMedia = (media: Media) => { const selectMedia = (media: Media) => {
console.log(media)
emit('select-media', media); emit('select-media', media);
}; };
const media = ref<Media[]>([]); const media = ref<Media[]>([]);

View File

@ -1,19 +1,37 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue'; import { computed, onMounted } from 'vue'
import { useGlobalStore } from '../../../stores/Global'; import { useGlobalStore } from '../../../stores/Global'
import RenderElements from './RenderElements.vue'; import { useItemStore } from '../../../stores/Items'
import PriceDisplay from './PriceDisplay.vue'; import RenderElements from './RenderElements.vue'
import type { PreviewResponse } from '../../../model/preview/types'; import PriceDisplay from './PriceDisplay.vue'
import type { PreviewResponse } from '../../../model/preview/types'
import { debounce } from "@std/async/debounce"
const globalStore = useGlobalStore(); const globalStore = useGlobalStore()
const itemStore = useItemStore()
const previewData = computed<PreviewResponse | null>(() => globalStore.getPreviewData); const previewData = computed<PreviewResponse | null>(() => globalStore.getPreviewData)
const error = computed(() => globalStore.previewError); const error = computed(() => globalStore.previewError)
const isLoading = computed(() => globalStore.isPreviewLoading); const isLoading = computed(() => globalStore.isPreviewLoading)
const items = computed(() => previewData.value?.elements || []); const items = computed(() => previewData.value?.elements || [])
const price = computed(() => previewData.value); const price = computed(() => previewData.value)
let previewValues: Record<string, any> = {}
const handleUpdate = (payload: { elementId: string, newValue: any }) => {
previewValues[payload.elementId] = payload.newValue;
debounce(() => globalStore.loadPreview(itemStore.loadJSON(), previewValues), 500);
};
onMounted(() => {
globalStore.loadPreview(itemStore.loadJSON()).then(() => {
globalStore.previewData!.elements.map((el) => {
previewValues[el.id] = el.rawValue;
});
});
})
</script> </script>
<template> <template>
@ -31,7 +49,7 @@ const price = computed(() => previewData.value);
<div class="overflow-auto h-full"> <div class="overflow-auto h-full">
<div class="flex flex-row"> <div class="flex flex-row">
<div class="w-3/5 flex flex-col gap-2"> <div class="w-3/5 flex flex-col gap-2">
<RenderElements :items="items"/> <RenderElements :items="items" @update:value="handleUpdate"/>
</div> </div>
<div class="w-2/5 pl-6"> <div class="w-2/5 pl-6">
<PriceDisplay :price-data="price" /> <PriceDisplay :price-data="price" />

View File

@ -10,9 +10,9 @@ const formatCurrency = (value: number) => {
return new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(value); return new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(value);
}; };
const netPrice = computed(() => formatCurrency(props.priceData?.netto / 100 || 0)); const netPrice = computed(() => formatCurrency(props.priceData!.netto / 100 || 0));
const tax = computed(() => formatCurrency(props.priceData?.tax / 100 || 0)); const tax = computed(() => formatCurrency(props.priceData!.tax / 100 || 0));
const grossPrice = computed(() => formatCurrency(props.priceData?.brutto / 100 || 0)); const grossPrice = computed(() => formatCurrency(props.priceData!.brutto / 100 || 0));
</script> </script>

View File

@ -1,6 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { shallowRef } from 'vue'; import { shallowRef } from 'vue';
import type { Component } from 'vue';
import type { PreviewElement } from '../../../model/preview/types'; import type { PreviewElement } from '../../../model/preview/types';
import TextElement from './elements/TextElement.vue'; import TextElement from './elements/TextElement.vue';
@ -8,27 +7,53 @@ import InputElement from './elements/InputElement.vue';
import HiddenElement from './elements/HiddenElement.vue'; import HiddenElement from './elements/HiddenElement.vue';
import HeadlineElement from './elements/HeadlineElement.vue'; import HeadlineElement from './elements/HeadlineElement.vue';
import SelectElement from './elements/SelectElement.vue'; import SelectElement from './elements/SelectElement.vue';
import RowElement from './elements/RowElement.vue';
const props = defineProps<{ const props = defineProps<{
items: PreviewElement[] items: PreviewElement[]
}>(); }>();
const componentMap: Record<string, Component> = shallowRef({ const emit = defineEmits(['update:value']);
headline: HeadlineElement,
text: TextElement, const handleUpdate = (payload: { elementId: string, newValue: any }) => {
input: InputElement, emit('update:value', payload);
hidden: HiddenElement, };
select: SelectElement,
});
</script> </script>
<template> <template>
<div v-for="item in items" :key="item.id"> <div v-for="item in props.items" :key="item.id">
<component <HeadlineElement
v-if="item.valid && componentMap[item.htmlType]" v-if="item.valid && item.htmlType === 'headline'"
:is="componentMap[item.htmlType]"
:item="item" :item="item"
@update:value="handleUpdate"
/> />
<HiddenElement
v-if="item.valid && item.htmlType === 'hidden'"
:item="item"
@update:value="handleUpdate"
/>
<TextElement
v-if="item.valid && item.htmlType === 'text'"
:item="item"
@update:value="handleUpdate"
/>
<InputElement
v-if="item.valid && item.htmlType === 'input'"
:item="item"
@update:value="handleUpdate"
/>
<SelectElement
v-if="item.valid && item.htmlType === 'select'"
:item="item"
@update:value="handleUpdate"
/>
<RowElement
v-if="item.valid && item.htmlType === 'row'"
:item="item"
@update:value="handleUpdate"
/>
</div> </div>
</template> </template>

View File

@ -9,12 +9,12 @@ const props = defineProps<{
<template> <template>
<div class="flex gap-2 flex-row"> <div class="flex gap-2 flex-row">
<h1 v-if="item.variant == '1'" class="text-4xl">{{item.defaultValue}}</h1> <h1 v-if="props.item.variant == '1'" class="text-4xl">{{props.item.defaultValue}}</h1>
<h6 v-else-if="item.variant == '6'" class="text-base">{{item.defaultValue}}</h6> <h6 v-else-if="props.item.variant == '6'" class="text-base">{{props.item.defaultValue}}</h6>
<h5 v-else-if="item.variant == '5'" class="text-lg">{{item.defaultValue}}</h5> <h5 v-else-if="props.item.variant == '5'" class="text-lg">{{props.item.defaultValue}}</h5>
<h4 v-else-if="item.variant == '4'" class="text-xl">{{item.defaultValue}}</h4> <h4 v-else-if="props.item.variant == '4'" class="text-xl">{{props.item.defaultValue}}</h4>
<h3 v-else-if="item.variant == '3'" class="text-2xl">{{item.defaultValue}}</h3> <h3 v-else-if="props.item.variant == '3'" class="text-2xl">{{props.item.defaultValue}}</h3>
<h2 v-else-if="item.variant == '2'" class="text-3xl">{{item.defaultValue}}</h2> <h2 v-else-if="props.item.variant == '2'" class="text-3xl">{{props.item.defaultValue}}</h2>
<h1 v-else class="text-4xl">{{item.defaultValue}}</h1> <h1 v-else class="text-4xl">{{props.item.defaultValue}}</h1>
</div> </div>
</template> </template>

View File

@ -11,6 +11,6 @@ const props = defineProps<{
<template> <template>
<div class="flex gap-2 flex-row"> <div class="flex gap-2 flex-row">
<Input type="hidden" name="item.name" id="item.id" value="item.value"/> <Input type="hidden" :name="props.item.name" :id="props.item.id" :value="props.item.value"/>
</div> </div>
</template> </template>

View File

@ -1,10 +1,20 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue';
import type { PreviewElement } from '../../../../model/preview/types'; import type { PreviewElement } from '../../../../model/preview/types';
import { Input } from '../../../../components/ui/input'; import { Input } from '../../../../components/ui/input';
const props = defineProps<{ const props = defineProps<{
item: PreviewElement item: PreviewElement
}>() }>();
const emit = defineEmits(['update:value']);
const value = computed({
get: () => props.item.rawValue,
set: (newValue) => {
emit('update:value', { elementId: props.item.id, newValue });
}
});
</script> </script>
@ -12,6 +22,6 @@ const props = defineProps<{
<template> <template>
<div class="flex gap-2 flex-row items-center"> <div class="flex gap-2 flex-row items-center">
<label class="w-60 flex-inital">{{item.name}}</label> <label class="w-60 flex-inital">{{item.name}}</label>
<Input v-model:placeholder="item.placeHolder" v-model="item.value" v-model:name="item.name" v-model:id="item.id" v-model:required="item.required"/> <Input v-model="value" :placeholder="item.placeHolder" :name="item.name" :id="item.id" :required="item.required"/>
</div> </div>
</template> </template>

View File

@ -0,0 +1,23 @@
<script lang="ts" setup>
import type { PreviewElement } from '../../../../model/preview/types';
import RenderElements from '../RenderElements.vue'
const props = defineProps<{
item: PreviewElement
}>()
const emit = defineEmits(['update:value']);
const handleUpdate = (payload: { elementId: string, newValue: any }) => {
emit('update:value', payload);
};
</script>
<template>
<div class="flex gap-2 flex-row">
<div class="flex-row w-full h-auto" v-for="col in props.item.elements">
<RenderElements :items="col.elements" @update:value="handleUpdate"/>
</div>
</div>
</template>

View File

@ -1,4 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue';
import type { PreviewElement } from '../../../../model/preview/types'; import type { PreviewElement } from '../../../../model/preview/types';
import { import {
Select, Select,
@ -11,7 +12,16 @@ import {
const props = defineProps<{ const props = defineProps<{
item: PreviewElement item: PreviewElement
}>() }>();
const emit = defineEmits(['update:value']);
const value = computed({
get: () => props.item.rawValue,
set: (newValue) => {
emit('update:value', { elementId: props.item.id, newValue });
}
});
</script> </script>
@ -19,13 +29,13 @@ const props = defineProps<{
<div class="flex gap-2 flex-row items-center"> <div class="flex gap-2 flex-row items-center">
<label class="w-60 flex-inital">{{item.name}}</label> <label class="w-60 flex-inital">{{item.name}}</label>
<div class="w-full"> <div class="w-full">
<Select v-model="item.rawValue"> <Select v-model="value">
<SelectTrigger> <SelectTrigger>
<SelectValue /> <SelectValue />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectGroup> <SelectGroup>
<SelectItem v-for="option in item.options" :key="option.uuid" :value="option.id"> <SelectItem v-for="option in item.options" :key="option.id" v-show="option.valid" :value="option.id">
{{option.name}} {{option.name}}
</SelectItem> </SelectItem>
</SelectGroup> </SelectGroup>

View File

@ -9,6 +9,6 @@ const props = defineProps<{
<template> <template>
<div class="flex gap-2 flex-row"> <div class="flex gap-2 flex-row">
<p style="white-space: pre-line;">{{item.defaultValue}}</p> <p style="white-space: pre-line;">{{props.item.defaultValue}}</p>
</div> </div>
</template> </template>

View File

@ -0,0 +1,15 @@
<script lang="ts" setup>
import type { PreviewElement } from '../../../../model/preview/types';
import { Textarea } from '../../../ui/textarea'
const props = defineProps<{
item: PreviewElement
}>()
</script>
<template>
<div class="flex gap-2 flex-row">
<Textarea style="white-space: pre-line;" v-value="props.item.defaultValue"></Textarea>
</div>
</template>

View File

@ -27,9 +27,9 @@ const dialogOpen = ref(false);
const uploadProgress = ref(0); const uploadProgress = ref(0);
const handleMediaSelect = (media: any) => { const handleMediaSelect = (media: any) => {
theModel.value.default = media.uuid; theModel.value!.default = media.uuid;
theModel.value.url = media.url; theModel.value!.url = media.url;
dialogOpen.value = false; dialogOpen.value = false;
}; };
const isDragging = ref(false); const isDragging = ref(false);
const directories = ref<Folder[]>([]); const directories = ref<Folder[]>([]);
@ -75,11 +75,11 @@ const handleFile = async (file: File) => {
uploadProgress.value = 0; uploadProgress.value = 0;
if(selectedDirectory) { if(selectedDirectory) {
try { try {
let response = await uploadFile(file, selectedDirectory.value, (progress) => { let response: any = await uploadFile(file, selectedDirectory.value, (progress) => {
uploadProgress.value = progress; uploadProgress.value = progress;
}); });
theModel.value.url = response.url theModel.value!.url = response.url
theModel.value.default = response.uuid theModel.value!.default = response.uuid
// Handle successful upload // Handle successful upload
} catch (error) { } catch (error) {
console.error('Upload failed', error); console.error('Upload failed', error);

View File

@ -2,7 +2,7 @@
import type { HTMLAttributes } from 'vue' import type { HTMLAttributes } from 'vue'
import { reactiveOmit } from '@vueuse/core' import { reactiveOmit } from '@vueuse/core'
import { PaginationRoot, type PaginationRootEmits, type PaginationRootProps, useForwardPropsEmits } from 'reka-ui' import { PaginationRoot, type PaginationRootEmits, type PaginationRootProps, useForwardPropsEmits } from 'reka-ui'
import { cn } from '@/lib/utils' import { cn } from '../../../lib/utils'
const props = defineProps<PaginationRootProps & { const props = defineProps<PaginationRootProps & {
class?: HTMLAttributes['class'] class?: HTMLAttributes['class']

View File

@ -2,7 +2,7 @@
import type { HTMLAttributes } from 'vue' import type { HTMLAttributes } from 'vue'
import { reactiveOmit } from '@vueuse/core' import { reactiveOmit } from '@vueuse/core'
import { PaginationList, type PaginationListProps } from 'reka-ui' import { PaginationList, type PaginationListProps } from 'reka-ui'
import { cn } from '@/lib/utils' import { cn } from '../../../lib/utils'
const props = defineProps<PaginationListProps & { class?: HTMLAttributes['class'] }>() const props = defineProps<PaginationListProps & { class?: HTMLAttributes['class'] }>()

View File

@ -3,7 +3,7 @@ import type { HTMLAttributes } from 'vue'
import { reactiveOmit } from '@vueuse/core' import { reactiveOmit } from '@vueuse/core'
import { MoreHorizontal } from 'lucide-vue-next' import { MoreHorizontal } from 'lucide-vue-next'
import { PaginationEllipsis, type PaginationEllipsisProps } from 'reka-ui' import { PaginationEllipsis, type PaginationEllipsisProps } from 'reka-ui'
import { cn } from '@/lib/utils' import { cn } from '../../../lib/utils'
const props = defineProps<PaginationEllipsisProps & { class?: HTMLAttributes['class'] }>() const props = defineProps<PaginationEllipsisProps & { class?: HTMLAttributes['class'] }>()

View File

@ -4,8 +4,8 @@ import type { HTMLAttributes } from 'vue'
import { reactiveOmit } from '@vueuse/core' import { reactiveOmit } from '@vueuse/core'
import { ChevronLeftIcon } from 'lucide-vue-next' import { ChevronLeftIcon } from 'lucide-vue-next'
import { PaginationFirst, useForwardProps } from 'reka-ui' import { PaginationFirst, useForwardProps } from 'reka-ui'
import { cn } from '@/lib/utils' import { cn } from '../../../lib/utils'
import { buttonVariants, type ButtonVariants } from '@/components/ui/button' import { buttonVariants, type ButtonVariants } from '../button'
const props = withDefaults(defineProps<PaginationFirstProps & { const props = withDefaults(defineProps<PaginationFirstProps & {
size?: ButtonVariants['size'] size?: ButtonVariants['size']

View File

@ -2,8 +2,8 @@
import type { HTMLAttributes } from 'vue' import type { HTMLAttributes } from 'vue'
import { reactiveOmit } from '@vueuse/core' import { reactiveOmit } from '@vueuse/core'
import { PaginationListItem, type PaginationListItemProps } from 'reka-ui' import { PaginationListItem, type PaginationListItemProps } from 'reka-ui'
import { cn } from '@/lib/utils' import { cn } from '../../../lib/utils'
import { buttonVariants, type ButtonVariants } from '@/components/ui/button' import { buttonVariants, type ButtonVariants } from '../button'
const props = withDefaults(defineProps<PaginationListItemProps & { const props = withDefaults(defineProps<PaginationListItemProps & {
size?: ButtonVariants['size'] size?: ButtonVariants['size']

View File

@ -4,8 +4,8 @@ import type { HTMLAttributes } from 'vue'
import { reactiveOmit } from '@vueuse/core' import { reactiveOmit } from '@vueuse/core'
import { ChevronRightIcon } from 'lucide-vue-next' import { ChevronRightIcon } from 'lucide-vue-next'
import { PaginationLast, useForwardProps } from 'reka-ui' import { PaginationLast, useForwardProps } from 'reka-ui'
import { cn } from '@/lib/utils' import { cn } from '../../../lib/utils'
import { buttonVariants, type ButtonVariants } from '@/components/ui/button' import { buttonVariants, type ButtonVariants } from '../button'
const props = withDefaults(defineProps<PaginationLastProps & { const props = withDefaults(defineProps<PaginationLastProps & {
size?: ButtonVariants['size'] size?: ButtonVariants['size']

View File

@ -4,8 +4,8 @@ import type { HTMLAttributes } from 'vue'
import { reactiveOmit } from '@vueuse/core' import { reactiveOmit } from '@vueuse/core'
import { ChevronRightIcon } from 'lucide-vue-next' import { ChevronRightIcon } from 'lucide-vue-next'
import { PaginationNext, useForwardProps } from 'reka-ui' import { PaginationNext, useForwardProps } from 'reka-ui'
import { cn } from '@/lib/utils' import { cn } from '../../../lib/utils'
import { buttonVariants, type ButtonVariants } from '@/components/ui/button' import { buttonVariants, type ButtonVariants } from '../button'
const props = withDefaults(defineProps<PaginationNextProps & { const props = withDefaults(defineProps<PaginationNextProps & {
size?: ButtonVariants['size'] size?: ButtonVariants['size']

View File

@ -4,8 +4,8 @@ import type { HTMLAttributes } from 'vue'
import { reactiveOmit } from '@vueuse/core' import { reactiveOmit } from '@vueuse/core'
import { ChevronLeftIcon } from 'lucide-vue-next' import { ChevronLeftIcon } from 'lucide-vue-next'
import { PaginationPrev, useForwardProps } from 'reka-ui' import { PaginationPrev, useForwardProps } from 'reka-ui'
import { cn } from '@/lib/utils' import { buttonVariants, type ButtonVariants } from '../button'
import { buttonVariants, type ButtonVariants } from '@/components/ui/button' import { cn } from '../../../lib/utils'
const props = withDefaults(defineProps<PaginationPrevProps & { const props = withDefaults(defineProps<PaginationPrevProps & {
size?: ButtonVariants['size'] size?: ButtonVariants['size']

View File

@ -164,9 +164,9 @@ export const fetchLayouts = async (shop: string) => {
} }
}; };
export const fetchPreview = async (shopUuid: string, json: object[]) => { export const fetchPreview = async (shopUuid: string, json: object[], values?: Record<string, any>) => {
try { try {
const response = await api.post('api/plugin/system/psc/xmlcalc/product/pd', { json: { shop: shopUuid, json: json } }); const response = await api.post('api/plugin/system/psc/xmlcalc/product/pd', { json: { shop: shopUuid, json: json, values: values } });
return await response.json(); return await response.json();
} catch (error) { } catch (error) {
console.error('Error fetching preview:', error); console.error('Error fetching preview:', error);
@ -174,4 +174,15 @@ export const fetchPreview = async (shopUuid: string, json: object[]) => {
} }
}; };
export default api; export const fetchMediaUrl = async (uuid: string) => {
try {
const response = await api.get(`api/media/${uuid}`);
const data:any = await response.json();
return data.data.attributes.url;
} catch (error) {
console.error(`Error fetching media url for ${uuid}:`, error);
throw error;
}
};
export default api;

View File

@ -35,7 +35,7 @@ export default class BaseElement {
}, []) }, [])
} }
} }
getIdRecursiv(list: []) { getIdRecursiv(list: string[]) {
} }
fromJSON(obj: any) { fromJSON(obj: any) {

View File

@ -32,7 +32,7 @@ export default class Column extends BaseElement {
this.items.push(item) this.items.push(item)
}) })
} }
getIdRecursiv(list: []) { getIdRecursiv(list: string[]) {
this.items.forEach((item) => { this.items.forEach((item) => {
list.push(item.id); list.push(item.id);
item.getIdRecursiv(list) item.getIdRecursiv(list)

View File

@ -34,7 +34,7 @@ export default class FieldsetElement extends BaseElement {
this.items.push(item) this.items.push(item)
}) })
} }
getIdRecursiv(list: []) { getIdRecursiv(list: string[]) {
this.items.forEach((item) => { this.items.forEach((item) => {
list.push(item.id); list.push(item.id);
item.getIdRecursiv(list) item.getIdRecursiv(list)

View File

@ -16,7 +16,7 @@ export default class Row extends BaseElement {
addColumnAtTheBeginning(column: Column) { addColumnAtTheBeginning(column: Column) {
this.columns.unshift(column) this.columns.unshift(column)
} }
getIdRecursiv(list: []) { getIdRecursiv(list: string[]) {
this.columns.forEach((column) => { this.columns.forEach((column) => {
column.getIdRecursiv(list) column.getIdRecursiv(list)
}) })

View File

@ -3,6 +3,7 @@ export interface PreviewOption {
name: string; name: string;
valid: boolean; valid: boolean;
selected: boolean; selected: boolean;
elements: PreviewOption[];
} }
export interface PreviewElement { export interface PreviewElement {
@ -21,7 +22,8 @@ export interface PreviewElement {
rawValue: string; rawValue: string;
rawValues: any[]; rawValues: any[];
options: PreviewOption[]; options: PreviewOption[];
htmlType: 'headline' | 'text' | 'input' | 'hidden' | 'select'; elements: PreviewElement[];
htmlType: string;
validationErrors: any[]; validationErrors: any[];
variant?: string; // For headline variant?: string; // For headline
minValue?: number; // For input minValue?: number; // For input

View File

@ -60,7 +60,7 @@ export const useGlobalStore = defineStore('global', {
setParameter(value: string) { setParameter(value: string) {
this.parameter = value this.parameter = value
}, },
setMode(value: Number) { setMode(value: Mode) {
this.mode = value this.mode = value
}, },
setJson(value: string) { setJson(value: string) {
@ -177,11 +177,10 @@ export const useGlobalStore = defineStore('global', {
setCurrentTab(tab: string | number) { setCurrentTab(tab: string | number) {
this.currentTab = tab this.currentTab = tab
}, },
async loadPreview(json: object[]) { async loadPreview(json: object[], values?: Record<string, any>) {
this.isPreviewLoading = true;
this.previewError = ''; this.previewError = '';
try { try {
const response: any = await fetchPreview(this.shopUuid, json); const response: any = await fetchPreview(this.shopUuid, json, values);
this.previewData = response; this.previewData = response;
} catch (e: any) { } catch (e: any) {
this.previewError = `Failed to load preview data: ${e.message}`; this.previewError = `Failed to load preview data: ${e.message}`;
@ -189,6 +188,6 @@ export const useGlobalStore = defineStore('global', {
} finally { } finally {
this.isPreviewLoading = false; this.isPreviewLoading = false;
} }
} },
} }
}) })

View File

@ -12,7 +12,7 @@ export const useItemStore = defineStore('items', {
getters: { getters: {
getCount: (state) => state.items.length, getCount: (state) => state.items.length,
getIdRecursiv(state) { getIdRecursiv(state) {
let list = [] let list: string[] = []
state.items.forEach((item) => { state.items.forEach((item) => {
list.push(item.id); list.push(item.id);
item.getIdRecursiv(list) item.getIdRecursiv(list)

View File

@ -33,7 +33,7 @@ export default defineConfig({
changeOrigin: true, changeOrigin: true,
configure: (proxy) => { configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => { proxy.on('proxyReq', (proxyReq) => {
proxyReq.setHeader('Authorization', 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE3NTQ1OTUxMjUsImV4cCI6MTc1NDU5ODcyNSwicm9sZXMiOlsiUk9MRV9BRE1JTiIsIlJPTEVfU0hPUF9PUEVSQVRPUiIsIlJPTEVfVVNFUiIsIlJPTEVfVVNFUiIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9FZGl0IiwiUk9MRV9QU0NfQ29sbGVjdF9Db250YWN0X0FkZCIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9EZWxldGUiLCJST0xFX1BTQ19Db2xsZWN0X0NvbnRhY3RfTG9jayIsIlJPTEVfUFNDX1IyX1NlbmRjbG91ZF9TaG93Il0sInVpZCI6MX0.C-_PO6C-uFj_6zOtJymfYRsMi0tn-Aq_-HAjpYIqh4rAvY5fTnf54kli1F1bqYogRTqWiTgzPh3EYkPuU7dC8UlCN1eMwXzLFzqtlI7IPPh2UhUvFv6EGix5XTWHnfO-I53vYhrd1qO5Kp--nqFyCCMSaXsRd9daJ7fkbPfGXrwIXPxUeFhhcbMYP4SsUHgS3ZGInM1J_txO62LJHBc91pAtzSliVpUhwJzHjHuiTeC8WTUhdRgVaQo2echLWPfPrMlWolh3cN6wk41wCNivpTIQ4h-a3WVEHvlRz61W9jehzWMiMoTZglmatn8cPsiFFb_nmUacYP5avazXAdpgjA'); proxyReq.setHeader('Authorization', 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE3NTY3MzE1MDEsImV4cCI6MTc1NjczNTEwMSwicm9sZXMiOlsiUk9MRV9BRE1JTiIsIlJPTEVfU0hPUF9PUEVSQVRPUiIsIlJPTEVfVVNFUiIsIlJPTEVfVVNFUiIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9FZGl0IiwiUk9MRV9QU0NfQ29sbGVjdF9Db250YWN0X0FkZCIsIlJPTEVfUFNDX0NvbGxlY3RfQ29udGFjdF9EZWxldGUiLCJST0xFX1BTQ19Db2xsZWN0X0NvbnRhY3RfTG9jayIsIlJPTEVfUFNDX1IyX1NlbmRjbG91ZF9TaG93Il0sInVpZCI6MX0.Krs-TxmU9J3-p9Tt9cgFbm94wNz7wG9zRUe6yGMFG5USngDNzg4f3FL46JAWUx1liZBiU5K_Qnir5ol1--T6o2MNWIqxj3DTMgx6weWscv0Uw0eXOvhXhZp3wjaFnaqnqdN-vDqdEljs4V8ZA7RmbrL4SNgH-XoKrn0GEI9uVUYtd3wwR4SZFDEvZC1MTRi17zVMdpAxNaZ5KWTvcaARmUmDT5uKmgFOaM0z0mUT9mbL9KetqdId4aq_o6o6cPI--CDVmGNElvh4b3Ogf4yFe1hSuh9Yt1jM9rhqA7JDMpTRm3Ffx1nEdOyuA02hFFttuGICLc4NFTLbsY8qfp0H5A');
}); });
}, },
}, },

View File

@ -6,6 +6,6 @@ services:
Plugin\Custom\PSC\FormBuilder\: Plugin\Custom\PSC\FormBuilder\:
resource: '../../*/*' resource: '../../*/*'
# Plugin\System\PSC\Invoice\Section\Invoice: Plugin\Custom\PSC\FormBuilder\Ui\OpenButton:
# tags: tags:
# - { name: psc.backend.custom.section } - { name: psc.backend.custom.buttons, productType: 6 }

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,40 @@
<?php
namespace Plugin\Custom\PSC\FormBuilder\Ui;
use PSC\Shop\EntityBundle\Entity\Product;
use PSC\System\PluginBundle\Form\Interfaces\Button;
use PSC\System\PluginBundle\Model\PluginButtonArea;
class OpenButton implements Button
{
private Product $product;
public function getModule(): int
{
return Button::Product;
}
public function getArea(): PluginButtonArea
{
return PluginButtonArea::Global;
}
public function setProduct(Product $product): self
{
$this->product = $product;
return $this;
}
public function render(): string
{
return (
'<a target="_blank" href="/apps/backend/component/formbuilder/product/edit?mode=1&uuid=' .
$this->product->getUUID() .
'&shop=' .
$this->product->getShop()->getUuid() .
'" class="btn btn-default btn-sm"><i class="fa fa-lg fa-fw fa-boxes"></i> Konfigurator</a>
'
);
}
}

View File

@ -4,21 +4,20 @@ namespace Plugin\System\PSC\XmlCalc\Api\Product;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes\JsonContent;
use OpenApi\Annotations as OA; use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use Plugin\System\PSC\XmlCalc\Dto\Input\PriceInput; use Plugin\System\PSC\XmlCalc\Dto\Input\PriceInput;
use Plugin\System\PSC\XmlCalc\Model\Product as PluginProduct; use Plugin\System\PSC\XmlCalc\Model\Product as PluginProduct;
use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Library\Calc\Engine; use PSC\Library\Calc\Engine;
use PSC\Library\Calc\PaperContainer; use PSC\Library\Calc\PaperContainer;
use PSC\Shop\ContactBundle\Model\Contact; use PSC\Shop\ContactBundle\Model\Contact;
use PSC\Shop\ContactBundle\Transformer\Model\Contact as ContactTransformer; use PSC\Shop\ContactBundle\Transformer\Model\Contact as ContactTransformer;
use PSC\Shop\EntityBundle\Entity\Product;
use PSC\System\SettingsBundle\Service\PaperDB; use PSC\System\SettingsBundle\Service\PaperDB;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@ -33,18 +32,13 @@ class Config extends AbstractController
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
) {} ) {}
/** #[Response(
* @OA\Response( response: 200,
* response=200, description: 'get config for product',
* description="get config for product", content: new JsonContent(ref: new Model(type: PluginProduct::class)),
* @OA\JsonContent(ref=@Model(type=\Plugin\System\PSC\XmlCalc\Model\Product::class)) )]
* ) #[RequestBody(ref: new Model(type: PriceInput::class))]
* @OA\RequestBody( #[Tag(name: 'Plugin/System/psc/Xmlcalc/Product')]
*
* @Model(type=\Plugin\System\PSC\XmlCalc\Dto\Input\PriceInput::class))
* )
* @OA\Tag(name="Plugin/System/psc/Xmlcalc/Product")
* */
#[Route(path: '/product/config', methods: ['POST'])] #[Route(path: '/product/config', methods: ['POST'])]
#[ParamConverter( #[ParamConverter(
'data', 'data',
@ -94,7 +88,7 @@ class Config extends AbstractController
'xml' => $engine->generateXML(true), 'xml' => $engine->generateXML(true),
'parameter' => $engine->getParameters(), 'parameter' => $engine->getParameters(),
'paperContainer' => $product->getShop()->getInstall()->getPaperContainer(), 'paperContainer' => $product->getShop()->getInstall()->getPaperContainer(),
'shopUuid' => $product->getShop()->getUid(), 'shopUuid' => $product->getShop()->getUuid(),
'formulas' => $engine->getFormulas(), 'formulas' => $engine->getFormulas(),
]); ]);
} }

View File

@ -4,9 +4,11 @@ namespace Plugin\System\PSC\XmlCalc\Api\Product;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes\JsonContent;
use OpenApi\Annotations as OA; use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use Plugin\System\PSC\XmlCalc\Dto\Input\DesignInput; use Plugin\System\PSC\XmlCalc\Dto\Input\DesignInput;
use Plugin\System\PSC\XmlCalc\Model\Product as PluginProduct; use Plugin\System\PSC\XmlCalc\Model\Product as PluginProduct;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
@ -33,18 +35,13 @@ class Design extends AbstractController
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
) {} ) {}
/** #[Response(
* @OA\Response( response: 200,
* response=200, description: 'get config for product',
* description="get config for product", content: new JsonContent(ref: new Model(type: PluginProduct::class)),
* @OA\JsonContent(ref=@Model(type=\Plugin\System\PSC\XmlCalc\Model\Product::class)) )]
* ) #[RequestBody(ref: new Model(type: DesignInput::class))]
* @OA\RequestBody( #[Tag(name: 'Plugin/System/psc/Xmlcalc/Product')]
*
* @Model(type=\Plugin\System\PSC\XmlCalc\Dto\Input\DesignInput::class))
* )
* @OA\Tag(name="Plugin/System/psc/Xmlcalc/Product")
* */
#[Route(path: '/product/design', methods: ['POST'])] #[Route(path: '/product/design', methods: ['POST'])]
#[ParamConverter( #[ParamConverter(
'data', 'data',

View File

@ -4,9 +4,11 @@ namespace Plugin\System\PSC\XmlCalc\Api\Product;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes\JsonContent;
use OpenApi\Annotations as OA; use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use Plugin\System\PSC\XmlCalc\Dto\Input\JsonInput; use Plugin\System\PSC\XmlCalc\Dto\Input\JsonInput;
use Plugin\System\PSC\XmlCalc\Model\Product as PluginProduct; use Plugin\System\PSC\XmlCalc\Model\Product as PluginProduct;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
@ -33,18 +35,13 @@ class Json extends AbstractController
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
) {} ) {}
/** #[Response(
* @OA\Response( response: 200,
* response=200, description: 'get config for product',
* description="get config for product", content: new JsonContent(ref: new Model(type: PluginProduct::class)),
* @OA\JsonContent(ref=@Model(type=\Plugin\System\PSC\XmlCalc\Model\Product::class)) )]
* ) #[RequestBody(ref: new Model(type: JsonInput::class))]
* @OA\RequestBody( #[Tag(name: 'Plugin/System/psc/Xmlcalc/Product')]
*
* @Model(type=\Plugin\System\PSC\XmlCalc\Dto\Input\JsonInput::class))
* )
* @OA\Tag(name="Plugin/System/psc/Xmlcalc/Product")
* */
#[Route(path: '/product/json', methods: ['POST'])] #[Route(path: '/product/json', methods: ['POST'])]
#[ParamConverter( #[ParamConverter(
'data', 'data',

View File

@ -4,8 +4,11 @@ namespace Plugin\System\PSC\XmlCalc\Api\Product;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use Plugin\System\PSC\XmlCalc\Dto\Input\PriceInput; use Plugin\System\PSC\XmlCalc\Dto\Input\PriceInput;
use Plugin\System\PSC\XmlCalc\Dto\Output\Display\Group as DisplayGroup; use Plugin\System\PSC\XmlCalc\Dto\Output\Display\Group as DisplayGroup;
use Plugin\System\PSC\XmlCalc\Dto\Output\PreCalc\Group; use Plugin\System\PSC\XmlCalc\Dto\Output\PreCalc\Group;
@ -15,6 +18,7 @@ use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Element;
use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Option; use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Option;
use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Input\Max as PluginMax; use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Input\Max as PluginMax;
use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Input\Min; use Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Input\Min;
use Plugin\System\PSC\XmlCalc\Dto\Output\PriceOutput;
use PSC\Library\Calc\Engine; use PSC\Library\Calc\Engine;
use PSC\Library\Calc\Error\Validation\Input\Max; use PSC\Library\Calc\Error\Validation\Input\Max;
use PSC\Library\Calc\Error\Validation\Input\Min as PSCMin; use PSC\Library\Calc\Error\Validation\Input\Min as PSCMin;
@ -28,15 +32,10 @@ use PSC\Shop\ContactBundle\Transformer\Model\Contact as ContactTransformer;
use PSC\Shop\EntityBundle\Entity\Product; use PSC\Shop\EntityBundle\Entity\Product;
use PSC\System\SettingsBundle\Service\Help; use PSC\System\SettingsBundle\Service\Help;
use PSC\System\SettingsBundle\Service\PaperDB; use PSC\System\SettingsBundle\Service\PaperDB;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Yaml\Yaml;
class Preview extends AbstractController class Preview extends AbstractController
{ {
@ -77,20 +76,13 @@ class Preview extends AbstractController
$this->helpService = $helpService; $this->helpService = $helpService;
} }
/** #[Response(
* get price response: 200,
* description: 'generate preview',
* @OA\Response( content: new JsonContent(ref: new Model(type: PriceOutput::class)),
* response=200, )]
* description="orders", #[RequestBody(ref: new Model(type: PriceInput::class))]
* @OA\JsonContent(ref=@Model(type=\Plugin\System\PSC\XmlCalc\Dto\Output\PriceOutput::class)) #[Tag(name: 'Plugin/System/psc/Xmlcalc/Price')]
* )
* @OA\RequestBody(
*
* @Model(type=\Plugin\System\PSC\XmlCalc\Dto\Input\PriceInput::class))
* )
* @OA\Tag(name="Plugin/System/psc/Xmlcalc/Price")
*/
#[Route(path: '/product/preview', methods: ['POST'])] #[Route(path: '/product/preview', methods: ['POST'])]
#[ParamConverter( #[ParamConverter(
'data', 'data',
@ -163,94 +155,7 @@ class Preview extends AbstractController
* @var Base $option * @var Base $option
*/ */
foreach ($engine->getArticle()->getOptions() as $option) { foreach ($engine->getArticle()->getOptions() as $option) {
$tmp = new Element(); $output->elements[] = $this->parseOption($option);
$tmp->name = $option->getName();
$tmp->required = $option->isRequire();
if (is_array($option->getRawValue())) {
$tmp->rawValues = $option->getRawValue();
} else {
$tmp->rawValue = $option->getRawValue();
}
if ($option->getDefault()) {
$tmp->defaultValue = $option->getDefault();
}
$tmp->value = $option->getValue();
if ($help = $this->helpService->getHelp((string) $product->getUid(), $option->getId())) {
$tmp->help = $help->helpText;
$tmp->helpTitle = $help->helpTitle;
} else {
$tmp->help = $option->getHelp();
$tmp->helpLink = $option->getHelpLink();
}
$tmp->id = $option->getId();
$tmp->valid = $option->isValid();
$tmp->htmlType = $option->type;
$tmp->displayGroup = $option->getDisplayGroup();
if ($option->type == 'select' || $option->type == 'checkbox' || $option->type == 'radio') {
/**
* @var Opt $option
*/
if ($option instanceof ColorDBSelect) {
$tmp->colorSystem = $option->getColorSystem();
if (!isset($output->colorDb[$option->getColorSystem()])) {
$output->colorDb[$option->getColorSystem()] = [];
foreach ($option->getOptions() as $opt) {
$element = array_find((array) $option->getSelectedOptions(), function (Opt $o1) use ($opt) {
return $o1->getId() === $opt->getId();
});
$tmpOpt = new Option();
$tmpOpt->id = $opt->getId();
$tmpOpt->name = $opt->getLabel();
$tmpOpt->prefix = $opt->getPrefix();
$tmpOpt->suffix = $opt->getSuffix();
$tmpOpt->valid = $opt->isValid();
$tmpOpt->selected = $element ? true : false;
$output->colorDb[$option->getColorSystem()][] = $tmpOpt;
}
}
} else {
foreach ($option->getOptions() as $opt) {
$element = array_find((array) $option->getSelectedOptions(), function (Opt $o1) use ($opt) {
return $o1->getId() === $opt->getId();
});
if ($option instanceof DeliverySelect) {
$tmpOpt = new Option();
$tmpOpt->id = $opt->getId();
$tmpOpt->name = $opt->getLabel();
$tmpOpt->valid = $opt->isValid();
$tmpOpt->selected = $element ? true : false;
$tmpOpt->info = $opt->getInfo();
$tmpOpt->deliveryDate = $opt->getDeliveryDateAsString();
} else {
$tmpOpt = new Option();
$tmpOpt->id = $opt->getId();
$tmpOpt->name = $opt->getLabel();
$tmpOpt->valid = $opt->isValid();
$tmpOpt->selected = $element ? true : false;
}
$tmp->options[] = $tmpOpt;
}
}
}
if ($option->type == 'input') {
$tmp->minValue = $option->getMinValue();
$tmp->maxValue = $option->getMaxValue();
$tmp->placeHolder = $option->getPlaceHolder();
$tmp->pattern = $option->getPattern();
foreach ($option->getValidationErrors() as $error) {
if ($error instanceof PSCMin) {
$tmp->validationErrors[] = new Min($tmp->value, $option->getMinValue());
}
if ($error instanceof Max) {
$tmp->validationErrors[] = new PluginMax($tmp->value, $option->getMaxValue());
}
}
}
$output->elements[] = $tmp;
} }
foreach ($engine->getArticle()->getPreCalc()->getGroups() as $group) { foreach ($engine->getArticle()->getPreCalc()->getGroups() as $group) {
@ -284,4 +189,105 @@ class Preview extends AbstractController
} }
return $this->json($output); return $this->json($output);
} }
private function parseOption($option): Element
{
$tmp = new Element();
$tmp->name = $option->getName();
$tmp->required = $option->isRequire();
if (is_array($option->getRawValue())) {
$tmp->rawValues = $option->getRawValue();
} else {
$tmp->rawValue = $option->getRawValue();
}
if ($option->getDefault()) {
$tmp->defaultValue = $option->getDefault();
}
$tmp->value = $option->getValue();
if ($help = $this->helpService->getHelp((string) $product->getUid(), $option->getId())) {
$tmp->help = $help->helpText;
$tmp->helpTitle = $help->helpTitle;
} else {
$tmp->help = $option->getHelp();
$tmp->helpLink = $option->getHelpLink();
}
$tmp->id = $option->getId();
$tmp->valid = $option->isValid();
$tmp->htmlType = $option->type;
$tmp->displayGroup = $option->getDisplayGroup();
if ($option->type == 'select' || $option->type == 'checkbox' || $option->type == 'radio') {
/**
* @var Opt $option
*/
if ($option instanceof ColorDBSelect) {
$tmp->colorSystem = $option->getColorSystem();
if (!isset($output->colorDb[$option->getColorSystem()])) {
$output->colorDb[$option->getColorSystem()] = [];
foreach ($option->getOptions() as $opt) {
$element = array_find((array) $option->getSelectedOptions(), function (Opt $o1) use ($opt) {
return $o1->getId() === $opt->getId();
});
$tmpOpt = new Option();
$tmpOpt->id = $opt->getId();
$tmpOpt->name = $opt->getLabel();
$tmpOpt->prefix = $opt->getPrefix();
$tmpOpt->suffix = $opt->getSuffix();
$tmpOpt->valid = $opt->isValid();
$tmpOpt->selected = $element ? true : false;
$output->colorDb[$option->getColorSystem()][] = $tmpOpt;
}
}
} else {
foreach ($option->getOptions() as $opt) {
$element = array_find((array) $option->getSelectedOptions(), function (Opt $o1) use ($opt) {
return $o1->getId() === $opt->getId();
});
if ($option instanceof DeliverySelect) {
$tmpOpt = new Option();
$tmpOpt->id = $opt->getId();
$tmpOpt->name = $opt->getLabel();
$tmpOpt->valid = $opt->isValid();
$tmpOpt->selected = $element ? true : false;
$tmpOpt->info = $opt->getInfo();
$tmpOpt->deliveryDate = $opt->getDeliveryDateAsString();
} else {
$tmpOpt = new Option();
$tmpOpt->id = $opt->getId();
$tmpOpt->name = $opt->getLabel();
$tmpOpt->valid = $opt->isValid();
$tmpOpt->selected = $element ? true : false;
}
$tmp->options[] = $tmpOpt;
}
}
}
if ($option->type == 'input') {
$tmp->minValue = $option->getMinValue();
$tmp->maxValue = $option->getMaxValue();
$tmp->placeHolder = $option->getPlaceHolder();
$tmp->pattern = $option->getPattern();
foreach ($option->getValidationErrors() as $error) {
if ($error instanceof PSCMin) {
$tmp->validationErrors[] = new Min($tmp->value, $option->getMinValue());
}
if ($error instanceof Max) {
$tmp->validationErrors[] = new PluginMax($tmp->value, $option->getMaxValue());
}
}
}
if ($option->type == 'row') {
foreach ($option->getColumns() as $column) {
$tmp->elements[] = $this->parseOption($column);
}
}
if ($option->type == 'column') {
foreach ($option->getOptions() as $option) {
$tmp->elements[] = $this->parseOption($option);
}
}
return $tmp;
}
} }

View File

@ -104,103 +104,118 @@ class PreviewDesigner extends AbstractController
} }
$engine->setTax(19); $engine->setTax(19);
$output->netto = $engine->getPrice() * 100; $output->netto = round($engine->getPrice() * 100);
$output->tax = $engine->getTaxPrice() * 100; $output->tax = round($engine->getTaxPrice() * 100);
$output->brutto = $engine->getCompletePrice() * 100; $output->brutto = round($engine->getCompletePrice() * 100);
/** /**
* @var Base $option * @var Base $option
*/ */
foreach ($engine->getArticle()->getOptions() as $option) { foreach ($engine->getArticle()->getOptions() as $option) {
$tmp = new Element(); $output->elements[] = $this->parseOption($option);
}
return $this->json($output);
}
private function parseOption($option): Element
{
$tmp = new Element();
if ($option->getName()) {
$tmp->name = $option->getName(); $tmp->name = $option->getName();
$tmp->required = $option->isRequire(); }
if (is_array($option->getRawValue())) { $tmp->required = $option->isRequire();
$tmp->rawValues = $option->getRawValue(); if (is_array($option->getRawValue())) {
} else { $tmp->rawValues = $option->getRawValue();
$tmp->rawValue = $option->getRawValue(); } else {
} $tmp->rawValue = $option->getRawValue();
if ($option->getDefault()) { }
$tmp->defaultValue = $option->getDefault(); if ($option->getDefault()) {
} $tmp->defaultValue = $option->getDefault();
$tmp->value = $option->getValue(); }
$tmp->value = $option->getValue();
if ($help = $this->helpService->getHelp(null, $option->getId())) { if ($help = $this->helpService->getHelp(null, $option->getId())) {
$tmp->help = $help->helpText; $tmp->help = $help->helpText;
$tmp->helpTitle = $help->helpTitle; $tmp->helpTitle = $help->helpTitle;
} else { } else {
$tmp->help = $option->getHelp(); $tmp->help = $option->getHelp();
$tmp->helpLink = $option->getHelpLink(); $tmp->helpLink = $option->getHelpLink();
} }
$tmp->id = $option->getId(); $tmp->id = $option->getId();
$tmp->valid = $option->isValid(); $tmp->valid = $option->isValid();
$tmp->htmlType = $option->type; $tmp->htmlType = $option->type;
$tmp->displayGroup = $option->getDisplayGroup(); $tmp->displayGroup = $option->getDisplayGroup();
if ($option->type == 'select' || $option->type == 'checkbox' || $option->type == 'radio') { if ($option->type == 'select' || $option->type == 'checkbox' || $option->type == 'radio') {
/** /**
* @var Opt $option * @var Opt $option
*/ */
if ($option instanceof ColorDBSelect) { if ($option instanceof ColorDBSelect) {
$tmp->colorSystem = $option->getColorSystem(); $tmp->colorSystem = $option->getColorSystem();
if (!isset($output->colorDb[$option->getColorSystem()])) { if (!isset($output->colorDb[$option->getColorSystem()])) {
$output->colorDb[$option->getColorSystem()] = []; $output->colorDb[$option->getColorSystem()] = [];
foreach ($option->getOptions() as $opt) {
$element = array_find((array) $option->getSelectedOptions(), function (Opt $o1) use ($opt) {
return $o1->getId() === $opt->getId();
});
$tmpOpt = new Option();
$tmpOpt->id = $opt->getId();
$tmpOpt->name = $opt->getLabel();
$tmpOpt->prefix = $opt->getPrefix();
$tmpOpt->suffix = $opt->getSuffix();
$tmpOpt->valid = $opt->isValid();
$tmpOpt->selected = $element ? true : false;
$output->colorDb[$option->getColorSystem()][] = $tmpOpt;
}
}
} else {
foreach ($option->getOptions() as $opt) { foreach ($option->getOptions() as $opt) {
$element = array_find((array) $option->getSelectedOptions(), function (Opt $o1) use ($opt) { $element = array_find((array) $option->getSelectedOptions(), function (Opt $o1) use ($opt) {
return $o1->getId() === $opt->getId(); return $o1->getId() === $opt->getId();
}); });
$tmpOpt = new Option();
if ($option instanceof DeliverySelect) { $tmpOpt->id = $opt->getId();
$tmpOpt = new Option(); $tmpOpt->name = $opt->getLabel();
$tmpOpt->id = $opt->getId(); $tmpOpt->prefix = $opt->getPrefix();
$tmpOpt->name = $opt->getLabel(); $tmpOpt->suffix = $opt->getSuffix();
$tmpOpt->valid = $opt->isValid(); $tmpOpt->valid = $opt->isValid();
$tmpOpt->selected = $element ? true : false; $tmpOpt->selected = $element ? true : false;
$tmpOpt->info = $opt->getInfo(); $output->colorDb[$option->getColorSystem()][] = $tmpOpt;
$tmpOpt->deliveryDate = $opt->getDeliveryDateAsString();
} else {
$tmpOpt = new Option();
$tmpOpt->id = $opt->getId();
$tmpOpt->name = $opt->getLabel();
$tmpOpt->valid = $opt->isValid();
$tmpOpt->selected = $element ? true : false;
}
$tmp->options[] = $tmpOpt;
} }
} }
} } else {
if ($option->type == 'input') { foreach ($option->getOptions() as $opt) {
$tmp->minValue = $option->getMinValue(); $element = array_find((array) $option->getSelectedOptions(), function (Opt $o1) use ($opt) {
$tmp->maxValue = $option->getMaxValue(); return $o1->getId() === $opt->getId();
$tmp->placeHolder = $option->getPlaceHolder(); });
$tmp->pattern = $option->getPattern();
foreach ($option->getValidationErrors() as $error) { if ($option instanceof DeliverySelect) {
if ($error instanceof PSCMin) { $tmpOpt = new Option();
$tmp->validationErrors[] = new Min($tmp->value, $option->getMinValue()); $tmpOpt->id = $opt->getId();
} $tmpOpt->name = $opt->getLabel();
if ($error instanceof Max) { $tmpOpt->valid = $opt->isValid();
$tmp->validationErrors[] = new PluginMax($tmp->value, $option->getMaxValue()); $tmpOpt->selected = $element ? true : false;
$tmpOpt->info = $opt->getInfo();
$tmpOpt->deliveryDate = $opt->getDeliveryDateAsString();
} else {
$tmpOpt = new Option();
$tmpOpt->id = $opt->getId();
$tmpOpt->name = $opt->getLabel();
$tmpOpt->valid = $opt->isValid();
$tmpOpt->selected = $element ? true : false;
} }
$tmp->options[] = $tmpOpt;
} }
} }
$output->elements[] = $tmp;
} }
return $this->json($output); if ($option->type == 'input') {
$tmp->minValue = $option->getMinValue();
$tmp->maxValue = $option->getMaxValue();
$tmp->placeHolder = $option->getPlaceHolder();
$tmp->pattern = $option->getPattern();
foreach ($option->getValidationErrors() as $error) {
if ($error instanceof PSCMin) {
$tmp->validationErrors[] = new Min($tmp->value, $option->getMinValue());
}
if ($error instanceof Max) {
$tmp->validationErrors[] = new PluginMax($tmp->value, $option->getMaxValue());
}
}
}
if ($option->type == 'row') {
foreach ($option->getColumns() as $column) {
$tmp->elements[] = $this->parseOption($column);
}
}
if ($option->type == 'column') {
foreach ($option->getOptions() as $option) {
$tmp->elements[] = $this->parseOption($option);
}
}
return $tmp;
} }
} }

View File

@ -2,22 +2,24 @@
namespace Plugin\System\PSC\XmlCalc\Api\Product; namespace Plugin\System\PSC\XmlCalc\Api\Product;
use PSC\Shop\EntityBundle\Entity\Product as PSCProduct;
use Plugin\System\PSC\XmlCalc\Model\Product;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Attribute\Security;
use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use Plugin\System\PSC\XmlCalc\Model\Product;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Shop\EntityBundle\Entity\Product as PSCProduct;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Nelmio\ApiDocBundle\Annotation\Security; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use OpenApi\Annotations as OA;
use Nelmio\ApiDocBundle\Annotation\Model;
class Update extends AbstractController {
class Update extends AbstractController
{
private EntityManagerInterface $entityManager; private EntityManagerInterface $entityManager;
public function __construct(EntityManagerInterface $entityManager) public function __construct(EntityManagerInterface $entityManager)
@ -25,33 +27,30 @@ class Update extends AbstractController {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
} }
/** #[Response(
* change product response: 200,
* description: 'update product',
* @OA\Response( content: new JsonContent(ref: new Model(type: Product::class)),
* response=200, )]
* description="update product", #[Security(name: 'Bearer')]
* @OA\JsonContent(ref=@Model(type=\Plugin\System\PSC\XmlCalc\Model\Product::class)) #[RequestBody(ref: new Model(type: Product::class))]
* ) #[Tag(name: 'Plugin/System/psc/Xmlcalc/Product')]
* @OA\RequestBody(
* description="This is a request body",
* @Model(type=\Plugin\System\PSC\XmlCalc\Model\Product::class)
* )
* @OA\Tag(name="Plugin/System/psc/Xmlcalc/Product")
* @Security(name="Bearer")
*/
#[Route(path: '/product/{uuid}', methods: ['PUT'])] #[Route(path: '/product/{uuid}', methods: ['PUT'])]
#[ParamConverter('productObj', class: '\Plugin\System\PSC\XmlCalc\Model\Product', converter: 'psc_rest.request_body')] #[ParamConverter(
'productObj',
class: '\Plugin\System\PSC\XmlCalc\Model\Product',
converter: 'psc_rest.request_body',
)]
#[IsGranted('ROLE_USER')] #[IsGranted('ROLE_USER')]
public function update(string $uuid, Product $productObj): JsonResponse public function update(string $uuid, Product $productObj): JsonResponse
{ {
$product = $this->entityManager->getRepository(PSCProduct::class)->findOneBy(['uuid' => $uuid]); $product = $this->entityManager->getRepository(PSCProduct::class)->findOneBy(['uuid' => $uuid]);
if(!$product) { if (!$product) {
return $this->json(new NotFound('paper not found')); return $this->json(new NotFound('paper not found'));
} }
if($productObj->calcXml !== null) { if ($productObj->calcXml !== null) {
$product->setCalcXml($productObj->calcXml); $product->setCalcXml($productObj->calcXml);
} }
@ -60,5 +59,4 @@ class Update extends AbstractController {
return $this->json($productObj); return $this->json($productObj);
} }
} }

View File

@ -4,9 +4,11 @@ namespace Plugin\System\PSC\XmlCalc\Api\Product;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes\JsonContent;
use OpenApi\Annotations as OA; use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use Plugin\System\PSC\XmlCalc\Dto\Input\XMLInput; use Plugin\System\PSC\XmlCalc\Dto\Input\XMLInput;
use Plugin\System\PSC\XmlCalc\Model\Product as PluginProduct; use Plugin\System\PSC\XmlCalc\Model\Product as PluginProduct;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
@ -33,18 +35,13 @@ class XML extends AbstractController
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
) {} ) {}
/** #[Response(
* @OA\Response( response: 200,
* response=200, description: 'get config for product',
* description="get config for product", content: new JsonContent(ref: new Model(type: PluginProduct::class)),
* @OA\JsonContent(ref=@Model(type=\Plugin\System\PSC\XmlCalc\Model\Product::class)) )]
* ) #[RequestBody(ref: new Model(type: XMLInput::class))]
* @OA\RequestBody( #[Tag(name: 'Plugin/System/psc/Xmlcalc/Product')]
*
* @Model(type=\Plugin\System\PSC\XmlCalc\Dto\Input\XML::class))
* )
* @OA\Tag(name="Plugin/System/psc/Xmlcalc/Product")
* */
#[Route(path: '/product/xml', methods: ['POST'])] #[Route(path: '/product/xml', methods: ['POST'])]
#[ParamConverter( #[ParamConverter(
'data', 'data',

View File

@ -17,5 +17,5 @@ final class PDInput
public array $json = []; public array $json = [];
#[Property(type: 'array', items: new Items(type: 'string'))] #[Property(type: 'array', items: new Items(type: 'string'))]
public array $values = ['auflage' => 100]; public array $values = [];
} }

View File

@ -33,6 +33,5 @@ final class PriceInput
* *
* @OA\Property(type="array", @OA\Items(type="string")) * @OA\Property(type="array", @OA\Items(type="string"))
*/ */
public array $values = ['auflage' => 100]; public array $values = [];
} }

View File

@ -32,5 +32,5 @@ final class XMLInput
* *
* @OA\Property(type="array", @OA\Items(type="string")) * @OA\Property(type="array", @OA\Items(type="string"))
*/ */
public array $values = ['auflage' => 100]; public array $values = [];
} }

View File

@ -4,6 +4,8 @@ namespace Plugin\System\PSC\XmlCalc\Dto\Output\Price;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Items;
use OpenApi\Attributes\Property;
class Element class Element
{ {
@ -26,35 +28,35 @@ class Element
* *
* @OA\Property(type="string") * @OA\Property(type="string")
*/ */
public string $pattern = ""; public string $pattern = '';
/** /**
* @var string * @var string
* *
* @OA\Property(type="string") * @OA\Property(type="string")
*/ */
public string $colorSystem = ""; public string $colorSystem = '';
/** /**
* @var string * @var string
* *
* @OA\Property(type="string") * @OA\Property(type="string")
*/ */
public string $placeHolder = ""; public string $placeHolder = '';
/** /**
* @var string * @var string
* *
* @OA\Property(type="string") * @OA\Property(type="string")
*/ */
public string $displayGroup = ""; public string $displayGroup = '';
/** /**
* @var string * @var string
* *
* @OA\Property(type="string") * @OA\Property(type="string")
*/ */
public string $defaultValue = ""; public string $defaultValue = '';
/** /**
* @var string * @var string
@ -66,29 +68,21 @@ class Element
/** /**
* @OA\Property(type="integer") * @OA\Property(type="integer")
*/ */
public ?int $minValue; public null|int $minValue;
/** /**
* @OA\Property(type="integer") * @OA\Property(type="integer")
*/ */
public ?int $maxValue; public null|int $maxValue;
/** #[Property(type: 'string')]
* @OA\Property(type="string") public null|string $help;
*/
public ?string $help;
/**
* @OA\Property(type="string")
*/
public ?string $helpTitle;
#[Property(type: 'string')]
public null|string $helpTitle;
/** #[Property(type: 'string')]
* @OA\Property(type="string") public null|string $helpLink;
*/
public ?string $helpLink;
/** /**
* @var bool * @var bool
@ -104,11 +98,7 @@ class Element
*/ */
public bool $required = false; public bool $required = false;
/** #[Property(type: 'string')]
* @var string
*
* @OA\Property(type="string")
*/
public string $rawValue; public string $rawValue;
/** /**
@ -118,11 +108,7 @@ class Element
*/ */
public array $rawValues = []; public array $rawValues = [];
/** #[Property(type: 'string')]
* @var string
*
* @OA\Property(type="string")
*/
public string $type; public string $type;
/** /**
@ -132,11 +118,10 @@ class Element
*/ */
public array $options = []; public array $options = [];
/** #[Property(type: 'array', items: new Items(ref: new Model(type: Element::class)))]
* @var string public array $elements = [];
*
* @OA\Property(type="string") #[Property(type: 'string')]
*/
public string $htmlType = 'input'; public string $htmlType = 'input';
/** @var Error[] /** @var Error[]
@ -144,5 +129,4 @@ class Element
* @OA\Property(type="array", @OA\Items(ref=@Model(type=\Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Error::class))) * @OA\Property(type="array", @OA\Items(ref=@Model(type=\Plugin\System\PSC\XmlCalc\Dto\Output\Price\Validation\Error::class)))
*/ */
public array $validationErrors = []; public array $validationErrors = [];
} }

View File

@ -6,20 +6,20 @@ use Brick\Math\RoundingMode;
use Brick\Money\Money; use Brick\Money\Money;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PSC\Shop\ContactBundle\Model\Contact;
use Plugin\System\PSC\XmlCalc\Model\ProductSpecialObject; use Plugin\System\PSC\XmlCalc\Model\ProductSpecialObject;
use PSC\Library\Calc\Engine; use PSC\Library\Calc\Engine;
use PSC\Library\Calc\Option\Type\Hidden; use PSC\Library\Calc\Option\Type\Hidden;
use PSC\Library\Calc\Option\Type\Select; use PSC\Library\Calc\Option\Type\Select;
use PSC\Library\Calc\PaperContainer; use PSC\Library\Calc\PaperContainer;
use PSC\Shop\ContactBundle\Model\Contact;
use PSC\Shop\OrderBundle\Model\Order\Position; use PSC\Shop\OrderBundle\Model\Order\Position;
use PSC\Shop\OrderBundle\Model\Order\Position\Price; use PSC\Shop\OrderBundle\Model\Order\Position\Price;
use PSC\Shop\OrderBundle\Model\Order\Tax; use PSC\Shop\OrderBundle\Model\Order\Tax;
use PSC\Shop\OrderBundle\Model\Order\TaxEnum; use PSC\Shop\OrderBundle\Model\Order\TaxEnum;
use PSC\Shop\ProductBundle\Interfaces\ICalcNeedContact;
use PSC\Shop\ProductBundle\Interfaces\IProducerHydrateModel; use PSC\Shop\ProductBundle\Interfaces\IProducerHydrateModel;
use PSC\Shop\ProductBundle\Interfaces\IProductTransformer; use PSC\Shop\ProductBundle\Interfaces\IProductTransformer;
use PSC\Shop\ProductBundle\Interfaces\IUiProducer; use PSC\Shop\ProductBundle\Interfaces\IUiProducer;
use PSC\Shop\ProductBundle\Interfaces\ICalcNeedContact;
use PSC\Shop\ProductBundle\Model\Product; use PSC\Shop\ProductBundle\Model\Product;
use PSC\System\SettingsBundle\Service\PaperDB; use PSC\System\SettingsBundle\Service\PaperDB;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
@ -32,10 +32,14 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
private Product $product; private Product $product;
private Engine $engine; private Engine $engine;
private EntityManagerInterface $entityManager; private EntityManagerInterface $entityManager;
private ?Contact $contact = null; private null|Contact $contact = null;
public function __construct(Shop $shopService, PaperDB $paperService, DocumentManager $documentManager, EntityManagerInterface $entityManager) public function __construct(
{ Shop $shopService,
PaperDB $paperService,
DocumentManager $documentManager,
EntityManagerInterface $entityManager,
) {
$this->shopService = $shopService; $this->shopService = $shopService;
$this->paperService = $paperService; $this->paperService = $paperService;
$this->mongoService = $documentManager; $this->mongoService = $documentManager;
@ -51,8 +55,8 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
public function setParams(array $params): void public function setParams(array $params): void
{ {
/** /**
* @var ProductSpecialObject $specProd * @var ProductSpecialObject $specProd
*/ */
$specProd = $this->product->getSpecialProductTypeObject(); $specProd = $this->product->getSpecialProductTypeObject();
$specProd->setParams($params); $specProd->setParams($params);
} }
@ -64,18 +68,25 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
public function getPrice(): Price public function getPrice(): Price
{ {
$this->setVariables(); $this->setVariables();
/** /**
* @var ProductSpecialObject $specProd * @var ProductSpecialObject $specProd
*/ */
$specProd = $this->product->getSpecialProductTypeObject(); $specProd = $this->product->getSpecialProductTypeObject();
$priceObj = Money::ofMinor($this->engine->getPrice() * 100, 'EUR'); $priceObj = Money::ofMinor($this->engine->getPrice() * 100, 'EUR');
$price = new Price(); $price = new Price();
$price->setNet($priceObj->getMinorAmount()->toInt()); $price->setNet($priceObj->getMinorAmount()->toInt());
$price->setVat($priceObj->toRational()->dividedBy(100)->multipliedBy($specProd->getTaxClass() / 100)->to($priceObj->getContext(), RoundingMode::UP)->getMinorAmount()->toInt()); $price->setVat(
$priceObj
->toRational()
->dividedBy(100)
->multipliedBy($specProd->getTaxClass() / 100)
->to($priceObj->getContext(), RoundingMode::UP)
->getMinorAmount()
->toInt(),
);
$price->setGross($price->getNet() + $price->getVat()); $price->setGross($price->getNet() + $price->getVat());
$price->setCount(1); $price->setCount(1);
$price->setAllNet($price->getNet()); $price->setAllNet($price->getNet());
@ -90,15 +101,15 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
{ {
if ($this->product->getSpecialProductTypeObject()) { if ($this->product->getSpecialProductTypeObject()) {
/** /**
* @var ProductSpecialObject $specProd * @var ProductSpecialObject $specProd
*/ */
$specProd = $this->product->getSpecialProductTypeObject(); $specProd = $this->product->getSpecialProductTypeObject();
$this->engine->setVariables($specProd->getParams()); $this->engine->setVariables($specProd->getParams());
if ($this->contact && $this->contact->getAccountType()->value > 1) { if ($this->contact && $this->contact->getAccountType()->value > 1) {
$this->engine->setVariable('contact.accountType', $this->contact->getAccountType()->value); $this->engine->setVariable('contact.accountType', $this->contact->getAccountType()->value);
$this->engine->setVariable('contact.account', $this->contact->getAccount()->getUid()); $this->engine->setVariable('contact.account', $this->contact->getAccount()->getUid());
} }
$this->engine->calc(); $this->engine->calc();
} }
} }
@ -115,7 +126,9 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
$paperContainer = new PaperContainer(); $paperContainer = new PaperContainer();
if ($this->product->getSpecialProductTypeObject() && $this->product->getSpecialProductTypeObject()->getXml()) { if ($this->product->getSpecialProductTypeObject() && $this->product->getSpecialProductTypeObject()->getXml()) {
$shop = $this->shopService->getShopByUid($this->product->getShopUuid()); $shop = $this->shopService->getShopByUid($this->product->getShopUuid());
$engine = new Engine(); $paperContainer->parse(simplexml_load_string($shop->getInstall()->getPaperContainer()));
$engine->setPaperRepository($this->paperService);
$engine->setPaperContainer($paperContainer);
$engine->loadString($this->product->getSpecialProductTypeObject()->getXml()); $engine->loadString($this->product->getSpecialProductTypeObject()->getXml());
if ($shop) { if ($shop) {
$engine->setFormulas($shop->getFormel()); $engine->setFormulas($shop->getFormel());
@ -123,31 +136,35 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
} }
} elseif ($this->product->getUid()) { } elseif ($this->product->getUid()) {
/** /**
* @var \PSC\Shop\EntityBundle\Entity\Product $product * @var \PSC\Shop\EntityBundle\Entity\Product $product
*/ */
$product = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Product::class)->find($this->product->getUid()); $product = $this->entityManager
->getRepository(\PSC\Shop\EntityBundle\Entity\Product::class)
->find($this->product->getUid());
$paperContainer->parse(simplexml_load_string($product->getShop()->getInstall()->getPaperContainer())); $paperContainer->parse(simplexml_load_string($product->getShop()->getInstall()->getPaperContainer()));
$engine = new Engine(); $engine = new Engine();
$engine->setPaperRepository($this->paperService); $engine->setPaperRepository($this->paperService);
$engine->setPaperContainer($paperContainer); $engine->setPaperContainer($paperContainer);
if ($product->getShop()->getInstall()->getCalcTemplates()) { if ($product->getShop()->getInstall()->getCalcTemplates()) {
$engine->setTemplates('<root>'.$product->getShop()->getInstall()->getCalcTemplates().'</root>'); $engine->setTemplates('<root>' . $product->getShop()->getInstall()->getCalcTemplates() . '</root>');
} }
$engine->loadString($product->getCalcXml()); $engine->loadString($product->getCalcXml());
$engine->setFormulas($product->getShop()->getFormel()); $engine->setFormulas($product->getShop()->getFormel());
$engine->setParameters($product->getShop()->getParameter()); $engine->setParameters($product->getShop()->getParameter());
} elseif ($this->product->getUuid()) { } elseif ($this->product->getUuid()) {
/** /**
* @var \PSC\Shop\EntityBundle\Entity\Product $product * @var \PSC\Shop\EntityBundle\Entity\Product $product
*/ */
$product = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Product::class)->findOneBy(['uuid' => $this->product->getUuid()]); $product = $this->entityManager
->getRepository(\PSC\Shop\EntityBundle\Entity\Product::class)
->findOneBy(['uuid' => $this->product->getUuid()]);
$paperContainer->parse(simplexml_load_string($product->getShop()->getInstall()->getPaperContainer())); $paperContainer->parse(simplexml_load_string($product->getShop()->getInstall()->getPaperContainer()));
$engine = new Engine(); $engine = new Engine();
$engine->setPaperRepository($this->paperService); $engine->setPaperRepository($this->paperService);
$engine->setPaperContainer($paperContainer); $engine->setPaperContainer($paperContainer);
if ($product->getShop()->getInstall()->getCalcTemplates()) { if ($product->getShop()->getInstall()->getCalcTemplates()) {
$engine->setTemplates('<root>'.$product->getShop()->getInstall()->getCalcTemplates().'</root>'); $engine->setTemplates('<root>' . $product->getShop()->getInstall()->getCalcTemplates() . '</root>');
} }
$engine->loadString($product->getCalcXml()); $engine->loadString($product->getCalcXml());
$engine->setFormulas($product->getShop()->getFormel()); $engine->setFormulas($product->getShop()->getFormel());
@ -164,16 +181,14 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
public function getJsonForm(): array public function getJsonForm(): array
{ {
$this->setVariables(); $this->setVariables();
$temp = [ $temp = [
'title' => $this->product->getTitle(), 'title' => $this->product->getTitle(),
'type' => 'object', 'type' => 'object',
'properties' => [], 'properties' => [],
'required' => [] 'required' => [],
]; ];
foreach ($this->engine->getArticle()->getOptions() as $option) { foreach ($this->engine->getArticle()->getOptions() as $option) {
if (!$option->isValid()) { if (!$option->isValid()) {
continue; continue;
@ -183,23 +198,25 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
} }
if ($option instanceof Select) { if ($option instanceof Select) {
$temp['properties'][$option->getId()] = [ $temp['properties'][$option->getId()] = [
'type' => 'string', 'type' => 'string',
'title' => $option->getName(), 'title' => $option->getName(),
'oneOf' => [], 'oneOf' => [],
'default' => $option->getSelectedOption()->getId() 'default' => $option->getSelectedOption()->getId(),
]; ];
foreach ($option->getValidOptions() as $opt) { foreach ($option->getValidOptions() as $opt) {
if ($opt->isValid()) { if ($opt->isValid()) {
$temp['properties'][$option->getId()]['oneOf'][] = ['title' => $opt->getLabel(), 'const' => $opt->getId()]; $temp['properties'][$option->getId()]['oneOf'][] = [
'title' => $opt->getLabel(),
'const' => $opt->getId(),
];
} }
} }
} else { } else {
$temp['properties'][$option->getId()] = [ $temp['properties'][$option->getId()] = [
'type' => 'string', 'type' => 'string',
'title' => $option->getName(), 'title' => $option->getName(),
'default' => $option->getRawValue() 'default' => $option->getRawValue(),
]; ];
} }
} }
@ -210,21 +227,20 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
public function getUiJsonForm(): array public function getUiJsonForm(): array
{ {
$temp = [ $temp = [
"ui:submitButtonOptions" => [ 'ui:submitButtonOptions' => [
"submitText" => "Save", 'submitText' => 'Save',
"norender" => true, 'norender' => true,
"props" => [ 'props' => [
"disabled" => false, 'disabled' => false,
"className" => "btn btn-info" 'className' => 'btn btn-info',
] ],
] ],
]; ];
foreach ($this->engine->getArticle()->getOptions() as $option) { foreach ($this->engine->getArticle()->getOptions() as $option) {
if ($option instanceof Hidden) { if ($option instanceof Hidden) {
$temp[$option->getId()] = [ $temp[$option->getId()] = [
'ui:widget' => 'hidden', 'ui:widget' => 'hidden',
]; ];
} }
} }
@ -232,7 +248,7 @@ class Producer implements IUiProducer, IProducerHydrateModel, ICalcNeedContact
return $temp; return $temp;
} }
public function setContact(?Contact $contact): void public function setContact(null|Contact $contact): void
{ {
$this->contact = $contact; $this->contact = $contact;
} }

File diff suppressed because it is too large Load Diff

View File

@ -4121,6 +4121,14 @@ class UserController extends TP_Controller_Action
$this->redirectSpeak('/basket/anfrage'); $this->redirectSpeak('/basket/anfrage');
return; return;
} }
if (file_exists($this->_templatePath . '/user/cregister.phtml')) {
if ($this->_getParam('mode') == 'basket') {
$this->_redirect('/user/cregister?mode=basket');
} else {
$this->_redirect('/user/cregister');
}
return;
}
if ($this->_request->getParam('mode') == 'basket') { if ($this->_request->getParam('mode') == 'basket') {
$this->view->priorityMessenger('Register successfull', 'success'); $this->view->priorityMessenger('Register successfull', 'success');
@ -4173,21 +4181,32 @@ class UserController extends TP_Controller_Action
{ {
if ($this->_request->getParam('contact', false)) { if ($this->_request->getParam('contact', false)) {
$vars = explode('*', $this->_request->getParam('contact', false)); $vars = explode('*', $this->_request->getParam('contact', false));
if ('nsWXSoLmx8TNEjdE8fbn' != $vars[1]) { if (count($vars) == 1) {
die('Not allowed'); if ('nsWXSoLmx8TNEjdE8fbn' != $this->_request->getParam('apikey', false)) {
die('Not allowed');
}
$_authAdapter = new TP_Plugin_AuthAdapter(); // put this in a constructor?
$_authAdapter->setApiLogin(true);
$_authAdapter->setIdentity($vars[0]);
$result = Zend_Auth::getInstance()->authenticate($_authAdapter);
} else {
if ('nsWXSoLmx8TNEjdE8fbn' != $vars[1]) {
die('Not allowed');
}
$_authAdapter = new TP_Plugin_AuthAdapter(); // put this in a constructor?
$_authAdapter->setApiLogin(true);
$_authAdapter->setIdentity($vars[0]);
$result = Zend_Auth::getInstance()->authenticate($_authAdapter);
$_SESSION['browser_form_post_url'] = urldecode($vars[2]);
$_SESSION['from_identity'] = urldecode($vars[3]);
$_SESSION['to_identity'] = urldecode($vars[4]);
$_SESSION['sender_domain'] = urldecode($vars[5]);
$_SESSION['sender_identity'] = urldecode($vars[6]);
$_SESSION['buyer_cookie'] = urldecode($vars[7]);
} }
$_authAdapter = new TP_Plugin_AuthAdapter(); // put this in a constructor?
$_authAdapter->setApiLogin(true);
$_authAdapter->setIdentity($vars[0]);
$result = Zend_Auth::getInstance()->authenticate($_authAdapter);
$_SESSION['browser_form_post_url'] = urldecode($vars[2]);
$_SESSION['from_identity'] = urldecode($vars[3]);
$_SESSION['to_identity'] = urldecode($vars[4]);
$_SESSION['sender_domain'] = urldecode($vars[5]);
$_SESSION['sender_identity'] = urldecode($vars[6]);
if ($result->isValid()) { if ($result->isValid()) {
return $this->redirectSpeak('/'); return $this->redirectSpeak('/');
} }
@ -4244,6 +4263,8 @@ class UserController extends TP_Controller_Action
urlencode((string) $xml->Header->Sender->Credential['domain']) . urlencode((string) $xml->Header->Sender->Credential['domain']) .
'*' . '*' .
urlencode((string) $xml->Header->Sender->Credential->Identity) . urlencode((string) $xml->Header->Sender->Credential->Identity) .
'*' .
urlencode((string) $xml->Request->PunchOutSetupRequest->BuyerCookie) .
'</URL>' . '</URL>' .
'</StartPage>' . '</StartPage>' .
'</PunchOutSetupResponse>' . '</PunchOutSetupResponse>' .
@ -4860,6 +4881,14 @@ class UserController extends TP_Controller_Action
} }
public function clogoutAction() public function clogoutAction()
{
Zend_Auth::getInstance()->clearIdentity();
$basket = new TP_Basket();
$basket->clear();
}
public function cregisterAction()
{ {
} }

View File

@ -23,7 +23,6 @@ class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
*/ */
protected $_apiLogin = false; protected $_apiLogin = false;
protected $_idLogin = false; protected $_idLogin = false;
/** /**
@ -58,10 +57,11 @@ class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
if ($this->_idLogin !== false) { if ($this->_idLogin !== false) {
$row = Doctrine_Query::create() $row = Doctrine_Query::create()
->from('Contact m') ->from('Contact m')
->where('m.id= ?', array($this->_idLogin)) ->where('m.id= ?', [$this->_idLogin])
->execute()->getFirst(); ->execute()
->getFirst();
$_identity = $row->toArray(true); $_identity = $row->toArray(true);
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank')); return new Zend_Auth_Result(true, $_identity, ['Erfolgreich authentifiziert an der Datendank']);
} }
$shop = Zend_Registry::get('shop'); $shop = Zend_Registry::get('shop');
@ -69,82 +69,102 @@ class TP_Plugin_AuthAdapter implements Zend_Auth_Adapter_Interface
if ($shop['install_id'] == 4999) { if ($shop['install_id'] == 4999) {
$row = Doctrine_Query::create() $row = Doctrine_Query::create()
->from('Contact m') ->from('Contact m')
->where('m.self_email = ? AND m.enable = 1 AND m.virtual = 0 AND m.install_id = ?', array($this->_identity, $shop['install_id'])) ->where('m.self_email = ? AND m.enable = 1 AND m.virtual = 0 AND m.install_id = ?', [
->execute()->getFirst(); $this->_identity,
$shop['install_id'],
])
->execute()
->getFirst();
} elseif ($this->_apiLogin) { } elseif ($this->_apiLogin) {
$row = Doctrine_Query::create() $row = Doctrine_Query::create()
->from('Contact m') ->from('Contact m')
->leftJoin('m.Shops as s') ->leftJoin('m.Shops as s')
->where('m.id = ? AND m.enable = 1 AND s.id = ?', array($this->_identity, $shop['id'])) ->where('(m.id = ? OR m.self_email = ?) AND m.enable = 1 AND s.id = ?', [
->execute()->getFirst(); $this->_identity,
$this->_identity,
$shop['id'],
])
->execute()
->getFirst();
} else { } else {
if ($shop['useemailaslogin'] == true) { if ($shop['useemailaslogin'] == true) {
$row = Doctrine_Query::create() $row = Doctrine_Query::create()
->from('Contact m') ->from('Contact m')
->leftJoin('m.Shops as s') ->leftJoin('m.Shops as s')
->where('m.self_email = ? AND m.enable = 1 AND m.virtual = 0 AND s.id = ?', array($this->_identity, $shop['id'])) ->where('m.self_email = ? AND m.enable = 1 AND m.virtual = 0 AND s.id = ?', [
->execute()->getFirst(); $this->_identity,
$shop['id'],
])
->execute()
->getFirst();
} else { } else {
$row = Doctrine_Query::create() $row = Doctrine_Query::create()
->from('Contact m') ->from('Contact m')
->leftJoin('m.Shops as s') ->leftJoin('m.Shops as s')
->where('m.name = ? AND m.enable = 1 AND m.virtual = 0 AND s.id = ?', array($this->_identity, $shop['id'])) ->where('m.name = ? AND m.enable = 1 AND m.virtual = 0 AND s.id = ?', [
->execute()->getFirst(); $this->_identity,
$shop['id'],
])
->execute()
->getFirst();
} }
} }
if ($row->password == "") { if ($row->password == '') {
return new Zend_Auth_Result(false, $_identity, array('empty password')); return new Zend_Auth_Result(false, $_identity, ['empty password']);
} }
// Es darf diesen Benutzer nur genau 1x geben // Es darf diesen Benutzer nur genau 1x geben
if (!isset($row->id)) { if (!isset($row->id)) {
return new Zend_Auth_Result(false, $_identity, array('Login failure')); return new Zend_Auth_Result(false, $_identity, ['Login failure']);
} }
if ($row->locked || $row->Account->locked) { if ($row->locked || $row->Account->locked) {
return new Zend_Auth_Result(false, $_identity, array('Sie wurden gesperrt')); return new Zend_Auth_Result(false, $_identity, ['Sie wurden gesperrt']);
} }
if ($row->id != '' && $row->password == $this->_credential && !$this->_apiLogin) { if ($row->id != '' && $row->password == $this->_credential && !$this->_apiLogin) {
$row->password = password_hash($row->password, PASSWORD_DEFAULT); $row->password = password_hash($row->password, PASSWORD_DEFAULT);
$row->save(); $row->save();
$_identity = $row->toArray(true); $_identity = $row->toArray(true);
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname']; $_identity['name1'] = $_identity['self_firstname'] . ' ' . $_identity['self_lastname'];
$dbMongo = TP_Mongo::getInstance(); $dbMongo = TP_Mongo::getInstance();
$dbMongo->Job->insertOne(array( $dbMongo->Job->insertOne([
"shop" => $shop['id'], 'shop' => $shop['id'],
"event" => "contact_login", 'event' => 'contact_login',
"data" => [ "contact" => $row->uuid ], 'data' => ['contact' => $row->uuid],
"created" => new MongoDB\BSON\UTCDateTime(), 'created' => new MongoDB\BSON\UTCDateTime(),
"updated" => new MongoDB\BSON\UTCDateTime() 'updated' => new MongoDB\BSON\UTCDateTime(),
)); ]);
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank')); return new Zend_Auth_Result(true, $_identity, ['Erfolgreich authentifiziert an der Datendank']);
} elseif (
} elseif (function_exists('password_verify') && password_verify($this->_credential, $row->password) && !$this->_apiLogin) { function_exists('password_verify') &&
password_verify($this->_credential, $row->password) &&
!$this->_apiLogin
) {
$_identity = $row->toArray(true); $_identity = $row->toArray(true);
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname']; $_identity['name1'] = $_identity['self_firstname'] . ' ' . $_identity['self_lastname'];
$dbMongo = TP_Mongo::getInstance(); $dbMongo = TP_Mongo::getInstance();
$dbMongo->Job->insertOne(array( $dbMongo->Job->insertOne([
"shop" => $shop['id'], 'shop' => $shop['id'],
"event" => "contact_login", 'event' => 'contact_login',
"data" => [ "contact" => $row->uuid ], 'data' => ['contact' => $row->uuid],
"created" => new MongoDB\BSON\UTCDateTime(), 'created' => new MongoDB\BSON\UTCDateTime(),
"updated" => new MongoDB\BSON\UTCDateTime() 'updated' => new MongoDB\BSON\UTCDateTime(),
)); ]);
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank')); return new Zend_Auth_Result(true, $_identity, ['Erfolgreich authentifiziert an der Datendank']);
} elseif ($this->_apiLogin) { } elseif ($this->_apiLogin) {
$_identity = $row->toArray(true); $_identity = $row->toArray(true);
$_identity['name1'] = $_identity['self_firstname'].' '.$_identity['self_lastname']; $_identity['name1'] = $_identity['self_firstname'] . ' ' . $_identity['self_lastname'];
$dbMongo = TP_Mongo::getInstance(); $dbMongo = TP_Mongo::getInstance();
$dbMongo->Job->insertOne(array( $dbMongo->Job->insertOne([
"shop" => $shop['id'], 'shop' => $shop['id'],
"event" => "contact_login", 'event' => 'contact_login',
"data" => [ "contact" => $row->uuid ], 'data' => ['contact' => $row->uuid],
"created" => new MongoDB\BSON\UTCDateTime(), 'created' => new MongoDB\BSON\UTCDateTime(),
"updated" => new MongoDB\BSON\UTCDateTime() 'updated' => new MongoDB\BSON\UTCDateTime(),
)); ]);
return new Zend_Auth_Result(true, $_identity, array('Erfolgreich authentifiziert an der Datendank')); return new Zend_Auth_Result(true, $_identity, ['Erfolgreich authentifiziert an der Datendank']);
} else { } else {
return new Zend_Auth_Result(false, $_identity, array('Passwort falsch!')); return new Zend_Auth_Result(false, $_identity, ['Passwort falsch!']);
} }
} }