Fixes
This commit is contained in:
parent
5353f6b77b
commit
4e45ad9b6e
28
src/new/fixtures/voucher.yml
Normal file
28
src/new/fixtures/voucher.yml
Normal file
@ -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'
|
||||
|
||||
@ -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"]));'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
|
||||
137
src/new/tests/PSC/Shop/Voucher/CreateTest.php
Normal file
137
src/new/tests/PSC/Shop/Voucher/CreateTest.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
namespace App\Tests\PSC\Shop\Voucher;
|
||||
|
||||
use PSC\Shop\EntityBundle\Repository\JobRepository;
|
||||
use Tests\RefreshDatabaseTrait;
|
||||
use PSC\Shop\ContactBundle\Repository\ContactRepository;
|
||||
use PSC\Shop\EntityBundle\Entity\Shop;
|
||||
use PSC\Shop\EntityBundle\Repository\ShopRepository;
|
||||
use PSC\Shop\PaymentBundle\Repository\PaymentRepository;
|
||||
use PSC\Shop\ShippingBundle\Repository\ShippingRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class CreateTest extends WebTestCase
|
||||
{
|
||||
use RefreshDatabaseTrait;
|
||||
|
||||
public function testCreateOneOrderWith5FixedVoucher(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
$shopRepository = static::getContainer()->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' => '<?xml version="1.0" encoding="utf-8"?>
|
||||
<kalkulation>
|
||||
<artikel>
|
||||
<name>Blocks A5 25blatt geleimt</name>
|
||||
<kommentar>kein</kommentar>
|
||||
|
||||
<option id="auflage" name="Auflage" type="Input" width="3" require="true" default="1">
|
||||
<auflage>
|
||||
<grenze formel="(10*5)">1-</grenze>
|
||||
</auflage>
|
||||
</option>
|
||||
|
||||
</artikel>
|
||||
</kalkulation>'
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'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']]));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -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,
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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]);
|
||||
|
||||
|
||||
@ -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,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group row">
|
||||
{{ form_label(form.wmd.mwert) }}
|
||||
<div class="col-md-8">{{ form_widget(form.wmd.mwert) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group row">
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
33
src/old/+
33
src/old/+
@ -1,33 +0,0 @@
|
||||
<div class="mb-10">
|
||||
<h2 class="text-center mb-2 font-lenzFont text-4xl tracking-widest text-highlight font-medium m-auto">Printmedien Shop</h2>
|
||||
<p class="m-auto text-lg text-center w-1/3">Erwerben Sie in unserem Printmedien Onlineshop günstige Druckprodukte zu erstklassiger Qualität kostenlos direkt zu Ihnen vor Ihre Haustüre geliefert.</p>
|
||||
</div>
|
||||
|
||||
<?php $articlegroups = $this->articlegroup()->getByArray($this->designsettings()->get('mc_start_productgroups')); ?>
|
||||
<?php $first = array_shift($articlegroups); ?>
|
||||
<div class="p-10 flex bg-dark w-2/4 m-auto text-white flex-row">
|
||||
<div class="w-1/2">
|
||||
<a href="<?= $this->url(array('id' => $first->url), 'overview') ?>" class="">
|
||||
<?= $this->image()->thumbnailImage($first->title, 'productgrouplist', $first->image); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="w-1/2 p-5">
|
||||
<h4 class="text-2xl font-lenzFont"><?php echo $first->title ?></h4>
|
||||
<p class="mt-4 mb-8 font-lenzFont"><?php echo $first->getEinleitung() ?></p>
|
||||
<a href="<?= $this->url(array('id' => $first->url), 'overview') ?>" class="uppercase bg-white p-4 text-black rounded-full text-sm font-bold">Zu den Produkten</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-2/4 m-auto text-white gap-5 columns-2 pt-5">
|
||||
<?php foreach ($articlegroups as $key => $articlegroup): ?>
|
||||
<div class="break-inside-avoid-column mb-5">
|
||||
<div class="bg-highlight p-10">
|
||||
<a href="<?= $this->url(array('id' => $articlegroup->url), 'overview') ?>" class="">
|
||||
<?= $this->image()->thumbnailImage($articlegroup->title, 'productgrouplist', $articlegroup->image); ?>
|
||||
</a>
|
||||
<h4 class="text-2xl font-lenzFont"><?php echo $articlegroup->title ?></h4>
|
||||
<p class="mt-4 mb-8 font-lenzFont"><?php echo $articlegroup->getEinleitung() ?></p>
|
||||
<a href="<?= $this->url(array('id' => $articlegroup->url), 'overview') ?>" class="uppercase text-center bg-white p-4 m-1 block text-black rounded-full text-sm font-bold hover:bg-black hover:text-white">Zu den Produkten</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
@ -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());
|
||||
|
||||
@ -96,14 +96,14 @@ class Saxoprint {
|
||||
' <div class="col-sm-8">\n' +
|
||||
' <select class="form-control" disabled id="saxo_' +
|
||||
item.id +
|
||||
'" name="' +
|
||||
'" name="proptery[' +
|
||||
item.id +
|
||||
'">' +
|
||||
']">' +
|
||||
options +
|
||||
"</select>" +
|
||||
' <input type="hidden" name="' +
|
||||
' <input type="hidden" name="property[' +
|
||||
item.id +
|
||||
'" id="disabled_input_' +
|
||||
']" id="disabled_input_' +
|
||||
item.id +
|
||||
'" value="' +
|
||||
item.defaultValue +
|
||||
@ -123,9 +123,9 @@ class Saxoprint {
|
||||
' <div class="col-sm-8">\n' +
|
||||
' <select class="form-control" id="saxo_' +
|
||||
item.id +
|
||||
'" name="' +
|
||||
'" name="property[' +
|
||||
item.id +
|
||||
'">' +
|
||||
']">' +
|
||||
options +
|
||||
"</select>" +
|
||||
" </div>\n" +
|
||||
|
||||
@ -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");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user