Compare commits

..

No commits in common. "plugin-laufkarten" and "asset-mapper" have entirely different histories.

818 changed files with 20948 additions and 35191 deletions

View File

@ -64,10 +64,10 @@ server {
try_files $uri @sfFront; try_files $uri @sfFront;
} }
# location /w2p/ { # location /w2p/ {
# proxy_pass http://tp:8080/w2p/; # proxy_pass http://tp:8080/w2p/;
# proxy_temp_path /tmp/proxy; # proxy_temp_path /tmp/proxy;
# } #}
location @sfFront { # Symfony location @sfFront { # Symfony
if ($request_method = 'OPTIONS') { if ($request_method = 'OPTIONS') {

View File

@ -100,14 +100,8 @@ RUN docker-php-ext-install -j$(nproc) ldap
RUN pecl install imap \ RUN pecl install imap \
&& docker-php-ext-enable 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
RUN apt-get update && apt-get install -y --no-install-recommends \ # COPY ./.docker/images/php/base/pdf/php_pdflib.so /pdflib.so
poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# make bash default shell # make bash default shell
RUN sed -e 's;/bin/ash$;/bin/bash;g' -i /etc/passwd RUN sed -e 's;/bin/ash$;/bin/bash;g' -i /etc/passwd

View File

@ -10,7 +10,3 @@ symfony-init: ## init Symfony
$(EXECUTE_IN_APPLICATION_CONTAINER) php "/application/src/new/bin/console" importmap:install; $(EXECUTE_IN_APPLICATION_CONTAINER) php "/application/src/new/bin/console" importmap:install;
$(EXECUTE_IN_APPLICATION_CONTAINER) php "/application/src/new/bin/console" asset-map:compile; $(EXECUTE_IN_APPLICATION_CONTAINER) php "/application/src/new/bin/console" asset-map:compile;
$(EXECUTE_IN_APPLICATION_CONTAINER) php "/application/src/new/bin/console" assets:install; $(EXECUTE_IN_APPLICATION_CONTAINER) php "/application/src/new/bin/console" assets:install;
.PHONY: php-stan
php-stan: ## init Symfony
$(EXECUTE_IN_APPLICATION_CONTAINER) php "vendor/bin/phpstan" analyse ;

Binary file not shown.

View File

@ -306,7 +306,7 @@ CREATE TABLE `article` (
`a4_auflagen` text DEFAULT NULL, `a4_auflagen` text DEFAULT NULL,
`a4_sponsoring` int(1) DEFAULT NULL, `a4_sponsoring` int(1) DEFAULT NULL,
`a4_prodzeit` varchar(255) DEFAULT NULL, `a4_prodzeit` varchar(255) DEFAULT NULL,
`a4_abpreis` varchar(20) DEFAULT NULL, `a4_abpreis` float(8,2) DEFAULT 0.00,
`a5_buy` int(1) DEFAULT NULL, `a5_buy` int(1) DEFAULT NULL,
`a5_xml` text DEFAULT NULL, `a5_xml` text DEFAULT NULL,
`layouterid` varchar(255) DEFAULT NULL, `layouterid` varchar(255) DEFAULT NULL,
@ -933,7 +933,7 @@ CREATE TABLE `contact_address` (
`email` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL,
`type` int(1) NOT NULL, `type` int(1) NOT NULL,
`company` varchar(100) DEFAULT NULL, `company` varchar(100) DEFAULT NULL,
`anrede` varchar(100) DEFAULT NULL, `anrede` varchar(100) NOT NULL,
`country` varchar(100) DEFAULT NULL, `country` varchar(100) DEFAULT NULL,
`fax` varchar(255) DEFAULT NULL, `fax` varchar(255) DEFAULT NULL,
`company2` varchar(255) DEFAULT NULL, `company2` varchar(255) DEFAULT NULL,
@ -1712,7 +1712,7 @@ CREATE TABLE `papierdb` (
`huelsendurchmesser` varchar(60) DEFAULT NULL, `huelsendurchmesser` varchar(60) DEFAULT NULL,
`kleber` varchar(60) DEFAULT NULL, `kleber` varchar(60) DEFAULT NULL,
`abdeckpapier` varchar(60) DEFAULT NULL, `abdeckpapier` varchar(60) DEFAULT NULL,
`laufrichtung` varchar(60) DEFAULT NULL, `laufrichtung` varchar(2) DEFAULT NULL,
`mengenangabe` int(10) DEFAULT NULL, `mengenangabe` int(10) DEFAULT NULL,
`mengenangabe_palette` int(10) DEFAULT NULL, `mengenangabe_palette` int(10) DEFAULT NULL,
`inhalt` varchar(60) DEFAULT NULL, `inhalt` varchar(60) DEFAULT NULL,
@ -2114,7 +2114,7 @@ CREATE TABLE `shop` (
`smtphostname` varchar(255) DEFAULT NULL, `smtphostname` varchar(255) DEFAULT NULL,
`smtpusername` varchar(255) DEFAULT NULL, `smtpusername` varchar(255) DEFAULT NULL,
`smtppassword` varchar(255) DEFAULT NULL, `smtppassword` varchar(255) DEFAULT NULL,
`smtpusethis` int(1) NULL DEFAULT 0, `smtpusethis` int(1) NOT NULL,
`useemailaslogin` int(1) NOT NULL, `useemailaslogin` int(1) NOT NULL,
`noverify` int(1) NOT NULL, `noverify` int(1) NOT NULL,
`keywords` longtext DEFAULT NULL, `keywords` longtext DEFAULT NULL,

Binary file not shown.

View File

@ -31,3 +31,4 @@ JWT_PASSPHRASE=f7754c7a99638fe7162a144825ddaea7
# postgresql+advisory://db_user:db_password@localhost/db_name # postgresql+advisory://db_user:db_password@localhost/db_name
LOCK_DSN=flock LOCK_DSN=flock
###< symfony/lock ### ###< symfony/lock ###

View File

@ -1,2 +0,0 @@
MAILER_DSN=smtp://smtp4dev:25

View File

@ -1,40 +1,27 @@
const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet, reOrder, reOrderOrder, reOrderPos }, orderUuid) => ` const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet, reOrder, reOrderOrder, reOrderPos }, orderUuid) => `
<tr style="${psc.order.get_pos_bg_color(status)}" class="border-t border-stroke ${psc.order.get_pos_bg_color_class(status)}" id="row-${uuid}"> <div style="${psc.order.get_pos_bg_color(status)}" class="row ${psc.order.get_pos_bg_color_class(status)}" id="row-${uuid}">
<td class="px-2 py-3"></td> <div class="col-1 p-1">${pos}</div>
<td class="px-2 py-3 font-medium">${pos}</td> <div class="col-4 p-1">
<td class="px-2 py-3" colspan="2"></td> ${
<td class="px-2 py-3" colspan="2"></td> (product => product.originalProduct ? `<a href="/apps/backend/product/edit/index/${product.originalProduct.uuid}">${product.originalProduct.title}</a>` : `<a href="/apps/backend/product/edit/index/${product.uuid}">${product.title}</a>` )(product) //call the anonymous inline with the data we care about
<td class="px-2 py-3"></td> }
<td class="px-2 py-3"> <br/>ArtNr intern: ${product.nrIntern}<br/>
${ ${psc.order.get_special_product_options(product.specialProductTypeObject)}</div>
(product => product.originalProduct ? `<a href="/apps/backend/product/edit/index/${product.originalProduct.uuid}" class="text-psc-500 hover:underline">${product.originalProduct.title}</a>` : `<a href="/apps/backend/product/edit/index/${product.uuid}" class="text-psc-500 hover:underline">${product.title}</a>` )(product) <div class="col-1 p-1">Auflage: ${price.count}</div>
} <div class="col-1 p-1">Kunden Info: ${customerInfo}${(reOrder? `<br/><strong>Ist eine Nachbestellung</strong>`:``)}</div>
<br/><span class="text-xs text-gray-600">ArtNr intern: ${product.nrIntern}</span><br/> <div class="col-1 p-1">${basketField1}</div>
${psc.order.get_special_product_options(product.specialProductTypeObject)} <div class="col-1 p-1">${basketField2}</div>
</td> <div class="col-1 p-1 text-end">${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet/100)} <strong>(${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross/100)})</strong></div>
<td class="px-2 py-3"> <div class="col-2 p-2 text-end"><div class="btn-group btn-group-sm w-100">
<span class="text-xs">Auflage: ${price.count}</span> <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
</td> ${psc.order.get_pos_status(status).internalName}
<td class="px-2 py-3">
<span class="text-xs">Kunden Info: ${customerInfo}${(reOrder? `<br/><strong class="text-yellow-600">Ist eine Nachbestellung</strong>`:``)}</span>
</td>
<td class="px-2 py-3 text-right whitespace-nowrap">
${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet/100)} <br/><strong>(${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross/100)})</strong>
</td>
<td class="px-2 py-3 text-right">
<div class="relative inline-block text-left">
<button type="button" class="inline-flex justify-between items-center w-full px-3 py-1.5 text-xs font-medium text-white bg-psc-500 hover:bg-psc-600 rounded-sm shadow-sm min-w-[120px]">
${psc.order.get_pos_status(status).internalName}
<svg class="w-4 h-4 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</button> </button>
<div class="hidden absolute right-0 z-10 mt-1 w-48 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5"> <div class="dropdown-menu">
${psc.order.get_pos_status_loop(orderUuid, uuid)} ${psc.order.get_pos_status_loop(orderUuid, uuid)}
</div> </div>
</div> </div></div>
</td> <div class="col-1 p-1"></div>
</tr> </div>
`; `;
const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet }, orderUuid) => ` const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet }, orderUuid) => `
@ -58,7 +45,7 @@ const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketFiel
`; `;
const Order_List_Pos_Status = (status, orderUuid, posUuid) => ` const Order_List_Pos_Status = (status, orderUuid, posUuid) => `
<button type="button" class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 switch_pos" data-order-uuid="${orderUuid}" data-pos-uuid="${posUuid}" data-status="${status.code}">${status.internalName}</button> <button type="button" class="dropdown-item switch_pos" data-order-uuid="${orderUuid}" data-pos-uuid="${posUuid}" data-status="${status.code}">${status.internalName}</button>
`; `;
const Order_List_Pos_Calc_Option = (elm) => ` const Order_List_Pos_Calc_Option = (elm) => `
@ -104,31 +91,25 @@ export class order {
bind_buttons() { bind_buttons() {
$('.toogle_list_detail_view').off(); $('.toogle_list_detail_view').off();
$('.toogle_list_detail_view').on('click', function() { $('.toogle_list_detail_view').on('click', function() {
var uuid = $(this).data().uuid; var uuid = $(this).data().uuid;
var $icon = $(this); if($('#rows-' + uuid + ' > div').length > 0) {
if($('#rows-' + uuid).children().length > 0) {
$('#rows-' + uuid).html(''); $('#rows-' + uuid).html('');
$icon.removeClass('fa-minus').addClass('fa-plus');
}else{ }else{
psc.order.load_detail(uuid); psc.order.load_detail(uuid);
$icon.removeClass('fa-plus').addClass('fa-minus');
} }
}); });
$('.toogle_list_simple_detail_view').off(); $('.toogle_list_simple_detail_view').off();
$('.toogle_list_simple_detail_view').on('click', function() { $('.toogle_list_simple_detail_view').on('click', function() {
var uuid = $(this).data().uuid; var uuid = $(this).data().uuid;
var $icon = $(this); if($('#rows-' + uuid + ' > tr').length > 0) {
if($('#rows-' + uuid).children().length > 0) {
$('#rows-' + uuid).html(''); $('#rows-' + uuid).html('');
$icon.removeClass('fa-minus').addClass('fa-plus');
}else{ }else{
psc.order.load_detail(uuid, true); psc.order.load_detail(uuid, true);
$icon.removeClass('fa-plus').addClass('fa-minus');
} }
}); });
} }
load_detail(orderUuid, simple = false) { load_detail(orderUuid, simple = false) {

View File

@ -2,27 +2,16 @@ import "./css/backend.css"
import Alpine from 'alpinejs'; import Alpine from 'alpinejs';
import persist from '@alpinejs/persist' import persist from '@alpinejs/persist'
import $ from 'jquery' import $ from 'jquery'
import 'summernote/dist/summernote-lite.js'
import 'summernote/dist/summernote-lite.min.css'
import '../backend/dashboard/js/summernote/mediabundle.plugin.js'
import { initTabs } from 'david-ai';
import { registerVueControllerComponents } from '@symfony/ux-vue';
import { startStimulusApp } from '@symfony/stimulus-bundle';
import { order } from './js/order.js';
import { multiselect } from './js/multiselect.js';
window.$ = window.jQuery = $; window.$ = window.jQuery = $;
import { initTabs } from 'david-ai';
// Initialize tabs functionality // Initialize tabs functionality
initTabs(); initTabs();
import { registerVueControllerComponents } from '@symfony/ux-vue';
registerVueControllerComponents() registerVueControllerComponents()
import { startStimulusApp } from '@symfony/stimulus-bundle';
const app = startStimulusApp(); const app = startStimulusApp();
Alpine.plugin(persist) Alpine.plugin(persist)
// Initialize PSC global object
window.psc = window.psc || {};
window.psc.order = new order();
window.psc.multiselect = new multiselect();
Alpine.store('theme', { Alpine.store('theme', {
theme: Alpine.$persist("light").as('theme'), theme: Alpine.$persist("light").as('theme'),
@ -47,43 +36,3 @@ Alpine.store('sideBar', {
} }
}) })
Alpine.start(); Alpine.start();
// Initialize PSC modules
window.psc.order.init();
window.psc.multiselect.init();
const initSummernote = () => {
if (!$.fn?.summernote) {
return;
}
$(document).on('blur', '.note-codable', function () {
const codeviewHtml = $(this).val();
const $summernoteTextarea = $(this).closest('.note-editor').siblings('textarea');
$summernoteTextarea.val(codeviewHtml);
});
const toolbar = [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['insert', ['link', 'hr', 'image']],
['view', ['fullscreen', 'codeview']],
['help', ['help']],
];
if (typeof window.mediaBundleBrowser === 'function') {
toolbar.push(['media', ['media']]);
}
$('.summernote').summernote({
height: 400,
toolbar,
});
};
document.addEventListener('DOMContentLoaded', initSummernote);

View File

@ -57,10 +57,10 @@
} }
.badge-yes { .badge-yes {
@apply inline-flex items-center rounded-full bg-lime-500 px-2 py-1 text-xs font-medium text-white hover:bg-opacity-90 justify-center shadow-xl; @apply inline-flex rounded-sm bg-lime-500 px-2 py-1 text-sm font-medium text-white hover:bg-opacity-90 justify-center shadow-xl;
} }
.badge-no { .badge-no {
@apply inline-flex items-center rounded-full bg-orange-500 px-2 py-1 text-xs font-medium text-white hover:bg-opacity-90 justify-center shadow-xl; @apply inline-flex rounded-sm bg-orange-500 px-2 py-1 text-sm font-medium text-white hover:bg-opacity-90 justify-center shadow-xl;
} }
.table-icon, .button-icon { .table-icon, .button-icon {
@ -68,11 +68,11 @@
} }
.psc-button-save { .psc-button-save {
@apply inline-flex items-center justify-center py-1 gap-2 font-medium rounded-md px-4 text-sm text-white shadow-lg bg-psc-500 hover:bg-psc-600 hover:ring-2 hover:ring-psc-500 hover:ring-offset-2 min-h-[2.25rem]; @apply inline-flex items-center justify-center py-1 gap-1 font-medium rounded-sm px-4 text-sm text-white shadow-lg bg-psc-500 hover:bg-psc-600 hover:ring-2 hover:ring-psc-500 hover:ring-offset-2 min-h-[2.25rem];
} }
.psc-button-secondary { .psc-button-secondary {
@apply inline-flex items-center justify-center py-1 gap-2 font-medium rounded-md px-4 text-xs text-white shadow-lg bg-psc-500 hover:bg-psc-600 hover:ring-2 hover:ring-psc-500 hover:ring-offset-2 min-h-[1.8rem]; @apply inline-flex items-center justify-center py-1 gap-1 font-medium rounded-sm px-4 text-xs text-white shadow-lg bg-psc-500 hover:bg-psc-600 hover:ring-2 hover:ring-psc-500 hover:ring-offset-2 min-h-[1.8rem];
} }
.form-label { .form-label {

View File

@ -1,74 +0,0 @@
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);
});
});
}
}

View File

@ -1,307 +0,0 @@
const Order_List_Detail = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet, reOrder, reOrderOrder, reOrderPos }, orderUuid) => `
<div class="px-6 py-4 bg-gray-50" style="${psc.order.get_pos_bg_color(status)}">
<div class="grid grid-cols-12 gap-4 w-full" id="row-${uuid}">
<div class="col-span-1">
<span class="text-xs font-semibold text-gray-700">Pos:</span>
<div class="font-medium">${pos}</div>
</div>
<div class="col-span-4">
<span class="text-xs font-semibold text-gray-700">Produkt:</span>
<div>
${(product => product.originalProduct ? `<a href="/apps/backend/product/edit/index/${product.originalProduct.uuid}" class="text-psc-500 hover:underline">${product.originalProduct.title}</a>` : `<a href="/apps/backend/product/edit/index/${product.uuid}" class="text-psc-500 hover:underline">${product.title}</a>`)(product)
}
<br/><span class="text-xs text-gray-600">ArtNr intern: ${product.nrIntern}</span><br/>
${psc.order.get_special_product_options(product.specialProductTypeObject)}
</div>
</div>
<div class="col-span-2">
<span class="text-xs font-semibold text-gray-700">Auflage:</span>
<div>${price.count}</div>
</div>
<div class="col-span-2">
<span class="text-xs font-semibold text-gray-700">Kunden Info:</span>
<div class="text-sm">${customerInfo}${(reOrder ? `<br/><strong class="text-yellow-600">Ist eine Nachbestellung</strong>` : ``)}</div>
</div>
<div class="col-span-2">
<span class="text-xs font-semibold text-gray-700">Preis:</span>
<div class="text-right whitespace-nowrap">
${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet / 100)}<br/>
<strong>(${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross / 100)})</strong>
</div>
</div>
<div class="col-span-1">
<span class="text-xs font-semibold text-gray-700">Status:</span>
<div class="relative inline-block text-left w-full">
<button type="button" class="inline-flex justify-between items-center w-full px-3 py-1.5 text-xs font-medium text-white bg-psc-500 hover:bg-psc-600 rounded-sm shadow-sm">
${psc.order.get_pos_status(status).internalName}
<svg class="w-4 h-4 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</button>
<div class="hidden absolute right-0 z-10 mt-1 w-56 rounded-sm shadow-xl bg-white border border-gray-200 py-1">
${psc.order.get_pos_status_loop(orderUuid, uuid)}
</div>
</div>
</div>
</div>
</div>
`;
const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketField2, pos, price, product, status, allNet }, orderUuid) => `
<td colspan="12" class="px-6 py-4 bg-gray-50" style="${psc.order.get_pos_bg_color(status)}">
<div class="flex gap-4 w-full">
<div class="flex-none w-16">
<span class="text-xs font-semibold text-gray-700">Pos:</span>
<div class="font-medium">${pos}</div>
</div>
<div class="flex-1">
<span class="text-xs font-semibold text-gray-700">Produkt:</span>
<div>
${(product => product.originalProduct ? `<a href="/apps/backend/product/edit/index/${product.originalProduct.uuid}" class="text-psc-500 hover:underline">${product.originalProduct.title}</a>` : `<a href="/apps/backend/product/edit/index/${product.uuid}" class="text-psc-500 hover:underline">${product.title}</a>`)(product)
}
<br/><span class="text-xs text-gray-600">ArtNr intern: ${product.nrIntern}</span><br/>
${psc.order.get_special_product_options(product.specialProductTypeObject)}
</div>
</div>
<div class="flex-none w-32">
<span class="text-xs font-semibold text-gray-700">Auflage:</span>
<div>${price.count}</div>
</div>
<div class="flex-none w-48">
<span class="text-xs font-semibold text-gray-700">Kunden Info:</span>
<div class="text-sm">${customerInfo}</div>
</div>
<div class="flex-none w-32 text-right">
<span class="text-xs font-semibold text-gray-700">Preis:</span>
<div class="whitespace-nowrap">${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allNet / 100)} <strong>(${new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price.allGross / 100)})</strong></div>
</div>
<div class="flex-none w-24">
<span class="text-xs font-semibold text-gray-700">Status:</span>
<div>${psc.order.get_pos_status(status).internalName}</div>
</div>
</div>
</td>
`;
const Order_List_Pos_Status = (status, orderUuid, posUuid) => `
<button type="button" class="flex items-center w-full px-3 py-1.5 text-xs text-gray-700 hover:bg-psc-50 hover:text-psc-700 transition-colors switch_pos" data-order-uuid="${orderUuid}" data-pos-uuid="${posUuid}" data-status="${status.code}">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-3.5 h-3.5 mr-2 text-gray-400">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
${status.internalName}
</button>
`;
const Order_List_Pos_Calc_Option = (elm) => `
<tr><td>${elm.name}</td><td>${elm.value}</td></tr>
`;
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 '<table>' + specialProductTypeObject.options.map(elm => {
if (elm.type != 'hidden') {
return Order_List_Pos_Calc_Option(elm);
}
}).join('') + '</table>';
}
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 + ' td').children().length > 0) {
$('#rows-' + uuid + ' td').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 + ' td').children().length > 0) {
$('#rows-' + uuid + ' td').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 + ' td').html(result.positions.map(x => Order_List_Detail_Simple(x, orderUuid)).join(''));
} else {
$('#rows-' + result.uuid + ' td').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 + ' td').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('');
}
}

