diff --git a/src/new/fixtures/voucher.yml b/src/new/fixtures/voucher.yml new file mode 100644 index 000000000..ae59dfb74 --- /dev/null +++ b/src/new/fixtures/voucher.yml @@ -0,0 +1,28 @@ +PSC\Shop\EntityBundle\Entity\Voucher: + voucher_1: + title: 5€ fest + enable: true + payment: true + shipping: true + more: true + percent: false + code: 5f + mode: 1 + fromDate: <(new DateTime("2023-12-12"))> + toDate: <(new DateTime("2025-12-12"))> + value: 5 + shop: '@shop_1' + voucher_2: + title: 5€ prozent + enable: true + payment: true + shipping: true + more: true + percent: true + code: 5p + mode: 1 + fromDate: <(new DateTime("2023-12-12"))> + toDate: <(new DateTime("2025-12-12"))> + value: 5 + shop: '@shop_1' + diff --git a/src/new/src/PSC/System/SettingsBundle/Twig/Node/Barcode.php b/src/new/src/PSC/System/SettingsBundle/Twig/Node/Barcode.php index 4d641b494..8e082617f 100755 --- a/src/new/src/PSC/System/SettingsBundle/Twig/Node/Barcode.php +++ b/src/new/src/PSC/System/SettingsBundle/Twig/Node/Barcode.php @@ -35,20 +35,27 @@ class Barcode extends Node }else{ $compiler->raw('$_options = [];'); } - $compiler->raw('ob_start();'); - $compiler->subcompile($this->getNode('body')) - ->raw('$_barcode = ob_get_clean();') + $node = $this->getNode('body'); + $compiler->subcompile($node) ->raw(PHP_EOL); - $compiler->raw( - '$options = new \chillerlan\QRCode\QROptions(); -$options->version = 20; + ' +$options = new \chillerlan\QRCode\QROptions(); +$options->version = \chillerlan\QRCode\Common\Version::AUTO; $options->outputInterface = \chillerlan\QRCode\Output\QRMarkupSVG::class; $options->bgColor = $_options["bgcolor"]?? "rgb(255, 255, 255)"; $options->outputBase64 = false; $options->svgAddXmlHeader = false; -$options->svgWidth = $_options["width"]?? 20; -$options->svgHeight = $_options["height"]?? 20; +if(isset($_options["width"]) && $_options["width"] != 0) { + $options->svgWidth = (string)$_options["width"]; + }else{ + $options->svgWidth = "20"; + } +if(isset($_options["height"]) && $_options["height"] != 0) { + $options->svgHeight = (string)$_options["height"]; + }else{ + $options->svgHeight = "20"; + } $options->moduleValues = [ // finder \chillerlan\QRCode\Data\QRMatrix::M_FINDER_DARK => $_options["finderdotdark"]?? "rgb(0, 0, 0)", @@ -75,9 +82,8 @@ $options->moduleValues = [ \chillerlan\QRCode\Data\QRMatrix::M_QUIETZONE => $_options["bgcolor"]?? "rgb(255, 255, 255)", \chillerlan\QRCode\Data\QRMatrix::M_SEPARATOR => $_options["bgcolor"]?? "rgb(255, 255, 255)", ]; -echo (new \chillerlan\QRCode\QRCode($options))->render(trim($_barcode));' +echo (new \chillerlan\QRCode\QRCode($options))->render(trim($context["barcode"]));' ); - + } - } diff --git a/src/new/src/PSC/System/SettingsBundle/Twig/Token/BarcodeParser.php b/src/new/src/PSC/System/SettingsBundle/Twig/Token/BarcodeParser.php index 2fea20892..f1a19f673 100755 --- a/src/new/src/PSC/System/SettingsBundle/Twig/Token/BarcodeParser.php +++ b/src/new/src/PSC/System/SettingsBundle/Twig/Token/BarcodeParser.php @@ -28,7 +28,6 @@ class BarcodeParser extends AbstractTokenParser $stream->expect(Token::BLOCK_END_TYPE); $body = $this->parser->subparse([$this, 'decideCacheEnd'], true); $stream->expect(Token::BLOCK_END_TYPE); - return new Barcode($annotation, $parameters, $body, $lineNumber, $this->getTag()); } @@ -55,4 +54,4 @@ class BarcodeParser extends AbstractTokenParser return 'barcode'; } -} \ No newline at end of file +} diff --git a/src/new/tests/PSC/Shop/Voucher/CreateTest.php b/src/new/tests/PSC/Shop/Voucher/CreateTest.php new file mode 100644 index 000000000..c68105b4c --- /dev/null +++ b/src/new/tests/PSC/Shop/Voucher/CreateTest.php @@ -0,0 +1,137 @@ +get(ShopRepository::class); + + /** + * @var Shop $shop +*/ + $shop = $shopRepository->findOneBy(['title' => 'Printchampion']); + + $shippingRepository = static::getContainer()->get(ShippingRepository::class); + + $paymentRepository = static::getContainer()->get(PaymentRepository::class); + + $client->jsonRequest( + 'POST', '/api/order/create', [ + 'shop' => [ + 'uuid' => (String)$shop->getUuid() + ], + 'type' => 2, + 'shipping' => [ + 'uid' => $shippingRepository->findOneBy(['title' => 'Deutschlandweit'])->getUid() + ], + 'payment' => [ + 'uid' => $paymentRepository->findOneBy(['title' => 'per Rechnung'])->getUid() + ], + 'voucher' => [ + [ + 'code' => '5f' + ] + ], + 'draft' => false, + 'deliveryAddress' => [ + 'firstname' => 'Thomas', + 'lastname' => 'Peterson', + 'street' => 'Chausseestr.', + 'houseNumber' => '24', + 'zip' => '17506', + 'city' => 'Gribow' + ], + 'invoiceAddress' => [ + 'firstname' => 'Thomas', + 'lastname' => 'Peterson', + 'street' => 'Chausseestr.', + 'houseNumber' => '24', + 'zip' => '17400', + 'city' => 'Berlin' + ], + 'positions' => [ + [ + 'count' => 1, + 'product' => [ + 'title' => 'test XML', + 'specialProductTypeObject' => [ + 'typ' => 6, + 'taxClass' => 1900, + 'xml' => ' + + + Blocks A5 25blatt geleimt + kein + + + + + ' + ] + ] + ], + [ + 'count' => 1, + 'product' => [ + 'title' => 'test Manual Position', + 'specialProductTypeObject' => [ + 'typ' => 1, + 'cent' => true, + 'net' => 145, + 'taxClass' => 1900 + ] + ] + ] + ] + ], ['HTTP_apiKey' => $shop->getApiKey()] + ); + + self::assertSame(200, $client->getResponse()->getStatusCode()); + + $data = json_decode($client->getResponse()->getContent(), true); + + $client->jsonRequest( + 'POST', '/api/order/getonebyuuid', [ + 'uuid' => $data['uuid'], + ], ['HTTP_apiKey' => $shop->getApiKey()] + ); + + $data = json_decode($client->getResponse()->getContent(), true); + + self::assertSame(7147, $data['gross']); + self::assertSame('SAN-'.date("Ym").'-1', $data['alias']); + + self::assertSame('Berlin', $data['invoiceAddress']['city']); + + self::assertSame('Gribow', $data['deliveryAddress']['city']); + + self::assertSame(200, $client->getResponse()->getStatusCode()); + + /** + * @var JobRepository $jobs +*/ + $jobs = static::getContainer()->get(JobRepository::class); + + self::assertCount(0, $jobs->findBy(['data.order' => $data['uuid']])); + + } + +} diff --git a/src/new/tests/sqlite.sql b/src/new/tests/sqlite.sql index 1bd334d8a..951b57dad 100755 --- a/src/new/tests/sqlite.sql +++ b/src/new/tests/sqlite.sql @@ -628,6 +628,10 @@ create table credit_system enable INTEGER null, f date null, t date null, + payment INTEGER null, + zeroPayment INTEGER null, + zeroShipping INTEGER null, + shipping INTEGER null, percent INTEGER null, wert float null, more INTEGER not null, diff --git a/src/new/var/plugins/Custom/NoweDruck/UPS/Queue/Import.php b/src/new/var/plugins/Custom/NoweDruck/UPS/Queue/Import.php index 52c66978b..954d1aa07 100755 --- a/src/new/var/plugins/Custom/NoweDruck/UPS/Queue/Import.php +++ b/src/new/var/plugins/Custom/NoweDruck/UPS/Queue/Import.php @@ -25,7 +25,9 @@ class Import implements InternalQueueInterface set_time_limit(0); $finder = new Finder(); - + if(!file_exists('/data/www/old/data/packages/ups/import')) { + return true; + } $files = $finder->files()->in('/data/www/old/data/packages/ups/import')->name("*.Out"); /** @var SplFileInfo $file */ foreach($files as $file) { @@ -56,4 +58,4 @@ class Import implements InternalQueueInterface return true; } -} \ No newline at end of file +} diff --git a/src/new/var/plugins/Custom/PSC/CollectLayouter/Helper/MPDF.php b/src/new/var/plugins/Custom/PSC/CollectLayouter/Helper/MPDF.php index 6190f2f97..21bbcc755 100755 --- a/src/new/var/plugins/Custom/PSC/CollectLayouter/Helper/MPDF.php +++ b/src/new/var/plugins/Custom/PSC/CollectLayouter/Helper/MPDF.php @@ -134,7 +134,6 @@ EOD; $twig = $this->twig->createTemplate($this->setting->getHtml()); $html = $twig->render(['form' => $this->data, 'print' => $print]); - $this->mpdf->WriteHTML($html,\Mpdf\HTMLParserMode::HTML_BODY); $this->mpdf->Output($this->pdfFile); @@ -168,4 +167,4 @@ EOD; return $this->pdfFile; } -} \ No newline at end of file +} diff --git a/src/new/var/plugins/Custom/PSC/Printess/Queue/Render.php b/src/new/var/plugins/Custom/PSC/Printess/Queue/Render.php index 84a3c141d..f320103cc 100755 --- a/src/new/var/plugins/Custom/PSC/Printess/Queue/Render.php +++ b/src/new/var/plugins/Custom/PSC/Printess/Queue/Render.php @@ -99,7 +99,6 @@ class Render implements QueueInterface, ConfigurableElementInterface ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $objPosition->getLayouterId())); $data = $layoutDesignData->getDesign(); - $this->sendToProduction->setShopId($pos->getShop()->getUID()); $response = $this->sendToProduction->sendToProduction($data['projectId'], $pos->getOrder()->getAlias() . ' ' .$pos->getPos()); if(isset($response['jobId'])) { @@ -123,7 +122,6 @@ class Render implements QueueInterface, ConfigurableElementInterface } } - $orderspos = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos') ->findby(['layouterMode' => 101, 'renderPrint' => 2]); @@ -171,4 +169,4 @@ class Render implements QueueInterface, ConfigurableElementInterface return $this->_error; } -} \ No newline at end of file +} diff --git a/src/new/var/plugins/Custom/PSC/Saxoprint_API_R1/Api/GetPrice.php b/src/new/var/plugins/Custom/PSC/Saxoprint_API_R1/Api/GetPrice.php index 5c0e004a6..b406d42a9 100755 --- a/src/new/var/plugins/Custom/PSC/Saxoprint_API_R1/Api/GetPrice.php +++ b/src/new/var/plugins/Custom/PSC/Saxoprint_API_R1/Api/GetPrice.php @@ -24,13 +24,14 @@ class GetPrice extends Base protected function buildData() { $temp = []; - - foreach($this->config as $key => $value) + $tempCustom = []; + foreach($this->config['property'] as $key => $value) { - if($key == 102) { + if($key == '102') { $this->versand = $value; continue; } + if($key == 'auflage') { $this->auflage = $value; continue; @@ -39,9 +40,18 @@ class GetPrice extends Base $temp[$key] = intval($value); } } + if(isset($this->config['custom'])) { + foreach($this->config['custom'] as $key => $value) + { + if($value != 0) { + $tempCustom[$key] = intval($value); + } + } + } return [ 'PropertyPropertyValue' => $temp, + 'PropertyCustomValue' => $tempCustom, ]; } @@ -94,4 +104,4 @@ class GetPrice extends Base { $this->versand = $versand; } -} \ No newline at end of file +} diff --git a/src/new/var/plugins/Custom/PSC/WMD_API/Controller/WMDController.php b/src/new/var/plugins/Custom/PSC/WMD_API/Controller/WMDController.php index d53f3aeb2..5b7f23624 100755 --- a/src/new/var/plugins/Custom/PSC/WMD_API/Controller/WMDController.php +++ b/src/new/var/plugins/Custom/PSC/WMD_API/Controller/WMDController.php @@ -67,7 +67,8 @@ class WMDController extends AbstractController foreach($pricesArray as $priceObj) { $versand['values'][] = ['id' => $priceObj['deliveryOption'], 'label' => $priceObj['deliveryOption'], 'price' => $priceObj['price']['productPriceWithTax']['centAmount']]; - if($price === 0) { + if(($price === 0 && !isset($reqConfig['shipping'])) || + $price === 0 && isset($reqConfig['shipping']) && $reqConfig['shipping'] == $priceObj['deliveryOption']) { $price = $priceObj['price']['productPrice']['centAmount']; $priceVat = $priceObj['price']['productTax']['centAmount']; $priceGross = $priceObj['price']['productPriceWithTax']['centAmount']; @@ -75,6 +76,10 @@ class WMDController extends AbstractController } + if(isset($reqConfig['shipping'])) { + $versand['defaultValue'] = $reqConfig['shipping']; + } + $config[] = $auflage; $config[] = $versand; diff --git a/src/new/var/plugins/Custom/PSC/WMD_API/Form/ProductSettings.php b/src/new/var/plugins/Custom/PSC/WMD_API/Form/ProductSettings.php index fdb0c3dda..527d7e769 100755 --- a/src/new/var/plugins/Custom/PSC/WMD_API/Form/ProductSettings.php +++ b/src/new/var/plugins/Custom/PSC/WMD_API/Form/ProductSettings.php @@ -5,7 +5,9 @@ namespace Plugin\Custom\PSC\WMD_API\Form; use PSC\Libraries\AceEditorBundle\Form\Extension\AceEditorType; use PSC\Shop\EntityBundle\Entity\Product; use PSC\System\PluginBundle\Form\Interfaces\Field; +use PSC\System\SettingsBundle\Service\Tax; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -15,7 +17,7 @@ use Symfony\Component\Form\FormEvent; class ProductSettings implements Field { - public function __construct() + public function __construct(private Tax $taxService) { } public function getTemplate() @@ -38,6 +40,10 @@ class ProductSettings implements Field public function buildForm(FormBuilderInterface $builder, array $options) { $builder + ->add("mwert", ChoiceType::class, array( + 'label' => 'MwSt.', + 'choices' => $this->taxService->getTaxesForForm(), + )) ->add( "config", AceEditorType::class, array( 'wrapper_attr' => array(), // aceeditor wrapper html attributes. @@ -82,12 +88,20 @@ class ProductSettings implements Field public function formPostSetData(FormEvent $event) { + /** @var Product $data */ + $data = $event->getData(); + $event->getForm()->get('wmd')->get('mwert')->setData($data->getMwert()); } public function formPostSubmit(FormEvent $event) { + /** @var Product $data */ + $data = $event->getData(); + $data->setMwert($event->getForm()->get('wmd')->get('mwert')->getData()); + $event->setData($data); } + public function formPreSetData(FormEvent $event) { // TODO: Implement formPreSetData() method. diff --git a/src/new/var/plugins/Custom/PSC/WMD_API/Resources/views/form/product_settings.html.twig b/src/new/var/plugins/Custom/PSC/WMD_API/Resources/views/form/product_settings.html.twig index 8bd25a3b4..bf55d6580 100755 --- a/src/new/var/plugins/Custom/PSC/WMD_API/Resources/views/form/product_settings.html.twig +++ b/src/new/var/plugins/Custom/PSC/WMD_API/Resources/views/form/product_settings.html.twig @@ -1,3 +1,11 @@ +
+
+
+ {{ form_label(form.wmd.mwert) }} +
{{ form_widget(form.wmd.mwert) }}
+
+
+
diff --git a/src/new/var/plugins/System/PSC/Bootstrap3/Form/Field/Sites.php b/src/new/var/plugins/System/PSC/Bootstrap3/Form/Field/Sites.php index a47c45455..c126c220b 100755 --- a/src/new/var/plugins/System/PSC/Bootstrap3/Form/Field/Sites.php +++ b/src/new/var/plugins/System/PSC/Bootstrap3/Form/Field/Sites.php @@ -70,7 +70,7 @@ if(isset($_POST["settings"]["bootstrap3Images"]["layout"])) { $txtdefault = fread($handledefault, filesize($filenamedefault)); fclose($handledefault); - $filenamehauptmenu = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/layout/_hauptmenu.html"; + $filenamehauptmenu = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/layout/_hauptmenu.phtml"; $handlehauptmenu = fopen($filenamehauptmenu, 'r'); $txthauptmenu = fread($handlehauptmenu, filesize($filenamehauptmenu)); fclose($handlehauptmenu); diff --git a/src/new/var/plugins/System/PSC/Bootstrap4/Form/Field/Sites.php b/src/new/var/plugins/System/PSC/Bootstrap4/Form/Field/Sites.php index dab2a8536..c2443f7ba 100755 --- a/src/new/var/plugins/System/PSC/Bootstrap4/Form/Field/Sites.php +++ b/src/new/var/plugins/System/PSC/Bootstrap4/Form/Field/Sites.php @@ -70,7 +70,7 @@ if(isset($_POST["settings"]["bootstrap4Images"]["layout"])) { $txtdefault = fread($handledefault, filesize($filenamedefault)); fclose($handledefault); - $filenamehauptmenu = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/layout/_hauptmenu.html"; + $filenamehauptmenu = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/layout/_hauptmenu.phtml"; $handlehauptmenu = fopen($filenamehauptmenu, 'r'); $txthauptmenu = fread($handlehauptmenu, filesize($filenamehauptmenu)); fclose($handlehauptmenu); diff --git a/src/old/+ b/src/old/+ deleted file mode 100644 index 3612a512d..000000000 --- a/src/old/+ +++ /dev/null @@ -1,33 +0,0 @@ -
-

Printmedien Shop

-

Erwerben Sie in unserem Printmedien Onlineshop günstige Druckprodukte zu erstklassiger Qualität kostenlos direkt zu Ihnen vor Ihre Haustüre geliefert.

-
- -articlegroup()->getByArray($this->designsettings()->get('mc_start_productgroups')); ?> - - - diff --git a/src/old/application/modules/default/controllers/BasketController.php b/src/old/application/modules/default/controllers/BasketController.php index b4fc877fa..a57b821c8 100755 --- a/src/old/application/modules/default/controllers/BasketController.php +++ b/src/old/application/modules/default/controllers/BasketController.php @@ -3958,7 +3958,7 @@ $creditSystemPayment = false; } - if (($article->typ == 6 || $article->typ == 100) && $artikel->getLayouterId() != "") { + if ($artikel->getLayouterId() != "") { $articleSession = new TP_Layoutersession(); $articleSess = $articleSession->getLayouterArticle($artikel->getLayouterId()); diff --git a/src/old/public/styles/vorlagen/bootstrap4_api/saxoprint.js b/src/old/public/styles/vorlagen/bootstrap4_api/saxoprint.js index bfc8088f3..01e9ccc8b 100755 --- a/src/old/public/styles/vorlagen/bootstrap4_api/saxoprint.js +++ b/src/old/public/styles/vorlagen/bootstrap4_api/saxoprint.js @@ -96,14 +96,14 @@ class Saxoprint { '
\n' + ' " + - ' \n' + ' " + "
\n" + diff --git a/src/old/public/styles/vorlagen/bootstrap4_api/wmd.js b/src/old/public/styles/vorlagen/bootstrap4_api/wmd.js index a0a66c297..9d5524862 100755 --- a/src/old/public/styles/vorlagen/bootstrap4_api/wmd.js +++ b/src/old/public/styles/vorlagen/bootstrap4_api/wmd.js @@ -36,7 +36,7 @@ class WMD { options = ""; $.each(item.values, function (i, value) { selected = ""; - if (parseInt(item.defaultValue) == value.id) { + if (item.defaultValue == value.id) { selected = 'selected="selected"'; } if (value.id == 0) { @@ -118,12 +118,12 @@ class WMD { } if (item.values.length > 0) { - $("#saxo_" + item.id) + $("#wmd" + item.id) .parent() .parent() .removeClass("hide"); } else { - $("#saxo_" + item.id) + $("#wmd" + item.id) .parent() .parent() .addClass("hide");