Compare commits

...

34 Commits

Author SHA1 Message Date
9937165710 Fixes
Some checks failed
Gitea Actions / Run-Tests-On-Amd64 (push) Failing after 41m47s
Gitea Actions / Merge (push) Successful in 6m45s
Gitea Actions / Run-Tests-On-Arm64 (push) Has been cancelled
2026-02-12 10:31:22 +01:00
a2fc107f26 Backup
Some checks failed
Gitea Actions / Run-Tests-On-Amd64 (push) Failing after 39m16s
Gitea Actions / Merge (push) Successful in 6m32s
Gitea Actions / Run-Tests-On-Arm64 (push) Has been cancelled
2026-01-27 09:33:52 +01:00
a2187a48b8 Fixes 2026-01-13 18:22:22 +01:00
d598a9214f Fixes+ 2026-01-13 11:04:34 +01:00
3a0019a1b9 Fixes 2026-01-08 09:48:02 +01:00
7e46c1fc5d Fixes 2026-01-06 10:09:37 +01:00
47057ea7a3 Fixes 2025-12-31 16:47:12 +01:00
e9ca2223e4 Fixes 2025-12-23 14:03:01 +01:00
91ba43510b backup
Some checks failed
Gitea Actions / Run-Tests-On-Amd64 (push) Failing after 36m1s
Gitea Actions / Merge (push) Successful in 5m39s
Gitea Actions / Run-Tests-On-Arm64 (push) Has been cancelled
2025-12-19 17:03:27 +01:00
6d6241576d backup 2025-12-17 19:53:54 +01:00
1ff03906c2 backup 2025-12-17 19:32:50 +01:00
7e7628bbd3 Fixes
Some checks failed
Gitea Actions / Run-Tests-On-Amd64 (push) Failing after 40m13s
Gitea Actions / Merge (push) Successful in 6m14s
Gitea Actions / Run-Tests-On-Arm64 (push) Has been cancelled
2025-12-16 12:38:53 +01:00
1cc2bc57ba Basket Bundle Attributes 2025-12-15 17:01:07 +01:00
c504f9e4de Basket Bundle Attributes 2025-12-13 18:24:33 +01:00
e044a424fa Fixes 2025-12-13 18:02:25 +01:00
0c00d36236 Fixes 2025-12-12 10:51:44 +01:00
e320761ff5 FIxes 2025-12-11 23:02:19 +01:00
0e1ae9a1a7 FIxes 2025-12-11 22:41:54 +01:00
4db2d79207 FIxes 2025-12-11 21:42:48 +01:00
beb6450338 Fixes 2025-12-11 15:11:46 +01:00
4be0f5a39d first migrate 2025-12-11 09:55:37 +01:00
a65ecc8d47 first migrate 2025-12-11 09:47:54 +01:00
75caff77f1 Backup 2025-12-09 17:17:05 +01:00
ff9978d103 Logs 2025-12-08 15:44:56 +01:00
deca028334 Backup 2025-12-08 15:38:00 +01:00
3fc04a4373 Backup 2025-12-04 14:13:32 +01:00
d30ffb4981 Backup 2025-12-03 12:03:45 +01:00
b6e25299cd Backup 2025-12-03 12:03:04 +01:00
2bc45b89c4 Backup 2025-12-02 13:07:00 +01:00
1021f70a8b Cms 2025-11-04 10:23:20 +01:00
fe28e238be CMS und Status 2025-11-04 09:33:39 +01:00
60a41b5f14 Backup before 2025-11-03 14:33:01 +01:00
3f14580904 Backup 2025-10-24 10:22:54 +02:00
fbd0cbf43e Fix FriendlyCaptcha for Guest Action 2025-10-21 10:47:16 +02:00
818 changed files with 35167 additions and 20924 deletions

View File

@ -67,7 +67,7 @@ server {
# 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,8 +100,14 @@ 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
# COPY ./.docker/images/php/base/pdf/php_pdflib.so /pdflib.so RUN apt-get update && apt-get install -y --no-install-recommends \
poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# make bash default shell # 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,3 +10,7 @@ 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` float(8,2) DEFAULT 0.00, `a4_abpreis` varchar(20) DEFAULT NULL,
`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) NOT NULL, `anrede` varchar(100) DEFAULT 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(2) DEFAULT NULL, `laufrichtung` varchar(60) 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) NOT NULL, `smtpusethis` int(1) NULL DEFAULT 0,
`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,4 +31,3 @@ 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 ###

2
src/new/.env.dev Normal file
View File

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

View File

@ -1,27 +1,40 @@
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) => `
<div style="${psc.order.get_pos_bg_color(status)}" class="row ${psc.order.get_pos_bg_color_class(status)}" id="row-${uuid}"> <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 class="col-1 p-1">${pos}</div> <td class="px-2 py-3"></td>
<div class="col-4 p-1"> <td class="px-2 py-3 font-medium">${pos}</td>
<td class="px-2 py-3" colspan="2"></td>
<td class="px-2 py-3" colspan="2"></td>
<td class="px-2 py-3"></td>
<td class="px-2 py-3">
${ ${
(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 (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/>ArtNr intern: ${product.nrIntern}<br/> <br/><span class="text-xs text-gray-600">ArtNr intern: ${product.nrIntern}</span><br/>
${psc.order.get_special_product_options(product.specialProductTypeObject)}</div> ${psc.order.get_special_product_options(product.specialProductTypeObject)}
<div class="col-1 p-1">Auflage: ${price.count}</div> </td>
<div class="col-1 p-1">Kunden Info: ${customerInfo}${(reOrder? `<br/><strong>Ist eine Nachbestellung</strong>`:``)}</div> <td class="px-2 py-3">
<div class="col-1 p-1">${basketField1}</div> <span class="text-xs">Auflage: ${price.count}</span>
<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">Kunden Info: ${customerInfo}${(reOrder? `<br/><strong class="text-yellow-600">Ist eine Nachbestellung</strong>`:``)}</span>
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> </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} ${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="dropdown-menu"> <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">
${psc.order.get_pos_status_loop(orderUuid, uuid)} ${psc.order.get_pos_status_loop(orderUuid, uuid)}
</div> </div>
</div></div>
<div class="col-1 p-1"></div>
</div> </div>
</td>
</tr>
`; `;
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) => `
@ -45,7 +58,7 @@ const Order_List_Detail_Simple = ({ uuid, basketField1, customerInfo, basketFiel
`; `;
const Order_List_Pos_Status = (status, orderUuid, posUuid) => ` const Order_List_Pos_Status = (status, orderUuid, posUuid) => `
<button type="button" class="dropdown-item switch_pos" data-order-uuid="${orderUuid}" data-pos-uuid="${posUuid}" data-status="${status.code}">${status.internalName}</button> <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>
`; `;
const Order_List_Pos_Calc_Option = (elm) => ` const Order_List_Pos_Calc_Option = (elm) => `
@ -92,20 +105,26 @@ export class order {
$('.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;
if($('#rows-' + uuid + ' > div').length > 0) { var $icon = $(this);
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;
if($('#rows-' + uuid + ' > tr').length > 0) { var $icon = $(this);
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');
} }
}); });