View File

@ -25,10 +25,11 @@
"cocur/slugify": "v3.1", "cocur/slugify": "v3.1",
"composer/package-versions-deprecated": "^1.8", "composer/package-versions-deprecated": "^1.8",
"ddeboer/imap": "1.21.*", "ddeboer/imap": "1.21.*",
"doctrine/annotations": "^2",
"doctrine/cache": "^2", "doctrine/cache": "^2",
"doctrine/doctrine-bundle": "^3", "doctrine/doctrine-bundle": "^2",
"doctrine/mongodb-odm-bundle": "^5", "doctrine/mongodb-odm-bundle": "^5",
"doctrine/orm": "^3", "doctrine/orm": "^2.7",
"gabrielbull/ups-api": "dev-master", "gabrielbull/ups-api": "dev-master",
"gesdinet/jwt-refresh-token-bundle": "^1.5", "gesdinet/jwt-refresh-token-bundle": "^1.5",
"gregwar/captcha-bundle": "^2.2", "gregwar/captcha-bundle": "^2.2",
@ -36,11 +37,12 @@
"horstoeko/zugferd": "^1.0", "horstoeko/zugferd": "^1.0",
"incenteev/composer-parameter-handler": "^2.0", "incenteev/composer-parameter-handler": "^2.0",
"jms/serializer-bundle": "5.*", "jms/serializer-bundle": "5.*",
"knplabs/knp-gaufrette-bundle": "0.9.*", "knplabs/knp-gaufrette-bundle": "0.7.*",
"knplabs/knp-menu-bundle": "^3", "knplabs/knp-menu-bundle": "^3",
"knplabs/knp-paginator-bundle": "6.10.*", "knplabs/knp-paginator-bundle": "5.9.*",
"lexik/form-filter-bundle": "^7",
"lexik/jwt-authentication-bundle": "^3", "lexik/jwt-authentication-bundle": "^3",
"liip/imagine-bundle": "2.16.*", "liip/imagine-bundle": "2.9.*",
"mistic100/randomcolor": "^1.1", "mistic100/randomcolor": "^1.1",
"mobiledetect/mobiledetectlib": "^2.8", "mobiledetect/mobiledetectlib": "^2.8",
"mpdf/mpdf": "dev-qrcode", "mpdf/mpdf": "dev-qrcode",
@ -48,11 +50,10 @@
"nelmio/api-doc-bundle": "^4", "nelmio/api-doc-bundle": "^4",
"nelmio/cors-bundle": "^2.2", "nelmio/cors-bundle": "^2.2",
"nicolab/php-ftp-client": "^1.4", "nicolab/php-ftp-client": "^1.4",
"oneup/uploader-bundle": "^5", "oneup/uploader-bundle": "^3",
"oyejorge/less.php": "~1.5", "oyejorge/less.php": "~1.5",
"paypal/paypal-checkout-sdk": "^1.0", "paypal/paypal-checkout-sdk": "dev-master",
"paypal/paypal-server-sdk": "^2", "paypal/rest-api-sdk-php": "dev-master",
"phenx/php-font-lib": "^1.0",
"phpoffice/phpspreadsheet": "^1.28", "phpoffice/phpspreadsheet": "^1.28",
"phpseclib/phpseclib": "~3.0", "phpseclib/phpseclib": "~3.0",
"picqer/sendcloud-php-client": "v2.8.1", "picqer/sendcloud-php-client": "v2.8.1",
@ -63,27 +64,26 @@
"ramsey/uuid": "4.5.1", "ramsey/uuid": "4.5.1",
"sauladam/shipment-tracker": "dev-master", "sauladam/shipment-tracker": "dev-master",
"scssphp/scssphp": "v1.11.1", "scssphp/scssphp": "v1.11.1",
"setasign/fpdi-tcpdf": "^2.3", "sensio/framework-extra-bundle": "^6.1",
"sofort/sofortlib-php": "3.3.2", "sofort/sofortlib-php": "3.3.2",
"spatie/array-to-xml": "^3.4", "spatie/array-to-xml": "^3.4",
"spiriitlabs/form-filter-bundle": "12.0.1",
"symfony/asset": "*", "symfony/asset": "*",
"symfony/asset-mapper": "7.4.*", "symfony/asset-mapper": "6.4.*",
"symfony/console": "*", "symfony/console": "*",
"symfony/dotenv": "*", "symfony/dotenv": "*",
"symfony/expression-language": "*", "symfony/expression-language": "*",
"symfony/flex": "^2", "symfony/flex": "^1.3.1",
"symfony/form": "*", "symfony/form": "*",
"symfony/framework-bundle": "*", "symfony/framework-bundle": "*",
"symfony/http-client": "*", "symfony/http-client": "*",
"symfony/intl": "*", "symfony/intl": "*",
"symfony/lock": "7.4.*", "symfony/lock": "6.4.*",
"symfony/mailer": "*", "symfony/mailer": "*",
"symfony/mime": "*", "symfony/mime": "*",
"symfony/monolog-bundle": "^4", "symfony/monolog-bundle": "^3.8",
"symfony/notifier": "*", "symfony/notifier": "*",
"symfony/process": "*", "symfony/process": "*",
"symfony/property-access": "7.4.*", "symfony/property-access": "6.4.4",
"symfony/property-info": "*", "symfony/property-info": "*",
"symfony/proxy-manager-bridge": "*", "symfony/proxy-manager-bridge": "*",
"symfony/runtime": "*", "symfony/runtime": "*",
@ -116,8 +116,9 @@
"maglnet/composer-require-checker": "4.*", "maglnet/composer-require-checker": "4.*",
"mockery/mockery": "^1.5", "mockery/mockery": "^1.5",
"php-parallel-lint/php-parallel-lint": "dev-develop", "php-parallel-lint/php-parallel-lint": "dev-develop",
"phpstan/phpstan": "^2.1", "phpstan/phpstan": "^1",
"phpunit/phpunit": "^10", "phpunit/phpunit": "^10",
"rector/rector": "0.19.2",
"squizlabs/php_codesniffer": "*", "squizlabs/php_codesniffer": "*",
"symfony/browser-kit": "*", "symfony/browser-kit": "*",
"symfony/css-selector": "*", "symfony/css-selector": "*",
@ -197,7 +198,7 @@
"extra": { "extra": {
"symfony": { "symfony": {
"allow-contrib": false, "allow-contrib": false,
"require": "7.4.*" "require": "6.4.*"
}, },
"public-dir": "web/" "public-dir": "web/"
} }

5229
src/new/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,13 @@ return [
Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true], Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true],
Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true], Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true], Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true], Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
Oneup\UploaderBundle\OneupUploaderBundle::class => ['all' => true], Oneup\UploaderBundle\OneupUploaderBundle::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
@ -61,5 +63,4 @@ return [
Symfonycasts\TailwindBundle\SymfonycastsTailwindBundle::class => ['all' => true], Symfonycasts\TailwindBundle\SymfonycastsTailwindBundle::class => ['all' => true],
Symfonycasts\SassBundle\SymfonycastsSassBundle::class => ['all' => true], Symfonycasts\SassBundle\SymfonycastsSassBundle::class => ['all' => true],
Symfony\UX\Vue\VueBundle::class => ['all' => true], Symfony\UX\Vue\VueBundle::class => ['all' => true],
Spiriit\Bundle\FormFilterBundle\SpiriitFormFilterBundle::class => ['all' => true],
]; ];

View File

@ -6,21 +6,23 @@ use PSC\Libraries\DoctrineBundle\ORM\Query\AST\Functions\SimpleFunction;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('doctrine', [ $containerConfigurator->extension(
'dbal' => [ 'doctrine',
'url' => '%env(resolve:DATABASE_URL)%', [
'charset' => 'utf8mb4', 'dbal' => [
'default_table_options' => ['collate' => 'utf8mb4_unicode_ci'], 'url' => '%env(resolve:DATABASE_URL)%',
'server_version' => '8.0', 'charset' => 'utf8mb4',
], 'default_table_options' => ['collate' => 'utf8mb4_unicode_ci']],
'orm' => [ 'orm' => [
'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware', 'auto_generate_proxy_classes' => true,
'auto_mapping' => true, 'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware',
'dql' => [ 'auto_mapping' => true,
'numeric_functions' => [ 'dql' => [
'month' => SimpleFunction::class, 'numeric_functions' => [
], 'month' => SimpleFunction::class
], ]
], ]
]); ]
]
);
}; };

View File

@ -5,14 +5,7 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('doctrine', ['orm' => [ $containerConfigurator->extension('doctrine', ['orm' => ['auto_generate_proxy_classes' => false, 'metadata_cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.system_cache_pool'], 'query_cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.system_cache_pool'], 'result_cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.result_cache_pool']]]);
'metadata_cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.system_cache_pool'],
'query_cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.system_cache_pool'],
'result_cache_driver' => ['type' => 'pool', 'pool' => 'doctrine.result_cache_pool'],
]]);
$containerConfigurator->extension('framework', ['cache' => ['pools' => [ $containerConfigurator->extension('framework', ['cache' => ['pools' => ['doctrine.result_cache_pool' => ['adapter' => 'cache.app'], 'doctrine.system_cache_pool' => ['adapter' => 'cache.system']]]]);
'doctrine.result_cache_pool' => ['adapter' => 'cache.app'],
'doctrine.system_cache_pool' => ['adapter' => 'cache.system'],
]]]);
}; };

View File

@ -5,56 +5,11 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('psc_shop_media', [ $containerConfigurator->extension('psc_shop_media', ['default_context' => 'default', 'contexts' => ['default' => ['providers' => ['psc.shop.media.provider.image', 'psc.shop.media.provider.file'], 'formats' => ['small' => ['width' => 100, 'quality' => 70], 'big' => ['width' => 500, 'quality' => 70]]]], 'providers' => ['image' => ['thumbnail' => 'psc.shop.media.thumbnail.liip_imagine', 'allowed_extensions' => ['jpg', 'png', 'gif', 'jpeg'], 'allowed_mime_types' => ['image/pjpeg', 'image/jpeg', 'image/png', 'image/x-png', 'image/gif']]], 'cdn' => ['server' => ['path' => '/uploads/media']], 'filesystem' => ['local' => ['directory' => '%kernel.project_dir%/web/uploads/media', 'create' => false]]]);
'default_context' => 'default',
'contexts' => ['default' => [
'providers' => ['psc.shop.media.provider.image', 'psc.shop.media.provider.file'],
'formats' => ['small' => ['width' => 100, 'quality' => 70], 'big' => ['width' => 500, 'quality' => 70]],
]],
'providers' => ['image' => [
'thumbnail' => 'psc.shop.media.thumbnail.liip_imagine',
'allowed_extensions' => ['jpg', 'png', 'gif', 'jpeg'],
'allowed_mime_types' => ['image/pjpeg', 'image/jpeg', 'image/png', 'image/x-png', 'image/gif'],
]],
'cdn' => ['server' => ['path' => '/uploads/media']],
'filesystem' => ['local' => ['directory' => '%kernel.project_dir%/web/uploads/media', 'create' => false]],
]);
$containerConfigurator->extension('knp_gaufrette', [ $containerConfigurator->extension('knp_gaufrette', ['stream_wrapper' => null, 'adapters' => ['backend_articles' => ['safe_local' => ['directory' => '%kernel.project_dir%/web/uploads/backend_articles', 'create' => true]], 'steplayouter_motiv_guest' => ['local' => ['directory' => '%kernel.project_dir%/web/uploads/steplayouter_motiv_guest', 'create' => true]], 'steplayouter_motiv' => ['local' => ['directory' => '%kernel.project_dir%/web/market/motive/', 'create' => true]]], 'filesystems' => ['backend_articles' => ['adapter' => 'backend_articles', 'alias' => 'backend_articles_filesystem'], 'steplayouter_motiv_guest' => ['adapter' => 'steplayouter_motiv_guest'], 'steplayouter_motiv' => ['adapter' => 'steplayouter_motiv']]]);
'stream_wrapper' => null,
'adapters' => [
'backend_articles' => ['safe_local' => [
'directory' => '%kernel.project_dir%/web/uploads/backend_articles',
'create' => true,
]],
'steplayouter_motiv_guest' => ['local' => [
'directory' => '%kernel.project_dir%/web/uploads/steplayouter_motiv_guest',
'create' => true,
]],
'steplayouter_motiv' => ['local' => [
'directory' => '%kernel.project_dir%/web/market/motive/',
'create' => true,
]],
],
'filesystems' => [
'backend_articles' => ['adapter' => 'backend_articles', 'alias' => 'backend_articles_filesystem'],
'steplayouter_motiv_guest' => ['adapter' => 'steplayouter_motiv_guest'],
'steplayouter_motiv' => ['adapter' => 'steplayouter_motiv'],
],
]);
$containerConfigurator->extension('knp_paginator', [ $containerConfigurator->extension('knp_paginator', ['page_range' => 5, 'default_options' => ['page_name' => 'page', 'sort_field_name' => 'sort', 'sort_direction_name' => 'direction', 'distinct' => true], 'template' => ['pagination' => '@PSCBackendDashboard/pagination/bootstrap4.html.twig']]);
'page_range' => 5,
'default_options' => [
'page_name' => 'page',
'sort_field_name' => 'sort',
'sort_direction_name' => 'direction',
'distinct' => true,
],
'template' => ['pagination' => '@PSCBackendDashboard/pagination/bootstrap4.html.twig'],
]);
$containerConfigurator->extension('spiriit_form_filter', ['listeners' => [ $containerConfigurator->extension('lexik_form_filter', ['listeners' => ['doctrine_orm' => true, 'doctrine_dbal' => true, 'doctrine_mongodb' => true]]);
'doctrine_orm' => true,
]]);
}; };

View File

@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('sensio_framework_extra', ['router' => ['annotations' => false], 'request' => ['converters' => true, 'disable' => ['doctrine.orm', 'datetime']]]);
};

File diff suppressed because it is too large Load Diff

View File

@ -53,14 +53,14 @@ return static function (RoutingConfigurator $routingConfigurator): void {
$routingConfigurator->import('@PSCShopCreateBundle/Resources/config/routing.yml'); $routingConfigurator->import('@PSCShopCreateBundle/Resources/config/routing.yml');
$routingConfigurator->import('@PSCComponentSteplayouterBundle/Controller/', 'attribute')->prefix('/'); $routingConfigurator->import('@PSCComponentSteplayouterBundle/Controller/', 'annotation')->prefix('/');
$routingConfigurator $routingConfigurator
->import('@PSCComponentSteplayouterBundle/Controller/System', 'attribute') ->import('@PSCComponentSteplayouterBundle/Controller/System', 'annotation')
->prefix('/step/system'); ->prefix('/step/system');
$routingConfigurator $routingConfigurator
->import('@PSCComponentConfigurationlayouterBundle/Controller/', 'attribute') ->import('@PSCComponentConfigurationlayouterBundle/Controller/', 'annotation')
->prefix('/psc/component'); ->prefix('/psc/component');
$routingConfigurator->import('.', 'plugin'); $routingConfigurator->import('.', 'plugin');

View File

@ -5,5 +5,5 @@ declare(strict_types=1);
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return static function (RoutingConfigurator $routingConfigurator): void { return static function (RoutingConfigurator $routingConfigurator): void {
$routingConfigurator->import('../../src/PSC/Kernel.php', 'attribute'); $routingConfigurator->import('../../src/PSC/Kernel.php', 'annotation');
}; };

View File

@ -20,11 +20,11 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services(); $services = $containerConfigurator->services();
$services->defaults()->autowire()->autoconfigure(); $services->defaults()
->autowire()
->autoconfigure();
/* $services $services->set('liip_imagine.data.loader.stream.steplayouter_motiv_guest', StreamLoader::class)
* ->set('liip_imagine.data.loader.stream.steplayouter_motiv_guest', StreamLoader::class) ->args([service('liip_imagine'), 'gaufrette://steplayouter_motiv_guest/'])
* ->args([service('liip_imagine'), 'gaufrette://steplayouter_motiv_guest/'])->tag('liip_imagine.data.loader', [ ->tag('liip_imagine.data.loader', ['loader' => 'stream.steplayouter_motiv_guest']);
* 'loader' => 'stream.steplayouter_motiv_guest',
* ]);*/
}; };

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ PSC\Shop\EntityBundle\Entity\Product:
pos: <numberBetween(1, 200)> pos: <numberBetween(1, 200)>
notEdit: false notEdit: false
private: false private: false
mwert: 19 taxClass: 19
price: 0 price: 0
set_config: '{}' set_config: '{}'
shop: '@shop_1' shop: '@shop_1'
@ -23,7 +23,7 @@ PSC\Shop\EntityBundle\Entity\Product:
notEdit: false notEdit: false
pos: <numberBetween(1, 200)> pos: <numberBetween(1, 200)>
private: false private: false
mwert: 19 taxClass: 19
price: 0 price: 0
set_config: '{}' set_config: '{}'
shop: '@shop_1' shop: '@shop_1'
@ -37,7 +37,7 @@ PSC\Shop\EntityBundle\Entity\Product:
notEdit: false notEdit: false
pos: <numberBetween(1, 200)> pos: <numberBetween(1, 200)>
private: false private: false
mwert: 19 taxClass: 19
price: 0 price: 0
set_config: '\[{"article_id": "7996f00d-a5e6-4915-970d-9f7c4287cd92"}, {"article_id": "7996f00d-a5e6-4915-970d-9f7c4287cd91"} ]' set_config: '\[{"article_id": "7996f00d-a5e6-4915-970d-9f7c4287cd92"}, {"article_id": "7996f00d-a5e6-4915-970d-9f7c4287cd91"} ]'
shop: '@shop_1' shop: '@shop_1'
@ -51,7 +51,7 @@ PSC\Shop\EntityBundle\Entity\Product:
type: 2 type: 2
pos: <numberBetween(1, 200)> pos: <numberBetween(1, 200)>
private: false private: false
mwert: 19 taxClass: 19
price: 20 price: 20
set_config: '{}' set_config: '{}'
shop: '@shop_1' shop: '@shop_1'
@ -65,7 +65,7 @@ PSC\Shop\EntityBundle\Entity\Product:
pos: <numberBetween(1, 200)> pos: <numberBetween(1, 200)>
notEdit: false notEdit: false
private: false private: false
mwert: 19 taxClass: 19
set_config: '{}' set_config: '{}'
shop: '@shop_1' shop: '@shop_1'
calcXml: > calcXml: >
@ -116,7 +116,7 @@ PSC\Shop\EntityBundle\Entity\Product:
pos: <numberBetween(1, 200)> pos: <numberBetween(1, 200)>
notEdit: false notEdit: false
private: false private: false
mwert: 19 taxClass: 19
set_config: '{}' set_config: '{}'
shop: '@shop_1' shop: '@shop_1'
calcXml: > calcXml: >

