diff --git a/.docker/images/php/base/Dockerfile b/.docker/images/php/base/Dockerfile index 3f282ef85..6fd7ad548 100644 --- a/.docker/images/php/base/Dockerfile +++ b/.docker/images/php/base/Dockerfile @@ -100,8 +100,14 @@ RUN docker-php-ext-install -j$(nproc) ldap RUN pecl install imap \ && docker-php-ext-enable imap +# rsvg und pdfmerge für creativelayouter +COPY ./src/new/assets/fonts /usr/local/share/fonts/custom +RUN fc-cache -fv +RUN apt-get update && apt-get install cairosvg -y -# COPY ./.docker/images/php/base/pdf/php_pdflib.so /pdflib.so +RUN apt-get update && apt-get install -y --no-install-recommends \ + poppler-utils \ + && rm -rf /var/lib/apt/lists/* # make bash default shell RUN sed -e 's;/bin/ash$;/bin/bash;g' -i /etc/passwd diff --git a/.docker/images/php/base/pdf/php_pdflib.so b/.docker/images/php/base/pdf/php_pdflib.so index 4bc65e1ef..44e4d3f28 100644 Binary files a/.docker/images/php/base/pdf/php_pdflib.so and b/.docker/images/php/base/pdf/php_pdflib.so differ diff --git a/dev_db/mariadb.sql b/dev_db/mariadb.sql index 066cdbfe9..c1f85228c 100644 --- a/dev_db/mariadb.sql +++ b/dev_db/mariadb.sql @@ -306,7 +306,7 @@ CREATE TABLE `article` ( `a4_auflagen` text DEFAULT NULL, `a4_sponsoring` int(1) DEFAULT NULL, `a4_prodzeit` varchar(255) DEFAULT NULL, - `a4_abpreis` float(8,2) DEFAULT 0.00, + `a4_abpreis` varchar(20) DEFAULT NULL, `a5_buy` int(1) DEFAULT NULL, `a5_xml` text DEFAULT NULL, `layouterid` varchar(255) DEFAULT NULL, diff --git a/dev_db/mongodb.dump b/dev_db/mongodb.dump index ed7added2..1782d796c 100644 Binary files a/dev_db/mongodb.dump and b/dev_db/mongodb.dump differ diff --git a/src/new/assets/backend/dashboard/js/order.js b/src/new/assets/backend/dashboard/js/order.js index 59d58f993..cad411ee6 100755 --- a/src/new/assets/backend/dashboard/js/order.js +++ b/src/new/assets/backend/dashboard/js/order.js @@ -1,27 +1,40 @@ const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet, reOrder, reOrderOrder, reOrderPos }, orderUuid) => ` -
-
${pos}
-
- ${ - (product => product.originalProduct ? `${product.originalProduct.title}` : `${product.title}` )(product) //call the anonymous inline with the data we care about - } -
ArtNr intern: ${product.nrIntern}
- ${psc.order.get_special_product_options(product.specialProductTypeObject)}
-
Auflage: ${price.count}
-
Kunden Info: ${customerInfo}${(reOrder? `
Ist eine Nachbestellung`:``)}
-
${basketField1}
-
${basketField2}
-
${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet/100)} (${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross/100)})
-
- -
-
-
+
+ + `; const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet }, orderUuid) => ` @@ -45,7 +58,7 @@ const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketFiel `; const Order_List_Pos_Status = (status, orderUuid, posUuid) => ` - + `; const Order_List_Pos_Calc_Option = (elm) => ` @@ -91,25 +104,31 @@ export class order { bind_buttons() { $('.toogle_list_detail_view').off(); $('.toogle_list_detail_view').on('click', function() { - var uuid = $(this).data().uuid; - if($('#rows-' + uuid + ' > div').length > 0) { + var uuid = $(this).data().uuid; + var $icon = $(this); + if($('#rows-' + uuid).children().length > 0) { $('#rows-' + uuid).html(''); + $icon.removeClass('fa-minus').addClass('fa-plus'); }else{ psc.order.load_detail(uuid); + $icon.removeClass('fa-plus').addClass('fa-minus'); } }); $('.toogle_list_simple_detail_view').off(); $('.toogle_list_simple_detail_view').on('click', function() { - var uuid = $(this).data().uuid; - if($('#rows-' + uuid + ' > tr').length > 0) { + var uuid = $(this).data().uuid; + var $icon = $(this); + if($('#rows-' + uuid).children().length > 0) { $('#rows-' + uuid).html(''); + $icon.removeClass('fa-minus').addClass('fa-plus'); }else{ psc.order.load_detail(uuid, true); + $icon.removeClass('fa-plus').addClass('fa-minus'); } }); - + } load_detail(orderUuid, simple = false) { diff --git a/src/new/assets/tailwind/backend.js b/src/new/assets/tailwind/backend.js index 91e66bc9b..40fbe8631 100644 --- a/src/new/assets/tailwind/backend.js +++ b/src/new/assets/tailwind/backend.js @@ -12,6 +12,15 @@ import { startStimulusApp } from '@symfony/stimulus-bundle'; const app = startStimulusApp(); Alpine.plugin(persist) +// Import PSC modules +import { order } from './js/order.js'; +import { multiselect } from './js/multiselect.js'; + +// Initialize PSC global object +window.psc = window.psc || {}; +window.psc.order = new order(); +window.psc.multiselect = new multiselect(); + Alpine.store('theme', { theme: Alpine.$persist("light").as('theme'), @@ -36,3 +45,7 @@ Alpine.store('sideBar', { } }) Alpine.start(); + +// Initialize PSC modules +window.psc.order.init(); +window.psc.multiselect.init(); diff --git a/src/new/assets/tailwind/js/multiselect.js b/src/new/assets/tailwind/js/multiselect.js new file mode 100644 index 000000000..1fbd6cd85 --- /dev/null +++ b/src/new/assets/tailwind/js/multiselect.js @@ -0,0 +1,74 @@ +export class multiselect { + + init() { + this.bindMultiSelectButtons(); + } + + bindMultiSelectButtons() { + // Find all multiselect widgets + $('[data-multiselect-widget]').each(function() { + const $widget = $(this); + const $from = $widget.find('select[name$="_from"]'); + const $to = $widget.find('select[name]:not([name$="_from"])'); + + // Get base ID (without _from or _to suffix) + const fromId = $from.attr('id'); + + // Right All button + $widget.find('button[id$="_rightAll"]').off('click').on('click', function() { + $from.find('option').each(function() { + const $option = $(this).clone(); + $to.append($option); + }); + $from.empty(); + }); + + // Right Selected button + $widget.find('button[id$="_rightSelected"]').off('click').on('click', function() { + $from.find('option:selected').each(function() { + const $option = $(this).clone(); + $to.append($option); + $(this).remove(); + }); + }); + + // Left Selected button + $widget.find('button[id$="_leftSelected"]').off('click').on('click', function() { + $to.find('option:selected').each(function() { + const $option = $(this).clone(); + $from.append($option); + $(this).remove(); + }); + }); + + // Left All button + $widget.find('button[id$="_leftAll"]').off('click').on('click', function() { + $to.find('option').each(function() { + const $option = $(this).clone(); + $from.append($option); + }); + $to.empty(); + }); + + // Double click to move items + $from.off('dblclick').on('dblclick', 'option', function() { + const $option = $(this).clone(); + $to.append($option); + $(this).remove(); + }); + + $to.off('dblclick').on('dblclick', 'option', function() { + const $option = $(this).clone(); + $from.append($option); + $(this).remove(); + }); + }); + + // Before form submit, select all options in the "to" select + $('form').on('submit', function() { + $(this).find('[data-multiselect-widget]').each(function() { + $(this).find('select[name]:not([name$="_from"]) option').prop('selected', true); + }); + }); + } +} diff --git a/src/new/assets/tailwind/js/order.js b/src/new/assets/tailwind/js/order.js new file mode 100644 index 000000000..2d89c2c35 --- /dev/null +++ b/src/new/assets/tailwind/js/order.js @@ -0,0 +1,309 @@ +const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet, reOrder, reOrderOrder, reOrderPos }, orderUuid) => ` + +
+
+ Pos: +
${pos}
+
+
+ Produkt: +
+ ${ + (product => product.originalProduct ? `${product.originalProduct.title}` : `${product.title}` )(product) + } +
ArtNr intern: ${product.nrIntern}
+ ${psc.order.get_special_product_options(product.specialProductTypeObject)} +
+
+
+ Auflage: +
${price.count}
+
+
+ Kunden Info: +
${customerInfo}${(reOrder? `
Ist eine Nachbestellung`:``)}
+
+
+ Preis: +
+ ${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet/100)}
+ (${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross/100)}) +
+
+
+ Status: +
+ + +
+
+
+ +`; + +const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet }, orderUuid) => ` + +
+
+ Pos: +
${pos}
+
+
+ Produkt: +
+ ${ + (product => product.originalProduct ? `${product.originalProduct.title}` : `${product.title}` )(product) + } +
ArtNr intern: ${product.nrIntern}
+ ${psc.order.get_special_product_options(product.specialProductTypeObject)} +
+
+
+ Auflage: +
${price.count}
+
+
+ Kunden Info: +
${customerInfo}
+
+
+ Preis: +
${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet/100)} (${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross/100)})
+
+
+ Status: +
${psc.order.get_pos_status(status).internalName}
+
+
+ +`; + +const Order_List_Pos_Status = (status, orderUuid, posUuid) => ` + +`; + +const Order_List_Pos_Calc_Option = (elm) => ` + ${elm.name}${elm.value} +`; + +export class order { + + init() { + this.load_status(); + this.bind_buttons(); + this.init_dropdowns(); + } + + init_dropdowns() { + // Initialize all status dropdowns (both in main table and details) + $(document).off('click.orderDropdown'); + $(document).on('click.orderDropdown', '.relative.inline-block button', function(e) { + e.preventDefault(); + e.stopPropagation(); + var $dropdown = $(this).next('div'); + + // Close all other dropdowns + $('.relative.inline-block div[class*="hidden"]').addClass('hidden'); + + // Toggle this dropdown + $dropdown.toggleClass('hidden'); + }); + + // Close dropdowns when clicking outside + $(document).on('click.orderDropdown', function(e) { + if (!$(e.target).closest('.relative.inline-block').length) { + $('.relative.inline-block div[class*="absolute"]').addClass('hidden'); + } + }); + } + + get_special_product_options(specialProductTypeObject) { + if(specialProductTypeObject.typ != 6) { + return ''; + } + + return '' + specialProductTypeObject.options.map(elm => { + if(elm.type != 'hidden') { + return Order_List_Pos_Calc_Option(elm); + } + }).join('') + '
'; + } + + load_status() { + if(jwt_token != "") { + $.ajax({ + url: "/apps/api/system/status", + contentType: "application/json", + headers: { + "Authorization": "Bearer " + jwt_token + }, + method: 'GET', + success: function (result) { + psc.order.status_order = result.order; + psc.order.status_pos = result.position; + } + }); + } + } + + bind_buttons() { + $('.toogle_list_detail_view').off(); + $('.toogle_list_detail_view').on('click', function() { + var uuid = $(this).data().uuid; + var $icon = $(this); + if($('#rows-' + uuid).children().length > 0) { + $('#rows-' + uuid).html(''); + $icon.removeClass('fa-minus').addClass('fa-plus'); + }else{ + psc.order.load_detail(uuid); + $icon.removeClass('fa-plus').addClass('fa-minus'); + } + }); + + $('.toogle_list_simple_detail_view').off(); + $('.toogle_list_simple_detail_view').on('click', function() { + var uuid = $(this).data().uuid; + var $icon = $(this); + if($('#rows-' + uuid).children().length > 0) { + $('#rows-' + uuid).html(''); + $icon.removeClass('fa-minus').addClass('fa-plus'); + }else{ + psc.order.load_detail(uuid, true); + $icon.removeClass('fa-plus').addClass('fa-minus'); + } + }); + + + } + + load_detail(orderUuid, simple = false) { + $.ajax({ + url: "/apps/api/order/getonebyuuid", + contentType: "application/json", + headers: { + "Authorization": "Bearer " + jwt_token + }, + method: 'POST', + data: JSON.stringify({ + uuid: orderUuid + }), + success: function(result) { + psc.order.build_details(orderUuid, result, simple); + } + }) + } + + build_details(orderUuid, result, simple = false) { + if(simple) { + $('#rows-' + result.uuid).html(result.positions.map(x => Order_List_Detail_Simple(x, orderUuid)).join('')); + }else{ + $('#rows-' + result.uuid).html(result.positions.map(x => Order_List_Detail(x, orderUuid)).join('')); + result.positions.map(x => this.loadPluginDetails(x)); + + } + + this.bind_status_buttons(); + } + + loadPluginDetails(pos) { + $.ajax({ + url: "/apps/api/position/getpluginlistdetails/" + pos.uuid, + contentType: "application/json", + headers: { + "Authorization": "Bearer " + jwt_token + }, + method: 'GET', + success: function(result) { + $('#row-' + pos.uuid).append(result.html); + } + }) + } + + bind_status_buttons() { + // Bind status change buttons for positions + $('.switch_pos').off(); + $('.switch_pos').on('click', function() { + + var orderUuid = $(this).data().orderUuid; + var posUuid = $(this).data().posUuid; + var status = $(this).data().status; + + $.ajax({ + url: "/apps/api/position/status/change", + contentType: "application/json", + headers: { + "Authorization": "Bearer " + jwt_token + }, + data: JSON.stringify({ + position: posUuid, + status: status, + }), + method: 'POST', + success: function(result) { + $('#rows-' + orderUuid).html(''); + psc.order.load_detail(orderUuid); + } + }); + }); + } + + get_pos_bg_color(status) { + + /* + {% if orderStatuse.getPosStatusColor(pos.status) != '' %}background-color: {{ orderStatuse.getPosStatusColor(pos.status) }}{% endif %}" + */ + const found = psc.order.status_pos.find(stat => stat.code == status); + + if(found && found.color != "") { + return 'background-color: ' + found.color; + } + + } + + get_pos_status(status) { + + /* + {% if orderStatuse.getPosStatusColor(pos.status) != '' %}background-color: {{ orderStatuse.getPosStatusColor(pos.status) }}{% endif %}" + */ + const found = psc.order.status_pos.find(stat => stat.code == status); + if(found) { + return found; + } + + return {internalName: 'notFound'}; + + } + + get_pos_bg_color_class(status) { + + /* + class="{% if pos.status == 170 %}bg-lightdark{% elseif pos.status == 200 or pos.status == 210 %}bg-lightsuccess{% else %}bg-lightdanger{% endif %} + */ + + if(status == 170) { + return 'bg-lightdark'; + } + if(status == 200 || status == 210) { + return 'bg-lightsuccess'; + } + + return 'bg-lightdanger'; + } + + get_pos_status_loop(orderUuid, posUuid) { + return psc.order.status_pos.map(x => Order_List_Pos_Status(x, orderUuid, posUuid)).join(''); + } + +} diff --git a/src/new/composer.json b/src/new/composer.json index 98df67446..e65f3f9d4 100755 --- a/src/new/composer.json +++ b/src/new/composer.json @@ -54,6 +54,7 @@ "oyejorge/less.php": "~1.5", "paypal/paypal-checkout-sdk": "dev-master", "paypal/rest-api-sdk-php": "dev-master", + "phenx/php-font-lib": "^1.0", "phpoffice/phpspreadsheet": "^1.28", "phpseclib/phpseclib": "~3.0", "picqer/sendcloud-php-client": "v2.8.1", diff --git a/src/new/composer.lock b/src/new/composer.lock index 2111eda9e..50d3176be 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": "f0609413226c0c4e60f20fbe8a606b6b", + "content-hash": "a64df55d7d2fc51cd3b31487e06b46da", "packages": [ { "name": "azuyalabs/yasumi", @@ -6470,6 +6470,51 @@ "abandoned": "paypal/paypal-server-sdk", "time": "2020-05-11T17:21:19+00:00" }, + { + "name": "phenx/php-font-lib", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/dompdf/php-font-lib.git", + "reference": "6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d", + "reference": "6137b7d4232b7f16c882c75e4ca3991dbcf6fe2d", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3 || ^4 || ^5 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "FontLib\\": "src/FontLib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-or-later" + ], + "authors": [ + { + "name": "The FontLib Community", + "homepage": "https://github.com/dompdf/php-font-lib/blob/master/AUTHORS.md" + } + ], + "description": "A library to read, parse, export and make subsets of different types of font files.", + "homepage": "https://github.com/dompdf/php-font-lib", + "support": { + "issues": "https://github.com/dompdf/php-font-lib/issues", + "source": "https://github.com/dompdf/php-font-lib/tree/1.0.1" + }, + "time": "2024-12-02T14:37:59+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", diff --git a/src/new/src/PSC/Component/SteplayouterBundle/Controller/PdfController.php b/src/new/src/PSC/Component/SteplayouterBundle/Controller/PdfController.php index ff20ce769..a6fc5c533 100755 --- a/src/new/src/PSC/Component/SteplayouterBundle/Controller/PdfController.php +++ b/src/new/src/PSC/Component/SteplayouterBundle/Controller/PdfController.php @@ -15,29 +15,30 @@ namespace PSC\Component\SteplayouterBundle\Controller; use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ORM\EntityManagerInterface; +use FontLib\Font; use Gaufrette\Util\Path; +use PSC\Component\SteplayouterBundle\Calendar\Design; +use PSC\Component\SteplayouterBundle\Calendar\Generator; +use PSC\Component\SteplayouterBundle\Calendar\Type\Hoch; use PSC\Component\SteplayouterBundle\Calendar\Type\Hochvariable; +use PSC\Component\SteplayouterBundle\Calendar\Type\Quer; use PSC\Component\SteplayouterBundle\Config\Converter\ToArray; use PSC\Component\SteplayouterBundle\Service\Pdf; use PSC\Shop\EntityBundle\Document\Motiv; use PSC\Shop\EntityBundle\Entity\Layoutdesigndata; use PSC\Shop\EntityBundle\Entity\Product; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; -use PSC\Component\SteplayouterBundle\Calendar\Design; -use PSC\Component\SteplayouterBundle\Calendar\Type\Hoch; -use PSC\Component\SteplayouterBundle\Calendar\Type\Quer; -use PSC\Component\SteplayouterBundle\Calendar\Generator; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\KernelInterface; -use Symfony\Component\Security\Core\Exception\AccessDeniedException; -use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Routing\Annotation\Route; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Translation\Exception\NotFoundResourceException; use Twig\Environment; use Twig\Extension\StringLoaderExtension; @@ -57,7 +58,10 @@ class PdfController extends AbstractController * * @return void */ - #[Route(path: '/component/steplayouter/pdf/imagepreview/{layouter_uuid}/{width}', name: 'component_steplayouter_pdf_imagepreview')] + #[Route( + path: '/component/steplayouter/pdf/imagepreview/{layouter_uuid}/{width}', + name: 'component_steplayouter_pdf_imagepreview', + )] public function imagePreviewAction( Request $request, EntityManagerInterface $entityManager, @@ -65,47 +69,35 @@ class PdfController extends AbstractController KernelInterface $kernel, Environment $twig, ToArray $converter, - $pdflib_lic, $layouter_uuid, - $width = 100 + $width = 100, ) { - /** @var Product $product */ $product = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $layouter_uuid)); + ->getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findOneBy(['uuid' => $layouter_uuid]); if ($product) { $data = $product->getSteplayouterData(); - $datatable = array(); + $datatable = []; } else { - /** @var Layoutdesigndata $layoutData */ + /** @var Layoutdesigndata $layoutData */ $layoutData = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouter_uuid)); + ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata') + ->findOneBy(['uuid' => $layouter_uuid]); $data = $layoutData->getDesign(); $datatable = $layoutData->getDatatable(); $product = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $layoutData->getArticleUuid())); + ->getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findOneBy(['uuid' => $layoutData->getArticleUuid()]); } if (empty($datatable)) { - $datatable[] = array(); + $datatable[] = []; } - $p = new \PDFlib(); - $p->set_option("errorpolicy=return"); - $p->set_option("stringformat=utf8"); - if ($pdflib_lic != "") { - @$p->set_parameter("license", $pdflib_lic); - } - $p->set_option("SearchPath=" . $kernel->getProjectDir() . "/assets/fonts"); - $outfilename = "temp/" . uniqid() . ".pdf"; - if ($p->begin_document($outfilename, "") == 0) { - die("Error: " . $p->get_errmsg()); - } - - $p->set_info("Creator", "PDFlib starter sample"); - $p->set_info("Title", "starter_path"); + $outfilename = 'temp/' . uniqid() . '.pdf'; $dataArray = $converter->fromXml($product); - $tempFiles = array(); + $tempFiles = []; foreach ($datatable as $row) { $pageOpen = false; foreach ($data as $key => $site) { @@ -119,151 +111,79 @@ class PdfController extends AbstractController $site['height'] = $layoutData->getDynamicHeight(); } - $svgContent = $site['fabricSVG']; - $xml = simplexml_load_string($svgContent); - $tps = $xml->xpath('//*[string(@templatePrintBinding)]'); - foreach ($tps as $tp) { - $tp->{0} = $tp['templatePrintBinding']; - } - $svgContent = $xml->asXML(); - preg_match_all('/(image|xlink:href)=(")[^">]+/i', $svgContent, $media); - $urls = preg_replace('/(image|xlink:href)("|=")(.*)/i', "$3", $media[0]); + $svg = $site['fabricSVG']; + + preg_match_all('/(image|xlink:href)=(")[^">]+/i', $svg, $media); + $urls = preg_replace('/(image|xlink:href)("|=")(.*)/i', '$3', $media[0]); $cal = false; foreach ($urls as $url) { - $matches = array(); - $found = preg_match("/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/", $url, $matches); + $matches = []; + $found = preg_match( + '/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', + $url, + $matches, + ); if ($found == 0) { - $found = preg_match("/[a-fA-F0-9]{4}-[a-fA-F0-9]{8}-[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{8}/", $url, $matches); + $found = preg_match( + '/[a-fA-F0-9]{4}-[a-fA-F0-9]{8}-[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{8}/', + $url, + $matches, + ); } if ($found == 0) { $found = preg_match("/\/[a-fA-F0-9]{24}/", $url, $matches); if (isset($matches[0])) { - $matches[0] = str_replace("/", "", $matches[0]); + $matches[0] = str_replace('/', '', $matches[0]); } } if ($found) { - $motiv = $documentManager - ->getRepository(Motiv::class) - ->find($matches[0]); + $motiv = $documentManager->getRepository(Motiv::class)->find($matches[0]); if (!$motiv) { $motiv = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv')->findOneByUuid($matches[0]); + ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv') + ->findOneByUuid($matches[0]); } if ($motiv) { - $svgContent = str_replace($url, "../market/motive/" . $motiv->getFileMid(), $svgContent); + $svg = str_replace($url, '/data/www/old/market/motive/' . $motiv->getFileMid(), $svg); } continue; } - if ($found == 0) { - $found = preg_match("/calendar\/render\/[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,4}\/[0-9]{1,6}\/[0-9]{1,6}\/[0-9]{1,3}\/[0-9]{1,3}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{1}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/.{1,40}/", $url, $matches); - } elseif ($found == 0) { - $found = preg_match("/calendar\/render\/[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,4}\/[0-9]{1,6}\/[0-9]{1,6}\/[0-9]{1,3}\/[0-9]{1,3}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{1}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}/", $url, $matches); - } - - if ($found) { - $matches = explode("/", $matches[0]); - $calendarDesign = new Design(); - switch ($matches[2]) { - case 4: - $calendarType = new Hoch($this->container); - $calendarDesign->setHeight($matches[6]); - - break; - case 8: - $calendarType = new Hochvariable($this->container); - $calendarDesign->setHeight($matches[6]); - - break; - case 7: - default: - $calendarType = new Quer($this->container); - } - - $calendarDesign->setRenderMonth($matches[3]); - $calendarDesign->setStartYear($matches[4]); - $calendarDesign->setWidth($matches[5]); - $calendarDesign->setMonthSize($matches[7]); - $calendarDesign->setDaySize($matches[8]); - $calendarDesign->setMonthColor('#' . $matches[9]); - $calendarDesign->setDayColor('#' . $matches[10]); - $calendarDesign->setSunColor('#' . $matches[11]); - $calendarDesign->setDisplayYear($matches[12]); - $calendarDesign->setDisplayHeightMounthCal($matches[13]); - $calendarDesign->setDisplayMarginCal($matches[14]); - $calendarDesign->setCalendarX($matches[15]); - $calendarDesign->setCalendarY($matches[16]); - $calendarDesign->setYearX($matches[17]); - $calendarDesign->setYearY($matches[18]); - $calendarDesign->setCalendarWidth($matches[19]); - $calendarDesign->setCalendarHeight($matches[20]); - $calendarDesign->setMonthX($matches[21]); - $calendarDesign->setMonthY($matches[22]); - $calendarDesign->setYearSize($matches[23]); - if (isset($matches[24])) { - $calendarDesign->setFontFamily(urldecode($matches[24])); - } - $calendarType->setDesign($calendarDesign); - $calendarGenerator = new Generator(); - $calendarGenerator->setType($calendarType); - $cal = $calendarGenerator->render(); - $svgContent = preg_replace('//', "", $svgContent); - } } - $template = $twig->createTemplate($svgContent); - $svgContent = $template->render(array( - 'row' => $row - )); - file_put_contents("temp/" . $layouter_uuid . '_' . $key . ".svg", $svgContent); - $tempFiles[] = "temp/" . $layouter_uuid . '_' . $key . ".svg"; - $p->begin_page_ext(0, 0, "width=" . $site['width'] . " height=" . $site['height']); - $graphics = $p->load_graphics("auto", "temp/" . $layouter_uuid . '_' . $key . ".svg", ""); - $optlist = "boxsize={" . $site['width'] . " " . $site['height'] . "} position={center} fitmethod=meet"; - if ($p->info_graphics($graphics, "fittingpossible", $optlist) == 1) { - $p->fit_graphics($graphics, 0, 0, $optlist); - } - $p->close_graphics($graphics); - $p->end_layer(); - if ($cal) { - $indocCal = $p->open_pdi_document($cal, ""); - if ($indocCal == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } + $template = $twig->createTemplate($svg); + $svg = $template->render([ + 'row' => $row, + ]); - $pageCal = $p->open_pdi_page($indocCal, 1, ""); - if ($pageCal == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } + $tmpSvg = tempnam(sys_get_temp_dir(), 'svg_') . '.svg'; + $tmpPdf = tempnam(sys_get_temp_dir(), 'pdf_') . '.pdf'; + file_put_contents($tmpSvg, $svg); + $cmd = + 'cairosvg ' . escapeshellarg($tmpSvg) . ' -f pdf -o ' . escapeshellarg($tmpPdf) . ' --unsafe 2>&1'; + exec($cmd, $output, $ret); - $layerCal = $p->define_layer("cal", ""); - $p->begin_layer($layerCal); - $p->fit_pdi_page($pageCal, $dataArray['sites'][$key + 1]['calendar']['x'] + $dataArray['sites'][$key + 1]['trimLeft'], $dataArray['sites'][$key + 1]['trimBottom'] + $site['height'] - $dataArray['sites'][$key + 1]['calendar']['y'] - $dataArray['sites'][$key + 1]['calendar']['height'], ""); - $p->close_pdi_page($pageCal); - $p->end_layer(); - } + unlink($tmpSvg); - $p->end_page_ext(""); break; } } - $p->end_document(""); - foreach ($tempFiles as $file) { - unlink($file); - } - - $im = new \imagick($outfilename . "[0]"); + $im = new \imagick($tmpPdf); $im->thumbnailimage($width, 400, true); - $im->writeimage($outfilename . ".png"); - unlink($outfilename); + $im->writeimage('/data/www/old/public/' . $outfilename . '.png'); + // unlink($outfilename); + unlink($tmpPdf); $response = new Response(); $response->headers->set('Cache-Control', 'private'); - $response->headers->set('Content-type', mime_content_type($outfilename . ".png")); - $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename . ".png") . '"'); - $response->headers->set('Content-length', filesize($outfilename . ".png")); + $response->headers->set('Content-type', mime_content_type('/data/www/old/public/' . $outfilename . '.png')); + $response->headers->set( + 'Content-Disposition', + 'attachment; filename="' . basename('/data/www/old/public/' . $outfilename . '.png') . '"', + ); + $response->headers->set('Content-length', filesize('/data/www/old/public/' . $outfilename . '.png')); $response->sendHeaders(); - $response->setContent(readfile($outfilename . ".png")); + $response->setContent(readfile('/data/www/old/public/' . $outfilename . '.png')); return $response; } @@ -277,7 +197,6 @@ class PdfController extends AbstractController * @param KernelInterface $kernel * @param Environment $twig * @param ToArray $converter - * @param $pdflib_lic * @param $product_uuid * @return JsonResponse * @throws \Exception @@ -290,49 +209,36 @@ class PdfController extends AbstractController KernelInterface $kernel, Environment $twig, ToArray $converter, - $pdflib_lic, - $product_uuid + $product_uuid, ) { $product = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $product_uuid)); + ->getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findOneBy(['uuid' => $product_uuid]); if (!$product) { $dataDesign = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $product_uuid)); + ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata') + ->findOneBy(['uuid' => $product_uuid]); $product = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $dataDesign->getArticleUuid())); + ->getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findOneBy(['uuid' => $dataDesign->getArticleUuid()]); } $parametersAsArray = []; if ($content = $request->getContent()) { $parametersAsArray = json_decode($content, true); } - $data = $parametersAsArray["payload"] ?? array(); - $datatable = $parametersAsArray["datatable"] ?? array(); - $dynamicSize = $parametersAsArray["dynamicSize"] ?? false; - $dynamicSizeWidth = $parametersAsArray["dynamicSizeWidth"] ?? 0; - $dynamicSizeHeight = $parametersAsArray["dynamicSizeHeight"] ?? 0; + $data = $parametersAsArray['payload'] ?? []; + $datatable = $parametersAsArray['datatable'] ?? []; + $dynamicSize = $parametersAsArray['dynamicSize'] ?? false; + $dynamicSizeWidth = $parametersAsArray['dynamicSizeWidth'] ?? 0; + $dynamicSizeHeight = $parametersAsArray['dynamicSizeHeight'] ?? 0; if (empty($datatable)) { - $datatable[] = array(); + $datatable[] = []; } - $p = new \PDFlib(); - $p->set_option("errorpolicy=return"); - $p->set_option("stringformat=utf8"); - if ($pdflib_lic != "") { - @$p->set_parameter("license", $pdflib_lic); - } - $p->set_option("SearchPath=" . $kernel->getProjectDir() . "/assets/fonts"); - $outfilename = "temp/" . uniqid() . ".pdf"; - $optlist = "masterpassword=BoonkerzWichtig1 permissions={" . - "nocopy noaccessible noassemble}"; - if ($p->begin_document($outfilename, $optlist) == 0) { - die("Error: " . $p->get_errmsg()); - } - - $p->set_info("Creator", "PDFlib starter sample"); - $p->set_info("Title", "starter_path"); + $outfilename = 'temp/' . uniqid() . '.pdf'; $dataArray = $converter->fromXml($product); - $tempFiles = array(); + $tempFiles = []; foreach ($datatable as $row) { $pageOpen = false; reset($data); @@ -347,253 +253,68 @@ class PdfController extends AbstractController $site['height'] = $dynamicSizeHeight; } - $svgContent = $site['fabricSVG']; - $xml = simplexml_load_string($svgContent); - $tps = $xml->xpath('//*[string(@templatePrintBinding)]'); - foreach ($tps as $tp) { - $tp->{0} = $tp['templatePrintBinding']; - } - $svgContent = $xml->asXML(); - preg_match_all('/(image|xlink:href)=(")[^">]+/i', $svgContent, $media); - $urls = preg_replace('/(image|xlink:href)("|=")(.*)/i', "$3", $media[0]); + $svg = $site['fabricSVG']; + preg_match_all('/(image|xlink:href)=(")[^">]+/i', $svg, $media); + $urls = preg_replace('/(image|xlink:href)("|=")(.*)/i', '$3', $media[0]); $cal = false; foreach ($urls as $url) { - $matches = array(); - $found = preg_match("/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/", $url, $matches); + $matches = []; + $found = preg_match( + '/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', + $url, + $matches, + ); if ($found == 0) { - $found = preg_match("/[a-fA-F0-9]{4}-[a-fA-F0-9]{8}-[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{8}/", $url, $matches); + $found = preg_match( + '/[a-fA-F0-9]{4}-[a-fA-F0-9]{8}-[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{8}/', + $url, + $matches, + ); } if ($found == 0) { $found = preg_match("/\/[a-fA-F0-9]{24}/", $url, $matches); if (isset($matches[0])) { - $matches[0] = str_replace("/", "", $matches[0]); + $matches[0] = str_replace('/', '', $matches[0]); } } if ($found) { - $motiv = $documentManager - ->getRepository(Motiv::class) - ->find($matches[0]); + $motiv = $documentManager->getRepository(Motiv::class)->find($matches[0]); if (!$motiv) { $motiv = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv')->findOneByUuid($matches[0]); + ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv') + ->findOneByUuid($matches[0]); } if ($motiv) { - $svgContent = str_replace($url, "../market/motive/" . $motiv->getFileMid(), $svgContent); + $svg = str_replace($url, '/data/www/old/market/motive/' . $motiv->getFileMid(), $svg); } continue; } - - if ($found == 0) { - $found = preg_match("/calendar\/render\/[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,4}\/[0-9]{1,6}\/[0-9]{1,6}\/[0-9]{1,3}\/[0-9]{1,3}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{1}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/.{1,40}/", $url, $matches); - } elseif ($found == 0) { - $found = preg_match("/calendar\/render\/[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,4}\/[0-9]{1,6}\/[0-9]{1,6}\/[0-9]{1,3}\/[0-9]{1,3}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{1}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}/", $url, $matches); - } - - if ($found) { - $matches = explode("/", $matches[0]); - $calendarDesign = new Design(); - switch ($matches[2]) { - case 4: - $calendarType = new Hoch($this->container); - $calendarDesign->setHeight($matches[6]); - - break; - case 8: - $calendarType = new Hochvariable($this->container); - $calendarDesign->setHeight($matches[6]); - - break; - case 7: - default: - $calendarType = new Quer($this->container); - } - - $calendarDesign->setRenderMonth($matches[3]); - $calendarDesign->setStartYear($matches[4]); - $calendarDesign->setWidth($matches[5]); - $calendarDesign->setMonthSize($matches[7]); - $calendarDesign->setDaySize($matches[8]); - $calendarDesign->setMonthColor('#' . $matches[9]); - $calendarDesign->setDayColor('#' . $matches[10]); - $calendarDesign->setSunColor('#' . $matches[11]); - $calendarDesign->setDisplayYear($matches[12]); - $calendarDesign->setDisplayHeightMounthCal($matches[13]); - $calendarDesign->setDisplayMarginCal($matches[14]); - $calendarDesign->setCalendarX($matches[15]); - $calendarDesign->setCalendarY($matches[16]); - $calendarDesign->setYearX($matches[17]); - $calendarDesign->setYearY($matches[18]); - $calendarDesign->setCalendarWidth($matches[19]); - $calendarDesign->setCalendarHeight($matches[20]); - $calendarDesign->setMonthX($matches[21]); - $calendarDesign->setMonthY($matches[22]); - $calendarDesign->setYearSize($matches[23]); - if (isset($matches[24])) { - $calendarDesign->setFontFamily(urldecode($matches[24])); - } - $calendarType->setDesign($calendarDesign); - $calendarGenerator = new Generator(); - $calendarGenerator->setType($calendarType); - $cal = $calendarGenerator->render(); - $svgContent = preg_replace('//', "", $svgContent); - } } - $template = $twig->createTemplate($svgContent); - $svgContent = $template->render(array( - 'row' => $row - )); - file_put_contents("temp/" . $id . ".svg", $svgContent); - $tempFiles[] = "temp/" . $id . ".svg"; - $width = $site['width'] + $dataArray['sites'][$key + 1]['trimLeft'] + $dataArray['sites'][$key + 1]['trimRight']; - $height = $site['height'] + $dataArray['sites'][$key + 1]['trimTop'] + $dataArray['sites'][$key + 1]['trimBottom']; - if (isset($dataArray['pdfPrintMerge']['sites']) && $key == 0) { - $p->begin_page_ext(0, 0, "width=" . $dataArray['pdfPrintMerge']['width'] . " height=" . $dataArray['pdfPrintMerge']['height']); - $pageOpen = true; - } elseif (isset($dataArray['pdfPrintMerge']['sites']) && $key > 0 && in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) { - } else { - $p->begin_page_ext(0, 0, "width=" . $site['width'] . " height=" . $site['height']); - $pageOpen = true; - } + $template = $twig->createTemplate($svg); + $svg = $template->render([ + 'row' => $row, + ]); + $tmpSvg = tempnam(sys_get_temp_dir(), 'svg_') . '.svg'; + $tmpPdf = tempnam(sys_get_temp_dir(), 'pdf_') . '.pdf'; + file_put_contents($tmpSvg, $svg); + $cmd = + 'cairosvg ' . escapeshellarg($tmpSvg) . ' -f pdf -o ' . escapeshellarg($tmpPdf) . ' --unsafe 2>&1'; + exec($cmd, $output, $ret); + unlink($tmpSvg); - $graphics = $p->load_graphics("auto", "temp/" . $id . ".svg", ""); - $optlist = "boxsize={" . $width . " " . $height . "} position={top left} fitmethod=meet"; - if ($p->info_graphics($graphics, "fittingpossible", $optlist) == 1) { - if (isset($dataArray['pdfPrintMerge']['sites']) && in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) { - $p->fit_graphics($graphics, $dataArray['sites'][$key + 1]['mergePosX'], $dataArray['sites'][$key + 1]['mergePosY'], $optlist); - } else { - $p->fit_graphics($graphics, $dataArray['sites'][$key + 1]['trimLeft'] * -1, $dataArray['sites'][$key + 1]['trimTop'] * -1, $optlist); - } - } - - $p->close_graphics($graphics); - $p->end_layer(); - if ($cal) { - $indocCal = $p->open_pdi_document($cal, ""); - if ($indocCal == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $pageCal = $p->open_pdi_page($indocCal, 1, ""); - if ($pageCal == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $layerCal = $p->define_layer("cal", ""); - $p->begin_layer($layerCal); - $p->fit_pdi_page($pageCal, $dataArray['sites'][$key + 1]['calendar']['x'], $site['height'] - $dataArray['sites'][$key + 1]['calendar']['y'] - $dataArray['sites'][$key + 1]['calendar']['height'], ""); - $p->close_pdi_page($pageCal); - $p->end_layer(); - } - - if ($dataArray['sites'][$key + 1]['elements']) { - foreach ($dataArray['sites'][$key + 1]['elements'] as $element) { - if ($element['type'] == "stanze") { - $stanze = $documentManager - ->getRepository(Motiv::class) - ->find($element['value']); - if (!$stanze) { - $stanze = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv')->findOneByUuid($element['value']); - } - - $indocStanze = $p->open_pdi_document($kernel->getProjectDir() . "/web/market/motive/" . $stanze->getFileOrginal(), ""); - if ($indocStanze == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $pageStanze = $p->open_pdi_page($indocStanze, 1, ""); - if ($pageStanze == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $layerStanze = $p->define_layer("stanze", ""); - $p->begin_layer($layerStanze); - /* Place the imported page on the German layer of the output page */ - if (isset($dataArray['pdfPrintMerge']['sites']) && in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) { - $p->fit_pdi_page($pageStanze, $dataArray['sites'][$key + 1]['mergePosX'] + $element['x'], $dataArray['sites'][$key + 1]['mergePosY'] + $element['y'], ""); - } else { - $p->fit_pdi_page($pageStanze, 0, 0, ""); - } - - $p->close_pdi_page($pageStanze); - $p->end_layer(); - } - } - } - - if ($dataArray['sites'][$key + 1]['elements']) { - foreach ($dataArray['sites'][$key + 1]['elements'] as $element) { - if ($element['type'] == "barcode") { - $barcodefont = $p->load_font("fre3of9x", "unicode", "embedding"); - if ($barcodefont == 0) { - throw new Exception("Error: " . $p->get_errmsg()); - } - - if (isset($dataArray['pdfPrintMerge']['sites']) && in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) { - $p->fit_textline("*ABC123*", $dataArray['sites'][$key + 1]['mergePosX'] + $element['x'], $dataArray['sites'][$key + 1]['mergePosY'] + $element['y'], "font=" . $barcodefont . - " rotate=90 fontsize=" . $element['fontSize']); - $font = $p->load_font("Verdana", "unicode", ""); - $p->fit_textline("2432342423423424", $dataArray['sites'][$key + 1]['mergePosX'] + $element['x'] + 10, $dataArray['sites'][$key + 1]['mergePosY'] + $element['y'], "font=" . $font . - " rotate=90 fontsize=10"); - } else { - $p->fit_textline("*ABC123*", $element['x'], $element['y'], "font=" . $barcodefont . - " rotate=90 fontsize=" . $element['fontSize']); - } - } - } - } - - - $font = $p->load_font("Verdana", "unicode", ""); - $p->fit_textline("---MUSTER---", 0, 0, "font=" . $font . - " fontsize=1 textrendering=1 boxsize={" . $site['width'] . " " . $site['height'] . "} stamp=ul2lr" . - " strokecolor=red strokewidth=1"); - if (!$dataArray['pdfPrintMerge']) { - $p->end_page_ext(""); - $pageOpen = false; - } elseif (isset($dataArray['pdfPrintMerge']['sites']) && $key > 0 && !in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) { - $p->end_page_ext(""); - $pageOpen = false; - } - } - - if ($pageOpen) { - if (isset($dataArray['pdfPrintMerge']['stanze'])) { - $stanze = $documentManager - ->getRepository(Motiv::class) - ->find((string)$dataArray['pdfPrintMerge']['stanze']); - if (!$stanze) { - $stanze = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv')->findOneByUuid((string)$dataArray['pdfPrintMerge']['stanze']); - } - - $indocStanze = $p->open_pdi_document($kernel->getProjectDir() . "/web/market/motive/" . $stanze->getFileOrginal(), ""); - if ($indocStanze == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $pageStanze = $p->open_pdi_page($indocStanze, 1, ""); - if ($pageStanze == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $layerStanze = $p->define_layer("stanze", ""); - $p->begin_layer($layerStanze); -/* Place the imported page on the German layer of the output page */ - $p->fit_pdi_page($pageStanze, 0, 0, ""); - $p->close_pdi_page($pageStanze); - $p->end_layer(); - } - - $p->end_page_ext(""); + $tempFiles[] = $tmpPdf; } } - $p->end_document(""); + $allPdfs = implode(' ', array_map('escapeshellarg', $tempFiles)); + + $cmd = 'pdfunite ' . $allPdfs . ' /data/www/old/public/' . escapeshellarg($outfilename) . ' 2>&1'; + exec($cmd, $out, $ret); + foreach ($tempFiles as $file) { unlink($file); } @@ -601,11 +322,13 @@ class PdfController extends AbstractController $json = new JsonResponse(); $json->headers->set('Access-Control-Allow-Origin', '*'); $json->headers->set('Access-Control-Allow-Headers', 'X-Requested-With'); - $json->setContent(json_encode(array('success' => true, 'file' => $request->getBasePath() . '/' . $outfilename))); + $json->setContent(json_encode([ + 'success' => true, + 'file' => $request->getBasePath() . '/' . $outfilename, + ])); return $json; } - /** * Pdf Preview * @@ -613,16 +336,14 @@ class PdfController extends AbstractController * @return void */ #[Route(path: '/component/steplayouter/pdf/check/{layouter_uuid}', name: 'component_steplayouter_pdf_check')] - public function pdfCheckAction( - Request $request, - EntityManagerInterface $entityManager, - $layouter_uuid - ) { + public function pdfCheckAction(Request $request, EntityManagerInterface $entityManager, $layouter_uuid) + { $layoutData = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouter_uuid)); - $data = array('success' => true, 'found' => false); + ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata') + ->findOneBy(['uuid' => $layouter_uuid]); + $data = ['success' => true, 'found' => false]; if ($layoutData) { - $data = array('success' => true, 'found' => true); + $data = ['success' => true, 'found' => true]; } $jsonResponse = new JsonResponse(); @@ -636,10 +357,13 @@ class PdfController extends AbstractController * * @return RedirectResponse */ - #[Route(path: '/component/steplayouter/pdf/print/{layouter_uuid}/{alias}', name: 'component_steplayouter_pdf_print')] + #[Route( + path: '/component/steplayouter/pdf/print/{layouter_uuid}/{alias}', + name: 'component_steplayouter_pdf_print', + )] public function pdfAction(Request $request, Pdf $pdfService, $layouter_uuid, $alias) { - $outfilename = "temp/" . uniqid() . ".pdf"; + $outfilename = 'temp/' . uniqid() . '.pdf'; $pdfService->create($outfilename, $layouter_uuid, $alias); return $this->redirect($request->getBasePath() . '/' . $outfilename); } diff --git a/src/new/src/PSC/Component/SteplayouterBundle/Resources/config/services.yml b/src/new/src/PSC/Component/SteplayouterBundle/Resources/config/services.yml index bdca44c46..654d69ae1 100755 --- a/src/new/src/PSC/Component/SteplayouterBundle/Resources/config/services.yml +++ b/src/new/src/PSC/Component/SteplayouterBundle/Resources/config/services.yml @@ -2,8 +2,6 @@ services: _defaults: autowire: true autoconfigure: true - bind: - $pdflib_lic: 'L900202-010091-135115-PPD3D2-EHE432' PSC\Component\SteplayouterBundle\: resource: '../../*/*' @@ -15,27 +13,3 @@ services: PSC\Component\SteplayouterBundle\Queue\Render: tags: - { name: queues } - -# tp.component.steplayouter.upload_listener: -# class: PSC\Component\SteplayouterBundle\EventListener\PostUploadListener -# tags: -# - { name: kernel.event_listener, event: oneup_uploader.post_upload, method: postUpload } -# arguments: ['@doctrine'] -# -# psc.component.steplayouter.calendargenerator: -# class: PSC\Component\SteplayouterBundle\Calendar\Generator -# arguments: ['@service_container'] -# -# psc.component.steplayouter.configure_menu_listener: -# class: PSC\Component\SteplayouterBundle\EventListener\ConfigureMenuListener -# tags: -# - { name: kernel.event_listener, event: psc.backend.system, method: onMenuConfigureSystem } -# -# psc.component.steplayouter.pdf: -# class: PSC\Component\SteplayouterBundle\Service\Pdf -# arguments: ['@doctrine.orm.entity_manager', '%pdflib_lic%', '@kernel', '@psc.component.steplayouter.converter.toArray', '@doctrine_mongodb', '@service_container'] -# -# psc.component.steplayouter.converter.toArray: -# class: PSC\Component\SteplayouterBundle\Config\Converter\ToArray -# arguments: ['@PSC\\System\\SettingsBundle\\Service\\Color', '@security.authorization_checker', '@security.token_storage', '@doctrine_mongodb'] -# diff --git a/src/new/src/PSC/Component/SteplayouterBundle/Service/Pdf.php b/src/new/src/PSC/Component/SteplayouterBundle/Service/Pdf.php index e0c859053..1fd3d85fd 100755 --- a/src/new/src/PSC/Component/SteplayouterBundle/Service/Pdf.php +++ b/src/new/src/PSC/Component/SteplayouterBundle/Service/Pdf.php @@ -24,28 +24,31 @@ use Twig\Environment; class Pdf { protected $entityManager; - protected $pdf_lic; protected $kernel; protected $mongoDb; protected $converter; protected $twig; - public function __construct(EntityManagerInterface $em, $pdflib_lic, KernelInterface $kernel, ToArray $converter, DocumentManager $mongoDb, Environment $twig) - { + public function __construct( + EntityManagerInterface $em, + KernelInterface $kernel, + ToArray $converter, + DocumentManager $mongoDb, + Environment $twig, + ) { $this->entityManager = $em; - $this->pdf_lic = $pdflib_lic; $this->kernel = $kernel; $this->converter = $converter; $this->mongoDb = $mongoDb; $this->twig = $twig; } - public function create($outfilename, $layouter_uuid, $alias = "") + public function create($outfilename, $layouter_uuid, $alias = '') { - /** @var Layoutdesigndata $layoutData */ $layoutData = $this->entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouter_uuid)); + ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata') + ->findOneBy(['uuid' => $layouter_uuid]); if (!$layoutData) { return; @@ -58,32 +61,16 @@ class Pdf $dynamicSizeHeight = $layoutData->getDynamicHeight(); if (empty($datatable)) { - $datatable[] = array(); + $datatable[] = []; } $product = $this->entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $layoutData->getArticleUuid())); - - $p = new \PDFlib(); - $p->set_option("errorpolicy=return"); - $p->set_option("stringformat=utf8"); - if ($this->pdf_lic && $this->pdf_lic != "") { - @$p->set_parameter("license", $this->pdf_lic); - } - $p->set_option("SearchPath=" . $this->kernel->getProjectDir() . "/assets/fonts"); - - - - if ($p->begin_document($outfilename, "") == 0) { - die("Error: " . $p->get_errmsg()); - } - - $p->set_info("Creator", "PDFlib starter sample"); - $p->set_info("Title", "starter_path"); + ->getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findOneBy(['uuid' => $layoutData->getArticleUuid()]); $dataArray = $this->converter->fromXml($product); - $tempFiles = array(); + $tempFiles = []; foreach ($datatable as $row) { $pageOpen = false; @@ -94,306 +81,75 @@ class Pdf continue; } - $svgContent = $this->utf8_for_xml($site['fabricSVG']); + $svg = $this->utf8_for_xml($site['fabricSVG']); if ($dynamicSize) { $site['width'] = $dynamicSizeWidth; $site['height'] = $dynamicSizeHeight; } - $xml = simplexml_load_string($svgContent); - $tps = $xml->xpath('//*[string(@templatePrintBinding)]'); - - foreach ($tps as $tp) { - $tp->{0} = $tp['templatePrintBinding']; - } - $svgContent = $xml->asXML(); - preg_match_all('/(image|xlink:href)=(")[^">]+/i', $svgContent, $media); - $urls = preg_replace('/(image|xlink:href)("|=")(.*)/i', "$3", $media[0]); + preg_match_all('/(image|xlink:href)=(")[^">]+/i', $svg, $media); + $urls = preg_replace('/(image|xlink:href)("|=")(.*)/i', '$3', $media[0]); $cal = false; foreach ($urls as $url) { - $matches = array(); + $matches = []; - $found = preg_match("/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/", $url, $matches); + $found = preg_match( + '/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/', + $url, + $matches, + ); if ($found == 0) { - $found = preg_match("/[a-fA-F0-9]{4}-[a-fA-F0-9]{8}-[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{8}/", $url, $matches); + $found = preg_match( + '/[a-fA-F0-9]{4}-[a-fA-F0-9]{8}-[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{8}/', + $url, + $matches, + ); } if ($found == 0) { $found = preg_match("/\/[a-fA-F0-9]{24}/", $url, $matches); if (isset($matches[0])) { - $matches[0] = str_replace("/", "", $matches[0]); + $matches[0] = str_replace('/', '', $matches[0]); } } if ($found) { - $motiv = $this->mongoDb - ->getRepository(Motiv::class) - ->find($matches[0]); + $motiv = $this->mongoDb->getRepository(Motiv::class)->find($matches[0]); if (!$motiv) { $motiv = $this->entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv')->findOneByUuid($matches[0]); + ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv') + ->findOneByUuid($matches[0]); } if ($motiv) { - $svgContent = str_replace($url, "../market/motive/" . $motiv->getFileOrginal(), $svgContent); + $svg = str_replace($url, '/data/www/old/market/motive/' . $motiv->getFileOrginal(), $svg); } continue; } - if ($found == 0) { - $found = preg_match("/calendar\/render\/[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,4}\/[0-9]{1,6}\/[0-9]{1,6}\/[0-9]{1,3}\/[0-9]{1,3}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{1}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/.{1,40}/", $url, $matches); - } elseif ($found == 0) { - $found = preg_match("/calendar\/render\/[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,4}\/[0-9]{1,6}\/[0-9]{1,6}\/[0-9]{1,3}\/[0-9]{1,3}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{6}\/[a-fA-F0-9]{1}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}\/[0-9]{1,3}/", $url, $matches); - } - - if ($found) { - $matches = explode("/", $matches[0]); - - $calendarDesign = new Design(); - - switch ($matches[2]) { - case 4: - $calendarType = new Hoch($this->container); - $calendarDesign->setHeight($matches[6]); - break; - case 8: - $calendarType = new Hochvariable($this->container); - $calendarDesign->setHeight($matches[6]); - break; - case 7: - default: - $calendarType = new Quer($this->container); - } - - $calendarDesign->setRenderMonth($matches[3]); - $calendarDesign->setStartYear($matches[4]); - $calendarDesign->setWidth($matches[5]); - $calendarDesign->setMonthSize($matches[7]); - $calendarDesign->setDaySize($matches[8]); - $calendarDesign->setMonthColor('#' . $matches[9]); - $calendarDesign->setDayColor('#' . $matches[10]); - $calendarDesign->setSunColor('#' . $matches[11]); - $calendarDesign->setDisplayYear($matches[12]); - $calendarDesign->setDisplayHeightMounthCal($matches[13]); - $calendarDesign->setDisplayMarginCal($matches[14]); - $calendarDesign->setCalendarX($matches[15]); - $calendarDesign->setCalendarY($matches[16]); - $calendarDesign->setYearX($matches[17]); - $calendarDesign->setYearY($matches[18]); - $calendarDesign->setCalendarWidth($matches[19]); - $calendarDesign->setCalendarHeight($matches[20]); - $calendarDesign->setMonthX($matches[21]); - $calendarDesign->setMonthY($matches[22]); - $calendarDesign->setYearSize($matches[23]); - if (isset($matches[24])) { - $calendarDesign->setFontFamily(urldecode($matches[24])); - } - $calendarType->setDesign($calendarDesign); - $calendarGenerator = new Generator(); - $calendarGenerator->setType($calendarType); - $cal = $calendarGenerator->render(); - - //$svgContent = preg_replace('//', $cal, $svgContent); - $svgContent = str_replace($url, $cal, $svgContent); - } } - $template = $this->twig->createTemplate($svgContent); - $svgContent = $template->render(array( - 'row' => $row - )); - file_put_contents($this->kernel->getProjectDir() . "/web/temp/" . $layouter_uuid . '_' . $key . ".svg", $svgContent); + $template = $this->twig->createTemplate($svg); + $svg = $template->render([ + 'row' => $row, + ]); + $tmpSvg = tempnam(sys_get_temp_dir(), 'svg_') . '.svg'; + $tmpPdf = tempnam(sys_get_temp_dir(), 'pdf_') . '.pdf'; + file_put_contents($tmpSvg, $svg); + $cmd = + 'cairosvg ' . escapeshellarg($tmpSvg) . ' -f pdf -o ' . escapeshellarg($tmpPdf) . ' --unsafe 2>&1'; + exec($cmd, $output, $ret); - $width = $site['width'] + $dataArray['sites'][$key + 1]['trimLeft'] + $dataArray['sites'][$key + 1]['trimRight']; - $height = $site['height'] + $dataArray['sites'][$key + 1]['trimTop'] + $dataArray['sites'][$key + 1]['trimBottom']; + unlink($tmpSvg); - if (isset($dataArray['pdfPrintMerge']['sites']) && $key == 0) { - $p->begin_page_ext(0, 0, "width=" . $dataArray['pdfPrintMerge']['width'] . " height=" . $dataArray['pdfPrintMerge']['height']); - $pageOpen = true; - } elseif (isset($dataArray['pdfPrintMerge']['sites']) && $key > 0 && in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) { - } else { - $p->begin_page_ext(0, 0, "width=" . $width . " height=" . $height . " trimbox={" . $dataArray['sites'][$key + 1]['trimLeft'] . " " - . $dataArray['sites'][$key + 1]['trimTop'] . " " . ($site['width'] + $dataArray['sites'][$key + 1]['trimLeft']) . " " . ($site['height'] + $dataArray['sites'][$key + 1]['trimTop']) . "}"); - $pageOpen = true; - } - - $graphics = $p->load_graphics("auto", $this->kernel->getProjectDir() . "/web/temp/" . $layouter_uuid . '_' . $key . ".svg", ""); - - $optlist = "boxsize={" . $width . " " . $height . "} position={top left} fitmethod=meet"; - - if ($p->info_graphics($graphics, "fittingpossible", $optlist) == 1) { - if (isset($dataArray['pdfPrintMerge']['sites']) && in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) { - if ($dataArray['sites'][$key + 1]['clipBox']) { - $clipBox = explode(" ", $dataArray['sites'][$key + 1]['clipBox']); - $p->save(); - $p->rect($dataArray['sites'][$key + 1]['mergePosX'] + $clipBox[0], $dataArray['sites'][$key + 1]['mergePosY'] + $clipBox[1], $clipBox[2], $clipBox[3]); - $p->clip(); - } - $p->fit_graphics($graphics, $dataArray['sites'][$key + 1]['mergePosX'], $dataArray['sites'][$key + 1]['mergePosY'], $optlist); - if ($dataArray['sites'][$key + 1]['clipBox']) { - $p->restore(); - } - } else { - $p->fit_graphics($graphics, 0, 0, $optlist); - } - } - $p->close_graphics($graphics); - $p->end_layer(); - - if ($cal) { - $indocCal = $p->open_pdi_document($cal, ""); - if ($indocCal == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $pageCal = $p->open_pdi_page($indocCal, 1, ""); - if ($pageCal == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $layerCal = $p->define_layer("cal", ""); - $p->begin_layer($layerCal); - - $p->fit_pdi_page($pageCal, $dataArray['sites'][$key + 1]['calendar']['x'] + $dataArray['sites'][$key + 1]['trimLeft'], $dataArray['sites'][$key + 1]['trimBottom'] + $site['height'] - $dataArray['sites'][$key + 1]['calendar']['y'] - $dataArray['sites'][$key + 1]['calendar']['height'], ""); - - $p->close_pdi_page($pageCal); - - $p->end_layer(); - } - - if ($dataArray['sites'][$key + 1]['elements']) { - foreach ($dataArray['sites'][$key + 1]['elements'] as $element) { - if ($element['type'] == "stanze") { - $stanze = $this->mongoDb - ->getRepository(Motiv::class) - ->find($element['value']); - - if (!$stanze) { - $stanze = $this->entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv')->findOneByUuid($element['value']); - } - - $indocStanze = $p->open_pdi_document($this->kernel->getProjectDir() . "/web/market/motive/" . $stanze->getFileOrginal(), ""); - if ($indocStanze == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $pageStanze = $p->open_pdi_page($indocStanze, 1, ""); - if ($pageStanze == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $layerStanze = $p->define_layer("stanze", ""); - $p->begin_layer($layerStanze); - - /* Place the imported page on the German layer of the output page */ - if (isset($dataArray['pdfPrintMerge']['sites']) && in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) { - $p->fit_pdi_page($pageStanze, $dataArray['sites'][$key + 1]['mergePosX'] + $element['x'], $dataArray['sites'][$key + 1]['mergePosY'] + $element['y'], ""); - } else { - $p->fit_pdi_page($pageStanze, 0, 0, ""); - } - - $p->close_pdi_page($pageStanze); - - $p->end_layer(); - } - } - } - - if ($dataArray['sites'][$key + 1]['elements']) { - foreach ($dataArray['sites'][$key + 1]['elements'] as $element) { - if ($element['type'] == "barcode") { - $barcodefont = $p->load_font("fre3of9x", "unicode", "embedding"); - $font = $p->load_font("Verdana", "unicode", ""); - if ($barcodefont == 0) { - throw new Exception("Error: " . $p->get_errmsg()); - } - - if (isset($dataArray['pdfPrintMerge']['sites']) && in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) { - $p->fit_textline($alias, $dataArray['sites'][$key + 1]['mergePosX'] + $element['x'], $dataArray['sites'][$key + 1]['mergePosY'] + $element['y'], "font=" . $barcodefont . - " rotate=90 fontsize=" . $element['fontSize']); - $p->fit_textline($alias, $dataArray['sites'][$key + 1]['mergePosX'] + $element['x'] + 10, $dataArray['sites'][$key + 1]['mergePosY'] + $element['y'], "font=" . $font . - " rotate=90 fontsize=10"); - } else { - $p->fit_textline($alias, $element['x'], $element['y'], "font=" . $barcodefont . - " rotate=" . $element['rotate'] . " fontsize=" . $element['fontSize'] . " " . - "fillcolor={black 1} " . - "matchbox={fillcolor={white 1} " . - "boxheight={ascender descender} " . - "offsetleft=-8 offsetright=8 offsettop=8 offsetbottom=-12}"); - if (isset($element['addTextX'])) { - $p->fit_textline($alias, $element['x'], $element['y'] - 12, "font=" . $font . - " rotate=" . $element['rotate'] . " fontsize=10 " . - "fillcolor={black 1} " . - "matchbox={fillcolor={white 1} " . - "boxheight={ascender descender} " . - "offsetleft=-8 offsetright=8 offsettop=0 offsetbottom=0}"); - $p->fit_textline($element['addText'], $element['addTextX'], $element['addTextY'], "font=" . $font . - " rotate=" . $element['rotate'] . " fontsize=10 " . - "fillcolor={black 1} " . - "matchbox={fillcolor={white 1} " . - "boxheight={ascender descender} " . - "offsetleft=-8 offsetright=8 offsettop=0 offsetbottom=0}"); - } else { - $p->fit_textline($alias . $element['addText'], $element['x'], $element['y'] - 12, "font=" . $font . - " rotate=" . $element['rotate'] . " fontsize=10 " . - "fillcolor={black 1} " . - "matchbox={fillcolor={white 1} " . - "boxheight={ascender descender} " . - "offsetleft=-8 offsetright=8 offsettop=0 offsetbottom=0}"); - } - } - } - } - } - - if (!$dataArray['pdfPrintMerge']) { - $p->end_page_ext(""); - $pageOpen = false; - } elseif (isset($dataArray['pdfPrintMerge']['sites']) && $key > 0 && !in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) { - $p->end_page_ext(""); - $pageOpen = false; - } - } - - if ($pageOpen) { - if (isset($dataArray['pdfPrintMerge']['stanze'])) { - $stanze = $this->mongoDb - ->getRepository(Motiv::class) - ->find((string)$dataArray['pdfPrintMerge']['stanze']); - - if (!$stanze) { - $stanze = $this->entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv')->findOneByUuid((string)$dataArray['pdfPrintMerge']['stanze']); - } - - $indocStanze = $p->open_pdi_document($this->kernel->getProjectDir() . "/web/market/motive/" . $stanze->getFileOrginal(), ""); - if ($indocStanze == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $pageStanze = $p->open_pdi_page($indocStanze, 1, ""); - if ($pageStanze == 0) { - throw new \Exception("Error: " . $p->get_errmsg()); - } - - $layerStanze = $p->define_layer("stanze", ""); - $p->begin_layer($layerStanze); - - /* Place the imported page on the German layer of the output page */ - $p->fit_pdi_page($pageStanze, 0, 0, ""); - - $p->close_pdi_page($pageStanze); - - $p->end_layer(); - } - - $p->end_page_ext(""); + $tempFiles[] = $tmpPdf; } } - $p->end_document(""); + $allPdfs = implode(' ', array_map('escapeshellarg', $tempFiles)); + $cmd = 'pdfunite ' . $allPdfs . ' ' . escapeshellarg($outfilename) . ' 2>&1'; + exec($cmd, $out, $ret); foreach ($tempFiles as $file) { unlink($file); diff --git a/src/new/src/PSC/Shop/OrderBundle/Resources/views/backend/list/index.html.twig b/src/new/src/PSC/Shop/OrderBundle/Resources/views/backend/list/index.html.twig index 16130a1d5..7e93108b7 100755 --- a/src/new/src/PSC/Shop/OrderBundle/Resources/views/backend/list/index.html.twig +++ b/src/new/src/PSC/Shop/OrderBundle/Resources/views/backend/list/index.html.twig @@ -1,4 +1,5 @@ {% extends 'backend_tailwind_base.html.twig' %} +{% form_theme form 'tailwind_formtheme.html.twig' %} {% trans_default_domain 'core_order_list' %} {% block header %} @@ -31,7 +32,6 @@ Filtern nach Auftragsstatus (Positionsstatus wird nicht berücksichtigt): {{ form_widget(form.status, {attr: { - class: 'w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-psc-500 focus:border-psc-500 transition-all text-sm' }}) }}
@@ -123,9 +123,14 @@ - @@ -166,4 +171,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/new/src/PSC/Shop/ProductBundle/Transformer/Product.php b/src/new/src/PSC/Shop/ProductBundle/Transformer/Product.php index 9fd44df3a..143143e24 100755 --- a/src/new/src/PSC/Shop/ProductBundle/Transformer/Product.php +++ b/src/new/src/PSC/Shop/ProductBundle/Transformer/Product.php @@ -43,7 +43,12 @@ readonly class Product $product->setUid($productEntity->getUID()); $product->setTitle($productEntity->getTitle()); $product->setUuid($productEntity->getUUID()); - $product->setLanguage($productEntity->getLanguage()); + if ($productEntity->getLanguage() == null) { + $product->setLanguage('all'); + } else { + $product->setLanguage($productEntity->getLanguage()); + } + $product->setLangData($productEntity->getLangData()); $product->setTextArt((string) $productEntity->getTextArt()); $product->setPrice((int) $productEntity->getPrice()); diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251202130922.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251202130922.php index cfde61c87..d10a5cc52 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251202130922.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251202130922.php @@ -6,6 +6,7 @@ class Version20251202130922 extends Base { public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY sor int(4) null;"); + $this->entityManager->getConnection()->exec("update cms set sor = 1 where sor = '';"); + $this->entityManager->getConnection()->exec('ALTER TABLE cms MODIFY sor int(4) null;'); } } diff --git a/src/new/templates/tailwind_formtheme.html.twig b/src/new/templates/tailwind_formtheme.html.twig index 1072aa6f2..0460965c9 100644 --- a/src/new/templates/tailwind_formtheme.html.twig +++ b/src/new/templates/tailwind_formtheme.html.twig @@ -57,9 +57,10 @@ {% set required = false %} {%- endif -%} {% if multiple %} -
-
- {%- set options = choices -%} {% for group_label, choice in options %} {%- if choice is iterable -%} @@ -76,15 +77,32 @@
-
- - - - +
+ + + +
-
- {% for group_label, choice in options %} {%- if choice is iterable -%} diff --git a/src/new/tests/mariadb.sql b/src/new/tests/mariadb.sql index c115f67d6..5c5f31d84 100644 --- a/src/new/tests/mariadb.sql +++ b/src/new/tests/mariadb.sql @@ -306,7 +306,7 @@ CREATE TABLE `article` ( `a4_auflagen` text DEFAULT NULL, `a4_sponsoring` int(1) DEFAULT NULL, `a4_prodzeit` varchar(255) DEFAULT NULL, - `a4_abpreis` float(8,2) DEFAULT 0.00, + `a4_abpreis` varchar(10) DEFAULT NULL, `a5_buy` int(1) DEFAULT NULL, `a5_xml` text DEFAULT NULL, `layouterid` varchar(255) DEFAULT NULL, diff --git a/src/new/tests/mysql.sql b/src/new/tests/mysql.sql index bd37b641f..ff37969c1 100644 --- a/src/new/tests/mysql.sql +++ b/src/new/tests/mysql.sql @@ -305,7 +305,7 @@ CREATE TABLE `article` ( `a4_auflagen` text DEFAULT NULL, `a4_sponsoring` int(1) DEFAULT NULL, `a4_prodzeit` varchar(255) DEFAULT NULL, - `a4_abpreis` float(20,2) DEFAULT NULL, + `a4_abpreis` varchar(20) DEFAULT NULL, `a5_buy` int(1) DEFAULT NULL, `a5_xml` text DEFAULT NULL, `layouterid` varchar(255) NOT NULL, diff --git a/src/new/var/plugins/Custom/Krueger/Artikelimport/Document/Import.php b/src/new/var/plugins/Custom/Krueger/Artikelimport/Document/Import.php index 0d668da6a..82f79804f 100755 --- a/src/new/var/plugins/Custom/Krueger/Artikelimport/Document/Import.php +++ b/src/new/var/plugins/Custom/Krueger/Artikelimport/Document/Import.php @@ -1,31 +1,20 @@ shop = $shop; } +} - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/Artikelimport/Queue/Import.php b/src/new/var/plugins/Custom/Krueger/Artikelimport/Queue/Import.php index be6654571..2fa724521 100755 --- a/src/new/var/plugins/Custom/Krueger/Artikelimport/Queue/Import.php +++ b/src/new/var/plugins/Custom/Krueger/Artikelimport/Queue/Import.php @@ -832,11 +832,13 @@ if($variMaterialNo == "3200 S") } } $produktchecknoActive = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findBy(array('shop' => $selectedShop)); - +$exportProdukte = []; foreach($produktchecknoActive as $produktchecknoActive) { //\dump($produktchecknoActive->getUid()); if($produktchecknoActive->getMetaKeywords() == "1") { $produktchecknoActive->setEnable(true); + $exportProdukte[] = $produkt; + $this->generateGoogleMerchantXml($xml, $queueSettings->getShop(), $exportProdukte); } else { $produktchecknoActive->setEnable(NULL); } @@ -888,4 +890,123 @@ $this->_entityManager->clear(); return $number[0].".".substr($number[1].str_repeat("0", $decimals), 0, $decimals); } } + +private function generateGoogleMerchantXml($xml, $shopId, $produktchecknoActive) +{ + $outputFile = '/data/www/old/data/packages/import/google_merchants.xml'; + $baseImageUrl = 'https://www.krueger-scheiben.de/styles/vorlagen/kdv_b3_dev/product_images/'; + $placeholderImg = 'placeholder.jpg'; + $baseProductUrl = 'https://www.krueger-scheiben.de/article/show/'; + $currency = 'EUR'; + + $rssDom = new \DOMDocument('1.0', 'utf-8'); + $rssDom->formatOutput = true; + + $rss = $rssDom->createElement('rss'); + $rss->setAttribute('version', '2.0'); + $rss->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:g', 'http://base.google.com/ns/1.0'); + $rssDom->appendChild($rss); + + $channel = $rssDom->createElement('channel'); + $channel->appendChild($rssDom->createElement('title', 'Krüger Scheiben - Google Merchant Feed')); + $channel->appendChild($rssDom->createElement('link', 'https://www.krueger-scheiben.de')); + $channel->appendChild($rssDom->createElement('description', 'Automatisch generierter Produktfeed aus täglichem Artikelimport')); + $rss->appendChild($channel); + + $exportCount = 0; + $skipped = 0; + + foreach ($xml->tblMaterials->Detail_Collection->Detail as $value) { + + $variMaterialNo = (string)$value->attributes()->MaterialNo; + $variDescDE = (string)$value->attributes()->DescDE; + $variAddDescDE = (string)$value->attributes()->AddDescDE; + $variAdd2DescDE = (string)$value->attributes()->Add2DescDE; + $variImage = (string)$value->attributes()->Image; + $variClientNo = (string)$value->attributes()->ClientNo; + $variPrice = (float)$value->attributes()->Price; + $variPriceInd = (int)$value->attributes()->PriceInd; + $variPalletAmount = (int)$value->attributes()->PalletAmount; + $variAsOfAmount1 = (int)$value->attributes()->AsOfAmount1; + $variPriceStep1 = (float)$value->attributes()->PriceStep1; + $variTaxKey = (int)$value->attributes()->TaxKey; + $variEAN = (string)$value->attributes()->EAN; + + // --- Filter --- + if ($variClientNo !== '' || stripos($variDescDE, 'Gutschrift') !== false) { + $skipped++; + continue; + } + + // --- URL exakt wie im Import --- + $urlcheck = $this->_entityManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findBy(['shop' => $shopId, 'title' => $variDescDE]); + + if (count($urlcheck) == 1) { + $inurl = $this->shortText($this->clean(strtolower($variDescDE)), 100); + } else { + $inurl = $this->shortText($this->clean(strtolower($variDescDE)), 100) . '-' . + $this->clean(strtolower($variMaterialNo)); + } + + $productUrl = $baseProductUrl . $inurl; + + // --- Preislogik --- + switch ($variPriceInd) { + case 1: $variPrice /= 10; $variPriceStep1 /= 10; break; + case 2: $variPrice /= 100; $variPriceStep1 /= 100; break; + case 3: $variPrice /= 1000; $variPriceStep1 /= 1000; break; + default: break; + } + $variPrice *= $variPalletAmount; + $variPriceStep1 *= $variPalletAmount; + + // --- MwSt --- + $mwstFactor = ($variTaxKey == 5 || $variTaxKey == 21) ? 1.07 : 1.19; + $priceGross = $variPrice * $mwstFactor; + $priceStep1Gross = $variPriceStep1 * $mwstFactor; + + // --- Beschreibung --- + $description = $variAddDescDE . "\n" . $variAdd2DescDE; + if ($variAsOfAmount1 > 0 && $variPriceStep1 > 0) { + $description .= "\nPreisstaffel: 1–{$variAsOfAmount1} = " + . number_format($priceGross, 2, ',', '') . " € / ab {$variAsOfAmount1} = " + . number_format($priceStep1Gross, 2, ',', '') . " €"; + } + + // --- Bild --- + $imgUrl = ($variImage && strtolower($variImage) !== 'none.jpg') + ? $baseImageUrl . rawurlencode($variImage) + : $baseImageUrl . $placeholderImg; + + // --- XML-Item --- + $item = $rssDom->createElement('item'); + $item->appendChild($rssDom->createElement('g:id', htmlspecialchars($variMaterialNo))); + $item->appendChild($rssDom->createElement('title', htmlspecialchars($variDescDE))); + $item->appendChild($rssDom->createElement('description', htmlspecialchars($description))); + $item->appendChild($rssDom->createElement('link', $productUrl)); + $item->appendChild($rssDom->createElement('g:image_link', $imgUrl)); + $item->appendChild($rssDom->createElement('g:price', number_format($priceGross, 2, '.', '') . ' ' . $currency)); + $item->appendChild($rssDom->createElement('g:unit_pricing_measure', max(1, $variPalletAmount) . ' Stück')); + $item->appendChild($rssDom->createElement('g:unit_pricing_base_measure', '1 Stück')); + + if ($variEAN !== '') { + $item->appendChild($rssDom->createElement('g:gtin', htmlspecialchars($variEAN))); + } + + $item->appendChild($rssDom->createElement('g:availability', 'in stock')); + $item->appendChild($rssDom->createElement('g:condition', 'new')); + $channel->appendChild($item); + + $exportCount++; + } + + $rssDom->save($outputFile); + + echo "✅ Google Merchant Feed erzeugt: $outputFile\n"; + echo "📦 Exportiert: $exportCount Produkte\n"; + echo "🚫 Übersprungen: $skipped Produkte\n"; } + + } \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/Artikelimport/Resources/views/queue/import.html.twig b/src/new/var/plugins/Custom/Krueger/Artikelimport/Resources/views/queue/import.html.twig new file mode 100644 index 000000000..2b8244246 --- /dev/null +++ b/src/new/var/plugins/Custom/Krueger/Artikelimport/Resources/views/queue/import.html.twig @@ -0,0 +1,28 @@ + +
+
+

Details

+
+
+
+
+
+ +
+ {{ form_widget(form.file) }} +
+
+
+
+
+
+
+ +
+ {{ form_widget(form.shop) }} +
+
+
+
+
+
\ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/ArtikelimportEN/Document/Import.php b/src/new/var/plugins/Custom/Krueger/ArtikelimportEN/Document/Import.php index 45c7ca513..512d4a22a 100755 --- a/src/new/var/plugins/Custom/Krueger/ArtikelimportEN/Document/Import.php +++ b/src/new/var/plugins/Custom/Krueger/ArtikelimportEN/Document/Import.php @@ -1,31 +1,20 @@ shop = $shop; } +} - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/ArtikelimportFR/Document/Import.php b/src/new/var/plugins/Custom/Krueger/ArtikelimportFR/Document/Import.php index 1c3f8d913..f97e3ce43 100755 --- a/src/new/var/plugins/Custom/Krueger/ArtikelimportFR/Document/Import.php +++ b/src/new/var/plugins/Custom/Krueger/ArtikelimportFR/Document/Import.php @@ -1,31 +1,20 @@ shop = $shop; } +} - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/ArtikelimportFR/Queue/Import.php b/src/new/var/plugins/Custom/Krueger/ArtikelimportFR/Queue/Import.php index 9ad0a05a4..5e26576fa 100755 --- a/src/new/var/plugins/Custom/Krueger/ArtikelimportFR/Queue/Import.php +++ b/src/new/var/plugins/Custom/Krueger/ArtikelimportFR/Queue/Import.php @@ -281,7 +281,7 @@ $inarraycheckb = array(); $variMatGroupNo = $value->attributes()->MatGroupNo; - $variGrDescDEName = strtolower($value->attributes()->GrDescFR); + $variGrDescDEName = strtolower($value->attributes()->GrDescDE); $variGrDescDE = $value->attributes()->GrDescDE; $variGrDescEN = $value->attributes()->GrDescEN; @@ -639,6 +639,12 @@ $inarraycheckb = array(); $description = "" . $variAddDescFR . "
" . $variAdd2DescFR; $produktcheck->setMetaCustomTitle($staffelpreis); $produktcheck->setType(6); + if ($variWeight2 != "" AND $variWeight2 != NULL) { + $gewichtinkalk = $variWeight2 * 1000; + $gewichtinkalk = intval($gewichtinkalk); + } else { + $gewichtinkalk = 0; + } $produktcheck->setCalcXml(' ' . str_replace(array("
", "
", "&", "$"), " ", $variDescFR) . '
@@ -649,6 +655,11 @@ $inarraycheckb = array(); ' . $variAsOfAmount1b . '- +
'); diff --git a/src/new/var/plugins/Custom/Krueger/Artikelkundenimport/Document/Import.php b/src/new/var/plugins/Custom/Krueger/Artikelkundenimport/Document/Import.php index 8280619e4..22ea591ad 100755 --- a/src/new/var/plugins/Custom/Krueger/Artikelkundenimport/Document/Import.php +++ b/src/new/var/plugins/Custom/Krueger/Artikelkundenimport/Document/Import.php @@ -1,31 +1,20 @@ shop = $shop; } +} - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/Customermail/Document/Maildata.php b/src/new/var/plugins/Custom/Krueger/Customermail/Document/Maildata.php index a15ebc163..d2b44e271 100755 --- a/src/new/var/plugins/Custom/Krueger/Customermail/Document/Maildata.php +++ b/src/new/var/plugins/Custom/Krueger/Customermail/Document/Maildata.php @@ -1,37 +1,25 @@ setstatus = $setstatus; } - -} \ No newline at end of file +} diff --git a/src/new/var/plugins/Custom/Krueger/Kundenimport/Document/Import.php b/src/new/var/plugins/Custom/Krueger/Kundenimport/Document/Import.php index 9435ee810..d8ad7650e 100755 --- a/src/new/var/plugins/Custom/Krueger/Kundenimport/Document/Import.php +++ b/src/new/var/plugins/Custom/Krueger/Kundenimport/Document/Import.php @@ -1,31 +1,20 @@ shop = $shop; } +} - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/Kundenimport/Resources/views/Queue/import.html.twig b/src/new/var/plugins/Custom/Krueger/Kundenimport/Resources/views/Queue/import.html.twig new file mode 100644 index 000000000..e2b53b4d1 --- /dev/null +++ b/src/new/var/plugins/Custom/Krueger/Kundenimport/Resources/views/Queue/import.html.twig @@ -0,0 +1,38 @@ + +
+
+

Details

+
+
+
+
+
+ +
+ {{ form_widget(form.file) }} +
+
+
+
+
+
+
+ +
+ {{ form_widget(form.account) }} +
+
+
+
+
+
+
+ +
+ {{ form_widget(form.shop) }} +
+
+
+
+
+
\ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/MegalithOrderexport/Document/Export.php b/src/new/var/plugins/Custom/Krueger/MegalithOrderexport/Document/Export.php index 1462cb529..289061502 100755 --- a/src/new/var/plugins/Custom/Krueger/MegalithOrderexport/Document/Export.php +++ b/src/new/var/plugins/Custom/Krueger/MegalithOrderexport/Document/Export.php @@ -1,31 +1,20 @@ shop = $shop; } +} - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/MegalithOrderexport/Resources/views/queue/export.html.twig b/src/new/var/plugins/Custom/Krueger/MegalithOrderexport/Resources/views/queue/export.html.twig new file mode 100644 index 000000000..3928a60a3 --- /dev/null +++ b/src/new/var/plugins/Custom/Krueger/MegalithOrderexport/Resources/views/queue/export.html.twig @@ -0,0 +1,13 @@ + +
+
+

Details

+
+
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/MegalithOrderexportEN/Document/Export.php b/src/new/var/plugins/Custom/Krueger/MegalithOrderexportEN/Document/Export.php index fe52272e1..9229227ba 100755 --- a/src/new/var/plugins/Custom/Krueger/MegalithOrderexportEN/Document/Export.php +++ b/src/new/var/plugins/Custom/Krueger/MegalithOrderexportEN/Document/Export.php @@ -1,31 +1,20 @@ shop = $shop; } +} - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/MegalithOrderexportFR/Document/Export.php b/src/new/var/plugins/Custom/Krueger/MegalithOrderexportFR/Document/Export.php index b3ca6a60c..23ce339dc 100755 --- a/src/new/var/plugins/Custom/Krueger/MegalithOrderexportFR/Document/Export.php +++ b/src/new/var/plugins/Custom/Krueger/MegalithOrderexportFR/Document/Export.php @@ -1,31 +1,20 @@ shop = $shop; } +} - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/MegalithOrderexportOrder/Document/Export.php b/src/new/var/plugins/Custom/Krueger/MegalithOrderexportOrder/Document/Export.php index 20a580f60..71591188a 100755 --- a/src/new/var/plugins/Custom/Krueger/MegalithOrderexportOrder/Document/Export.php +++ b/src/new/var/plugins/Custom/Krueger/MegalithOrderexportOrder/Document/Export.php @@ -1,31 +1,20 @@ shop = $shop; } +} - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/MegalithOrdersaleupdate/Document/Export.php b/src/new/var/plugins/Custom/Krueger/MegalithOrdersaleupdate/Document/Export.php index 3a1123731..6c61ebad7 100755 --- a/src/new/var/plugins/Custom/Krueger/MegalithOrdersaleupdate/Document/Export.php +++ b/src/new/var/plugins/Custom/Krueger/MegalithOrdersaleupdate/Document/Export.php @@ -1,31 +1,20 @@ shop = $shop; } +} - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/MegalithOrdersaleupdate/Resources/views/Queue/export.html.twig b/src/new/var/plugins/Custom/Krueger/MegalithOrdersaleupdate/Resources/views/Queue/export.html.twig new file mode 100644 index 000000000..3928a60a3 --- /dev/null +++ b/src/new/var/plugins/Custom/Krueger/MegalithOrdersaleupdate/Resources/views/Queue/export.html.twig @@ -0,0 +1,13 @@ + +
+
+

Details

+
+
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/src/new/var/plugins/Custom/Krueger/Megalithuser/Resources/view/Frontend/megalithuser/index.html.twig b/src/new/var/plugins/Custom/Krueger/Megalithuser/Resources/view/Frontend/megalithuser/index.html.twig new file mode 100644 index 000000000..9f5ed07b0 --- /dev/null +++ b/src/new/var/plugins/Custom/Krueger/Megalithuser/Resources/view/Frontend/megalithuser/index.html.twig @@ -0,0 +1 @@ +{{ output }} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/Formular/Document/Formular.php b/src/new/var/plugins/Custom/PSC/Formular/Document/Formular.php index dd4d4a2fd..75b8c3742 100755 --- a/src/new/var/plugins/Custom/PSC/Formular/Document/Formular.php +++ b/src/new/var/plugins/Custom/PSC/Formular/Document/Formular.php @@ -1,4 +1,5 @@ private; + return (bool) $this->private; } public function setPrivate(bool $private): void { $this->private = $private; } +} -} \ No newline at end of file diff --git a/src/new/var/tailwind/backend.built.css b/src/new/var/tailwind/backend.built.css index 27ca332eb..b94692dd1 100644 --- a/src/new/var/tailwind/backend.built.css +++ b/src/new/var/tailwind/backend.built.css @@ -926,6 +926,10 @@ html { grid-column: span 3 / span 3; } +.col-span-4{ + grid-column: span 4 / span 4; +} + .col-span-5{ grid-column: span 5 / span 5; } @@ -1165,6 +1169,10 @@ html { height: 0.75rem; } +.h-3\.5{ + height: 0.875rem; +} + .h-4{ height: 1rem; } @@ -1217,10 +1225,26 @@ html { width: 2.75rem; } +.w-16{ + width: 4rem; +} + +.w-24{ + width: 6rem; +} + .w-3{ width: 0.75rem; } +.w-3\.5{ + width: 0.875rem; +} + +.w-32{ + width: 8rem; +} + .w-4{ width: 1rem; } @@ -1233,6 +1257,10 @@ html { width: 1.25rem; } +.w-56{ + width: 14rem; +} + .w-6{ width: 1.5rem; } @@ -1253,6 +1281,10 @@ html { width: 100vw; } +.min-w-\[120px\]{ + min-width: 120px; +} + .min-w-\[180px\]{ min-width: 180px; } @@ -2674,6 +2706,11 @@ html { background-color: rgb(79 70 229 / var(--tw-bg-opacity)); } +.hover\:bg-psc-50:hover{ + --tw-bg-opacity: 1; + background-color: rgb(238 180 175 / var(--tw-bg-opacity)); +} + .hover\:bg-psc-500:hover{ --tw-bg-opacity: 1; background-color: rgb(234 100 27 / var(--tw-bg-opacity)); @@ -2728,6 +2765,11 @@ html { color: rgb(234 100 27 / var(--tw-text-opacity)); } +.hover\:text-psc-700:hover{ + --tw-text-opacity: 1; + color: rgb(144 40 31 / var(--tw-text-opacity)); +} + .hover\:text-white:hover{ --tw-text-opacity: 1; color: rgb(255 255 255 / var(--tw-text-opacity)); diff --git a/src/old/application/articles/Market/Article.php b/src/old/application/articles/Market/Article.php index 75bf34078..e8db8b15e 100755 --- a/src/old/application/articles/Market/Article.php +++ b/src/old/application/articles/Market/Article.php @@ -2,15 +2,15 @@ class market_article { - public $id = "6"; + public $id = '6'; public $articlegroups; public $private; public $versandwert; public $versand; public $netto = 0; - public $name = "Main Product"; - public $template = "market_article"; - public $information = "Bietet Markt Produkte an"; + public $name = 'Main Product'; + public $template = 'market_article'; + public $information = 'Bietet Markt Produkte an'; public $backend = 'Market/config/backend.ini'; public $backend_market = 'Market/config/backend_market.ini'; public $frontend = 'Market/config/frontend.xml'; @@ -33,18 +33,31 @@ class market_article public function toArray() { - return array('thomas' => $this->thomas, 'pdf' => $this->pdf, 'template' => $this->template, 'a1_xml' => str_replace('\\', '', $this->a1_xml), 'versand' => $this->versand, 'versandwert' => $this->versandwert, 'private' => $this->private, 'articlegroups' => $this->articlegroups, 'mwert' => $this->mwert, 'title' => $this->title, 'price' => $this->price, 'text' => $this->text, 'file' => $this->file, 'file1' => $this->file1); + return [ + 'thomas' => $this->thomas, + 'pdf' => $this->pdf, + 'template' => $this->template, + 'a1_xml' => str_replace('\\', '', $this->a1_xml), + 'versand' => $this->versand, + 'versandwert' => $this->versandwert, + 'private' => $this->private, + 'articlegroups' => $this->articlegroups, + 'mwert' => $this->mwert, + 'title' => $this->title, + 'price' => $this->price, + 'text' => $this->text, + 'file' => $this->file, + 'file1' => $this->file1, + ]; } public function createFrontend($view, $translate, Article $article, $ajax = false) { + $view->view->upload_possible = []; - $view->view->upload_possible = array(); - - $upload = array(); + $upload = []; if ($article->a6_org_article != 0) { - if ($article->OrgArticle->upload_article) { $upload['article'] = 'Jetzt Hochladen'; $view->view->upload_possible[] = 'article'; @@ -90,7 +103,6 @@ class market_article $view->view->upload_possible[] = 'multi'; } } else { - if ($article->upload_article) { $upload['article'] = 'Jetzt Hochladen'; $view->view->upload_possible[] = 'article'; @@ -137,17 +149,30 @@ class market_article } } if ($view->getRequest()->getParam('auflage', false)) { - $view->getRequest()->setParam('auflage', str_replace(".", "", $view->getRequest()->getParam('auflage', false))); - $view->getRequest()->setPost('auflage', str_replace(".", "", $view->getRequest()->getParam('auflage', false))); + $view->getRequest()->setParam( + 'auflage', + str_replace('.', '', $view->getRequest()->getParam('auflage', false)), + ); + $view->getRequest()->setPost( + 'auflage', + str_replace('.', '', $view->getRequest()->getParam('auflage', false)), + ); } if (!$view->getRequest()->getParam('upload_mode', false)) { $keys = array_keys($upload); if (isset($keys[0])) { - if ($article->not_edit == 1) { $_POST['upload_mode'] = 'article'; $view->getRequest()->setParam('upload_mode', 'article'); - } elseif (count($upload) == 1 && ($view->view->upload_possible[0] == 'provided' || $view->view->upload_possible[0] == 'center' || $view->view->upload_possible[0] == 'mail' || $view->view->upload_possible[0] == 'post')) { + } elseif ( + count($upload) == 1 && + ( + $view->view->upload_possible[0] == 'provided' || + $view->view->upload_possible[0] == 'center' || + $view->view->upload_possible[0] == 'mail' || + $view->view->upload_possible[0] == 'post' + ) + ) { $_POST['upload_mode'] = $view->view->upload_possible[0]; $view->getRequest()->setParam('upload_mode', $view->view->upload_possible[0]); } else { @@ -155,7 +180,10 @@ class market_article $view->getRequest()->setParam('upload_mode', 'none'); } - if ($view->getRequest()->getParam('layouter', false) || $view->getRequest()->getParam('openlayouter', false)) { + if ( + $view->getRequest()->getParam('layouter', false) || + $view->getRequest()->getParam('openlayouter', false) + ) { $view->getRequest()->setParam('upload_mode', 'steplayouter2'); $_POST['upload_mode'] = 'steplayouter2'; } @@ -176,16 +204,20 @@ class market_article if (!$ajax) { $view->view->upload_mode_form = new Zend_Form(); $view->view->upload_mode_form->addElement('radio', 'upload_mode_select'); - $view->view->upload_mode_form->upload_mode_select->setLabel('Datenübertragung') + $view + ->view + ->upload_mode_form + ->upload_mode_select + ->setLabel('Datenübertragung') ->setMultiOptions($upload) - ->removeDecorator('label')->removeDecorator('HtmlTag') + ->removeDecorator('label') + ->removeDecorator('HtmlTag') ->setAttrib('onChange', 'this.form.submit()'); $view->view->upload_mode_form->valid(); $view->view->form->addElement('hidden', 'upload_mode'); - $view->view->form->upload_mode - ->removeDecorator('label')->removeDecorator('HtmlTag'); + $view->view->form->upload_mode->removeDecorator('label')->removeDecorator('HtmlTag'); if ($view->getRequest()->getParam('upload_mode')) { $view->view->upload_mode = $view->getRequest()->getParam('upload_mode'); @@ -215,7 +247,6 @@ class market_article } } } else { - if ($view->getRequest()->getParam('upload_mode')) { $view->view->upload_mode = $view->getRequest()->getParam('upload_mode'); @@ -223,7 +254,13 @@ class market_article $articleBasket = $basket->getTempProduct($article->uuid); $articleBasket->setUploadMode($view->view->upload_mode); - $view->view->form[] = array('type' => 'radio', 'options' => $upload, 'value' => $view->view->upload_mode, 'label' => $translate->translate('Datenübertragung'), 'name' => 'upload_mode'); + $view->view->form[] = [ + 'type' => 'radio', + 'options' => $upload, + 'value' => $view->view->upload_mode, + 'label' => $translate->translate('Datenübertragung'), + 'name' => 'upload_mode', + ]; } else { $keys = array_keys($upload); if (isset($keys[0])) { @@ -233,9 +270,21 @@ class market_article $articleBasket = $basket->getTempProduct($article->uuid); $articleBasket->setUploadMode($keys[0]); - $view->view->form[] = array('type' => 'radio', 'options' => $upload, 'value' => $keys[0], 'label' => $translate->translate('Datenübertragung'), 'name' => 'upload_mode'); + $view->view->form[] = [ + 'type' => 'radio', + 'options' => $upload, + 'value' => $keys[0], + 'label' => $translate->translate('Datenübertragung'), + 'name' => 'upload_mode', + ]; } else { - $view->view->form[] = array('type' => 'radio', 'options' => $upload, 'value' => null, 'label' => $translate->translate('Datenübertragung'), 'name' => 'upload_mode'); + $view->view->form[] = [ + 'type' => 'radio', + 'options' => $upload, + 'value' => null, + 'label' => $translate->translate('Datenübertragung'), + 'name' => 'upload_mode', + ]; } } } @@ -290,7 +339,7 @@ class market_article foreach ($files as $file) { $finfo = new finfo(FILEINFO_MIME_TYPE); $finfo = $finfo->file('uploads/' . $view->view->shop->uid . '/article/' . $file['value']); - if ($finfo == "application/pdf") { + if ($finfo == 'application/pdf') { $image = new Imagick(); $image->pingImage('uploads/' . $view->view->shop->uid . '/article/' . $file['value']); $max = $max + $image->getNumberImages(); @@ -307,7 +356,7 @@ class market_article $this->netto = $calc->parse($view, null, $param, $article->a6_resale_price + $articleBasket->getMotivPrice()); - if (isset($view->view->layouterPreviewId) && $view->view->layouterPreviewId != "") { + if (isset($view->view->layouterPreviewId) && $view->view->layouterPreviewId != '') { $articleSession = new TP_Layoutersession(); $articleSess = $articleSession->getLayouterArticle($view->view->layouterPreviewId); @@ -320,14 +369,16 @@ class market_article } if (!$ajax) { - if (!$view->getRequest()->getParam('special', false)) { - $view->view->form->addElement('submit', 'send', array('label' => $translate->translate('Calc'))); + $view->view->form->addElement('submit', 'send', ['label' => $translate->translate('Calc')]); } } else { - if (!$view->getRequest()->getParam('special', false)) { - $view->view->form[] = array('type' => 'submit', 'label' => $translate->translate('Calc'), 'name' => 'send'); + $view->view->form[] = [ + 'type' => 'submit', + 'label' => $translate->translate('Calc'), + 'name' => 'send', + ]; } } @@ -348,7 +399,11 @@ class market_article } $auflage = $view->getRequest()->getParam('auflage', false); if ($auflage && $auflage > 1) { - return $this->netto + ($view->getRequest()->getParam('auflage', 1) * $article->a6_resale_price) + ($view->getRequest()->getParam('auflage', 1) * $articleBasket->getMotivPrice()); + return ( + $this->netto + + ($view->getRequest()->getParam('auflage', 1) * $article->a6_resale_price) + + ($view->getRequest()->getParam('auflage', 1) * $articleBasket->getMotivPrice()) + ); } return $this->netto + $article->a6_resale_price + $articleBasket->getMotivPrice(); } @@ -374,46 +429,53 @@ class market_article { $path = str_split($data->id); - $orginal = $data->a6_directory; $data->a6_directory = implode('/', $path) . '/'; if (file_exists(APPLICATION_PATH . '/../market/templateprint/orginal/' . $orginal . '/product.zip')) { - mkdir(APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path), 0777, true); - copy(APPLICATION_PATH . '/../market/templateprint/orginal/' . $orginal . '/product.zip', APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path) . '/product.zip'); + mkdir(APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path), 0o777, true); + copy( + APPLICATION_PATH . '/../market/templateprint/orginal/' . $orginal . '/product.zip', + APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path) . '/product.zip', + ); } if (file_exists(APPLICATION_PATH . '/../market/templateprint/orginal/' . $orginal . '/final.pdf')) { - mkdir(APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path), 0777, true); - copy(APPLICATION_PATH . '/../market/templateprint/orginal/' . $orginal . '/final.pdf', APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path) . '/final.pdf'); + mkdir(APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path), 0o777, true); + copy( + APPLICATION_PATH . '/../market/templateprint/orginal/' . $orginal . '/final.pdf', + APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path) . '/final.pdf', + ); } if (file_exists(APPLICATION_PATH . '/../market/templateprint/orginal/' . $orginal . '/preview.pdf')) { - mkdir(APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path), 0777, true); - copy(APPLICATION_PATH . '/../market/templateprint/orginal/' . $orginal . '/preview.pdf', APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path) . '/preview.pdf'); + mkdir(APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path), 0o777, true); + copy( + APPLICATION_PATH . '/../market/templateprint/orginal/' . $orginal . '/preview.pdf', + APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path) . '/preview.pdf', + ); } - $data->save(); if ($orguuid != false) { - $articleSession = new TP_Layoutersession(); $articleSess = $articleSession->getLayouterArticle($orguuid); if ($articleSess->getLayouterModus() == 2) { - $data->upload_steplayouter_data = $articleSess->getDesignerXML(); - if ($articleSess->getTitle() != "") { + if ($articleSess->getTitle() != '') { $data->title = $articleSess->getTitle(); } $data->save(); } elseif ($articleSess->getLayouterModus() == 4) { - - $design = Doctrine_Query::create()->from('LayouterDesignData c')->where('c.uuid = ?', array( - $articleSess->getArticleId() - ))->fetchOne(); + $design = Doctrine_Query::create() + ->from('LayouterDesignData c') + ->where('c.uuid = ?', [ + $articleSess->getArticleId(), + ]) + ->fetchOne(); $data->upload_steplayouter_data = $design->design; $articleSession->deleteLayouterArticle($orguuid); } else { @@ -424,7 +486,6 @@ class market_article public function copyAdminPreDispatch($orgArticle, $copyArticle) { - if ($orgArticle->install_id == $copyArticle->install_id) { return; } @@ -442,16 +503,12 @@ class market_article foreach ($xml as $node) { foreach ($node->option as $nod) { - foreach ($nod->children() as $key => $nextNode) { - if ($key != 'opt') { foreach ($nextNode->children() as $keys => $nextNodee) { preg_match_all('/\$P\w*\$P/', $nextNodee['formel'], $founds); if (!empty($founds[0])) { - foreach ($founds[0] as $key => $found) { - $foundvalue = str_replace('$P', '', $found); $nextNodee['formel'] = str_replace($found, $$foundvalue, $nextNodee['formel']); } @@ -463,11 +520,13 @@ class market_article foreach ($nextNodee->children() as $keyss => $nextNodeee) { preg_match_all('/\$P\w*\$P/', $nextNodeee['formel'], $founds); if (!empty($founds[0])) { - foreach ($founds[0] as $key => $found) { - $foundvalue = str_replace('$P', '', $found); - $nextNodeee['formel'] = str_replace($found, $$foundvalue, $nextNodeee['formel']); + $nextNodeee['formel'] = str_replace( + $found, + $$foundvalue, + $nextNodeee['formel'], + ); } } } @@ -475,19 +534,22 @@ class market_article } } - if ((string) $nod['mode'] == 'papierdb' && (string) $nod['container'] != "") { - $inhalt = $papierdborg->xpath('//papiercontainer[@id="' . (string) $nod['container'] . '"]'); + if (((string) $nod['mode']) == 'papierdb' && ((string) $nod['container']) != '') { + $inhalt = $papierdborg->xpath('//papiercontainer[@id="' . ((string) $nod['container']) . '"]'); $inhalt = $inhalt[0]; $papierdborgset = $papierdb->addChild('papiercontainer'); $papierdborgset->addAttribute('id', $inhalt['id'] . '_' . $copyArticle->id); - if ($inhalt['value'] != "") { + if ($inhalt['value'] != '') { $papierdborgset->addAttribute('value', $inhalt['value']); } foreach ($inhalt->papier as $papier) { - - $p = Doctrine_Query::create()->select()->from('Papier p')->where('p.art_nr = ? AND p.install_id = ?', array($papier['id'], $orgInstall->id))->fetchOne(); + $p = Doctrine_Query::create() + ->select() + ->from('Papier p') + ->where('p.art_nr = ? AND p.install_id = ?', [$papier['id'], $orgInstall->id]) + ->fetchOne(); $newPapier = new Papier(); $newPapier->install_id = $copyInstall->id; @@ -499,7 +561,7 @@ class market_article $papierdbp = $papierdborgset->addChild('papier'); $papierdbp->addAttribute('id', $newPapier->art_nr); - if ($papier['value'] != "") { + if ($papier['value'] != '') { $papierdbp->addAttribute('value', $papier['value']); } } @@ -524,166 +586,245 @@ class market_article if ($layouterPreviewId) { $article = Doctrine_Query::create() ->from('Article c') - ->where('c.id = ?', array(intval($articleId))) + ->where('c.id = ?', [intval($articleId)]) ->fetchOne(); $articleSession = new TP_Layoutersession(); $articleSess = $articleSession->getLayouterArticle($layouterPreviewId); - if ($articleSess->getTemplatePrintId() != "") { + if ($articleSess->getTemplatePrintId() != '') { return TP_Templateprint::generatePreviewLink($article, $layouterPreviewId); } } } - public function generatePreview($articleId, $layouterPreviewId = false, $mode = false, $class = "", $onlyPath = false, $order_id = false, $pos = false, $site = 1) - { - + public function generatePreview( + $articleId, + $layouterPreviewId = false, + $mode = false, + $class = '', + $onlyPath = false, + $order_id = false, + $pos = false, + $site = 1, + ) { if ($order_id && $pos) { - $article = Doctrine_Query::create() ->from('Article c') - ->where('c.id = ?', array(intval($articleId))) + ->where('c.id = ?', [intval($articleId)]) ->fetchOne(); - return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, TP_Templateprint::generatePreview($article, $layouterPreviewId, $order_id, $pos), $mode, $class, $onlyPath); + return TP_Image::generateWidthImgTag( + TP_Image::LAYOUTERPREVIEW, + TP_Templateprint::generatePreview($article, $layouterPreviewId, $order_id, $pos), + $mode, + $class, + $onlyPath, + ); } if ($layouterPreviewId) { $layouterPreviewId = strtoupper($layouterPreviewId); $article = Doctrine_Query::create() ->from('Article c') - ->where('c.id = ?', array(intval($articleId))) + ->where('c.id = ?', [intval($articleId)]) ->fetchOne(); $articleSession = new TP_Layoutersession(); $articleSess = $articleSession->getLayouterArticle($layouterPreviewId); if ($articleSess->getLayouterModus() == 2) { - - if (!file_exists(PUBLIC_PATH . '/steplayouter/temp/' . $layouterPreviewId . ".png")) { - - Zend_Registry::set("steplayout_preview", 1); + if (!file_exists(PUBLIC_PATH . '/steplayouter/temp/' . $layouterPreviewId . '.png')) { + Zend_Registry::set('steplayout_preview', 1); $data = json_decode($articleSess->getDesignerXML(), true); - $steplayouter = new TP_Steplayouter($data['jsonSaveData'], $article, $data['jsonLayerData'], $data['jsonCreateData']); + $steplayouter = new TP_Steplayouter( + $data['jsonSaveData'], + $article, + $data['jsonLayerData'], + $data['jsonCreateData'], + ); $steplayouter->buildRenderStack($data['width'], $data['height']); - $file = $steplayouter->exportPNG(PUBLIC_PATH . '/steplayouter/temp/' . $layouterPreviewId, 400, 400, 1); + $file = $steplayouter->exportPNG( + PUBLIC_PATH . '/steplayouter/temp/' . $layouterPreviewId, + 400, + 400, + 1, + ); } - return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, PUBLIC_PATH . '/steplayouter/temp/' . $layouterPreviewId . ".png", $mode, $class, $onlyPath); + return TP_Image::generateWidthImgTag( + TP_Image::LAYOUTERPREVIEW, + PUBLIC_PATH . '/steplayouter/temp/' . $layouterPreviewId . '.png', + $mode, + $class, + $onlyPath, + ); } elseif ($articleSess->getLayouterModus() == 4) { - return ''; + return ( + '' + ); } elseif ($articleSess->getLayouterModus() == 5) { - require_once(APPLICATION_PATH . '/helpers/Image.php'); + require_once APPLICATION_PATH . '/helpers/Image.php'; $imageHelper = new TP_View_Helper_Image(); $file = $imageHelper->thumbnailImage($article->title, 'articlesinglegreater', $article->file, true); return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, $file, $mode, $class, $onlyPath); } elseif ($articleSess->getLayouterModus() == 6) { - require_once(APPLICATION_PATH . '/helpers/Image.php'); + require_once APPLICATION_PATH . '/helpers/Image.php'; $imageHelper = new TP_View_Helper_Image(); $file = $imageHelper->thumbnailImage($article->title, 'articlesinglegreater', $article->file, true); return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, $file, $mode, $class, $onlyPath); } elseif ($articleSess->getLayouterModus() == 8) { - return ''; + return ( + '' + ); } elseif ($articleSess->getLayouterModus() == 9) { - return ''; + return ( + '' + ); } elseif ($articleSess->getLayouterModus() == 10) { - return ''; + return ( + '' + ); } elseif ($articleSess->getLayouterModus() == 11) { $layoutData = Doctrine_Query::create() - ->from('LayouterDesignData c') - ->where('c.uuid = ?', array((string)$layouterPreviewId)) - ->fetchOne(); + ->from('LayouterDesignData c') + ->where('c.uuid = ?', [(string) $layouterPreviewId]) + ->fetchOne(); $design = json_decode($layoutData->design, true); - return ''; + return ''; } elseif ($articleSess->getLayouterModus() == 12) { $layoutData = Doctrine_Query::create() ->from('LayouterDesignData c') - ->where('c.uuid = ?', array((string)$layouterPreviewId)) + ->where('c.uuid = ?', [(string) $layouterPreviewId]) ->fetchOne(); $design = json_decode($layoutData->design, true); if (isset($design['previews'][$site - 1]['url'])) { - return ''; + return ''; } return ''; } elseif ($articleSess->getLayouterModus() == 101) { $layoutData = Doctrine_Query::create() ->from('LayouterDesignData c') - ->where('c.uuid = ?', array((string)$layouterPreviewId)) + ->where('c.uuid = ?', [(string) $layouterPreviewId]) ->fetchOne(); $design = json_decode($layoutData->design, true); - return ''; - + return ''; } elseif ($articleSess->getLayouterModus() == 102) { $layoutData = Doctrine_Query::create() ->from('LayouterDesignData c') - ->where('c.uuid = ?', array((string)$layouterPreviewId)) + ->where('c.uuid = ?', [(string) $layouterPreviewId]) ->fetchOne(); $design = json_decode($layoutData->design, true); - return ''; - - } elseif ($articleSess->getTemplatePrintId() != "") { - + return ''; + } elseif ($articleSess->getTemplatePrintId() != '') { if (!TP_Templateprint::siteExists($article, $layouterPreviewId, false, false, $site)) { return ''; } - return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, TP_Templateprint::generatePreview($article, $layouterPreviewId, false, false, $site), $mode, $class, $onlyPath, true); + return TP_Image::generateWidthImgTag( + TP_Image::LAYOUTERPREVIEW, + TP_Templateprint::generatePreview($article, $layouterPreviewId, false, false, $site), + $mode, + $class, + $onlyPath, + true, + ); } } else { $article = Doctrine_Query::create() ->from('Article c') - ->where('c.id = ?', array(intval($articleId))) + ->where('c.id = ?', [intval($articleId)]) ->fetchOne(); - if ($article->upload_steplayouter_data != "") { - return ''; + if ($article->upload_steplayouter_data != '') { + return ( + '' + ); } elseif (TP_Templateprint::isTemplateExists($article)) { - return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, TP_Templateprint::generatePreview($article), $mode, $class, $onlyPath); + return TP_Image::generateWidthImgTag( + TP_Image::LAYOUTERPREVIEW, + TP_Templateprint::generatePreview($article), + $mode, + $class, + $onlyPath, + ); } } - if ($layouterPreviewId != false && $layouterPreviewId != "") { - return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, TP_FOP::generatePreview($articleId, $layouterPreviewId), $mode, $class, $onlyPath); + if ($layouterPreviewId != false && $layouterPreviewId != '') { + return TP_Image::generateWidthImgTag( + TP_Image::LAYOUTERPREVIEW, + TP_FOP::generatePreview($articleId, $layouterPreviewId), + $mode, + $class, + $onlyPath, + ); } - return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, TP_FOP::generatePreview($articleId), $mode, $class, $onlyPath); + return TP_Image::generateWidthImgTag( + TP_Image::LAYOUTERPREVIEW, + TP_FOP::generatePreview($articleId), + $mode, + $class, + $onlyPath, + ); } public function generatePreviewBig($articleId, $layouterPreviewId = false) { - if ($layouterPreviewId) { $article = Doctrine_Query::create() ->from('Article c') - ->where('c.id = ?', array(intval($articleId))) + ->where('c.id = ?', [intval($articleId)]) ->fetchOne(); $articleSession = new TP_Layoutersession(); $articleSess = $articleSession->getLayouterArticle($layouterPreviewId); if ($articleSess->getLayouterModus() == 2) { - $steplayouter = new TP_Steplayouter(json_decode($articleSess->getDesignerXML(), true), $article); $steplayouter->buildRenderStack(); $file = $steplayouter->exportPNG(PUBLIC_PATH . '/steplayouter/temp/' . $layouterPreviewId, 400, 400, 1); return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, $file); } elseif ($articleSess->getLayouterModus() == 8) { - return ''; - } elseif ($articleSess->getTemplatePrintId() != "") { - return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, TP_Templateprint::generatePreview($article, $layouterPreviewId)); + return ( + '' + ); + } elseif ($articleSess->getTemplatePrintId() != '') { + return TP_Image::generateWidthImgTag( + TP_Image::LAYOUTERPREVIEW, + TP_Templateprint::generatePreview($article, $layouterPreviewId), + ); } } else { $article = Doctrine_Query::create() ->from('Article c') - ->where('c.id = ?', array(intval($articleId))) + ->where('c.id = ?', [intval($articleId)]) ->fetchOne(); if ($article->upload_templateprint && $article->render_new_preview_image == false) { - return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, TP_Templateprint::generatePreview($article)); + return TP_Image::generateWidthImgTag( + TP_Image::LAYOUTERPREVIEW, + TP_Templateprint::generatePreview($article), + ); } } - if ($layouterPreviewId != false && $layouterPreviewId != "") { - return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, TP_FOP::generatePreview($articleId, $layouterPreviewId)); + if ($layouterPreviewId != false && $layouterPreviewId != '') { + return TP_Image::generateWidthImgTag( + TP_Image::LAYOUTERPREVIEW, + TP_FOP::generatePreview($articleId, $layouterPreviewId), + ); } return TP_Image::generateWidthImgTag(TP_Image::LAYOUTERPREVIEW, TP_FOP::generatePreview($articleId)); } diff --git a/src/old/library/Zend/View/Helper/FormHelpcheckbox.php b/src/old/library/Zend/View/Helper/FormHelpcheckbox.php new file mode 100644 index 000000000..d63b0d6a5 --- /dev/null +++ b/src/old/library/Zend/View/Helper/FormHelpcheckbox.php @@ -0,0 +1,35 @@ +formCheckbox($name, $value, $attribs, $checkedOptions); + } +} diff --git a/src/old/market/steplayouter/basket/283/1/AF-07.12.2025-78_1.pdf b/src/old/market/steplayouter/basket/283/1/AF-07.12.2025-78_1.pdf new file mode 100644 index 000000000..3b89651c7 Binary files /dev/null and b/src/old/market/steplayouter/basket/283/1/AF-07.12.2025-78_1.pdf differ diff --git a/src/old/public/temp/3e72ab89-2a0e-d82b-5c49-44d051b3e582_0.pdf b/src/old/public/temp/3e72ab89-2a0e-d82b-5c49-44d051b3e582_0.pdf new file mode 100644 index 000000000..c540087c9 Binary files /dev/null and b/src/old/public/temp/3e72ab89-2a0e-d82b-5c49-44d051b3e582_0.pdf differ diff --git a/src/old/public/temp/3e72ab89-2a0e-d82b-5c49-44d051b3e582_0.svg b/src/old/public/temp/3e72ab89-2a0e-d82b-5c49-44d051b3e582_0.svg new file mode 100644 index 000000000..2e2b22ba0 --- /dev/null +++ b/src/old/public/temp/3e72ab89-2a0e-d82b-5c49-44d051b3e582_0.svg @@ -0,0 +1,45 @@ + + + +Created with Fabric.js 1.6.5 + + + + + + + + Dein Text + + + \ No newline at end of file diff --git a/src/old/public/temp/693435d52640c.pdf.png b/src/old/public/temp/693435d52640c.pdf.png new file mode 100644 index 000000000..1d40f2dea Binary files /dev/null and b/src/old/public/temp/693435d52640c.pdf.png differ diff --git a/src/old/public/temp/693435f318576.pdf.png b/src/old/public/temp/693435f318576.pdf.png new file mode 100644 index 000000000..fc289d94c Binary files /dev/null and b/src/old/public/temp/693435f318576.pdf.png differ diff --git a/src/old/public/temp/6934362adc811.pdf.png b/src/old/public/temp/6934362adc811.pdf.png new file mode 100644 index 000000000..865502020 Binary files /dev/null and b/src/old/public/temp/6934362adc811.pdf.png differ diff --git a/src/old/public/temp/6934a0321992d.pdf.png b/src/old/public/temp/6934a0321992d.pdf.png new file mode 100644 index 000000000..90f625b18 Binary files /dev/null and b/src/old/public/temp/6934a0321992d.pdf.png differ diff --git a/src/old/public/temp/6934a12abb6fb.pdf.png b/src/old/public/temp/6934a12abb6fb.pdf.png new file mode 100644 index 000000000..3d9017dae Binary files /dev/null and b/src/old/public/temp/6934a12abb6fb.pdf.png differ diff --git a/src/old/public/temp/6934ab347c535.pdf.png b/src/old/public/temp/6934ab347c535.pdf.png new file mode 100644 index 000000000..e9c108fc8 Binary files /dev/null and b/src/old/public/temp/6934ab347c535.pdf.png differ diff --git a/src/old/public/temp/6934aba1c4b5f.pdf.png b/src/old/public/temp/6934aba1c4b5f.pdf.png new file mode 100644 index 000000000..4e8130216 Binary files /dev/null and b/src/old/public/temp/6934aba1c4b5f.pdf.png differ diff --git a/src/old/public/temp/6934b38731a18.pdf.png b/src/old/public/temp/6934b38731a18.pdf.png new file mode 100644 index 000000000..844dd8155 Binary files /dev/null and b/src/old/public/temp/6934b38731a18.pdf.png differ diff --git a/src/old/public/temp/6934b62835cd0.pdf.png b/src/old/public/temp/6934b62835cd0.pdf.png new file mode 100644 index 000000000..b5a2eeff7 Binary files /dev/null and b/src/old/public/temp/6934b62835cd0.pdf.png differ diff --git a/src/old/public/temp/6934b647d436d.pdf.png b/src/old/public/temp/6934b647d436d.pdf.png new file mode 100644 index 000000000..d1c241992 Binary files /dev/null and b/src/old/public/temp/6934b647d436d.pdf.png differ diff --git a/src/old/public/temp/69358930a901b.pdf.png b/src/old/public/temp/69358930a901b.pdf.png new file mode 100644 index 000000000..aacbf7650 Binary files /dev/null and b/src/old/public/temp/69358930a901b.pdf.png differ diff --git a/src/old/public/temp/6935893ca47e8.pdf.png b/src/old/public/temp/6935893ca47e8.pdf.png new file mode 100644 index 000000000..219d5b862 Binary files /dev/null and b/src/old/public/temp/6935893ca47e8.pdf.png differ diff --git a/src/old/public/temp/69358a5ca541b.pdf.png b/src/old/public/temp/69358a5ca541b.pdf.png new file mode 100644 index 000000000..540606a51 Binary files /dev/null and b/src/old/public/temp/69358a5ca541b.pdf.png differ diff --git a/src/old/public/temp/69358aa88a27f.pdf.png b/src/old/public/temp/69358aa88a27f.pdf.png new file mode 100644 index 000000000..25895b17d Binary files /dev/null and b/src/old/public/temp/69358aa88a27f.pdf.png differ diff --git a/src/old/public/temp/69358ab009f7a.pdf.png b/src/old/public/temp/69358ab009f7a.pdf.png new file mode 100644 index 000000000..0fbd3aea7 Binary files /dev/null and b/src/old/public/temp/69358ab009f7a.pdf.png differ diff --git a/src/old/public/temp/6935a8ed33f70.pdf b/src/old/public/temp/6935a8ed33f70.pdf new file mode 100644 index 000000000..cacf4e698 Binary files /dev/null and b/src/old/public/temp/6935a8ed33f70.pdf differ diff --git a/src/old/public/temp/6935a90cde8cd.pdf.png b/src/old/public/temp/6935a90cde8cd.pdf.png new file mode 100644 index 000000000..6060d031c Binary files /dev/null and b/src/old/public/temp/6935a90cde8cd.pdf.png differ diff --git a/src/old/public/temp/6935a9139213b.pdf.png b/src/old/public/temp/6935a9139213b.pdf.png new file mode 100644 index 000000000..a58648b2f Binary files /dev/null and b/src/old/public/temp/6935a9139213b.pdf.png differ diff --git a/src/old/public/temp/6935a926f09b5.pdf.png b/src/old/public/temp/6935a926f09b5.pdf.png new file mode 100644 index 000000000..0aa230e91 Binary files /dev/null and b/src/old/public/temp/6935a926f09b5.pdf.png differ diff --git a/src/old/public/temp/test.pdf b/src/old/public/temp/test.pdf new file mode 100644 index 000000000..cdb416feb Binary files /dev/null and b/src/old/public/temp/test.pdf differ diff --git a/src/old/public/temp/test.svg b/src/old/public/temp/test.svg new file mode 100644 index 000000000..6744cae33 --- /dev/null +++ b/src/old/public/temp/test.svg @@ -0,0 +1,13 @@ + + + +Created with Fabric.js 1.6.5 + + + + + + Dein Text + + + \ No newline at end of file