View File

@ -2,16 +2,27 @@ 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'
window.$ = window.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 { 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 = $;
// 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'),
@ -36,3 +47,43 @@ 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 rounded-sm bg-lime-500 px-2 py-1 text-sm font-medium text-white hover:bg-opacity-90 justify-center shadow-xl; @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;
} }
.badge-no { .badge-no {
@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; @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;
} }
.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-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]; @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];
} }
.psc-button-secondary { .psc-button-secondary {
@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]; @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];
} }
.form-label { .form-label {

View File

@ -0,0 +1,74 @@
export class multiselect {
init() {
this.bindMultiSelectButtons();
}
bindMultiSelectButtons() {
// Find all multiselect widgets
$('[data-multiselect-widget]').each(function() {
const $widget = $(this);
const $from = $widget.find('select[name$="_from"]');
const $to = $widget.find('select[name]:not([name$="_from"])');
// Get base ID (without _from or _to suffix)
const fromId = $from.attr('id');
// Right All button
$widget.find('button[id$="_rightAll"]').off('click').on('click', function() {
$from.find('option').each(function() {
const $option = $(this).clone();
$to.append($option);
});
$from.empty();
});
// Right Selected button
$widget.find('button[id$="_rightSelected"]').off('click').on('click', function() {
$from.find('option:selected').each(function() {
const $option = $(this).clone();
$to.append($option);
$(this).remove();
});
});
// Left Selected button
$widget.find('button[id$="_leftSelected"]').off('click').on('click', function() {
$to.find('option:selected').each(function() {
const $option = $(this).clone();
$from.append($option);
$(this).remove();
});
});
// Left All button
$widget.find('button[id$="_leftAll"]').off('click').on('click', function() {
$to.find('option').each(function() {
const $option = $(this).clone();
$from.append($option);
});
$to.empty();
});
// Double click to move items
$from.off('dblclick').on('dblclick', 'option', function() {
const $option = $(this).clone();
$to.append($option);
$(this).remove();
});
$to.off('dblclick').on('dblclick', 'option', function() {
const $option = $(this).clone();
$from.append($option);
$(this).remove();
});
});
// Before form submit, select all options in the "to" select
$('form').on('submit', function() {
$(this).find('[data-multiselect-widget]').each(function() {
$(this).find('select[name]:not([name$="_from"]) option').prop('selected', true);
});
});
}
}

View File

@ -0,0 +1,307 @@
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,11 +25,10 @@
"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": "^2", "doctrine/doctrine-bundle": "^3",
"doctrine/mongodb-odm-bundle": "^5", "doctrine/mongodb-odm-bundle": "^5",
"doctrine/orm": "^2.7", "doctrine/orm": "^3",
"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",
@ -37,12 +36,11 @@
"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.7.*", "knplabs/knp-gaufrette-bundle": "0.9.*",
"knplabs/knp-menu-bundle": "^3", "knplabs/knp-menu-bundle": "^3",
"knplabs/knp-paginator-bundle": "5.9.*", "knplabs/knp-paginator-bundle": "6.10.*",
"lexik/form-filter-bundle": "^7",
"lexik/jwt-authentication-bundle": "^3", "lexik/jwt-authentication-bundle": "^3",
"liip/imagine-bundle": "2.9.*", "liip/imagine-bundle": "2.16.*",
"mistic100/randomcolor": "^1.1", "mistic100/randomcolor": "^1.1",
"mobiledetect/mobiledetectlib": "^2.8", "mobiledetect/mobiledetectlib": "^2.8",
"mpdf/mpdf": "dev-qrcode", "mpdf/mpdf": "dev-qrcode",
@ -50,10 +48,11 @@
"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": "^3", "oneup/uploader-bundle": "^5",
"oyejorge/less.php": "~1.5", "oyejorge/less.php": "~1.5",
"paypal/paypal-checkout-sdk": "dev-master", "paypal/paypal-checkout-sdk": "^1.0",
"paypal/rest-api-sdk-php": "dev-master", "paypal/paypal-server-sdk": "^2",
"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",
@ -64,26 +63,27 @@
"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",
"sensio/framework-extra-bundle": "^6.1", "setasign/fpdi-tcpdf": "^2.3",
"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": "6.4.*", "symfony/asset-mapper": "7.4.*",
"symfony/console": "*", "symfony/console": "*",
"symfony/dotenv": "*", "symfony/dotenv": "*",
"symfony/expression-language": "*", "symfony/expression-language": "*",
"symfony/flex": "^1.3.1", "symfony/flex": "^2",
"symfony/form": "*", "symfony/form": "*",
"symfony/framework-bundle": "*", "symfony/framework-bundle": "*",
"symfony/http-client": "*", "symfony/http-client": "*",
"symfony/intl": "*", "symfony/intl": "*",
"symfony/lock": "6.4.*", "symfony/lock": "7.4.*",
"symfony/mailer": "*", "symfony/mailer": "*",
"symfony/mime": "*", "symfony/mime": "*",
"symfony/monolog-bundle": "^3.8", "symfony/monolog-bundle": "^4",
"symfony/notifier": "*", "symfony/notifier": "*",
"symfony/process": "*", "symfony/process": "*",
"symfony/property-access": "6.4.4", "symfony/property-access": "7.4.*",
"symfony/property-info": "*", "symfony/property-info": "*",
"symfony/proxy-manager-bridge": "*", "symfony/proxy-manager-bridge": "*",
"symfony/runtime": "*", "symfony/runtime": "*",
@ -116,9 +116,8 @@
"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": "^1", "phpstan/phpstan": "^2.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": "*",
@ -198,7 +197,7 @@
"extra": { "extra": {
"symfony": { "symfony": {
"allow-contrib": false, "allow-contrib": false,
"require": "6.4.*" "require": "7.4.*"
}, },
"public-dir": "web/" "public-dir": "web/"
} }

5239
src/new/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,13 +7,11 @@ 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],
@ -63,4 +61,5 @@ 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,23 +6,21 @@ 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( $containerConfigurator->extension('doctrine', [
'doctrine',
[
'dbal' => [ 'dbal' => [
'url' => '%env(resolve:DATABASE_URL)%', 'url' => '%env(resolve:DATABASE_URL)%',
'charset' => 'utf8mb4', 'charset' => 'utf8mb4',
'default_table_options' => ['collate' => 'utf8mb4_unicode_ci']], 'default_table_options' => ['collate' => 'utf8mb4_unicode_ci'],
'server_version' => '8.0',
],
'orm' => [ 'orm' => [
'auto_generate_proxy_classes' => true,
'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware', 'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware',
'auto_mapping' => true, 'auto_mapping' => true,
'dql' => [ 'dql' => [
'numeric_functions' => [ 'numeric_functions' => [
'month' => SimpleFunction::class 'month' => SimpleFunction::class,
] ],
] ],
] ],
] ]);
);
}; };