View File

@ -9,7 +9,7 @@ PSC\Shop\EntityBundle\Entity\Voucher:
code: 5f code: 5f
mode: 1 mode: 1
fromDate: <(new DateTime("2023-12-12"))> fromDate: <(new DateTime("2023-12-12"))>
toDate: <(new DateTime("2026-12-12"))> toDate: <(new DateTime("2025-12-12"))>
value: 5 value: 5
shop: '@shop_1' shop: '@shop_1'
voucher_2: voucher_2:
@ -22,7 +22,7 @@ PSC\Shop\EntityBundle\Entity\Voucher:
code: 5p code: 5p
mode: 1 mode: 1
fromDate: <(new DateTime("2023-12-12"))> fromDate: <(new DateTime("2023-12-12"))>
toDate: <(new DateTime("2026-12-12"))> toDate: <(new DateTime("2025-12-12"))>
value: 5 value: 5
shop: '@shop_1' shop: '@shop_1'
voucher_3: voucher_3:
@ -37,7 +37,7 @@ PSC\Shop\EntityBundle\Entity\Voucher:
zeroShipping: false zeroShipping: false
mode: 1 mode: 1
fromDate: <(new DateTime("2023-12-12"))> fromDate: <(new DateTime("2023-12-12"))>
toDate: <(new DateTime("2026-12-12"))> toDate: <(new DateTime("2025-12-12"))>
value: 0 value: 0
shop: '@shop_1' shop: '@shop_1'
voucher_4: voucher_4:
@ -52,7 +52,7 @@ PSC\Shop\EntityBundle\Entity\Voucher:
zeroShipping: true zeroShipping: true
mode: 1 mode: 1
fromDate: <(new DateTime("2023-12-12"))> fromDate: <(new DateTime("2023-12-12"))>
toDate: <(new DateTime("2026-12-12"))> toDate: <(new DateTime("2025-12-12"))>
value: 0 value: 0
shop: '@shop_1' shop: '@shop_1'

View File

@ -1,5 +0,0 @@
parameters:
level: 7
paths:
- src

View File

