diff --git a/src/new/.env b/src/new/.env index 4de9b9f50..604717e3c 100644 --- a/src/new/.env +++ b/src/new/.env @@ -31,5 +31,3 @@ JWT_PASSPHRASE=f7754c7a99638fe7162a144825ddaea7 # postgresql+advisory://db_user:db_password@localhost/db_name LOCK_DSN=flock ###< symfony/lock ### - -MAILER_DSN=smtp://smtp4dev:25 diff --git a/src/new/.env.dev b/src/new/.env.dev new file mode 100644 index 000000000..7bb56e140 --- /dev/null +++ b/src/new/.env.dev @@ -0,0 +1,2 @@ + +MAILER_DSN=smtp://smtp4dev:25 diff --git a/src/new/composer.json b/src/new/composer.json index a501f1772..282947c38 100755 --- a/src/new/composer.json +++ b/src/new/composer.json @@ -50,6 +50,7 @@ "nicolab/php-ftp-client": "^1.4", "oneup/uploader-bundle": "^5", "oyejorge/less.php": "~1.5", + "paypal/paypal-checkout-sdk": "^1.0", "paypal/paypal-server-sdk": "^2", "phenx/php-font-lib": "^1.0", "phpoffice/phpspreadsheet": "^1.28", diff --git a/src/new/composer.lock b/src/new/composer.lock index 3d4fe825b..b9bf96190 100755 --- a/src/new/composer.lock +++ b/src/new/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6c648aadd2d1a32e81bdc58fd18f23cc", + "content-hash": "59f5c6fa85a2165c7a1dccb2f12e1e60", "packages": [ { "name": "apimatic/core", @@ -6288,6 +6288,59 @@ }, "time": "2025-09-24T15:06:41+00:00" }, + { + "name": "paypal/paypal-checkout-sdk", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/paypal/Checkout-PHP-SDK.git", + "reference": "19992ce7051ff9e47e643f28abb8cc1b3e5f1812" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paypal/Checkout-PHP-SDK/zipball/19992ce7051ff9e47e643f28abb8cc1b3e5f1812", + "reference": "19992ce7051ff9e47e643f28abb8cc1b3e5f1812", + "shasum": "" + }, + "require": { + "paypal/paypalhttp": "1.0.1" + }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Sample\\": "samples/", + "PayPalCheckoutSdk\\": "lib/PayPalCheckoutSdk" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "https://github.com/paypal/Checkout-PHP-SDK/blob/master/LICENSE" + ], + "authors": [ + { + "name": "PayPal", + "homepage": "https://github.com/paypal/Checkout-PHP-SDK/contributors" + } + ], + "description": "PayPal's PHP SDK for Checkout REST APIs", + "homepage": "http://github.com/paypal/Checkout-PHP-SDK/", + "keywords": [ + "checkout", + "orders", + "payments", + "paypal", + "rest", + "sdk" + ], + "support": { + "source": "https://github.com/paypal/Checkout-PHP-SDK/tree/1.0.2" + }, + "abandoned": "paypal/paypal-server-sdk", + "time": "2021-09-21T20:57:38+00:00" + }, { "name": "paypal/paypal-server-sdk", "version": "2.1.0", @@ -6332,6 +6385,50 @@ }, "time": "2025-12-04T21:51:20+00:00" }, + { + "name": "paypal/paypalhttp", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/paypal/paypalhttp_php.git", + "reference": "7b09c89c80828e842c79230e7f156b61fbb68d25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paypal/paypalhttp_php/zipball/7b09c89c80828e842c79230e7f156b61fbb68d25", + "reference": "7b09c89c80828e842c79230e7f156b61fbb68d25", + "shasum": "" + }, + "require": { + "ext-curl": "*" + }, + "require-dev": { + "phpunit/phpunit": "^5.7", + "wiremock-php/wiremock-php": "1.43.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PayPalHttp\\": "lib/PayPalHttp" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PayPal", + "homepage": "https://github.com/paypal/paypalhttp_php/contributors" + } + ], + "support": { + "issues": "https://github.com/paypal/paypalhttp_php/issues", + "source": "https://github.com/paypal/paypalhttp_php/tree/1.0.1" + }, + "abandoned": true, + "time": "2021-09-14T21:35:26+00:00" + }, { "name": "phenx/php-font-lib", "version": "1.0.1", diff --git a/src/new/config/reference.php b/src/new/config/reference.php index 1875f986e..577739b43 100644 --- a/src/new/config/reference.php +++ b/src/new/config/reference.php @@ -474,7 +474,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; * datetime?: array{ * default_format?: scalar|null, // Default: "Y-m-d\\TH:i:sP" * default_deserialization_formats?: list, - * default_timezone?: scalar|null, // Default: "UTC" + * default_timezone?: scalar|null, // Default: "Europe/Berlin" * cdata?: scalar|null, // Default: true * }, * array_collection?: array{ @@ -574,7 +574,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; * datetime?: array{ * default_format?: scalar|null, // Default: "Y-m-d\\TH:i:sP" * default_deserialization_formats?: list, - * default_timezone?: scalar|null, // Default: "UTC" + * default_timezone?: scalar|null, // Default: "Europe/Berlin" * cdata?: scalar|null, // Default: true * }, * array_collection?: array{ diff --git a/src/new/src/PSC/Shop/EntityBundle/Entity/ProductProductgroup.php b/src/new/src/PSC/Shop/EntityBundle/Entity/ProductProductgroup.php index 13ae9f68b..a6cf84320 100755 --- a/src/new/src/PSC/Shop/EntityBundle/Entity/ProductProductgroup.php +++ b/src/new/src/PSC/Shop/EntityBundle/Entity/ProductProductgroup.php @@ -34,7 +34,7 @@ class ProductProductgroup #[ORM\ManyToOne(targetEntity: 'Product', inversedBy: 'groups')] #[ORM\JoinColumn(name: 'article_id', referencedColumnName: 'id', nullable: false)] protected $product; -/** + /** * Titel des Product * * @var int @@ -42,7 +42,8 @@ class ProductProductgroup #[ORM\Id] #[ORM\Column(name: 'articlegroup_id', type: 'integer')] protected $group; -/** + + /** * @return int */ public function getProduct() diff --git a/src/new/src/PSC/System/SettingsBundle/Resources/views/backend/settings/smtp_test.html.twig b/src/new/src/PSC/System/SettingsBundle/Resources/views/backend/settings/smtptest.html.twig old mode 100755 new mode 100644 similarity index 100% rename from src/new/src/PSC/System/SettingsBundle/Resources/views/backend/settings/smtp_test.html.twig rename to src/new/src/PSC/System/SettingsBundle/Resources/views/backend/settings/smtptest.html.twig diff --git a/src/new/var/plugins/Custom/PSC/Formular/Controller/Backend/SettingsController.php b/src/new/var/plugins/Custom/PSC/Formular/Controller/Backend/SettingsController.php index ce7999f2c..d33faa072 100755 --- a/src/new/var/plugins/Custom/PSC/Formular/Controller/Backend/SettingsController.php +++ b/src/new/var/plugins/Custom/PSC/Formular/Controller/Backend/SettingsController.php @@ -1,4 +1,5 @@ getSelectedShop(); $formular = new Formular(); @@ -45,43 +43,48 @@ class SettingsController extends AbstractController $documentManager->flush(); $session->getFlashBag()->add( 'success', - 'Formular \'' . $formular->getFormularname() . '\' has been created!' + 'Formular \'' . $formular->getFormularname() . '\' has been created!', + ); + $logService->createLogEntry( + $selectedShop, + $this->getUser(), + LogEntry::INFO, + SettingsController::class, + $formular->getFormularname(), + 'Formular created', ); - $logService->createLogEntry($selectedShop, $this->getUser(), LogEntry::INFO, SettingsController::class, $formular->getFormularname(), "Formular created"); return $this->redirectToRoute('plugin_custom_psc_formular_backend_list'); } return array('form' => $form->createView()); } - #[Template()] + #[Template('@PluginCustomPSCFormular/backend/settings/list.html.twig')] #[Route('/list', name: 'plugin_custom_psc_formular_backend_list')] public function listAction( Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, DocumentManager $documentManager, EntityManagerInterface $entityManager, - Field $fieldService - ) - { + Field $fieldService, + ) { $selectedShop = $shopService->getSelectedShop(); /** @var Plugin\Custom\PSC\Formular\Document\Formular $formular */ $formular = $documentManager ->getRepository('Plugin\Custom\PSC\Formular\Document\Formular') - ->findBy(array("shop" => (string)$selectedShop->getUid())); + ->findBy(array('shop' => (string) $selectedShop->getUid())); - $domains = $entityManager - ->getRepository(Domain::class)->getAllByShopId($selectedShop); + $domains = $entityManager->getRepository(Domain::class)->getAllByShopId($selectedShop); if (count($domains) > 0) { $domain = array_pop($domains)->getHost(); - }else{ + } else { $domain = false; } return array('formular' => $formular, 'domain' => $domain); } - #[Template()] + #[Template('@PluginCustomPSCFormular/backend/settings/edit.html.twig')] #[Route('/edit/{id}', name: 'plugin_custom_psc_formular_backend_edit')] public function editAction( Request $request, @@ -91,14 +94,13 @@ class SettingsController extends AbstractController Field $fieldService, SessionInterface $session, Log $logService, - $id - ) - { + $id, + ) { $selectedShop = $shopService->getSelectedShop(); /** @var Plugin\Custom\PSC\Formular\Document\Formular $formular */ $formular = $documentManager ->getRepository('Plugin\Custom\PSC\Formular\Document\Formular') - ->findOneBy(array("shop" => (string)$selectedShop->getUid(), "id" => $id)); + ->findOneBy(array('shop' => (string) $selectedShop->getUid(), 'id' => $id)); $form = $this->createForm(WebForm::class, $formular); @@ -108,31 +110,38 @@ class SettingsController extends AbstractController $documentManager->flush(); $session->getFlashBag()->add( 'success', - 'Formular \'' . $formular->getFormularname() . '\' has been updated!' + 'Formular \'' . $formular->getFormularname() . '\' has been updated!', + ); + $logService->createLogEntry( + $selectedShop, + $this->getUser(), + LogEntry::INFO, + SettingsController::class, + $formular->getFormularname(), + 'Formular updated', ); - $logService->createLogEntry($selectedShop, $this->getUser(), LogEntry::INFO, SettingsController::class, $formular->getFormularname(), "Formular updated"); } return array('form' => $form->createView()); } - #[Template()] + #[Template('@PluginCustomPSCFormular/backend/settings/delete.html.twig')] #[Route('/delete/{id}', name: 'plugin_custom_psc_formular_backend_delete')] public function deleteAction( Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, DocumentManager $documentManager, EntityManagerInterface $entityManager, - Field $fieldService, $id, + Field $fieldService, + $id, SessionInterface $session, - Log $logService - ) - { + Log $logService, + ) { $selectedShop = $shopService->getSelectedShop(); /** @var Plugin\Custom\PSC\Formular\Document\Formular $formular */ $formular = $documentManager ->getRepository('Plugin\Custom\PSC\Formular\Document\Formular') - ->findOneBy(array("shop" => (string)$selectedShop->getUid(), "id" => $id)); + ->findOneBy(array('shop' => (string) $selectedShop->getUid(), 'id' => $id)); $form = $this->createForm(DeleteType::class); @@ -143,11 +152,15 @@ class SettingsController extends AbstractController $title = $formular->getFormularname(); $documentManager->remove($formular); $documentManager->flush(); - $session->getFlashBag()->add( - 'success', - 'Formular \'' . $title . '\' has been deleted!' + $session->getFlashBag()->add('success', 'Formular \'' . $title . '\' has been deleted!'); + $logService->createLogEntry( + $selectedShop, + $this->getUser(), + LogEntry::INFO, + SettingsController::class, + $title, + 'Formular deleted', ); - $logService->createLogEntry($selectedShop, $this->getUser(), LogEntry::INFO, SettingsController::class, $title, "Formular deleted"); return $this->redirectToRoute('plugin_custom_psc_formular_backend_list'); } return $this->redirectToRoute('plugin_custom_psc_formular_backend_list'); @@ -156,7 +169,7 @@ class SettingsController extends AbstractController //\var_dump($formular); return array( 'cms' => $formular, - 'form' => $form->createView() + 'form' => $form->createView(), ); } } diff --git a/src/new/var/plugins/Custom/PSC/Formular/Controller/StartController.php b/src/new/var/plugins/Custom/PSC/Formular/Controller/StartController.php index c877c5578..74b58d71a 100755 --- a/src/new/var/plugins/Custom/PSC/Formular/Controller/StartController.php +++ b/src/new/var/plugins/Custom/PSC/Formular/Controller/StartController.php @@ -8,9 +8,9 @@ use Gregwar\Captcha\CaptchaBuilder; use Plugin\Custom\PSC\Formular\Document\Formular; use Plugin\Custom\PSC\Formular\Event\Submit; use PSC\Shop\QueueBundle\Service\Event\Manager; +use PSC\System\SettingsBundle\Service\Shop; use Symfony\Bridge\Twig\Attribute\Template; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use PSC\System\SettingsBundle\Service\Shop; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\HttpClient\HttpClientInterface; @@ -18,26 +18,26 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; #[Route('/formular')] class StartController extends AbstractController { + function __construct( + private readonly Shop $shopService, + private readonly DocumentManager $documentManager, + private readonly Manager $eventManager, + private readonly \Twig\Environment $template, + private HttpClientInterface $httpClient, + ) {} - function __construct(private readonly Shop $shopService, private readonly DocumentManager $documentManager, private readonly Manager $eventManager, private readonly \Twig\Environment $template, private HttpClientInterface $httpClient) - { - } - - #[Template()] + #[Template('@PluginCustomPSCFormular/start/start.html.twig')] #[Route('/start/{id}', name: 'plugin_custom_psc_formular_frontend_start')] public function startAction(Request $request, string $id) { - - $selectedShop = $this->shopService->getShopByDomain(); $shopDoc = $this->shopService->getMongoShopByDomain(); - /** @var Formular $formular */ $formular = $this->documentManager ->getRepository('Plugin\Custom\PSC\Formular\Document\Formular') - ->findOneBy(array("shop" => (string)$selectedShop->getUid(), "id" => $id)); + ->findOneBy(array('shop' => (string) $selectedShop->getUid(), 'id' => $id)); $captchaEnable = $formular->getCaptcha(); $friendlyCaptchaEnabled = $formular->getFriendlyCaptcha(); @@ -46,7 +46,7 @@ class StartController extends AbstractController $web2mailreCaptchawebcode = $formular->getReCaptchawebcode(); $web2mailreCaptchasecret = $formular->getReCaptchasecret(); - if($formular->isPrivate() && $this->getUser() == null) { + if ($formular->isPrivate() && $this->getUser() == null) { return $this->redirect('/'); } @@ -58,60 +58,60 @@ class StartController extends AbstractController $secretKey = $web2mailreCaptchasecret; $ip = $_SERVER['REMOTE_ADDR']; if ($request->isMethod('post')) { - if ($reCaptchaEnable) { - $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $secretKey . "&response=" . $_POST['g-recaptcha-response'] . "&remoteip=" . $ip); + $response = file_get_contents( + 'https://www.google.com/recaptcha/api/siteverify?secret=' + . $secretKey + . '&response=' + . $_POST['g-recaptcha-response'] + . '&remoteip=' + . $ip, + ); $responseKeys = json_decode($response, true); // Spamversuch - if (intval($responseKeys["success"]) !== 1) { + if (intval($responseKeys['success']) !== 1) { $nospam = false; } else { $nospam = true; } - }elseif ($friendlyCaptchaEnabled) { - $request = $this->httpClient->request('POST', - 'https://api.friendlycaptcha.com/api/v1/siteverify', - [ - 'body' => [ - 'solution' => $_POST['frc-captcha-solution'], - 'secret' => $shopDoc->getPluginSettingModule('friendlycaptcha', 'secret'), - 'sitekey' => $shopDoc->getPluginSettingModule('friendlycaptcha', 'siteKey') - ] - ] - ); + } elseif ($friendlyCaptchaEnabled) { + $request = $this->httpClient->request('POST', 'https://api.friendlycaptcha.com/api/v1/siteverify', [ + 'body' => [ + 'solution' => $_POST['frc-captcha-solution'], + 'secret' => $shopDoc->getPluginSettingModule('friendlycaptcha', 'secret'), + 'sitekey' => $shopDoc->getPluginSettingModule('friendlycaptcha', 'siteKey'), + ], + ]); $response = $request->toArray(); - if (intval($response["success"]) !== 1) { + if (intval($response['success']) !== 1) { $nospam = false; } else { $nospam = true; } - }elseif ($captchaFoxEnabled) { - $request = $this->httpClient->request('POST', - 'https://api.captchafox.com/siteverify', - [ - 'body' => [ - 'response' => $_POST['cf-captcha-response'], - 'secret' => $shopDoc->getPluginSettingModule('captchafox', 'secretkey'), - 'sitekey' => $shopDoc->getPluginSettingModule('captchafox', 'publickey') - ] - ] - ); + } elseif ($captchaFoxEnabled) { + $request = $this->httpClient->request('POST', 'https://api.captchafox.com/siteverify', [ + 'body' => [ + 'response' => $_POST['cf-captcha-response'], + 'secret' => $shopDoc->getPluginSettingModule('captchafox', 'secretkey'), + 'sitekey' => $shopDoc->getPluginSettingModule('captchafox', 'publickey'), + ], + ]); $response = $request->toArray(); - if (intval($response["success"]) !== 1) { + if (intval($response['success']) !== 1) { $nospam = false; } else { $nospam = true; } - }elseif($captchaEnable) { + } elseif ($captchaEnable) { $phrase = $request->getSession()->get('contact_captcha', false); - if($phrase && $phrase == $request->get('captcha', "") || $request->get('email_confirm', "") != "") { + if ($phrase && $phrase == $request->get('captcha', '') || $request->get('email_confirm', '') != '') { $nospam = true; - }else{ + } else { $nospam = false; $captchaWrong = true; } @@ -120,10 +120,10 @@ class StartController extends AbstractController } if ($nospam) { $outarray = array(); - $text = ""; + $text = ''; foreach ($_POST as $key => $formulardata) { - if ($key != "g-recaptcha-response") { - $text .= $key . ": " . $formulardata . "
"; + if ($key != 'g-recaptcha-response') { + $text .= $key . ': ' . $formulardata . '
'; } } if (preg_match_all("/\b\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}\b/", $text, $emails)) @@ -138,34 +138,42 @@ class StartController extends AbstractController $notify->setShop($selectedShop->getUID()); $notify->setFormular($formular->getId()); $notify->setFormData($_POST); - if(isset($emails[0]) && is_string($emails[0])) { + if (isset($emails[0]) && is_string($emails[0])) { $notify->setSenderMail($emails[0]); - }else{ - $notify->setSenderMail(""); + } else { + $notify->setSenderMail(''); } $this->eventManager->addJob($notify); $send = true; $spam = false; } - }else{ - + } else { } $text = $this->template->createTemplate($web2maileditor); - $captchaCode = ""; + $captchaCode = ''; - if($captchaEnable) { - $builder = new CaptchaBuilder; + if ($captchaEnable) { + $builder = new CaptchaBuilder(); $builder->build(); - $captchaCode = ''; + $captchaCode = ''; $request->getSession()->set('contact_captcha', $builder->getPhrase()); - }elseif($reCaptchaEnable) { - $captchaCode = '
'; - }elseif($friendlyCaptchaEnabled) { - $captchaCode = '
'; - }elseif($captchaFoxEnabled) { - $captchaCode = '
'; + } elseif ($reCaptchaEnable) { + $captchaCode = + '
'; + } elseif ($friendlyCaptchaEnabled) { + $captchaCode = + '
'; + } elseif ($captchaFoxEnabled) { + $captchaCode = + '
'; } $text = $text->render(['captcha' => $captchaCode, 'data' => $_POST, 'captchaWrong' => $captchaWrong]); @@ -181,5 +189,5 @@ class StartController extends AbstractController 'mailadresse' => $mailadresse, ); } +} -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/GoogleProduktXMLExport/Document/Export.php b/src/new/var/plugins/Custom/PSC/GoogleProduktXMLExport/Document/Export.php new file mode 100644 index 000000000..f22e82d94 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/GoogleProduktXMLExport/Document/Export.php @@ -0,0 +1,30 @@ +shop; + } + + /** + * @param string $shop + */ + public function setShop($shop) + { + $this->shop = $shop; + } +} + diff --git a/src/new/var/plugins/Custom/PSC/Gutschein/Controller/OrderController.php b/src/new/var/plugins/Custom/PSC/Gutschein/Controller/OrderController.php new file mode 100644 index 000000000..008775400 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/Gutschein/Controller/OrderController.php @@ -0,0 +1,19 @@ + $position]; + } +} diff --git a/src/new/var/plugins/Custom/PSC/Gutschein/Form/Field/Calc.php b/src/new/var/plugins/Custom/PSC/Gutschein/Form/Field/Calc.php deleted file mode 100644 index 25ea5dec7..000000000 --- a/src/new/var/plugins/Custom/PSC/Gutschein/Form/Field/Calc.php +++ /dev/null @@ -1,87 +0,0 @@ -add('minAmount', MoneyType::class, [ - 'required' => false, - 'label' => 'Minimaler Gutscheinwert', - 'data' => 10.00, - ])->add('maxAmount', MoneyType::class, [ - 'required' => false, - 'label' => 'Maximaler Gutscheinwert', - 'data' => 500.00, - ])->add('defaultAmount', MoneyType::class, [ - 'required' => false, - 'label' => 'Voreingestellter Wert', - 'data' => 50.00, - ])->add('validityMonths', IntegerType::class, [ - 'required' => false, - 'label' => 'Gültigkeit (Monate)', - 'data' => 12, - ]); - - if ($product) { - $builder->get('defaultAmount')->setData($product->gutschein['defaultAmount'] ?? null); - $builder->get('minAmount')->setData($product->gutschein['minAmount'] ?? null); - $builder->get('maxAmount')->setData($product->gutschein['maxAmount'] ?? null); - $builder->get('validityMonths')->setData($product->gutschein['validityMonths'] ?? null); - } - return $builder; - } - - public function getGroup() - { - return \Plugin\Custom\PSC\Gutschein\Form\Group\Calc::GROUP_ID; - } - - public function formPostSetData(FormEvent $event) - { - } - - public function formPostSubmit(FormEvent $event) - { - } - - public function formPreSetData(FormEvent $event) - { - } - - public function formSubmit(FormEvent $event) - { - } -} diff --git a/src/new/var/plugins/Custom/PSC/Gutschein/Form/Field/ProductSettings.php b/src/new/var/plugins/Custom/PSC/Gutschein/Form/Field/ProductSettings.php index 413192f47..e1a35fdaf 100644 --- a/src/new/var/plugins/Custom/PSC/Gutschein/Form/Field/ProductSettings.php +++ b/src/new/var/plugins/Custom/PSC/Gutschein/Form/Field/ProductSettings.php @@ -14,24 +14,24 @@ use Symfony\Component\Form\FormEvent; class ProductSettings implements Field { public function __construct( - private readonly EntityManagerInterface $entityManager + private readonly EntityManagerInterface $entityManager, ) {} - public function getTemplate() + public function getTemplate(): string { return '@PluginCustomPSCGutschein/form/field/product_settings.html.twig'; } - public function getModule() + public function getModule(): int { return Field::Product; } - public function formPreSubmit(FormEvent $event) + public function formPreSubmit(FormEvent $event): void { } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): FormBuilderInterface { $product = $options['product']; @@ -45,17 +45,13 @@ class ProductSettings implements Field foreach ($vouchers as $voucher) { $unusedCount = $voucherItemRepo->countUnusedCodes($voucher->getUid()); - $label = sprintf( - '%s (%d verfügbare Codes)', - $voucher->getTitle(), - $unusedCount - ); - $choices[$label] = (string)$voucher->getUid(); + $label = sprintf('%s (%d verfügbare Codes)', $voucher->getTitle(), $unusedCount); + $choices[$label] = (string) $voucher->getUid(); } $currentLinkedVoucher = null; if ($product && isset($product->gutschein['linkedVoucherUid'])) { - $currentLinkedVoucher = (string)$product->gutschein['linkedVoucherUid']; + $currentLinkedVoucher = (string) $product->gutschein['linkedVoucherUid']; } $builder->add('linkedVoucherUid', ChoiceType::class, [ @@ -69,21 +65,22 @@ class ProductSettings implements Field return $builder; } - public function getGroup() + public function getGroup(): string { return \Plugin\Custom\PSC\Gutschein\Form\Group\Calc::GROUP_ID; } - public function formPostSetData(FormEvent $event) + public function formPostSetData(FormEvent $event): void { } - public function formPostSubmit(FormEvent $event) + public function formPostSubmit(FormEvent $event): void { /** @var Product $product */ $product = $event->getData(); $form = $event->getForm(); - + $product->setPrice(0); + $product->setCanBuyWithNoPrice(1); if ($form->has('linkedVoucherUid')) { $linkedVoucherUid = $form->get('linkedVoucherUid')->getData(); @@ -92,7 +89,7 @@ class ProductSettings implements Field // Update or set linkedVoucherUid if (!empty($linkedVoucherUid)) { - $gutscheinData['linkedVoucherUid'] = (int)$linkedVoucherUid; + $gutscheinData['linkedVoucherUid'] = (int) $linkedVoucherUid; } else { // Remove if empty (use random generation) unset($gutscheinData['linkedVoucherUid']); @@ -103,11 +100,11 @@ class ProductSettings implements Field } } - public function formPreSetData(FormEvent $event) + public function formPreSetData(FormEvent $event): void { } - public function formSubmit(FormEvent $event) + public function formSubmit(FormEvent $event): void { } } diff --git a/src/new/var/plugins/Custom/PSC/Gutschein/Model/ProductSpecialObject.php b/src/new/var/plugins/Custom/PSC/Gutschein/Model/ProductSpecialObject.php index 1893d32ae..70435cfc3 100644 --- a/src/new/var/plugins/Custom/PSC/Gutschein/Model/ProductSpecialObject.php +++ b/src/new/var/plugins/Custom/PSC/Gutschein/Model/ProductSpecialObject.php @@ -6,27 +6,11 @@ use PSC\Shop\OrderBundle\Model\Order\Position\IProductTypeObject; class ProductSpecialObject implements IProductTypeObject { - private int $taxClass = 1900; // 19% VAT + private int $taxClass = 0; // 19% VAT private array $params = []; - // Backend configuration (set by admin) - private float $minAmount = 10.00; - private float $maxAmount = 500.00; - private ?float $defaultAmount = 50.00; - private int $validityMonths = 12; - - // Customer-entered data - private float $voucherAmount = 0; - private string $recipientName = ''; - private string $greetingMessage = ''; - private string $deliveryMethod = 'digital'; - - // Generated data - private string $voucherCode = ''; - private ?\DateTime $expirationDate = null; - - // VoucherBundle integration private ?int $linkedVoucherUid = null; + private ?string $voucherCode = ''; public function getName(): string { @@ -42,14 +26,8 @@ class ProductSpecialObject implements IProductTypeObject { return [ 'params' => $this->params, - 'voucherAmount' => $this->voucherAmount, - 'recipientName' => $this->recipientName, - 'greetingMessage' => $this->greetingMessage, - 'deliveryMethod' => $this->deliveryMethod, - 'voucherCode' => $this->voucherCode, - 'expirationDate' => $this->expirationDate?->format('Y-m-d H:i:s'), - 'validityMonths' => $this->validityMonths, 'linkedVoucherUid' => $this->linkedVoucherUid, + 'voucherCode' => $this->voucherCode, ]; } @@ -74,106 +52,6 @@ class ProductSpecialObject implements IProductTypeObject $this->params = $params; } - public function getMinAmount(): float - { - return $this->minAmount; - } - - public function setMinAmount(float $minAmount): void - { - $this->minAmount = $minAmount; - } - - public function getMaxAmount(): float - { - return $this->maxAmount; - } - - public function setMaxAmount(float $maxAmount): void - { - $this->maxAmount = $maxAmount; - } - - public function getDefaultAmount(): ?float - { - return $this->defaultAmount; - } - - public function setDefaultAmount(?float $defaultAmount): void - { - $this->defaultAmount = $defaultAmount; - } - - public function getValidityMonths(): int - { - return $this->validityMonths; - } - - public function setValidityMonths(int $validityMonths): void - { - $this->validityMonths = $validityMonths; - } - - public function getVoucherAmount(): float - { - return $this->voucherAmount; - } - - public function setVoucherAmount(float $voucherAmount): void - { - $this->voucherAmount = $voucherAmount; - } - - public function getRecipientName(): string - { - return $this->recipientName; - } - - public function setRecipientName(string $recipientName): void - { - $this->recipientName = $recipientName; - } - - public function getGreetingMessage(): string - { - return $this->greetingMessage; - } - - public function setGreetingMessage(string $greetingMessage): void - { - $this->greetingMessage = $greetingMessage; - } - - public function getDeliveryMethod(): string - { - return $this->deliveryMethod; - } - - public function setDeliveryMethod(string $deliveryMethod): void - { - $this->deliveryMethod = $deliveryMethod; - } - - public function getVoucherCode(): string - { - return $this->voucherCode; - } - - public function setVoucherCode(string $voucherCode): void - { - $this->voucherCode = $voucherCode; - } - - public function getExpirationDate(): ?\DateTime - { - return $this->expirationDate; - } - - public function setExpirationDate(?\DateTime $expirationDate): void - { - $this->expirationDate = $expirationDate; - } - public function getLinkedVoucherUid(): ?int { return $this->linkedVoucherUid; @@ -183,4 +61,14 @@ class ProductSpecialObject implements IProductTypeObject { $this->linkedVoucherUid = $linkedVoucherUid; } + + public function getVoucherCode(): string + { + return $this->voucherCode; + } + + public function setVoucherCode(string $code): void + { + $this->voucherCode = $code; + } } diff --git a/src/new/var/plugins/Custom/PSC/Gutschein/Resources/config/services.yml b/src/new/var/plugins/Custom/PSC/Gutschein/Resources/config/services.yml index bcbc22429..4fbfbefd3 100644 --- a/src/new/var/plugins/Custom/PSC/Gutschein/Resources/config/services.yml +++ b/src/new/var/plugins/Custom/PSC/Gutschein/Resources/config/services.yml @@ -14,10 +14,6 @@ services: tags: - { name: psc.backend.custom.groups, productType: 9 } - Plugin\Custom\PSC\Gutschein\Form\Field\Calc: - tags: - - { name: psc.backend.custom.fields, productType: 9 } - Plugin\Custom\PSC\Gutschein\Form\Field\ProductSettings: tags: - { name: psc.backend.custom.fields, productType: 9 } diff --git a/src/new/var/plugins/Custom/PSC/Gutschein/Resources/views/form/field/calc.html.twig b/src/new/var/plugins/Custom/PSC/Gutschein/Resources/views/form/field/calc.html.twig deleted file mode 100644 index 8d4fc98be..000000000 --- a/src/new/var/plugins/Custom/PSC/Gutschein/Resources/views/form/field/calc.html.twig +++ /dev/null @@ -1,44 +0,0 @@ -
-
-
Gutschein-Konfiguration
-
-
-
-
-
- {{ form_label(form.validityMonths) }} - {{ form_widget(form.validityMonths) }} - Gültigkeitsdauer ab Kaufdatum -
-
-
- -
-
-
- {{ form_label(form.minAmount) }} - {{ form_widget(form.minAmount) }} - Mindestbetrag -
-
-
-
- {{ form_label(form.defaultAmount) }} - {{ form_widget(form.defaultAmount) }} - Vorauswahl -
-
-
-
- {{ form_label(form.maxAmount) }} - {{ form_widget(form.maxAmount) }} - Maximalbetrag -
-
-
- -
- Hinweis: Kunden können beim Kauf einen beliebigen Betrag zwischen Minimal- und Maximalbetrag wählen. -
-
-
diff --git a/src/new/var/plugins/Custom/PSC/Gutschein/Resources/views/form/field/product_settings.html.twig b/src/new/var/plugins/Custom/PSC/Gutschein/Resources/views/form/field/product_settings.html.twig index 5c9f3dc0e..46f36df0b 100644 --- a/src/new/var/plugins/Custom/PSC/Gutschein/Resources/views/form/field/product_settings.html.twig +++ b/src/new/var/plugins/Custom/PSC/Gutschein/Resources/views/form/field/product_settings.html.twig @@ -4,9 +4,9 @@
- {{ form_label(form.linkedVoucherUid) }} - {{ form_widget(form.linkedVoucherUid, {'attr': {'class': 'form-control'}}) }} - {{ form_help(form.linkedVoucherUid) }} + {{ form_label(form.gutschein.linkedVoucherUid) }} + {{ form_widget(form.gutschein.linkedVoucherUid, {'attr': {'class': 'form-control'}}) }} + {{ form_help(form.gutschein.linkedVoucherUid) }}
@@ -15,12 +15,12 @@
  • Wählen Sie einen Gutschein aus dem VoucherBundle aus, um vordefinierte Codes zu verwenden
  • Bei jedem Verkauf wird automatisch ein Code aus dem Voucher zugewiesen
  • Der Code wird als "verwendet" markiert und mit dem Kunden verknüpft
  • -
  • Wenn keine Codes mehr verfügbar sind, wird automatisch ein Zufallscode generiert
  • +
  • Wenn keine Codes mehr verfügbar sind, kann das Produkt nicht mehr bestellt werden
  • Ohne Verknüpfung werden weiterhin Zufallscodes generiert (Standard-Verhalten)
  • - {% if form.linkedVoucherUid.vars.value %} + {% if form.gutschein.linkedVoucherUid.vars.value %}
    Aktuell verknüpft: Dieser Gutschein verwendet Codes aus dem ausgewählten VoucherBundle-Gutschein.
    diff --git a/src/new/var/plugins/Custom/PSC/Gutschein/Resources/views/order/detail.html.twig b/src/new/var/plugins/Custom/PSC/Gutschein/Resources/views/order/detail.html.twig new file mode 100644 index 000000000..7d174ce90 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/Gutschein/Resources/views/order/detail.html.twig @@ -0,0 +1 @@ +

    Gutscheincode: {{ position.product.specialProductTypeObject.voucherCode }}

    diff --git a/src/new/var/plugins/Custom/PSC/Gutschein/Section/OrderPositionDetail.php b/src/new/var/plugins/Custom/PSC/Gutschein/Section/OrderPositionDetail.php new file mode 100644 index 000000000..c8cb8626a --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/Gutschein/Section/OrderPositionDetail.php @@ -0,0 +1,32 @@ +title = 'Gutschein'; + } + + public function getModule() + { + return Section::OrderPositionDetail; + } + + public function getId() + { + return self::SECTION_ID; + } + + public function getController() + { + return 'Plugin\\Custom\\PSC\\Gutschein\\Controller\\OrderController::detailAction'; + } +} diff --git a/src/new/var/plugins/Custom/PSC/Gutschein/Transformer/Position.php b/src/new/var/plugins/Custom/PSC/Gutschein/Transformer/Position.php index dd93671fe..5f0c12e6a 100644 --- a/src/new/var/plugins/Custom/PSC/Gutschein/Transformer/Position.php +++ b/src/new/var/plugins/Custom/PSC/Gutschein/Transformer/Position.php @@ -2,16 +2,16 @@ namespace Plugin\Custom\PSC\Gutschein\Transformer; +use Plugin\Custom\PSC\Gutschein\Model\ProductSpecialObject; use PSC\Shop\EntityBundle\Entity\Orderpos; use PSC\Shop\OrderBundle\Transformer\Order\Position\IPositionTransformer; -use Plugin\Custom\PSC\Gutschein\Model\ProductSpecialObject; class Position implements IPositionTransformer { public function fromDb( \PSC\Shop\OrderBundle\Model\Order\Position $position, Orderpos $posEntity, - \PSC\Shop\EntityBundle\Document\Position $posDoc + \PSC\Shop\EntityBundle\Document\Position $posDoc, ) { $obj = new ProductSpecialObject(); @@ -20,37 +20,19 @@ class Position implements IPositionTransformer if (isset($data['params'])) { $obj->setParams($data['params']); } - if (isset($data['voucherAmount'])) { - $obj->setVoucherAmount($data['voucherAmount']); - } - if (isset($data['recipientName'])) { - $obj->setRecipientName($data['recipientName']); - } - if (isset($data['greetingMessage'])) { - $obj->setGreetingMessage($data['greetingMessage']); - } - if (isset($data['deliveryMethod'])) { - $obj->setDeliveryMethod($data['deliveryMethod']); + if (isset($data['linkedVoucherUid'])) { + $obj->setLinkedVoucherUid($data['linkedVoucherUid']); } if (isset($data['voucherCode'])) { $obj->setVoucherCode($data['voucherCode']); } - if (isset($data['expirationDate'])) { - $obj->setExpirationDate(new \DateTime($data['expirationDate'])); - } - if (isset($data['validityMonths'])) { - $obj->setValidityMonths($data['validityMonths']); - } - $position->getProduct()->setSpecialProductTypeObject($obj); } public function toDb( \PSC\Shop\OrderBundle\Model\Order\Position $position, Orderpos $posEntity, - \PSC\Shop\EntityBundle\Document\Position $posDoc + \PSC\Shop\EntityBundle\Document\Position $posDoc, ) { - // Position data is stored via getPositionData() in ProductSpecialObject - // No additional transformation needed here } } diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Api/GetSettings.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Api/GetSettings.php index 0fcd63114..73f91cbda 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Api/GetSettings.php +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Api/GetSettings.php @@ -72,6 +72,7 @@ class GetSettings $marker->setLabel("Dot {$i}"); $marker->setX(0.0); $marker->setY(0.0); + $marker->setSize(2.0); // 2mm diameter $ocrMarkers[] = $marker; } $textMarker = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\OcrMarker(); @@ -79,12 +80,14 @@ class GetSettings $textMarker->setLabel('Text Position'); $textMarker->setX(0.0); $textMarker->setY(0.0); + $textMarker->setSize(8.0); // 8pt font size $ocrMarkers[] = $textMarker; $triangleMarker = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\OcrMarker(); $triangleMarker->setType('triangle'); $triangleMarker->setLabel('Triangle (Pfeil nach oben)'); $triangleMarker->setX(0.0); $triangleMarker->setY(0.0); + $triangleMarker->setSize(3.0); // 3mm side length $ocrMarkers[] = $triangleMarker; $setting->setOcrMarkers($ocrMarkers); } diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Api/Preview.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Api/Preview.php index 97519a10d..15d4ef643 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Api/Preview.php +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Api/Preview.php @@ -18,6 +18,111 @@ use Symfony\Component\Routing\Attribute\Route; class Preview { + /** + * Get RGB color values for background + */ + private function getBackgroundColor(string $color): array + { + return match ($color) { + 'red' => [255, 0, 0], + 'green' => [0, 255, 0], + 'blue' => [0, 0, 255], + 'yellow' => [255, 255, 0], + 'white' => [255, 255, 255], // Changed from 'black' to 'white' + default => [255, 255, 255], // Default: white background + }; + } + + /** + * Render OCR markers on the current page + */ + private function renderOcrMarkers( + Fpdi $pdf, + array $ocrMarkers, + array $configData = [], + array $currentFile = [], + ): void { + if (empty($ocrMarkers)) { + return; + } + + // Save current graphics state + $pdf->StartTransform(); + + foreach ($ocrMarkers as $marker) { + $x = $marker['x'] ?? 0; + $y = $marker['y'] ?? 0; + $type = $marker['type'] ?? 'dot'; + $size = $marker['size'] ?? 2.0; // Default size + + // Set black color for markers + $pdf->SetDrawColor(0, 0, 0); + $pdf->SetFillColor(0, 0, 0); + + switch ($type) { + case 'dot': + // Draw a filled circle (dot) with configurable diameter + $radius = $size / 2; // Convert diameter to radius + $pdf->Circle($x, $y, $radius, 0, 360, 'F'); + break; + + case 'text': + // Build dynamic text with content area info and tab number + $contentAreaWidth = $configData['contentAreaWidth'] ?? 0; + $contentAreaHeight = $configData['contentAreaHeight'] ?? 0; + $contentAreaLeft = $configData['contentAreaLeft'] ?? 0; + $contentAreaTop = $configData['contentAreaTop'] ?? 0; + $tabNumber = $currentFile['tabNumber'] ?? '?'; + $unit = $configData['unit'] ?? 'mm'; + + $text = sprintf( + 'Inhalt: %.1f x %.1f %s @ (%.1f, %.1f) | Tab: %s', + $contentAreaWidth, + $contentAreaHeight, + $unit, + $contentAreaLeft, + $contentAreaTop, + $tabNumber, + ); + + // Save state and rotate text 90° counter-clockwise (vertical, bottom to top) + $pdf->StartTransform(); + + // Rotate 90° counter-clockwise around point (x, y) + $pdf->Rotate(90, $x, $y); + + // Draw text with configurable font size + $pdf->SetFont('helvetica', 'B', $size); // size is font size in pt + $pdf->SetTextColor(0, 0, 0); + $pdf->Text($x, $y, $text); + + // Restore transformation + $pdf->StopTransform(); + break; + + case 'triangle': + // Draw an upward-pointing triangle with configurable side length + $height = ($size * sqrt(3)) / 2; // Height of equilateral triangle + + // Calculate triangle points (pointing up) + $points = [ + $x, + $y - ((2 * $height) / 3), // Top point + $x - ($size / 2), + $y + ($height / 3), // Bottom left + $x + ($size / 2), + $y + ($height / 3), // Bottom right + ]; + + $pdf->Polygon($points, 'F'); + break; + } + } + + // Restore graphics state + $pdf->StopTransform(); + } + #[Response(response: 200, description: 'PDF preview generated successfully')] #[Response(response: 400, description: 'Bad request')] #[Route('/preview', name: 'plugin_custom_psc_laufkartenlayouter_preview', methods: ['POST'])] @@ -84,23 +189,25 @@ class Preview $configData['contentAreaHeight'], false, ); - $pdf->SetFont('helvetica', '', $fontSize); - $pdf->SetTextColor(0, 0, 0); - if ($file['color'] == 'red') { - $pdf->SetTextColor(255, 0, 0); - } - if ($file['color'] == 'green') { - $pdf->SetTextColor(0, 255, 0); - } - if ($file['color'] == 'blue') { - $pdf->SetTextColor(0, 0, 255); - } - if ($file['color'] == 'yellow') { - $pdf->SetTextColor(255, 255, 0); - } + + dump($file); + dump($configData); $tab = array_filter($configData['tabPositions'], function ($item) use ($file) { return $item['tabNumber'] == $file['tabNumber'] ? $item : null; - })[0]; + }); + dump($tab); + $tab = array_shift($tab); + // Render OCR markers on this page + $this->renderOcrMarkers($pdf, $configData['ocrMarkers'] ?? [], $configData, $file); + + // Draw colored background rectangle + $bgColor = $this->getBackgroundColor($file['color']); + $pdf->SetFillColor($bgColor[0], $bgColor[1], $bgColor[2]); + $pdf->Rect($tab['x'], $tab['y'], $tab['width'], $tab['height'], 'F'); + + // Draw text in black + $pdf->SetFont('helvetica', '', $fontSize); + $pdf->SetTextColor(0, 0, 0); // Always black text $pdf->MultiCell( $tab['width'], $tab['height'], @@ -128,20 +235,21 @@ class Preview $configData['contentAreaHeight'], false, ); + + // Render OCR markers on this page + $this->renderOcrMarkers($pdf, $configData['ocrMarkers'] ?? [], $configData, $file); + + // Calculate position for page 2 (mirrored) + $xPos = $configData['width'] - $tab['width'] - $tab['x']; + + // Draw colored background rectangle + $bgColor = $this->getBackgroundColor($file['color']); + $pdf->SetFillColor($bgColor[0], $bgColor[1], $bgColor[2]); + $pdf->Rect($xPos, $tab['y'], $tab['width'], $tab['height'], 'F'); + + // Draw text in black $pdf->SetFont('helvetica', '', $fontSize); - $pdf->SetTextColor(0, 0, 0); - if ($file['color'] == 'red') { - $pdf->SetTextColor(255, 0, 0); - } - if ($file['color'] == 'green') { - $pdf->SetTextColor(0, 255, 0); - } - if ($file['color'] == 'blue') { - $pdf->SetTextColor(0, 0, 255); - } - if ($file['color'] == 'yellow') { - $pdf->SetTextColor(255, 255, 0); - } + $pdf->SetTextColor(0, 0, 0); // Always black text $pdf->MultiCell( $tab['width'], $tab['height'], @@ -150,7 +258,7 @@ class Preview 'C', false, 1, - ($configData['width'] - $tab['width']) - $tab['x'], + $xPos, $tab['y'], true, 0, @@ -170,24 +278,26 @@ class Preview $configData['contentAreaHeight'], false, ); - $pdf->SetFont('helvetica', '', $fontSize); - $pdf->SetTextColor(0, 0, 0); - if ($file['color'] == 'red') { - $pdf->SetTextColor(255, 0, 0); - } - if ($file['color'] == 'green') { - $pdf->SetTextColor(0, 255, 0); - } - if ($file['color'] == 'blue') { - $pdf->SetTextColor(0, 0, 255); - } - if ($file['color'] == 'yellow') { - $pdf->SetTextColor(255, 255, 0); - } + + $tab = array_filter($configData['tabPositions'], function ($item) use ($file) { + return $item['tabNumber'] == $file['tabNumber'] ? $item : null; + })[0]; + + // Render OCR markers on this page + $this->renderOcrMarkers($pdf, $configData['ocrMarkers'] ?? [], $configData, $file); + + // Get background color + $bgColor = $this->getBackgroundColor($file['color']); + if ($frontSide) { - $tab = array_filter($configData['tabPositions'], function ($item) use ($file) { - return $item['tabNumber'] == $file['tabNumber'] ? $item : null; - })[0]; + // Front side: normal position + // Draw colored background rectangle + $pdf->SetFillColor($bgColor[0], $bgColor[1], $bgColor[2]); + $pdf->Rect($tab['x'], $tab['y'], $tab['width'], $tab['height'], 'F'); + + // Draw text in black + $pdf->SetFont('helvetica', '', $fontSize); + $pdf->SetTextColor(0, 0, 0); // Always black text $pdf->MultiCell( $tab['width'], $tab['height'], @@ -207,9 +317,16 @@ class Preview ); $frontSide = false; } else { - $tab = array_filter($configData['tabPositions'], function ($item) use ($file) { - return $item['tabNumber'] == $file['tabNumber'] ? $item : null; - })[0]; + // Back side: mirrored position + $xPos = $configData['width'] - $tab['width'] - $tab['x']; + + // Draw colored background rectangle + $pdf->SetFillColor($bgColor[0], $bgColor[1], $bgColor[2]); + $pdf->Rect($xPos, $tab['y'], $tab['width'], $tab['height'], 'F'); + + // Draw text in black + $pdf->SetFont('helvetica', '', $fontSize); + $pdf->SetTextColor(0, 0, 0); // Always black text $pdf->MultiCell( $tab['width'], $tab['height'], @@ -218,7 +335,7 @@ class Preview 'C', false, 1, - ($configData['width'] - $tab['width']) - $tab['x'], + $xPos, $tab['y'], true, 0, diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/IndexController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/IndexController.php index 2c85d3b36..fb0bccce5 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/IndexController.php +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/IndexController.php @@ -67,6 +67,7 @@ class IndexController extends AbstractController $marker->setLabel("Dot {$i}"); $marker->setX(0.0); $marker->setY(0.0); + $marker->setSize(2.0); // 2mm diameter $ocrMarkers[] = $marker; } @@ -76,6 +77,7 @@ class IndexController extends AbstractController $textMarker->setLabel('Text Position'); $textMarker->setX(0.0); $textMarker->setY(0.0); + $textMarker->setSize(8.0); // 8pt font size $ocrMarkers[] = $textMarker; // 1 Triangle @@ -84,6 +86,7 @@ class IndexController extends AbstractController $triangleMarker->setLabel('Triangle (Pfeil nach oben)'); $triangleMarker->setX(0.0); $triangleMarker->setY(0.0); + $triangleMarker->setSize(3.0); // 3mm side length $ocrMarkers[] = $triangleMarker; $setting->setOcrMarkers($ocrMarkers); @@ -98,6 +101,7 @@ class IndexController extends AbstractController $marker->setLabel("Dot {$i}"); $marker->setX(0.0); $marker->setY(0.0); + $marker->setSize(2.0); // 2mm diameter $ocrMarkers[] = $marker; } $textMarker = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\OcrMarker(); @@ -105,12 +109,14 @@ class IndexController extends AbstractController $textMarker->setLabel('Text Position'); $textMarker->setX(0.0); $textMarker->setY(0.0); + $textMarker->setSize(8.0); // 8pt font size $ocrMarkers[] = $textMarker; $triangleMarker = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\OcrMarker(); $triangleMarker->setType('triangle'); $triangleMarker->setLabel('Triangle (Pfeil nach oben)'); $triangleMarker->setX(0.0); $triangleMarker->setY(0.0); + $triangleMarker->setSize(3.0); // 3mm side length $ocrMarkers[] = $triangleMarker; $setting->setOcrMarkers($ocrMarkers); } diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/OcrMarker.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/OcrMarker.php index de2b02241..db603a81f 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/OcrMarker.php +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/OcrMarker.php @@ -38,6 +38,13 @@ class OcrMarker extends AbstractType 'scale' => 1, 'html5' => true, 'attr' => ['step' => '0.1'], + ]) + ->add('size', NumberType::class, [ + 'label' => 'Größe / Durchmesser', + 'scale' => 1, + 'html5' => true, + 'attr' => ['step' => '0.1', 'min' => '0.1'], + 'help' => 'Durchmesser in mm für Dots, Schriftgröße für Text, Seitenlänge für Dreieck', ]); } diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/OcrMarker.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/OcrMarker.php index 188a1ef8a..cbdcabc2e 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/OcrMarker.php +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/OcrMarker.php @@ -8,6 +8,7 @@ class OcrMarker private string $label; private float $x = 0.0; private float $y = 0.0; + private float $size = 2.0; // Diameter in mm for dots, font size for text, size for triangle public function getType(): string { @@ -52,4 +53,15 @@ class OcrMarker $this->y = $y; return $this; } + + public function getSize(): float + { + return $this->size; + } + + public function setSize(float $size): self + { + $this->size = $size; + return $this; + } } diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/index/index.html.twig b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/index/index.html.twig index 52a3793e6..37f4f18b9 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/index/index.html.twig +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/index/index.html.twig @@ -254,10 +254,11 @@ - - - - + + + + + @@ -283,6 +284,16 @@ + {% endfor %} diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/frontend/designer/start.html.twig b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/frontend/designer/start.html.twig index 35aad39e8..af0f26c9a 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/frontend/designer/start.html.twig +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/frontend/designer/start.html.twig @@ -320,7 +320,7 @@ uuid: fileData.uuid, fileName: fileData.fileName, ocrNumber: fileData.ocrNumber || '', - color: fileData.color || 'black', + color: fileData.color || 'white', numPages: fileData.numPages || 0, isDuplex: fileData.isDuplex || false }; @@ -509,7 +509,7 @@ numPages: numPages, isDuplex: numPages % 2 === 0 && numPages > 1, ocrNumber: '', - color: 'black', + color: 'white', processed: false, isAlreadyUploaded: false, // Mark as NOT uploaded yet isValid: isValid // Only 1 or 2 pages are valid @@ -646,7 +646,7 @@ numPages: numPages, isDuplex: numPages % 2 === 0 && numPages > 1, ocrNumber: '', - color: 'black', + color: 'white', processed: false, isAlreadyUploaded: false, // New files need to be uploaded isValid: isValid // Only 1 or 2 pages are valid @@ -807,8 +807,8 @@ - - + + `; }); diff --git a/src/new/var/plugins/System/Ariba/Auth/Form/AuthGroup.php b/src/new/var/plugins/System/Ariba/Auth/Form/AuthGroup.php new file mode 100644 index 000000000..9dee60d07 --- /dev/null +++ b/src/new/var/plugins/System/Ariba/Auth/Form/AuthGroup.php @@ -0,0 +1,28 @@ +title = 'Ariba'; + } + + public function getModule() + { + return Field::Shop; + } + + public function getId() + { + return self::GROUP_ID; + } +} diff --git a/src/new/var/plugins/System/Ariba/Auth/Form/ShopSettings.php b/src/new/var/plugins/System/Ariba/Auth/Form/ShopSettings.php new file mode 100644 index 000000000..1b016b12f --- /dev/null +++ b/src/new/var/plugins/System/Ariba/Auth/Form/ShopSettings.php @@ -0,0 +1,80 @@ +getData(); + $event->getForm()->get('ariba')->get('secretkey')->setData($data->getPluginSettingModule('ariba', 'secretkey')); + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->add('secretkey', TextType::class, [ + 'label' => 'Secret Key', + 'required' => false, + 'mapped' => false, + ]); + return $builder; + } + + public function getGroup(): string + { + return AribaAuth::GROUP_ID; + } + + public function formPreSubmit(FormEvent $event) + { + // TODO: Implement formPreSubmit() method. + } + + public function formPreSetData(FormEvent $event) + { + } + + public function formSubmit(FormEvent $event) + { + /** @var Shop $data */ + $data = $event->getData(); + $data->setPluginSettingModule( + 'captchafox', + 'secretkey', + $event->getForm()->get('captchafox')->get('secretkey')->getData(), + ); + $data->setPluginSettingModule( + 'captchafox', + 'publickey', + $event->getForm()->get('captchafox')->get('publickey')->getData(), + ); + $event->setData($data); + } +} diff --git a/src/new/var/plugins/System/Ariba/Auth/Plugin.php b/src/new/var/plugins/System/Ariba/Auth/Plugin.php new file mode 100644 index 000000000..49a8b4638 --- /dev/null +++ b/src/new/var/plugins/System/Ariba/Auth/Plugin.php @@ -0,0 +1,25 @@ + +
    +
    + {{ form_label(form.ariba.secretkey) }} +
    + {{ form_widget(form.ariba.secretkey, {attr: {'class': 'form-control'}}) }} +
    +
    +
    + diff --git a/src/new/var/plugins/System/PSC/Bootstrap4/Controller/Backend/SliderController.php b/src/new/var/plugins/System/PSC/Bootstrap4/Controller/Backend/SliderController.php index 7c8778cac..16f122394 100755 --- a/src/new/var/plugins/System/PSC/Bootstrap4/Controller/Backend/SliderController.php +++ b/src/new/var/plugins/System/PSC/Bootstrap4/Controller/Backend/SliderController.php @@ -1,109 +1,108 @@ getSelectedShop(); - $settings = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shopsetting')->findBy(array("shop" => $selectedShop->getUid(), "key" => "index_slides")); + $settings = $entityManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Shopsetting') + ->findBy(array('shop' => $selectedShop->getUid(), 'key' => 'index_slides')); $tmp = []; - foreach($settings as $setting) { + foreach ($settings as $setting) { $tmp[] = array_merge(['uid' => $setting->getUid()], json_decode($setting->getValue(), true)); } return ['slides' => $tmp]; } - #[Template] + #[Template('@PluginSystemPSCBootstrap4/backend/slider/edit.html.twig')] #[Route(path: '/edit/{uid}', defaults: ['uid' => ''], name: 'psc_plugin_bootstrap4_backend_slider_edit')] - public function editAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, EntityManagerInterface $entityManager, $uid) - { + public function editAction( + Request $request, + \PSC\System\SettingsBundle\Service\Shop $shopService, + EntityManagerInterface $entityManager, + $uid, + ) { $selectedShop = $shopService->getSelectedShop(); - $data = ["title" => ""]; - if($uid) { + $data = ['title' => '']; + if ($uid) { /** @var Shopsetting $setting */ - $setting = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shopsetting')->findOneBy(array("shop" => $selectedShop->getUid(), "uid" => $uid)); + $setting = $entityManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Shopsetting') + ->findOneBy(array('shop' => $selectedShop->getUid(), 'uid' => $uid)); $data = array_merge(['uid' => $setting->getUid()], json_decode($setting->getValue(), true)); } $form = $this->createForm(SlideType::class, $data); $form->handleRequest($request); - if($form->isSubmitted() && $form->isValid()) { + if ($form->isSubmitted() && $form->isValid()) { $dataForm = $form->getData(); - if($uid) { + if ($uid) { $setting->setValue(json_encode([ 'title' => $dataForm['title'], 'link' => $dataForm['link'], 'text' => $dataForm['text'], - 'image' => $dataForm['image'] + 'image' => $dataForm['image'], ])); - - }else{ + } else { $setting = new Shopsetting(); $setting->setShop($selectedShop); $setting->setUid(time()); - $setting->setKey("index_slides"); + $setting->setKey('index_slides'); $setting->setValue(json_encode([ 'title' => $dataForm['title'], 'link' => $dataForm['link'], 'text' => $dataForm['text'], - 'image' => $dataForm['image'] + 'image' => $dataForm['image'], ])); } $entityManager->persist($setting); $entityManager->flush(); - return $this->redirectToRoute("psc_plugin_bootstrap4_backend_slider_index"); - + return $this->redirectToRoute('psc_plugin_bootstrap4_backend_slider_index'); } - return ['form' => $form->createView(), "slide" => $data]; + return ['form' => $form->createView(), 'slide' => $data]; } - #[Template('@PluginSystemPSCBootstrap4ControllerBackend/slider/delete.html.twig')] + #[Template('@PluginSystemPSCBootstrap4/backend/slider/delete.html.twig')] #[Route(path: '/delete/{uid}', name: 'psc_plugin_bootstrap4_backend_slider_delete')] - public function deleteAction(Request $request, SessionInterface $session, \PSC\System\SettingsBundle\Service\Shop $shopService, EntityManagerInterface $entityManager, $uid) - { + public function deleteAction( + Request $request, + SessionInterface $session, + \PSC\System\SettingsBundle\Service\Shop $shopService, + EntityManagerInterface $entityManager, + $uid, + ) { $selectedShop = $shopService->getSelectedShop(); - if($uid) { + if ($uid) { /** @var Shopsetting $setting */ - $setting = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shopsetting')->findOneBy(array("shop" => $selectedShop->getUid(), "uid" => $uid)); + $setting = $entityManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Shopsetting') + ->findOneBy(array('shop' => $selectedShop->getUid(), 'uid' => $uid)); $data = array_merge(['uid' => $setting->getUid()], json_decode($setting->getValue(), true)); } @@ -117,10 +116,7 @@ class SliderController extends AbstractController $title = $data['title']; $entityManager->remove($setting); $entityManager->flush(); - $session->getFlashBag()->add( - 'success', - 'Slide \'' . $title . '\' has been deleted!' - ); + $session->getFlashBag()->add('success', 'Slide \'' . $title . '\' has been deleted!'); return $this->redirectToRoute('psc_plugin_bootstrap4_backend_slider_index'); } return $this->redirectToRoute('psc_plugin_bootstrap4_backend_slider_index'); @@ -128,4 +124,5 @@ class SliderController extends AbstractController return ['slide' => $data, 'form' => $form->createView()]; } -} \ No newline at end of file +} + diff --git a/src/new/var/plugins/System/PSC/Invoice/InvoiceTS/src/modules/button/ButtonComponent.tsx b/src/new/var/plugins/System/PSC/Invoice/InvoiceTS/src/modules/button/ButtonComponent.tsx index 0712ab674..87e3366b9 100644 --- a/src/new/var/plugins/System/PSC/Invoice/InvoiceTS/src/modules/button/ButtonComponent.tsx +++ b/src/new/var/plugins/System/PSC/Invoice/InvoiceTS/src/modules/button/ButtonComponent.tsx @@ -1,13 +1,13 @@ import OrderState from '../../state/order' -import {container} from "tsyringe-neo" +import { container } from "tsyringe-neo" import OrderService from '../../services/order' import { Component } from 'react' -import {debounceTime} from "rxjs" -import {Order} from "../../model/order" +import { debounceTime } from "rxjs" +import { Order } from "../../model/order" import { Button } from "flowbite-react" import React from 'react' -class ButtonComponent extends Component<{loadOrder},{disabled: boolean}> { +class ButtonComponent extends Component<{ loadOrder }, { disabled: boolean, saving: boolean }> { orderState: OrderState orderService: OrderService constructor(props) { @@ -15,7 +15,7 @@ class ButtonComponent extends Component<{loadOrder},{disabled: boolean}> { this.orderState = container.resolve(OrderState) this.orderService = container.resolve(OrderService) - this.state = {disabled: true} + this.state = { disabled: true, saving: false } } componentDidMount() { @@ -23,7 +23,7 @@ class ButtonComponent extends Component<{loadOrder},{disabled: boolean}> { } saveButton(order: Order) { - if(order.contact.username != "" + if (order.contact.username != "" && order.payment.title != "" && order.shipping.title != "" && order.shop.name != "" @@ -31,7 +31,7 @@ class ButtonComponent extends Component<{loadOrder},{disabled: boolean}> { && order.invoiceAddress.uuid != "" && order.type != 0 ) { - this.setState({disabled: false}) + this.setState({ disabled: false }) } } @@ -44,9 +44,12 @@ class ButtonComponent extends Component<{loadOrder},{disabled: boolean}> { async handleSave(e) { e.preventDefault() + this.setState({ saving: true }) let result = await this.orderService.saveOrder(this.orderState.getCurrentOrder().value) this.props.loadOrder(result['uuid']) + + this.setState({ saving: false }) } render() { @@ -56,18 +59,19 @@ class ButtonComponent extends Component<{loadOrder},{disabled: boolean}> { size="md" color="blue" disabled={this.state.disabled} - onClick={(e:any) => this.handleSave(e)} + onClick={(e: any) => this.handleSave(e)} > - Speichern + {this.state.saving === true && wird gespeichert...} + {this.state.saving === false && Speichern}
    TypeLabelX Position ({{ setting.unit }})Y Position ({{ setting.unit }})TypeLabelX Position ({{ setting.unit }})Y Position ({{ setting.unit }})Größe ({{ setting.unit }})
    {{ form_widget(ocrMarker.y, {'attr': {'class': 'form-control', 'placeholder': '0.0'}}) }} + {{ form_widget(ocrMarker.size, {'attr': {'class': 'form-control', 'placeholder': '2.0'}}) }} + {% if ocrMarker.vars.data.type == 'dot' %} + Durchmesser + {% elseif ocrMarker.vars.data.type == 'text' %} + Schriftgröße (pt) + {% elseif ocrMarker.vars.data.type == 'triangle' %} + Seitenlänge + {% endif %} +
    ${index + 1} ${pdf.fileName} ${pdf.numPages} ${pdf.isDuplex ? 'Ja' : 'Nein'}${pdf.ocrNumber || '-'}${colorName}${pdf.ocrNumber || '-'}${colorName}