View File

@ -5,7 +5,14 @@ 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' => ['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']]]); $containerConfigurator->extension('doctrine', ['orm' => [
'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' => ['doctrine.result_cache_pool' => ['adapter' => 'cache.app'], 'doctrine.system_cache_pool' => ['adapter' => 'cache.system']]]]); $containerConfigurator->extension('framework', ['cache' => ['pools' => [
'doctrine.result_cache_pool' => ['adapter' => 'cache.app'],
'doctrine.system_cache_pool' => ['adapter' => 'cache.system'],
]]]);
}; };

View File

@ -5,11 +5,56 @@ 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', ['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('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]],
]);
$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']]]); $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'],
],
]);
$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']]); $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'],
]);
$containerConfigurator->extension('lexik_form_filter', ['listeners' => ['doctrine_orm' => true, 'doctrine_dbal' => true, 'doctrine_mongodb' => true]]); $containerConfigurator->extension('spiriit_form_filter', ['listeners' => [
'doctrine_orm' => true,
]]);
}; };

View File

@ -1,9 +0,0 @@
<?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']]]);
};

2873
src/new/config/reference.php Normal file

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/', 'annotation')->prefix('/'); $routingConfigurator->import('@PSCComponentSteplayouterBundle/Controller/', 'attribute')->prefix('/');
$routingConfigurator $routingConfigurator
->import('@PSCComponentSteplayouterBundle/Controller/System', 'annotation') ->import('@PSCComponentSteplayouterBundle/Controller/System', 'attribute')
->prefix('/step/system'); ->prefix('/step/system');
$routingConfigurator $routingConfigurator
->import('@PSCComponentConfigurationlayouterBundle/Controller/', 'annotation') ->import('@PSCComponentConfigurationlayouterBundle/Controller/', 'attribute')
->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', 'annotation'); $routingConfigurator->import('../../src/PSC/Kernel.php', 'attribute');
}; };

View File