@ -1780,7 +1780,7 @@ CREATE TABLE `shop` (
`smtphostname` varchar(255) NOT NULL, `smtphostname` varchar(255) NOT NULL,
`smtpusername` varchar(255) NOT NULL, `smtpusername` varchar(255) NOT NULL,
`smtppassword` varchar(255) NOT NULL, `smtppassword` varchar(255) NOT NULL,
`smtpusethis` int(1) NULL DEFAULT 0, `smtpusethis` int(1) NOT NULL,
`useemailaslogin` int(1) NOT NULL, `useemailaslogin` int(1) NOT NULL,
`noverify` int(1) NOT NULL, `noverify` int(1) NOT NULL,
`keywords` longtext, `keywords` longtext,

View File

@ -20,11 +20,11 @@ use PSC\Shop\QueueBundle\Service\Queue\Manager;
use PSC\System\SettingsBundle\Service\Instance; use PSC\System\SettingsBundle\Service\Instance;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use PSC\System\UpdateBundle\Service\Migration; use PSC\System\UpdateBundle\Service\Migration;
use Symfony\Bridge\Twig\Attribute\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Intl\NumberFormatter\NumberFormatter; use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\UX\Chartjs\Builder\ChartBuilderInterface; use Symfony\UX\Chartjs\Builder\ChartBuilderInterface;
use Symfony\UX\Chartjs\Model\Chart; use Symfony\UX\Chartjs\Model\Chart;
@ -47,52 +47,24 @@ class DashboardController extends AbstractController
* @return array|View|\Symfony\Component\HttpFoundation\RedirectResponse * @return array|View|\Symfony\Component\HttpFoundation\RedirectResponse
* @throws \Doctrine\ORM\ORMException * @throws \Doctrine\ORM\ORMException
*/ */
#[IsGranted('ROLE_SHOP')] #[Security("is_granted('ROLE_SHOP')")]
#[Route(path: '/dashboard', name: 'psc_backend_dashboard_index')] #[Route(path: '/dashboard', name: 'psc_backend_dashboard_index')]
#[Template('@PSCBackendDashboard/dashboard/index.html.twig')] #[Template]
public function indexAction( public function indexAction(Migration $migration, Shop $shop, EntityManagerInterface $entityManager, Manager $queueService, Instance $instanceService, ChartBuilderInterface $chartBuilder, ContactRepository $contactRepository, Order $orderService)
Migration $migration, {
Shop $shop,
EntityManagerInterface $entityManager,
Manager $queueService,
Instance $instanceService,
ChartBuilderInterface $chartBuilder,
ContactRepository $contactRepository,
Order $orderService,
) {
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$selectedShop = $shop->getSelectedShop(); $selectedShop = $shop->getSelectedShop();
$year1 = date('Y'); $year1 = date("Y");
$year2 = date('Y') - 1; $year2 = date("Y") - 1;
$year3 = date('Y') - 2; $year3 = date("Y") - 2;
$tempSales1 = array_column( $tempSales1 = array_column($entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop($selectedShop->getUid(), $year1), 'brutto', 'monat');
$entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop( $tempSales2 = array_column($entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop($selectedShop->getUid(), $year2), 'brutto', 'monat');
$selectedShop->getUid(), $tempSales3 = array_column($entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop($selectedShop->getUid(), $year3), 'brutto', 'monat');
$year1,
),
'brutto',
'monat',
);
$tempSales2 = array_column(
$entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop(
$selectedShop->getUid(),
$year2,
),
'brutto',
'monat',
);
$tempSales3 = array_column(
$entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop(
$selectedShop->getUid(),
$year3,
),
'brutto',
'monat',
);
$fmt = new \NumberFormatter(locale_get_default(), \NumberFormatter::CURRENCY); $fmt = new \NumberFormatter(locale_get_default(), \NumberFormatter::CURRENCY);
$sales1 = []; $sales1 = array();
$sales2 = []; $sales2 = array();
$sales3 = []; $sales3 = array();
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
if (isset($tempSales1[$i])) { if (isset($tempSales1[$i])) {
$sales1[] = round($tempSales1[$i]); $sales1[] = round($tempSales1[$i]);
@ -112,20 +84,7 @@ class DashboardController extends AbstractController
} }
$chart = $chartBuilder->createChart(Chart::TYPE_LINE); $chart = $chartBuilder->createChart(Chart::TYPE_LINE);
$chart->setData([ $chart->setData([
'labels' => [ 'labels' => ['Januar', 'Februar', 'März', 'April', 'May', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
'Januar',
'Februar',
'März',
'April',
'May',
'Juni',
'Juli',
'August',
'September',
'Oktober',
'November',
'Dezember',
],
'datasets' => [ 'datasets' => [
[ [
'label' => $year1, 'label' => $year1,
@ -154,18 +113,19 @@ class DashboardController extends AbstractController
'maintainAspectRatio' => false, 'maintainAspectRatio' => false,
]); ]);
if ($migration->checkIfMigrationMustRun()) { if ($migration->checkIfMigrationMustRun()) {
return $this->redirectToRoute('psc_system_update_migration_do'); return $this->redirectToRoute('psc_system_update_migration_do');
} }
return [ return array(
'user' => $this->getUser(), 'user' => $this->getUser(),
'shop' => $selectedShop, 'shop' => $selectedShop,
'lastContacts' => $contactRepository->getLastCreatedContacts($selectedShop, 10), 'lastContacts' => $contactRepository->getLastCreatedContacts($selectedShop, 10),
'lastOrders' => $orderService->getLastOrders(), 'lastOrders' => $orderService->getLastOrders(),
'queueErrorCount' => $queueService->getErrorJobCount(), 'queueErrorCount' => $queueService->getErrorJobCount(),
'instance' => $instanceService->getInstance(), 'instance' => $instanceService->getInstance(),
'chart' => $chart, 'chart' => $chart
]; );
} }
} }

View File

@ -15,9 +15,9 @@ namespace PSC\Backend\DashboardBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
/** /**
* DefaultController fürs ProductionBundle * DefaultController fürs ProductionBundle
@ -34,7 +34,7 @@ class DefaultController extends AbstractController
* @return View * @return View
*/ */
#[Route(path: '/', name: 'psc_backend_default_index')] #[Route(path: '/', name: 'psc_backend_default_index')]
#[Template('@PSCBackendDashboard/default/index.html.twig')] #[Template]
public function indexAction() public function indexAction()
{ {
return $this->redirect($this->generateUrl("psc_backend_dashboard_index")); return $this->redirect($this->generateUrl("psc_backend_dashboard_index"));

View File

@ -16,16 +16,16 @@ namespace PSC\Backend\DashboardBundle\Controller;
use Http\Message\Authentication; use Http\Message\Authentication;
use PSC\System\UpdateBundle\Service\Migration; use PSC\System\UpdateBundle\Service\Migration;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class LoginController extends AbstractController class LoginController extends AbstractController
{ {
#[Route(path: '/login', name: 'psc_backend_login')] #[Route(path: '/login', name: 'psc_backend_login')]
#[Template('@PSCBackendDashboard/login/index.html.twig')] #[Template]
public function indexAction(Migration $migration, AuthenticationUtils $authenticationUtils) public function indexAction(Migration $migration, AuthenticationUtils $authenticationUtils)
{ {
if ($migration->checkIfMigrationMustRun()) { if ($migration->checkIfMigrationMustRun()) {

View File

@ -17,97 +17,103 @@ use Doctrine\ORM\EntityManagerInterface;
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface; use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
use PSC\Shop\EntityBundle\Entity\Domain; use PSC\Shop\EntityBundle\Entity\Domain;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use Symfony\Bridge\Twig\Attribute\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
/**
* ShopController fürs ProductionBundle
*
* @package PSC\Backend\Production
* @subpackage Controller
*/
class ShopController extends AbstractController class ShopController extends AbstractController
{ {
#[IsGranted('ROLE_SHOP')] #[Security("is_granted('ROLE_SHOP')")]
#[Template('@PSCBackendDashboard/shop/my_editable_shops.html.twig')] #[Template]
public function myEditableShopsAction( public function myEditableShopsAction(Request $request, Shop $shop, JWTTokenManagerInterface $jwtManager, EntityManagerInterface $entityManager)
Request $request,
Shop $shop,
JWTTokenManagerInterface $jwtManager,
EntityManagerInterface $entityManager,
) {
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$selectedShop = $shop->getSelectedShop();
$shops = $shop->getMyEditableShops();
$domains = $entityManager->getRepository(Domain::class)->getAllByShopId($selectedShop);
if (count($domains) > 0) {
$domain = array_pop($domains)->getHost();
} else {
$domain = false;
}
return [
'domain' => $domain,
'shops' => $shops,
'jwt' => $jwtManager->create($this->getUser()),
'selectedShop' => $selectedShop,
'displayDeletedShop' => $request->getSession()->get('displayDeletedShop', false),
];
}
#[IsGranted('ROLE_SHOP')]
#[Template('@PSCBackendDashboard/shop/my_editable_shops_tailwind.html.twig')]
public function myEditableShopsTailwindAction(
Request $request,
Shop $shop,
JWTTokenManagerInterface $jwtManager,
EntityManagerInterface $entityManager,
) {
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$selectedShop = $shop->getSelectedShop();
$shops = $shop->getMyEditableShops();
$domains = $entityManager->getRepository(Domain::class)->getAllByShopId($selectedShop);
if (count($domains) > 0) {
$domain = array_pop($domains)->getHost();
} else {
$domain = false;
}
return [
'domain' => $domain,
'shops' => $shops,
'jwt' => $jwtManager->create($this->getUser()),
'selectedShop' => $selectedShop,
'displayDeletedShop' => $request->getSession()->get('displayDeletedShop', false),
];
}
#[IsGranted('ROLE_SHOP')]
#[Route(path: '/shop/change/{shop_uuid}', name: 'psc_backend_dashboard_shop_change')]
public function changeShopAction(Request $request, EntityManagerInterface $em, Security $security, $shop_uuid)
{ {
$em->getRepository('PSC\Shop\EntityBundle\Entity\ShopContact')->changeSelectedShop(
$security->getUser(), /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$shop_uuid, $selectedShop = $shop->getSelectedShop();
); $shops = $shop->getMyEditableShops();
$domains = $entityManager
->getRepository(Domain::class)->getAllByShopId($selectedShop);
if (count($domains) > 0) {
$domain = array_pop($domains)->getHost();
} else {
$domain = false;
}
return array('domain' => $domain, 'shops' => $shops, 'jwt' => $jwtManager->create($this->getUser()), 'selectedShop' => $selectedShop, 'displayDeletedShop' => $request->getSession()->get('displayDeletedShop', false));
}
#[Security("is_granted('ROLE_SHOP')")]
#[Template]
public function myEditableShopsTailwindAction(Request $request, Shop $shop, JWTTokenManagerInterface $jwtManager, EntityManagerInterface $entityManager)
{
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$selectedShop = $shop->getSelectedShop();
$shops = $shop->getMyEditableShops();
$domains = $entityManager
->getRepository(Domain::class)->getAllByShopId($selectedShop);
if (count($domains) > 0) {
$domain = array_pop($domains)->getHost();
} else {
$domain = false;
}
return array('domain' => $domain, 'shops' => $shops, 'jwt' => $jwtManager->create($this->getUser()), 'selectedShop' => $selectedShop, 'displayDeletedShop' => $request->getSession()->get('displayDeletedShop', false));
}
/**
* Change Shop
*
*
* @param Request $request
* @param EntityManagerInterface $em
* @param \Symfony\Component\Security\Core\Security $security
* @param $shop_uuid
* @return RedirectResponse
*/
#[Security("is_granted('ROLE_SHOP')")]
#[Route(path: '/shop/change/{shop_uuid}', name: 'psc_backend_dashboard_shop_change')]
public function changeShopAction(Request $request, EntityManagerInterface $em, \Symfony\Component\Security\Core\Security $security, $shop_uuid)
{
$em
->getRepository('PSC\Shop\EntityBundle\Entity\ShopContact')
->changeSelectedShop($security->getUser(), $shop_uuid);
$request->getSession()->set('selectedShop', $shop_uuid); $request->getSession()->set('selectedShop', $shop_uuid);
return $this->redirect($this->generateUrl('psc_backend_dashboard_index')); return $this->redirect($this->generateUrl('psc_backend_dashboard_index'));
} }
#[IsGranted('ROLE_SHOP')] /**
* Change Shop
*
*
* @param Request $request
* @param EntityManagerInterface $em
* @param \Symfony\Component\Security\Core\Security $security
* @param Shop $shopService
* @return RedirectResponse
* @throws \Doctrine\ORM\ORMException
*/
#[Security("is_granted('ROLE_SHOP')")]
#[Route(path: '/shop/deleted/toogle', name: 'psc_backend_dashboard_toogle_deleted_shop')] #[Route(path: '/shop/deleted/toogle', name: 'psc_backend_dashboard_toogle_deleted_shop')]
public function toogleDisplayDeletedShopAction( public function toogleDisplayDeletedShopAction(Request $request, EntityManagerInterface $em, \Symfony\Component\Security\Core\Security $security, Shop $shopService)
Request $request, {
EntityManagerInterface $em,
Security $security,
Shop $shopService,
) {
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$selectedShop = $shopService->getSelectedShop(); $selectedShop = $shopService->getSelectedShop();
if (!!$request->getSession()->get('displayDeletedShop', false) && $selectedShop->isDeleted()) { if (!!$request->getSession()->get('displayDeletedShop', false) && $selectedShop->isDeleted()) {
$shops = $em->getRepository( $shops = $em
'PSC\Shop\EntityBundle\Entity\ShopContact', ->getRepository('PSC\Shop\EntityBundle\Entity\ShopContact')->myEditableShopsWithNoDeleted($security->getUser());
)->myEditableShopsWithNoDeleted($security->getUser());
$request->getSession()->set('selectedShop', $shops[0]->getUid()); $request->getSession()->set('selectedShop', $shops[0]->getUid());
} }
$request->getSession()->set('displayDeletedShop', !$request->getSession()->get('displayDeletedShop', false)); $request->getSession()->set('displayDeletedShop', !$request->getSession()->get('displayDeletedShop', false));

View File

@ -11,17 +11,17 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class IconButtonExtension extends AbstractTypeExtension class IconButtonExtension extends AbstractTypeExtension
{ {
public function buildView(FormView $view, FormInterface $form, array $options): void public function buildView(FormView $view, FormInterface $form, array $options)
{ {
$view->vars['icon_before'] = $options['icon_before'] ? $options['icon_before'] : ''; $view->vars['icon_before'] = $options['icon_before'] ? $options['icon_before'] : '';
$view->vars['icon_after'] = $options['icon_after'] ? $options['icon_after'] : ''; $view->vars['icon_after'] = $options['icon_after'] ? $options['icon_after'] : '';
} }
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'icon_before' => null, 'icon_before' => null,
'icon_after' => null, 'icon_after' => null
]); ]);
} }

View File

@ -1,4 +1,4 @@
psc_backend_dashboard: psc_backend_dashboard:
resource: "@PSCBackendDashboardBundle/Controller/" resource: "@PSCBackendDashboardBundle/Controller/"
type: attribute type: annotation
prefix: /backend prefix: /backend

View File

@ -30,9 +30,9 @@ use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
@ -65,8 +65,8 @@ class ListController extends \Symfony\Bundle\FrameworkBundle\Controller\Abstract
* @throws \Doctrine\ORM\ORMException * @throws \Doctrine\ORM\ORMException
*/ */
#[Route(path: '/list/index', name: 'psc_backend_domain_list_index')] #[Route(path: '/list/index', name: 'psc_backend_domain_list_index')]
#[Template('@PSCBackendDomain/backend/list/index.html.twig')] #[Template]
#[IsGranted('ROLE_SHOP')] #[Security("is_granted('ROLE_SHOP')")]
public function indexAction(Request $request, Shop $shopService, DocumentManager $mongoService, EntityManagerInterface $em, DomainSync $sync) public function indexAction(Request $request, Shop $shopService, DocumentManager $mongoService, EntityManagerInterface $em, DomainSync $sync)
{ {
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
@ -101,7 +101,7 @@ class ListController extends \Symfony\Bundle\FrameworkBundle\Controller\Abstract
* *
*/ */
#[Route(path: '/list/sync', name: 'psc_backend_domain_list_sync')] #[Route(path: '/list/sync', name: 'psc_backend_domain_list_sync')]
#[IsGranted('ROLE_SHOP')] #[Security("is_granted('ROLE_SHOP')")]
public function syncAction(DomainSync $sync) public function syncAction(DomainSync $sync)
{ {
$sync->syncDomains(); $sync->syncDomains();
@ -120,7 +120,7 @@ class ListController extends \Symfony\Bundle\FrameworkBundle\Controller\Abstract
* @throws \Doctrine\ORM\ORMException * @throws \Doctrine\ORM\ORMException
*/ */
#[Route(path: '/list/delete/{uid}', name: 'psc_backend_domain_list_delete')] #[Route(path: '/list/delete/{uid}', name: 'psc_backend_domain_list_delete')]
#[IsGranted('ROLE_SHOP')] #[Security("is_granted('ROLE_SHOP')")]
public function deleteAction(Shop $shopService, EntityManagerInterface $entityManager, DocumentManager $mongoManager, $uid) public function deleteAction(Shop $shopService, EntityManagerInterface $entityManager, DocumentManager $mongoManager, $uid)
{ {
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */

View File

@ -1,4 +1,4 @@
psc_backend_domain: psc_backend_domain:
resource: "@PSCBackendDomainBundle/Controller/Backend" resource: "@PSCBackendDomainBundle/Controller/Backend"
type: attribute type: annotation
prefix: /backend/domain prefix: /backend/domain

View File

@ -4,9 +4,9 @@ namespace PSC\Backend\ToolsBundle\Controller\Backend;
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface; use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
use PSC\Backend\ToolsBundle\Service\ExporterRegistry; use PSC\Backend\ToolsBundle\Service\ExporterRegistry;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -25,9 +25,9 @@ class ExporterController extends AbstractController
* @param ExporterRegistry $registry * @param ExporterRegistry $registry
* @return array * @return array
*/ */
#[Template('@PSCBackendTools/backend/exporter/list.html.twig')] #[Template]
#[Route(path: '/list', name: 'psc_backend_tools_exporter_list_index')] #[Route(path: '/list', name: 'psc_backend_tools_exporter_list_index')]
#[IsGranted('ROLE_SHOP')] #[Security("is_granted('ROLE_SHOP')")]
public function listAction(ExporterRegistry $registry) public function listAction(ExporterRegistry $registry)
{ {
return array('exporters' => $registry->all()); return array('exporters' => $registry->all());
@ -41,8 +41,8 @@ class ExporterController extends AbstractController
* @return array * @return array
*/ */
#[Route(path: '/{type}/export', name: 'psc_backend_tools_exporter_form')] #[Route(path: '/{type}/export', name: 'psc_backend_tools_exporter_form')]
#[IsGranted('ROLE_SHOP')] #[Security("is_granted('ROLE_SHOP')")]
#[Template('@PSCBackendTools/backend/exporter/form.html.twig')] #[Template]
public function formAction(Request $request, ExporterRegistry $registry, $type) public function formAction(Request $request, ExporterRegistry $registry, $type)
{ {
if (!$registry->has($type)) { if (!$registry->has($type)) {

View File

@ -5,9 +5,9 @@ namespace PSC\Backend\ToolsBundle\Controller\Backend;
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface; use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
use PSC\Backend\ToolsBundle\Service\ImporterRegistry; use PSC\Backend\ToolsBundle\Service\ImporterRegistry;
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -23,9 +23,9 @@ class ImporterController extends AbstractController
dump($importer);die(); dump($importer);die();
} }
#[Template('@PSCBackendTools/backend/importer/list.html.twig')] #[Template]
#[Route(path: '/list', name: 'psc_backend_tools_importer_list_index')] #[Route(path: '/list', name: 'psc_backend_tools_importer_list_index')]
#[IsGranted('ROLE_SHOP')] #[Security("is_granted('ROLE_SHOP')")]
public function listAction(ImporterRegistry $registry) public function listAction(ImporterRegistry $registry)
{ {
return array('exporters' => $registry->all()); return array('exporters' => $registry->all());

View File

@ -8,7 +8,6 @@ use LogicException;
use Port\Csv\CsvWriter; use Port\Csv\CsvWriter;
use Port\Reader\ArrayReader; use Port\Reader\ArrayReader;
use PSC\Backend\ToolsBundle\Export\Writer\ExcelWriter; use PSC\Backend\ToolsBundle\Export\Writer\ExcelWriter;
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface; use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface;
use PSC\Backend\ToolsBundle\Service\ExporterRegistry; use PSC\Backend\ToolsBundle\Service\ExporterRegistry;
use PSC\Shop\EntityBundle\Entity\Contact; use PSC\Shop\EntityBundle\Entity\Contact;
@ -23,19 +22,15 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Validator\Constraints\Date; use Symfony\Component\Validator\Constraints\Date;
use Symfony\Component\Validator\Constraints\DateTime; use Symfony\Component\Validator\Constraints\DateTime;
class ContactExporter implements ExporterInterface, ConfigurableElementInterface class ContactExporter implements ExporterInterface
{ {
private $_formFactory = null; private $_formFactory = null;
private $_entityManager = null; private $_entityManager = null;
private $_shopService = null; private $_shopService = null;
/** @var Form */ /** @var Form */
private $_form = null; private $_form = null;
public function __construct(FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, Shop $shopService)
public function __construct( {
FormFactoryInterface $formFactory,
EntityManagerInterface $entityManager,
Shop $shopService,
) {
$this->_formFactory = $formFactory; $this->_formFactory = $formFactory;
$this->_entityManager = $entityManager; $this->_entityManager = $entityManager;
$this->_shopService = $shopService; $this->_shopService = $shopService;
@ -56,11 +51,6 @@ class ContactExporter implements ExporterInterface, ConfigurableElementInterface
public function getForm(FormBuilderInterface $builder, $form_options) public function getForm(FormBuilderInterface $builder, $form_options)
{ {
$builder->add('fotos', CheckboxType::class, ['required' => false, 'label' => 'Fotos mit exportieren?']);
$builder->add('fotosFolder', TextType::class, [
'required' => false,
'label' => 'Pfad für die Fotos z.B.: /data/www/old/data/packages/fotos/{{ media.uuid }}.{{media.extension}}',
]);
} }
public function getGroup() public function getGroup()
@ -78,12 +68,9 @@ class ContactExporter implements ExporterInterface, ConfigurableElementInterface
*/ */
public function export() public function export()
{ {
$formData = $this->_form->getData(); $rows = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->getContactsByShop($this->_shopService->getSelectedShop());
$rows = $this->_entityManager $temp = array();
->getRepository('PSC\Shop\EntityBundle\Entity\Contact') $temp[] = array(
->getContactsByShop($this->_shopService->getSelectedShop());
$temp = [];
$temp[] = [
'id' => 'id', 'id' => 'id',
'uid' => 'uid', 'uid' => 'uid',
'account_id' => 'account_id', 'account_id' => 'account_id',
@ -121,21 +108,19 @@ class ContactExporter implements ExporterInterface, ConfigurableElementInterface
'alternativAppendix' => 'alternativAppendix', 'alternativAppendix' => 'alternativAppendix',
'alternativ' => 'alternativ', 'alternativ' => 'alternativ',
'alternativType' => 'alternativType', 'alternativType' => 'alternativType',
'birthday' => 'birthday', 'birthday' => 'birthday'
'image1' => 'image1', );
'image2' => 'image2',
];
foreach ($rows as $row) { foreach ($rows as $row) {
/** @var Contact $contact */ /** @var Contact $contact */
$contact = $row->getContact(); $contact = $row->getContact();
$temp[] = [ $temp[] = array(
'id' => $contact->getId(), 'id' => $contact->getId(),
'uid' => $contact->getId(), 'uid' => $contact->getId(),
'account_id' => $contact->getAccount() ? ((string) $contact->getAccount()->getId()) : 0, 'account_id' => ($contact->getAccount() ? (string)$contact->getAccount()->getId() : 0),
'account_title' => $contact->getAccount() ? ((string) $contact->getAccount()->getTitle()) : 0, 'account_title' => ($contact->getAccount() ? (string)$contact->getAccount()->getTitle() : 0),
'enable' => (int) $contact->isEnable(), 'enable' => (int)$contact->isEnable(),
'locked' => (int) $contact->isLocked(), 'locked' => (int)$contact->isLocked(),
'virtual' => (int) $contact->isVirtual(), 'virtual' => (int)$contact->isVirtual(),
'username' => $contact->getUsername(), 'username' => $contact->getUsername(),
'firstname' => $contact->getFirstname(), 'firstname' => $contact->getFirstname(),
'lastname' => $contact->getLastname(), 'lastname' => $contact->getLastname(),
@ -166,22 +151,15 @@ class ContactExporter implements ExporterInterface, ConfigurableElementInterface
'alternativAppendix' => $contact->getAlternativAppendix(), 'alternativAppendix' => $contact->getAlternativAppendix(),
'alternativ' => $contact->getAlternativ(), 'alternativ' => $contact->getAlternativ(),
'alternativType' => $contact->getAlternativType(), 'alternativType' => $contact->getAlternativType(),
'birthday' => $contact->getBirthday(), 'birthday' => $contact->getBirthday()
'image1' => $contact->getImage1() ?? '', );
'image2' => $contact->getImage2() ?? '',
];
if ($formData['fotos'] && $contact->getImage1() != '') {
$this->mediaManager->copyMediaToFolder($contact->getImage1(), $formData['fotosFolder']);
}
if ($formData['fotos'] && $contact->getImage2() != '') {
$this->mediaManager->copyMediaToFolder($contact->getImage2(), $formData['fotosFolder']);
}
} }
$reader = new ArrayReader($temp); $reader = new ArrayReader($temp);
$writer = new CsvWriter(); $writer = new CsvWriter();
$writer->setStream(fopen('php://output', 'w')); $writer->setStream(fopen('php://output', 'w'));
$response = new StreamedResponse(function () use ($reader, $writer) { $response = new StreamedResponse(function () use ($reader, $writer) {
foreach ($reader as $row) { foreach ($reader as $row) {
$writer->writeItem($row); $writer->writeItem($row);
} }

View File

@ -4,25 +4,19 @@ namespace PSC\Backend\ToolsBundle\Exporter\Excel;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use MongoDB\BSON\ObjectId;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface; use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface;
use PSC\Backend\ToolsBundle\Service\ExporterRegistry; use PSC\Backend\ToolsBundle\Service\ExporterRegistry;
use PSC\Shop\EntityBundle\Document\Contact as PSCContact; use PSC\Shop\EntityBundle\Document\Contact as PSCContact;
use PSC\Shop\EntityBundle\Entity\Contact; use PSC\Shop\EntityBundle\Entity\Contact;
use PSC\Shop\MediaBundle\Document\Media;
use PSC\Shop\MediaBundle\Service\MediaManager;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Form; use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\BinaryFileResponse;
class ContactExporter implements ExporterInterface, ConfigurableElementInterface class ContactExporter implements ExporterInterface
{ {
/** @var Form */ /** @var Form */
private $_form = null; private $_form = null;
@ -31,7 +25,6 @@ class ContactExporter implements ExporterInterface, ConfigurableElementInterface
private FormFactoryInterface $formFactory, private FormFactoryInterface $formFactory,
private EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
private DocumentManager $mongoManager, private DocumentManager $mongoManager,
private MediaManager $mediaManager,
private Shop $shopService, private Shop $shopService,
) {} ) {}
@ -50,11 +43,6 @@ class ContactExporter implements ExporterInterface, ConfigurableElementInterface
public function getForm(FormBuilderInterface $builder, $form_options) public function getForm(FormBuilderInterface $builder, $form_options)
{ {
$builder->add('fotos', CheckboxType::class, ['required' => false, 'label' => 'Fotos mit exportieren?']);
$builder->add('fotosFolder', TextType::class, [
'required' => false,
'label' => 'Pfad für die Fotos z.B.: /data/www/old/data/packages/fotos/{{ media.uuid }}.{{media.extension}}',
]);
} }
public function getGroup() public function getGroup()
@ -72,7 +60,6 @@ class ContactExporter implements ExporterInterface, ConfigurableElementInterface
*/ */
public function export() public function export()
{ {
$formData = $this->_form->getData();
$rows = $this->entityManager $rows = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Contact') ->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
->getContactsByShop($this->shopService->getSelectedShop()); ->getContactsByShop($this->shopService->getSelectedShop());
@ -141,8 +128,6 @@ class ContactExporter implements ExporterInterface, ConfigurableElementInterface
'custom22' => $shop->getCustomerFieldName22(), 'custom22' => $shop->getCustomerFieldName22(),
'custom23' => $shop->getCustomerFieldName23(), 'custom23' => $shop->getCustomerFieldName23(),
'custom24' => $shop->getCustomerFieldName24(), 'custom24' => $shop->getCustomerFieldName24(),
'image1' => 'image1',
'image2' => 'image2',
]; ];
foreach ($rows as $row) { foreach ($rows as $row) {
/** @var Contact $contact */ /** @var Contact $contact */
@ -215,17 +200,9 @@ class ContactExporter implements ExporterInterface, ConfigurableElementInterface
'custom22' => $contactDoc ? $contactDoc->getCustom22() : '', 'custom22' => $contactDoc ? $contactDoc->getCustom22() : '',
'custom23' => $contactDoc ? $contactDoc->getCustom23() : '', 'custom23' => $contactDoc ? $contactDoc->getCustom23() : '',
'custom24' => $contactDoc ? $contactDoc->getCustom24() : '', 'custom24' => $contactDoc ? $contactDoc->getCustom24() : '',
'image1' => $contact->getImage1() ?? '',
'image2' => $contact->getImage2() ?? '',
]; ];
if ($formData['fotos'] && $contact->getImage1() != '') {
$this->mediaManager->copyMediaToFolder($contact->getImage1(), $formData['fotosFolder']);
}
if ($formData['fotos'] && $contact->getImage2() != '') {
$this->mediaManager->copyMediaToFolder($contact->getImage2(), $formData['fotosFolder']);
}
} }
$spreadsheet = new Spreadsheet(); $spreadsheet = new Spreadsheet();
$spreadsheet->getActiveSheet()->fromArray( $spreadsheet->getActiveSheet()->fromArray(

View File

@ -2,15 +2,15 @@
namespace PSC\Backend\ToolsBundle\Exporter\Excel; namespace PSC\Backend\ToolsBundle\Exporter\Excel;
require_once __DIR__ . '/../../../../Shop/EntityBundle/Lagacy/TP_Basket_Item.php'; require_once(__DIR__ . '/../../../../Shop/EntityBundle/Lagacy/TP_Basket_Item.php');
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface; use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface;
use PSC\Backend\ToolsBundle\Service\ExporterRegistry; use PSC\Backend\ToolsBundle\Service\ExporterRegistry;
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
use PSC\Library\Calc\Engine; use PSC\Library\Calc\Engine;
use PSC\Library\Calc\PaperContainer; use PSC\Library\Calc\PaperContainer;
use PSC\Shop\EntityBundle\Document\Position; use PSC\Shop\EntityBundle\Document\Position;
@ -25,31 +25,24 @@ use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\BinaryFileResponse;
class PositionExporter implements ExporterInterface, ConfigurableElementInterface class PositionExporter implements ExporterInterface, ConfigurableElementInterface
{ {
private $_formFactory = null; private $_formFactory = null;
private $_entityManager = null; private $_entityManager = null;
private $_securityContext = null; private $_securityContext = null;
private $_shopService = null; private $_shopService = null;
/** @var Form */ /** @var Form */
private $_form = null; private $_form = null;
/** /**
* @var PaperDB * @var PaperDB
*/ */
private PaperDB $_paperDbService; private PaperDB $_paperDbService;
/** /**
* @var DocumentManager * @var DocumentManager
*/ */
private DocumentManager $_mongoDb; private DocumentManager $_mongoDb;
function __construct(FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, Shop $shopService, PaperDB $paperDbService, DocumentManager $mongodb)
function __construct( {
FormFactoryInterface $formFactory,
EntityManagerInterface $entityManager,
Shop $shopService,
PaperDB $paperDbService,
DocumentManager $mongodb,
) {
$this->_formFactory = $formFactory; $this->_formFactory = $formFactory;
$this->_entityManager = $entityManager; $this->_entityManager = $entityManager;
$this->_shopService = $shopService; $this->_shopService = $shopService;
@ -75,8 +68,8 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
$builder->add('product', EntityType::class, array( $builder->add('product', EntityType::class, array(
'class' => Product::class, 'class' => Product::class,
'query_builder' => function (EntityRepository $er) { 'query_builder' => function (EntityRepository $er) {
return $er
->createQueryBuilder('g') return $er->createQueryBuilder('g')
->andWhere('g.shop = :shop and g.originalProduct = 0') ->andWhere('g.shop = :shop and g.originalProduct = 0')
->setParameter('shop', $this->_shopService->getSelectedShop()->getUid()) ->setParameter('shop', $this->_shopService->getSelectedShop()->getUid())
->orderBy('g.title', 'ASC'); ->orderBy('g.title', 'ASC');
@ -84,15 +77,11 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
'choice_label' => 'title', 'choice_label' => 'title',
'required' => false, 'required' => false,
'placeholder' => 'Alle', 'placeholder' => 'Alle',
'label' => 'Vorgänger', 'label' => 'Vorgänger'
));
$builder->add('from', DateType::class, array('label' => 'Von', 'attr' => array('class' => 'form-element')));
$builder->add('to', DateType::class, array('label' => 'Bis', 'attr' => array('class' => 'form-element')));
$builder->add('calc_options', TextType::class, array(
'label' => 'Kalkulationsoptionen (auflage,papier)',
'required' => false,
'attr' => array('class' => 'form-element'),
)); ));
$builder->add("from", DateType::class, array('label' => 'Von', 'attr' => array('class' => 'form-element')));
$builder->add("to", DateType::class, array('label' => 'Bis', 'attr' => array('class' => 'form-element')));
$builder->add("calc_options", TextType::class, array('label' => 'Kalkulationsoptionen (auflage,papier)', 'required' => false, 'attr' => array('class' => 'form-element')));
} }
public function getGroup() public function getGroup()
@ -113,17 +102,15 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
$formData = $this->_form->getData(); $formData = $this->_form->getData();
$orderRepository = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos'); $orderRepository = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos');
if ($formData['product'] === null) { if ($formData['product'] === null) {
$qb = $orderRepository $qb = $orderRepository->createQueryBuilder('o')
->createQueryBuilder('o') ->where("o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop")
->where('o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop')
->setParameter('from', $formData['from']) ->setParameter('from', $formData['from'])
->setParameter('to', $formData['to']) ->setParameter('to', $formData['to'])
->setParameter('shop', $this->_shopService->getSelectedShop()->getId()) ->setParameter('shop', $this->_shopService->getSelectedShop()->getId())
->getQuery(); ->getQuery();
} else { } else {
$qb = $orderRepository $qb = $orderRepository->createQueryBuilder('o')
->createQueryBuilder('o') ->where("o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop AND o.product = :product")
->where('o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop AND o.product = :product')
->setParameter('from', $formData['from']) ->setParameter('from', $formData['from'])
->setParameter('to', $formData['to']) ->setParameter('to', $formData['to'])
->setParameter('shop', $this->_shopService->getSelectedShop()->getId()) ->setParameter('shop', $this->_shopService->getSelectedShop()->getId())
@ -132,7 +119,7 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
} }
$rows = $qb->getResult(); $rows = $qb->getResult();
$calcOptions = explode(',', $formData['calc_options']); $calcOptions = explode(",", $formData['calc_options']);
$data[] = array(); $data[] = array();
$temp = array( $temp = array(
'order' => 'order', 'order' => 'order',
@ -157,7 +144,7 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
'productId' => 'articleId', 'productId' => 'articleId',
'productTitle' => 'articleName', 'productTitle' => 'articleName',
'weight' => 'weight', 'weight' => 'weight',
'articleName' => 'articleName', 'articleName' => 'articleName'
); );
foreach ($calcOptions as $key) { foreach ($calcOptions as $key) {
$temp[$key] = $key; $temp[$key] = $key;
@ -165,32 +152,26 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
$data[] = $temp; $data[] = $temp;
$paperContainer = new PaperContainer(); $paperContainer = new PaperContainer();
$paperContainer->parse(simplexml_load_string( $paperContainer->parse(simplexml_load_string($this->_shopService->getSelectedShop()->getInstall()->getPaperContainer()));
$this->_shopService
->getSelectedShop()
->getInstall()
->getPaperContainer(),
));
$engine = new Engine(); $engine = new Engine();
$engine->setPaperRepository($this->_paperDbService); $engine->setPaperRepository($this->_paperDbService);
$engine->setPaperContainer($paperContainer); $engine->setPaperContainer($paperContainer);
if ($this->_shopService->getSelectedShop()->getInstall()->getCalcTemplates()) { if ($this->_shopService->getSelectedShop()->getInstall()->getCalcTemplates()) {
$engine->setTemplates('<root>' . $this->_shopService $engine->setTemplates('<root>' . $this->_shopService->getSelectedShop()->getInstall()->getCalcTemplates() . '</root>');
->getSelectedShop()
->getInstall()
->getCalcTemplates() . '</root>');
} }
/** @var Orderpos $row */ /** @var Orderpos $row */
foreach ($rows as $row) { foreach ($rows as $row) {
/** @var Position $objDoc */ /** @var Position $objDoc */
$objDoc = $this->_mongoDb->getRepository(Position::class)->findOneBy(['uid' => (string) $row->getId()]); $objDoc = $this->_mongoDb
->getRepository(Position::class)
->findOneBy(['uid' => (string)$row->getId()]);
$temp = array( $temp = array(
'order' => (string) $row->getOrder()->getAlias(), 'order' => (string)$row->getOrder()->getAlias(),
'pos' => (string) $row->getPos(), 'pos' => (string)$row->getPos(),
'created' => (string) $row->getOrder()->getCreated()->format('d.m.Y H:i:s'), 'created' => (string)$row->getOrder()->getCreated()->format('d.m.Y H:i:s'),
'brutto' => (string) $row->getOrder()->getBrutto(), 'brutto' => (string)$row->getOrder()->getBrutto(),
'contact' => (string) $row->getOrder()->getContact()->getEmail(), 'contact' => (string)$row->getOrder()->getContact()->getEmail(),
'invoice_company' => $row->getOrder()->getInvoiceAddress()->getCompany(), 'invoice_company' => $row->getOrder()->getInvoiceAddress()->getCompany(),
'invoice_firstname' => $row->getOrder()->getInvoiceAddress()->getFirstname(), 'invoice_firstname' => $row->getOrder()->getInvoiceAddress()->getFirstname(),
'invoice_lastname' => $row->getOrder()->getInvoiceAddress()->getLastname(), 'invoice_lastname' => $row->getOrder()->getInvoiceAddress()->getLastname(),
@ -205,11 +186,11 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
'delivery_house_number' => $row->getOrder()->getDeliveryAddress()->getHouseNumber(), 'delivery_house_number' => $row->getOrder()->getDeliveryAddress()->getHouseNumber(),
'delivery_zip' => $row->getOrder()->getDeliveryAddress()->getZip(), 'delivery_zip' => $row->getOrder()->getDeliveryAddress()->getZip(),
'delivery_city' => $row->getOrder()->getDeliveryAddress()->getCity(), 'delivery_city' => $row->getOrder()->getDeliveryAddress()->getCity(),
'productId' => (string) $row->getProduct()->getId(), 'productId' => (string)$row->getProduct()->getId(),
'productTitle' => (string) $row->getProduct()->getTitle(), 'productTitle' => (string)$row->getProduct()->getTitle(),
'weight' => (string) $row->getWeight(), 'weight' => (string)$row->getWeight(),
); );
$objPosition = unserialize($row->getData()); $objPosition = unserialize(($row->getData()));
if ($row->hasCalcXml()) { if ($row->hasCalcXml()) {
$engine->loadString($row->getCalcXml()); $engine->loadString($row->getCalcXml());
$engine->setVariables($objPosition->getOptions()); $engine->setVariables($objPosition->getOptions());
@ -226,16 +207,16 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
$articleCalc = new \PSC\Library\Calc\Article($objPosition->getOptions()['kalk_artikel']); $articleCalc = new \PSC\Library\Calc\Article($objPosition->getOptions()['kalk_artikel']);
$temp['articleName'] = $objPosition->getOptions()['kalk_artikel']; $temp['articleName'] = $objPosition->getOptions()['kalk_artikel'];
} else { } else {
$articleCalc = new \PSC\Library\Calc\Article('test'); $articleCalc = new \PSC\Library\Calc\Article("test");
$temp['articleName'] = ''; $temp['articleName'] = '';
} }
} }
foreach ($calcOptions as $key) { foreach ($calcOptions as $key) {
if ($articleCalc->getOptionById($key)) { if ($articleCalc->getOptionById($key)) {
$temp[$key] = (string) $articleCalc->getOptionById($key)->getValue(); $temp[$key] = (string)$articleCalc->getOptionById($key)->getValue();
} else { } else {
$temp[$key] = ''; $temp[$key] = "";
} }
} }
@ -244,12 +225,13 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
$spreadsheet = new Spreadsheet(); $spreadsheet = new Spreadsheet();
$spreadsheet->getActiveSheet()->fromArray( $spreadsheet->getActiveSheet()
$data, // The data to set ->fromArray(
null, // Array values with this value will not be set $data, // The data to set
'A1', // Top left coordinate of the worksheet range where NULL, // Array values with this value will not be set
// we want to set these values (default is A1) 'A1' // Top left coordinate of the worksheet range where
); // we want to set these values (default is A1)
);
$writer = new Xlsx($spreadsheet); $writer = new Xlsx($spreadsheet);
$writer->save('/tmp/test.xlsx'); $writer->save('/tmp/test.xlsx');

View File

@ -1,6 +1,6 @@
psc_backend_tools: psc_backend_tools:
resource: "@PSCBackendToolsBundle/Controller/Backend" resource: "@PSCBackendToolsBundle/Controller/Backend"
type: attribute type: annotation
prefix: /backend/tools prefix: /backend/tools

View File

@ -3,65 +3,66 @@
namespace PSC\Component\ApiBundle\Api\Account; namespace PSC\Component\ApiBundle\Api\Account;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\JsonContent; use OpenApi\Annotations as OA;
use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Input; use PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Input;
use PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Output; use PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Output;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Component\ApiBundle\Dto\Shop\Shops; use PSC\Component\ApiBundle\Dto\Shop\Shops;
use PSC\Component\ApiBundle\Model\Shop; use PSC\Component\ApiBundle\Model\Shop;
use PSC\Component\ApiBundle\Model\Shop\Domain; use PSC\Component\ApiBundle\Model\Shop\Domain;
use PSC\Shop\EntityBundle\Entity\Account;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response as HttpResponse; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
class GetParentByTitle extends AbstractController class GetParentByTitle extends AbstractController
{ {
private EntityManagerInterface $entityManager; private EntityManagerInterface $entityManager;
private \PSC\System\SettingsBundle\Service\Shop $shopService; private \PSC\System\SettingsBundle\Service\Shop $shopService;
public function __construct( public function __construct(EntityManagerInterface $entityManager, \PSC\System\SettingsBundle\Service\Shop $shopService)
EntityManagerInterface $entityManager, {
\PSC\System\SettingsBundle\Service\Shop $shopService,
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->shopService = $shopService; $this->shopService = $shopService;
} }
#[Response( /**
response: 200, * Check account parents by title
description: 'account', *
content: new JsonContent( * @OA\Response(
ref: new Model(type: PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Output::class), * response=200,
), * description="account",
)] * @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Output::class))
#[RequestBody( * )
description: 'This is a request body', * @OA\RequestBody(
content: new Model(type: PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Input::class), * description="This is a request body",
)] * @Model(type=\PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Input::class))
#[Tag(name: 'Account')] * )
#[IsGranted('ROLE_API')] * @OA\Tag(name="Account")
#[Security(name: 'ApiKeyAuth')] * @IsGranted("ROLE_API")
* @Security(name="ApiKeyAuth")
*/
#[Route(path: '/account/getparentbytitle', methods: ['POST'])] #[Route(path: '/account/getparentbytitle', methods: ['POST'])]
public function existsAction(#[MapRequestPayload] Input $data): JsonResponse #[ParamConverter('data', class: '\PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Input', converter: 'psc_rest.request_body')]
public function existsAction(Input $data): JsonResponse
{ {
$output = new Output(); $output = new Output();
$account = $this->entityManager $account = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Account') ->getRepository('PSC\Shop\EntityBundle\Entity\Account')
->getAccountByTitle($data->title); ->getAccountByTitle(
$data->title
);
if (!$account) { if (!$account) {
$output->parent = ''; $output->parent = "";
$output->parent_id = 0; $output->parent_id = 0;
return $this->json($output); return $this->json($output);
} }
@ -76,7 +77,14 @@ class GetParentByTitle extends AbstractController
return $this->json($output); return $this->json($output);
} }
protected function recursiveParent(\PSC\Shop\EntityBundle\Entity\Account $account): Account /**
* Gets the Parent Account
*
* @param \PSC\Shop\EntityBundle\Entity\Account $account
*
* @return \PSC\Shop\EntityBundle\Entity\Account
*/
protected function recursiveParent(\PSC\Shop\EntityBundle\Entity\Account $account)
{ {
if ($account->getParent()) { if ($account->getParent()) {
$account = $this->recursiveParent($account->getParent()); $account = $this->recursiveParent($account->getParent());

View File

@ -3,11 +3,9 @@
namespace PSC\Component\ApiBundle\Api\Cms; namespace PSC\Component\ApiBundle\Api\Cms;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\JsonContent; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Dto\Cms\Cms\Output; use PSC\Component\ApiBundle\Dto\Cms\Cms\Output;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Component\ApiBundle\Dto\Shop\Shops; use PSC\Component\ApiBundle\Dto\Shop\Shops;
@ -16,11 +14,11 @@ use PSC\Component\ApiBundle\Model\Shop;
use PSC\Component\ApiBundle\Model\Shop\Domain; use PSC\Component\ApiBundle\Model\Shop\Domain;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response as HttpResponse; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
class Get extends AbstractController class Get extends AbstractController
{ {
@ -28,24 +26,27 @@ class Get extends AbstractController
private Cms $hydrateCms; private Cms $hydrateCms;
private \PSC\System\SettingsBundle\Service\Shop $shopService; private \PSC\System\SettingsBundle\Service\Shop $shopService;
public function __construct( public function __construct(EntityManagerInterface $entityManager, \PSC\System\SettingsBundle\Service\Shop $shopService, Cms $hydrateCms)
EntityManagerInterface $entityManager, {
\PSC\System\SettingsBundle\Service\Shop $shopService,
Cms $hydrateCms,
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->hydrateCms = $hydrateCms; $this->hydrateCms = $hydrateCms;
$this->shopService = $shopService; $this->shopService = $shopService;
} }
#[Response(response: 200, description: 'cms', content: new JsonContent(ref: new Model(type: Output::class)))] /**
#[Tag(name: 'Cms')] * Cms
*
* @OA\Response(
* response=200,
* description="cms",
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Cms\Cms\Output::class))
* )
* @OA\Tag(name="Cms")
*/
#[Route(path: '/cms', methods: ['GET'])] #[Route(path: '/cms', methods: ['GET'])]
public function allAction(): JsonResponse public function allAction(): JsonResponse
{ {
$cmss = $this->entityManager $cmss = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Cms::class)->findAllByShop($this->shopService->getShopByDomain());
->getRepository(\PSC\Shop\EntityBundle\Entity\Cms::class)
->findAllByShop($this->shopService->getShopByDomain());
$data = []; $data = [];
/** @var \PSC\Shop\EntityBundle\Entity\Cms $cms */ /** @var \PSC\Shop\EntityBundle\Entity\Cms $cms */
@ -56,17 +57,21 @@ class Get extends AbstractController
return $this->json(new Output($data)); return $this->json(new Output($data));
} }
#[Response( /**
response: 200, * Get One Cms
description: 'found cms', *
content: new JsonContent(ref: new Model(type: \PSC\Component\ApiBundle\Model\Cms::class)), * @OA\Response(
)] * response=200,
#[Response( * description="found cms",
response: 404, * @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Model\Cms::class))
description: 'not found', * )
content: new JsonContent(ref: new Model(type: NotFound::class)), * @OA\Response(
)] * response=404,
#[Tag(name: 'Cms')] * description="not found",
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Error\NotFound::class))
* )
* @OA\Tag(name="Cms")
*/
#[Route(path: '/cms/{id}', methods: ['GET'])] #[Route(path: '/cms/{id}', methods: ['GET'])]
public function one($id): JsonResponse public function one($id): JsonResponse
{ {

View File

@ -4,11 +4,9 @@ namespace PSC\Component\ApiBundle\Api\Plugin;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use MongoDB\BSON\ObjectId; use MongoDB\BSON\ObjectId;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\JsonContent; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Component\ApiBundle\Dto\Shop\Shops; use PSC\Component\ApiBundle\Dto\Shop\Shops;
use PSC\Component\ApiBundle\Model\Shop; use PSC\Component\ApiBundle\Model\Shop;
@ -16,11 +14,11 @@ use PSC\Component\ApiBundle\Model\Shop\Domain;
use PSC\System\PluginBundle\Interfaces\Plugin; use PSC\System\PluginBundle\Interfaces\Plugin;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response as HttpResponse; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
class Get extends AbstractController class Get extends AbstractController
{ {
@ -31,12 +29,16 @@ class Get extends AbstractController
$this->documentManager = $documentManager; $this->documentManager = $documentManager;
} }
#[Response( /**
response: 200, * Layouter Plugins
description: 'shops', *
content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Plugin\Plugins\Output::class)), * @OA\Response(
)] * response=200,
#[Tag(name: 'Plugin')] * description="shops",
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Plugin\Plugins\Output::class))
* )
* @OA\Tag(name="Plugin")
*/
#[Route(path: '/plugins/layouter', methods: ['GET'])] #[Route(path: '/plugins/layouter', methods: ['GET'])]
public function layouterAction(): JsonResponse public function layouterAction(): JsonResponse
{ {
@ -59,13 +61,17 @@ class Get extends AbstractController
return $this->json(new Shops\Output($data)); return $this->json(new Shops\Output($data));
} }
#[Response( /**
response: 200, * Plugins
description: 'shops', *
content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Plugin\Plugins\Output::class)), * @OA\Response(
)] * response=200,
#[Tag(name: 'Plugin')] * description="shops",
#[Security(name: 'ApiKeyAuth')] * @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Plugin\Plugins\Output::class))
* )
* @OA\Tag(name="Plugin")
* @Security(name="ApiKeyAuth")
*/
#[Route(path: '/plugins', methods: ['GET'])] #[Route(path: '/plugins', methods: ['GET'])]
#[IsGranted('ROLE_API')] #[IsGranted('ROLE_API')]
public function allAction(): JsonResponse public function allAction(): JsonResponse
@ -84,25 +90,27 @@ class Get extends AbstractController
return $this->json(new Shops\Output($data)); return $this->json(new Shops\Output($data));
} }
#[Response( /**
response: 200, * Get one plugin
description: 'found plugin', *
content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Model\Plugin::class)), * @OA\Response(
)] * response=200,
#[Response( * description="found plugin",
response: 404, * @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Model\Plugin::class))
description: 'not found', * )
content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Error\NotFound::class)), * @OA\Response(
)] * response=404,
#[Tag(name: 'Plugin')] * description="not found",
#[Security(name: 'ApiKeyAuth')] * @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Error\NotFound::class))
* )
* @OA\Tag(name="Plugin")
* @Security(name="ApiKeyAuth")
*/
#[Route(path: '/plugins/{uuid}', methods: ['GET'])] #[Route(path: '/plugins/{uuid}', methods: ['GET'])]
#[IsGranted('ROLE_API')] #[IsGranted('ROLE_API')]
public function one($uuid): JsonResponse public function one($uuid): JsonResponse
{ {
$plugin = $this->documentManager $plugin = $this->documentManager->getRepository(\PSC\System\PluginBundle\Document\Plugin::class)->findOneBy(['id' => new ObjectId($uuid)]);
->getRepository(\PSC\System\PluginBundle\Document\Plugin::class)
->findOneBy(['id' => new ObjectId($uuid)]);
if (!$plugin) { if (!$plugin) {
return $this->json(new NotFound()); return $this->json(new NotFound());
} }

View File

@ -3,44 +3,44 @@
namespace PSC\Component\ApiBundle\Api\Shop; namespace PSC\Component\ApiBundle\Api\Shop;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\JsonContent; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Component\ApiBundle\Dto\Shop\Shops; use PSC\Component\ApiBundle\Dto\Shop\Shops;
use PSC\Component\ApiBundle\Model\Shop; use PSC\Component\ApiBundle\Model\Shop;
use PSC\Component\ApiBundle\Model\Shop\Domain; use PSC\Component\ApiBundle\Model\Shop\Domain;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response as HttpResponse; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
class Get extends AbstractController class Get extends AbstractController
{ {
private EntityManagerInterface $entityManager; private EntityManagerInterface $entityManager;
private \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop; private \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop;
public function __construct( public function __construct(EntityManagerInterface $entityManager, \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop)
EntityManagerInterface $entityManager, {
\PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop,
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->hydrateShop = $hydrateShop; $this->hydrateShop = $hydrateShop;
} }
#[Response( /**
response: 200, * Shops
description: 'shops', *
content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Shop\Shops\Output::class)), * @OA\Response(
)] * response=200,
#[Tag(name: 'Shops')] * description="shops",
#[Security(name: 'ApiKeyAuth')] * @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Shop\Shops\Output::class))
#[Security(name: 'Bearer')] * )
* @OA\Tag(name="Shops")
* @Security(name="ApiKeyAuth")
* @Security(name="Bearer")
*/
#[Route(path: '/shops', methods: ['GET'])] #[Route(path: '/shops', methods: ['GET'])]
#[IsGranted('ROLE_SHOP')] #[IsGranted('ROLE_SHOP')]
public function allAction(): JsonResponse public function allAction(): JsonResponse
@ -56,25 +56,27 @@ class Get extends AbstractController
return $this->json(new Shops\Output($data)); return $this->json(new Shops\Output($data));
} }
#[Response( /**
response: 200, * Get One Shop
description: 'found shop', *
content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Model\Shop::class)), * @OA\Response(
)] * response=200,
#[Response( * description="found shop",
response: 404, * @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Model\Shop::class))
description: 'not found', * )
content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Error\NotFound::class)), * @OA\Response(
)] * response=404,
#[Tag(name: 'Shops')] * description="not found",
#[Security(name: 'ApiKeyAuth')] * @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Error\NotFound::class))
* )
* @OA\Tag(name="Shops")
* @Security(name="ApiKeyAuth")
*/
#[Route(path: '/shops/{id}', methods: ['GET'])] #[Route(path: '/shops/{id}', methods: ['GET'])]
#[IsGranted('ROLE_API')] #[IsGranted('ROLE_API')]
public function one($id): JsonResponse public function one($id): JsonResponse
{ {
$shop = $this->entityManager $shop = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Shop::class)->findOneBy(['uid' => $id]);
->getRepository(\PSC\Shop\EntityBundle\Entity\Shop::class)
->findOneBy(['uid' => $id]);
if ($shop) { if ($shop) {
return $this->json($this->hydrateShop->hydrateToModel($shop)); return $this->json($this->hydrateShop->hydrateToModel($shop));

View File

@ -3,12 +3,9 @@
namespace PSC\Component\ApiBundle\Api\Stockbooking; namespace PSC\Component\ApiBundle\Api\Stockbooking;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\JsonContent; use OpenApi\Annotations as OA;
use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Component\ApiBundle\Dto\Error\PersistFailure; use PSC\Component\ApiBundle\Dto\Error\PersistFailure;
use PSC\Component\ApiBundle\Dto\Shop\Shops; use PSC\Component\ApiBundle\Dto\Shop\Shops;
@ -20,58 +17,56 @@ use PSC\Component\ApiBundle\Model\Shop\Domain;
use PSC\Component\ApiBundle\Model\Stockbooking; use PSC\Component\ApiBundle\Model\Stockbooking;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response as HttpResponse; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
class CreateByNr extends AbstractController class CreateByNr extends AbstractController
{ {
private EntityManagerInterface $entityManager; private EntityManagerInterface $entityManager;
private \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop; private \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop;
public function __construct( public function __construct(EntityManagerInterface $entityManager, \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop)
EntityManagerInterface $entityManager, {
\PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop,
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->hydrateShop = $hydrateShop; $this->hydrateShop = $hydrateShop;
} }
#[Response( /**
response: 200, * create by nr
description: 'stockbooking', *
content: new JsonContent( * @OA\Response(
ref: new Model(type: PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr\Output::class), * response=200,
), * description="stockbooking",
)] * @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr\Output::class))
#[RequestBody( * )
description: 'This is a request body', * @OA\RequestBody(
content: new Model(type: PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr\Input::class), * description="This is a request body",
)] * @Model(type=\PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr\Input::class))
#[Tag(name: 'Stockbooking')] * )
#[IsGranted('ROLE_API')] * @OA\Tag(name="Stockbooking")
#[Security(name: 'ApiKeyAuth')] * @IsGranted("ROLE_API")
* @Security(name="ApiKeyAuth")
*/
#[Route(path: '/stockbooking/createbynr', methods: ['POST'])] #[Route(path: '/stockbooking/createbynr', methods: ['POST'])]
public function create(#[MapRequestPayload] Input $data): JsonResponse #[ParamConverter('data', class: '\PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr\Input', converter: 'psc_rest.request_body')]
public function create(Input $data): JsonResponse
{ {
$product = $this->entityManager $product = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Product') ->getRepository('PSC\Shop\EntityBundle\Entity\Product')->createQueryBuilder('product')
->createQueryBuilder('product')
->andWhere('product.nrIntern = :nr or product.nrExtern = :nr') ->andWhere('product.nrIntern = :nr or product.nrExtern = :nr')
->setParameter('nr', $data->product_nr) ->setParameter('nr', $data->product_nr)
->getQuery() ->getQuery()->getOneOrNullResult();
->getOneOrNullResult();
if ($product) { if ($product) {
$contact = $this->entityManager $contact = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Contact') ->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(['uid' => $data->contact_id]);
->findOneBy(['uid' => $data->contact_id]);
if (!$contact) { if (!$contact) {
return $this->json(new NotFound('Contact not found')); return $this->json(new NotFound("Contact not found"));
} }
$stBooking = new \PSC\Shop\EntityBundle\Entity\Stockbooking($product); $stBooking = new \PSC\Shop\EntityBundle\Entity\Stockbooking($product);
@ -95,6 +90,6 @@ class CreateByNr extends AbstractController
return $this->json(new Output()); return $this->json(new Output());
} }
return $this->json(new NotFound('Product not found')); return $this->json(new NotFound("Product not found"));
} }
} }

View File

@ -3,12 +3,9 @@
namespace PSC\Component\ApiBundle\Api\Stockbooking; namespace PSC\Component\ApiBundle\Api\Stockbooking;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\JsonContent; use OpenApi\Annotations as OA;
use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Component\ApiBundle\Dto\Shop\Shops; use PSC\Component\ApiBundle\Dto\Shop\Shops;
use PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Input; use PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Input;
@ -19,55 +16,56 @@ use PSC\Component\ApiBundle\Model\Shop\Domain;
use PSC\Component\ApiBundle\Model\Stockbooking; use PSC\Component\ApiBundle\Model\Stockbooking;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response as HttpResponse; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
class GetByNr extends AbstractController class GetByNr extends AbstractController
{ {
private EntityManagerInterface $entityManager; private EntityManagerInterface $entityManager;
private \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop; private \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop;
public function __construct( public function __construct(EntityManagerInterface $entityManager, \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop)
EntityManagerInterface $entityManager, {
\PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop,
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->hydrateShop = $hydrateShop; $this->hydrateShop = $hydrateShop;
} }
#[Response( /**
response: 200, * get all by nr
description: 'account', *
content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Output::class)), * @OA\Response(
)] * response=200,
#[RequestBody( * description="account",
description: 'This is a request body', * @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Output::class))
content: new Model(type: PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Input::class), * )
)] * @OA\RequestBody(
#[Tag(name: 'Stockbooking')] * description="This is a request body",
#[IsGranted('ROLE_API')] * @Model(type=\PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Input::class))
#[Security(name: 'ApiKeyAuth')] * )
* @OA\Tag(name="Stockbooking")
* @IsGranted("ROLE_API")
* @Security(name="ApiKeyAuth")
*/
#[Route(path: '/stockbooking/getallbynr', methods: ['POST'])] #[Route(path: '/stockbooking/getallbynr', methods: ['POST'])]
public function allAction(#[MapRequestPayload] Input $data): JsonResponse #[ParamConverter('data', class: '\PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Input', converter: 'psc_rest.request_body')]
public function allAction(Input $data): JsonResponse
{ {
$product = $this->entityManager $product = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Product') ->getRepository('PSC\Shop\EntityBundle\Entity\Product')->createQueryBuilder('product')
->createQueryBuilder('product')
->andWhere('product.nrIntern = :nr or product.nrExtern = :nr') ->andWhere('product.nrIntern = :nr or product.nrExtern = :nr')
->setParameter('nr', $data->nr) ->setParameter('nr', $data->nr)
->getQuery() ->getQuery()->getOneOrNullResult();
->getOneOrNullResult();
if ($product) { if ($product) {
$bookings = $this->entityManager $bookings = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Stockbooking') ->getRepository('PSC\Shop\EntityBundle\Entity\Stockbooking')
->findByProduct($product); ->findByProduct($product);
$bookingsTemp = []; $bookingsTemp = array();
/** @var \PSC\Shop\EntityBundle\Entity\Stockbooking $booking */ /** @var \PSC\Shop\EntityBundle\Entity\Stockbooking $booking */
foreach ($bookings as $booking) { foreach ($bookings as $booking) {
$contact = new Contact(); $contact = new Contact();
@ -88,6 +86,6 @@ class GetByNr extends AbstractController
return $this->json(new Output($bookingsTemp)); return $this->json(new Output($bookingsTemp));
} }
return $this->json(new NotFound('Product not found')); return $this->json(new NotFound("Product not found"));
} }
} }

View File

@ -3,28 +3,32 @@
namespace PSC\Component\ApiBundle\Api\System; namespace PSC\Component\ApiBundle\Api\System;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\JsonContent; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Model\Instance; use PSC\Component\ApiBundle\Model\Instance;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response as HttpResponse; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
class Info extends AbstractController class Info extends AbstractController
{ {
#[Tag(name: 'System')] /**
#[Response( * Get system info.
response: 200, *
description: 'Returns system info', *
content: new JsonContent(ref: new Model(type: Instance::class)), * @Security(name="ApiKeyAuth")
)] * @OA\Response(
* response=200,
* description="Returns system info",
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Model\Instance::class))
* )
* @OA\Tag(name="System")
*/
#[Route(path: '/system/info', methods: ['GET'])] #[Route(path: '/system/info', methods: ['GET'])]
#[IsGranted('ROLE_API')] #[IsGranted('ROLE_API')]
public function infoAction(DocumentManager $documentManager): JsonResponse public function infoAction(DocumentManager $documentManager): JsonResponse
@ -34,13 +38,14 @@ class Info extends AbstractController
->getRepository(\PSC\Shop\EntityBundle\Document\Instance::class) ->getRepository(\PSC\Shop\EntityBundle\Document\Instance::class)
->findOneBy(['appId' => '1']); ->findOneBy(['appId' => '1']);
$data = new Instance(); $data = new Instance();
$data->sftpHost = getenv('ftpIp'); $data->sftpHost = getenv('ftpIp');
$data->ip = getenv('ftpIp'); $data->ip = getenv('ftpIp');
$data->sftpUserName = getenv('ftpUsername'); $data->sftpUserName = getenv('ftpUsername');
$data->sftpPassword = getenv('ftpPassword'); $data->sftpPassword = getenv('ftpPassword');
$data->sftpPort = getenv('ftpPort'); $data->sftpPort = getenv('ftpPort');
if ($instance && $instance->isSmtpOwn()) { if($instance && $instance->isSmtpOwn()) {
$data->smtpOwn = true; $data->smtpOwn = true;
} }