@ -20,11 +20,11 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services(); $services = $containerConfigurator->services();
$services->defaults() $services->defaults()->autowire()->autoconfigure();
->autowire()
->autoconfigure();
$services->set('liip_imagine.data.loader.stream.steplayouter_motiv_guest', StreamLoader::class) /* $services
->args([service('liip_imagine'), 'gaufrette://steplayouter_motiv_guest/']) * ->set('liip_imagine.data.loader.stream.steplayouter_motiv_guest', StreamLoader::class)
->tag('liip_imagine.data.loader', ['loader' => 'stream.steplayouter_motiv_guest']); * ->args([service('liip_imagine'), 'gaufrette://steplayouter_motiv_guest/'])->tag('liip_imagine.data.loader', [
* '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
taxClass: 19 mwert: 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
taxClass: 19 mwert: 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
taxClass: 19 mwert: 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
taxClass: 19 mwert: 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
taxClass: 19 mwert: 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
taxClass: 19 mwert: 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("2025-12-12"))> toDate: <(new DateTime("2026-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("2025-12-12"))> toDate: <(new DateTime("2026-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("2025-12-12"))> toDate: <(new DateTime("2026-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("2025-12-12"))> toDate: <(new DateTime("2026-12-12"))>
value: 0 value: 0
shop: '@shop_1' shop: '@shop_1'

5
src/new/phpstan.neon Normal file
View File

@ -0,0 +1,5 @@
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) NOT NULL, `smtpusethis` int(1) NULL DEFAULT 0,
`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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\Security\Http\Attribute\IsGranted;
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,24 +47,52 @@ 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
*/ */
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('ROLE_SHOP')]
#[Route(path: '/dashboard', name: 'psc_backend_dashboard_index')] #[Route(path: '/dashboard', name: 'psc_backend_dashboard_index')]
#[Template] #[Template('@PSCBackendDashboard/dashboard/index.html.twig')]
public function indexAction(Migration $migration, Shop $shop, EntityManagerInterface $entityManager, Manager $queueService, Instance $instanceService, ChartBuilderInterface $chartBuilder, ContactRepository $contactRepository, Order $orderService) public function indexAction(
{ 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($entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop($selectedShop->getUid(), $year1), 'brutto', 'monat'); $tempSales1 = array_column(
$tempSales2 = array_column($entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop($selectedShop->getUid(), $year2), 'brutto', 'monat'); $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop(
$tempSales3 = array_column($entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop($selectedShop->getUid(), $year3), 'brutto', 'monat'); $selectedShop->getUid(),
$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 = array(); $sales1 = [];
$sales2 = array(); $sales2 = [];
$sales3 = array(); $sales3 = [];
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]);
@ -84,7 +112,20 @@ class DashboardController extends AbstractController
} }
$chart = $chartBuilder->createChart(Chart::TYPE_LINE); $chart = $chartBuilder->createChart(Chart::TYPE_LINE);
$chart->setData([ $chart->setData([
'labels' => ['Januar', 'Februar', 'März', 'April', 'May', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], 'labels' => [
'Januar',
'Februar',
'März',
'April',
'May',
'Juni',
'Juli',
'August',
'September',
'Oktober',
'November',
'Dezember',
],
'datasets' => [ 'datasets' => [
[ [
'label' => $year1, 'label' => $year1,
@ -113,19 +154,18 @@ 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 array( return [
'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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
/** /**
* 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] #[Template('@PSCBackendDashboard/default/index.html.twig')]
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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
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] #[Template('@PSCBackendDashboard/login/index.html.twig')]
public function indexAction(Migration $migration, AuthenticationUtils $authenticationUtils) public function indexAction(Migration $migration, AuthenticationUtils $authenticationUtils)
{ {
if ($migration->checkIfMigrationMustRun()) { if ($migration->checkIfMigrationMustRun()) {

View File

@ -17,103 +17,97 @@ 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\Component\HttpFoundation\RedirectResponse; use Symfony\Bundle\SecurityBundle\Security;
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
{ {
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('ROLE_SHOP')]
#[Template] #[Template('@PSCBackendDashboard/shop/my_editable_shops.html.twig')]
public function myEditableShopsAction(Request $request, Shop $shop, JWTTokenManagerInterface $jwtManager, EntityManagerInterface $entityManager) public function myEditableShopsAction(
{ Request $request,
Shop $shop,
JWTTokenManagerInterface $jwtManager,
EntityManagerInterface $entityManager,
) {
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$selectedShop = $shop->getSelectedShop(); $selectedShop = $shop->getSelectedShop();
$shops = $shop->getMyEditableShops(); $shops = $shop->getMyEditableShops();
$domains = $entityManager $domains = $entityManager->getRepository(Domain::class)->getAllByShopId($selectedShop);
->getRepository(Domain::class)->getAllByShopId($selectedShop);
if (count($domains) > 0) { if (count($domains) > 0) {
$domain = array_pop($domains)->getHost(); $domain = array_pop($domains)->getHost();
} else { } else {
$domain = false; $domain = false;
} }
return array('domain' => $domain, 'shops' => $shops, 'jwt' => $jwtManager->create($this->getUser()), 'selectedShop' => $selectedShop, 'displayDeletedShop' => $request->getSession()->get('displayDeletedShop', false)); return [
'domain' => $domain,
'shops' => $shops,
'jwt' => $jwtManager->create($this->getUser()),
'selectedShop' => $selectedShop,
'displayDeletedShop' => $request->getSession()->get('displayDeletedShop', false),
];
} }
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('ROLE_SHOP')]
#[Template] #[Template('@PSCBackendDashboard/shop/my_editable_shops_tailwind.html.twig')]
public function myEditableShopsTailwindAction(Request $request, Shop $shop, JWTTokenManagerInterface $jwtManager, EntityManagerInterface $entityManager) public function myEditableShopsTailwindAction(
{ Request $request,
Shop $shop,
JWTTokenManagerInterface $jwtManager,
EntityManagerInterface $entityManager,
) {
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$selectedShop = $shop->getSelectedShop(); $selectedShop = $shop->getSelectedShop();
$shops = $shop->getMyEditableShops(); $shops = $shop->getMyEditableShops();
$domains = $entityManager $domains = $entityManager->getRepository(Domain::class)->getAllByShopId($selectedShop);
->getRepository(Domain::class)->getAllByShopId($selectedShop);
if (count($domains) > 0) { if (count($domains) > 0) {
$domain = array_pop($domains)->getHost(); $domain = array_pop($domains)->getHost();
} else { } else {
$domain = false; $domain = false;
} }
return array('domain' => $domain, 'shops' => $shops, 'jwt' => $jwtManager->create($this->getUser()), 'selectedShop' => $selectedShop, 'displayDeletedShop' => $request->getSession()->get('displayDeletedShop', false)); return [
'domain' => $domain,
'shops' => $shops,
'jwt' => $jwtManager->create($this->getUser()),
'selectedShop' => $selectedShop,
'displayDeletedShop' => $request->getSession()->get('displayDeletedShop', false),
];
} }
#[IsGranted('ROLE_SHOP')]
/**
* 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')] #[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) public function changeShopAction(Request $request, EntityManagerInterface $em, Security $security, $shop_uuid)
{ {
$em $em->getRepository('PSC\Shop\EntityBundle\Entity\ShopContact')->changeSelectedShop(
->getRepository('PSC\Shop\EntityBundle\Entity\ShopContact') $security->getUser(),
->changeSelectedShop($security->getUser(), $shop_uuid); $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(Request $request, EntityManagerInterface $em, \Symfony\Component\Security\Core\Security $security, Shop $shopService) public function toogleDisplayDeletedShopAction(
{ 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 $shops = $em->getRepository(
->getRepository('PSC\Shop\EntityBundle\Entity\ShopContact')->myEditableShopsWithNoDeleted($security->getUser()); 'PSC\Shop\EntityBundle\Entity\ShopContact',
)->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) public function buildView(FormView $view, FormInterface $form, array $options): void
{ {
$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) public function configureOptions(OptionsResolver $resolver): void
{ {
$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: annotation type: attribute
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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
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] #[Template('@PSCBackendDomain/backend/list/index.html.twig')]
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('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')]
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('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')]
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('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: annotation type: attribute
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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
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] #[Template('@PSCBackendTools/backend/exporter/list.html.twig')]
#[Route(path: '/list', name: 'psc_backend_tools_exporter_list_index')] #[Route(path: '/list', name: 'psc_backend_tools_exporter_list_index')]
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('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')]
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('ROLE_SHOP')]
#[Template] #[Template('@PSCBackendTools/backend/exporter/form.html.twig')]
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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
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] #[Template('@PSCBackendTools/backend/importer/list.html.twig')]
#[Route(path: '/list', name: 'psc_backend_tools_importer_list_index')] #[Route(path: '/list', name: 'psc_backend_tools_importer_list_index')]
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('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,6 +8,7 @@ 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;
@ -22,15 +23,19 @@ 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 class ContactExporter implements ExporterInterface, ConfigurableElementInterface
{ {
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;
@ -51,6 +56,11 @@ class ContactExporter implements ExporterInterface
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()
@ -68,9 +78,12 @@ class ContactExporter implements ExporterInterface
*/ */
public function export() public function export()
{ {
$rows = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->getContactsByShop($this->_shopService->getSelectedShop()); $formData = $this->_form->getData();
$temp = array(); $rows = $this->_entityManager
$temp[] = array( ->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
->getContactsByShop($this->_shopService->getSelectedShop());
$temp = [];
$temp[] = [
'id' => 'id', 'id' => 'id',
'uid' => 'uid', 'uid' => 'uid',
'account_id' => 'account_id', 'account_id' => 'account_id',
@ -108,19 +121,21 @@ class ContactExporter implements ExporterInterface
'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[] = array( $temp[] = [
'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(),
@ -151,15 +166,22 @@ class ContactExporter implements ExporterInterface
'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,19 +4,25 @@ 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 class ContactExporter implements ExporterInterface, ConfigurableElementInterface
{ {
/** @var Form */ /** @var Form */
private $_form = null; private $_form = null;
@ -25,6 +31,7 @@ class ContactExporter implements ExporterInterface
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,
) {} ) {}
@ -43,6 +50,11 @@ class ContactExporter implements ExporterInterface
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()
@ -60,6 +72,7 @@ class ContactExporter implements ExporterInterface
*/ */
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());
@ -128,6 +141,8 @@ class ContactExporter implements ExporterInterface
'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 */
@ -200,9 +215,17 @@ class ContactExporter implements ExporterInterface
'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,24 +25,31 @@ 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;
@ -68,8 +75,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
return $er->createQueryBuilder('g') ->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');
@ -77,11 +84,15 @@ 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()
@ -102,15 +113,17 @@ 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->createQueryBuilder('o') $qb = $orderRepository
->where("o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop") ->createQueryBuilder('o')
->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->createQueryBuilder('o') $qb = $orderRepository
->where("o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop AND o.product = :product") ->createQueryBuilder('o')
->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())
@ -119,7 +132,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',
@ -144,7 +157,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;
@ -152,26 +165,32 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
$data[] = $temp; $data[] = $temp;
$paperContainer = new PaperContainer(); $paperContainer = new PaperContainer();
$paperContainer->parse(simplexml_load_string($this->_shopService->getSelectedShop()->getInstall()->getPaperContainer())); $paperContainer->parse(simplexml_load_string(
$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->getSelectedShop()->getInstall()->getCalcTemplates() . '</root>'); $engine->setTemplates('<root>' . $this->_shopService
->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 $objDoc = $this->_mongoDb->getRepository(Position::class)->findOneBy(['uid' => (string) $row->getId()]);
->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(),
@ -186,11 +205,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());
@ -207,16 +226,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] = '';
} }
} }
@ -225,11 +244,10 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
$spreadsheet = new Spreadsheet(); $spreadsheet = new Spreadsheet();
$spreadsheet->getActiveSheet() $spreadsheet->getActiveSheet()->fromArray(
->fromArray(
$data, // The data to set $data, // The data to set
NULL, // Array values with this value will not be set null, // Array values with this value will not be set
'A1' // Top left coordinate of the worksheet range where 'A1', // Top left coordinate of the worksheet range where
// we want to set these values (default is A1) // we want to set these values (default is A1)
); );

View File

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

View File

@ -3,66 +3,65 @@
namespace PSC\Component\ApiBundle\Api\Account; namespace PSC\Component\ApiBundle\Api\Account;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes as OA;
use OpenApi\Annotations as OA; use OpenApi\Attributes\JsonContent;
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; use Symfony\Component\HttpFoundation\Response as HttpResponse;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\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(EntityManagerInterface $entityManager, \PSC\System\SettingsBundle\Service\Shop $shopService) public function __construct(
{ EntityManagerInterface $entityManager,
\PSC\System\SettingsBundle\Service\Shop $shopService,
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->shopService = $shopService; $this->shopService = $shopService;
} }
/** #[Response(
* Check account parents by title response: 200,
* description: 'account',
* @OA\Response( content: new JsonContent(
* response=200, ref: new Model(type: PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Output::class),
* description="account", ),
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Output::class)) )]
* ) #[RequestBody(
* @OA\RequestBody( description: 'This is a request body',
* description="This is a request body", content: new Model(type: PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Input::class),
* @Model(type=\PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Input::class)) )]
* ) #[Tag(name: 'Account')]
* @OA\Tag(name="Account") #[IsGranted('ROLE_API')]
* @IsGranted("ROLE_API") #[Security(name: 'ApiKeyAuth')]
* @Security(name="ApiKeyAuth")
*/
#[Route(path: '/account/getparentbytitle', methods: ['POST'])] #[Route(path: '/account/getparentbytitle', methods: ['POST'])]
#[ParamConverter('data', class: '\PSC\Component\ApiBundle\Dto\Account\GetParentByTitle\Input', converter: 'psc_rest.request_body')] public function existsAction(#[MapRequestPayload] Input $data): JsonResponse
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( ->getAccountByTitle($data->title);
$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);
} }
@ -77,14 +76,7 @@ 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,9 +3,11 @@
namespace PSC\Component\ApiBundle\Api\Cms; namespace PSC\Component\ApiBundle\Api\Cms;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes as OA;
use OpenApi\Annotations as OA; use OpenApi\Attributes\JsonContent;
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;
@ -14,11 +16,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; use Symfony\Component\HttpFoundation\Response as HttpResponse;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\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
{ {
@ -26,27 +28,24 @@ 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(EntityManagerInterface $entityManager, \PSC\System\SettingsBundle\Service\Shop $shopService, Cms $hydrateCms) public function __construct(
{ 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)))]
* Cms #[Tag(name: '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->getRepository(\PSC\Shop\EntityBundle\Entity\Cms::class)->findAllByShop($this->shopService->getShopByDomain()); $cmss = $this->entityManager
->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 */
@ -57,21 +56,17 @@ class Get extends AbstractController
return $this->json(new Output($data)); return $this->json(new Output($data));
} }
/** #[Response(
* Get One Cms response: 200,
* description: 'found cms',
* @OA\Response( content: new JsonContent(ref: new Model(type: \PSC\Component\ApiBundle\Model\Cms::class)),
* response=200, )]
* description="found cms", #[Response(
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Model\Cms::class)) response: 404,
* ) description: 'not found',
* @OA\Response( content: new JsonContent(ref: new Model(type: NotFound::class)),
* response=404, )]
* description="not found", #[Tag(name: 'Cms')]
* @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,9 +4,11 @@ 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\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes as OA;
use OpenApi\Annotations as OA; use OpenApi\Attributes\JsonContent;
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;
@ -14,11 +16,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; use Symfony\Component\HttpFoundation\Response as HttpResponse;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\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
{ {
@ -29,16 +31,12 @@ class Get extends AbstractController
$this->documentManager = $documentManager; $this->documentManager = $documentManager;
} }
/** #[Response(
* Layouter Plugins response: 200,
* description: 'shops',
* @OA\Response( content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Plugin\Plugins\Output::class)),
* response=200, )]
* description="shops", #[Tag(name: 'Plugin')]
* @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
{ {
@ -61,17 +59,13 @@ class Get extends AbstractController
return $this->json(new Shops\Output($data)); return $this->json(new Shops\Output($data));
} }
/** #[Response(
* Plugins response: 200,
* description: 'shops',
* @OA\Response( content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Plugin\Plugins\Output::class)),
* response=200, )]
* description="shops", #[Tag(name: 'Plugin')]
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Plugin\Plugins\Output::class)) #[Security(name: 'ApiKeyAuth')]
* )
* @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
@ -90,27 +84,25 @@ class Get extends AbstractController
return $this->json(new Shops\Output($data)); return $this->json(new Shops\Output($data));
} }
/** #[Response(
* Get one plugin response: 200,
* description: 'found plugin',
* @OA\Response( content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Model\Plugin::class)),
* response=200, )]
* description="found plugin", #[Response(
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Model\Plugin::class)) response: 404,
* ) description: 'not found',
* @OA\Response( content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Error\NotFound::class)),
* response=404, )]
* description="not found", #[Tag(name: 'Plugin')]
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Error\NotFound::class)) #[Security(name: 'ApiKeyAuth')]
* )
* @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->getRepository(\PSC\System\PluginBundle\Document\Plugin::class)->findOneBy(['id' => new ObjectId($uuid)]); $plugin = $this->documentManager
->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\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes as OA;
use OpenApi\Annotations as OA; use OpenApi\Attributes\JsonContent;
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; use Symfony\Component\HttpFoundation\Response as HttpResponse;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\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(EntityManagerInterface $entityManager, \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop) public function __construct(
{ EntityManagerInterface $entityManager,
\PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop,
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->hydrateShop = $hydrateShop; $this->hydrateShop = $hydrateShop;
} }
/** #[Response(
* Shops response: 200,
* description: 'shops',
* @OA\Response( content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Shop\Shops\Output::class)),
* response=200, )]
* description="shops", #[Tag(name: 'Shops')]
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Shop\Shops\Output::class)) #[Security(name: 'ApiKeyAuth')]
* ) #[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,27 +56,25 @@ class Get extends AbstractController
return $this->json(new Shops\Output($data)); return $this->json(new Shops\Output($data));
} }
/** #[Response(
* Get One Shop response: 200,
* description: 'found shop',
* @OA\Response( content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Model\Shop::class)),
* response=200, )]
* description="found shop", #[Response(
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Model\Shop::class)) response: 404,
* ) description: 'not found',
* @OA\Response( content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Error\NotFound::class)),
* response=404, )]
* description="not found", #[Tag(name: 'Shops')]
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Error\NotFound::class)) #[Security(name: 'ApiKeyAuth')]
* )
* @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->getRepository(\PSC\Shop\EntityBundle\Entity\Shop::class)->findOneBy(['uid' => $id]); $shop = $this->entityManager
->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,9 +3,12 @@
namespace PSC\Component\ApiBundle\Api\Stockbooking; namespace PSC\Component\ApiBundle\Api\Stockbooking;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes as OA;
use OpenApi\Annotations as OA; use OpenApi\Attributes\JsonContent;
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;
@ -17,56 +20,58 @@ 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; use Symfony\Component\HttpFoundation\Response as HttpResponse;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\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(EntityManagerInterface $entityManager, \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop) public function __construct(
{ EntityManagerInterface $entityManager,
\PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop,
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->hydrateShop = $hydrateShop; $this->hydrateShop = $hydrateShop;
} }
/** #[Response(
* create by nr response: 200,
* description: 'stockbooking',
* @OA\Response( content: new JsonContent(
* response=200, ref: new Model(type: PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr\Output::class),
* description="stockbooking", ),
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr\Output::class)) )]
* ) #[RequestBody(
* @OA\RequestBody( description: 'This is a request body',
* description="This is a request body", content: new Model(type: PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr\Input::class),
* @Model(type=\PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr\Input::class)) )]
* ) #[Tag(name: 'Stockbooking')]
* @OA\Tag(name="Stockbooking") #[IsGranted('ROLE_API')]
* @IsGranted("ROLE_API") #[Security(name: 'ApiKeyAuth')]
* @Security(name="ApiKeyAuth")
*/
#[Route(path: '/stockbooking/createbynr', methods: ['POST'])] #[Route(path: '/stockbooking/createbynr', methods: ['POST'])]
#[ParamConverter('data', class: '\PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr\Input', converter: 'psc_rest.request_body')] public function create(#[MapRequestPayload] Input $data): JsonResponse
public function create(Input $data): JsonResponse
{ {
$product = $this->entityManager $product = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->createQueryBuilder('product') ->getRepository('PSC\Shop\EntityBundle\Entity\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()->getOneOrNullResult(); ->getQuery()
->getOneOrNullResult();
if ($product) { if ($product) {
$contact = $this->entityManager $contact = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(['uid' => $data->contact_id]); ->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
->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);
@ -90,6 +95,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,9 +3,12 @@
namespace PSC\Component\ApiBundle\Api\Stockbooking; namespace PSC\Component\ApiBundle\Api\Stockbooking;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes as OA;
use OpenApi\Annotations as OA; use OpenApi\Attributes\JsonContent;
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;
@ -16,56 +19,55 @@ 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; use Symfony\Component\HttpFoundation\Response as HttpResponse;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\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(EntityManagerInterface $entityManager, \PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop) public function __construct(
{ EntityManagerInterface $entityManager,
\PSC\Component\ApiBundle\Hydrate\Shop $hydrateShop,
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->hydrateShop = $hydrateShop; $this->hydrateShop = $hydrateShop;
} }
/** #[Response(
* get all by nr response: 200,
* description: 'account',
* @OA\Response( content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Output::class)),
* response=200, )]
* description="account", #[RequestBody(
* @OA\JsonContent(ref=@Model(type=\PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Output::class)) description: 'This is a request body',
* ) content: new Model(type: PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Input::class),
* @OA\RequestBody( )]
* description="This is a request body", #[Tag(name: 'Stockbooking')]
* @Model(type=\PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Input::class)) #[IsGranted('ROLE_API')]
* ) #[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'])]
#[ParamConverter('data', class: '\PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr\Input', converter: 'psc_rest.request_body')] public function allAction(#[MapRequestPayload] Input $data): JsonResponse
public function allAction(Input $data): JsonResponse
{ {
$product = $this->entityManager $product = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->createQueryBuilder('product') ->getRepository('PSC\Shop\EntityBundle\Entity\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()->getOneOrNullResult(); ->getQuery()
->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 = array(); $bookingsTemp = [];
/** @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();
@ -86,6 +88,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,32 +3,28 @@
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\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes as OA;
use OpenApi\Annotations as OA; use OpenApi\Attributes\JsonContent;
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; use Symfony\Component\HttpFoundation\Response as HttpResponse;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\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')]
* Get system info. #[Response(
* response: 200,
* description: 'Returns system info',
* @Security(name="ApiKeyAuth") content: new JsonContent(ref: new Model(type: Instance::class)),
* @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
@ -38,14 +34,13 @@ 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,14 +2,16 @@
namespace PSC\Component\ApiBundle\Api\System; namespace PSC\Component\ApiBundle\Api\System;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Attributes as OA;
use OpenApi\Annotations as OA; use OpenApi\Attributes\JsonContent;
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; use Symfony\Component\HttpFoundation\Response as HttpResponse;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
class Version extends AbstractController class Version extends AbstractController
@ -21,17 +23,12 @@ class Version extends AbstractController
$this->kernel = $kernel; $this->kernel = $kernel;
} }
/** #[Response(
* Get Release version. response: 200,
* description: 'release version',
* content: new JsonContent(ref: new Model(type: PSC\Component\ApiBundle\Model\Version::class)),
* @OA\Response( )]
* response=200, #[Tag(name: 'System')]
* 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

@ -1,82 +0,0 @@
<?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,15 +2,12 @@
namespace PSC\Component\ApiBundle\Dto\Account\GetParentByTitle; namespace PSC\Component\ApiBundle\Dto\Account\GetParentByTitle;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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,22 +2,15 @@
namespace PSC\Component\ApiBundle\Dto\Account\GetParentByTitle; namespace PSC\Component\ApiBundle\Dto\Account\GetParentByTitle;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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,8 +3,10 @@
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\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes as OA;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Items;
class Output class Output
{ {
@ -14,17 +16,9 @@ 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,8 +3,9 @@
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\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes as OA;
use OpenApi\Attributes\Property;
class NotFound class NotFound
{ {
@ -13,8 +14,6 @@ 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,8 +3,9 @@
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\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes as OA;
use OpenApi\Attributes\Property;
class PersistFailure class PersistFailure
{ {
@ -13,8 +14,6 @@ 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,8 +2,10 @@
namespace PSC\Component\ApiBundle\Dto\Plugin\Plugins; namespace PSC\Component\ApiBundle\Dto\Plugin\Plugins;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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
@ -14,17 +16,9 @@ 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,8 +3,10 @@
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\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes as OA;
use OpenApi\Attributes\Property;
use OpenApi\Attributes\Items;
class Output class Output
{ {
@ -14,17 +16,9 @@ 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,43 +2,24 @@
namespace PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr; namespace PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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,16 +2,13 @@
namespace PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr; namespace PSC\Component\ApiBundle\Dto\Stockbooking\CreateByNr;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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,15 +2,12 @@
namespace PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr; namespace PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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,8 +2,10 @@
namespace PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr; namespace PSC\Component\ApiBundle\Dto\Stockbooking\GetByNr;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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
@ -14,17 +16,9 @@ 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,25 +13,18 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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)]
* @OA\Property(type="string", maxLength=255) public string $title = '';
*/ #[Property(type: 'string', maxLength: 255)]
public string $title = ""; public string $text = '';
/** #[Property(type: 'string', maxLength: 255)]
* @OA\Property(type="string", maxLength=255) public string $shopId = '';
*/
public string $text = "";
/**
* @OA\Property(type="string", maxLength=255)
*/
public string $shopId = "";
} }

View File

@ -13,34 +13,23 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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,8 +13,9 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes as OA;
use OpenApi\Attributes\Property;
class Plugin class Plugin
{ {
@ -24,16 +25,10 @@ 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,62 +13,38 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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,8 +13,9 @@
namespace PSC\Component\ApiBundle\Model\Shop; namespace PSC\Component\ApiBundle\Model\Shop;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes as OA;
use OpenApi\Attributes\Property;
class Domain class Domain
{ {
@ -25,16 +26,10 @@ 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,37 +13,24 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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,17 +13,15 @@
namespace PSC\Component\ApiBundle\Model; namespace PSC\Component\ApiBundle\Model;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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 = "";
/**
* @OA\Property(type="string", maxLength=255) #[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: annotation type: attribute

View File

@ -5,7 +5,3 @@ 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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
/** /**
* 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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
/** /**
* DefaultController fürs ProductionBundle * DefaultController fürs ProductionBundle

View File

@ -21,28 +21,14 @@ class PrintPdfCommand extends Command
{ {
protected function configure() protected function configure()
{ {
$this $this->setName('component:steplayouter:pdf:print')
->setName('component:steplayouter:pdf:print')
->setDescription('Create Print PDF') ->setDescription('Create Print PDF')
->addArgument( ->addArgument('outputDir', InputArgument::REQUIRED, 'Layouter Id')
'outputDir', ->addArgument('layouterUid', InputArgument::REQUIRED, 'Layouter Id')
InputArgument::REQUIRED, ->addArgument('aliasUid', InputArgument::REQUIRED, 'Alias Id');
'Layouter Id'
)
->addArgument(
'layouterUid',
InputArgument::REQUIRED,
'Layouter Id'
)
->addArgument(
'aliasUid',
InputArgument::REQUIRED,
'Alias Id'
)
;
} }
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output): int
{ {
$layouter_uuid = $input->getArgument('layouterUid'); $layouter_uuid = $input->getArgument('layouterUid');
$outfilename = $input->getArgument('outputDir'); $outfilename = $input->getArgument('outputDir');
@ -52,5 +38,7 @@ 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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
/** /**
* 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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
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] #[Template('@PSCComponentSteplayouter/default/index.html.twig')]
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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
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] #[Template('@PSCComponentSteplayouter/system/check/index.html.twig')]
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
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] #[Template('@PSCComponentSteplayouter/system/settings/index.html.twig')]
#[Security("is_granted('ROLE_SHOP')")] #[IsGranted('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,8 +2,6 @@ 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: '../../*/*'
@ -15,27 +13,3 @@ 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,28 +24,31 @@ 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(EntityManagerInterface $em, $pdflib_lic, KernelInterface $kernel, ToArray $converter, DocumentManager $mongoDb, Environment $twig) public function __construct(
{ EntityManagerInterface $em,
KernelInterface $kernel,
ToArray $converter,
DocumentManager $mongoDb,
Environment $twig,
) {
$this->entityManager = $em; $this->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')->findOneBy(array('uuid' => $layouter_uuid)); ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')
->findOneBy(['uuid' => $layouter_uuid]);
if (!$layoutData) { if (!$layoutData) {
return; return;
@ -58,32 +61,16 @@ class Pdf
$dynamicSizeHeight = $layoutData->getDynamicHeight(); $dynamicSizeHeight = $layoutData->getDynamicHeight();
if (empty($datatable)) { if (empty($datatable)) {
$datatable[] = array(); $datatable[] = [];
} }
$product = $this->entityManager $product = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $layoutData->getArticleUuid())); ->getRepository('PSC\Shop\EntityBundle\Entity\Product')
->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 = array(); $tempFiles = [];
foreach ($datatable as $row) { foreach ($datatable as $row) {
$pageOpen = false; $pageOpen = false;
@ -94,306 +81,75 @@ class Pdf
continue; continue;
} }
$svgContent = $this->utf8_for_xml($site['fabricSVG']); $svg = $this->utf8_for_xml($site['fabricSVG']);
if ($dynamicSize) { if ($dynamicSize) {
$site['width'] = $dynamicSizeWidth; $site['width'] = $dynamicSizeWidth;
$site['height'] = $dynamicSizeHeight; $site['height'] = $dynamicSizeHeight;
} }
$xml = simplexml_load_string($svgContent); preg_match_all('/(image|xlink:href)=(")[^">]+/i', $svg, $media);
$tps = $xml->xpath('//*[string(@templatePrintBinding)]'); $urls = preg_replace('/(image|xlink:href)("|=")(.*)/i', '$3', $media[0]);
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 = array(); $matches = [];
$found = preg_match("/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/", $url, $matches); $found = preg_match(
'/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/',
$url,
$matches,
);
if ($found == 0) { if ($found == 0) {
$found = preg_match("/[a-fA-F0-9]{4}-[a-fA-F0-9]{8}-[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{8}/", $url, $matches); $found = preg_match(
'/[a-fA-F0-9]{4}-[a-fA-F0-9]{8}-[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{8}/',
$url,
$matches,
);
} }
if ($found == 0) { 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 $motiv = $this->mongoDb->getRepository(Motiv::class)->find($matches[0]);
->getRepository(Motiv::class)
->find($matches[0]);
if (!$motiv) { if (!$motiv) {
$motiv = $this->entityManager $motiv = $this->entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Motiv')->findOneByUuid($matches[0]); ->getRepository('PSC\Shop\EntityBundle\Entity\Motiv')
->findOneByUuid($matches[0]);
} }
if ($motiv) { if ($motiv) {
$svgContent = str_replace($url, "../market/motive/" . $motiv->getFileOrginal(), $svgContent); $svg = str_replace($url, '/data/www/old/market/motive/' . $motiv->getFileOrginal(), $svg);
} }
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) { $template = $this->twig->createTemplate($svg);
$matches = explode("/", $matches[0]); $svg = $template->render([
'row' => $row,
]);
$tmpSvg = tempnam(sys_get_temp_dir(), 'svg_') . '.svg';
$tmpPdf = tempnam(sys_get_temp_dir(), 'pdf_') . '.pdf';
file_put_contents($tmpSvg, $svg);
$cmd =
'cairosvg ' . escapeshellarg($tmpSvg) . ' -f pdf -o ' . escapeshellarg($tmpPdf) . ' --unsafe 2>&1';
exec($cmd, $output, $ret);
$calendarDesign = new Design(); unlink($tmpSvg);
switch ($matches[2]) { $tempFiles[] = $tmpPdf;
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($svgContent); $allPdfs = implode(' ', array_map('escapeshellarg', $tempFiles));
$svgContent = $template->render(array(
'row' => $row
));
file_put_contents($this->kernel->getProjectDir() . "/web/temp/" . $layouter_uuid . '_' . $key . ".svg", $svgContent);
$width = $site['width'] + $dataArray['sites'][$key + 1]['trimLeft'] + $dataArray['sites'][$key + 1]['trimRight'];
$height = $site['height'] + $dataArray['sites'][$key + 1]['trimTop'] + $dataArray['sites'][$key + 1]['trimBottom'];
if (isset($dataArray['pdfPrintMerge']['sites']) && $key == 0) {
$p->begin_page_ext(0, 0, "width=" . $dataArray['pdfPrintMerge']['width'] . " height=" . $dataArray['pdfPrintMerge']['height']);
$pageOpen = true;
} elseif (isset($dataArray['pdfPrintMerge']['sites']) && $key > 0 && in_array($key + 1, $dataArray['pdfPrintMerge']['sites'])) {
} else {
$p->begin_page_ext(0, 0, "width=" . $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("");
}
}
$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) public function build(ContainerBuilder $container): void
{ {
parent::build($container); parent::build($container);
$container->addCompilerPass(new AutoRegistryCompilerPass()); $container->addCompilerPass(new AutoRegistryCompilerPass());

View File

@ -0,0 +1,16 @@
<?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\Annotation\Route; use Symfony\Component\Routing\Attribute\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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
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] #[Template('@PSCShopAccount/backend/edit/create.html.twig')]
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] #[Template('@PSCShopAccount/backend/edit/edit.html.twig')]
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 Lexik\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface; use Spiriit\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\Annotation\Route; use Symfony\Component\Routing\Attribute\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Bridge\Twig\Attribute\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Symfony\Component\Security\Http\Attribute\IsGranted;
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
*/ */
#[Security("is_granted('ROLE_ADMIN')")] #[IsGranted('ROLE_ADMIN')]
#[Route(path: '/list/index', name: 'psc_shop_account_backend_list')] #[Route(path: '/list/index', name: 'psc_shop_account_backend_list')]
#[Template] #[Template('@PSCShopAccount/backend/list/index.html.twig')]
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,15 +3,13 @@
namespace PSC\Shop\AccountBundle\Dto\All; namespace PSC\Shop\AccountBundle\Dto\All;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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 Lexik\Bundle\FormFilterBundle\Filter\Form\Type\TextFilterType; use Spiriit\Bundle\FormFilterBundle\Filter\Form\Type\TextFilterType;
use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; use Spiriit\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,33 +3,24 @@
namespace PSC\Shop\AccountBundle\Model; namespace PSC\Shop\AccountBundle\Model;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use OpenApi\Annotations as OA; use OpenApi\Attributes 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: annotation type: attribute
prefix: /backend/account prefix: /backend/account
psc_shop_account_api: psc_shop_account_api:
resource: "@PSCShopAccountBundle/Api" resource: "@PSCShopAccountBundle/Api"
type: annotation type: attribute
prefix: /api/account prefix: /api/account

View File

@ -3,9 +3,11 @@
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\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
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\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;
@ -13,40 +15,30 @@ 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\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\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(private readonly EntityManagerInterface $entityManager, private readonly EventDispatcherInterface $eventDispatcher, private readonly TokenStorageInterface $tokenStorage) public function __construct(
{ 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'])]
#[ParamConverter('data', class: '\PSC\Shop\BasketBundle\Dto\Legacy\Input', converter: 'psc_rest.request_body')] public function add(#[MapRequestPayload] Input $data): JsonResponse
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';
@ -60,26 +52,25 @@ 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) {
@ -92,6 +83,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,9 +3,11 @@
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\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
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\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;
@ -13,12 +15,11 @@ 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\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\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
@ -33,27 +34,17 @@ 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'])]
#[ParamConverter('data', class: '\PSC\Shop\BasketBundle\Dto\Legacy\Input', converter: 'psc_rest.request_body')] public function temp(#[MapRequestPayload] Input $data): JsonResponse
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]);
@ -62,7 +53,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;
@ -71,6 +62,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,9 +3,11 @@
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\Annotation\Model; use Nelmio\ApiDocBundle\Attribute\Model;
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\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;
@ -13,12 +15,11 @@ 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\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Attribute\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
@ -33,27 +34,17 @@ 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'])]
#[ParamConverter('data', class: '\PSC\Shop\BasketBundle\Dto\Legacy\Input', converter: 'psc_rest.request_body')] public function update(#[MapRequestPayload] Input $data): JsonResponse
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]);
@ -63,9 +54,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();
@ -77,6 +68,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

@ -0,0 +1,91 @@
<?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