View File

@ -2,16 +2,14 @@
namespace PSC\Component\ApiBundle\Api\System; namespace PSC\Component\ApiBundle\Api\System;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\JsonContent; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response as HttpResponse; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
class Version extends AbstractController class Version extends AbstractController
@ -23,12 +21,17 @@ class Version extends AbstractController
$this->kernel = $kernel; $this->kernel = $kernel;
} }
#[Response( /**
response: 200, * Get Release version.
description: 'release version', *
content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Model\Version::class)), *
)] * @OA\Response(
#[Tag(name: 'System')] * response=200,
* description="release version",
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Model\Version::class))
* )
* @OA\Tag(name="System")
*/
#[Route(path: '/system/version', methods: ['GET'])] #[Route(path: '/system/version', methods: ['GET'])]
public function versionAction(): JsonResponse public function versionAction(): JsonResponse
{ {

View File

@ -0,0 +1,82 @@
<?php
namespace PSC\Component\ApiBundle\Converter;
use JMS\Serializer\Exception\UnsupportedFormatException;
use Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInterface;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Serializer\Annotation\Context;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\HttpFoundation\Request;
final class RequestBody implements ParamConverterInterface
{
private $serializer;
private $context = [];
/**
* @param string[]|null $groups
*/
public function __construct(
SerializerInterface $serializer,
?array $groups = null,
?string $version = null,
?string $validationErrorsArgument = null
) {
$this->serializer = $serializer;
if (!empty($groups)) {
$this->context['groups'] = (array) $groups;
}
if (!empty($version)) {
$this->context['version'] = $version;
}
}
/**
* {@inheritdoc}
*/
public function apply(Request $request, ParamConverter $configuration): bool
{
$format = $request->getContentType();
if (null === $format) {
return $this->throwException(new UnsupportedMediaTypeHttpException(), $configuration);
}
try {
$object = $this->serializer->deserialize(
$request->getContent(),
$configuration->getClass(),
$format,
);
} catch (UnsupportedFormatException $e) {
return $this->throwException(new UnsupportedMediaTypeHttpException($e->getMessage(), $e), $configuration);
}
$request->attributes->set($configuration->getName(), $object);
return true;
}
/**
* {@inheritdoc}
*/
public function supports(ParamConverter $configuration): bool
{
return null !== $configuration->getClass() && 'psc_rest.request_body' === $configuration->getConverter();
}
private function throwException(\Exception $exception, ParamConverter $configuration): bool
{
if ($configuration->isOptional()) {
return false;
}
throw $exception;
}
}

View File

@ -2,12 +2,15 @@
namespace PSC\Component\ApiBundle\Dto\Account\GetParentByTitle; namespace PSC\Component\ApiBundle\Dto\Account\GetParentByTitle;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
final class Input final class Input
{ {
#[Property(type: 'string')] /**
* @var string
*
* @OA\Property(type="string")
*/
public string $title; public string $title;
} }

View File

@ -2,15 +2,22 @@
namespace PSC\Component\ApiBundle\Dto\Account\GetParentByTitle; namespace PSC\Component\ApiBundle\Dto\Account\GetParentByTitle;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
final class Output final class Output
{ {
#[Property(type: 'string')] /**
* @var string
*
* @OA\Property(type="string")
*/
public string $parent; public string $parent;
#[Property(type: 'integer')] /**
* @var int
*
* @OA\Property(type="integer")
*/
public int $parent_id; public int $parent_id;
} }

View File

@ -3,10 +3,8 @@
namespace PSC\Component\ApiBundle\Dto\Cms\Cms; namespace PSC\Component\ApiBundle\Dto\Cms\Cms;
use PSC\Component\ApiBundle\Model\Cms; use PSC\Component\ApiBundle\Model\Cms;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Items;
class Output class Output
{ {
@ -16,9 +14,17 @@ class Output
$this->count = count($cms); $this->count = count($cms);
} }
#[Property(type: 'array', items: new Items(ref: new Model(type: PSC\Component\ApiBundle\Model\Cms::class)))] /**
* @var Cms[]
*
* @OA\Property(type="array", @OA\Items(ref=@Model(type=\PSC\Component\ApiBundle\Model\Cms::class)))
*/
public array $data = []; public array $data = [];
#[Property(type: 'integer')] /**
* @var int
*
* @OA\Property(type="integer")
*/
public int $count = 0; public int $count = 0;
} }

View File

@ -3,9 +3,8 @@
namespace PSC\Component\ApiBundle\Dto\Error; namespace PSC\Component\ApiBundle\Dto\Error;
use PSC\Component\ApiBundle\Model\Shop; use PSC\Component\ApiBundle\Model\Shop;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class NotFound class NotFound
{ {
@ -14,6 +13,8 @@ class NotFound
$this->message = $message; $this->message = $message;
} }
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $message = ""; public string $message = "";
} }

View File

@ -3,9 +3,8 @@
namespace PSC\Component\ApiBundle\Dto\Error; namespace PSC\Component\ApiBundle\Dto\Error;
use PSC\Component\ApiBundle\Model\Shop; use PSC\Component\ApiBundle\Model\Shop;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class PersistFailure class PersistFailure
{ {
@ -14,6 +13,8 @@ class PersistFailure
$this->message = $message; $this->message = $message;
} }
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $message = ""; public string $message = "";
} }

View File

@ -2,10 +2,8 @@
namespace PSC\Component\ApiBundle\Dto\Plugin\Plugins; namespace PSC\Component\ApiBundle\Dto\Plugin\Plugins;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Items;
use PSC\Component\ApiBundle\Model\Plugin; use PSC\Component\ApiBundle\Model\Plugin;
class Output class Output
@ -16,9 +14,17 @@ class Output
$this->count = count($plugins); $this->count = count($plugins);
} }
#[Property(type: 'array', items: new Items(ref: new Model(type: PSC\Component\ApiBundle\Model\Plugin::class)))] /**
* @var Plugin[]
*
* @OA\Property(type="array", @OA\Items(ref=@Model(type=\PSC\Component\ApiBundle\Model\Plugin::class)))
*/
public array $data = []; public array $data = [];
#[Property(type: 'integer')] /**
* @var int
*
* @OA\Property(type="integer")
*/
public int $count = 0; public int $count = 0;
} }

View File

@ -3,10 +3,8 @@
namespace PSC\Component\ApiBundle\Dto\Shop\Shops; namespace PSC\Component\ApiBundle\Dto\Shop\Shops;
use PSC\Component\ApiBundle\Model\Shop; use PSC\Component\ApiBundle\Model\Shop;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Items;
class Output class Output
{ {
@ -16,9 +14,17 @@ class Output
$this->count = count($shops); $this->count = count($shops);
} }
#[Property(type: 'array', items: new Items(ref: new Model(type: PSC\Component\ApiBundle\Model\Shop::class)))] /**
* @var Shop[]
*
* @OA\Property(type="array", @OA\Items(ref=@Model(type=\PSC\Component\ApiBundle\Model\Shop::class)))
*/
public array $data = []; public array $data = [];
#[Property(type: 'integer')] /**
* @var int
*
* @OA\Property(type="integer")
*/
public int $count = 0; public int $count = 0;
} }

View File

@ -2,24 +2,43 @@
namespace PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr; namespace PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class Input class Input
{ {
#[Property(type: 'string')] /**
* @var string
*
* @OA\Property(type="string")
*/
public string $product_nr = ""; public string $product_nr = "";
#[Property(type: 'string')] /**
* @var string
*
* @OA\Property(type="string")
*/
public string $description = ""; public string $description = "";
#[Property(type: 'integer')] /**
* @var int
*
* @OA\Property(type="integer")
*/
public int $amount = 0; public int $amount = 0;
#[Property(type: 'string')] /**
* @var string
*
* @OA\Property(type="string")
*/
public string $delivery_nr = ""; public string $delivery_nr = "";
#[Property(type: 'integer')] /**
* @var int
*
* @OA\Property(type="integer")
*/
public int $contact_id = 0; public int $contact_id = 0;
} }

View File

@ -2,13 +2,16 @@
namespace PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr; namespace PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
use PSC\Component\ApiBundle\Model\Stockbooking; use PSC\Component\ApiBundle\Model\Stockbooking;
class Output class Output
{ {
#[Property(type: 'boolean')] /**
* @var bool
*
* @OA\Property(type="boolean")
*/
public bool $success = true; public bool $success = true;
} }

View File

@ -2,12 +2,15 @@
namespace PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr; namespace PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class Input class Input
{ {
#[Property(type: 'string')] /**
* @var string
*
* @OA\Property(type="string")
*/
public string $nr = ""; public string $nr = "";
} }

View File

@ -2,10 +2,8 @@
namespace PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr; namespace PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Items;
use PSC\Component\ApiBundle\Model\Stockbooking; use PSC\Component\ApiBundle\Model\Stockbooking;
class Output class Output
@ -16,9 +14,17 @@ class Output
$this->count = count($shops); $this->count = count($shops);
} }
#[Property(type: 'array', items: new Items(ref: new Model(type: PSC\Component\ApiBundle\Model\Stockbooking::class)))] /**
* @var Stockbooking[]
*
* @OA\Property(type="array", @OA\Items(ref=@Model(type=\PSC\Component\ApiBundle\Model\Stockbooking::class)))
*/
public array $data = []; public array $data = [];
#[Property(type: 'integer')] /**
* @var int
*
* @OA\Property(type="integer")
*/
public int $count = 0; public int $count = 0;
} }

View File

@ -13,18 +13,25 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class Cms class Cms
{ {
#[Property(type: 'integer')] /**
* @OA\Property(type="integer")
*/
public int $id; public int $id;
#[Property(type: 'string', maxLength: 255)] /**
public string $title = ''; * @OA\Property(type="string", maxLength=255)
#[Property(type: 'string', maxLength: 255)] */
public string $text = ''; public string $title = "";
#[Property(type: 'string', maxLength: 255)] /**
public string $shopId = ''; * @OA\Property(type="string", maxLength=255)
*/
public string $text = "";
/**
* @OA\Property(type="string", maxLength=255)
*/
public string $shopId = "";
} }

View File

@ -13,23 +13,34 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class Instance class Instance
{ {
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $sftpUserName = ""; public string $sftpUserName = "";
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $sftpPassword; public string $sftpPassword;
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $sftpPort; public string $sftpPort;
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $sftpHost; public string $sftpHost;
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $ip; public string $ip;
#[Property(type: 'boolean')] /**
* @OA\Property(type="boolean")
*/
public bool $smtpOwn = false; public bool $smtpOwn = false;
} }

View File

@ -13,9 +13,8 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class Plugin class Plugin
{ {
@ -25,10 +24,16 @@ class Plugin
$this->title = $title; $this->title = $title;
} }
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $uuid = ""; public string $uuid = "";
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $title = ""; public string $title = "";
#[Property(type: 'boolean')] /**
* @OA\Property(type="boolean")
*/
public bool $installed = false; public bool $installed = false;
} }

View File

@ -13,38 +13,62 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Items;
class Shop class Shop
{ {
#[Property(type: 'integer')] /**
* @OA\Property(type="integer")
*/
public int $id = 0; public int $id = 0;
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $uuid = ""; public string $uuid = "";
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $name = ""; public string $name = "";
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $basketField1 = ""; public string $basketField1 = "";
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $basketField2 = ""; public string $basketField2 = "";
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $logo1 = ""; public string $logo1 = "";
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $logo2 = ""; public string $logo2 = "";
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $browsericon = ""; public string $browsericon = "";
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $basketPosField1 = ""; public string $basketPosField1 = "";
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $basketPosField2 = ""; public string $basketPosField2 = "";
#[Property(type: 'array', items: new Items(ref: new Model(type: PSC\Component\ApiBundle\Model\Shop\Domain::class)))] /**
* @OA\Property(type="array", @OA\Items(ref=@Model(type=\PSC\Component\ApiBundle\Model\Shop\Domain::class)))
*/
public array $domains = []; public array $domains = [];
#[Property(type: 'boolean')] /**
* @OA\Property(type="boolean")
*/
public bool $disabled = false; public bool $disabled = false;
#[Property(type: 'boolean')] /**
* @OA\Property(type="boolean")
*/
public bool $private = false; public bool $private = false;
/** /**

View File

@ -13,9 +13,8 @@
namespace PSC\Component\ApiBundle\Model\Shop; namespace PSC\Component\ApiBundle\Model\Shop;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class Domain class Domain
{ {
@ -26,10 +25,16 @@ class Domain
$this->ssl = $ssl; $this->ssl = $ssl;
} }
#[Property(type: 'integer')] /**
* @OA\Property(type="integer")
*/
public int $id; public int $id;
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $name = ""; public string $name = "";
#[Property(type: 'boolean')] /**
* @OA\Property(type="boolean")
*/
public bool $ssl = false; public bool $ssl = false;
} }

View File

@ -13,24 +13,37 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class Stockbooking class Stockbooking
{ {
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $id; public string $id;
#[Property(type: 'object')] /**
* @OA\Property(type="object")
*/
public Contact $contact; public Contact $contact;
#[Property(type: 'object')] /**
* @OA\Property(type="object")
*/
public Product $product; public Product $product;
#[Property(type: 'integer')] /**
* @OA\Property(type="integer")
*/
public int $amount = 0; public int $amount = 0;
#[Property(type: 'date')] /**
* @OA\Property(type="date")
*/
public \DateTime $created; public \DateTime $created;
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $deliveryNumber; public string $deliveryNumber;
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $description; public string $description;
} }

View File

@ -13,15 +13,17 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class Version class Version
{ {
#[Property(type: 'string', maxLength: 255)] /**
* @OA\Property(type="string", maxLength=255)
*/
public string $datum = ""; public string $datum = "";
/**
#[Property(type: 'string', maxLength: 255)] * @OA\Property(type="string", maxLength=255)
*/
public string $release = ""; public string $release = "";
} }

View File

@ -1,4 +1,4 @@
psc_component_api_system: psc_component_api_system:
resource: "@PSCComponentApiBundle/Api" resource: "@PSCComponentApiBundle/Api"
prefix: /api prefix: /api
type: attribute type: annotation

View File

@ -5,3 +5,7 @@ services:
PSC\Component\ApiBundle\: PSC\Component\ApiBundle\:
resource: '../../*/*' resource: '../../*/*'
PSC\Component\ApiBundle\Converter\RequestBody:
tags:
- { name: request.param_converter, converter: "psc_rest.request_body" }

View File

@ -26,8 +26,8 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Translation\Exception\NotFoundResourceException; use Symfony\Component\Translation\Exception\NotFoundResourceException;
/** /**

View File

@ -14,9 +14,9 @@
namespace PSC\Component\SteplayouterBundle\Calendar\Type; namespace PSC\Component\SteplayouterBundle\Calendar\Type;
use PSC\Component\SteplayouterBundle\Calendar\Type; use PSC\Component\SteplayouterBundle\Calendar\Type;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
/** /**
* DefaultController fürs ProductionBundle * DefaultController fürs ProductionBundle

View File

@ -14,9 +14,9 @@
namespace PSC\Component\SteplayouterBundle\Calendar\Type; namespace PSC\Component\SteplayouterBundle\Calendar\Type;
use PSC\Component\SteplayouterBundle\Calendar\Type; use PSC\Component\SteplayouterBundle\Calendar\Type;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
class Hochvariable extends Type class Hochvariable extends Type
{ {

View File

@ -14,9 +14,9 @@
namespace PSC\Component\SteplayouterBundle\Calendar\Type; namespace PSC\Component\SteplayouterBundle\Calendar\Type;
use PSC\Component\SteplayouterBundle\Calendar\Type; use PSC\Component\SteplayouterBundle\Calendar\Type;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
/** /**
* DefaultController fürs ProductionBundle * DefaultController fürs ProductionBundle

View File

@ -21,14 +21,28 @@ class PrintPdfCommand extends Command
{ {
protected function configure() protected function configure()
{ {
$this->setName('component:steplayouter:pdf:print') $this
->setName('component:steplayouter:pdf:print')
->setDescription('Create Print PDF') ->setDescription('Create Print PDF')
->addArgument('outputDir', InputArgument::REQUIRED, 'Layouter Id') ->addArgument(
->addArgument('layouterUid', InputArgument::REQUIRED, 'Layouter Id') 'outputDir',
->addArgument('aliasUid', InputArgument::REQUIRED, 'Alias Id'); InputArgument::REQUIRED,
'Layouter Id'
)
->addArgument(
'layouterUid',
InputArgument::REQUIRED,
'Layouter Id'
)
->addArgument(
'aliasUid',
InputArgument::REQUIRED,
'Alias Id'
)
;
} }
protected function execute(InputInterface $input, OutputInterface $output): int protected function execute(InputInterface $input, OutputInterface $output)
{ {
$layouter_uuid = $input->getArgument('layouterUid'); $layouter_uuid = $input->getArgument('layouterUid');
$outfilename = $input->getArgument('outputDir'); $outfilename = $input->getArgument('outputDir');
@ -38,7 +52,5 @@ class PrintPdfCommand extends Command
$pdfService = $this->getContainer()->get('psc.component.steplayouter.pdf'); $pdfService = $this->getContainer()->get('psc.component.steplayouter.pdf');
$pdfService->create($outfilename, $layouter_uuid, $aliasUid); $pdfService->create($outfilename, $layouter_uuid, $aliasUid);
return 0;
} }
} }

View File

@ -18,11 +18,11 @@ use PSC\Component\SteplayouterBundle\Calendar\Type\Quer;
use PSC\Component\SteplayouterBundle\Calendar\Type\Hoch; use PSC\Component\SteplayouterBundle\Calendar\Type\Hoch;
use PSC\Component\SteplayouterBundle\Calendar\Design; use PSC\Component\SteplayouterBundle\Calendar\Design;
use PSC\Component\SteplayouterBundle\Calendar\Generator; use PSC\Component\SteplayouterBundle\Calendar\Generator;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
/** /**
* CalendarController fürs SteplayouterBundle * CalendarController fürs SteplayouterBundle

View File

@ -13,9 +13,9 @@
namespace PSC\Component\SteplayouterBundle\Controller; namespace PSC\Component\SteplayouterBundle\Controller;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
/** /**
@ -33,7 +33,7 @@ class DefaultController extends AbstractController
* @return View * @return View
*/ */
#[Route(path: '/component/steplayouter', name: 'component_steplayouter')] #[Route(path: '/component/steplayouter', name: 'component_steplayouter')]
#[Template('@PSCComponentSteplayouter/default/index.html.twig')] #[Template]
public function indexAction() public function indexAction()
{ {
return array('stylePath' => '{{stylePath}}'); return array('stylePath' => '{{stylePath}}');

File diff suppressed because one or more lines are too long

View File

@ -23,8 +23,8 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Translation\Exception\NotFoundResourceException; use Symfony\Component\Translation\Exception\NotFoundResourceException;
use PSC\Component\SteplayouterBundle\Config\Converter\ToArray; use PSC\Component\SteplayouterBundle\Config\Converter\ToArray;

View File

@ -25,8 +25,8 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Translation\Exception\NotFoundResourceException; use Symfony\Component\Translation\Exception\NotFoundResourceException;
/** /**

View File

@ -24,9 +24,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
@ -45,8 +45,8 @@ class CheckController extends AbstractController
* @return View * @return View
*/ */
#[Route(path: '/check/index', name: 'psc_component_steplayouter_system_check_index')] #[Route(path: '/check/index', name: 'psc_component_steplayouter_system_check_index')]
#[Template('@PSCComponentSteplayouter/system/check/index.html.twig')] #[Template]
#[IsGranted('ROLE_SHOP')] #[Security("is_granted('ROLE_SHOP')")]
public function indexAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, EntityManagerInterface $entityManager) public function indexAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, EntityManagerInterface $entityManager)
{ {
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */

View File

@ -24,9 +24,9 @@ use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
@ -49,8 +49,8 @@ class SettingsController extends AbstractController
* @throws \Doctrine\ORM\ORMException * @throws \Doctrine\ORM\ORMException
*/ */
#[Route(path: '/settings/index', name: 'psc_component_steplayouter_system_settings_index')] #[Route(path: '/settings/index', name: 'psc_component_steplayouter_system_settings_index')]
#[Template('@PSCComponentSteplayouter/system/settings/index.html.twig')] #[Template]
#[IsGranted('ROLE_SHOP')] #[Security("is_granted('ROLE_SHOP')")]
public function indexAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, DocumentManager $documentManager) public function indexAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, DocumentManager $documentManager)
{ {
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */

View File

@ -2,6 +2,8 @@ services:
_defaults: _defaults:
autowire: true autowire: true
autoconfigure: true autoconfigure: true
bind:
$pdflib_lic: 'L900202-010091-135115-PPD3D2-EHE432'
PSC\Component\SteplayouterBundle\: PSC\Component\SteplayouterBundle\:
resource: '../../*/*' resource: '../../*/*'
@ -13,3 +15,27 @@ services:
PSC\Component\SteplayouterBundle\Queue\Render: PSC\Component\SteplayouterBundle\Queue\Render:
tags: tags:
- { name: queues } - { 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']
#

View File

@ -24,31 +24,28 @@ use Twig\Environment;
class Pdf class Pdf
{ {
protected $entityManager; protected $entityManager;
protected $pdf_lic;
protected $kernel; protected $kernel;
protected $mongoDb; protected $mongoDb;
protected $converter; protected $converter;
protected $twig; protected $twig;
public function __construct( public function __construct(EntityManagerInterface $em, $pdflib_lic, KernelInterface $kernel, ToArray $converter, DocumentManager $mongoDb, Environment $twig)
EntityManagerInterface $em, {
KernelInterface $kernel,
ToArray $converter,
DocumentManager $mongoDb,
Environment $twig,
) {
$this->entityManager = $em; $this->entityManager = $em;
$this->pdf_lic = $pdflib_lic;
$this->kernel = $kernel; $this->kernel = $kernel;
$this->converter = $converter; $this->converter = $converter;
$this->mongoDb = $mongoDb; $this->mongoDb = $mongoDb;
$this->twig = $twig; $this->twig = $twig;
} }
public function create($outfilename, $layouter_uuid, $alias = '') public function create($outfilename, $layouter_uuid, $alias = "")
{ {
/** @var Layoutdesigndata $layoutData */ /** @var Layoutdesigndata $layoutData */
$layoutData = $this->entityManager $layoutData = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata') ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouter_uuid));
->findOneBy(['uuid' => $layouter_uuid]);
if (!$layoutData) { if (!$layoutData) {
return; return;
@ -61,16 +58,32 @@ class Pdf
$dynamicSizeHeight = $layoutData->getDynamicHeight(); $dynamicSizeHeight = $layoutData->getDynamicHeight();
if (empty($datatable)) { if (empty($datatable)) {
$datatable[] = []; $datatable[] = array();
} }
$product = $this->entityManager $product = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Product') ->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $layoutData->getArticleUuid()));
->findOneBy(['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");
$dataArray = $this->converter->fromXml($product); $dataArray = $this->converter->fromXml($product);
$tempFiles = []; $tempFiles = array();
foreach ($datatable as $row) { foreach ($datatable as $row) {
$pageOpen = false; $pageOpen = false;
@ -81,75 +94,306 @@ class Pdf
continue; continue;
} }
$svg = $this->utf8_for_xml($site['fabricSVG']); $svgContent = $this->utf8_for_xml($site['fabricSVG']);
if ($dynamicSize) { if ($dynamicSize) {
$site['width'] = $dynamicSizeWidth; $site['width'] = $dynamicSizeWidth;
$site['height'] = $dynamicSizeHeight; $site['height'] = $dynamicSizeHeight;
} }
preg_match_all('/(image|xlink:href)=(")[^">]+/i', $svg, $media); $xml = simplexml_load_string($svgContent);
$urls = preg_replace('/(image|xlink:href)("|=")(.*)/i', '$3', $media[0]); $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]);
$cal = false; $cal = false;
foreach ($urls as $url) { foreach ($urls as $url) {
$matches = []; $matches = array();
$found = preg_match( $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);
'/[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) { if ($found == 0) {
$found = preg_match( $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);
'/[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) { if ($found == 0) {
$found = preg_match("/\/[a-fA-F0-9]{24}/", $url, $matches); $found = preg_match("/\/[a-fA-F0-9]{24}/", $url, $matches);
if (isset($matches[0])) { if (isset($matches[0])) {
$matches[0] = str_replace('/', '', $matches[0]); $matches[0] = str_replace("/", "", $matches[0]);
} }
} }
if ($found) { if ($found) {
$motiv = $this->mongoDb->getRepository(Motiv::class)->find($matches[0]); $motiv = $this->mongoDb
->getRepository(Motiv::class)
->find($matches[0]);
if (!$motiv) { if (!$motiv) {
$motiv = $this->entityManager $motiv = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Motiv') ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv')->findOneByUuid($matches[0]);
->findOneByUuid($matches[0]);
} }
if ($motiv) { if ($motiv) {
$svg = str_replace($url, '/data/www/old/market/motive/' . $motiv->getFileOrginal(), $svg); $svgContent = str_replace($url, "../market/motive/" . $motiv->getFileOrginal(), $svgContent);
} }
continue; 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('/<image.*calendar.+<\/image>/', $cal, $svgContent);
$svgContent = str_replace($url, $cal, $svgContent);
}
} }
$template = $this->twig->createTemplate($svg); $template = $this->twig->createTemplate($svgContent);
$svg = $template->render([ $svgContent = $template->render(array(
'row' => $row, 'row' => $row
]); ));
$tmpSvg = tempnam(sys_get_temp_dir(), 'svg_') . '.svg'; file_put_contents($this->kernel->getProjectDir() . "/web/temp/" . $layouter_uuid . '_' . $key . ".svg", $svgContent);
$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); $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'];
$tempFiles[] = $tmpPdf; 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("");
} }
} }
$allPdfs = implode(' ', array_map('escapeshellarg', $tempFiles)); $p->end_document("");
$cmd = 'pdfunite ' . $allPdfs . ' ' . escapeshellarg($outfilename) . ' 2>&1';
exec($cmd, $out, $ret);
foreach ($tempFiles as $file) { foreach ($tempFiles as $file) {
unlink($file); unlink($file);

View File

@ -8,7 +8,7 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
class PSCLibrariesAutoRegistryBundle extends Bundle class PSCLibrariesAutoRegistryBundle extends Bundle
{ {
public function build(ContainerBuilder $container): void public function build(ContainerBuilder $container)
{ {
parent::build($container); parent::build($container);
$container->addCompilerPass(new AutoRegistryCompilerPass()); $container->addCompilerPass(new AutoRegistryCompilerPass());

View File

@ -1,16 +0,0 @@
<?php
declare(strict_types=1);
namespace PSC\Libraries\DoctrineBundle\DBAL\Platform;
use Doctrine\DBAL\Platforms\MariaDBPlatform as BaseMariaDBPlatform;
/**
* Custom MariaDB Platform to support all MariaDB versions
*/
class MariaDBPlatform extends BaseMariaDBPlatform
{
// This class extends the base MariaDB platform
// and can be used to add custom functionality if needed
}

View File

@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;

View File

@ -30,9 +30,9 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
@ -70,7 +70,7 @@ class EditController extends AbstractController
* @throws \Doctrine\ORM\ORMException * @throws \Doctrine\ORM\ORMException
*/ */
#[Route(path: '/edit/create', name: 'psc_shop_account_backend_create')] #[Route(path: '/edit/create', name: 'psc_shop_account_backend_create')]
#[Template('@PSCShopAccount/backend/edit/create.html.twig')] #[Template]
public function createAction( public function createAction(
Request $request, Request $request,
Field $fieldService, Field $fieldService,
@ -145,7 +145,7 @@ class EditController extends AbstractController
* @throws \Doctrine\ODM\MongoDB\MongoDBException * @throws \Doctrine\ODM\MongoDB\MongoDBException
*/ */
#[Route(path: '/edit/edit/{uuid}', name: 'psc_shop_account_backend_edit')] #[Route(path: '/edit/edit/{uuid}', name: 'psc_shop_account_backend_edit')]
#[Template('@PSCShopAccount/backend/edit/edit.html.twig')] #[Template]
public function editAction( public function editAction(
Request $request, Request $request,
Field $fieldService, Field $fieldService,

View File

@ -16,7 +16,7 @@ namespace PSC\Shop\AccountBundle\Controller\Backend;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Knp\Component\Pager\PaginatorInterface; use Knp\Component\Pager\PaginatorInterface;
use Spiriit\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface; use Lexik\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface;
use PSC\Shop\AccountBundle\Form\Backend\SearchType; use PSC\Shop\AccountBundle\Form\Backend\SearchType;
use PSC\Shop\EntityBundle\Entity\Motiv; use PSC\Shop\EntityBundle\Entity\Motiv;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
@ -26,9 +26,9 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bridge\Twig\Attribute\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
@ -53,9 +53,9 @@ class ListController extends AbstractController
* @return array * @return array
* @throws \Doctrine\ORM\ORMException * @throws \Doctrine\ORM\ORMException
*/ */
#[IsGranted('ROLE_ADMIN')] #[Security("is_granted('ROLE_ADMIN')")]
#[Route(path: '/list/index', name: 'psc_shop_account_backend_list')] #[Route(path: '/list/index', name: 'psc_shop_account_backend_list')]
#[Template('@PSCShopAccount/backend/list/index.html.twig')] #[Template]
public function indexAction(Request $request, Shop $shopService, EntityManagerInterface $entityManager, PaginatorInterface $paginator, FilterBuilderUpdaterInterface $filterBuilderUpdater, SessionInterface $session) public function indexAction(Request $request, Shop $shopService, EntityManagerInterface $entityManager, PaginatorInterface $paginator, FilterBuilderUpdaterInterface $filterBuilderUpdater, SessionInterface $session)
{ {

View File

@ -3,13 +3,15 @@
namespace PSC\Shop\AccountBundle\Dto\All; namespace PSC\Shop\AccountBundle\Dto\All;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Items;
use PSC\Shop\ContactBundle\Model\Contact; use PSC\Shop\ContactBundle\Model\Contact;
class Output class Output
{ {
#[Property(type: 'array', items: new Items(ref: new Model(type: PSC\Shop\AccountBundle\Model\Account::class)))] /**
* @var Contact[]
*
* @OA\Property(type="array", @OA\Items(ref=@Model(type=\PSC\Shop\AccountBundle\Model\Account::class)))
*/
public array $data = []; public array $data = [];
} }

View File

@ -13,8 +13,8 @@
namespace PSC\Shop\AccountBundle\Form\Backend; namespace PSC\Shop\AccountBundle\Form\Backend;
use Spiriit\Bundle\FormFilterBundle\Filter\Form\Type\TextFilterType; use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\TextFilterType;
use Spiriit\Bundle\FormFilterBundle\Filter\Query\QueryInterface; use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;

View File

@ -3,24 +3,33 @@
namespace PSC\Shop\AccountBundle\Model; namespace PSC\Shop\AccountBundle\Model;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes as OA; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Property;
class Account class Account
{ {
#[Property(type: 'integer')] /**
* @OA\Property(type="integer")
*/
private int $id = 0; private int $id = 0;
#[Property(type: 'integer')] /**
* @OA\Property(type="integer")
*/
private int $uid = 0; private int $uid = 0;
#[Property(type: 'string')] /**
* @OA\Property(type="string")
*/
private string $uuid = ""; private string $uuid = "";
#[Property(type: 'string')] /**
* @OA\Property(type="string")
*/
private string $appendix; private string $appendix;
#[Property(type: 'string')] /**
* @OA\Property(type="string")
*/
private string $title; private string $title;
public function getUuid(): string public function getUuid(): string

View File

@ -1,9 +1,9 @@
psc_shop_account_backend: psc_shop_account_backend:
resource: "@PSCShopAccountBundle/Controller/Backend" resource: "@PSCShopAccountBundle/Controller/Backend"
type: attribute type: annotation
prefix: /backend/account prefix: /backend/account
psc_shop_account_api: psc_shop_account_api:
resource: "@PSCShopAccountBundle/Api" resource: "@PSCShopAccountBundle/Api"
type: attribute type: annotation
prefix: /api/account prefix: /api/account

View File

@ -3,11 +3,9 @@
namespace PSC\Shop\BasketBundle\Api\Basket\Legacy; namespace PSC\Shop\BasketBundle\Api\Basket\Legacy;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes\JsonContent; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\RequestBody; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Shop\BasketBundle\Dto\Legacy\Input; use PSC\Shop\BasketBundle\Dto\Legacy\Input;
use PSC\Shop\BasketBundle\Dto\Legacy\Output; use PSC\Shop\BasketBundle\Dto\Legacy\Output;
@ -15,30 +13,40 @@ use PSC\Shop\BasketBundle\Event\Legacy\Add as PSCAdd;
use PSC\Shop\EntityBundle\Entity\Product; use PSC\Shop\EntityBundle\Entity\Product;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
class Add extends AbstractController class Add extends AbstractController
{ {
public function __construct( public function __construct(private readonly EntityManagerInterface $entityManager, private readonly EventDispatcherInterface $eventDispatcher, private readonly TokenStorageInterface $tokenStorage)
private readonly EntityManagerInterface $entityManager, {
private readonly EventDispatcherInterface $eventDispatcher, }
private readonly TokenStorageInterface $tokenStorage,
) {}
/** /**
* change temp basketitem
*
* @deprecated * @deprecated
*
* @OA\Response(
* response=200,
* description="basket",
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\BasketBundle\Dto\Legacy\Output::class))
* )
* @OA\RequestBody(
* description="This is a request body",
* @Model(type=\PSC\Shop\BasketBundle\Dto\Legacy\Input::class))
* )
* @OA\Tag(name="Basket")
*/ */
#[Tag(name: 'Basket')]
#[Response(response: 200, description: 'basket', content: new JsonContent(ref: new Model(type: Output::class)))]
#[RequestBody(description: 'This is a request body', content: new Model(type: Input::class))]
#[Route(path: '/legacy/add', methods: ['POST'])] #[Route(path: '/legacy/add', methods: ['POST'])]
public function add(#[MapRequestPayload] Input $data): JsonResponse #[ParamConverter('data', class: '\PSC\Shop\BasketBundle\Dto\Legacy\Input', converter: 'psc_rest.request_body')]
public function add(Input $data): JsonResponse
{ {
include_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Item.php'; include_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Item.php';
include_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Collection.php'; include_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Collection.php';
@ -52,25 +60,26 @@ class Add extends AbstractController
$this->eventDispatcher->dispatch($event, PSCAdd::NAME); $this->eventDispatcher->dispatch($event, PSCAdd::NAME);
} }
$articles = $_SESSION['Basket']['Articles']; $articles = $_SESSION['Basket']['Articles'];
/** /**
* @var \TP_Basket_Item $basketItem * @var \TP_Basket_Item $basketItem
*/ */
$basketItem = clone $_SESSION['Basket']['TempProduct'][$data->productUUId]; $basketItem = clone($_SESSION['Basket']['TempProduct'][$data->productUUId]);
$basketItem->setDeliveryDate((string) $data->deliveryDate); $basketItem->setDeliveryDate((string)$data->deliveryDate);
$basketItem->setDeliveryInfo((string) $data->deliveryInfo); $basketItem->setDeliveryInfo((string)$data->deliveryInfo);
if (((string) $data->ref) != '') { if ((string)$data->ref != "") {
$basketItem->setRef($data->ref); $basketItem->setRef($data->ref);
} }
if (((string) $data->basketField1) != '') { if ((string)$data->basketField1 != "") {
$basketItem->setRef($data->basketField1); $basketItem->setRef($data->basketField1);
} }
if (((string) $data->basketField2) != '') { if ((string)$data->basketField2 != "") {
$basketItem->setKst($data->basketField2); $basketItem->setKst($data->basketField2);
} }
$basketItem->setXmlProduct((string) $data->xmlProduct); $basketItem->setXmlProduct((string)$data->xmlProduct);
if (((string) $data->layouterUuid) != '') { if ((string)$data->layouterUuid != "") {
$basketItem->setLayouterId((string) $data->layouterUuid); $basketItem->setLayouterId((string)$data->layouterUuid);
} }
$itemId = $articles->addItem($basketItem); $itemId = $articles->addItem($basketItem);
if ($data->clearTempItem) { if ($data->clearTempItem) {
@ -83,6 +92,6 @@ class Add extends AbstractController
return $this->json(new Output()); return $this->json(new Output());
} }
return $this->json(new NotFound('order not found')); return $this->json(new NotFound("order not found"));
} }
} }

View File

@ -3,11 +3,9 @@
namespace PSC\Shop\BasketBundle\Api\Basket\Legacy; namespace PSC\Shop\BasketBundle\Api\Basket\Legacy;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes\JsonContent; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\RequestBody; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Shop\BasketBundle\Dto\Legacy\Input; use PSC\Shop\BasketBundle\Dto\Legacy\Input;
use PSC\Shop\BasketBundle\Dto\Legacy\Output; use PSC\Shop\BasketBundle\Dto\Legacy\Output;
@ -15,11 +13,12 @@ use PSC\Shop\BasketBundle\Event\Legacy\Temp as PSCTemp;
use PSC\Shop\EntityBundle\Entity\Product; use PSC\Shop\EntityBundle\Entity\Product;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
class Temp extends AbstractController class Temp extends AbstractController
@ -34,17 +33,27 @@ class Temp extends AbstractController
} }
/** /**
* change temp basketitem
* @deprecated * @deprecated
*
* @OA\Response(
* response=200,
* description="basket",
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\BasketBundle\Dto\Legacy\Output::class))
* )
* @OA\RequestBody(
* description="This is a request body",
* @Model(type=\PSC\Shop\BasketBundle\Dto\Legacy\Input::class))
* )
* @OA\Tag(name="Basket")
*/ */
#[Tag(name: 'Basket')]
#[Response(response: 200, description: 'basket', content: new JsonContent(ref: new Model(type: Output::class)))]
#[RequestBody(description: 'This is a request body', content: new Model(type: Input::class))]
#[Route(path: '/legacy/temp', methods: ['POST'])] #[Route(path: '/legacy/temp', methods: ['POST'])]
public function temp(#[MapRequestPayload] Input $data): JsonResponse #[ParamConverter('data', class: '\PSC\Shop\BasketBundle\Dto\Legacy\Input', converter: 'psc_rest.request_body')]
public function temp(Input $data): JsonResponse
{ {
require_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Item.php'; require_once(__DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Item.php');
require_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Collection.php'; require_once(__DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Collection.php');
require_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Util.php'; require_once(__DIR__ . '/../../../../EntityBundle/Lagacy/TP_Util.php');
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $data->productUUId]); $product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $data->productUUId]);
@ -53,7 +62,7 @@ class Temp extends AbstractController
$this->eventDispatcher->dispatch($event, PSCTemp::NAME); $this->eventDispatcher->dispatch($event, PSCTemp::NAME);
$basketItem = $_SESSION['Basket']['TempProduct'][$data->productUUId]; $basketItem = $_SESSION['Basket']['TempProduct'][$data->productUUId];
$basketItem->setXmlProduct((string) $data->xmlProduct); $basketItem->setXmlProduct((string)$data->xmlProduct);
$output = new Output(); $output = new Output();
$output->success = true; $output->success = true;
@ -62,6 +71,6 @@ class Temp extends AbstractController
return $this->json(new Output()); return $this->json(new Output());
} }
return $this->json(new NotFound('order not found')); return $this->json(new NotFound("order not found"));
} }
} }

View File

@ -3,11 +3,9 @@
namespace PSC\Shop\BasketBundle\Api\Basket\Legacy; namespace PSC\Shop\BasketBundle\Api\Basket\Legacy;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Attribute\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes\JsonContent; use Nelmio\ApiDocBundle\Annotation\Security;
use OpenApi\Attributes\RequestBody; use OpenApi\Annotations as OA;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Component\ApiBundle\Dto\Error\NotFound;
use PSC\Shop\BasketBundle\Dto\Legacy\Input; use PSC\Shop\BasketBundle\Dto\Legacy\Input;
use PSC\Shop\BasketBundle\Dto\Legacy\Output; use PSC\Shop\BasketBundle\Dto\Legacy\Output;
@ -15,11 +13,12 @@ use PSC\Shop\BasketBundle\Event\Legacy\Update as PSCUpdate;
use PSC\Shop\EntityBundle\Entity\Product; use PSC\Shop\EntityBundle\Entity\Product;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
class Update extends AbstractController class Update extends AbstractController
@ -34,17 +33,27 @@ class Update extends AbstractController
} }
/** /**
* change temp basketitem
* @deprecated * @deprecated
*
* @OA\Response(
* response=200,
* description="basket",
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\BasketBundle\Dto\Legacy\Output::class))
* )
* @OA\RequestBody(
* description="This is a request body",
* @Model(type=\PSC\Shop\BasketBundle\Dto\Legacy\Input::class))
* )
* @OA\Tag(name="Basket")
*/ */
#[Tag(name: 'Basket')]
#[Response(response: 200, description: 'basket', content: new JsonContent(ref: new Model(type: Output::class)))]
#[RequestBody(description: 'This is a request body', content: new Model(type: Input::class))]
#[Route(path: '/legacy/update', methods: ['POST'])] #[Route(path: '/legacy/update', methods: ['POST'])]
public function update(#[MapRequestPayload] Input $data): JsonResponse #[ParamConverter('data', class: '\PSC\Shop\BasketBundle\Dto\Legacy\Input', converter: 'psc_rest.request_body')]
public function update(Input $data): JsonResponse
{ {
require_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Item.php'; require_once(__DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Item.php');
require_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Collection.php'; require_once(__DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Collection.php');
require_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Util.php'; require_once(__DIR__ . '/../../../../EntityBundle/Lagacy/TP_Util.php');
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $data->productUUId]); $product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $data->productUUId]);
@ -54,9 +63,9 @@ class Update extends AbstractController
$articles = $_SESSION['Basket']['Articles']; $articles = $_SESSION['Basket']['Articles'];
$basketItem = $_SESSION['Basket']['TempProduct'][$data->productUUId]; $basketItem = $_SESSION['Basket']['TempProduct'][$data->productUUId];
$basketItem->setDeliveryDate((string) $data->deliveryDate); $basketItem->setDeliveryDate((string)$data->deliveryDate);
$basketItem->setDeliveryInfo((string) $data->deliveryInfo); $basketItem->setDeliveryInfo((string)$data->deliveryInfo);
$basketItem->setXmlProduct((string) $data->xmlProduct); $basketItem->setXmlProduct((string)$data->xmlProduct);
$articles->updateItem($basketItem->getInLoad(), $basketItem); $articles->updateItem($basketItem->getInLoad(), $basketItem);
$output = new Output(); $output = new Output();
@ -68,6 +77,6 @@ class Update extends AbstractController
return $this->json(new Output()); return $this->json(new Output());
} }
return $this->json(new NotFound('order not found')); return $this->json(new NotFound("order not found"));
} }
} }

View File

@ -1,91 +0,0 @@
<?php
namespace PSC\Shop\BasketBundle\Api\Layouter;
use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\RequestBody;
use OpenApi\Attributes\Response;
use OpenApi\Attributes\Tag;
use PSC\Shop\BasketBundle\Dto\Layouter\Input;
use PSC\Shop\BasketBundle\Dto\Legacy\Output;
use PSC\Shop\EntityBundle\Entity\LayouterSession;
use PSC\Shop\EntityBundle\Repository\LayouterSessionRepository;
use PSC\Shop\EntityBundle\Repository\ProductRepository;
use Ramsey\Uuid\Nonstandard\Uuid;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use TP_Layouter_Item;
class Save extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly LayouterSessionRepository $layouterSessionRepository,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly ProductRepository $productRepository,
private readonly TokenStorageInterface $tokenStorage,
) {}
#[Tag(name: 'Basket')]
#[Response(response: 200, description: 'basket', content: new JsonContent(ref: new Model(type: Output::class)))]
#[RequestBody(description: 'This is a request body', content: new Model(type: Input::class))]
#[Route(path: '/layouter/save', methods: ['POST'])]
public function save(#[MapRequestPayload] Input $data): JsonResponse
{
include_once __DIR__ . '/../../../EntityBundle/Lagacy/TP_Basket_Item.php';
include_once __DIR__ . '/../../../EntityBundle/Lagacy/TP_Basket_Collection.php';
include_once __DIR__ . '/../../../EntityBundle/Lagacy/TP_Util.php';
include_once __DIR__ . '/../../../EntityBundle/Lagacy/TP_Layouter_Item.php';
include_once __DIR__ . '/../../../EntityBundle/Lagacy/TP_Layoutersession.php';
$product = $this->productRepository->findOneBy(['uuid' => $data->productUUId]);
if ($this->tokenStorage->getToken()) {
$row = new LayouterSession();
$row->setUuid(Uuid::uuid4()->toString());
$row->setContactId(
$this->tokenStorage
->getToken()
->getUser()
->getId(),
);
$row->setProductId($data->productUUId);
$row->setTitle($product->getTitle());
$row->setLayouterModus($data->layouterModus);
// TODO: Store uploadedFiles in session data
$this->entityManager->persist($row);
return $this->json([
'success' => true,
'layouterUUId' => $row->getUuid(),
'auth' => true,
'user' => $this->tokenStorage
->getToken()
->getUser()
->getUsername(),
]);
}
$session = new TP_Layouter_Item();
$session->setTitle($product->getTitle());
$session->setArticleId(Uuid::uuid4()->toString());
$session->setOrgArticleId($data->productUUId);
$session->setIsEdit(true);
$session->setUpdated(date('Y-m-d H:i:s'));
$session->setLayouterModus($data->layouterModus);
// Store uploaded files in session
$_SESSION['Layoutersession']['data'][$session->getArticleId()] = $session;
return $this->json([
'success' => true,
'auth' => false,
'layouterUUId' => $session->getArticleId(),
]);
}
}

Some files were not shown because too many files have changed in this diff Show More