Fixes
This commit is contained in:
parent
155b00ce13
commit
e0f433309b
@ -76,6 +76,8 @@ RUN pecl install mcrypt \
|
|||||||
RUN docker-php-ext-install -j$(nproc) curl
|
RUN docker-php-ext-install -j$(nproc) curl
|
||||||
# Install Zip
|
# Install Zip
|
||||||
RUN docker-php-ext-install zip
|
RUN docker-php-ext-install zip
|
||||||
|
# Install exif
|
||||||
|
RUN docker-php-ext-install exif
|
||||||
# Install gd
|
# Install gd
|
||||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
|
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||||
&& docker-php-ext-install -j$(nproc) gd
|
&& docker-php-ext-install -j$(nproc) gd
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -4,4 +4,5 @@ PDFLIB_LIC=L900202-010091-135115-PPD3D2-EHE432
|
|||||||
CORS_ALLOW_ORIGIN=*
|
CORS_ALLOW_ORIGIN=*
|
||||||
DATABASE_URL=sqlite:///%kernel.project_dir%/var/test.sqlite
|
DATABASE_URL=sqlite:///%kernel.project_dir%/var/test.sqlite
|
||||||
MONGODB_DB=psc_test
|
MONGODB_DB=psc_test
|
||||||
|
DATABASE_URL=mysql://root:Wichtig1@mysql:3306/psc_test
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ require('./js/tether.min');
|
|||||||
require('./js/dropzone');
|
require('./js/dropzone');
|
||||||
global.Raphael = require('raphael/raphael.min');
|
global.Raphael = require('raphael/raphael.min');
|
||||||
require('morris.js/morris.min');
|
require('morris.js/morris.min');
|
||||||
require('summernote/dist/summernote-bs4');
|
require('summernote/dist/summernote-lite');
|
||||||
require('./js/summernote/mediabundle.plugin');
|
require('./js/summernote/mediabundle.plugin');
|
||||||
require('multiselect-two-sides/dist/js/multiselect');
|
require('multiselect-two-sides/dist/js/multiselect');
|
||||||
require('bootstrap-toggle/js/bootstrap-toggle.min');
|
require('bootstrap-toggle/js/bootstrap-toggle.min');
|
||||||
@ -39,6 +39,6 @@ import './js/tools/mediaChooser';
|
|||||||
import 'bootstrap/scss/bootstrap.scss';
|
import 'bootstrap/scss/bootstrap.scss';
|
||||||
import './css/tools/cargobay.toogle.min.css';
|
import './css/tools/cargobay.toogle.min.css';
|
||||||
import './less/base.less';
|
import './less/base.less';
|
||||||
import 'summernote/dist/summernote-bs4.min.css';
|
import 'summernote/dist/summernote-lite.min.css';
|
||||||
//import 'multiselect/css/multi-select.css';
|
//import 'multiselect/css/multi-select.css';
|
||||||
import 'bootstrap-toggle/css/bootstrap-toggle.min.css';
|
import 'bootstrap-toggle/css/bootstrap-toggle.min.css';
|
||||||
|
|||||||
@ -89,7 +89,7 @@ $(function() {
|
|||||||
toolbar: [
|
toolbar: [
|
||||||
['style', ['style']],
|
['style', ['style']],
|
||||||
['font', ['bold', 'italic', 'underline', 'clear']],
|
['font', ['bold', 'italic', 'underline', 'clear']],
|
||||||
['fontname', ['fontname']],
|
['fontsize', ['fontsize']],
|
||||||
['color', ['color']],
|
['color', ['color']],
|
||||||
['para', ['ul', 'ol', 'paragraph']],
|
['para', ['ul', 'ol', 'paragraph']],
|
||||||
['height', ['height']],
|
['height', ['height']],
|
||||||
|
|||||||
@ -11,6 +11,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@symfony/ux-chartjs": {
|
||||||
|
"chart": {
|
||||||
|
"enabled": true,
|
||||||
|
"fetch": "eager"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@symfony/ux-live-component": {
|
"@symfony/ux-live-component": {
|
||||||
"live": {
|
"live": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|||||||
@ -53,11 +53,11 @@
|
|||||||
"paypal/rest-api-sdk-php": "dev-master",
|
"paypal/rest-api-sdk-php": "dev-master",
|
||||||
"php-http/guzzle6-adapter": "^1.1",
|
"php-http/guzzle6-adapter": "^1.1",
|
||||||
"phpoffice/phpspreadsheet": "^1.28",
|
"phpoffice/phpspreadsheet": "^1.28",
|
||||||
|
"picqer/sendcloud-php-client": "v2.8.1",
|
||||||
"portphp/csv": ">=1.1.0",
|
"portphp/csv": ">=1.1.0",
|
||||||
"portphp/excel": ">=1.1.0",
|
"portphp/excel": ">=1.1.0",
|
||||||
"portphp/steps": ">=1.3",
|
"portphp/steps": ">=1.3",
|
||||||
"psc/calc": "dev-master",
|
"psc/calc": "dev-master",
|
||||||
"psc/sendcloud-api": "dev-master",
|
|
||||||
"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",
|
||||||
@ -87,6 +87,7 @@
|
|||||||
"symfony/translation": "*",
|
"symfony/translation": "*",
|
||||||
"symfony/twig-bundle": "*",
|
"symfony/twig-bundle": "*",
|
||||||
"symfony/ux-autocomplete": "^2.14",
|
"symfony/ux-autocomplete": "^2.14",
|
||||||
|
"symfony/ux-chartjs": "^2.19",
|
||||||
"symfony/ux-live-component": "^2.12",
|
"symfony/ux-live-component": "^2.12",
|
||||||
"symfony/ux-twig-component": "^2.12",
|
"symfony/ux-twig-component": "^2.12",
|
||||||
"symfony/validator": "*",
|
"symfony/validator": "*",
|
||||||
@ -158,23 +159,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "package",
|
|
||||||
"package": {
|
|
||||||
"name": "psc/sendcloud-api",
|
|
||||||
"version": "dev-master",
|
|
||||||
"source": {
|
|
||||||
"url": "https://gitlab.com/printshopcreator/sendcloud-api.git",
|
|
||||||
"type": "git",
|
|
||||||
"reference": "main"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Picqer\\Carriers\\SendCloud\\": "src/Picqer/Carriers/SendCloud"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"replace": {
|
"replace": {
|
||||||
|
|||||||
981
src/new/composer.lock
generated
981
src/new/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -59,4 +59,6 @@ return [
|
|||||||
Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true],
|
Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true],
|
||||||
Symfony\UX\LiveComponent\LiveComponentBundle::class => ['all' => true],
|
Symfony\UX\LiveComponent\LiveComponentBundle::class => ['all' => true],
|
||||||
Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true],
|
Symfony\UX\Autocomplete\AutocompleteBundle::class => ['all' => true],
|
||||||
|
Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
|
||||||
|
Symfony\UX\Chartjs\ChartjsBundle::class => ['all' => true],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -2,8 +2,27 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use PSC\Libraries\DoctrineBundle\ORM\Query\AST\Functions\SimpleFunction;
|
||||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||||
|
|
||||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||||
$containerConfigurator->extension('doctrine', ['dbal' => ['url' => '%env(resolve:DATABASE_URL)%', 'charset' => 'utf8mb4', 'default_table_options' => ['collate' => 'utf8mb4_unicode_ci']], 'orm' => ['auto_generate_proxy_classes' => true, 'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware', 'auto_mapping' => true]]);
|
$containerConfigurator->extension(
|
||||||
|
'doctrine',
|
||||||
|
[
|
||||||
|
'dbal' => [
|
||||||
|
'url' => '%env(resolve:DATABASE_URL)%',
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'default_table_options' => ['collate' => 'utf8mb4_unicode_ci']],
|
||||||
|
'orm' => [
|
||||||
|
'auto_generate_proxy_classes' => true,
|
||||||
|
'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware',
|
||||||
|
'auto_mapping' => true,
|
||||||
|
'dql' => [
|
||||||
|
'numeric_functions' => [
|
||||||
|
'month' => SimpleFunction::class
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
8
src/new/fixtures/domain.yml
Normal file
8
src/new/fixtures/domain.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
PSC\Shop\EntityBundle\Entity\Domain:
|
||||||
|
domain_1:
|
||||||
|
__construct: ['@shop_1']
|
||||||
|
host: "pc"
|
||||||
|
domain_2:
|
||||||
|
__construct: ['@shop_2']
|
||||||
|
host: "bvh"
|
||||||
|
|
||||||
185
src/new/package-lock.json
generated
185
src/new/package-lock.json
generated
@ -20,15 +20,17 @@
|
|||||||
"multiselect": "^0.9.12",
|
"multiselect": "^0.9.12",
|
||||||
"multiselect-two-sides": "^2.5.7",
|
"multiselect-two-sides": "^2.5.7",
|
||||||
"raphael": "^2.3.0",
|
"raphael": "^2.3.0",
|
||||||
"summernote": "^0.8.18"
|
"summernote": "^0.8.20"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@hotwired/stimulus": "^3.2.2",
|
"@hotwired/stimulus": "^3.2.2",
|
||||||
"@symfony/stimulus-bridge": "^3.2.2",
|
"@symfony/stimulus-bridge": "^3.2.2",
|
||||||
"@symfony/ux-autocomplete": "file:vendor/symfony/ux-autocomplete/assets",
|
"@symfony/ux-autocomplete": "file:vendor/symfony/ux-autocomplete/assets",
|
||||||
|
"@symfony/ux-chartjs": "file:vendor/symfony/ux-chartjs/assets",
|
||||||
"@symfony/ux-live-component": "file:vendor/symfony/ux-live-component/assets",
|
"@symfony/ux-live-component": "file:vendor/symfony/ux-live-component/assets",
|
||||||
"@symfony/webpack-encore": "4.2.0",
|
"@symfony/webpack-encore": "4.2.0",
|
||||||
"@types/node": "^18.7.6",
|
"@types/node": "^18.7.6",
|
||||||
|
"chart.js": "^3.4.1 || ^4.0",
|
||||||
"core-js": "^3.0.0",
|
"core-js": "^3.0.0",
|
||||||
"regenerator-runtime": "^0.13.2",
|
"regenerator-runtime": "^0.13.2",
|
||||||
"sass": "^1.38.0",
|
"sass": "^1.38.0",
|
||||||
@ -2177,6 +2179,13 @@
|
|||||||
"@jridgewell/sourcemap-codec": "1.4.14"
|
"@jridgewell/sourcemap-codec": "1.4.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@kurkle/color": {
|
||||||
|
"version": "0.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz",
|
||||||
|
"integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@leichtgewicht/ip-codec": {
|
"node_modules/@leichtgewicht/ip-codec": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz",
|
||||||
@ -2505,6 +2514,10 @@
|
|||||||
"resolved": "vendor/symfony/ux-autocomplete/assets",
|
"resolved": "vendor/symfony/ux-autocomplete/assets",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@symfony/ux-chartjs": {
|
||||||
|
"resolved": "vendor/symfony/ux-chartjs/assets",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
"node_modules/@symfony/ux-live-component": {
|
"node_modules/@symfony/ux-live-component": {
|
||||||
"resolved": "vendor/symfony/ux-live-component/assets",
|
"resolved": "vendor/symfony/ux-live-component/assets",
|
||||||
"link": true
|
"link": true
|
||||||
@ -4296,6 +4309,19 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/chart.js": {
|
||||||
|
"version": "4.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.4.tgz",
|
||||||
|
"integrity": "sha512-emICKGBABnxhMjUjlYRR12PmOXhJ2eJjEHL2/dZlWjxRAZT1D8xplLFq5M0tMQK8ja+wBS/tuVEJB5C6r7VxJA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@kurkle/color": "^0.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"pnpm": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/check-error": {
|
"node_modules/check-error": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz",
|
||||||
@ -4947,6 +4973,13 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/cssfontparser": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/cssfontparser/-/cssfontparser-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/cssnano": {
|
"node_modules/cssnano": {
|
||||||
"version": "5.1.14",
|
"version": "5.1.14",
|
||||||
"resolved": "https://registry.npmjs.org/cssnano/-/cssnano-5.1.14.tgz",
|
"resolved": "https://registry.npmjs.org/cssnano/-/cssnano-5.1.14.tgz",
|
||||||
@ -6746,6 +6779,17 @@
|
|||||||
"optional": true,
|
"optional": true,
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
|
"node_modules/jest-canvas-mock": {
|
||||||
|
"version": "2.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/jest-canvas-mock/-/jest-canvas-mock-2.5.2.tgz",
|
||||||
|
"integrity": "sha512-vgnpPupjOL6+L5oJXzxTxFrlGEIbHdZqFU+LFNdtLxZ3lRDCl17FlTMM7IatoRQkrcyOTMlDinjUguqmQ6bR2A==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"cssfontparser": "^1.2.1",
|
||||||
|
"moo-color": "^1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/jest-util": {
|
"node_modules/jest-util": {
|
||||||
"version": "29.3.1",
|
"version": "29.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.3.1.tgz",
|
||||||
@ -7524,6 +7568,23 @@
|
|||||||
"ufo": "^1.3.2"
|
"ufo": "^1.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/moo-color": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/moo-color/-/moo-color-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"color-name": "^1.1.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/moo-color/node_modules/color-name": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/morris.js": {
|
"node_modules/morris.js": {
|
||||||
"version": "0.5.0",
|
"version": "0.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/morris.js/-/morris.js-0.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/morris.js/-/morris.js-0.5.0.tgz",
|
||||||
@ -9513,6 +9574,13 @@
|
|||||||
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/resize-observer-polyfill": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/resolve": {
|
"node_modules/resolve": {
|
||||||
"version": "1.22.1",
|
"version": "1.22.1",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
||||||
@ -10471,9 +10539,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/summernote": {
|
"node_modules/summernote": {
|
||||||
"version": "0.8.18",
|
"version": "0.8.20",
|
||||||
"resolved": "https://registry.npmjs.org/summernote/-/summernote-0.8.18.tgz",
|
"resolved": "https://registry.npmjs.org/summernote/-/summernote-0.8.20.tgz",
|
||||||
"integrity": "sha512-VlwBaNm9vSYMYXvO2f3UCUmY0Gm8jxLcBn+D08aX3pKs4x2vAoyQ4DcDQ6D+PchQiLrf86AGQVfVu56F4aP3ug=="
|
"integrity": "sha512-W9RhjQjsn+b1s9xiJQgJbCiYGJaDAc9CdEqXo+D13WuStG8lCdtKaO5AiNiSSMJsQJN2EfGSwbBQt+SFE2B8Kw==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/supports-color": {
|
"node_modules/supports-color": {
|
||||||
"version": "5.5.0",
|
"version": "5.5.0",
|
||||||
@ -11290,6 +11360,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/vitest-canvas-mock": {
|
||||||
|
"version": "0.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/vitest-canvas-mock/-/vitest-canvas-mock-0.3.3.tgz",
|
||||||
|
"integrity": "sha512-3P968tYBpqYyzzOaVtqnmYjqbe13576/fkjbDEJSfQAkHtC5/UjuRHOhFEN/ZV5HVZIkaROBUWgazDKJ+Ibw+Q==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"jest-canvas-mock": "~2.5.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"vitest": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/vitest-fetch-mock": {
|
"node_modules/vitest-fetch-mock": {
|
||||||
"version": "0.2.2",
|
"version": "0.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.2.2.tgz",
|
||||||
@ -12038,6 +12121,22 @@
|
|||||||
"tom-select": "^2.2.2"
|
"tom-select": "^2.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"vendor/symfony/ux-chartjs/assets": {
|
||||||
|
"name": "@symfony/ux-chartjs",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@hotwired/stimulus": "^3.0.0",
|
||||||
|
"chart.js": "^3.4.1 || ^4.0",
|
||||||
|
"resize-observer-polyfill": "^1.5.1",
|
||||||
|
"vitest-canvas-mock": "^0.3.3"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@hotwired/stimulus": "^3.0.0",
|
||||||
|
"chart.js": "^3.4.1 || ^4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"vendor/symfony/ux-live-component/assets": {
|
"vendor/symfony/ux-live-component/assets": {
|
||||||
"name": "@symfony/ux-live-component",
|
"name": "@symfony/ux-live-component",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -13459,6 +13558,12 @@
|
|||||||
"@jridgewell/sourcemap-codec": "1.4.14"
|
"@jridgewell/sourcemap-codec": "1.4.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@kurkle/color": {
|
||||||
|
"version": "0.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz",
|
||||||
|
"integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@leichtgewicht/ip-codec": {
|
"@leichtgewicht/ip-codec": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz",
|
||||||
@ -13681,6 +13786,15 @@
|
|||||||
"vitest-fetch-mock": "^0.2.2"
|
"vitest-fetch-mock": "^0.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@symfony/ux-chartjs": {
|
||||||
|
"version": "file:vendor/symfony/ux-chartjs/assets",
|
||||||
|
"requires": {
|
||||||
|
"@hotwired/stimulus": "^3.0.0",
|
||||||
|
"chart.js": "^3.4.1 || ^4.0",
|
||||||
|
"resize-observer-polyfill": "^1.5.1",
|
||||||
|
"vitest-canvas-mock": "^0.3.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@symfony/ux-live-component": {
|
"@symfony/ux-live-component": {
|
||||||
"version": "file:vendor/symfony/ux-live-component/assets",
|
"version": "file:vendor/symfony/ux-live-component/assets",
|
||||||
"requires": {
|
"requires": {
|
||||||
@ -15042,6 +15156,15 @@
|
|||||||
"supports-color": "^5.3.0"
|
"supports-color": "^5.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"chart.js": {
|
||||||
|
"version": "4.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.4.tgz",
|
||||||
|
"integrity": "sha512-emICKGBABnxhMjUjlYRR12PmOXhJ2eJjEHL2/dZlWjxRAZT1D8xplLFq5M0tMQK8ja+wBS/tuVEJB5C6r7VxJA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@kurkle/color": "^0.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"check-error": {
|
"check-error": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz",
|
||||||
@ -15525,6 +15648,12 @@
|
|||||||
"integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
|
"integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"cssfontparser": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/cssfontparser/-/cssfontparser-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"cssnano": {
|
"cssnano": {
|
||||||
"version": "5.1.14",
|
"version": "5.1.14",
|
||||||
"resolved": "https://registry.npmjs.org/cssnano/-/cssnano-5.1.14.tgz",
|
"resolved": "https://registry.npmjs.org/cssnano/-/cssnano-5.1.14.tgz",
|
||||||
@ -16905,6 +17034,16 @@
|
|||||||
"optional": true,
|
"optional": true,
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
|
"jest-canvas-mock": {
|
||||||
|
"version": "2.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/jest-canvas-mock/-/jest-canvas-mock-2.5.2.tgz",
|
||||||
|
"integrity": "sha512-vgnpPupjOL6+L5oJXzxTxFrlGEIbHdZqFU+LFNdtLxZ3lRDCl17FlTMM7IatoRQkrcyOTMlDinjUguqmQ6bR2A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"cssfontparser": "^1.2.1",
|
||||||
|
"moo-color": "^1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"jest-util": {
|
"jest-util": {
|
||||||
"version": "29.3.1",
|
"version": "29.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.3.1.tgz",
|
||||||
@ -17515,6 +17654,23 @@
|
|||||||
"ufo": "^1.3.2"
|
"ufo": "^1.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"moo-color": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/moo-color/-/moo-color-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"color-name": "^1.1.4"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"color-name": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"morris.js": {
|
"morris.js": {
|
||||||
"version": "0.5.0",
|
"version": "0.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/morris.js/-/morris.js-0.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/morris.js/-/morris.js-0.5.0.tgz",
|
||||||
@ -19014,6 +19170,12 @@
|
|||||||
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"resize-observer-polyfill": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.22.1",
|
"version": "1.22.1",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
||||||
@ -19785,9 +19947,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"summernote": {
|
"summernote": {
|
||||||
"version": "0.8.18",
|
"version": "0.8.20",
|
||||||
"resolved": "https://registry.npmjs.org/summernote/-/summernote-0.8.18.tgz",
|
"resolved": "https://registry.npmjs.org/summernote/-/summernote-0.8.20.tgz",
|
||||||
"integrity": "sha512-VlwBaNm9vSYMYXvO2f3UCUmY0Gm8jxLcBn+D08aX3pKs4x2vAoyQ4DcDQ6D+PchQiLrf86AGQVfVu56F4aP3ug=="
|
"integrity": "sha512-W9RhjQjsn+b1s9xiJQgJbCiYGJaDAc9CdEqXo+D13WuStG8lCdtKaO5AiNiSSMJsQJN2EfGSwbBQt+SFE2B8Kw=="
|
||||||
},
|
},
|
||||||
"supports-color": {
|
"supports-color": {
|
||||||
"version": "5.5.0",
|
"version": "5.5.0",
|
||||||
@ -20416,6 +20578,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"vitest-canvas-mock": {
|
||||||
|
"version": "0.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/vitest-canvas-mock/-/vitest-canvas-mock-0.3.3.tgz",
|
||||||
|
"integrity": "sha512-3P968tYBpqYyzzOaVtqnmYjqbe13576/fkjbDEJSfQAkHtC5/UjuRHOhFEN/ZV5HVZIkaROBUWgazDKJ+Ibw+Q==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"jest-canvas-mock": "~2.5.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"vitest-fetch-mock": {
|
"vitest-fetch-mock": {
|
||||||
"version": "0.2.2",
|
"version": "0.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/vitest-fetch-mock/-/vitest-fetch-mock-0.2.2.tgz",
|
||||||
|
|||||||
@ -3,9 +3,11 @@
|
|||||||
"@hotwired/stimulus": "^3.2.2",
|
"@hotwired/stimulus": "^3.2.2",
|
||||||
"@symfony/stimulus-bridge": "^3.2.2",
|
"@symfony/stimulus-bridge": "^3.2.2",
|
||||||
"@symfony/ux-autocomplete": "file:vendor/symfony/ux-autocomplete/assets",
|
"@symfony/ux-autocomplete": "file:vendor/symfony/ux-autocomplete/assets",
|
||||||
|
"@symfony/ux-chartjs": "file:vendor/symfony/ux-chartjs/assets",
|
||||||
"@symfony/ux-live-component": "file:vendor/symfony/ux-live-component/assets",
|
"@symfony/ux-live-component": "file:vendor/symfony/ux-live-component/assets",
|
||||||
"@symfony/webpack-encore": "4.2.0",
|
"@symfony/webpack-encore": "4.2.0",
|
||||||
"@types/node": "^18.7.6",
|
"@types/node": "^18.7.6",
|
||||||
|
"chart.js": "^3.4.1 || ^4.0",
|
||||||
"core-js": "^3.0.0",
|
"core-js": "^3.0.0",
|
||||||
"regenerator-runtime": "^0.13.2",
|
"regenerator-runtime": "^0.13.2",
|
||||||
"sass": "^1.38.0",
|
"sass": "^1.38.0",
|
||||||
@ -36,6 +38,6 @@
|
|||||||
"multiselect": "^0.9.12",
|
"multiselect": "^0.9.12",
|
||||||
"multiselect-two-sides": "^2.5.7",
|
"multiselect-two-sides": "^2.5.7",
|
||||||
"raphael": "^2.3.0",
|
"raphael": "^2.3.0",
|
||||||
"summernote": "^0.8.18"
|
"summernote": "^0.8.20"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,8 @@ use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
|
|||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||||
|
use Symfony\UX\Chartjs\Builder\ChartBuilderInterface;
|
||||||
|
use Symfony\UX\Chartjs\Model\Chart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DashboardController fürs ProductionBundle
|
* DashboardController fürs ProductionBundle
|
||||||
@ -46,17 +48,69 @@ class DashboardController extends AbstractController
|
|||||||
#[Security("is_granted('ROLE_SHOP')")]
|
#[Security("is_granted('ROLE_SHOP')")]
|
||||||
#[Route(path: '/dashboard', name: 'psc_backend_dashboard_index')]
|
#[Route(path: '/dashboard', name: 'psc_backend_dashboard_index')]
|
||||||
#[Template]
|
#[Template]
|
||||||
public function indexAction(Migration $migration, Shop $shop, EntityManagerInterface $entityManager, Manager $queueService, Instance $instanceService)
|
public function indexAction(Migration $migration, Shop $shop, EntityManagerInterface $entityManager, Manager $queueService, Instance $instanceService, ChartBuilderInterface $chartBuilder)
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
|
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
|
||||||
$selectedShop = $shop->getSelectedShop();
|
$selectedShop = $shop->getSelectedShop();
|
||||||
$tempSales = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop($selectedShop->getUid());
|
$year1 = date("Y");
|
||||||
|
$year2 = date("Y") - 1;
|
||||||
|
$year3 = date("Y") - 2;
|
||||||
|
$tempSales1 = array_column($entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Order')->getIncomeByShop($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);
|
||||||
$sales = array();
|
$sales1 = array();
|
||||||
foreach ($tempSales as $sale) {
|
$sales2 = array();
|
||||||
$sales[] = array('month' => $sale['month'], 'brutto' => round($sale['brutto']));
|
$sales3 = array();
|
||||||
|
for ($i = 1; $i <= 12; $i++) {
|
||||||
|
if(isset($tempSales1[$i])) {
|
||||||
|
$sales1[] = round($tempSales1[$i]);
|
||||||
|
} else {
|
||||||
|
$sales1[] = 0;
|
||||||
|
}
|
||||||
|
if(isset($tempSales2[$i])) {
|
||||||
|
$sales2[] = round($tempSales2[$i]);
|
||||||
|
} else {
|
||||||
|
$sales2[] = 0;
|
||||||
|
}
|
||||||
|
if(isset($tempSales3[$i])) {
|
||||||
|
$sales3[] = round($tempSales3[$i]);
|
||||||
|
} else {
|
||||||
|
$sales3[] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$chart = $chartBuilder->createChart(Chart::TYPE_LINE);
|
||||||
|
$chart->setData([
|
||||||
|
'labels' => ['Januar', 'Februar', 'März', 'April', 'May', 'Juli', 'Juni', 'August', 'September', 'Oktober', 'November', 'Dezember'],
|
||||||
|
'datasets' => [
|
||||||
|
[
|
||||||
|
'label' => $year1,
|
||||||
|
'backgroundColor' => 'rgb(255, 99, 132, .4)',
|
||||||
|
'borderColor' => 'rgb(255, 99, 132)',
|
||||||
|
'data' => $sales1,
|
||||||
|
'tension' => 0.4,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => $year2,
|
||||||
|
'backgroundColor' => 'rgb(100, 20, 132, .4)',
|
||||||
|
'borderColor' => 'rgb(100, 20, 132)',
|
||||||
|
'data' => $sales2,
|
||||||
|
'tension' => 0.4,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => $year3,
|
||||||
|
'backgroundColor' => 'rgba(45, 220, 126, .4)',
|
||||||
|
'borderColor' => 'rgba(45, 220, 126)',
|
||||||
|
'data' => $sales3,
|
||||||
|
'tension' => 0.4,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$chart->setOptions([
|
||||||
|
'maintainAspectRatio' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
if ($migration->checkIfMigrationMustRun()) {
|
if ($migration->checkIfMigrationMustRun()) {
|
||||||
return $this->redirectToRoute('psc_system_update_migration_do');
|
return $this->redirectToRoute('psc_system_update_migration_do');
|
||||||
@ -67,7 +121,7 @@ class DashboardController extends AbstractController
|
|||||||
'shop' => $selectedShop,
|
'shop' => $selectedShop,
|
||||||
'queueErrorCount' => $queueService->getErrorJobCount(),
|
'queueErrorCount' => $queueService->getErrorJobCount(),
|
||||||
'instance' => $instanceService->getInstance(),
|
'instance' => $instanceService->getInstance(),
|
||||||
'sales' => json_encode($sales)
|
'chart' => $chart
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@
|
|||||||
<h4>Sales Graph</h4>
|
<h4>Sales Graph</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div id="sales-graph" class="chart no-padding"></div>
|
{{ render_chart(chart) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -63,26 +63,4 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block javascripts %}
|
|
||||||
{{ parent() }}
|
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
// sales graph
|
|
||||||
if ($('#sales-graph').length) {
|
|
||||||
|
|
||||||
Morris.Bar({
|
|
||||||
element : 'sales-graph',
|
|
||||||
data:
|
|
||||||
{{ sales|raw }}
|
|
||||||
,
|
|
||||||
xkey: 'month',
|
|
||||||
ykeys: ['brutto'],
|
|
||||||
labels: ['Summe']
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PSC\Libraries\DoctrineBundle\ORM\Query\AST;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
|
use Doctrine\DBAL\Platforms\MySQLPlatform;
|
||||||
|
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
|
||||||
|
use Doctrine\ORM\Query\QueryException;
|
||||||
|
use PSC\Libraries\DoctrineBundle\ORM\Query\AST\Platform\Functions\PlatformFunctionNode;
|
||||||
|
|
||||||
|
class FunctionFactory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create platform function node.
|
||||||
|
*
|
||||||
|
* @throws QueryException
|
||||||
|
*/
|
||||||
|
public static function create(
|
||||||
|
AbstractPlatform $platform,
|
||||||
|
string $functionName,
|
||||||
|
array $parameters
|
||||||
|
): PlatformFunctionNode {
|
||||||
|
if ($platform instanceof PostgreSQLPlatform) {
|
||||||
|
$platformName = 'postgresql';
|
||||||
|
} elseif ($platform instanceof MySQLPlatform) {
|
||||||
|
$platformName = 'mysql';
|
||||||
|
} else {
|
||||||
|
throw QueryException::syntaxError(
|
||||||
|
\sprintf(
|
||||||
|
'Not supported platform "%s"',
|
||||||
|
$platform::class
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$className = __NAMESPACE__
|
||||||
|
. '\\Platform\\Functions\\'
|
||||||
|
. static::classify(\strtolower($platformName))
|
||||||
|
. '\\'
|
||||||
|
. static::classify(\strtolower($functionName));
|
||||||
|
|
||||||
|
if (!\class_exists($className)) {
|
||||||
|
throw QueryException::syntaxError(
|
||||||
|
\sprintf(
|
||||||
|
'Function "%s" does not supported for platform "%s"',
|
||||||
|
$functionName,
|
||||||
|
$platformName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new $className($parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function classify($word)
|
||||||
|
{
|
||||||
|
return \str_replace([' ', '_', '-'], '', \ucwords($word, ' _-'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PSC\Libraries\DoctrineBundle\ORM\Query\AST\Functions;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
||||||
|
use Doctrine\ORM\Query\SqlWalker;
|
||||||
|
use PSC\Libraries\DoctrineBundle\ORM\Query\AST\FunctionFactory;
|
||||||
|
|
||||||
|
abstract class AbstractPlatformAwareFunctionNode extends FunctionNode
|
||||||
|
{
|
||||||
|
public array $parameters = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noinspection PhpMissingReturnTypeInspection
|
||||||
|
* @noinspection ReturnTypeCanBeDeclaredInspection
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getSql(SqlWalker $sqlWalker): string
|
||||||
|
{
|
||||||
|
$function = FunctionFactory::create(
|
||||||
|
$sqlWalker->getConnection()->getDatabasePlatform(),
|
||||||
|
$this->name,
|
||||||
|
$this->parameters
|
||||||
|
);
|
||||||
|
return $function->getSql($sqlWalker);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PSC\Libraries\DoctrineBundle\ORM\Query\AST\Functions;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Query\Parser;
|
||||||
|
use Doctrine\ORM\Query\TokenType;
|
||||||
|
|
||||||
|
class SimpleFunction extends AbstractPlatformAwareFunctionNode
|
||||||
|
{
|
||||||
|
public const PARAMETER_KEY = 'expression';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function parse(Parser $parser): void
|
||||||
|
{
|
||||||
|
$parser->match(TokenType::T_IDENTIFIER);
|
||||||
|
$parser->match(TokenType::T_OPEN_PARENTHESIS);
|
||||||
|
$this->parameters[self::PARAMETER_KEY] = $parser->ArithmeticPrimary();
|
||||||
|
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PSC\Libraries\DoctrineBundle\ORM\Query\AST\Platform\Functions\Mysql;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Query\AST\Node;
|
||||||
|
use Doctrine\ORM\Query\SqlWalker;
|
||||||
|
use PSC\Libraries\DoctrineBundle\ORM\Query\AST\Functions\SimpleFunction;
|
||||||
|
use PSC\Libraries\DoctrineBundle\ORM\Query\AST\Platform\Functions\PlatformFunctionNode;
|
||||||
|
|
||||||
|
class Month extends PlatformFunctionNode
|
||||||
|
{
|
||||||
|
public function getSql(SqlWalker $sqlWalker): string
|
||||||
|
{
|
||||||
|
/** @var Node $expression */
|
||||||
|
$expression = $this->parameters[SimpleFunction::PARAMETER_KEY];
|
||||||
|
return 'MONTH(' . $this->getExpressionValue($expression, $sqlWalker) . ')';
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace PSC\Libraries\DoctrineBundle\ORM\Query\AST\Platform\Functions;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Query\AST\Node;
|
||||||
|
use Doctrine\ORM\Query\SqlWalker;
|
||||||
|
|
||||||
|
abstract class PlatformFunctionNode
|
||||||
|
{
|
||||||
|
/** @var array */
|
||||||
|
public $parameters;
|
||||||
|
|
||||||
|
public function __construct(array $parameters)
|
||||||
|
{
|
||||||
|
$this->parameters = $parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public function getSql(SqlWalker $sqlWalker): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get expression value string.
|
||||||
|
*
|
||||||
|
* @param string|Node $expression
|
||||||
|
*/
|
||||||
|
protected function getExpressionValue($expression, SqlWalker $sqlWalker): string
|
||||||
|
{
|
||||||
|
if ($expression instanceof Node) {
|
||||||
|
$expression = $expression->dispatch($sqlWalker);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $expression;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -16,6 +16,7 @@ namespace PSC\Shop\ContactBundle\Form\Backend\General;
|
|||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use PSC\Shop\EntityBundle\Entity\Shop;
|
use PSC\Shop\EntityBundle\Entity\Shop;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CountryType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
@ -47,7 +48,7 @@ class ContactAddressType extends AbstractType
|
|||||||
->add('email', TextType::class, ['required' => false, 'label' => 'Email'])
|
->add('email', TextType::class, ['required' => false, 'label' => 'Email'])
|
||||||
->add('company', TextType::class, ['required' => false, 'label' => 'Company'])
|
->add('company', TextType::class, ['required' => false, 'label' => 'Company'])
|
||||||
->add('company2', TextType::class, ['required' => false, 'label' => 'Company2'])
|
->add('company2', TextType::class, ['required' => false, 'label' => 'Company2'])
|
||||||
->add('country', TextType::class, ['required' => false, 'label' => 'country'])
|
->add('country', CountryType::class, ['preferred_choices' => ['DE', 'CH', 'AT'], 'required' => false, 'label' => 'country'])
|
||||||
->add('fax', TextType::class, ['required' => false, 'label' => 'faxnumber'])
|
->add('fax', TextType::class, ['required' => false, 'label' => 'faxnumber'])
|
||||||
->add('ustid', TextType::class, ['required' => false, 'label' => 'vatid'])
|
->add('ustid', TextType::class, ['required' => false, 'label' => 'vatid'])
|
||||||
->add('zusatz1', TextType::class, ['required' => false, 'label' => 'additiveone'])
|
->add('zusatz1', TextType::class, ['required' => false, 'label' => 'additiveone'])
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class ContactType extends AbstractType
|
|||||||
{
|
{
|
||||||
/** @var Field */
|
/** @var Field */
|
||||||
protected $fields;
|
protected $fields;
|
||||||
/** @var General */
|
/** @var General */
|
||||||
protected $shop = null;
|
protected $shop = null;
|
||||||
protected $statusService = null;
|
protected $statusService = null;
|
||||||
protected $formFactory;
|
protected $formFactory;
|
||||||
@ -274,6 +274,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
|
|
||||||
->add('image', MediaType::class, ['required' => false, 'label' => 'pic'])
|
->add('image', MediaType::class, ['required' => false, 'label' => 'pic'])
|
||||||
|
->add('image2', MediaType::class, ['required' => false, 'label' => 'pic'])
|
||||||
->add('information', TextareaType::class, ['required' => false, 'label' => 'information'])
|
->add('information', TextareaType::class, ['required' => false, 'label' => 'information'])
|
||||||
->add('vonwo', TextType::class, ['required' => false, 'label' => 'Fromwhere'])
|
->add('vonwo', TextType::class, ['required' => false, 'label' => 'Fromwhere'])
|
||||||
->add('newsletter', CheckboxType::class, ['required' => false, 'label' => 'newsletter'])
|
->add('newsletter', CheckboxType::class, ['required' => false, 'label' => 'newsletter'])
|
||||||
@ -391,6 +392,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('country', TextType::class, [
|
->add('country', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
'disabled' => true,
|
||||||
'label' => 'country',
|
'label' => 'country',
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
@ -600,7 +602,7 @@ class ContactType extends AbstractType
|
|||||||
))
|
))
|
||||||
->add('custom1', TextType::class, [
|
->add('custom1', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName1()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName1() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom1 }}'
|
'data-bs-html' => '{{ contact.custom1 }}'
|
||||||
@ -608,7 +610,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom2', TextType::class, [
|
->add('custom2', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName2()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName2() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom2 }}'
|
'data-bs-html' => '{{ contact.custom2 }}'
|
||||||
@ -616,7 +618,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom3', TextType::class, [
|
->add('custom3', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName3()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName3() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom3 }}'
|
'data-bs-html' => '{{ contact.custom3 }}'
|
||||||
@ -624,7 +626,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom4', TextType::class, [
|
->add('custom4', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName4()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName4() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom4 }}'
|
'data-bs-html' => '{{ contact.custom4 }}'
|
||||||
@ -632,7 +634,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom5', TextType::class, [
|
->add('custom5', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName5()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName5() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom5 }}'
|
'data-bs-html' => '{{ contact.custom5 }}'
|
||||||
@ -640,7 +642,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom6', TextType::class, [
|
->add('custom6', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName6()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName6() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom6 }}'
|
'data-bs-html' => '{{ contact.custom6 }}'
|
||||||
@ -648,7 +650,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom7', TextType::class, [
|
->add('custom7', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName7()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName7() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom7 }}'
|
'data-bs-html' => '{{ contact.custom7 }}'
|
||||||
@ -656,7 +658,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom8', TextType::class, [
|
->add('custom8', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName8()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName8() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom8 }}'
|
'data-bs-html' => '{{ contact.custom8 }}'
|
||||||
@ -664,7 +666,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom9', TextType::class, [
|
->add('custom9', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName9()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName9() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom9 }}'
|
'data-bs-html' => '{{ contact.custom9 }}'
|
||||||
@ -672,7 +674,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom10', TextType::class, [
|
->add('custom10', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName10()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName10() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom10 }}'
|
'data-bs-html' => '{{ contact.custom10 }}'
|
||||||
@ -680,7 +682,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom11', TextType::class, [
|
->add('custom11', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName11()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName11() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom11 }}'
|
'data-bs-html' => '{{ contact.custom11 }}'
|
||||||
@ -688,7 +690,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom12', TextType::class, [
|
->add('custom12', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName12()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName12() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom12 }}'
|
'data-bs-html' => '{{ contact.custom12 }}'
|
||||||
@ -696,7 +698,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom13', TextType::class, [
|
->add('custom13', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName13()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName13() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom13 }}'
|
'data-bs-html' => '{{ contact.custom13 }}'
|
||||||
@ -704,7 +706,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom14', TextType::class, [
|
->add('custom14', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName14()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName14() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom14 }}'
|
'data-bs-html' => '{{ contact.custom14 }}'
|
||||||
@ -712,7 +714,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom15', TextType::class, [
|
->add('custom15', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName15()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName15() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom15 }}'
|
'data-bs-html' => '{{ contact.custom15 }}'
|
||||||
@ -720,7 +722,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom16', TextType::class, [
|
->add('custom16', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName16()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName16() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom16 }}'
|
'data-bs-html' => '{{ contact.custom16 }}'
|
||||||
@ -728,7 +730,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom17', TextType::class, [
|
->add('custom17', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName17()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName17() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom17 }}'
|
'data-bs-html' => '{{ contact.custom17 }}'
|
||||||
@ -736,7 +738,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom18', TextType::class, [
|
->add('custom18', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName18()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName18() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom18 }}'
|
'data-bs-html' => '{{ contact.custom18 }}'
|
||||||
@ -744,7 +746,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom19', TextType::class, [
|
->add('custom19', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName19()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName19() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom19 }}'
|
'data-bs-html' => '{{ contact.custom19 }}'
|
||||||
@ -752,7 +754,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom20', TextType::class, [
|
->add('custom20', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName20()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName20() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom20 }}'
|
'data-bs-html' => '{{ contact.custom20 }}'
|
||||||
@ -760,7 +762,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom21', TextType::class, [
|
->add('custom21', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName21()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName21() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom21 }}'
|
'data-bs-html' => '{{ contact.custom21 }}'
|
||||||
@ -768,7 +770,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom22', TextType::class, [
|
->add('custom22', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName22()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName22() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom22 }}'
|
'data-bs-html' => '{{ contact.custom22 }}'
|
||||||
@ -776,7 +778,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom23', TextType::class, [
|
->add('custom23', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName23()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName23() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom23 }}'
|
'data-bs-html' => '{{ contact.custom23 }}'
|
||||||
@ -784,7 +786,7 @@ class ContactType extends AbstractType
|
|||||||
])
|
])
|
||||||
->add('custom24', TextType::class, [
|
->add('custom24', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName24()?? " ",
|
'label' => $this->shop->getMongoSelectedShop()->getCustomerFieldName24() ?? " ",
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'data-bs-toggle' => "tooltip",
|
'data-bs-toggle' => "tooltip",
|
||||||
'data-bs-html' => '{{ contact.custom24 }}'
|
'data-bs-html' => '{{ contact.custom24 }}'
|
||||||
@ -799,7 +801,7 @@ class ContactType extends AbstractType
|
|||||||
'choices' => $this->statusService->getOrderStatusAsArray(),
|
'choices' => $this->statusService->getOrderStatusAsArray(),
|
||||||
'translation_domain' => 'status'
|
'translation_domain' => 'status'
|
||||||
));
|
));
|
||||||
/** @var \PSC\System\PluginBundle\Form\Interfaces\Field $field */
|
/** @var \PSC\System\PluginBundle\Form\Interfaces\Field $field */
|
||||||
foreach ($this->fields->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Contact) as $field) {
|
foreach ($this->fields->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Contact) as $field) {
|
||||||
$builder->add($field->buildForm($this->formFactory->createNamedBuilder($field->getGroup(), FormType::class, null, ['mapped' => false]), $options));
|
$builder->add($field->buildForm($this->formFactory->createNamedBuilder($field->getGroup(), FormType::class, null, ['mapped' => false]), $options));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
namespace PSC\Shop\ContactBundle\Model\Contact;
|
namespace PSC\Shop\ContactBundle\Model\Contact;
|
||||||
|
|
||||||
use OpenApi\Attributes as OA;
|
use OpenApi\Attributes as OA;
|
||||||
|
use PSC\Shop\MediaBundle\Model\Media;
|
||||||
|
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||||
|
|
||||||
class LayouterData
|
class LayouterData
|
||||||
{
|
{
|
||||||
@ -105,13 +107,19 @@ class LayouterData
|
|||||||
#[OA\Property(type: 'string')]
|
#[OA\Property(type: 'string')]
|
||||||
private string $district = "";
|
private string $district = "";
|
||||||
|
|
||||||
|
#[OA\Property(ref: new Model(type: Media::class))]
|
||||||
|
private ?Media $image1 = null;
|
||||||
|
|
||||||
|
#[OA\Property(ref: new Model(type: Media::class))]
|
||||||
|
private ?Media $image2 = null;
|
||||||
|
|
||||||
#[OA\Property(type: 'string')]
|
#[OA\Property(type: 'string')]
|
||||||
private string $state = "";
|
private string $state = "";
|
||||||
|
|
||||||
#[OA\Schema(schema: "StringList", properties: [new OA\Property(property: "value", type:"array", items: new OA\Items(anyOf: [new OA\Schema(type: 'string')]))])]
|
#[OA\Schema(schema: "StringList", properties: [new OA\Property(property: "value", type:"array", items: new OA\Items(anyOf: [new OA\Schema(type: 'string')]))])]
|
||||||
#[OA\Schema(schema: "String", properties: [new OA\Property(property: "value", type:"string")])]
|
#[OA\Schema(schema: "String", properties: [new OA\Property(property: "value", type:"string")])]
|
||||||
#[OA\Schema(schema: "Object", properties: [new OA\Property(property: "value", type:"object")])]
|
#[OA\Schema(schema: "Object", properties: [new OA\Property(property: "value", type:"object")])]
|
||||||
#[OA\Property(type: 'array', items: new OA\Items(oneOf: [new OA\Schema(ref: "#StringList"),new OA\Schema(ref: "#String"),new OA\Schema(ref: "#Object")]))]
|
#[OA\Property(type: 'array', items: new OA\Items(oneOf: [new OA\Schema(ref: "#StringList"),new OA\Schema(ref: "#String"),new OA\Schema(ref: "#Object")]))]
|
||||||
private array $settings = [];
|
private array $settings = [];
|
||||||
|
|
||||||
public function getKst(): string
|
public function getKst(): string
|
||||||
@ -401,7 +409,7 @@ class LayouterData
|
|||||||
|
|
||||||
public function getSettingForLayouter($layouter): array
|
public function getSettingForLayouter($layouter): array
|
||||||
{
|
{
|
||||||
return $this->settings[$layouter]?? [];
|
return $this->settings[$layouter] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFax(): string
|
public function getFax(): string
|
||||||
@ -474,4 +482,23 @@ class LayouterData
|
|||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getImage1(): Media|string|null
|
||||||
|
{
|
||||||
|
return $this->image1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setImage1(Media|string|null $image1): void
|
||||||
|
{
|
||||||
|
$this->image1 = $image1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImage2(): Media|string|null
|
||||||
|
{
|
||||||
|
return $this->image2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setImage2(Media|string|null $image2): void
|
||||||
|
{
|
||||||
|
$this->image2 = $image2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,14 +26,6 @@
|
|||||||
{{ form_start(form, { 'attr': {'class': 'smart-form'}}) }}
|
{{ form_start(form, { 'attr': {'class': 'smart-form'}}) }}
|
||||||
{{ form_errors(form) }}
|
{{ form_errors(form) }}
|
||||||
|
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link active" data-bs-toggle="tab" href="#all" role="tab">{{ 'general'|trans }}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
<div class="tab-pane active" id="all" role="tabpanel">
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
@ -46,18 +38,7 @@
|
|||||||
{{ form_errors(form.type) }}
|
{{ form_errors(form.type) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-6">
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-6 form-control-label">
|
|
||||||
{{ form_label(form.pos) }}
|
|
||||||
</label>
|
|
||||||
<div class="col-md-6">
|
|
||||||
{{ form_widget(form.pos) }}
|
|
||||||
</div>
|
|
||||||
{{ form_errors(form.pos) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-md-3 form-control-label">
|
<label class="col-md-3 form-control-label">
|
||||||
{{ form_label(form.uuid) }}
|
{{ form_label(form.uuid) }}
|
||||||
@ -69,6 +50,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-3 form-control-label">
|
||||||
|
{{ form_label(form.homepage) }}
|
||||||
|
</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
{{ form_widget(form.homepage) }}
|
||||||
|
</div>
|
||||||
|
{{ form_errors(form.homepage) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-3 form-control-label">
|
||||||
|
{{ form_label(form.pos) }}
|
||||||
|
</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
{{ form_widget(form.pos) }}
|
||||||
|
</div>
|
||||||
|
{{ form_errors(form.pos) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
@ -169,10 +174,10 @@
|
|||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
{{ form_widget(form.zip) }}
|
{{ form_widget(form.zip) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5">
|
<div class="col-md-4">
|
||||||
{{ form_widget(form.city) }}
|
{{ form_widget(form.city) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-3">
|
||||||
{{ form_widget(form.country) }}
|
{{ form_widget(form.country) }}
|
||||||
</div>
|
</div>
|
||||||
{{ form_errors(form.zip) }}
|
{{ form_errors(form.zip) }}
|
||||||
@ -257,23 +262,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-3 form-control-label">
|
|
||||||
{{ form_label(form.homepage) }}
|
|
||||||
</label>
|
|
||||||
<div class="col-md-9">
|
|
||||||
{{ form_widget(form.homepage) }}
|
|
||||||
</div>
|
|
||||||
{{ form_errors(form.homepage) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-md-offset-1 col-md-11">
|
<div class="text-end">
|
||||||
{{ form_widget(form.save, {attr: {class: 'btn btn-primary btn-sm'}}) }}
|
{{ form_widget(form.save, {attr: {class: 'btn btn-primary btn-sm'}}) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -26,14 +26,6 @@
|
|||||||
{{ form_start(form, { 'attr': {'class': 'smart-form'}}) }}
|
{{ form_start(form, { 'attr': {'class': 'smart-form'}}) }}
|
||||||
{{ form_errors(form) }}
|
{{ form_errors(form) }}
|
||||||
|
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link active" data-bs-toggle="tab" href="#all" role="tab">{{ 'general'|trans }}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
<div class="tab-pane active" id="all" role="tabpanel">
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
@ -46,18 +38,7 @@
|
|||||||
{{ form_errors(form.type) }}
|
{{ form_errors(form.type) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-6">
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-3 form-control-label">
|
|
||||||
{{ form_label(form.pos) }}
|
|
||||||
</label>
|
|
||||||
<div class="col-md-9">
|
|
||||||
{{ form_widget(form.pos) }}
|
|
||||||
</div>
|
|
||||||
{{ form_errors(form.pos) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-md-3 form-control-label">
|
<label class="col-md-3 form-control-label">
|
||||||
{{ form_label(form.uuid) }}
|
{{ form_label(form.uuid) }}
|
||||||
@ -69,6 +50,31 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-3 form-control-label">
|
||||||
|
{{ form_label(form.homepage) }}
|
||||||
|
</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
{{ form_widget(form.homepage) }}
|
||||||
|
</div>
|
||||||
|
{{ form_errors(form.homepage) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col-md-3 form-control-label">
|
||||||
|
{{ form_label(form.pos) }}
|
||||||
|
</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
{{ form_widget(form.pos) }}
|
||||||
|
</div>
|
||||||
|
{{ form_errors(form.pos) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
@ -169,10 +175,10 @@
|
|||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
{{ form_widget(form.zip) }}
|
{{ form_widget(form.zip) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-5">
|
<div class="col-md-4">
|
||||||
{{ form_widget(form.city) }}
|
{{ form_widget(form.city) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-3">
|
||||||
{{ form_widget(form.country) }}
|
{{ form_widget(form.country) }}
|
||||||
</div>
|
</div>
|
||||||
{{ form_errors(form.zip) }}
|
{{ form_errors(form.zip) }}
|
||||||
@ -255,23 +261,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="row mb-3">
|
|
||||||
<label class="col-md-3 form-control-label">
|
|
||||||
{{ form_label(form.homepage) }}
|
|
||||||
</label>
|
|
||||||
<div class="col-md-9">
|
|
||||||
{{ form_widget(form.homepage) }}
|
|
||||||
</div>
|
|
||||||
{{ form_errors(form.homepage) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-md-offset-1 col-md-11">
|
<div class="text-end">
|
||||||
{{ form_widget(form.save, {attr: {class: 'btn btn-primary btn-sm'}}) }}
|
{{ form_widget(form.save, {attr: {class: 'btn btn-primary btn-sm'}}) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -32,9 +32,6 @@
|
|||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h5>{{ contact.username }}</h5>
|
<h5>{{ contact.username }}</h5>
|
||||||
<div class="float-end">
|
|
||||||
<i class="fa fa-lg fa-fw fa-question-circle"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="body">
|
<div class="body">
|
||||||
@ -276,19 +273,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="header"><h5>{{ form_label(form.image) }}</h5></div>
|
|
||||||
<div class="body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
{{ form_widget(form.image) }}
|
|
||||||
</div>
|
|
||||||
{{ form_errors(form.image) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="header"><h5>{{ form_label(form.country) }}</h5></div>
|
<div class="header"><h5>{{ form_label(form.country) }}</h5></div>
|
||||||
@ -904,6 +888,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="header"><h5>{{ form_label(form.image) }}</h5></div>
|
||||||
|
<div class="body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
{{ form_widget(form.image) }}
|
||||||
|
{{ form_errors(form.image) }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
{{ form_widget(form.image2) }}
|
||||||
|
{{ form_errors(form.image2) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="rights" role="tabpanel">
|
<div class="tab-pane" id="rights" role="tabpanel">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@ -31,9 +31,6 @@
|
|||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="float-end">
|
|
||||||
<i class="fa fa-lg fa-fw fa-question-circle"></i>
|
|
||||||
</div>
|
|
||||||
<h5><a href="mailto:{{ contact.username }}">{{ contact.username }}</a> (<label data-bs-toggle="tooltip" data-bs-html="{{ contact.id }}" for="contact_id" class="form-label required">ID:</label> {{ contact.uid }})</h5>
|
<h5><a href="mailto:{{ contact.username }}">{{ contact.username }}</a> (<label data-bs-toggle="tooltip" data-bs-html="{{ contact.id }}" for="contact_id" class="form-label required">ID:</label> {{ contact.uid }})</h5>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -260,19 +257,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="header"><h5>{{ form_label(form.image) }}</h5></div>
|
|
||||||
<div class="body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
{{ form_widget(form.image) }}
|
|
||||||
</div>
|
|
||||||
{{ form_errors(form.image) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="header"><h5>{{ form_label(form.country) }}</h5></div>
|
<div class="header"><h5>{{ form_label(form.country) }}</h5></div>
|
||||||
@ -888,6 +872,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="header"><h5>{{ form_label(form.image) }}</h5></div>
|
||||||
|
<div class="body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
{{ form_widget(form.image) }}
|
||||||
|
{{ form_errors(form.image) }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
{{ form_widget(form.image2) }}
|
||||||
|
{{ form_errors(form.image2) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="rights" role="tabpanel">
|
<div class="tab-pane" id="rights" role="tabpanel">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@ -6,43 +6,45 @@ use Doctrine\ODM\MongoDB\DocumentManager;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use PSC\Shop\ContactBundle\Model\Role;
|
use PSC\Shop\ContactBundle\Model\Role;
|
||||||
use PSC\Shop\ContactBundle\Repository\ContactRepository;
|
use PSC\Shop\ContactBundle\Repository\ContactRepository;
|
||||||
|
use PSC\Shop\MediaBundle\Model\Media;
|
||||||
|
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||||
|
use PSC\Shop\MediaBundle\Transformer\Media as PSCMedia;
|
||||||
use PSC\System\SettingsBundle\Service\Shop;
|
use PSC\System\SettingsBundle\Service\Shop;
|
||||||
|
|
||||||
class Contact
|
class Contact
|
||||||
{
|
{
|
||||||
|
public function __construct(private readonly MediaManager $mediaManager, private readonly ContactRepository $contactRepository, private readonly Shop $shopService, private readonly EntityManagerInterface $entityManager, private readonly DocumentManager $documentManager, private readonly PSCMedia $mediaTransformer)
|
||||||
public function __construct(private readonly ContactRepository $contactRepository, private readonly Shop $shopService, private readonly EntityManagerInterface $entityManager, private readonly DocumentManager $documentManager)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toDb(\PSC\Shop\ContactBundle\Model\Contact $contact): void
|
public function toDb(\PSC\Shop\ContactBundle\Model\Contact $contact): void
|
||||||
{
|
{
|
||||||
if($contact->getUuid() !== "") {
|
if ($contact->getUuid() !== "") {
|
||||||
/** @var \PSC\Shop\EntityBundle\Entity\Contact $contactEntity */
|
/** @var \PSC\Shop\EntityBundle\Entity\Contact $contactEntity */
|
||||||
$contactEntity = $this->contactRepository->findOneBy(['uuid' => $contact->getUuid()]);
|
$contactEntity = $this->contactRepository->findOneBy(['uuid' => $contact->getUuid()]);
|
||||||
$contactDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)->findOneBy(['uid' => $contactEntity->getUid()]);
|
$contactDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)->findOneBy(['uid' => $contactEntity->getUid()]);
|
||||||
}else{
|
} else {
|
||||||
if($contact->getUid() !== 0) {
|
if ($contact->getUid() !== 0) {
|
||||||
$contactEntity = $this->contactRepository->findOneBy(['uid' => $contact->getUuid()]);
|
$contactEntity = $this->contactRepository->findOneBy(['uid' => $contact->getUuid()]);
|
||||||
$contactDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)->findOneBy(['uid' => $contactEntity->getUid()]);
|
$contactDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)->findOneBy(['uid' => $contactEntity->getUid()]);
|
||||||
}else{
|
} else {
|
||||||
$contactEntity = new \PSC\Shop\EntityBundle\Entity\Contact();
|
$contactEntity = new \PSC\Shop\EntityBundle\Entity\Contact();
|
||||||
$contactDoc = new \PSC\Shop\EntityBundle\Document\Contact();
|
$contactDoc = new \PSC\Shop\EntityBundle\Document\Contact();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$contactDoc) {
|
if (!$contactDoc) {
|
||||||
$contactDoc = new \PSC\Shop\EntityBundle\Document\Contact();
|
$contactDoc = new \PSC\Shop\EntityBundle\Document\Contact();
|
||||||
}
|
}
|
||||||
|
|
||||||
$shops = [];
|
$shops = [];
|
||||||
foreach($contact->getShops() as $shop) {
|
foreach ($contact->getShops() as $shop) {
|
||||||
$shops[] = $this->shopService->getShopByUid($shop->getUuid());
|
$shops[] = $this->shopService->getShopByUid($shop->getUuid());
|
||||||
}
|
}
|
||||||
if(count($shops) > 0) {
|
if (count($shops) > 0) {
|
||||||
$contactEntity->setShops($shops);
|
$contactEntity->setShops($shops);
|
||||||
}
|
}
|
||||||
if($contact->getEmail() != "") {
|
if ($contact->getEmail() != "") {
|
||||||
$contactEntity->setEmail($contact->getEmail());
|
$contactEntity->setEmail($contact->getEmail());
|
||||||
}
|
}
|
||||||
$contactEntity->setEnable(true);
|
$contactEntity->setEnable(true);
|
||||||
@ -56,6 +58,13 @@ class Contact
|
|||||||
$contactEntity->setHouseNumber((string)$contact->getLayouterData()->getHouseNumber());
|
$contactEntity->setHouseNumber((string)$contact->getLayouterData()->getHouseNumber());
|
||||||
$contactEntity->setHomepage((string)$contact->getLayouterData()->getHomepage());
|
$contactEntity->setHomepage((string)$contact->getLayouterData()->getHomepage());
|
||||||
|
|
||||||
|
if ($contact->getLayouterData()->getImage1() != null) {
|
||||||
|
$contactEntity->setImage((string)$contact->getLayouterData()->getImage1()->getUuid());
|
||||||
|
}
|
||||||
|
if ($contact->getLayouterData()->getImage2() != null) {
|
||||||
|
$contactEntity->setImage2((string)$contact->getLayouterData()->getImage2()->getUuid());
|
||||||
|
}
|
||||||
|
|
||||||
$contactEntity->setBirthday((string)$contact->getLayouterData()->getBirthday());
|
$contactEntity->setBirthday((string)$contact->getLayouterData()->getBirthday());
|
||||||
$contactEntity->setKostenstellung((string)$contact->getLayouterData()->getKst());
|
$contactEntity->setKostenstellung((string)$contact->getLayouterData()->getKst());
|
||||||
$contactEntity->setState((string)$contact->getLayouterData()->getState());
|
$contactEntity->setState((string)$contact->getLayouterData()->getState());
|
||||||
@ -103,7 +112,7 @@ class Contact
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($contact->getRoles()) > 0) {
|
if (count($contact->getRoles()) > 0) {
|
||||||
$roles = [];
|
$roles = [];
|
||||||
/** @var Role $role */
|
/** @var Role $role */
|
||||||
foreach ($contact->getRoles() as $role) {
|
foreach ($contact->getRoles() as $role) {
|
||||||
@ -125,7 +134,7 @@ class Contact
|
|||||||
public function fromDb(\PSC\Shop\ContactBundle\Model\Contact $contact, \PSC\Shop\EntityBundle\Entity\Contact $contactEntity): void
|
public function fromDb(\PSC\Shop\ContactBundle\Model\Contact $contact, \PSC\Shop\EntityBundle\Entity\Contact $contactEntity): void
|
||||||
{
|
{
|
||||||
$contactDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)->findOneBy(['uid' => $contactEntity->getUid()]);
|
$contactDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Contact::class)->findOneBy(['uid' => $contactEntity->getUid()]);
|
||||||
if(!$contactDoc) {
|
if (!$contactDoc) {
|
||||||
$contactDoc = new \PSC\Shop\EntityBundle\Document\Contact();
|
$contactDoc = new \PSC\Shop\EntityBundle\Document\Contact();
|
||||||
$contactDoc->setUid($contactEntity->getUid());
|
$contactDoc->setUid($contactEntity->getUid());
|
||||||
}
|
}
|
||||||
@ -209,5 +218,22 @@ class Contact
|
|||||||
$contact->getLayouterData()->setState((string)$contactEntity->getState());
|
$contact->getLayouterData()->setState((string)$contactEntity->getState());
|
||||||
|
|
||||||
$contact->getLayouterData()->setEmail((string)$contactDoc->getLayouterEmail());
|
$contact->getLayouterData()->setEmail((string)$contactDoc->getLayouterEmail());
|
||||||
|
|
||||||
|
if ($contactEntity->getImage() != "") {
|
||||||
|
$media = $this->mediaManager->getMedia($contactEntity->getImage());
|
||||||
|
if ($media) {
|
||||||
|
$mediaModel = new Media();
|
||||||
|
$this->mediaTransformer->fromDb($mediaModel, $media);
|
||||||
|
$contact->getLayouterData()->setImage1($mediaModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($contactEntity->getImage2() != "") {
|
||||||
|
$media = $this->mediaManager->getMedia($contactEntity->getImage2());
|
||||||
|
if ($media) {
|
||||||
|
$mediaModel = new Media();
|
||||||
|
$this->mediaTransformer->fromDb($mediaModel, $media);
|
||||||
|
$contact->getLayouterData()->setImage2($mediaModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,63 +56,63 @@ class Shop
|
|||||||
public $browsericon;
|
public $browsericon;
|
||||||
public $sitemap;
|
public $sitemap;
|
||||||
public $robots;
|
public $robots;
|
||||||
/**
|
/**
|
||||||
* @var string $id
|
* @var string $id
|
||||||
*/
|
*/
|
||||||
#[Id]
|
#[Id]
|
||||||
protected $id;
|
protected $id;
|
||||||
/**
|
/**
|
||||||
* @var string $uid
|
* @var string $uid
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $uid;
|
protected $uid;
|
||||||
/**
|
/**
|
||||||
* @var string $apiKey;
|
* @var string $apiKey;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $apiKey;
|
protected $apiKey;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected string $defaultCurrency = "EUR";
|
protected string $defaultCurrency = "EUR";
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected string $defaultLocale = "de_DE";
|
protected string $defaultLocale = "de_DE";
|
||||||
/**
|
/**
|
||||||
* @var string $numberPattern;
|
* @var string $numberPattern;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $numberPattern;
|
protected $numberPattern;
|
||||||
/**
|
/**
|
||||||
* @var int $numberStart;
|
* @var int $numberStart;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'int')]
|
#[Field(type: 'int')]
|
||||||
protected $numberStart;
|
protected $numberStart;
|
||||||
/**
|
/**
|
||||||
* @var boolean $ownNumber
|
* @var boolean $ownNumber
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $ownNumber;
|
protected $ownNumber;
|
||||||
/**
|
/**
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $guestEnable;
|
protected $guestEnable;
|
||||||
/**
|
/**
|
||||||
* @var string $contactNumberPattern;
|
* @var string $contactNumberPattern;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $contactNumberPattern;
|
protected $contactNumberPattern;
|
||||||
/**
|
/**
|
||||||
* @var int $contactNumberStart;
|
* @var int $contactNumberStart;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'int')]
|
#[Field(type: 'int')]
|
||||||
protected $contactNumberStart;
|
protected $contactNumberStart;
|
||||||
/**
|
/**
|
||||||
* @var float $priceFactor;
|
* @var float $priceFactor;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'float')]
|
#[Field(type: 'float')]
|
||||||
protected $priceFactor;
|
protected $priceFactor;
|
||||||
/**
|
/**
|
||||||
* @var boolean $contactOwnNumber
|
* @var boolean $contactOwnNumber
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $contactOwnNumber;
|
protected $contactOwnNumber;
|
||||||
|
|
||||||
@ -172,367 +172,379 @@ class Shop
|
|||||||
|
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docInvoiceJasperXml;
|
protected $docInvoiceJasperXml;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docInvoicePosition;
|
protected $docInvoicePosition;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docJobticketJasperXml;
|
protected $docJobticketJasperXml;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docJobticketPosition;
|
protected $docJobticketPosition;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docJobticketPPJasperXml;
|
protected $docJobticketPPJasperXml;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docJobticketPPPosition;
|
protected $docJobticketPPPosition;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOfferJasperXml;
|
protected $docOfferJasperXml;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOfferPosition;
|
protected $docOfferPosition;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOrderJasperXml;
|
protected $docOrderJasperXml;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOrderPosition;
|
protected $docOrderPosition;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docLabelJasperXml;
|
protected $docLabelJasperXml;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docLabelPosition;
|
protected $docLabelPosition;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docDeliveryJasperXml;
|
protected $docDeliveryJasperXml;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docDeliveryPosition;
|
protected $docDeliveryPosition;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docStornoJasperXml;
|
protected $docStornoJasperXml;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docStornoPosition;
|
protected $docStornoPosition;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $redirectAfterBuy;
|
protected $redirectAfterBuy;
|
||||||
/**
|
/**
|
||||||
* @var boolean $redirectToSSL
|
* @var boolean $redirectToSSL
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $redirectToSSL;
|
protected $redirectToSSL;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $theme;
|
protected $theme;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $layouterTheme;
|
protected $layouterTheme;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $betreiberFax;
|
protected $betreiberFax;
|
||||||
/**
|
/**
|
||||||
* @var boolean $createPackageAfterBuy
|
* @var boolean $createPackageAfterBuy
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $createPackageAfterBuy;
|
protected $createPackageAfterBuy;
|
||||||
/**
|
/**
|
||||||
* @var boolean $tpSaveUserData
|
* @var boolean $tpSaveUserData
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $tpSaveUserData;
|
protected $tpSaveUserData;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName1;
|
* @var string $productFieldName1;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName1;
|
protected $productFieldName1;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName2;
|
* @var string $productFieldName2;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName2;
|
protected $productFieldName2;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName3;
|
* @var string $productFieldName3;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName3;
|
protected $productFieldName3;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName4;
|
* @var string $productFieldName4;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName4;
|
protected $productFieldName4;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName5;
|
* @var string $productFieldName5;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName5;
|
protected $productFieldName5;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName6;
|
* @var string $productFieldName6;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName6;
|
protected $productFieldName6;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName7;
|
* @var string $productFieldName7;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName7;
|
protected $productFieldName7;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName8;
|
* @var string $productFieldName8;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName8;
|
protected $productFieldName8;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName9;
|
* @var string $productFieldName9;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName9;
|
protected $productFieldName9;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName10;
|
* @var string $productFieldName10;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName10;
|
protected $productFieldName10;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName12;
|
* @var string $productFieldName12;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName11;
|
protected $productFieldName11;
|
||||||
/**
|
/**
|
||||||
* @var string $productFieldName12;
|
* @var string $productFieldName12;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $productFieldName12;
|
protected $productFieldName12;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName1;
|
* @var string $customerFieldName1;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName1;
|
protected $customerFieldName1;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName2;
|
* @var string $customerFieldName2;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName2;
|
protected $customerFieldName2;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName3;
|
* @var string $customerFieldName3;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName3;
|
protected $customerFieldName3;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName4;
|
* @var string $customerFieldName4;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName4;
|
protected $customerFieldName4;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName5;
|
* @var string $customerFieldName5;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName5;
|
protected $customerFieldName5;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName6;
|
* @var string $customerFieldName6;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName6;
|
protected $customerFieldName6;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName7;
|
* @var string $customerFieldName7;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName7;
|
protected $customerFieldName7;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName8;
|
* @var string $customerFieldName8;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName8;
|
protected $customerFieldName8;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName9;
|
* @var string $customerFieldName9;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName9;
|
protected $customerFieldName9;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName10;
|
* @var string $customerFieldName10;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName10;
|
protected $customerFieldName10;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName12;
|
* @var string $customerFieldName12;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName11;
|
protected $customerFieldName11;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName12;
|
* @var string $customerFieldName12;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName12;
|
protected $customerFieldName12;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName13;
|
* @var string $customerFieldName13;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName13;
|
protected $customerFieldName13;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName14;
|
* @var string $customerFieldName14;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName14;
|
protected $customerFieldName14;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName15;
|
* @var string $customerFieldName15;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName15;
|
protected $customerFieldName15;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName16;
|
* @var string $customerFieldName16;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName16;
|
protected $customerFieldName16;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName17;
|
* @var string $customerFieldName17;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName17;
|
protected $customerFieldName17;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName18;
|
* @var string $customerFieldName18;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName18;
|
protected $customerFieldName18;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName19;
|
* @var string $customerFieldName19;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName19;
|
protected $customerFieldName19;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName20;
|
* @var string $customerFieldName20;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName20;
|
protected $customerFieldName20;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName21;
|
* @var string $customerFieldName21;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName21;
|
protected $customerFieldName21;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName22;
|
* @var string $customerFieldName22;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName22;
|
protected $customerFieldName22;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName23;
|
* @var string $customerFieldName23;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName23;
|
protected $customerFieldName23;
|
||||||
/**
|
/**
|
||||||
* @var string $customerFieldName24;
|
* @var string $customerFieldName24;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $customerFieldName24;
|
protected $customerFieldName24;
|
||||||
/**
|
/**
|
||||||
* @var string $mailOrderCustomerSubjectTemplate;
|
* @var string $mailOrderCustomerSubjectTemplate;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $mailOrderCustomerSubjectTemplate;
|
protected $mailOrderCustomerSubjectTemplate;
|
||||||
/**
|
/**
|
||||||
* @var string $mailOrderCustomerTextTemplate;
|
* @var string $mailOrderCustomerTextTemplate;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $mailOrderCustomerTextTemplate;
|
protected $mailOrderCustomerTextTemplate;
|
||||||
/**
|
/**
|
||||||
* @var string $imprintText;
|
* @var string $imprintText;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $imprintText;
|
protected $imprintText;
|
||||||
/**
|
/**
|
||||||
* @var string $privacyPolicyText;
|
* @var string $privacyPolicyText;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $privacyPolicyText;
|
protected $privacyPolicyText;
|
||||||
/**
|
/**
|
||||||
* @var string $cancellationTermsText;
|
* @var string $cancellationTermsText;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $cancellationTermsText;
|
protected $cancellationTermsText;
|
||||||
/**
|
/**
|
||||||
* @var string $conditionsText;
|
* @var string $conditionsText;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $conditionsText;
|
protected $conditionsText;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docJobticketBg;
|
protected $docJobticketBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docJobticketPositionBg;
|
protected $docJobticketPositionBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docJobticketPPBg;
|
protected $docJobticketPPBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docJobticketPPPositionBg;
|
protected $docJobticketPPPositionBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOfferBg;
|
protected $docOfferBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOfferPositionBg;
|
protected $docOfferPositionBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOrderBg;
|
protected $docOrderBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOrderPositionBg;
|
protected $docOrderPositionBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docInvoiceBg;
|
protected $docInvoiceBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docInvoiceFileName;
|
protected $docInvoiceFileName;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOfferFileName;
|
protected $docOfferFileName;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docStornoFileName;
|
protected $docStornoFileName;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docJobticketFileName;
|
protected $docJobticketFileName;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docJobticketPPFileName;
|
protected $docJobticketPPFileName;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOrderFileName;
|
protected $docOrderFileName;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docDeliveryFileName;
|
protected $docDeliveryFileName;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docLabelFileName;
|
protected $docLabelFileName;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docInvoicePositionBg;
|
protected $docInvoicePositionBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docLabelBg;
|
protected $docLabelBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docLabelPositionBg;
|
protected $docLabelPositionBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docDeliveryBg;
|
protected $docDeliveryBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docDeliveryPositionBg;
|
protected $docDeliveryPositionBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docStornoBg;
|
protected $docStornoBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docStornoPositionBg;
|
protected $docStornoPositionBg;
|
||||||
#[Field(type: 'hash')]
|
#[Field(type: 'hash')]
|
||||||
protected $pluginSettings = [];
|
protected $pluginSettings = [];
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOfferProductBg;
|
protected $docOfferProductBg;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOfferProductXml;
|
protected $docOfferProductXml;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $docOfferProductFileName;
|
protected $docOfferProductFileName;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderCompany;
|
protected $senderCompany;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderFirstname;
|
protected $senderFirstname;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderLastname;
|
protected $senderLastname;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderStreet;
|
protected $senderStreet;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderHouseNumber;
|
protected $senderHouseNumber;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderZip;
|
protected $senderZip;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderCity;
|
protected $senderCity;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderCountry;
|
protected $senderCountry;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderTel;
|
protected $senderTel;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderFax;
|
protected $senderFax;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderMobile;
|
protected $senderMobile;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderEmail;
|
protected $senderEmail;
|
||||||
/**
|
#[Field(type: 'bool')]
|
||||||
* @var string $extraSettings;
|
protected bool $docInvoiceXML = false;
|
||||||
*/
|
#[Field(type: 'bool')]
|
||||||
|
protected bool $docOrderXML = false;
|
||||||
|
#[Field(type: 'bool')]
|
||||||
|
protected bool $docDeliveryXML = false;
|
||||||
|
#[Field(type: 'bool')]
|
||||||
|
protected bool $docOfferXML = false;
|
||||||
|
#[Field(type: 'bool')]
|
||||||
|
protected bool $docStornoXML = false;
|
||||||
|
#[Field(type: 'bool')]
|
||||||
|
protected bool $docJobticketXML = false;
|
||||||
|
/**
|
||||||
|
* @var string $extraSettings;
|
||||||
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $extraSettings;
|
protected $extraSettings;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected string $routingConfigCMS = '';
|
protected string $routingConfigCMS = '';
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected string $routingConfigProduct = '';
|
protected string $routingConfigProduct = '';
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected string $routingConfigProductGroup = '';
|
protected string $routingConfigProductGroup = '';
|
||||||
public bool $noVerify;
|
public bool $noVerify;
|
||||||
|
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected bool $disableOldCalc = false;
|
protected bool $disableOldCalc = false;
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getId()
|
public function getId()
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
@ -3119,4 +3131,65 @@ class Shop
|
|||||||
{
|
{
|
||||||
$this->disableOldCalc = $disableOldCalc;
|
$this->disableOldCalc = $disableOldCalc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isDocInvoiceXML(): bool
|
||||||
|
{
|
||||||
|
return (bool)$this->docInvoiceXML;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDocInvoiceXML(bool $value): void
|
||||||
|
{
|
||||||
|
$this->docInvoiceXML = $value;
|
||||||
|
}
|
||||||
|
public function isDocDeliveryXML(): bool
|
||||||
|
{
|
||||||
|
return (bool)$this->docDeliveryXML;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDocDeliveryXML(bool $value): void
|
||||||
|
{
|
||||||
|
$this->docDeliveryXML = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDocOrderXML(): bool
|
||||||
|
{
|
||||||
|
return (bool)$this->docOrderXML;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDocOrderXML(bool $value): void
|
||||||
|
{
|
||||||
|
$this->docOrderXML = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDocJobticketXML(): bool
|
||||||
|
{
|
||||||
|
return (bool)$this->docJobticketXML;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDocJobticketXML(bool $value): void
|
||||||
|
{
|
||||||
|
$this->docJobticketXML = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDocStornoXML(): bool
|
||||||
|
{
|
||||||
|
return (bool)$this->docStornoXML;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDocStornoXML(bool $value): void
|
||||||
|
{
|
||||||
|
$this->docStornoXML = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isDocOfferXML(): bool
|
||||||
|
{
|
||||||
|
return (bool)$this->docOfferXML;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDocOfferXML(bool $value): void
|
||||||
|
{
|
||||||
|
$this->docOfferXML = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -191,9 +191,9 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
|
|||||||
$this->createdAt = new \DateTime();
|
$this->createdAt = new \DateTime();
|
||||||
$this->updatedAt = new \DateTime();
|
$this->updatedAt = new \DateTime();
|
||||||
$this->uuid = Uuid::uuid4();
|
$this->uuid = Uuid::uuid4();
|
||||||
if($email == "") {
|
if ($email == "") {
|
||||||
$this->setEmail($this->uuid);
|
$this->setEmail($this->uuid);
|
||||||
}else{
|
} else {
|
||||||
$this->setEmail($email);
|
$this->setEmail($email);
|
||||||
}
|
}
|
||||||
$this->enable = true;
|
$this->enable = true;
|
||||||
@ -262,7 +262,7 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
|
|||||||
*/
|
*/
|
||||||
public function setPassword($password)
|
public function setPassword($password)
|
||||||
{
|
{
|
||||||
if($password != "") {
|
if ($password != "") {
|
||||||
$this->password = $password;
|
$this->password = $password;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -505,11 +505,11 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
|
|||||||
#[ORM\Column(name: 'self_web', type: 'string', length: 255, nullable: true)]
|
#[ORM\Column(name: 'self_web', type: 'string', length: 255, nullable: true)]
|
||||||
private $homepage;
|
private $homepage;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
#[ORM\Column(name: 'self_foto', type: 'string', length: 255, nullable: true)]
|
#[ORM\Column(name: 'self_foto', type: 'string', length: 255, nullable: true)]
|
||||||
private $image;
|
private $image;
|
||||||
|
#
|
||||||
|
#[ORM\Column(name: 'foto', type: 'string', length: 255, nullable: true)]
|
||||||
|
private $image2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
@ -1087,6 +1087,8 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
|
|||||||
$this->setName('anonym@anonym.de');
|
$this->setName('anonym@anonym.de');
|
||||||
$this->setEnable(false);
|
$this->setEnable(false);
|
||||||
$this->setPassword('anonym');
|
$this->setPassword('anonym');
|
||||||
|
$this->setImage("");
|
||||||
|
$this->setImage2("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1860,6 +1862,32 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
|
|||||||
$this->image = $image;
|
$this->image = $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getImage1()
|
||||||
|
{
|
||||||
|
return $this->image;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $image
|
||||||
|
*/
|
||||||
|
public function setImage1($image1)
|
||||||
|
{
|
||||||
|
$this->image = $image1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImage2()
|
||||||
|
{
|
||||||
|
return $this->image2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $image
|
||||||
|
*/
|
||||||
|
public function setImage2($image2)
|
||||||
|
{
|
||||||
|
$this->image2 = $image2;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -2333,7 +2361,7 @@ class Contact implements UserInterface, PasswordAuthenticatedUserInterface, \Ser
|
|||||||
if ($row->getLevel() == 50) {
|
if ($row->getLevel() == 50) {
|
||||||
$temp[] = "ROLE_SYSTEM_ADMIN";
|
$temp[] = "ROLE_SYSTEM_ADMIN";
|
||||||
}
|
}
|
||||||
if(!in_array($row->getLevel(), [10,20,25,30,35,40,50,0])) {
|
if (!in_array($row->getLevel(), [10,20,25,30,35,40,50,0])) {
|
||||||
$temp[] = $row->getTitle();
|
$temp[] = $row->getTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,19 +34,17 @@ class OrderRepository extends ServiceEntityRepository
|
|||||||
parent::__construct($registry, Order::class);
|
parent::__construct($registry, Order::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIncomeByShop($shopUuId)
|
public function getIncomeByShop($shopUuId, $year)
|
||||||
{
|
{
|
||||||
$fromDate = new DateTime();
|
|
||||||
$fromDate->modify("-12month");
|
|
||||||
$query = $this->getEntityManager()
|
$query = $this->getEntityManager()
|
||||||
->createQuery('
|
->createQuery('
|
||||||
SELECT sum(o.brutto) as brutto, SUBSTRING(o.created, 1, 7) as month FROM PSCEntityBundle:Order o
|
SELECT sum(o.brutto) as brutto, MONTH(o.created) as monat FROM PSCEntityBundle:Order o
|
||||||
JOIN o.shop s
|
JOIN o.shop s
|
||||||
WHERE o.status <> 170 AND s.uid = :shop_uuid AND o.type = 1 AND o.created > \'' . $fromDate->format('Y-m-d H:i:s') . '\'
|
WHERE o.status <> 170 AND s.uid = :shop_uuid AND o.type = 1 AND o.created >= \'' . $year . '-01-01\' AND o.created <= \'' . $year . '-12-31\'
|
||||||
GROUP BY month ORDER BY o.created DESC')
|
GROUP BY monat ORDER BY o.created ASC')
|
||||||
->setParameter('shop_uuid', $shopUuId);
|
->setParameter('shop_uuid', $shopUuId);
|
||||||
try {
|
try {
|
||||||
return $query->execute();
|
return $query->getArrayResult();
|
||||||
} catch (\Doctrine\ORM\NoResultException $e) {
|
} catch (\Doctrine\ORM\NoResultException $e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
79
src/new/src/PSC/Shop/MediaBundle/Api/Upload.php
Normal file
79
src/new/src/PSC/Shop/MediaBundle/Api/Upload.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\Shop\MediaBundle\Api;
|
||||||
|
|
||||||
|
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||||
|
use PSC\Shop\MediaBundle\Document\Media;
|
||||||
|
use PSC\Shop\MediaBundle\Model\Media as MediaModel;
|
||||||
|
use PSC\Shop\MediaBundle\Helper\MediaManager;
|
||||||
|
use PSC\System\SettingsBundle\Service\Shop;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
use OpenApi\Annotations as OA;
|
||||||
|
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||||
|
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||||
|
|
||||||
|
class Upload extends AbstractController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* create media
|
||||||
|
*
|
||||||
|
* @OA\Response(
|
||||||
|
* response=200,
|
||||||
|
* description="media",
|
||||||
|
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\MediaBundle\Model\Media::class))
|
||||||
|
* )
|
||||||
|
* @OA\RequestBody(
|
||||||
|
* description="This is a request body",
|
||||||
|
* @OA\MediaType(
|
||||||
|
* mediaType="multipart/form-data",
|
||||||
|
* @OA\Schema(
|
||||||
|
* @OA\Property(
|
||||||
|
* description="folder of file",
|
||||||
|
* property="folder",
|
||||||
|
* type="string"
|
||||||
|
* ),
|
||||||
|
* @OA\Property(
|
||||||
|
* description="Binary content of file",
|
||||||
|
* property="file",
|
||||||
|
* type="string",
|
||||||
|
* format="binary",
|
||||||
|
* ),
|
||||||
|
* required={"file", "folder"}
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* @OA\Tag(name="Media")
|
||||||
|
* @IsGranted("ROLE_USER")
|
||||||
|
* @Security(name="ApiKeyAuth")
|
||||||
|
* @Security(name="Bearer")
|
||||||
|
*/
|
||||||
|
#[Route(path: '/create', methods: ['POST'])]
|
||||||
|
public function create(MediaManager $mediaManager, Shop $shopService, DocumentManager $documentManager, Request $req): JsonResponse
|
||||||
|
{
|
||||||
|
$selectedShop = $shopService->getShopByDomain();
|
||||||
|
$selectedFolder = $documentManager
|
||||||
|
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
||||||
|
->findOneBy(array('id' => $req->get('folder')));
|
||||||
|
$handler = $mediaManager->getHandlerForType('pdf');
|
||||||
|
$media = new Media();
|
||||||
|
$helper = $handler->getFormHelper($media);
|
||||||
|
$media->setContent($req->files->get('file'));
|
||||||
|
$handler->prepareMedia($media);
|
||||||
|
$media->setFolder($selectedFolder);
|
||||||
|
$media->setShop($selectedShop->getUid());
|
||||||
|
$documentManager->persist($media);
|
||||||
|
$documentManager->flush();
|
||||||
|
|
||||||
|
$mediaModel = new MediaModel();
|
||||||
|
$mediaModel->setUuid($media->getId());
|
||||||
|
$mediaModel->setUrl($media->getUrl());
|
||||||
|
$mediaModel->setTitle($media->getTitle());
|
||||||
|
return $this->json($mediaModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
83
src/new/src/PSC/Shop/MediaBundle/Api/UploadVariant.php
Normal file
83
src/new/src/PSC/Shop/MediaBundle/Api/UploadVariant.php
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\Shop\MediaBundle\Api;
|
||||||
|
|
||||||
|
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||||
|
use PSC\Shop\MediaBundle\Document\Embed\Variant;
|
||||||
|
use PSC\Shop\MediaBundle\Document\Media;
|
||||||
|
use PSC\Shop\MediaBundle\Model\Media as MediaModel;
|
||||||
|
use PSC\Shop\MediaBundle\Helper\MediaManager;
|
||||||
|
use PSC\Shop\MediaBundle\Service\MediaManager as PSCMediaManager;
|
||||||
|
use PSC\Shop\MediaBundle\Transformer\Media as PSCMedia;
|
||||||
|
use PSC\System\SettingsBundle\Service\Shop;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
use OpenApi\Annotations as OA;
|
||||||
|
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||||
|
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||||
|
|
||||||
|
class UploadVariant extends AbstractController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* create media
|
||||||
|
*
|
||||||
|
* @OA\Response(
|
||||||
|
* response=200,
|
||||||
|
* description="media",
|
||||||
|
* @OA\JsonContent(ref=@Model(type=\PSC\Shop\MediaBundle\Model\Media::class))
|
||||||
|
* )
|
||||||
|
* @OA\RequestBody(
|
||||||
|
* description="This is a request body",
|
||||||
|
* @OA\MediaType(
|
||||||
|
* mediaType="multipart/form-data",
|
||||||
|
* @OA\Schema(
|
||||||
|
* @OA\Property(
|
||||||
|
* description="uuid of file",
|
||||||
|
* property="uuid",
|
||||||
|
* type="string"
|
||||||
|
* ),
|
||||||
|
* @OA\Property(
|
||||||
|
* description="settings of file",
|
||||||
|
* property="settings",
|
||||||
|
* type="string"
|
||||||
|
* ),
|
||||||
|
* @OA\Property(
|
||||||
|
* description="Binary content of file",
|
||||||
|
* property="file",
|
||||||
|
* type="string",
|
||||||
|
* format="binary",
|
||||||
|
* ),
|
||||||
|
* required={"file", "uuid", "settings"}
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* @OA\Tag(name="Media")
|
||||||
|
* @IsGranted("ROLE_USER")
|
||||||
|
* @Security(name="ApiKeyAuth")
|
||||||
|
* @Security(name="Bearer")
|
||||||
|
*/
|
||||||
|
#[Route(path: '/variant/create', methods: ['POST'])]
|
||||||
|
public function create(PSCMediaManager $mediaService, PSCMedia $mediaTransformer, MediaManager $mediaManager, Shop $shopService, DocumentManager $documentManager, Request $req): JsonResponse
|
||||||
|
{
|
||||||
|
$mediaVariant = new Variant();
|
||||||
|
|
||||||
|
$media = $mediaService->getMedia($req->get('uuid'));
|
||||||
|
$handler = $mediaManager->getHandlerForType('pdf');
|
||||||
|
$helper = $handler->getFormHelper($mediaVariant);
|
||||||
|
$mediaVariant->setContent($req->files->get('file'));
|
||||||
|
$mediaVariant->setSettings($req->get('settings'));
|
||||||
|
$handler->prepareMedia($mediaVariant);
|
||||||
|
$media->addVariant($mediaVariant);
|
||||||
|
$documentManager->persist($media);
|
||||||
|
$documentManager->flush();
|
||||||
|
|
||||||
|
$mediaModel = new MediaModel();
|
||||||
|
$mediaTransformer->fromDb($mediaModel, $media);
|
||||||
|
return $this->json($mediaModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -29,6 +29,7 @@ use PSC\Shop\EntityBundle\Entity\Shop;
|
|||||||
use PSC\Shop\MediaBundle\Document\Folder;
|
use PSC\Shop\MediaBundle\Document\Folder;
|
||||||
use PSC\Shop\MediaBundle\Form\Backend\FolderType;
|
use PSC\Shop\MediaBundle\Form\Backend\FolderType;
|
||||||
use PSC\Shop\MediaBundle\Form\Backend\SearchType;
|
use PSC\Shop\MediaBundle\Form\Backend\SearchType;
|
||||||
|
use PSC\Shop\MediaBundle\Form\Backend\SubFolderType;
|
||||||
use PSC\Shop\MediaBundle\Helper\Media\AbstractMediaHandler;
|
use PSC\Shop\MediaBundle\Helper\Media\AbstractMediaHandler;
|
||||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||||
use PSC\System\SettingsBundle\Form\Backend\DeleteType;
|
use PSC\System\SettingsBundle\Form\Backend\DeleteType;
|
||||||
@ -84,18 +85,18 @@ class FolderController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$type = $request->get('type');
|
$type = $request->get('type');
|
||||||
/** @var AbstractMediaHandler $handler */
|
/** @var AbstractMediaHandler $handler */
|
||||||
$handler = null;
|
$handler = null;
|
||||||
if ($type) {
|
if ($type) {
|
||||||
$handler = $mediaManager->getHandlerForType($type);
|
$handler = $mediaManager->getHandlerForType($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$searchForm->handleRequest($request);
|
||||||
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
|
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
|
||||||
$selectedShop = $shopService->getSelectedShop();
|
$selectedShop = $shopService->getSelectedShop();
|
||||||
$cat = new Folder();
|
$cat = new Folder();
|
||||||
$folderForm = $this->createForm(FolderType::class, $cat);
|
$folderForm = $this->createForm(FolderType::class, $cat);
|
||||||
$folderForm->handleRequest($request);
|
$folderForm->handleRequest($request);
|
||||||
$searchForm->handleRequest($request);
|
|
||||||
if ($folderForm->isSubmitted() && $folderForm->isValid()) {
|
if ($folderForm->isSubmitted() && $folderForm->isValid()) {
|
||||||
$cat->setIcon($request->get('icon', 'fa-file'));
|
$cat->setIcon($request->get('icon', 'fa-file'));
|
||||||
$documentManager->persist($cat);
|
$documentManager->persist($cat);
|
||||||
@ -104,31 +105,69 @@ class FolderController extends AbstractController
|
|||||||
$uuid = $cat->getId();
|
$uuid = $cat->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$subCat = new Folder();
|
||||||
|
$subFolderForm = $this->createForm(SubFolderType::class, $subCat);
|
||||||
|
$subFolderForm->handleRequest($request);
|
||||||
|
|
||||||
/** @var CachingIterator $folders */
|
/** @var CachingIterator $folders */
|
||||||
$folders = $documentManager
|
$folders = $documentManager
|
||||||
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
||||||
->createQueryBuilder('folder')
|
->createQueryBuilder('folder')
|
||||||
|
->field('parent_id')->exists(false)
|
||||||
->sort('title', 'ASC')->getQuery()->execute();
|
->sort('title', 'ASC')->getQuery()->execute();
|
||||||
if (count($folders->toArray()) == 0) {
|
if (count($folders->toArray()) == 0) {
|
||||||
$this->createDefaultFolder($documentManager);
|
$this->createDefaultFolder($documentManager);
|
||||||
/** @var Folder[] $folders */
|
/** @var Folder[] $folders */
|
||||||
$folders = $documentManager
|
$folders = $documentManager
|
||||||
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
||||||
->createQueryBuilder('folder')
|
->createQueryBuilder('folder')
|
||||||
|
->field('parent_id')->exists(false)
|
||||||
->sort('title', 'ASC')->getQuery()->execute();
|
->sort('title', 'ASC')->getQuery()->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$level = 1;
|
||||||
|
|
||||||
$tempFolders = array();
|
|
||||||
foreach ($folders as $cat) {
|
foreach ($folders as $cat) {
|
||||||
|
$subFolders = $documentManager
|
||||||
|
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
||||||
|
->createQueryBuilder('folder')
|
||||||
|
->field('parent_id')->equals($cat->getId())
|
||||||
|
->sort('title', 'ASC')->getQuery()->execute();
|
||||||
$count = $documentManager
|
$count = $documentManager
|
||||||
->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
||||||
->createQueryBuilder('media')
|
->createQueryBuilder('media')
|
||||||
->field('folder.$id')->equals(new ObjectId($cat->getId()))->count()
|
->field('folder.$id')->equals(new ObjectId($cat->getId()))->count()
|
||||||
->getQuery()->execute();
|
->getQuery()->execute();
|
||||||
$cat->setMedia($count);
|
$cat->setMedia($count);
|
||||||
$tempFolders[] = $cat;
|
foreach($subFolders as $subFolder) {
|
||||||
|
$count = $documentManager
|
||||||
|
->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
||||||
|
->createQueryBuilder('media')
|
||||||
|
->field('folder.$id')->equals(new ObjectId($subFolder->getId()))->count()
|
||||||
|
->getQuery()->execute();
|
||||||
|
$subFolder->setMedia($count);
|
||||||
|
$cat->addSubFolder($subFolder);
|
||||||
|
$subSubFolders = $documentManager
|
||||||
|
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
||||||
|
->createQueryBuilder('folder')
|
||||||
|
->field('parent_id')->equals($subFolder->getId())
|
||||||
|
->sort('title', 'ASC')->getQuery()->execute();
|
||||||
|
if($uuid == $subFolder->getId()) {
|
||||||
|
$level = 2;
|
||||||
|
}
|
||||||
|
foreach($subSubFolders as $subSubFolder) {
|
||||||
|
$count = $documentManager
|
||||||
|
->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
||||||
|
->createQueryBuilder('media')
|
||||||
|
->field('folder.$id')->equals(new ObjectId($subSubFolder->getId()))->count()
|
||||||
|
->getQuery()->execute();
|
||||||
|
$subSubFolder->setMedia($count);
|
||||||
|
$subFolder->addSubFolder($subSubFolder);
|
||||||
|
if($uuid == $subSubFolder->getId()) {
|
||||||
|
$level = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$uuid) {
|
if (!$uuid) {
|
||||||
@ -146,6 +185,18 @@ class FolderController extends AbstractController
|
|||||||
->findOneBy([]);
|
->findOneBy([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($subFolderForm->isSubmitted() && $subFolderForm->isValid()) {
|
||||||
|
$subCat->setIcon($request->get('icon', 'fa-file'));
|
||||||
|
$subCat->setParentId($selectedFolder->getId());
|
||||||
|
$documentManager->persist($subCat);
|
||||||
|
$documentManager->flush();
|
||||||
|
$session->set('media-folder-uuid', $subCat->getId());
|
||||||
|
$uuid = $subCat->getId();
|
||||||
|
$selectedFolder = $documentManager
|
||||||
|
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
||||||
|
->findOneBy(array('id' => $uuid));
|
||||||
|
return $this->redirectToRoute('psc_shop_media_backend_folder_show', ['uuid' => $uuid, 'htmlId' => $htmlId, 'modal' => $modal]);
|
||||||
|
}
|
||||||
$searchTerm = $request->query->get('term', '');
|
$searchTerm = $request->query->get('term', '');
|
||||||
$page = $request->query->getInt('page', 1);
|
$page = $request->query->getInt('page', 1);
|
||||||
if ($searchForm->isSubmitted() && $searchForm->isValid()) {
|
if ($searchForm->isSubmitted() && $searchForm->isValid()) {
|
||||||
@ -175,9 +226,11 @@ class FolderController extends AbstractController
|
|||||||
return array(
|
return array(
|
||||||
'pagination' => $pagination,
|
'pagination' => $pagination,
|
||||||
'mediamanager' => $mediaManager,
|
'mediamanager' => $mediaManager,
|
||||||
'folders' => $tempFolders,
|
'level' => $level,
|
||||||
|
'folders' => $folders,
|
||||||
'selectedFolder' => $selectedFolder,
|
'selectedFolder' => $selectedFolder,
|
||||||
'folderForm' => $folderForm->createView(),
|
'folderForm' => $folderForm->createView(),
|
||||||
|
'subFolderForm' => $subFolderForm->createView(),
|
||||||
'modal' => $modal,
|
'modal' => $modal,
|
||||||
'handler' => $handler,
|
'handler' => $handler,
|
||||||
'htmlId' => $htmlId,
|
'htmlId' => $htmlId,
|
||||||
@ -185,20 +238,6 @@ class FolderController extends AbstractController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Default Seite
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @param \PSC\System\SettingsBundle\Service\Shop $shopService
|
|
||||||
* @param DocumentManager $documentManager
|
|
||||||
* @param $uuid
|
|
||||||
* @param $modal
|
|
||||||
* @param $htmlId
|
|
||||||
* @return array
|
|
||||||
* @throws \Doctrine\ODM\MongoDB\MongoDBException
|
|
||||||
* @throws \Doctrine\ORM\ORMException
|
|
||||||
*/
|
|
||||||
#[Route(path: '/list/folder/delete/{uuid}/{modal}/{htmlId}', defaults: ['uuid' => false, 'modal' => false, 'htmlId' => false], name: 'psc_shop_media_backend_folder_delete')]
|
#[Route(path: '/list/folder/delete/{uuid}/{modal}/{htmlId}', defaults: ['uuid' => false, 'modal' => false, 'htmlId' => false], name: 'psc_shop_media_backend_folder_delete')]
|
||||||
#[Template]
|
#[Template]
|
||||||
public function deleteAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, DocumentManager $documentManager, $uuid, $modal, $htmlId)
|
public function deleteAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, DocumentManager $documentManager, $uuid, $modal, $htmlId)
|
||||||
|
|||||||
@ -95,7 +95,7 @@ class UploadController extends AbstractController
|
|||||||
$form = $this->createForm($handler->getFormType(), $helper);
|
$form = $this->createForm($handler->getFormType(), $helper);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
//$media = $helper->getMedia();
|
//$media = $helper->getMedia();
|
||||||
$documentManager->detach($media);
|
$documentManager->detach($media);
|
||||||
$documentManager->persist($media);
|
$documentManager->persist($media);
|
||||||
$documentManager->flush();
|
$documentManager->flush();
|
||||||
|
|||||||
659
src/new/src/PSC/Shop/MediaBundle/Document/Embed/Variant.php
Normal file
659
src/new/src/PSC/Shop/MediaBundle/Document/Embed/Variant.php
Normal file
@ -0,0 +1,659 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\Shop\MediaBundle\Document\Embed;
|
||||||
|
|
||||||
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbeddedDocument;
|
||||||
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;
|
||||||
|
use PSC\Shop\MediaBundle\Document\Media;
|
||||||
|
|
||||||
|
#[EmbeddedDocument]
|
||||||
|
class Variant extends Media
|
||||||
|
{
|
||||||
|
#[Field(type: 'string')]
|
||||||
|
protected $location;
|
||||||
|
#[Field(type: 'string')]
|
||||||
|
protected $settings;
|
||||||
|
#[Field(type: 'string')]
|
||||||
|
protected $contentType;
|
||||||
|
#[Field(type: 'hash')]
|
||||||
|
protected $metadata = array();
|
||||||
|
#[Field(type: 'date')]
|
||||||
|
protected $createdAt;
|
||||||
|
#[Field(type: 'date')]
|
||||||
|
protected $updatedAt;
|
||||||
|
|
||||||
|
protected $content;
|
||||||
|
#[Field(type: 'int')]
|
||||||
|
protected $filesize;
|
||||||
|
#[Field(type: 'string')]
|
||||||
|
protected $url;
|
||||||
|
#[Field(type: 'string')]
|
||||||
|
protected $originalFilename;
|
||||||
|
#[Field(type: 'bool')]
|
||||||
|
protected $deleted;
|
||||||
|
#[Field(type: 'string')]
|
||||||
|
protected $providerName;
|
||||||
|
#[Field(type: 'int')]
|
||||||
|
protected $providerStatus;
|
||||||
|
#[Field(type: 'string')]
|
||||||
|
protected $providerReference;
|
||||||
|
#[Field(type: 'hash')]
|
||||||
|
protected $providerMetadata = [];
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->setCreatedAt(new \DateTime());
|
||||||
|
$this->setUpdatedAt(new \DateTime());
|
||||||
|
$this->deleted = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFileSize()
|
||||||
|
{
|
||||||
|
$size = $this->filesize;
|
||||||
|
if ($size < 1024) {
|
||||||
|
return $size . "b";
|
||||||
|
} else {
|
||||||
|
$help = $size / 1024;
|
||||||
|
if ($help < 1024) {
|
||||||
|
return round($help, 1) . "kb";
|
||||||
|
} else {
|
||||||
|
return round(($help / 1024), 1) . "mb";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSettings(string $settings): void
|
||||||
|
{
|
||||||
|
$this->settings = $settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSettings(): string
|
||||||
|
{
|
||||||
|
return $this->settings;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getFileSizeBytes()
|
||||||
|
{
|
||||||
|
return $this->filesize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $filesize
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*/
|
||||||
|
public function setFileSize($filesize)
|
||||||
|
{
|
||||||
|
$this->filesize = $filesize;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set location
|
||||||
|
*
|
||||||
|
* @param string $location
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*/
|
||||||
|
public function setLocation($location)
|
||||||
|
{
|
||||||
|
$this->location = $location;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get location
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLocation()
|
||||||
|
{
|
||||||
|
return $this->location;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set contentType
|
||||||
|
*
|
||||||
|
* @param string $contentType
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*/
|
||||||
|
public function setContentType($contentType)
|
||||||
|
{
|
||||||
|
$this->contentType = $contentType;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get contentType
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getContentType()
|
||||||
|
{
|
||||||
|
return $this->contentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get contentType
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getContentTypeShort()
|
||||||
|
{
|
||||||
|
$contentType = $this->contentType;
|
||||||
|
$array = explode("/", $contentType);
|
||||||
|
$contentType = end($array);
|
||||||
|
return $contentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set metadata
|
||||||
|
*
|
||||||
|
* @param array $metadata
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*/
|
||||||
|
public function setMetadata($metadata)
|
||||||
|
{
|
||||||
|
$this->metadata = $metadata;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get metadata
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getMetadata()
|
||||||
|
{
|
||||||
|
return $this->metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the specified metadata value
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param mixed $value
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*/
|
||||||
|
public function setMetadataValue($name, $value)
|
||||||
|
{
|
||||||
|
$metadata = $this->getProviderMetadata();
|
||||||
|
$metadata[$name] = $value;
|
||||||
|
$this->setProviderMetadata($metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getMetadataValue($name, $default = null)
|
||||||
|
{
|
||||||
|
$metadata = $this->getProviderMetadata();
|
||||||
|
return isset($metadata[$name]) ? $metadata[$name] : $default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function unsetMetadataValue($name)
|
||||||
|
{
|
||||||
|
$metadata = $this->getProviderMetadata();
|
||||||
|
unset($metadata[$name]);
|
||||||
|
$this->setProviderMetadata($metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setCreatedAt(\DateTime $createdAt = null)
|
||||||
|
{
|
||||||
|
$this->createdAt = $createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get createdAt
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getCreatedAt()
|
||||||
|
{
|
||||||
|
return $this->createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setUpdatedAt(\DateTime $updatedAt = null)
|
||||||
|
{
|
||||||
|
$this->updatedAt = $updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get updatedAt
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getUpdatedAt()
|
||||||
|
{
|
||||||
|
return $this->updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set content
|
||||||
|
*
|
||||||
|
* @param mixed $content
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*/
|
||||||
|
public function setContent($content)
|
||||||
|
{
|
||||||
|
$this->content = $content;
|
||||||
|
$this->setUpdatedAt(new \DateTime());
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get content
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getContent()
|
||||||
|
{
|
||||||
|
return $this->content;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isDeleted()
|
||||||
|
{
|
||||||
|
return $this->deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $deleted
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*/
|
||||||
|
public function setDeleted($deleted)
|
||||||
|
{
|
||||||
|
$this->deleted = $deleted;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $url
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*/
|
||||||
|
public function setUrl($url)
|
||||||
|
{
|
||||||
|
$this->url = $url;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $originalFilename
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*/
|
||||||
|
public function setOriginalFilename($originalFilename)
|
||||||
|
{
|
||||||
|
$this->originalFilename = $originalFilename;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getOriginalFilename()
|
||||||
|
{
|
||||||
|
return $this->originalFilename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setBinaryContent($binaryContent)
|
||||||
|
{
|
||||||
|
// TODO: Implement setBinaryContent() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getBinaryContent()
|
||||||
|
{
|
||||||
|
// TODO: Implement getBinaryContent() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function resetBinaryContent()
|
||||||
|
{
|
||||||
|
// TODO: Implement resetBinaryContent() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
// TODO: Implement setName() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
// TODO: Implement getName() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setEnabled($enabled)
|
||||||
|
{
|
||||||
|
// TODO: Implement setEnabled() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getEnabled()
|
||||||
|
{
|
||||||
|
// TODO: Implement getEnabled() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setProviderName($providerName)
|
||||||
|
{
|
||||||
|
$this->providerName = $providerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getProviderName()
|
||||||
|
{
|
||||||
|
if ($this->providerName === null) {
|
||||||
|
return 'psc.shop.media.provider.image';
|
||||||
|
}
|
||||||
|
return $this->providerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setProviderStatus($providerStatus)
|
||||||
|
{
|
||||||
|
$this->providerStatus = $providerStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getProviderStatus()
|
||||||
|
{
|
||||||
|
if ($this->providerStatus === null) {
|
||||||
|
return MediaInterface::STATUS_OK;
|
||||||
|
}
|
||||||
|
return $this->providerStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setProviderReference($providerReference)
|
||||||
|
{
|
||||||
|
$this->providerReference = $providerReference;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getProviderReference()
|
||||||
|
{
|
||||||
|
return $this->providerReference;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setProviderMetadata(array $providerMetadata = [])
|
||||||
|
{
|
||||||
|
$this->providerMetadata = $providerMetadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getProviderMetadata()
|
||||||
|
{
|
||||||
|
return $this->providerMetadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setWidth($width)
|
||||||
|
{
|
||||||
|
// TODO: Implement setWidth() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getWidth()
|
||||||
|
{
|
||||||
|
// TODO: Implement getWidth() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setHeight($height)
|
||||||
|
{
|
||||||
|
// TODO: Implement setHeight() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getHeight()
|
||||||
|
{
|
||||||
|
// TODO: Implement getHeight() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setLength($length)
|
||||||
|
{
|
||||||
|
// TODO: Implement setLength() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getLength()
|
||||||
|
{
|
||||||
|
// TODO: Implement getLength() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setAuthorName($authorName)
|
||||||
|
{
|
||||||
|
// TODO: Implement setAuthorName() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getAuthorName()
|
||||||
|
{
|
||||||
|
// TODO: Implement getAuthorName() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setContext($context)
|
||||||
|
{
|
||||||
|
// TODO: Implement setContext() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getContext()
|
||||||
|
{
|
||||||
|
// TODO: Implement getContext() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setCdnIsFlushable($cdnIsFlushable)
|
||||||
|
{
|
||||||
|
// TODO: Implement setCdnIsFlushable() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getCdnIsFlushable()
|
||||||
|
{
|
||||||
|
// TODO: Implement getCdnIsFlushable() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setCdnFlushIdentifier($cdnFlushIdentifier)
|
||||||
|
{
|
||||||
|
// TODO: Implement setCdnFlushIdentifier() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getCdnFlushIdentifier()
|
||||||
|
{
|
||||||
|
// TODO: Implement getCdnFlushIdentifier() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setCdnFlushAt(\DateTime $cdnFlushAt = null)
|
||||||
|
{
|
||||||
|
// TODO: Implement setCdnFlushAt() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getCdnFlushAt()
|
||||||
|
{
|
||||||
|
// TODO: Implement getCdnFlushAt() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getExtension()
|
||||||
|
{
|
||||||
|
$providerReference = $this->getProviderReference();
|
||||||
|
if (!$providerReference) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// strips off query strings or hashes, which are common in URIs remote references
|
||||||
|
return preg_replace('{(\?|#).*}', '', pathinfo($providerReference, PATHINFO_EXTENSION));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setSize($size)
|
||||||
|
{
|
||||||
|
// TODO: Implement setSize() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getSize()
|
||||||
|
{
|
||||||
|
// TODO: Implement getSize() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setCdnStatus($cdnStatus)
|
||||||
|
{
|
||||||
|
// TODO: Implement setCdnStatus() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getCdnStatus()
|
||||||
|
{
|
||||||
|
// TODO: Implement getCdnStatus() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getBox()
|
||||||
|
{
|
||||||
|
// TODO: Implement getBox() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setGalleryHasMedias($galleryHasMedias)
|
||||||
|
{
|
||||||
|
// TODO: Implement setGalleryHasMedias() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getGalleryHasMedias()
|
||||||
|
{
|
||||||
|
// TODO: Implement getGalleryHasMedias() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getPreviousProviderReference()
|
||||||
|
{
|
||||||
|
// TODO: Implement getPreviousProviderReference() method.
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,38 +18,41 @@ use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
|
|||||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
||||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbeddedDocument;
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbeddedDocument;
|
||||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbedOne;
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbedOne;
|
||||||
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\Index;
|
||||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\ReferenceMany;
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\ReferenceMany;
|
||||||
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\ReferenceOne;
|
||||||
|
|
||||||
#[Document(collection: 'Media_Folder')]
|
#[Document(collection: 'Media_Folder')]
|
||||||
class Folder
|
class Folder
|
||||||
{
|
{
|
||||||
#[Id]
|
#[Id]
|
||||||
protected $id;
|
protected $id;
|
||||||
/**
|
/**
|
||||||
* @var \DateTime $created;
|
* @var \DateTime $created;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'date')]
|
#[Field(type: 'date')]
|
||||||
protected $created;
|
protected $created;
|
||||||
/**
|
/**
|
||||||
* @var \DateTime $updated;
|
* @var \DateTime $updated;
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'date')]
|
#[Field(type: 'date')]
|
||||||
protected $updated;
|
protected $updated;
|
||||||
/**
|
/**
|
||||||
* @var string $title
|
* @var string $title
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $title;
|
protected $title;
|
||||||
/**
|
/**
|
||||||
* @var string $icon
|
* @var string $icon
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $icon;
|
protected $icon;
|
||||||
/**
|
|
||||||
* @var string $parent
|
|
||||||
*/
|
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $parent;
|
protected $parent_id;
|
||||||
|
|
||||||
|
private $subFolders = [];
|
||||||
|
|
||||||
private $media = 0;
|
private $media = 0;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -153,19 +156,23 @@ class Folder
|
|||||||
$this->media = $media;
|
$this->media = $media;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getParentId()
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getParent()
|
|
||||||
{
|
{
|
||||||
return $this->parent;
|
return $this->parent_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setParentId($parent_id)
|
||||||
* @param string $parent
|
|
||||||
*/
|
|
||||||
public function setParent($parent)
|
|
||||||
{
|
{
|
||||||
$this->parent = $parent;
|
$this->parent_id = $parent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubFolders(): array
|
||||||
|
{
|
||||||
|
return $this->subFolders;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addSubFolder(Folder $folder): void
|
||||||
|
{
|
||||||
|
$this->subFolders[] = $folder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,13 +13,14 @@
|
|||||||
|
|
||||||
namespace PSC\Shop\MediaBundle\Document;
|
namespace PSC\Shop\MediaBundle\Document;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbedMany;
|
||||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;
|
||||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
|
||||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
||||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbeddedDocument;
|
|
||||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\EmbedOne;
|
|
||||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\ReferenceOne;
|
use Doctrine\ODM\MongoDB\Mapping\Annotations\ReferenceOne;
|
||||||
use Imagine\Image\Box;
|
use Doctrine\ODM\MongoDB\PersistentCollection;
|
||||||
|
use PSC\Shop\MediaBundle\Document\Embed\Variant;
|
||||||
use PSC\Shop\MediaBundle\Model\MediaInterface;
|
use PSC\Shop\MediaBundle\Model\MediaInterface;
|
||||||
|
|
||||||
#[Document]
|
#[Document]
|
||||||
@ -27,92 +28,95 @@ class Media implements MediaInterface
|
|||||||
{
|
{
|
||||||
#[Id]
|
#[Id]
|
||||||
protected $id;
|
protected $id;
|
||||||
/**
|
|
||||||
* @var string $shop
|
|
||||||
*/
|
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $shop;
|
protected $shop;
|
||||||
/**
|
|
||||||
* @var string
|
#[Field(type: 'string')]
|
||||||
*/
|
protected $contact;
|
||||||
|
|
||||||
|
#[EmbedMany(targetDocument: Variant::class)]
|
||||||
|
protected $variants;
|
||||||
|
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $title;
|
protected $title;
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $description;
|
protected $description;
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $copyright;
|
protected $copyright;
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $location;
|
protected $location;
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $contentType;
|
protected $contentType;
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'hash')]
|
#[Field(type: 'hash')]
|
||||||
protected $metadata = array();
|
protected $metadata = array();
|
||||||
/**
|
/**
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'date')]
|
#[Field(type: 'date')]
|
||||||
protected $createdAt;
|
protected $createdAt;
|
||||||
/**
|
/**
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'date')]
|
#[Field(type: 'date')]
|
||||||
protected $updatedAt;
|
protected $updatedAt;
|
||||||
/**
|
/**
|
||||||
* @var Folder
|
* @var Folder
|
||||||
*/
|
*/
|
||||||
#[ReferenceOne(targetDocument: 'PSC\Shop\MediaBundle\Document\Folder')]
|
#[ReferenceOne(targetDocument: 'PSC\Shop\MediaBundle\Document\Folder')]
|
||||||
protected $folder;
|
protected $folder;
|
||||||
/**
|
/**
|
||||||
* @var mixed
|
* @var mixed
|
||||||
*/
|
*/
|
||||||
protected $content;
|
protected $content;
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'int')]
|
#[Field(type: 'int')]
|
||||||
protected $filesize;
|
protected $filesize;
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $url;
|
protected $url;
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $originalFilename;
|
protected $originalFilename;
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $deleted;
|
protected $deleted;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $providerName;
|
protected $providerName;
|
||||||
#[Field(type: 'int')]
|
#[Field(type: 'int')]
|
||||||
protected $providerStatus;
|
protected $providerStatus;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $providerReference;
|
protected $providerReference;
|
||||||
#[Field(type: 'hash')]
|
#[Field(type: 'hash')]
|
||||||
protected $providerMetadata = [];
|
protected $providerMetadata = [];
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->setCreatedAt(new \DateTime());
|
$this->setCreatedAt(new \DateTime());
|
||||||
$this->setUpdatedAt(new \DateTime());
|
$this->setUpdatedAt(new \DateTime());
|
||||||
|
$this->variants = new ArrayCollection();
|
||||||
$this->deleted = false;
|
$this->deleted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,4 +822,29 @@ class Media implements MediaInterface
|
|||||||
{
|
{
|
||||||
// TODO: Implement getPreviousProviderReference() method.
|
// TODO: Implement getPreviousProviderReference() method.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addVariant(Variant $variant): void
|
||||||
|
{
|
||||||
|
$tmp = [];
|
||||||
|
$found = false;
|
||||||
|
foreach ($this->variants as $var) {
|
||||||
|
if ($var->getSettings() == $variant->getSettings()) {
|
||||||
|
$tmp[] = $variant;
|
||||||
|
$found = true;
|
||||||
|
} else {
|
||||||
|
$tmp[] = $var;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$found) {
|
||||||
|
$tmp[] = $variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->variants = $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVariants(): PersistentCollection
|
||||||
|
{
|
||||||
|
return $this->variants;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PrintshopCreator Suite
|
||||||
|
*
|
||||||
|
* PHP Version 5.3
|
||||||
|
*
|
||||||
|
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||||
|
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||||
|
* @license Private
|
||||||
|
* @link http://www.printshopcreator.de
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PSC\Shop\MediaBundle\Form\Backend;
|
||||||
|
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class SubFolderType extends AbstractType
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('title', TextType::class, array('attr' => array('placeholder' => 'Folder')));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return 'subFolder';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefaults(array(
|
||||||
|
'data_class' => 'PSC\Shop\MediaBundle\Document\Folder',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,12 +22,12 @@ class FileHandler extends AbstractMediaHandler
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const TYPE = 'file';
|
public const TYPE = 'file';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const MEDIA_PATH = '/uploads/media/';
|
public const MEDIA_PATH = '/uploads/media/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Filesystem
|
* @var Filesystem
|
||||||
@ -168,6 +168,7 @@ class FileHandler extends AbstractMediaHandler
|
|||||||
$media->setContent($file);
|
$media->setContent($file);
|
||||||
}
|
}
|
||||||
if ($content instanceof UploadedFile) {
|
if ($content instanceof UploadedFile) {
|
||||||
|
$this->checkExif($content->getPathname());
|
||||||
$pathInfo = pathinfo($content->getClientOriginalName());
|
$pathInfo = pathinfo($content->getClientOriginalName());
|
||||||
$media->setOriginalFilename($this->slugifier->slugify($pathInfo['filename']) . '.' . $pathInfo['extension']);
|
$media->setOriginalFilename($this->slugifier->slugify($pathInfo['filename']) . '.' . $pathInfo['extension']);
|
||||||
$name = $media->getTitle();
|
$name = $media->getTitle();
|
||||||
@ -184,6 +185,35 @@ class FileHandler extends AbstractMediaHandler
|
|||||||
$media->setLocation('local');
|
$media->setLocation('local');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function checkExif($filename)
|
||||||
|
{
|
||||||
|
if (function_exists('exif_read_data')) {
|
||||||
|
if (exif_imagetype($filename) != IMAGETYPE_JPEG) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$exif = exif_read_data($filename);
|
||||||
|
if ($exif && isset($exif['Orientation'])) {
|
||||||
|
$orientation = $exif['Orientation'];
|
||||||
|
if ($exif['Orientation'] == 3 or $exif['Orientation'] == 6 or $exif['Orientation'] == 8) {
|
||||||
|
$imageResource = imagecreatefromjpeg($filename);
|
||||||
|
switch ($exif['Orientation']) {
|
||||||
|
case 3:
|
||||||
|
$image = imagerotate($imageResource, 180, 0);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
$image = imagerotate($imageResource, -90, 0);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
$image = imagerotate($imageResource, 90, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
imagejpeg($image, $filename);
|
||||||
|
imagedestroy($imageResource);
|
||||||
|
imagedestroy($image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @param Media $media
|
* @param Media $media
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -88,12 +88,14 @@ class ImageHandler extends FileHandler
|
|||||||
parent::prepareMedia($media);
|
parent::prepareMedia($media);
|
||||||
|
|
||||||
if ($media->getContent()) {
|
if ($media->getContent()) {
|
||||||
$imageInfo = getimagesize($media->getContent());
|
if ('image/svg+xml' !== mime_content_type($media->getContent()->getPathname())) {
|
||||||
$width = $imageInfo[0];
|
$imageInfo = getimagesize($media->getContent());
|
||||||
$height = $imageInfo[1];
|
$width = $imageInfo[0];
|
||||||
|
$height = $imageInfo[1];
|
||||||
|
|
||||||
$media->setMetadataValue('original_width', $width);
|
$media->setMetadataValue('original_width', $width);
|
||||||
$media->setMetadataValue('original_height', $height);
|
$media->setMetadataValue('original_height', $height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,9 @@ class Media
|
|||||||
#[OA\Property(type: 'string')]
|
#[OA\Property(type: 'string')]
|
||||||
private string $uuid = "";
|
private string $uuid = "";
|
||||||
|
|
||||||
|
#[OA\Property(type: 'array', items: new OA\Items(ref: new Model(type: Variant::class)))]
|
||||||
|
private array $variants = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -63,4 +66,43 @@ class Media
|
|||||||
{
|
{
|
||||||
$this->uuid = $uuid;
|
$this->uuid = $uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __toString(): string
|
||||||
|
{
|
||||||
|
return $this->uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getArray(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'uuid' => $this->uuid,
|
||||||
|
'url' => $this->url,
|
||||||
|
'title' => $this->title
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVariants(): array
|
||||||
|
{
|
||||||
|
return $this->variants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVariant(string $settings): Media|Variant
|
||||||
|
{
|
||||||
|
foreach ($this->variants as $variant) {
|
||||||
|
if ($settings == $variant->getSettings()) {
|
||||||
|
return $variant;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addVariant(Variant $variant): void
|
||||||
|
{
|
||||||
|
$this->variants[] = $variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clearVariants(): void
|
||||||
|
{
|
||||||
|
$this->variants = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
16
src/new/src/PSC/Shop/MediaBundle/Model/Upload.php
Normal file
16
src/new/src/PSC/Shop/MediaBundle/Model/Upload.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\Shop\MediaBundle\Model;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
use OpenApi\Attributes as OA;
|
||||||
|
|
||||||
|
class Upload
|
||||||
|
{
|
||||||
|
#[OA\Property(type: 'string')]
|
||||||
|
public string $folder = "";
|
||||||
|
|
||||||
|
#[OA\Property(type: 'string', format: 'binary')]
|
||||||
|
public UploadedFile $UploadedFile;
|
||||||
|
|
||||||
|
}
|
||||||
68
src/new/src/PSC/Shop/MediaBundle/Model/Variant.php
Normal file
68
src/new/src/PSC/Shop/MediaBundle/Model/Variant.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\Shop\MediaBundle\Model;
|
||||||
|
|
||||||
|
use OpenApi\Attributes as OA;
|
||||||
|
|
||||||
|
final class Variant
|
||||||
|
{
|
||||||
|
#[OA\Property(type: 'string')]
|
||||||
|
private string $contact;
|
||||||
|
#[OA\Property(type: 'string')]
|
||||||
|
private string $title;
|
||||||
|
#[OA\Property(type: 'string')]
|
||||||
|
private string $settings;
|
||||||
|
#[OA\Property(type: 'string')]
|
||||||
|
private string $uuid;
|
||||||
|
#[OA\Property(type: 'string')]
|
||||||
|
private string $url = "";
|
||||||
|
|
||||||
|
public function getTitle(): string
|
||||||
|
{
|
||||||
|
return $this->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTitle(string $title): void
|
||||||
|
{
|
||||||
|
$this->title = $title;
|
||||||
|
}
|
||||||
|
public function getUrl(): string
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUrl(string $url): void
|
||||||
|
{
|
||||||
|
$this->url = $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContact(): string
|
||||||
|
{
|
||||||
|
return $this->contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setContact(string $contact): void
|
||||||
|
{
|
||||||
|
$this->contact = $contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSettings(): string
|
||||||
|
{
|
||||||
|
return $this->settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSettings(string $settings): void
|
||||||
|
{
|
||||||
|
$this->settings = $settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUuid(): string
|
||||||
|
{
|
||||||
|
return $this->uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUuid(string $uuid): void
|
||||||
|
{
|
||||||
|
$this->uuid = $uuid;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,3 +3,7 @@ psc_shop_media_backend:
|
|||||||
type: annotation
|
type: annotation
|
||||||
prefix: /backend/media
|
prefix: /backend/media
|
||||||
|
|
||||||
|
psc_shop_media_api:
|
||||||
|
resource: "@PSCShopMediaBundle/Api"
|
||||||
|
prefix: /api/media
|
||||||
|
type: annotation
|
||||||
|
|||||||
@ -45,6 +45,27 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link {% if selectedFolder.id == cat.id %}active{% endif %}" href="{{ path('psc_shop_media_backend_folder_show', {uuid: cat.id, modal: modal, htmlId: htmlId}) }}">
|
<a class="nav-link {% if selectedFolder.id == cat.id %}active{% endif %}" href="{{ path('psc_shop_media_backend_folder_show', {uuid: cat.id, modal: modal, htmlId: htmlId}) }}">
|
||||||
<span class="badge bg-dark pull-right">({{ cat.media }})</span> <i class="fa {{ cat.icon }}"></i> {{ cat.title }}</a>
|
<span class="badge bg-dark pull-right">({{ cat.media }})</span> <i class="fa {{ cat.icon }}"></i> {{ cat.title }}</a>
|
||||||
|
{% if cat.subFolders|length > 0 %}
|
||||||
|
<ul>
|
||||||
|
{% for subCat in cat.subFolders %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link {% if selectedFolder.id == subCat.id %}active{% endif %}" href="{{ path('psc_shop_media_backend_folder_show', {uuid: subCat.id, modal: modal, htmlId: htmlId}) }}">
|
||||||
|
<span class="badge bg-dark pull-right">({{ subCat.media }})</span> <i class="fa {{ subCat.icon }}"></i> {{ subCat.title }}</a>
|
||||||
|
{% if subCat.subFolders|length > 0 %}
|
||||||
|
<ul>
|
||||||
|
{% for subSubCat in subCat.subFolders %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link {% if selectedFolder.id == subSubCat.id %}active{% endif %}" href="{{ path('psc_shop_media_backend_folder_show', {uuid: subSubCat.id, modal: modal, htmlId: htmlId}) }}">
|
||||||
|
<span class="badge bg-dark pull-right">({{ subSubCat.media }})</span> <i class="fa {{ subSubCat.icon }}"></i> {{ subSubCat.title }}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
@ -55,7 +76,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">{% if selectedFolder %}<a href="{{ path("psc_shop_media_backend_upload_add", {uuid: selectedFolder.id, modal: modal, htmlId: htmlId}) }}" class="btn btn-info btn-sm"><span class="fa fa-edit"></span> Dateien hinzufügen (Einzelupload)</a>{% if pagination|length == 0 %} <a href="{{ path("psc_shop_media_backend_folder_delete", {uuid: selectedFolder.id, modal: modal, htmlId: htmlId}) }}" class="btn btn-danger btn-sm"><span class="fa fa-remove"></span> Ordner löschen</a>{% endif %}{% endif %}</div>
|
<div class="col-md-6">{% if selectedFolder %}<a href="{{ path("psc_shop_media_backend_upload_add", {uuid: selectedFolder.id, modal: modal, htmlId: htmlId}) }}" class="btn btn-info btn-sm"><span class="fa fa-edit"></span> Dateien hinzufügen (Einzelupload)</a> {% if pagination|length == 0 %} <a href="{{ path("psc_shop_media_backend_folder_delete", {uuid: selectedFolder.id, modal: modal, htmlId: htmlId}) }}" class="btn btn-danger btn-sm"><span class="fa fa-remove"></span> Ordner löschen</a>{% endif %}{% endif %}</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{{ form_start(searchForm, { 'attr': {'class': ''}}) }}
|
{{ form_start(searchForm, { 'attr': {'class': ''}}) }}
|
||||||
<div class="input-group input-group-sm mb-3">
|
<div class="input-group input-group-sm mb-3">
|
||||||
@ -67,7 +88,22 @@
|
|||||||
{{ form_end(searchForm) }}
|
{{ form_end(searchForm) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if level < 3 %}
|
||||||
|
{{ form_start(subFolderForm, { 'attr': {'class': ''}}) }}
|
||||||
|
<div class="form-group form-group-sm row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<label>Neuen Unterordner anlegen</label>
|
||||||
|
<div class="input-group input-group-sm">
|
||||||
|
|
||||||
|
{{ form_widget(subFolderForm.title, {attr: {'class': 'form-control'}}) }}
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-save"></i></button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ form_end(subFolderForm) }}
|
||||||
|
{% endif %}
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
{% set isImage = false %}
|
{% set isImage = false %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if imageurlorg %}
|
{% if imageurlorg %}
|
||||||
<img src="{{ imageurl }}" srcset="{{ imageurl }} 1x {{ imageurlretina is defined ? ', ' ~ imageurlretina ~ " 2x" }}" alt="{{ media.title }}" class="media-thumbnail__img w-100">
|
<img src="{{ imageurlorg }}" srcset="{{ imageurlorg }} 1x {{ imageurlretina is defined ? ', ' ~ imageurlretina ~ " 2x" }}" alt="{{ media.title }}" class="media-thumbnail__img w-100">
|
||||||
{% else %}
|
{% else %}
|
||||||
<i class="fas fa-file-o media-thumbnail__icon"></i>
|
<i class="fas fa-file-o media-thumbnail__icon"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -68,6 +68,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel">
|
||||||
|
<div class="header">
|
||||||
|
<h5>Varianten</h5>
|
||||||
|
</div>
|
||||||
|
<div class="body">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="thead-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Setting</th>
|
||||||
|
<th>Url</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for variant in media.variants %}
|
||||||
|
<tr><td>{{ variant.settings }}</td><td><img src="{{ variant.url }}" width="100" /></td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h5>Referenzen</h5>
|
<h5>Referenzen</h5>
|
||||||
|
|||||||
45
src/new/src/PSC/Shop/MediaBundle/Service/Folder.php
Normal file
45
src/new/src/PSC/Shop/MediaBundle/Service/Folder.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\Shop\MediaBundle\Service;
|
||||||
|
|
||||||
|
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||||
|
|
||||||
|
class Folder
|
||||||
|
{
|
||||||
|
public function __construct(private readonly DocumentManager $documentManager)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getTreeForSelectbox(): array
|
||||||
|
{
|
||||||
|
$folders = $this->documentManager
|
||||||
|
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
||||||
|
->createQueryBuilder('folder')
|
||||||
|
->field('parent_id')->exists(false)
|
||||||
|
->sort('title', 'ASC')->getQuery()->execute();
|
||||||
|
|
||||||
|
$temp = [];
|
||||||
|
foreach($folders as $folder) {
|
||||||
|
$temp[$folder->getTitle()] = $folder->getId();
|
||||||
|
$subFolders = $this->documentManager
|
||||||
|
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
||||||
|
->createQueryBuilder('folder')
|
||||||
|
->field('parent_id')->equals($folder->getId())
|
||||||
|
->sort('title', 'ASC')->getQuery()->execute();
|
||||||
|
foreach($subFolders as $subFolder) {
|
||||||
|
$temp['--' . $subFolder->getTitle()] = $subFolder->getId();
|
||||||
|
$subSubFolders = $this->documentManager
|
||||||
|
->getRepository('PSC\Shop\MediaBundle\Document\Folder')
|
||||||
|
->createQueryBuilder('folder')
|
||||||
|
->field('parent_id')->equals($subFolder->getId())
|
||||||
|
->sort('title', 'ASC')->getQuery()->execute();
|
||||||
|
foreach($subSubFolders as $subSubFolder) {
|
||||||
|
$temp['----' . $subSubFolder->getTitle()] = $subSubFolder->getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,27 +5,14 @@ namespace PSC\Shop\MediaBundle\Service;
|
|||||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||||
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
|
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
|
||||||
use PSC\Shop\MediaBundle\Document\Media;
|
use PSC\Shop\MediaBundle\Document\Media;
|
||||||
use PSC\Shop\MediaBundle\Helper\Media\AbstractMediaHandler;
|
|
||||||
use Symfony\Component\HttpFoundation\File\File;
|
|
||||||
use MongoDB\BSON\ObjectId;
|
use MongoDB\BSON\ObjectId;
|
||||||
|
use PSC\Shop\MediaBundle\Model\Media as AliasedMedia;
|
||||||
|
use PSC\Shop\MediaBundle\Transformer\Media as PSCMedia;
|
||||||
|
|
||||||
/**
|
|
||||||
* MediaManager
|
|
||||||
*/
|
|
||||||
class MediaManager
|
class MediaManager
|
||||||
{
|
{
|
||||||
/** @var DocumentManager */
|
public function __construct(private readonly DocumentManager $mongoDb, private readonly CacheManager $cacheManager, private readonly PSCMedia $mediaTransformer)
|
||||||
private $mongoDb;
|
|
||||||
|
|
||||||
private $cacheManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var DocumentManager $repository
|
|
||||||
*/
|
|
||||||
public function __construct(DocumentManager $mongoDb, CacheManager $cacheManager)
|
|
||||||
{
|
{
|
||||||
$this->mongoDb = $mongoDb;
|
|
||||||
$this->cacheManager = $cacheManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMedia($id)
|
public function getMedia($id)
|
||||||
@ -37,6 +24,14 @@ class MediaManager
|
|||||||
return $media;
|
return $media;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getModelByUuid(string $id): AliasedMedia
|
||||||
|
{
|
||||||
|
$mediaModel = new AliasedMedia();
|
||||||
|
$this->mediaTransformer->fromDb($mediaModel, $this->getMedia($id));
|
||||||
|
|
||||||
|
return $mediaModel;
|
||||||
|
}
|
||||||
|
|
||||||
public function retrieveThumbnailPath(Media $media, $mode = 'psc_backend_portal_image')
|
public function retrieveThumbnailPath(Media $media, $mode = 'psc_backend_portal_image')
|
||||||
{
|
{
|
||||||
/** @var string */
|
/** @var string */
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace PSC\Shop\MediaBundle\Transformer;
|
namespace PSC\Shop\MediaBundle\Transformer;
|
||||||
|
|
||||||
class Media {
|
use PSC\Shop\MediaBundle\Model\Variant;
|
||||||
|
|
||||||
|
class Media
|
||||||
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -12,6 +15,15 @@ class Media {
|
|||||||
$media->setTitle($mediaDoc->getTitle());
|
$media->setTitle($mediaDoc->getTitle());
|
||||||
$media->setUrl($mediaDoc->getUrl());
|
$media->setUrl($mediaDoc->getUrl());
|
||||||
$media->setUuid($mediaDoc->getId());
|
$media->setUuid($mediaDoc->getId());
|
||||||
|
|
||||||
|
foreach ($mediaDoc->getVariants() as $variant) {
|
||||||
|
$variantModel = new Variant();
|
||||||
|
$variantModel->setUrl($variant->getUrl());
|
||||||
|
$variantModel->setTitle($variant->getTitle());
|
||||||
|
$variantModel->setSettings($variant->getSettings());
|
||||||
|
$media->addVariant($variantModel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toDb(\PSC\Shop\MediaBundle\Model\Media $media, \PSC\Shop\MediaBundle\Document\Media $mediaDoc)
|
public function toDb(\PSC\Shop\MediaBundle\Model\Media $media, \PSC\Shop\MediaBundle\Document\Media $mediaDoc)
|
||||||
|
|||||||
@ -7,7 +7,9 @@ use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
|||||||
use MongoDB\BSON\ObjectId;
|
use MongoDB\BSON\ObjectId;
|
||||||
use PSC\Shop\MediaBundle\Document\Media;
|
use PSC\Shop\MediaBundle\Document\Media;
|
||||||
use PSC\Shop\MediaBundle\Helper\MediaManager;
|
use PSC\Shop\MediaBundle\Helper\MediaManager;
|
||||||
|
use PSC\Shop\MediaBundle\Model\Media as PSCMedia;
|
||||||
use PSC\Shop\MediaBundle\Model\MediaInterface;
|
use PSC\Shop\MediaBundle\Model\MediaInterface;
|
||||||
|
use PSC\Shop\MediaBundle\Model\Variant;
|
||||||
use PSC\Shop\MediaBundle\Service\Pool;
|
use PSC\Shop\MediaBundle\Service\Pool;
|
||||||
use PSC\Shop\MediaBundle\Twig\TokenParser\MediaTokenParser;
|
use PSC\Shop\MediaBundle\Twig\TokenParser\MediaTokenParser;
|
||||||
use PSC\Shop\MediaBundle\Twig\TokenParser\PathTokenParser;
|
use PSC\Shop\MediaBundle\Twig\TokenParser\PathTokenParser;
|
||||||
@ -22,25 +24,25 @@ class MediaExtension extends \Twig\Extension\AbstractExtension
|
|||||||
* @var Pool
|
* @var Pool
|
||||||
*/
|
*/
|
||||||
protected $mediaService;
|
protected $mediaService;
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $resources = array();
|
protected $resources = array();
|
||||||
/**
|
/**
|
||||||
* @var ManagerInterface
|
* @var ManagerInterface
|
||||||
*/
|
*/
|
||||||
protected $mediaManager;
|
protected $mediaManager;
|
||||||
protected $mongoManager;
|
protected $mongoManager;
|
||||||
/**
|
/**
|
||||||
* @var \Twig_Environment
|
* @var \Twig_Environment
|
||||||
*/
|
*/
|
||||||
protected $environment;
|
protected $environment;
|
||||||
/**
|
/**
|
||||||
* @param Pool $mediaService
|
* @param Pool $mediaService
|
||||||
* @param MediaManager $mediaManager
|
* @param MediaManager $mediaManager
|
||||||
* @param DocumentManager $mongoManager
|
* @param DocumentManager $mongoManager
|
||||||
* @param Environment $environment
|
* @param Environment $environment
|
||||||
*/
|
*/
|
||||||
public function __construct(Pool $mediaService, MediaManager $mediaManager, DocumentManager $mongoManager, Environment $environment)
|
public function __construct(Pool $mediaService, MediaManager $mediaManager, DocumentManager $mongoManager, Environment $environment)
|
||||||
{
|
{
|
||||||
$this->mediaService = $mediaService;
|
$this->mediaService = $mediaService;
|
||||||
@ -57,7 +59,11 @@ class MediaExtension extends \Twig\Extension\AbstractExtension
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function file($media): string {
|
public function file(string|PSCMedia|Variant $media): string
|
||||||
|
{
|
||||||
|
if ($media instanceof PSCMedia || $media instanceof Variant) {
|
||||||
|
return '/data/www/new/web'.$media->getUrl();
|
||||||
|
}
|
||||||
$media = $this->getMedia($media);
|
$media = $this->getMedia($media);
|
||||||
if (!$media) {
|
if (!$media) {
|
||||||
return '';
|
return '';
|
||||||
@ -66,7 +72,8 @@ class MediaExtension extends \Twig\Extension\AbstractExtension
|
|||||||
return '/data/www/new/web'.$media->getUrl();
|
return '/data/www/new/web'.$media->getUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fileWeb($media): string {
|
public function fileWeb($media): string
|
||||||
|
{
|
||||||
$media = $this->getMedia($media);
|
$media = $this->getMedia($media);
|
||||||
if (!$media) {
|
if (!$media) {
|
||||||
return '';
|
return '';
|
||||||
@ -122,7 +129,7 @@ class MediaExtension extends \Twig\Extension\AbstractExtension
|
|||||||
->getProvider($media->getProviderName());
|
->getProvider($media->getProviderName());
|
||||||
$format = $provider->getFormatName($media, $format);
|
$format = $provider->getFormatName($media, $format);
|
||||||
$format_definition = $provider->getFormat($format);
|
$format_definition = $provider->getFormat($format);
|
||||||
// build option
|
// build option
|
||||||
$defaultOptions = array(
|
$defaultOptions = array(
|
||||||
'title' => $media->getName(),
|
'title' => $media->getName(),
|
||||||
'alt' => $media->getName(),
|
'alt' => $media->getName(),
|
||||||
@ -167,7 +174,7 @@ class MediaExtension extends \Twig\Extension\AbstractExtension
|
|||||||
->getProvider($media->getProviderName());
|
->getProvider($media->getProviderName());
|
||||||
$format = $provider->getFormatName($media, $format);
|
$format = $provider->getFormatName($media, $format);
|
||||||
$format_definition = $provider->getFormat($format);
|
$format_definition = $provider->getFormat($format);
|
||||||
// build option
|
// build option
|
||||||
$defaultOptions = array(
|
$defaultOptions = array(
|
||||||
'title' => $media->getName(),
|
'title' => $media->getName(),
|
||||||
'alt' => $media->getName(),
|
'alt' => $media->getName(),
|
||||||
|
|||||||
@ -33,6 +33,7 @@ use PSC\Shop\OrderBundle\Form\Backend\ProdType;
|
|||||||
use PSC\Shop\OrderBundle\Form\Backend\ProdinfoType;
|
use PSC\Shop\OrderBundle\Form\Backend\ProdinfoType;
|
||||||
use PSC\Shop\OrderBundle\Form\Backend\Upload\DeleteType;
|
use PSC\Shop\OrderBundle\Form\Backend\Upload\DeleteType;
|
||||||
use PSC\Shop\OrderBundle\PSCShopOrderBundle;
|
use PSC\Shop\OrderBundle\PSCShopOrderBundle;
|
||||||
|
use PSC\Shop\OrderBundle\Service\Order as PSCOrder;
|
||||||
use PSC\Shop\QueueBundle\Event\Order\Create;
|
use PSC\Shop\QueueBundle\Event\Order\Create;
|
||||||
use PSC\Shop\QueueBundle\Event\Order\Updated;
|
use PSC\Shop\QueueBundle\Event\Order\Updated;
|
||||||
use PSC\Shop\QueueBundle\Event\Position\Printpartner\Notify;
|
use PSC\Shop\QueueBundle\Event\Position\Printpartner\Notify;
|
||||||
@ -70,26 +71,6 @@ class DetailController extends AbstractController
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Detail Seite
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @param Field $fieldService
|
|
||||||
* @param Section $sectionService
|
|
||||||
* @param Shop $shopService
|
|
||||||
* @param DocumentManager $mongoService
|
|
||||||
* @param EntityManagerInterface $entityManager
|
|
||||||
* @param Manager $eventManagerService
|
|
||||||
* @param Status $statusService
|
|
||||||
* @param PaperDB $paperService
|
|
||||||
* @param SessionInterface $session
|
|
||||||
* @param string $uuid
|
|
||||||
* @param boolean $enableDelivery
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
* @throws \Doctrine\ODM\MongoDB\MongoDBException
|
|
||||||
* @throws \Doctrine\ORM\ORMException
|
|
||||||
*/
|
|
||||||
#[Route(path: '/detail/show/{uuid}/{enableDelivery}', defaults: ['enableDelivery' => 0], name: 'psc_shop_order_backend_detail_show')]
|
#[Route(path: '/detail/show/{uuid}/{enableDelivery}', defaults: ['enableDelivery' => 0], name: 'psc_shop_order_backend_detail_show')]
|
||||||
#[Template]
|
#[Template]
|
||||||
public function showAction(
|
public function showAction(
|
||||||
@ -104,12 +85,14 @@ class DetailController extends AbstractController
|
|||||||
PaperDB $paperService,
|
PaperDB $paperService,
|
||||||
SessionInterface $session,
|
SessionInterface $session,
|
||||||
FormFactoryInterface $formFactory,
|
FormFactoryInterface $formFactory,
|
||||||
|
PSCOrder $orderService,
|
||||||
$uuid = "",
|
$uuid = "",
|
||||||
$enableDelivery = false
|
$enableDelivery = false
|
||||||
) {
|
) {
|
||||||
$customFields = $fieldService->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Order);
|
$customFields = $fieldService->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Order);
|
||||||
$customGroups = $fieldService->getGroups(\PSC\System\PluginBundle\Form\Interfaces\Field::Order);
|
$customGroups = $fieldService->getGroups(\PSC\System\PluginBundle\Form\Interfaces\Field::Order);
|
||||||
$customSections = $sectionService->get(\PSC\System\PluginBundle\Form\Interfaces\Section::Order);
|
$customSections = $sectionService->get(\PSC\System\PluginBundle\Form\Interfaces\Section::Order);
|
||||||
|
$customPositionDetailSections = $sectionService->get(\PSC\System\PluginBundle\Form\Interfaces\Section::OrderPositionDetail);
|
||||||
$selectedShop = $shopService->getSelectedShop();
|
$selectedShop = $shopService->getSelectedShop();
|
||||||
/**
|
/**
|
||||||
* @var \PSC\Shop\EntityBundle\Document\Shop $shop
|
* @var \PSC\Shop\EntityBundle\Document\Shop $shop
|
||||||
@ -154,7 +137,7 @@ class DetailController extends AbstractController
|
|||||||
$order->setStatus($data['status']);
|
$order->setStatus($data['status']);
|
||||||
$eventManagerService->addJob($notify);
|
$eventManagerService->addJob($notify);
|
||||||
$this->logService->createLogEntry($selectedShop, $this->getUser(), LogEntry::INFO, PSCShopOrderBundle::class, $order->getUuid(), "Order Status Detail Changed To: " . $data['status']);
|
$this->logService->createLogEntry($selectedShop, $this->getUser(), LogEntry::INFO, PSCShopOrderBundle::class, $order->getUuid(), "Order Status Detail Changed To: " . $data['status']);
|
||||||
}else{
|
} else {
|
||||||
$this->logService->createLogEntry($selectedShop, $this->getUser(), LogEntry::INFO, PSCShopOrderBundle::class, $order->getUuid(), "Order Status Not Changed But Rest Saved Current Status: " . $order->getStatus());
|
$this->logService->createLogEntry($selectedShop, $this->getUser(), LogEntry::INFO, PSCShopOrderBundle::class, $order->getUuid(), "Order Status Not Changed But Rest Saved Current Status: " . $order->getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +269,7 @@ class DetailController extends AbstractController
|
|||||||
if(isset($objDoc->getSpecialProductTypeObject()['kalk_artikel'])) {
|
if(isset($objDoc->getSpecialProductTypeObject()['kalk_artikel'])) {
|
||||||
$engine->setActiveArticle($objDoc->getSpecialProductTypeObject()['kalk_artikel']);
|
$engine->setActiveArticle($objDoc->getSpecialProductTypeObject()['kalk_artikel']);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$objPosition = unserialize($pos->getData());
|
$objPosition = unserialize($pos->getData());
|
||||||
$engine->setVariables($objPosition->getOptions());
|
$engine->setVariables($objPosition->getOptions());
|
||||||
if(isset($objPosition->getOptions()['kalk_artikel'])) {
|
if(isset($objPosition->getOptions()['kalk_artikel'])) {
|
||||||
@ -345,6 +328,7 @@ class DetailController extends AbstractController
|
|||||||
return array(
|
return array(
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'orderObj' => $orderObj,
|
'orderObj' => $orderObj,
|
||||||
|
'orderModel' => $orderService->getOrderByUuid($uuid),
|
||||||
'positions' => $positions,
|
'positions' => $positions,
|
||||||
'formInvoice' => $formInvoice->createView(),
|
'formInvoice' => $formInvoice->createView(),
|
||||||
'formDelivery' => $formDelivery->createView(),
|
'formDelivery' => $formDelivery->createView(),
|
||||||
@ -354,7 +338,8 @@ class DetailController extends AbstractController
|
|||||||
'shop' => $shop,
|
'shop' => $shop,
|
||||||
'customFields' => $customFields,
|
'customFields' => $customFields,
|
||||||
'customGroups' => $customGroups,
|
'customGroups' => $customGroups,
|
||||||
'customSections' => $customSections
|
'customSections' => $customSections,
|
||||||
|
'customPositionDetailSections' => $customPositionDetailSections,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,15 +44,8 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
|
|
||||||
require_once(__DIR__ . '/../../../EntityBundle/Lagacy/TP_Basket_Item.php');
|
require_once(__DIR__ . '/../../../EntityBundle/Lagacy/TP_Basket_Item.php');
|
||||||
|
|
||||||
/**
|
|
||||||
* DetailController fürs Backend
|
|
||||||
*
|
|
||||||
* @package PSC\Shop\Order\Backend
|
|
||||||
* @subpackage Controller
|
|
||||||
*/
|
|
||||||
class PrintController extends AbstractController
|
class PrintController extends AbstractController
|
||||||
{
|
{
|
||||||
|
|
||||||
#[Route(path: '/detail/print/{type}/{uuid}', name: 'psc_shop_order_backend_detail_print')]
|
#[Route(path: '/detail/print/{type}/{uuid}', name: 'psc_shop_order_backend_detail_print')]
|
||||||
#[Template]
|
#[Template]
|
||||||
public function printAction(
|
public function printAction(
|
||||||
@ -66,7 +59,7 @@ class PrintController extends AbstractController
|
|||||||
|
|
||||||
if ($uuid == 'last') {
|
if ($uuid == 'last') {
|
||||||
$selectedShop = $shopService->getSelectedShop();
|
$selectedShop = $shopService->getSelectedShop();
|
||||||
/** @var Order $order */
|
/** @var Order $order */
|
||||||
$order = $entityManager
|
$order = $entityManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Order')
|
->getRepository('PSC\Shop\EntityBundle\Entity\Order')
|
||||||
->createQueryBuilder('orders')
|
->createQueryBuilder('orders')
|
||||||
@ -76,7 +69,7 @@ class PrintController extends AbstractController
|
|||||||
->orderBy('orders.uid', 'DESC')
|
->orderBy('orders.uid', 'DESC')
|
||||||
->getQuery()->getSingleResult();
|
->getQuery()->getSingleResult();
|
||||||
} else {
|
} else {
|
||||||
/** @var Order $order */
|
/** @var Order $order */
|
||||||
$order = $entityManager
|
$order = $entityManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Order')
|
->getRepository('PSC\Shop\EntityBundle\Entity\Order')
|
||||||
->findOneBy(array('uuid' => $uuid));
|
->findOneBy(array('uuid' => $uuid));
|
||||||
@ -84,7 +77,7 @@ class PrintController extends AbstractController
|
|||||||
$content = $printingService->generateOrder($order, $type);
|
$content = $printingService->generateOrder($order, $type);
|
||||||
$response = new StreamedResponse(function () use ($content) {
|
$response = new StreamedResponse(function () use ($content) {
|
||||||
|
|
||||||
echo $content;
|
echo $content;
|
||||||
});
|
});
|
||||||
$response->headers->set('Content-Type', 'application/pdf');
|
$response->headers->set('Content-Type', 'application/pdf');
|
||||||
$response->headers->set('Cache-Control', '');
|
$response->headers->set('Cache-Control', '');
|
||||||
@ -110,7 +103,7 @@ class PrintController extends AbstractController
|
|||||||
|
|
||||||
if ($uuid == 'last') {
|
if ($uuid == 'last') {
|
||||||
$selectedShop = $shopService->getSelectedShop();
|
$selectedShop = $shopService->getSelectedShop();
|
||||||
/** @var Order $order */
|
/** @var Order $order */
|
||||||
$order = $entityManager
|
$order = $entityManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Order')
|
->getRepository('PSC\Shop\EntityBundle\Entity\Order')
|
||||||
->createQueryBuilder('orders')
|
->createQueryBuilder('orders')
|
||||||
@ -120,14 +113,14 @@ class PrintController extends AbstractController
|
|||||||
->orderBy('orders.uid', 'DESC')
|
->orderBy('orders.uid', 'DESC')
|
||||||
->getQuery()->getSingleResult();
|
->getQuery()->getSingleResult();
|
||||||
} else {
|
} else {
|
||||||
/** @var Order $order */
|
/** @var Order $order */
|
||||||
$order = $entityManager
|
$order = $entityManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Order')
|
->getRepository('PSC\Shop\EntityBundle\Entity\Order')
|
||||||
->findOneBy(array('uuid' => $uuid));
|
->findOneBy(array('uuid' => $uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = "";
|
$content = "";
|
||||||
/** @var Orderpos $position */
|
/** @var Orderpos $position */
|
||||||
foreach ($order->getPositions() as $position) {
|
foreach ($order->getPositions() as $position) {
|
||||||
if ($position->getUuid() == $posuuid) {
|
if ($position->getUuid() == $posuuid) {
|
||||||
$content = $printingService->generatePosition($position, $type);
|
$content = $printingService->generatePosition($position, $type);
|
||||||
@ -140,7 +133,7 @@ class PrintController extends AbstractController
|
|||||||
|
|
||||||
$response = new StreamedResponse(function () use ($content) {
|
$response = new StreamedResponse(function () use ($content) {
|
||||||
|
|
||||||
echo $content;
|
echo $content;
|
||||||
});
|
});
|
||||||
$response->headers->set('Content-Type', 'application/pdf');
|
$response->headers->set('Content-Type', 'application/pdf');
|
||||||
$response->headers->set('Cache-Control', '');
|
$response->headers->set('Cache-Control', '');
|
||||||
@ -148,35 +141,35 @@ class PrintController extends AbstractController
|
|||||||
$response->headers->set('Last-Modified', gmdate('D, d M Y H:i:s'));
|
$response->headers->set('Last-Modified', gmdate('D, d M Y H:i:s'));
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case Printing::INVOICE:
|
case Printing::INVOICE:
|
||||||
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'invoice_' . $order->getAlias() . '.pdf');
|
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'invoice_' . $order->getAlias() . '.pdf');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Printing::DELIVERY:
|
case Printing::DELIVERY:
|
||||||
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'delivery_' . $order->getAlias() . '.pdf');
|
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'delivery_' . $order->getAlias() . '.pdf');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Printing::LABEL:
|
case Printing::LABEL:
|
||||||
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'label_' . $order->getAlias() . '.pdf');
|
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'label_' . $order->getAlias() . '.pdf');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Printing::ORDER:
|
case Printing::ORDER:
|
||||||
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'order_' . $order->getAlias() . '.pdf');
|
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'order_' . $order->getAlias() . '.pdf');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Printing::OFFER:
|
case Printing::OFFER:
|
||||||
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'offer_' . $order->getAlias() . '.pdf');
|
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'offer_' . $order->getAlias() . '.pdf');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Printing::STORNO:
|
case Printing::STORNO:
|
||||||
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'storno_' . $order->getAlias() . '.pdf');
|
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'storno_' . $order->getAlias() . '.pdf');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Printing::JOBTICKET:
|
case Printing::JOBTICKET:
|
||||||
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'jobticket_' . $order->getAlias() . '.pdf');
|
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'jobticket_' . $order->getAlias() . '.pdf');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Printing::JOBTICKET_PRINTPARTNER:
|
case Printing::JOBTICKET_PRINTPARTNER:
|
||||||
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'jobticket_pp_' . $order->getAlias() . '.pdf');
|
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'jobticket_pp_' . $order->getAlias() . '.pdf');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -186,4 +179,46 @@ class PrintController extends AbstractController
|
|||||||
$response->prepare($request);
|
$response->prepare($request);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route(path: '/detail/xrechnung/{uuid}', name: 'psc_shop_order_backend_detail_xrechnung')]
|
||||||
|
#[Template]
|
||||||
|
public function xrechnung(
|
||||||
|
Request $request,
|
||||||
|
Printing $printingService,
|
||||||
|
\PSC\System\SettingsBundle\Service\Shop $shopService,
|
||||||
|
EntityManagerInterface $entityManager,
|
||||||
|
$uuid = ""
|
||||||
|
) {
|
||||||
|
|
||||||
|
if ($uuid == 'last') {
|
||||||
|
$selectedShop = $shopService->getSelectedShop();
|
||||||
|
/** @var Order $order */
|
||||||
|
$order = $entityManager
|
||||||
|
->getRepository('PSC\Shop\EntityBundle\Entity\Order')
|
||||||
|
->createQueryBuilder('orders')
|
||||||
|
->andWhere('orders.shop = :shop_id')
|
||||||
|
->setParameter("shop_id", $selectedShop->getUid())
|
||||||
|
->setMaxResults(1)
|
||||||
|
->orderBy('orders.uid', 'DESC')
|
||||||
|
->getQuery()->getSingleResult();
|
||||||
|
} else {
|
||||||
|
/** @var Order $order */
|
||||||
|
$order = $entityManager
|
||||||
|
->getRepository('PSC\Shop\EntityBundle\Entity\Order')
|
||||||
|
->findOneBy(array('uuid' => $uuid));
|
||||||
|
}
|
||||||
|
$content = $printingService->generateXRechnung($order);
|
||||||
|
$response = new StreamedResponse(function () use ($content) {
|
||||||
|
|
||||||
|
echo $content;
|
||||||
|
});
|
||||||
|
$response->headers->set('Content-Type', 'application/xml');
|
||||||
|
$response->headers->set('Cache-Control', '');
|
||||||
|
$response->headers->set('Content-Length', strlen($content));
|
||||||
|
$response->headers->set('Last-Modified', gmdate('D, d M Y H:i:s'));
|
||||||
|
$contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, "xrechnung.xml");
|
||||||
|
$response->headers->set('Content-Disposition', $contentDisposition);
|
||||||
|
$response->prepare($request);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,7 @@ span.row {
|
|||||||
{% if shop.docLabelJasperXml != "" %}<a target="_blank" href="{{ path('psc_shop_order_backend_detail_print', { uuid: order.uuid, type: 3}) }}" class="btn btn-default btn-sm"><i class="fa fa-cloud-download"></i> {{'labels'|trans}}</a>{% endif %}
|
{% if shop.docLabelJasperXml != "" %}<a target="_blank" href="{{ path('psc_shop_order_backend_detail_print', { uuid: order.uuid, type: 3}) }}" class="btn btn-default btn-sm"><i class="fa fa-cloud-download"></i> {{'labels'|trans}}</a>{% endif %}
|
||||||
{% if shop.docJobticketJasperXml != "" %}<a target="_blank" href="{{ path('psc_shop_order_backend_detail_print', { uuid: order.uuid, type: 7}) }}" class="btn btn-default btn-sm"><i class="fa fa-cloud-download"></i> {{'jobticket'|trans}}</a>{% endif %}
|
{% if shop.docJobticketJasperXml != "" %}<a target="_blank" href="{{ path('psc_shop_order_backend_detail_print', { uuid: order.uuid, type: 7}) }}" class="btn btn-default btn-sm"><i class="fa fa-cloud-download"></i> {{'jobticket'|trans}}</a>{% endif %}
|
||||||
{% if shop.docStornoJasperXml != "" %}<a target="_blank" href="{{ path('psc_shop_order_backend_detail_print', { uuid: order.uuid, type: 6}) }}" class="btn btn-default btn-sm"><i class="fa fa-cloud-download"></i> {{'cancel'|trans}}</a>{% endif %}
|
{% if shop.docStornoJasperXml != "" %}<a target="_blank" href="{{ path('psc_shop_order_backend_detail_print', { uuid: order.uuid, type: 6}) }}" class="btn btn-default btn-sm"><i class="fa fa-cloud-download"></i> {{'cancel'|trans}}</a>{% endif %}
|
||||||
|
<a target="_blank" href="{{ path('psc_shop_order_backend_detail_xrechnung', { uuid: order.uuid}) }}" class="btn btn-default btn-sm"><i class="fa fa-cloud-download"></i> {{'XRechnung'|trans}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="panel">
|
<!--<div class="panel">
|
||||||
@ -493,7 +494,7 @@ span.row {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for pos in positions %}
|
{% for pos in positions %}
|
||||||
<tr>
|
{% set posModel = orderModel.getPositionByUuid(pos.obj.uuid) %} <tr>
|
||||||
<td>{{ pos.obj.pos }}</td>
|
<td>{{ pos.obj.pos }}</td>
|
||||||
|
|
||||||
<td><a href="{{ path('backend_production_product_edit', {uuid: pos.obj.product.uuid}) }}">{{ pos.obj.product.title }}</a><br/>ArtNr intern: {{ pos.obj.product.nrIntern }}<br/>{{ 'weight'|trans }}: {{pos.obj.weight }}</td>
|
<td><a href="{{ path('backend_production_product_edit', {uuid: pos.obj.product.uuid}) }}">{{ pos.obj.product.title }}</a><br/>ArtNr intern: {{ pos.obj.product.nrIntern }}<br/>{{ 'weight'|trans }}: {{pos.obj.weight }}</td>
|
||||||
@ -540,6 +541,15 @@ span.row {
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
{% for customSection in customPositionDetailSections %}
|
||||||
|
{% if customSection.getController %}
|
||||||
|
{{ render(controller(
|
||||||
|
customSection.getController,
|
||||||
|
{'order': orderModel, 'position': posModel}
|
||||||
|
)) }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td colspan="5"><div class="row"><div class="col-6">{{ form_start(pos.formProd) }}{{ form_widget(pos.formProd.printPartnerEmail) }}{{ form_rest(pos.formProd) }}</div><div class="col-6"><button class="btn btn-info btn-sm" type="submit">Printpartner benachrichtigen</button></div>{{ form_end(pos.formProd) }}<br /><br /><div class="col-6">{{ form_start(pos.formProdinfo) }}{{ form_widget(pos.formProdinfo.customerInfo) }}{{ form_rest(pos.formProdinfo) }}</div><div class="col-6"><button class="btn btn-info btn-sm" type="submit">Dem Kunden zeigen</button></div>{{ form_end(pos.formProdinfo) }}</td>
|
<td colspan="5"><div class="row"><div class="col-6">{{ form_start(pos.formProd) }}{{ form_widget(pos.formProd.printPartnerEmail) }}{{ form_rest(pos.formProd) }}</div><div class="col-6"><button class="btn btn-info btn-sm" type="submit">Printpartner benachrichtigen</button></div>{{ form_end(pos.formProd) }}<br /><br /><div class="col-6">{{ form_start(pos.formProdinfo) }}{{ form_widget(pos.formProdinfo.customerInfo) }}{{ form_rest(pos.formProdinfo) }}</div><div class="col-6"><button class="btn btn-info btn-sm" type="submit">Dem Kunden zeigen</button></div>{{ form_end(pos.formProdinfo) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -22,7 +22,6 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
|
|||||||
*/
|
*/
|
||||||
class Position extends Base
|
class Position extends Base
|
||||||
{
|
{
|
||||||
|
|
||||||
protected \PSC\Shop\ProductBundle\Service\Product $productService;
|
protected \PSC\Shop\ProductBundle\Service\Product $productService;
|
||||||
private \PSC\Shop\ProductBundle\Hydrate\Product $productHydrate;
|
private \PSC\Shop\ProductBundle\Hydrate\Product $productHydrate;
|
||||||
private ProductType $productTypeRegistry;
|
private ProductType $productTypeRegistry;
|
||||||
@ -44,17 +43,17 @@ class Position extends Base
|
|||||||
$positionEntity->setLayouterMode(0);
|
$positionEntity->setLayouterMode(0);
|
||||||
$positionEntity->setRenderPrint(0);
|
$positionEntity->setRenderPrint(0);
|
||||||
$positionEntity->setCount($position->getPrice()->getCount());
|
$positionEntity->setCount($position->getPrice()->getCount());
|
||||||
$positionEntity->setPriceAllNetto($position->getPrice()->getAllNet()/100);
|
$positionEntity->setPriceAllNetto($position->getPrice()->getAllNet() / 100);
|
||||||
$positionEntity->setPriceOneNetto($position->getPrice()->getNet()/100);
|
$positionEntity->setPriceOneNetto($position->getPrice()->getNet() / 100);
|
||||||
$positionEntity->setPriceAllBrutto($position->getPrice()->getAllGross()/100);
|
$positionEntity->setPriceAllBrutto($position->getPrice()->getAllGross() / 100);
|
||||||
$positionEntity->setPriceOneBrutto($position->getPrice()->getGross()/100);
|
$positionEntity->setPriceOneBrutto($position->getPrice()->getGross() / 100);
|
||||||
$positionEntity->setPriceAllSteuer($position->getPrice()->getAllVat()/100);
|
$positionEntity->setPriceAllSteuer($position->getPrice()->getAllVat() / 100);
|
||||||
$positionEntity->setPriceOneSteuer($position->getPrice()->getVat()/100);
|
$positionEntity->setPriceOneSteuer($position->getPrice()->getVat() / 100);
|
||||||
$positionEntity->setResalePrice(0);
|
$positionEntity->setResalePrice(0);
|
||||||
$positionEntity->setBasketField1((string)$position->getBasketField1());
|
$positionEntity->setBasketField1((string)$position->getBasketField1());
|
||||||
$positionEntity->setBasketField2((string)$position->getBasketField2());
|
$positionEntity->setBasketField2((string)$position->getBasketField2());
|
||||||
|
|
||||||
if($position->getProduct()->getUuid()) {
|
if ($position->getProduct()->getUuid()) {
|
||||||
/**
|
/**
|
||||||
* @var Product $product
|
* @var Product $product
|
||||||
*/
|
*/
|
||||||
@ -73,9 +72,9 @@ class Position extends Base
|
|||||||
*/
|
*/
|
||||||
$temp = [];
|
$temp = [];
|
||||||
foreach ($position->getAdditionalInfos() as $key => $info) {
|
foreach ($position->getAdditionalInfos() as $key => $info) {
|
||||||
if(is_object($info) && method_exists($info, 'asArray')) {
|
if (is_object($info) && method_exists($info, 'asArray')) {
|
||||||
$temp[] = $info->asArray();
|
$temp[] = $info->asArray();
|
||||||
}else{
|
} else {
|
||||||
$temp[$key] = $info;
|
$temp[$key] = $info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,15 +100,15 @@ class Position extends Base
|
|||||||
{
|
{
|
||||||
$position->setProduct(new \PSC\Shop\ProductBundle\Model\Product());
|
$position->setProduct(new \PSC\Shop\ProductBundle\Model\Product());
|
||||||
|
|
||||||
if($pos->getProduct()) {
|
if ($pos->getProduct()) {
|
||||||
|
|
||||||
$position->setProduct($this->productHydrate->hydrateToModel($pos->getProduct()));
|
$position->setProduct($this->productHydrate->hydrateToModel($pos->getProduct()));
|
||||||
$tax = new Tax();
|
$tax = new Tax();
|
||||||
$tax->setName((int)$pos->getProduct()->getMwert()*100);
|
$tax->setName((int)$pos->getProduct()->getMwert() * 100);
|
||||||
$tax->setValue((int)$pos->getProduct()->getMwert()*100);
|
$tax->setValue((int)$pos->getProduct()->getMwert() * 100);
|
||||||
$position->getPrice()->setTax($tax);
|
$position->getPrice()->setTax($tax);
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
$tax = new Tax();
|
$tax = new Tax();
|
||||||
$position->getPrice()->setTax($tax);
|
$position->getPrice()->setTax($tax);
|
||||||
|
|
||||||
@ -119,12 +118,12 @@ class Position extends Base
|
|||||||
$position->setUuid($pos->getUuid());
|
$position->setUuid($pos->getUuid());
|
||||||
$position->setUid($pos->getId());
|
$position->setUid($pos->getId());
|
||||||
$position->getPrice()->setCount($pos->getCount());
|
$position->getPrice()->setCount($pos->getCount());
|
||||||
$position->getPrice()->setNet($pos->getPriceOneNetto()*100);
|
$position->getPrice()->setNet($pos->getPriceOneNetto() * 100);
|
||||||
$position->getPrice()->setAllNet($pos->getPriceAllNetto()*100);
|
$position->getPrice()->setAllNet($pos->getPriceAllNetto() * 100);
|
||||||
$position->getPrice()->setVat($pos->getPriceOneSteuer()*100);
|
$position->getPrice()->setVat($pos->getPriceOneSteuer() * 100);
|
||||||
$position->getPrice()->setAllVat($pos->getPriceAllSteuer()*100);
|
$position->getPrice()->setAllVat($pos->getPriceAllSteuer() * 100);
|
||||||
$position->getPrice()->setGross($pos->getPriceOneBrutto()*100);
|
$position->getPrice()->setGross($pos->getPriceOneBrutto() * 100);
|
||||||
$position->getPrice()->setAllGross($pos->getPriceAllBrutto()*100);
|
$position->getPrice()->setAllGross($pos->getPriceAllBrutto() * 100);
|
||||||
|
|
||||||
|
|
||||||
$position->setStatus($pos->getStatus());
|
$position->setStatus($pos->getStatus());
|
||||||
@ -139,7 +138,7 @@ class Position extends Base
|
|||||||
/**
|
/**
|
||||||
* @var \PSC\Shop\EntityBundle\Document\Tracking $tracking
|
* @var \PSC\Shop\EntityBundle\Document\Tracking $tracking
|
||||||
*/
|
*/
|
||||||
foreach($positionDoc->getTrackings() as $tracking) {
|
foreach ($positionDoc->getTrackings() as $tracking) {
|
||||||
$tr = new Tracking();
|
$tr = new Tracking();
|
||||||
$tr->setShippingProvider($tracking->getShippingProvider());
|
$tr->setShippingProvider($tracking->getShippingProvider());
|
||||||
$tr->setTrackingNumber($tracking->getTrackingNumber());
|
$tr->setTrackingNumber($tracking->getTrackingNumber());
|
||||||
@ -167,22 +166,19 @@ class Position extends Base
|
|||||||
if ($positionDoc->getExternalOrderNumber()) {
|
if ($positionDoc->getExternalOrderNumber()) {
|
||||||
$position->setExternalOrderNumber($positionDoc->getExternalOrderNumber());
|
$position->setExternalOrderNumber($positionDoc->getExternalOrderNumber());
|
||||||
}
|
}
|
||||||
if(is_array($positionDoc->getAdditionalInfos())) {
|
if (is_array($positionDoc->getAdditionalInfos())) {
|
||||||
$position->setAdditionalInfos($positionDoc->getAdditionalInfos());
|
$position->setAdditionalInfos($positionDoc->getAdditionalInfos());
|
||||||
}
|
}
|
||||||
$position->setCustomerInfo((string)$positionDoc->getCustomerInfo());
|
$position->setCustomerInfo((string)$positionDoc->getCustomerInfo());
|
||||||
|
|
||||||
/**
|
if ($pos->getProduct()) {
|
||||||
* Plugin Special Settings
|
|
||||||
*/
|
|
||||||
if($pos->getProduct()) {
|
|
||||||
if ($this->productTypeRegistry->getProductType($pos->getProduct()->getType())) {
|
if ($this->productTypeRegistry->getProductType($pos->getProduct()->getType())) {
|
||||||
$specialProductTransformer = $this->productTypeRegistry->getProductType($pos->getProduct()->getType())->getPositionProductTransformer();
|
$specialProductTransformer = $this->productTypeRegistry->getProductType($pos->getProduct()->getType())->getPositionProductTransformer();
|
||||||
$specialProductTransformer->fromDb($position, $pos, $positionDoc);
|
$specialProductTransformer->fromDb($position, $pos, $positionDoc);
|
||||||
} else {
|
} else {
|
||||||
$position->getProduct()->setSpecialProductTypeObject(new DummyProductTypeObject());
|
$position->getProduct()->setSpecialProductTypeObject(new DummyProductTypeObject());
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if ($this->productTypeRegistry->getProductType($pos->getTyp())) {
|
if ($this->productTypeRegistry->getProductType($pos->getTyp())) {
|
||||||
$specialProductTransformer = $this->productTypeRegistry->getProductType($pos->getTyp())->getPositionProductTransformer();
|
$specialProductTransformer = $this->productTypeRegistry->getProductType($pos->getTyp())->getPositionProductTransformer();
|
||||||
$specialProductTransformer->fromDb($position, $pos, $positionDoc);
|
$specialProductTransformer->fromDb($position, $pos, $positionDoc);
|
||||||
|
|||||||
@ -49,7 +49,7 @@ use Twig\Environment;
|
|||||||
class OfferController extends AbstractController
|
class OfferController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route(path: '/{uuid}', name: 'psc_shop_product_offer_print')]
|
#[Route(path: '/{uuid}', name: 'psc_shop_product_offer_print')]
|
||||||
public function printAction(Request $request, Printing $printingService, Shop $shopService ,EntityManagerInterface $entityManager, Environment $twig, TemplateVars $templateVars, $uuid)
|
public function printAction(Request $request, Printing $printingService, Shop $shopService, EntityManagerInterface $entityManager, Environment $twig, TemplateVars $templateVars, $uuid)
|
||||||
{
|
{
|
||||||
require_once(__DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Item.php');
|
require_once(__DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Item.php');
|
||||||
$options = array();
|
$options = array();
|
||||||
@ -60,9 +60,10 @@ class OfferController extends AbstractController
|
|||||||
$brutto = 0;
|
$brutto = 0;
|
||||||
$xmlProduct = "";
|
$xmlProduct = "";
|
||||||
if (isset($_SESSION['Basket']['TempProduct'][$uuid])) {
|
if (isset($_SESSION['Basket']['TempProduct'][$uuid])) {
|
||||||
/** @var \TP_Basket_Item $basketItem */
|
/** @var \TP_Basket_Item $basketItem */
|
||||||
$basketItem = unserialize(serialize($_SESSION['Basket']['TempProduct'][$uuid]));
|
$basketItem = unserialize(serialize($_SESSION['Basket']['TempProduct'][$uuid]));
|
||||||
$options = $basketItem->getOptions();
|
$options = $basketItem->getOptions();
|
||||||
|
$additionalInfos = $basketItem->getAdditionalInfos();
|
||||||
$count = $basketItem->getCount();
|
$count = $basketItem->getCount();
|
||||||
$netto = $basketItem->getNetto();
|
$netto = $basketItem->getNetto();
|
||||||
$steuer = $basketItem->getSteuer();
|
$steuer = $basketItem->getSteuer();
|
||||||
@ -75,11 +76,10 @@ class OfferController extends AbstractController
|
|||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||||
->findOneBy(array('uuid' => $uuid));
|
->findOneBy(array('uuid' => $uuid));
|
||||||
|
|
||||||
|
$content = $printingService->generateProductOffer($product, $this->getUser() ?? new Contact(), $count, $options, $additionalInfos, $netto, $steuer, $brutto, $xmlProduct);
|
||||||
$content = $printingService->generateProductOffer($product, $this->getUser() ?? new Contact(), $count, $options, $netto, $steuer, $brutto, $xmlProduct);
|
|
||||||
$response = new StreamedResponse(function () use ($content) {
|
$response = new StreamedResponse(function () use ($content) {
|
||||||
|
|
||||||
echo $content;
|
echo $content;
|
||||||
});
|
});
|
||||||
|
|
||||||
/** @var \PSC\Shop\EntityBundle\Document\Shop $shopDoc */
|
/** @var \PSC\Shop\EntityBundle\Document\Shop $shopDoc */
|
||||||
@ -87,8 +87,8 @@ class OfferController extends AbstractController
|
|||||||
if($shopDoc->getDocOfferProductFileName() != "") {
|
if($shopDoc->getDocOfferProductFileName() != "") {
|
||||||
|
|
||||||
$twig = $twig->createTemplate($shopDoc->getDocOfferProductFileName());
|
$twig = $twig->createTemplate($shopDoc->getDocOfferProductFileName());
|
||||||
$filename = $twig->render($templateVars->getProductTwigVars($product, $this->getUser() ?? new Contact(), $count, $options, $netto, $steuer, $brutto, $xmlProduct));
|
$filename = $twig->render($templateVars->getProductTwigVars($product, $this->getUser() ?? new Contact(), $count, $options, $additionalInfos, $netto, $steuer, $brutto, $xmlProduct));
|
||||||
}else{
|
} else {
|
||||||
$filename = 'offer_' . date('Y-m-d') . '.pdf';
|
$filename = 'offer_' . date('Y-m-d') . '.pdf';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,114 +13,116 @@ class Package
|
|||||||
*/
|
*/
|
||||||
#[Field(type: 'int')]
|
#[Field(type: 'int')]
|
||||||
protected $mode;
|
protected $mode;
|
||||||
/**
|
/**
|
||||||
* @var string $orderPath
|
* @var string $orderPath
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $orderPath;
|
protected $orderPath;
|
||||||
/**
|
/**
|
||||||
* @var string $designerPath
|
* @var string $designerPath
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $designerPath;
|
protected $designerPath;
|
||||||
/**
|
/**
|
||||||
* @var string $posPath
|
* @var string $posPath
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $posPath;
|
protected $posPath;
|
||||||
/**
|
/**
|
||||||
* @var array $orderFiles
|
* @var array $orderFiles
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'collection')]
|
#[Field(type: 'collection')]
|
||||||
protected $orderFiles;
|
protected $orderFiles;
|
||||||
/**
|
/**
|
||||||
* @var array $posFiles
|
* @var array $posFiles
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'collection')]
|
#[Field(type: 'collection')]
|
||||||
protected $posFiles;
|
protected $posFiles;
|
||||||
/**
|
/**
|
||||||
* @var boolean $orderJobticket
|
* @var boolean $orderJobticket
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $orderJobticket;
|
protected $orderJobticket;
|
||||||
/**
|
/**
|
||||||
* @var boolean $orderInvoice
|
* @var boolean $orderInvoice
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $orderInvoice;
|
protected $orderInvoice;
|
||||||
/**
|
/**
|
||||||
* @var boolean $orderDelivery
|
* @var boolean $orderDelivery
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $orderDelivery;
|
protected $orderDelivery;
|
||||||
/**
|
/**
|
||||||
* @var boolean $orderOrder
|
* @var boolean $orderOrder
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $orderOrder;
|
protected $orderOrder;
|
||||||
/**
|
#[Field(type: 'bool')]
|
||||||
* @var boolean $orderStorno
|
protected $orderInvoiceXML = false;
|
||||||
*/
|
/**
|
||||||
|
* @var boolean $orderStorno
|
||||||
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $orderStorno;
|
protected $orderStorno;
|
||||||
/**
|
/**
|
||||||
* @var boolean $orderLabel
|
* @var boolean $orderLabel
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $orderLabel;
|
protected $orderLabel;
|
||||||
/**
|
/**
|
||||||
* @var boolean $orderOffer
|
* @var boolean $orderOffer
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $orderOffer;
|
protected $orderOffer;
|
||||||
/**
|
/**
|
||||||
* @var boolean $orderJobticketPP
|
* @var boolean $orderJobticketPP
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $orderJobticketPP;
|
protected $orderJobticketPP;
|
||||||
/**
|
/**
|
||||||
* @var boolean $posJobticket
|
* @var boolean $posJobticket
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $posJobticket;
|
protected $posJobticket;
|
||||||
/**
|
/**
|
||||||
* @var boolean $posInvoice
|
* @var boolean $posInvoice
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $posInvoice;
|
protected $posInvoice;
|
||||||
/**
|
/**
|
||||||
* @var boolean $posDelivery
|
* @var boolean $posDelivery
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $posDelivery;
|
protected $posDelivery;
|
||||||
/**
|
/**
|
||||||
* @var boolean $posOrder
|
* @var boolean $posOrder
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $posOrder;
|
protected $posOrder;
|
||||||
/**
|
/**
|
||||||
* @var boolean $posStorno
|
* @var boolean $posStorno
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $posStorno;
|
protected $posStorno;
|
||||||
/**
|
/**
|
||||||
* @var boolean $posLabel
|
* @var boolean $posLabel
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $posLabel;
|
protected $posLabel;
|
||||||
/**
|
/**
|
||||||
* @var boolean $posOffer
|
* @var boolean $posOffer
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $posOffer;
|
protected $posOffer;
|
||||||
/**
|
/**
|
||||||
* @var boolean $posJobticketPP
|
* @var boolean $posJobticketPP
|
||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $posJobticketPP;
|
protected $posJobticketPP;
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getMode()
|
public function getMode()
|
||||||
{
|
{
|
||||||
return $this->mode;
|
return $this->mode;
|
||||||
@ -262,6 +264,17 @@ class Package
|
|||||||
$this->orderOrder = $orderOrder;
|
$this->orderOrder = $orderOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isOrderInvoiceXML(): bool
|
||||||
|
{
|
||||||
|
return (bool)$this->orderInvoiceXML;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setOrderInvoiceXML($orderInvoiceXML): void
|
||||||
|
{
|
||||||
|
$this->orderInvoiceXML = $orderInvoiceXML;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
<div class="col-2">{{ form_widget(form.orderLabel) }}</div>
|
<div class="col-2">{{ form_widget(form.orderLabel) }}</div>
|
||||||
<div class="col-2">{{ form_widget(form.orderOffer) }}</div>
|
<div class="col-2">{{ form_widget(form.orderOffer) }}</div>
|
||||||
<div class="col-2">{{ form_widget(form.orderJobticketPP) }}</div>
|
<div class="col-2">{{ form_widget(form.orderJobticketPP) }}</div>
|
||||||
|
<div class="col-2">{{ form_widget(form.orderInvoiceXML) }}</div>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -143,8 +144,8 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-md-1 form-control-label">{{ form_label(form.designerPath) }}</label>
|
<label class="col-md-4 form-control-label">{{ form_label(form.designerPath) }}</label>
|
||||||
<div class="col-md-11">
|
<div class="col-md-8">
|
||||||
{{ form_widget(form.designerPath) }}
|
{{ form_widget(form.designerPath) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -53,6 +53,7 @@ use Symfony\Component\Mailer\MailerInterface;
|
|||||||
use Symfony\Component\Mime\Email;
|
use Symfony\Component\Mime\Email;
|
||||||
use Symfony\Component\Mime\Message;
|
use Symfony\Component\Mime\Message;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||||
|
|
||||||
class Mail implements QueueInterface, ConfigurableElementInterface
|
class Mail implements QueueInterface, ConfigurableElementInterface
|
||||||
{
|
{
|
||||||
/** @var Form */
|
/** @var Form */
|
||||||
@ -64,11 +65,11 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
protected $_templateVars = null;
|
protected $_templateVars = null;
|
||||||
protected $_template = null;
|
protected $_template = null;
|
||||||
protected $_error = null;
|
protected $_error = null;
|
||||||
/**
|
/**
|
||||||
* @var Log
|
* @var Log
|
||||||
*/
|
*/
|
||||||
protected Log $_logService;
|
protected Log $_logService;
|
||||||
function __construct(TemplateVars $templateVars, Printing $printing, FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, DocumentManager $doctrine_mongodb, MailerInterface $mailer, \Twig\Environment $template, Log $logService)
|
public function __construct(TemplateVars $templateVars, Printing $printing, FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, DocumentManager $doctrine_mongodb, MailerInterface $mailer, \Twig\Environment $template, Log $logService)
|
||||||
{
|
{
|
||||||
$this->_formFactory = $formFactory;
|
$this->_formFactory = $formFactory;
|
||||||
$this->_entityManager = $entityManager;
|
$this->_entityManager = $entityManager;
|
||||||
@ -231,9 +232,9 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
/** @var \PSC\Shop\QueueBundle\Document\Queue\Mail $mailDoc */
|
/** @var \PSC\Shop\QueueBundle\Document\Queue\Mail $mailDoc */
|
||||||
$mailDoc = $queue->getQueueDocument();
|
$mailDoc = $queue->getQueueDocument();
|
||||||
$eventDoc = $queue->getEventDocument();
|
$eventDoc = $queue->getEventDocument();
|
||||||
/** @var TemplateVars $templateVars */
|
/** @var TemplateVars $templateVars */
|
||||||
$templateVars = $this->_templateVars;
|
$templateVars = $this->_templateVars;
|
||||||
/** @var Printing $printing */
|
/** @var Printing $printing */
|
||||||
$printing = $this->_printing;
|
$printing = $this->_printing;
|
||||||
if ($event->isOverwriteQueueHandling()) {
|
if ($event->isOverwriteQueueHandling()) {
|
||||||
try {
|
try {
|
||||||
@ -264,10 +265,10 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
|
|
||||||
if ($event instanceof Lock) {
|
if ($event instanceof Lock) {
|
||||||
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
||||||
/** @var Contact $contact */
|
/** @var Contact $contact */
|
||||||
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
||||||
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
||||||
/** @var Shop $shop */
|
/** @var Shop $shop */
|
||||||
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
||||||
$params = array(
|
$params = array(
|
||||||
'contact' => $contact,
|
'contact' => $contact,
|
||||||
@ -313,14 +314,14 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
if ($event instanceof UnLock || $event instanceof \PSC\Shop\QueueBundle\Event\Contact\Create) {
|
if ($event instanceof UnLock || $event instanceof \PSC\Shop\QueueBundle\Event\Contact\Create) {
|
||||||
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
||||||
/** @var Contact $contact */
|
/** @var Contact $contact */
|
||||||
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
||||||
/** @var \PSC\Shop\EntityBundle\Document\Contact $contactObj */
|
/** @var \PSC\Shop\EntityBundle\Document\Contact $contactObj */
|
||||||
$contactObj = $this->_doctrine_mongodb
|
$contactObj = $this->_doctrine_mongodb
|
||||||
->getRepository('PSC\Shop\EntityBundle\Document\Contact')
|
->getRepository('PSC\Shop\EntityBundle\Document\Contact')
|
||||||
->findOneBy(array('uid' => (string) $contact->getId()));
|
->findOneBy(array('uid' => (string) $contact->getId()));
|
||||||
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
||||||
/** @var Shop $shop */
|
/** @var Shop $shop */
|
||||||
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
||||||
$params = array(
|
$params = array(
|
||||||
'contact' => $contact,
|
'contact' => $contact,
|
||||||
@ -359,10 +360,10 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
if ($event instanceof Start) {
|
if ($event instanceof Start) {
|
||||||
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
||||||
/** @var Contact $contact */
|
/** @var Contact $contact */
|
||||||
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
||||||
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
||||||
/** @var Shop $shop */
|
/** @var Shop $shop */
|
||||||
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
||||||
$contact->setPasswordResetUuid(Uuid::uuid4());
|
$contact->setPasswordResetUuid(Uuid::uuid4());
|
||||||
$contact->setPasswordResetDate(time());
|
$contact->setPasswordResetDate(time());
|
||||||
@ -404,10 +405,10 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
if ($event instanceof Finish) {
|
if ($event instanceof Finish) {
|
||||||
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
||||||
/** @var Contact $contact */
|
/** @var Contact $contact */
|
||||||
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
||||||
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
||||||
/** @var Shop $shop */
|
/** @var Shop $shop */
|
||||||
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
||||||
$password = $this->generatePassword(10);
|
$password = $this->generatePassword(10);
|
||||||
$contact->setPassword(password_hash($password, PASSWORD_DEFAULT));
|
$contact->setPassword(password_hash($password, PASSWORD_DEFAULT));
|
||||||
@ -450,11 +451,11 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
if ($event instanceof Notify) {
|
if ($event instanceof Notify) {
|
||||||
$positionRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos');
|
$positionRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos');
|
||||||
/** @var Orderpos $position */
|
/** @var Orderpos $position */
|
||||||
$position = $positionRepo->findOneBy(array('uuid' => $event->getPosition()));
|
$position = $positionRepo->findOneBy(array('uuid' => $event->getPosition()));
|
||||||
$templateVars->loadOrder($position->getOrder()->getUuid());
|
$templateVars->loadOrder($position->getOrder()->getUuid());
|
||||||
$params = $templateVars->getPosTwigVars($event->getPosition());
|
$params = $templateVars->getPosTwigVars($event->getPosition());
|
||||||
/** @var Position $objDoc */
|
/** @var Position $objDoc */
|
||||||
$objDoc = $this->_doctrine_mongodb
|
$objDoc = $this->_doctrine_mongodb
|
||||||
->getRepository(Position::class)
|
->getRepository(Position::class)
|
||||||
->findOneBy(['uid' => (string)$position->getId()]);
|
->findOneBy(['uid' => (string)$position->getId()]);
|
||||||
@ -498,7 +499,7 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
if ($event instanceof Change) {
|
if ($event instanceof Change) {
|
||||||
$positionRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos');
|
$positionRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos');
|
||||||
/** @var Orderpos $position */
|
/** @var Orderpos $position */
|
||||||
$position = $positionRepo->findOneBy(array('uuid' => $event->getPosition()));
|
$position = $positionRepo->findOneBy(array('uuid' => $event->getPosition()));
|
||||||
$templateVars->loadOrder($position->getOrder()->getUuid());
|
$templateVars->loadOrder($position->getOrder()->getUuid());
|
||||||
try {
|
try {
|
||||||
@ -669,8 +670,10 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
|
|
||||||
if ($mailDoc->isSendInvoice()) {
|
if ($mailDoc->isSendInvoice()) {
|
||||||
$content = $printing->generateOrder($templateVars->getOrder(), Printing::INVOICE);
|
$content = $printing->generateOrder($templateVars->getOrder(), Printing::INVOICE);
|
||||||
|
$contentXRechnung = $printing->generateXRechnung($templateVars->getOrder());
|
||||||
if ($content) {
|
if ($content) {
|
||||||
$message->attach($content, $printing->getFileName(), 'application/pdf');
|
$message->attach($content, $printing->getFileName(), 'application/pdf');
|
||||||
|
$message->attach($contentXRechnung, "xrechnung.xml", 'application/pdf');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,8 +714,10 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
|
|
||||||
if ($mailDoc->isSendStorno()) {
|
if ($mailDoc->isSendStorno()) {
|
||||||
$content = $printing->generateOrder($templateVars->getOrder(), Printing::STORNO);
|
$content = $printing->generateOrder($templateVars->getOrder(), Printing::STORNO);
|
||||||
|
$contentXRechnung = $printing->generateXRechnung($templateVars->getOrder());
|
||||||
if ($content) {
|
if ($content) {
|
||||||
$message->attach($content, $printing->getFileName(), 'application/pdf');
|
$message->attach($content, $printing->getFileName(), 'application/pdf');
|
||||||
|
$message->attach($contentXRechnung, "xstorno.xml", 'application/pdf');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($mailDoc->getFiles() as $file) {
|
foreach ($mailDoc->getFiles() as $file) {
|
||||||
@ -739,7 +744,7 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ($event instanceof \Plugin\System\PSC\Upload\Event\Create) {
|
if ($event instanceof \Plugin\System\PSC\Upload\Event\Create) {
|
||||||
/** @var Upload $upload */
|
/** @var Upload $upload */
|
||||||
$upload = $this->_doctrine_mongodb
|
$upload = $this->_doctrine_mongodb
|
||||||
->getRepository(Upload::class)
|
->getRepository(Upload::class)
|
||||||
->findOneBy(['id' => new ObjectId($event->getUpload())]);
|
->findOneBy(['id' => new ObjectId($event->getUpload())]);
|
||||||
@ -785,10 +790,10 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
if ($event instanceof StockMin || $event instanceof BuyMax) {
|
if ($event instanceof StockMin || $event instanceof BuyMax) {
|
||||||
$productRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Product');
|
$productRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Product');
|
||||||
/** @var Product $product */
|
/** @var Product $product */
|
||||||
$product = $productRepo->findOneBy(array('uuid' => $event->getProduct()));
|
$product = $productRepo->findOneBy(array('uuid' => $event->getProduct()));
|
||||||
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
$shopRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop');
|
||||||
/** @var Shop $shop */
|
/** @var Shop $shop */
|
||||||
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
$shop = $shopRepo->findOneBy(array('uid' => $event->getShop()));
|
||||||
$params = array(
|
$params = array(
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
@ -836,7 +841,7 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
$templateVars->loadOrder($event->getOrder());
|
$templateVars->loadOrder($event->getOrder());
|
||||||
$vars = $templateVars->getPosTwigVars($event->getPosition());
|
$vars = $templateVars->getPosTwigVars($event->getPosition());
|
||||||
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
||||||
/** @var Contact $contact */
|
/** @var Contact $contact */
|
||||||
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
||||||
$vars['approvalContact'] = $contact;
|
$vars['approvalContact'] = $contact;
|
||||||
try {
|
try {
|
||||||
@ -937,7 +942,7 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
$templateVars->loadOrder($event->getOrder());
|
$templateVars->loadOrder($event->getOrder());
|
||||||
$vars = $templateVars->getPosTwigVars($event->getPosition());
|
$vars = $templateVars->getPosTwigVars($event->getPosition());
|
||||||
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
$contactRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact');
|
||||||
/** @var Contact $contact */
|
/** @var Contact $contact */
|
||||||
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
$contact = $contactRepo->findOneBy(array('uuid' => $event->getContact()));
|
||||||
$vars['approvalContact'] = $contact;
|
$vars['approvalContact'] = $contact;
|
||||||
$vars['message'] = $event->getMessage();
|
$vars['message'] = $event->getMessage();
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
private $_twig = null;
|
private $_twig = null;
|
||||||
private $_eventManager = null;
|
private $_eventManager = null;
|
||||||
private \PSC\Shop\OrderBundle\Service\Order $_orderService;
|
private \PSC\Shop\OrderBundle\Service\Order $_orderService;
|
||||||
function __construct(Environment $twig, Manager $eventManager, \PSC\System\SettingsBundle\Service\Package $packageService, TemplateVars $templateVars, FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, DocumentManager $doctrine_mongodb, \PSC\Shop\OrderBundle\Service\Order $orderService)
|
public function __construct(Environment $twig, Manager $eventManager, \PSC\System\SettingsBundle\Service\Package $packageService, TemplateVars $templateVars, FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, DocumentManager $doctrine_mongodb, \PSC\Shop\OrderBundle\Service\Order $orderService)
|
||||||
{
|
{
|
||||||
$this->_formFactory = $formFactory;
|
$this->_formFactory = $formFactory;
|
||||||
$this->_entityManager = $entityManager;
|
$this->_entityManager = $entityManager;
|
||||||
@ -98,6 +98,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
));
|
));
|
||||||
$builder->add('orderJobticket', CheckboxType::class, ['required' => false, 'label' => 'Jobticket']);
|
$builder->add('orderJobticket', CheckboxType::class, ['required' => false, 'label' => 'Jobticket']);
|
||||||
$builder->add('orderInvoice', CheckboxType::class, ['required' => false, 'label' => 'Rechnung']);
|
$builder->add('orderInvoice', CheckboxType::class, ['required' => false, 'label' => 'Rechnung']);
|
||||||
|
$builder->add('orderInvoiceXML', CheckboxType::class, ['required' => false, 'label' => 'XRechnung XML anfügen']);
|
||||||
$builder->add('orderDelivery', CheckboxType::class, ['required' => false, 'label' => 'Lieferschein']);
|
$builder->add('orderDelivery', CheckboxType::class, ['required' => false, 'label' => 'Lieferschein']);
|
||||||
$builder->add('orderOrder', CheckboxType::class, ['required' => false, 'label' => 'Auftrag']);
|
$builder->add('orderOrder', CheckboxType::class, ['required' => false, 'label' => 'Auftrag']);
|
||||||
$builder->add('orderStorno', CheckboxType::class, ['required' => false, 'label' => 'Storno']);
|
$builder->add('orderStorno', CheckboxType::class, ['required' => false, 'label' => 'Storno']);
|
||||||
@ -134,10 +135,10 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
));
|
));
|
||||||
if ($new) {
|
if ($new) {
|
||||||
$builder->add("posPath", TextType::class, array('data' => '/data/www/old/data/packages/uploads/{{ order.alias }}_{{ position.pos }}.zip', 'label' => 'Pfad', 'attr' => array('class' => 'form-element')));
|
$builder->add("posPath", TextType::class, array('data' => '/data/www/old/data/packages/uploads/{{ order.alias }}_{{ position.pos }}.zip', 'label' => 'Pfad', 'attr' => array('class' => 'form-element')));
|
||||||
$builder->add("designerPath", TextType::class, array('data' => 'final.pdf', 'label' => 'Layouter Dateiname', 'attr' => array('class' => 'form-element')));
|
$builder->add("designerPath", TextType::class, array('data' => 'final.pdf', 'label' => 'Layouter Dateiname (finish.pdf)', 'attr' => array('class' => 'form-element')));
|
||||||
} else {
|
} else {
|
||||||
$builder->add("posPath", TextType::class, array('label' => 'Pfad', 'attr' => array('class' => 'form-element')));
|
$builder->add("posPath", TextType::class, array('label' => 'Pfad', 'attr' => array('class' => 'form-element')));
|
||||||
$builder->add("designerPath", TextType::class, array('label' => 'Layouter Dateiname', 'attr' => array('class' => 'form-element')));
|
$builder->add("designerPath", TextType::class, array('label' => 'Layouter Dateiname (finish.pdf)', 'attr' => array('class' => 'form-element')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,6 +153,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
$package->setOrderJobticket($form->get('orderJobticket')->getData());
|
$package->setOrderJobticket($form->get('orderJobticket')->getData());
|
||||||
$package->setOrderDelivery($form->get('orderDelivery')->getData());
|
$package->setOrderDelivery($form->get('orderDelivery')->getData());
|
||||||
$package->setOrderInvoice($form->get('orderInvoice')->getData());
|
$package->setOrderInvoice($form->get('orderInvoice')->getData());
|
||||||
|
$package->setOrderInvoiceXML($form->get('orderInvoiceXML')->getData());
|
||||||
$package->setOrderOffer($form->get('orderOffer')->getData());
|
$package->setOrderOffer($form->get('orderOffer')->getData());
|
||||||
$package->setOrderStorno($form->get('orderStorno')->getData());
|
$package->setOrderStorno($form->get('orderStorno')->getData());
|
||||||
$package->setOrderOrder($form->get('orderOrder')->getData());
|
$package->setOrderOrder($form->get('orderOrder')->getData());
|
||||||
@ -189,6 +191,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
$form->get('orderJobticket')->setData($doc->isOrderJobticket());
|
$form->get('orderJobticket')->setData($doc->isOrderJobticket());
|
||||||
$form->get('orderDelivery')->setData($doc->isOrderDelivery());
|
$form->get('orderDelivery')->setData($doc->isOrderDelivery());
|
||||||
$form->get('orderInvoice')->setData($doc->isOrderInvoice());
|
$form->get('orderInvoice')->setData($doc->isOrderInvoice());
|
||||||
|
$form->get('orderInvoiceXML')->setData($doc->isOrderInvoiceXML());
|
||||||
$form->get('orderOffer')->setData($doc->isOrderOffer());
|
$form->get('orderOffer')->setData($doc->isOrderOffer());
|
||||||
$form->get('orderStorno')->setData($doc->isOrderStorno());
|
$form->get('orderStorno')->setData($doc->isOrderStorno());
|
||||||
$form->get('orderOrder')->setData($doc->isOrderOrder());
|
$form->get('orderOrder')->setData($doc->isOrderOrder());
|
||||||
@ -213,13 +216,13 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
|
|
||||||
/** @var \PSC\System\SettingsBundle\Service\Package $packageService */
|
/** @var \PSC\System\SettingsBundle\Service\Package $packageService */
|
||||||
$packageService = $this->_packageService;
|
$packageService = $this->_packageService;
|
||||||
/** @var \PSC\System\SettingsBundle\Service\TemplateVars $templateVars */
|
/** @var \PSC\System\SettingsBundle\Service\TemplateVars $templateVars */
|
||||||
$templateVars = $this->_templateVars;
|
$templateVars = $this->_templateVars;
|
||||||
/** @var \PSC\Shop\OrderBundle\Model\Order $orderObj */
|
/** @var \PSC\Shop\OrderBundle\Model\Order $orderObj */
|
||||||
$orderObj = $this->_orderService->getOrderByUuid($event->getOrder());
|
$orderObj = $this->_orderService->getOrderByUuid($event->getOrder());
|
||||||
$this->_packageService->setOrderObj($orderObj);
|
$this->_packageService->setOrderObj($orderObj);
|
||||||
if ($event instanceof Download) {
|
if ($event instanceof Download) {
|
||||||
/** @var \PSC\Shop\QueueBundle\Document\Queue\Package $queueSettings */
|
/** @var \PSC\Shop\QueueBundle\Document\Queue\Package $queueSettings */
|
||||||
$queueSettings = $packageDoc->getQueueDocument();
|
$queueSettings = $packageDoc->getQueueDocument();
|
||||||
$templateVars->loadOrder($event->getOrder());
|
$templateVars->loadOrder($event->getOrder());
|
||||||
if ($queueSettings->getMode() == 0) {
|
if ($queueSettings->getMode() == 0) {
|
||||||
@ -251,6 +254,9 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
if ($queueSettings->isOrderStorno()) {
|
if ($queueSettings->isOrderStorno()) {
|
||||||
$packageService->addOrderDocument(Printing::STORNO);
|
$packageService->addOrderDocument(Printing::STORNO);
|
||||||
}
|
}
|
||||||
|
if ($queueSettings->isOrderInvoiceXML()) {
|
||||||
|
$packageService->addXRechnung();
|
||||||
|
}
|
||||||
$packageService->addPluginFilesToOrderPackage();
|
$packageService->addPluginFilesToOrderPackage();
|
||||||
foreach ($queueSettings->getOrderFiles() as $file) {
|
foreach ($queueSettings->getOrderFiles() as $file) {
|
||||||
if ($file['name'] != "" && $file['content'] != "") {
|
if ($file['name'] != "" && $file['content'] != "") {
|
||||||
@ -346,6 +352,9 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
if ($queueSettings->isOrderStorno()) {
|
if ($queueSettings->isOrderStorno()) {
|
||||||
$packageService->addOrderDocument(Printing::STORNO);
|
$packageService->addOrderDocument(Printing::STORNO);
|
||||||
}
|
}
|
||||||
|
if ($queueSettings->isOrderInvoiceXML()) {
|
||||||
|
$packageService->addXRechnung();
|
||||||
|
}
|
||||||
|
|
||||||
$packageService->addPluginFilesToOrderPackage();
|
$packageService->addPluginFilesToOrderPackage();
|
||||||
foreach ($queueSettings->getOrderFiles() as $file) {
|
foreach ($queueSettings->getOrderFiles() as $file) {
|
||||||
@ -358,7 +367,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var Orderpos $pos */
|
/** @var Orderpos $pos */
|
||||||
foreach ($templateVars->getOrder()->getPositions() as $pos) {
|
foreach ($templateVars->getOrder()->getPositions() as $pos) {
|
||||||
$orderPosPath = $this->_twig->createTemplate($queueSettings->getPosPath());
|
$orderPosPath = $this->_twig->createTemplate($queueSettings->getPosPath());
|
||||||
$orderPosPath = $orderPosPath->render($templateVars->getPosTwigVars($pos->getUuid()));
|
$orderPosPath = $orderPosPath->render($templateVars->getPosTwigVars($pos->getUuid()));
|
||||||
@ -439,6 +448,9 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
if ($queueSettings->isOrderStorno()) {
|
if ($queueSettings->isOrderStorno()) {
|
||||||
$packageService->addOrderDocument(Printing::STORNO);
|
$packageService->addOrderDocument(Printing::STORNO);
|
||||||
}
|
}
|
||||||
|
if ($queueSettings->isOrderInvoiceXML()) {
|
||||||
|
$packageService->addXRechnung();
|
||||||
|
}
|
||||||
|
|
||||||
$packageService->addPluginFilesToOrderPackage();
|
$packageService->addPluginFilesToOrderPackage();
|
||||||
foreach ($queueSettings->getOrderFiles() as $file) {
|
foreach ($queueSettings->getOrderFiles() as $file) {
|
||||||
@ -466,10 +478,10 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if ($event instanceof Create || $event instanceof \PSC\Shop\QueueBundle\Event\Order\Status\Change || $event instanceof \PSC\Shop\QueueBundle\Event\Package\Create) {
|
if ($event instanceof Create || $event instanceof \PSC\Shop\QueueBundle\Event\Order\Status\Change || $event instanceof \PSC\Shop\QueueBundle\Event\Package\Create) {
|
||||||
/** @var \PSC\Shop\QueueBundle\Document\Queue\Package $queueSettings */
|
/** @var \PSC\Shop\QueueBundle\Document\Queue\Package $queueSettings */
|
||||||
$queueSettings = $packageDoc->getQueueDocument();
|
$queueSettings = $packageDoc->getQueueDocument();
|
||||||
$templateVars->loadOrder($event->getOrder());
|
$templateVars->loadOrder($event->getOrder());
|
||||||
/** @var \PSC\Shop\EntityBundle\Document\Order $orderObj */
|
/** @var \PSC\Shop\EntityBundle\Document\Order $orderObj */
|
||||||
$orderObj = $this->_doctrine_mongodb
|
$orderObj = $this->_doctrine_mongodb
|
||||||
->getRepository('PSC\Shop\EntityBundle\Document\Order')
|
->getRepository('PSC\Shop\EntityBundle\Document\Order')
|
||||||
->findOneBy(array('uid' => (string)$templateVars->getOrder()->getUid()));
|
->findOneBy(array('uid' => (string)$templateVars->getOrder()->getUid()));
|
||||||
@ -479,7 +491,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
$packageService->createPackage($orderPath);
|
$packageService->createPackage($orderPath);
|
||||||
$packageService->setOrder($templateVars->getOrder());
|
$packageService->setOrder($templateVars->getOrder());
|
||||||
if ($queueSettings->isOrderInvoice()) {
|
if ($queueSettings->isOrderInvoice()) {
|
||||||
$packageService->addOrderDocument(Printing::INVOICE);
|
$packageService->addOrderDocument(Printing::INVOICE);
|
||||||
}
|
}
|
||||||
if ($queueSettings->isOrderJobticket()) {
|
if ($queueSettings->isOrderJobticket()) {
|
||||||
$packageService->addOrderDocument(Printing::JOBTICKET);
|
$packageService->addOrderDocument(Printing::JOBTICKET);
|
||||||
@ -502,6 +514,9 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
if ($queueSettings->isOrderStorno()) {
|
if ($queueSettings->isOrderStorno()) {
|
||||||
$packageService->addOrderDocument(Printing::STORNO);
|
$packageService->addOrderDocument(Printing::STORNO);
|
||||||
}
|
}
|
||||||
|
if ($queueSettings->isOrderInvoiceXML()) {
|
||||||
|
$packageService->addXRechnung();
|
||||||
|
}
|
||||||
|
|
||||||
$packageService->addPluginFilesToOrderPackage();
|
$packageService->addPluginFilesToOrderPackage();
|
||||||
foreach ($queueSettings->getOrderFiles() as $file) {
|
foreach ($queueSettings->getOrderFiles() as $file) {
|
||||||
@ -515,7 +530,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$positionParams = $templateVars->getTwigVars();
|
$positionParams = $templateVars->getTwigVars();
|
||||||
/** @var Orderpos $pos */
|
/** @var Orderpos $pos */
|
||||||
foreach ($templateVars->getPositions() as $pos) {
|
foreach ($templateVars->getPositions() as $pos) {
|
||||||
$positionParams['position'] = $pos;
|
$positionParams['position'] = $pos;
|
||||||
$orderPosPath = $this->_twig->createTemplate($queueSettings->getPosPath());
|
$orderPosPath = $this->_twig->createTemplate($queueSettings->getPosPath());
|
||||||
@ -608,6 +623,9 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
if ($queueSettings->isOrderStorno()) {
|
if ($queueSettings->isOrderStorno()) {
|
||||||
$packageService->addOrderDocument(Printing::STORNO);
|
$packageService->addOrderDocument(Printing::STORNO);
|
||||||
}
|
}
|
||||||
|
if ($queueSettings->isOrderInvoiceXML()) {
|
||||||
|
$packageService->addXRechnung();
|
||||||
|
}
|
||||||
|
|
||||||
$packageService->addPluginFilesToOrderPackage();
|
$packageService->addPluginFilesToOrderPackage();
|
||||||
foreach ($queueSettings->getOrderFiles() as $file) {
|
foreach ($queueSettings->getOrderFiles() as $file) {
|
||||||
@ -621,7 +639,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$positionParams = $templateVars->getTwigVars();
|
$positionParams = $templateVars->getTwigVars();
|
||||||
/** @var Orderpos $pos */
|
/** @var Orderpos $pos */
|
||||||
foreach ($templateVars->getPositions() as $pos) {
|
foreach ($templateVars->getPositions() as $pos) {
|
||||||
$positionParams['position'] = $pos;
|
$positionParams['position'] = $pos;
|
||||||
$orderPosPath = $this->_twig->createTemplate($queueSettings->getPosPath());
|
$orderPosPath = $this->_twig->createTemplate($queueSettings->getPosPath());
|
||||||
@ -711,6 +729,9 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
if ($queueSettings->isOrderStorno()) {
|
if ($queueSettings->isOrderStorno()) {
|
||||||
$packageService->addOrderDocument(Printing::STORNO);
|
$packageService->addOrderDocument(Printing::STORNO);
|
||||||
}
|
}
|
||||||
|
if ($queueSettings->isOrderInvoiceXML()) {
|
||||||
|
$packageService->addXRechnung();
|
||||||
|
}
|
||||||
|
|
||||||
$packageService->addPluginFilesToOrderPackage();
|
$packageService->addPluginFilesToOrderPackage();
|
||||||
foreach ($queueSettings->getOrderFiles() as $file) {
|
foreach ($queueSettings->getOrderFiles() as $file) {
|
||||||
@ -736,7 +757,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
if ($queueSettings->getMode() == 3) {
|
if ($queueSettings->getMode() == 3) {
|
||||||
$positionParams = $templateVars->getTwigVars();
|
$positionParams = $templateVars->getTwigVars();
|
||||||
/** @var Orderpos $pos */
|
/** @var Orderpos $pos */
|
||||||
foreach ($templateVars->getPositions() as $pos) {
|
foreach ($templateVars->getPositions() as $pos) {
|
||||||
$positionParams['position'] = $pos;
|
$positionParams['position'] = $pos;
|
||||||
$orderPosPath = $this->_twig->createTemplate($queueSettings->getPosPath());
|
$orderPosPath = $this->_twig->createTemplate($queueSettings->getPosPath());
|
||||||
@ -797,10 +818,10 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ($event instanceof Change) {
|
if ($event instanceof Change) {
|
||||||
/** @var \PSC\Shop\QueueBundle\Document\Queue\Package $queueSettings */
|
/** @var \PSC\Shop\QueueBundle\Document\Queue\Package $queueSettings */
|
||||||
$queueSettings = $packageDoc->getQueueDocument();
|
$queueSettings = $packageDoc->getQueueDocument();
|
||||||
$positionRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos');
|
$positionRepo = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos');
|
||||||
/** @var Orderpos $position */
|
/** @var Orderpos $position */
|
||||||
$position = $positionRepo->findOneBy(array('uuid' => $event->getPosition()));
|
$position = $positionRepo->findOneBy(array('uuid' => $event->getPosition()));
|
||||||
$templateVars->loadOrder($position->getOrder()->getUuid());
|
$templateVars->loadOrder($position->getOrder()->getUuid());
|
||||||
if ($queueSettings->getMode() == 0) {
|
if ($queueSettings->getMode() == 0) {
|
||||||
@ -832,20 +853,23 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
if ($queueSettings->isOrderStorno()) {
|
if ($queueSettings->isOrderStorno()) {
|
||||||
$packageService->addOrderDocument(Printing::STORNO);
|
$packageService->addOrderDocument(Printing::STORNO);
|
||||||
}
|
}
|
||||||
|
if ($queueSettings->isOrderInvoiceXML()) {
|
||||||
|
$packageService->addXRechnung();
|
||||||
|
}
|
||||||
|
|
||||||
$packageService->addPluginFilesToOrderPackage();
|
$packageService->addPluginFilesToOrderPackage();
|
||||||
foreach ($queueSettings->getOrderFiles() as $file) {
|
foreach ($queueSettings->getOrderFiles() as $file) {
|
||||||
if ($file['name'] != "" && $file['content'] != "") {
|
if ($file['name'] != "" && $file['content'] != "") {
|
||||||
$name = $this->_twig->createTemplate($file['name']);
|
$name = $this->_twig->createTemplate($file['name']);
|
||||||
$content = $this->_twig->createTemplate($file['content']);
|
$content = $this->_twig->createTemplate($file['content']);
|
||||||
$name = $name->render($templateVars->getTwigVars());
|
$name = $name->render($templateVars->getTwigVars());
|
||||||
$content = $content->render($templateVars->getTwigVars());
|
$content = $content->render($templateVars->getTwigVars());
|
||||||
$packageService->addOrderDocumentFromString($name, $content);
|
$packageService->addOrderDocumentFromString($name, $content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$positionParams = $templateVars->getTwigVars();
|
$positionParams = $templateVars->getTwigVars();
|
||||||
/** @var Orderpos $pos */
|
/** @var Orderpos $pos */
|
||||||
foreach ($templateVars->getPositions() as $pos) {
|
foreach ($templateVars->getPositions() as $pos) {
|
||||||
if ($pos->getUuid() != $event->getPosition()) {
|
if ($pos->getUuid() != $event->getPosition()) {
|
||||||
continue;
|
continue;
|
||||||
@ -934,6 +958,9 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
if ($queueSettings->isOrderStorno()) {
|
if ($queueSettings->isOrderStorno()) {
|
||||||
$packageService->addOrderDocument(Printing::STORNO);
|
$packageService->addOrderDocument(Printing::STORNO);
|
||||||
}
|
}
|
||||||
|
if ($queueSettings->isOrderInvoiceXML()) {
|
||||||
|
$packageService->addXRechnung();
|
||||||
|
}
|
||||||
|
|
||||||
$packageService->addPluginFilesToOrderPackage();
|
$packageService->addPluginFilesToOrderPackage();
|
||||||
foreach ($queueSettings->getOrderFiles() as $file) {
|
foreach ($queueSettings->getOrderFiles() as $file) {
|
||||||
@ -947,7 +974,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$positionParams = $templateVars->getTwigVars();
|
$positionParams = $templateVars->getTwigVars();
|
||||||
/** @var Orderpos $pos */
|
/** @var Orderpos $pos */
|
||||||
foreach ($templateVars->getPositions() as $pos) {
|
foreach ($templateVars->getPositions() as $pos) {
|
||||||
if ($pos->getUuid() != $event->getPosition()) {
|
if ($pos->getUuid() != $event->getPosition()) {
|
||||||
continue;
|
continue;
|
||||||
@ -1034,6 +1061,9 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
if ($queueSettings->isOrderStorno()) {
|
if ($queueSettings->isOrderStorno()) {
|
||||||
$packageService->addOrderDocument(Printing::STORNO);
|
$packageService->addOrderDocument(Printing::STORNO);
|
||||||
}
|
}
|
||||||
|
if ($queueSettings->isOrderInvoiceXML()) {
|
||||||
|
$packageService->addXRechnung();
|
||||||
|
}
|
||||||
|
|
||||||
$packageService->addPluginFilesToOrderPackage();
|
$packageService->addPluginFilesToOrderPackage();
|
||||||
foreach ($queueSettings->getOrderFiles() as $file) {
|
foreach ($queueSettings->getOrderFiles() as $file) {
|
||||||
@ -1056,7 +1086,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
}
|
}
|
||||||
if ($queueSettings->getMode() == 3) {
|
if ($queueSettings->getMode() == 3) {
|
||||||
$positionParams = $templateVars->getTwigVars();
|
$positionParams = $templateVars->getTwigVars();
|
||||||
/** @var Orderpos $pos */
|
/** @var Orderpos $pos */
|
||||||
foreach ($templateVars->getPositions() as $pos) {
|
foreach ($templateVars->getPositions() as $pos) {
|
||||||
if ($pos->getUuid() != $event->getPosition()) {
|
if ($pos->getUuid() != $event->getPosition()) {
|
||||||
continue;
|
continue;
|
||||||
@ -1128,7 +1158,7 @@ class Package implements QueueInterface, ConfigurableElementInterface
|
|||||||
return $this->_error;
|
return $this->_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
function convert($size)
|
public function convert($size)
|
||||||
{
|
{
|
||||||
$unit = array('b','kb','mb','gb','tb','pb');
|
$unit = array('b','kb','mb','gb','tb','pb');
|
||||||
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i] . ' ' . PHP_EOL;
|
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i] . ' ' . PHP_EOL;
|
||||||
|
|||||||
@ -173,7 +173,7 @@ class ShopSettingsType extends AbstractType
|
|||||||
'highlight_active_line' => null
|
'highlight_active_line' => null
|
||||||
))
|
))
|
||||||
->add('docJobticketPositionBg', MediaType::class, array('label' => 'background'))
|
->add('docJobticketPositionBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docJobticketFileName', TextType::class, array('label' => 'filename', 'required' => false))
|
->add('docJobticketFileName', TextType::class, array('label' => 'filenamej', 'required' => false))
|
||||||
->add('docJobticketPosition', AceEditorType::class, array(
|
->add('docJobticketPosition', AceEditorType::class, array(
|
||||||
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
||||||
'width' => '90%',
|
'width' => '90%',
|
||||||
@ -238,7 +238,7 @@ class ShopSettingsType extends AbstractType
|
|||||||
'highlight_active_line' => null
|
'highlight_active_line' => null
|
||||||
))
|
))
|
||||||
->add('docOfferBg', MediaType::class, array('label' => 'background'))
|
->add('docOfferBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docOfferFileName', TextType::class, array('label' => 'filename', 'required' => false))
|
->add('docOfferFileName', TextType::class, array('label' => 'filenameo', 'required' => false))
|
||||||
->add('docOfferPositionBg', MediaType::class, array('label' => 'background'))
|
->add('docOfferPositionBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docOfferPosition', AceEditorType::class, array(
|
->add('docOfferPosition', AceEditorType::class, array(
|
||||||
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
||||||
@ -271,7 +271,7 @@ class ShopSettingsType extends AbstractType
|
|||||||
'highlight_active_line' => null
|
'highlight_active_line' => null
|
||||||
))
|
))
|
||||||
->add('docOrderBg', MediaType::class, array('label' => 'background'))
|
->add('docOrderBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docOrderFileName', TextType::class, array('label' => 'filename', 'required' => false))
|
->add('docOrderFileName', TextType::class, array('label' => 'filenameor', 'required' => false))
|
||||||
->add('docOrderPositionBg', MediaType::class, array('label' => 'background'))
|
->add('docOrderPositionBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docOrderPosition', AceEditorType::class, array(
|
->add('docOrderPosition', AceEditorType::class, array(
|
||||||
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
||||||
@ -304,8 +304,14 @@ class ShopSettingsType extends AbstractType
|
|||||||
'highlight_active_line' => null
|
'highlight_active_line' => null
|
||||||
))
|
))
|
||||||
->add('docInvoiceBg', MediaType::class, array('label' => 'background'))
|
->add('docInvoiceBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docInvoiceFileName', TextType::class, array('label' => 'filename', 'required' => false))
|
->add('docInvoiceFileName', TextType::class, array('label' => 'filenamei', 'required' => false))
|
||||||
->add('docInvoicePositionBg', MediaType::class, array('label' => 'background'))
|
->add('docInvoicePositionBg', MediaType::class, array('label' => 'background'))
|
||||||
|
->add('docInvoiceXML', CheckboxType::class, array('label' => 'embed XRechnung', 'required' => false))
|
||||||
|
->add('docJobticketXML', CheckboxType::class, array('label' => 'embed XRechnung', 'required' => false))
|
||||||
|
->add('docOfferXML', CheckboxType::class, array('label' => 'embed XRechnung', 'required' => false))
|
||||||
|
->add('docDeliveryXML', CheckboxType::class, array('label' => 'embed XRechnung', 'required' => false))
|
||||||
|
->add('docOrderXML', CheckboxType::class, array('label' => 'embed XRechnung', 'required' => false))
|
||||||
|
->add('docStornoXML', CheckboxType::class, array('label' => 'embed XRechnung', 'required' => false))
|
||||||
->add('docInvoicePosition', AceEditorType::class, array(
|
->add('docInvoicePosition', AceEditorType::class, array(
|
||||||
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
||||||
'width' => '90%',
|
'width' => '90%',
|
||||||
@ -337,7 +343,7 @@ class ShopSettingsType extends AbstractType
|
|||||||
'highlight_active_line' => null
|
'highlight_active_line' => null
|
||||||
))
|
))
|
||||||
->add('docLabelBg', MediaType::class, array('label' => 'background'))
|
->add('docLabelBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docLabelFileName', TextType::class, array('label' => 'filename', 'required' => false))
|
->add('docLabelFileName', TextType::class, array('label' => 'filenamel', 'required' => false))
|
||||||
->add('docLabelPositionBg', MediaType::class, array('label' => 'background'))
|
->add('docLabelPositionBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docLabelPosition', AceEditorType::class, array(
|
->add('docLabelPosition', AceEditorType::class, array(
|
||||||
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
||||||
@ -370,7 +376,7 @@ class ShopSettingsType extends AbstractType
|
|||||||
'highlight_active_line' => null
|
'highlight_active_line' => null
|
||||||
))
|
))
|
||||||
->add('docDeliveryBg', MediaType::class, array('label' => 'background'))
|
->add('docDeliveryBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docDeliveryFileName', TextType::class, array('label' => 'filename', 'required' => false))
|
->add('docDeliveryFileName', TextType::class, array('label' => 'filenamed', 'required' => false))
|
||||||
->add('docDeliveryPositionBg', MediaType::class, array('label' => 'background'))
|
->add('docDeliveryPositionBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docDeliveryPosition', AceEditorType::class, array(
|
->add('docDeliveryPosition', AceEditorType::class, array(
|
||||||
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
||||||
@ -403,7 +409,7 @@ class ShopSettingsType extends AbstractType
|
|||||||
'highlight_active_line' => null
|
'highlight_active_line' => null
|
||||||
))
|
))
|
||||||
->add('docStornoBg', MediaType::class, array('label' => 'background'))
|
->add('docStornoBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docStornoFileName', TextType::class, array('label' => 'filename', 'required' => false))
|
->add('docStornoFileName', TextType::class, array('label' => 'filenames', 'required' => false))
|
||||||
->add('docStornoPositionBg', MediaType::class, array('label' => 'background'))
|
->add('docStornoPositionBg', MediaType::class, array('label' => 'background'))
|
||||||
->add('docStornoPosition', AceEditorType::class, array(
|
->add('docStornoPosition', AceEditorType::class, array(
|
||||||
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
||||||
@ -495,7 +501,7 @@ class ShopSettingsType extends AbstractType
|
|||||||
'required' => false,
|
'required' => false,
|
||||||
))
|
))
|
||||||
->add('disableOldCalc', CheckboxType::class, array('required' => false, 'label' => 'disableOldCalc'));
|
->add('disableOldCalc', CheckboxType::class, array('required' => false, 'label' => 'disableOldCalc'));
|
||||||
/** @var \PSC\System\PluginBundle\Form\Interfaces\Field $field */
|
/** @var \PSC\System\PluginBundle\Form\Interfaces\Field $field */
|
||||||
foreach ($this->fields->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Shop) as $field) {
|
foreach ($this->fields->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Shop) as $field) {
|
||||||
$builder->add($field->buildForm($this->formFactory->createNamedBuilder($field->getGroup(), FormType::class, null, ['mapped' => false]), $options));
|
$builder->add($field->buildForm($this->formFactory->createNamedBuilder($field->getGroup(), FormType::class, null, ['mapped' => false]), $options));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,8 @@ registrationnumber: Handelsregisternummer
|
|||||||
register: Register
|
register: Register
|
||||||
legalform: Rechtsform
|
legalform: Rechtsform
|
||||||
Fax: Fax
|
Fax: Fax
|
||||||
senderaddress: Absenderadresse
|
senderaddress: Absenderadresse / Rechnungssteller z.B. für XRechnung
|
||||||
|
betreiberdata: Betreiber Daten z.B. für E-Mail Absender und Footer
|
||||||
firstname: Vorname
|
firstname: Vorname
|
||||||
lastname: Nachname
|
lastname: Nachname
|
||||||
Zip: PLZ
|
Zip: PLZ
|
||||||
@ -87,6 +88,13 @@ labels: Label
|
|||||||
cancellation: Storno
|
cancellation: Storno
|
||||||
testform: Formular testen
|
testform: Formular testen
|
||||||
filename: Dateiname
|
filename: Dateiname
|
||||||
|
filenamei: Dateiname (invoice.pdf)
|
||||||
|
filenames: Dateiname (storno.pdf)
|
||||||
|
filenamel: Dateiname (label.pdf)
|
||||||
|
filenameor: Dateiname (order.pdf)
|
||||||
|
filenamed: Dateiname (delivery.pdf)
|
||||||
|
filenamej: Dateiname (jobticket.pdf)
|
||||||
|
filenameo: Dateiname (offer.pdf)
|
||||||
Insertexample: Beispiel einfügen
|
Insertexample: Beispiel einfügen
|
||||||
imprint: Impressum
|
imprint: Impressum
|
||||||
Revocationinstruction: Widerrufsbelehrung
|
Revocationinstruction: Widerrufsbelehrung
|
||||||
|
|||||||
@ -258,6 +258,7 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="betreiber" role="tabpanel">
|
<div class="tab-pane" id="betreiber" role="tabpanel">
|
||||||
|
<h5>{{ 'betreiberdata'|trans}}</h5>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
@ -1092,7 +1093,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docInvoiceBg) }}
|
{{ form_label(form.docInvoiceBg) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -1101,10 +1102,19 @@
|
|||||||
{{ form_errors(form.docInvoiceBg) }}
|
{{ form_errors(form.docInvoiceBg) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
|
<div class="row mb-3">
|
||||||
|
{{ form_label(form.docInvoiceXML) }}
|
||||||
|
<div class="col-md-12">
|
||||||
|
{{ form_widget(form.docInvoiceXML) }}
|
||||||
|
</div>
|
||||||
|
{{ form_errors(form.docInvoiceXML) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docInvoiceFileName) }}
|
{{ form_label(form.docInvoiceFileName) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-12">
|
||||||
{{ form_widget(form.docInvoiceFileName) }}
|
{{ form_widget(form.docInvoiceFileName) }}
|
||||||
</div>
|
</div>
|
||||||
{{ form_errors(form.docInvoiceFileName) }}
|
{{ form_errors(form.docInvoiceFileName) }}
|
||||||
@ -1124,7 +1134,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docJobticketBg) }}
|
{{ form_label(form.docJobticketBg) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -1133,10 +1143,19 @@
|
|||||||
{{ form_errors(form.docJobticketBg) }}
|
{{ form_errors(form.docJobticketBg) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
|
<div class="row mb-3">
|
||||||
|
{{ form_label(form.docJobticketXML) }}
|
||||||
|
<div class="col-md-12">
|
||||||
|
{{ form_widget(form.docJobticketXML) }}
|
||||||
|
</div>
|
||||||
|
{{ form_errors(form.docJobticketXML) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docJobticketFileName) }}
|
{{ form_label(form.docJobticketFileName) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-12">
|
||||||
{{ form_widget(form.docJobticketFileName) }}
|
{{ form_widget(form.docJobticketFileName) }}
|
||||||
</div>
|
</div>
|
||||||
{{ form_errors(form.docJobticketFileName) }}
|
{{ form_errors(form.docJobticketFileName) }}
|
||||||
@ -1188,7 +1207,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docOfferBg) }}
|
{{ form_label(form.docOfferBg) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -1197,10 +1216,19 @@
|
|||||||
{{ form_errors(form.docOfferBg) }}
|
{{ form_errors(form.docOfferBg) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
|
<div class="row mb-3">
|
||||||
|
{{ form_label(form.docOfferXML) }}
|
||||||
|
<div class="col-md-12">
|
||||||
|
{{ form_widget(form.docOfferXML) }}
|
||||||
|
</div>
|
||||||
|
{{ form_errors(form.docOfferXML) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docOfferFileName) }}
|
{{ form_label(form.docOfferFileName) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-12">
|
||||||
{{ form_widget(form.docOfferFileName) }}
|
{{ form_widget(form.docOfferFileName) }}
|
||||||
</div>
|
</div>
|
||||||
{{ form_errors(form.docOfferFileName) }}
|
{{ form_errors(form.docOfferFileName) }}
|
||||||
@ -1220,7 +1248,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docOrderBg) }}
|
{{ form_label(form.docOrderBg) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -1229,10 +1257,19 @@
|
|||||||
{{ form_errors(form.docOrderBg) }}
|
{{ form_errors(form.docOrderBg) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
|
<div class="row mb-3">
|
||||||
|
{{ form_label(form.docOrderXML) }}
|
||||||
|
<div class="col-md-12">
|
||||||
|
{{ form_widget(form.docOrderXML) }}
|
||||||
|
</div>
|
||||||
|
{{ form_errors(form.docOrderXML) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docOrderFileName) }}
|
{{ form_label(form.docOrderFileName) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-12">
|
||||||
{{ form_widget(form.docOrderFileName) }}
|
{{ form_widget(form.docOrderFileName) }}
|
||||||
</div>
|
</div>
|
||||||
{{ form_errors(form.docOrderFileName) }}
|
{{ form_errors(form.docOrderFileName) }}
|
||||||
@ -1252,7 +1289,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docDeliveryBg) }}
|
{{ form_label(form.docDeliveryBg) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -1261,10 +1298,19 @@
|
|||||||
{{ form_errors(form.docDeliveryBg) }}
|
{{ form_errors(form.docDeliveryBg) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
|
<div class="row mb-3">
|
||||||
|
{{ form_label(form.docDeliveryXML) }}
|
||||||
|
<div class="col-md-12">
|
||||||
|
{{ form_widget(form.docDeliveryXML) }}
|
||||||
|
</div>
|
||||||
|
{{ form_errors(form.docDeliveryXML) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docDeliveryFileName) }}
|
{{ form_label(form.docDeliveryFileName) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-12">
|
||||||
{{ form_widget(form.docDeliveryFileName) }}
|
{{ form_widget(form.docDeliveryFileName) }}
|
||||||
</div>
|
</div>
|
||||||
{{ form_errors(form.docDeliveryFileName) }}
|
{{ form_errors(form.docDeliveryFileName) }}
|
||||||
@ -1316,7 +1362,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docStornoBg) }}
|
{{ form_label(form.docStornoBg) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -1325,10 +1371,19 @@
|
|||||||
{{ form_errors(form.docStornoBg) }}
|
{{ form_errors(form.docStornoBg) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-3">
|
||||||
|
<div class="row mb-3">
|
||||||
|
{{ form_label(form.docStornoXML) }}
|
||||||
|
<div class="col-md-12">
|
||||||
|
{{ form_widget(form.docStornoXML) }}
|
||||||
|
</div>
|
||||||
|
{{ form_errors(form.docStornoXML) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
{{ form_label(form.docStornoFileName) }}
|
{{ form_label(form.docStornoFileName) }}
|
||||||
<div class="col-md-6">
|
<div class="col-md-12">
|
||||||
{{ form_widget(form.docStornoFileName) }}
|
{{ form_widget(form.docStornoFileName) }}
|
||||||
</div>
|
</div>
|
||||||
{{ form_errors(form.docStornoFileName) }}
|
{{ form_errors(form.docStornoFileName) }}
|
||||||
|
|||||||
@ -18,16 +18,17 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
interface Section
|
interface Section
|
||||||
{
|
{
|
||||||
const Cms = 1;
|
public const Cms = 1;
|
||||||
const Product = 2;
|
public const Product = 2;
|
||||||
const Shipping = 3;
|
public const Shipping = 3;
|
||||||
const Payment = 4;
|
public const Payment = 4;
|
||||||
const Productgroup = 5;
|
public const Productgroup = 5;
|
||||||
const News = 6;
|
public const News = 6;
|
||||||
const Account = 7;
|
public const Account = 7;
|
||||||
const Contact = 8;
|
public const Contact = 8;
|
||||||
const Shop = 9;
|
public const Shop = 9;
|
||||||
const Order = 10;
|
public const Order = 10;
|
||||||
|
public const OrderPositionDetail = 11;
|
||||||
public function getTitle();
|
public function getTitle();
|
||||||
public function getId();
|
public function getId();
|
||||||
public function getModule();
|
public function getModule();
|
||||||
|
|||||||
147
src/new/src/PSC/System/SettingsBundle/Barcode/QRGdRounded.php
Normal file
147
src/new/src/PSC/System/SettingsBundle/Barcode/QRGdRounded.php
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\System\SettingsBundle\Barcode;
|
||||||
|
|
||||||
|
use chillerlan\QRCode\Data\QRMatrix;
|
||||||
|
use chillerlan\QRCode\Output\QRGdImagePNG;
|
||||||
|
use chillerlan\QRCode\QROptions;
|
||||||
|
use chillerlan\Settings\SettingsContainerInterface;
|
||||||
|
|
||||||
|
class QRGdRounded extends QRGdImagePNG
|
||||||
|
{
|
||||||
|
public function __construct(SettingsContainerInterface|QROptions $options, QRMatrix $matrix)
|
||||||
|
{
|
||||||
|
// enable the internal scaling for better rounding results at scale < 20
|
||||||
|
$options->drawCircularModules = true;
|
||||||
|
|
||||||
|
parent::__construct($options, $matrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function dump(string $file = null)
|
||||||
|
{
|
||||||
|
if ($this->options->logo !== null) {
|
||||||
|
$this->options->returnResource = true;
|
||||||
|
$image = parent::dump($file);
|
||||||
|
$im = imagecreatefrompng($this->options->logo);
|
||||||
|
$w = imagesx($im);
|
||||||
|
$h = imagesy($im);
|
||||||
|
// set new logo size, leave a border of 1 module (no proportional resize/centering)
|
||||||
|
$lw = (($this->options->logoSpaceWidth - 2) * $this->options->scale);
|
||||||
|
$lh = (($this->options->logoSpaceHeight - 2) * $this->options->scale);
|
||||||
|
|
||||||
|
// get the qrcode size
|
||||||
|
$ql = ($this->matrix->getSize() * $this->options->scale);
|
||||||
|
|
||||||
|
// scale the logo and copy it over. done!
|
||||||
|
imagecopyresampled($this->image, $im, (($ql - $lw) / 2), (($ql - $lh) / 2), 0, 0, $lw, $lh, $w, $h);
|
||||||
|
// $this->imagecopymerge_alpha($image, $image2, 0, 0, 0, 0, 150, 150, 50);
|
||||||
|
$imageData = $this->dumpImage();
|
||||||
|
|
||||||
|
$this->saveToFile($imageData, $file);
|
||||||
|
|
||||||
|
return $imageData;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::dump($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct)
|
||||||
|
{
|
||||||
|
$cut = imagecreatetruecolor($src_w, $src_h);
|
||||||
|
imagecopy($cut, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h);
|
||||||
|
imagecopy($cut, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h);
|
||||||
|
imagecopymerge($dst_im, $cut, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function module(int $x, int $y, int $M_TYPE): void
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bit order (starting from 0):
|
||||||
|
*
|
||||||
|
* 0 1 2
|
||||||
|
* 7 # 3
|
||||||
|
* 6 5 4
|
||||||
|
*/
|
||||||
|
$neighbours = $this->matrix->checkNeighbours($x, $y);
|
||||||
|
|
||||||
|
$x1 = ($x * $this->scale);
|
||||||
|
$y1 = ($y * $this->scale);
|
||||||
|
$x2 = (($x + 1) * $this->scale);
|
||||||
|
$y2 = (($y + 1) * $this->scale);
|
||||||
|
$rectsize = (int)($this->scale / 2);
|
||||||
|
|
||||||
|
$light = $this->getModuleValue($M_TYPE);
|
||||||
|
$dark = $this->getModuleValue($M_TYPE | QRMatrix::IS_DARK);
|
||||||
|
|
||||||
|
// ------------------
|
||||||
|
// Outer rounding
|
||||||
|
// ------------------
|
||||||
|
|
||||||
|
if (($neighbours & (1 << 7))) { // neighbour left
|
||||||
|
// top left
|
||||||
|
imagefilledrectangle($this->image, $x1, $y1, ($x1 + $rectsize), ($y1 + $rectsize), $light);
|
||||||
|
// bottom left
|
||||||
|
imagefilledrectangle($this->image, $x1, ($y2 - $rectsize), ($x1 + $rectsize), $y2, $light);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($neighbours & (1 << 3))) { // neighbour right
|
||||||
|
// top right
|
||||||
|
imagefilledrectangle($this->image, ($x2 - $rectsize), $y1, $x2, ($y1 + $rectsize), $light);
|
||||||
|
// bottom right
|
||||||
|
imagefilledrectangle($this->image, ($x2 - $rectsize), ($y2 - $rectsize), $x2, $y2, $light);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($neighbours & (1 << 1))) { // neighbour top
|
||||||
|
// top left
|
||||||
|
imagefilledrectangle($this->image, $x1, $y1, ($x1 + $rectsize), ($y1 + $rectsize), $light);
|
||||||
|
// top right
|
||||||
|
imagefilledrectangle($this->image, ($x2 - $rectsize), $y1, $x2, ($y1 + $rectsize), $light);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($neighbours & (1 << 5))) { // neighbour bottom
|
||||||
|
// bottom left
|
||||||
|
imagefilledrectangle($this->image, $x1, ($y2 - $rectsize), ($x1 + $rectsize), $y2, $light);
|
||||||
|
// bottom right
|
||||||
|
imagefilledrectangle($this->image, ($x2 - $rectsize), ($y2 - $rectsize), $x2, $y2, $light);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------
|
||||||
|
// inner rounding
|
||||||
|
// ---------------------
|
||||||
|
|
||||||
|
if (!$this->matrix->check($x, $y)) {
|
||||||
|
|
||||||
|
if (($neighbours & 1) && ($neighbours & (1 << 7)) && ($neighbours & (1 << 1))) {
|
||||||
|
// top left
|
||||||
|
imagefilledrectangle($this->image, $x1, $y1, ($x1 + $rectsize), ($y1 + $rectsize), $dark);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($neighbours & (1 << 1)) && ($neighbours & (1 << 2)) && ($neighbours & (1 << 3))) {
|
||||||
|
// top right
|
||||||
|
imagefilledrectangle($this->image, ($x2 - $rectsize), $y1, $x2, ($y1 + $rectsize), $dark);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($neighbours & (1 << 7)) && ($neighbours & (1 << 6)) && ($neighbours & (1 << 5))) {
|
||||||
|
// bottom left
|
||||||
|
imagefilledrectangle($this->image, $x1, ($y2 - $rectsize), ($x1 + $rectsize), $y2, $dark);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($neighbours & (1 << 3)) && ($neighbours & (1 << 4)) && ($neighbours & (1 << 5))) {
|
||||||
|
// bottom right
|
||||||
|
imagefilledrectangle($this->image, ($x2 - $rectsize), ($y2 - $rectsize), $x2, $y2, $dark);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
imagefilledellipse(
|
||||||
|
$this->image,
|
||||||
|
(int)($x * $this->scale + $this->scale / 2),
|
||||||
|
(int)($y * $this->scale + $this->scale / 2),
|
||||||
|
($this->scale - 1),
|
||||||
|
($this->scale - 1),
|
||||||
|
$light,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\System\SettingsBundle\Barcode;
|
||||||
|
|
||||||
|
use chillerlan\QRCode\QROptions;
|
||||||
|
|
||||||
|
class QRGdWithLogoOptions extends QROptions
|
||||||
|
{
|
||||||
|
protected ?string $logo = null;
|
||||||
|
}
|
||||||
237
src/new/src/PSC/System/SettingsBundle/Barcode/QRSvgWithLogo.php
Normal file
237
src/new/src/PSC/System/SettingsBundle/Barcode/QRSvgWithLogo.php
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PSC\System\SettingsBundle\Barcode;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use chillerlan\QRCode\Data\QRMatrix;
|
||||||
|
use chillerlan\QRCode\Output\QRMarkupSVG;
|
||||||
|
|
||||||
|
class QRSvgWithLogo extends QRMarkupSVG
|
||||||
|
{
|
||||||
|
protected function path(string $path, int $M_TYPE): string
|
||||||
|
{
|
||||||
|
if (true || !$this->options->melt) {
|
||||||
|
return parent::path($path, $M_TYPE);
|
||||||
|
}
|
||||||
|
return sprintf('<path class="%s" d="%s"/>', $this->getCssClass($M_TYPE), $path);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function collectModules(Closure $transform): array
|
||||||
|
{
|
||||||
|
if (!$this->options->melt) {
|
||||||
|
return parent::collectModules($transform);
|
||||||
|
}
|
||||||
|
$paths = [];
|
||||||
|
$melt = $this->options->melt; // avoid magic getter in long loops
|
||||||
|
|
||||||
|
// collect the modules for each type
|
||||||
|
foreach ($this->matrix->getMatrix() as $y => $row) {
|
||||||
|
foreach ($row as $x => $M_TYPE) {
|
||||||
|
$M_TYPE_LAYER = $M_TYPE;
|
||||||
|
|
||||||
|
if ($this->connectPaths && !$this->matrix->checkTypeIn($x, $y, $this->excludeFromConnect)) {
|
||||||
|
// to connect paths we'll redeclare the $M_TYPE_LAYER to data only
|
||||||
|
$M_TYPE_LAYER = QRMatrix::M_DATA;
|
||||||
|
|
||||||
|
if ($this->matrix->isDark($M_TYPE)) {
|
||||||
|
$M_TYPE_LAYER = QRMatrix::M_DATA_DARK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we're going to "melt" the matrix, we'll declare *all* modules as dark,
|
||||||
|
// so that light modules with dark parts are rendered in the same path
|
||||||
|
if ($melt) {
|
||||||
|
$M_TYPE_LAYER |= QRMatrix::IS_DARK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// collect the modules per $M_TYPE
|
||||||
|
$module = $transform($x, $y, $M_TYPE, $M_TYPE_LAYER);
|
||||||
|
|
||||||
|
if (!empty($module)) {
|
||||||
|
$paths[$M_TYPE_LAYER][] = $module;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// beautify output
|
||||||
|
ksort($paths);
|
||||||
|
|
||||||
|
return $paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function module(int $x, int $y, int $M_TYPE): string
|
||||||
|
{
|
||||||
|
if (!$this->options->melt) {
|
||||||
|
return parent::module($x, $y, $M_TYPE);
|
||||||
|
}
|
||||||
|
$bits = $this->matrix->checkNeighbours($x, $y, null);
|
||||||
|
$check = fn (int $all, int $any = 0): bool => ($bits & ($all | (~$any & 0xff))) === $all;
|
||||||
|
|
||||||
|
$template = ($M_TYPE & QRMatrix::IS_DARK) === QRMatrix::IS_DARK
|
||||||
|
? $this->darkModule($check, $this->options->inverseMelt)
|
||||||
|
: $this->lightModule($check, $this->options->inverseMelt);
|
||||||
|
|
||||||
|
$r = $this->options->meltRadius;
|
||||||
|
|
||||||
|
return sprintf($template, $x, $y, $r, (1 - $r), (1 - 2 * $r));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function darkModule(Closure $check, bool $invert): string
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (true) {
|
||||||
|
// 4 rounded
|
||||||
|
case !$invert && $check(0b00000000, 0b01010101):
|
||||||
|
case $invert && $check(0b00000000, 0b00000000):
|
||||||
|
return 'M%1$s,%2$s m0,%3$s v%5$s q0,%3$s %3$s,%3$s h%5$s q%3$s,0 %3$s,-%3$s v-%5$s q0,-%3$s -%3$s,-%3$s h-%5$s q-%3$s,0 -%3$s,%3$sZ';
|
||||||
|
|
||||||
|
// 3 rounded
|
||||||
|
case $invert && $check(0b01000000, 0b00000000): // 135
|
||||||
|
return 'M%1$s,%2$s m0,1 h%4$s q%3$s,0 %3$s,-%3$s v-%5$s q0,-%3$s -%3$s,-%3$s h-%5$s q-%3$s,0 -%3$s,%3$sZ';
|
||||||
|
case $invert && $check(0b00000001, 0b00000000): // 357
|
||||||
|
return 'M%1$s,%2$s v%4$s q0,%3$s %3$s,%3$s h%5$s q%3$s,0 %3$s,-%3$s v-%5$s q0,-%3$s -%3$s,-%3$sZ';
|
||||||
|
case $invert && $check(0b00000100, 0b00000000): // 571
|
||||||
|
return 'M%1$s,%2$s m1,0 v%4$s q0,%3$s -%3$s,%3$s h-%5$s q-%3$s,0 -%3$s,-%3$s v-%5$s q0,-%3$s %3$s,-%3$sZ';
|
||||||
|
case $invert && $check(0b00010000, 0b00000000): // 713
|
||||||
|
return 'M%1$s,%2$s m1,1 h-%4$s q-%3$s,0 -%3$s,-%3$s v-%5$s q0,-%3$s %3$s,-%3$s h%5$s q%3$s,0 %3$s,%3$sZ';
|
||||||
|
|
||||||
|
// 2 rounded
|
||||||
|
case !$invert && $check(0b00100000, 0b01010101): // 13
|
||||||
|
case $invert && $check(0b00000000, 0b01110000):
|
||||||
|
return 'M%1$s,%2$s m0,1 h1 v-%4$s q0,-%3$s -%3$s,-%3$s h-%5$s q-%3$s,0 -%3$s,%3$sZ';
|
||||||
|
case !$invert && $check(0b10000000, 0b01010101): // 35
|
||||||
|
case $invert && $check(0b00000000, 0b11000001):
|
||||||
|
return 'M%1$s,%2$s v1 h%4$s q%3$s,0 %3$s,-%3$s v-%5$s q0,-%3$s -%3$s,-%3$sZ';
|
||||||
|
case !$invert && $check(0b00000010, 0b01010101): // 57
|
||||||
|
case $invert && $check(0b00000000, 0b00000111):
|
||||||
|
return 'M%1$s,%2$s v%4$s q0,%3$s %3$s,%3$s h%5$s q%3$s,0 %3$s,-%3$s v-%4$sZ';
|
||||||
|
case !$invert && $check(0b00001000, 0b01010101): // 71
|
||||||
|
case $invert && $check(0b00000000, 0b00011100):
|
||||||
|
return 'M%1$s,%2$s m1,1 v-1 h-%4$s q-%3$s,0 -%3$s,%3$s v%5$s q0,%3$s %3$s,%3$sZ';
|
||||||
|
// diagonal
|
||||||
|
case $invert && $check(0b01000100, 0b00000000): // 15
|
||||||
|
return 'M%1$s,%2$s m0,1 h%4$s q%3$s,0 %3$s,-%3$s v-%4$s h-%4$s q-%3$s,0 -%3$s,%3$sZ';
|
||||||
|
case $invert && $check(0b00010001, 0b00000000): // 37
|
||||||
|
return 'M%1$s,%2$s h%4$s q%3$s,0 %3$s,%3$s v%4$s h-%4$s q-%3$s,0 -%3$s,-%3$sZ';
|
||||||
|
|
||||||
|
// 1 rounded
|
||||||
|
case !$invert && $check(0b00101000, 0b01010101): // 1
|
||||||
|
case $invert && $check(0b00000000, 0b01111100):
|
||||||
|
return 'M%1$s,%2$s m0,1 h1 v-1 h-%4$s q-%3$s,0 -%3$s,%3$sZ';
|
||||||
|
case !$invert && $check(0b10100000, 0b01010101): // 3
|
||||||
|
case $invert && $check(0b00000000, 0b11110001):
|
||||||
|
return 'M%1$s,%2$s h%4$s q%3$s,0 %3$s,%3$s v%4$s h-1Z';
|
||||||
|
case !$invert && $check(0b10000010, 0b01010101): // 5
|
||||||
|
case $invert && $check(0b00000000, 0b11000111):
|
||||||
|
return 'M%1$s,%2$s h1 v%4$s q0,%3$s -%3$s,%3$s h-%4$sZ';
|
||||||
|
case !$invert && $check(0b00001010, 0b01010101): // 7
|
||||||
|
case $invert && $check(0b00000000, 0b00011111):
|
||||||
|
return 'M%1$s,%2$s v%4$s q0,%3$s %3$s,%3$s h%4$s v-1Z';
|
||||||
|
default:
|
||||||
|
// full square
|
||||||
|
return 'M%1$s,%2$s h1 v1 h-1Z';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function lightModule(Closure $check, bool $invert): string
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (true) {
|
||||||
|
// 4 rounded
|
||||||
|
case !$invert && $check(0b11111111, 0b01010101):
|
||||||
|
case $invert && $check(0b10101010, 0b01010101):
|
||||||
|
return 'M%1$s,%2$s h%3$s q-%3$s,0 -%3$s,%3$sz m1,0 v%3$s q0,-%3$s -%3$s,-%3$sz m0,1 h-%3$s q%3$s,0 %3$s,-%3$sz m-1,0 v-%3$s q0,%3$s %3$s,%3$sZ';
|
||||||
|
|
||||||
|
// 3 rounded
|
||||||
|
case !$invert && $check(0b10111111, 0b00000000): // 135
|
||||||
|
return 'M%1$s,%2$s h%3$s q-%3$s,0 -%3$s,%3$sz m1,0 v%3$s q0,-%3$s -%3$s,-%3$sz m0,1 h-%3$s q%3$s,0 %3$s,-%3$sZ';
|
||||||
|
case !$invert && $check(0b11111110, 0b00000000): // 357
|
||||||
|
return 'M%1$s,%2$s m1,0 v%3$s q0,-%3$s -%3$s,-%3$sz m0,1 h-%3$s q%3$s,0 %3$s,-%3$sz m-1,0 v-%3$s q0,%3$s %3$s,%3$sZ';
|
||||||
|
case !$invert && $check(0b11111011, 0b00000000): // 571
|
||||||
|
return 'M%1$s,%2$s h%3$s q-%3$s,0 -%3$s,%3$sz m0,1 v-%3$s q0,%3$s %3$s,%3$sz m1,0 h-%3$s q%3$s,0 %3$s,-%3$sZ';
|
||||||
|
case !$invert && $check(0b11101111, 0b00000000): // 713
|
||||||
|
return 'M%1$s,%2$s h%3$s q-%3$s,0 -%3$s,%3$sz m0,1 v-%3$s q0,%3$s %3$s,%3$sz m1,-1 v%3$s q0,-%3$s -%3$s,-%3$sZ';
|
||||||
|
|
||||||
|
// 2 rounded
|
||||||
|
case !$invert && $check(0b10001111, 0b01110000): // 13
|
||||||
|
case $invert && $check(0b10001010, 0b01010101):
|
||||||
|
return 'M%1$s,%2$s h%3$s q-%3$s,0 -%3$s,%3$sz m1,0 v%3$s q0,-%3$s -%3$s,-%3$sZ';
|
||||||
|
case !$invert && $check(0b00111110, 0b11000001): // 35
|
||||||
|
case $invert && $check(0b00101010, 0b01010101):
|
||||||
|
return 'M%1$s,%2$s m1,0 v%3$s q0,-%3$s -%3$s,-%3$sz m0,1 h-%3$s q%3$s,0 %3$s,-%3$sZ';
|
||||||
|
case !$invert && $check(0b11111000, 0b00000111): // 57
|
||||||
|
case $invert && $check(0b10101000, 0b01010101):
|
||||||
|
return 'M%1$s,%2$s m1,1 h-%3$s q%3$s,0 %3$s,-%3$sz m-1,0 v-%3$s q0,%3$s %3$s,%3$sZ';
|
||||||
|
case !$invert && $check(0b11100011, 0b00011100): // 71
|
||||||
|
case $invert && $check(0b10100010, 0b01010101):
|
||||||
|
return 'M%1$s,%2$s h%3$s q-%3$s,0 -%3$s,%3$sz m0,1 v-%3$s q0,%3$s %3$s,%3$sZ';
|
||||||
|
// diagonal
|
||||||
|
case !$invert && $check(0b10111011, 0b00000000): // 15
|
||||||
|
return 'M%1$s,%2$s h%3$s q-%3$s,0 -%3$s,%3$sz m1,1 h-%3$s q%3$s,0 %3$s,-%3$sZ';
|
||||||
|
case !$invert && $check(0b11101110, 0b00000000): // 37
|
||||||
|
return 'M%1$s,%2$s m1,0 v%3$s q0,-%3$s -%3$s,-%3$sz m-1,1 v-%3$s q0,%3$s %3$s,%3$sZ';
|
||||||
|
|
||||||
|
// 1 rounded
|
||||||
|
case !$invert && $check(0b10000011, 0b01111100): // 1
|
||||||
|
case $invert && $check(0b10000010, 0b01010101):
|
||||||
|
return 'M%1$s,%2$s h%3$s q-%3$s,0 -%3$s,%3$sZ';
|
||||||
|
case !$invert && $check(0b00001110, 0b11110001): // 3
|
||||||
|
case $invert && $check(0b00001010, 0b01010101):
|
||||||
|
return 'M%1$s,%2$s m1,0 v%3$s q0,-%3$s -%3$s,-%3$sZ';
|
||||||
|
case !$invert && $check(0b00111000, 0b11000111): // 5
|
||||||
|
case $invert && $check(0b00101000, 0b01010101):
|
||||||
|
return 'M%1$s,%2$s m1,1 h-%3$s q%3$s,0 %3$s,-%3$sZ';
|
||||||
|
case !$invert && $check(0b11100000, 0b00011111): // 7
|
||||||
|
case $invert && $check(0b10100000, 0b01010101):
|
||||||
|
return 'M%1$s,%2$s m0,1 v-%3$s q0,%3$s %3$s,%3$sZ';
|
||||||
|
default:
|
||||||
|
// empty block
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function paths(): string
|
||||||
|
{
|
||||||
|
if ($this->options->svgLogo) {
|
||||||
|
$size = (int)ceil($this->moduleCount * $this->options->svgLogoScale);
|
||||||
|
$this->matrix->setLogoSpace($size, $size);
|
||||||
|
$svg = parent::paths();
|
||||||
|
$svg .= $this->getSvgLogo();
|
||||||
|
return $svg;
|
||||||
|
} elseif ($this->options->logo) {
|
||||||
|
$svg = parent::paths();
|
||||||
|
$svg .= $this->getLogo();
|
||||||
|
return $svg;
|
||||||
|
} else {
|
||||||
|
$svg = parent::paths();
|
||||||
|
return $svg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected function getLogo(): string
|
||||||
|
{
|
||||||
|
return sprintf(
|
||||||
|
'%5$s<g transform="translate(%1$s %1$s) scale(%2$s)" class="%3$s">%5$s <image href="%4$s"/>%5$s</g>',
|
||||||
|
(($this->moduleCount - ($this->moduleCount * $this->options->svgLogoScale)) / 2),
|
||||||
|
$this->options->svgLogoScale,
|
||||||
|
$this->options->svgLogoCssClass,
|
||||||
|
$this->options->logo,
|
||||||
|
"",
|
||||||
|
);
|
||||||
|
return sprintf('%1$s<image href="%2$s" height="100" width="100" />', $this->options->eol, $this->options->logo);
|
||||||
|
}
|
||||||
|
protected function getSvgLogo(): string
|
||||||
|
{
|
||||||
|
// @todo: customize the <g> element to your liking (css class, style...)
|
||||||
|
return sprintf(
|
||||||
|
'%5$s<g transform="translate(%1$s %1$s) scale(%2$s)" class="%3$s">%5$s %4$s%5$s</g>',
|
||||||
|
(($this->moduleCount - ($this->moduleCount * $this->options->svgLogoScale)) / 2),
|
||||||
|
$this->options->svgLogoScale,
|
||||||
|
$this->options->svgLogoCssClass,
|
||||||
|
file_get_contents($this->options->svgLogo),
|
||||||
|
$this->options->eol,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -47,15 +47,6 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
*/
|
*/
|
||||||
class SettingsController extends AbstractController
|
class SettingsController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Default Seite
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @param DocumentManager $documentManager
|
|
||||||
* @return array
|
|
||||||
* @throws \Doctrine\ODM\MongoDB\MongoDBException
|
|
||||||
*/
|
|
||||||
#[Route(path: '/settings/index', name: 'psc_backend_system_settings_index')]
|
#[Route(path: '/settings/index', name: 'psc_backend_system_settings_index')]
|
||||||
#[Template]
|
#[Template]
|
||||||
#[Security("is_granted('ROLE_SHOP')")]
|
#[Security("is_granted('ROLE_SHOP')")]
|
||||||
@ -84,7 +75,6 @@ class SettingsController extends AbstractController
|
|||||||
$logService->createLogEntry(new \PSC\Shop\EntityBundle\Entity\Shop(), $this->getUser(), LogEntry::INFO, PSCSystemSettingsBundle::class, "", "Systemsettings saved");
|
$logService->createLogEntry(new \PSC\Shop\EntityBundle\Entity\Shop(), $this->getUser(), LogEntry::INFO, PSCSystemSettingsBundle::class, "", "Systemsettings saved");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (getenv('ftpUsername')) {
|
if (getenv('ftpUsername')) {
|
||||||
$display = true;
|
$display = true;
|
||||||
$instance->setFtpUsername(getenv('ftpUsername'));
|
$instance->setFtpUsername(getenv('ftpUsername'));
|
||||||
@ -111,15 +101,6 @@ class SettingsController extends AbstractController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Default Seite
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @param DocumentManager $documentManager
|
|
||||||
* @return array
|
|
||||||
* @throws \Doctrine\ODM\MongoDB\MongoDBException
|
|
||||||
*/
|
|
||||||
#[Route(path: '/settings/smtptest', name: 'psc_backend_system_settings_smtptest')]
|
#[Route(path: '/settings/smtptest', name: 'psc_backend_system_settings_smtptest')]
|
||||||
#[Template]
|
#[Template]
|
||||||
#[Security("is_granted('ROLE_SHOP')")]
|
#[Security("is_granted('ROLE_SHOP')")]
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class SettingsType extends AbstractType
|
|||||||
->add('smtpPort', NumberType::class, array('required' => false, 'label' => 'Port'))
|
->add('smtpPort', NumberType::class, array('required' => false, 'label' => 'Port'))
|
||||||
->add('smtpHost', TextType::class, array('required' => false, 'label' => 'Host'))
|
->add('smtpHost', TextType::class, array('required' => false, 'label' => 'Host'))
|
||||||
->add('smtpUsername', TextType::class, array('required' => false, 'label' => 'Username'))
|
->add('smtpUsername', TextType::class, array('required' => false, 'label' => 'Username'))
|
||||||
->add('smtpPassword', TextType::class, array('required' => false, 'label' => 'Password'))
|
->add('smtpPassword', PasswordType::class, array('required' => false, 'label' => 'Password'))
|
||||||
->add('extraSettings', TextareaType::class, array('required' => false, 'label' => 'Extra Einstellungen'))
|
->add('extraSettings', TextareaType::class, array('required' => false, 'label' => 'Extra Einstellungen'))
|
||||||
->add('maintenanceMode', CheckboxType::class, array('required' => false, 'label' => 'Wartungsmodus'))
|
->add('maintenanceMode', CheckboxType::class, array('required' => false, 'label' => 'Wartungsmodus'))
|
||||||
->add('maintenanceTitle', TextType::class, array('required' => false, 'label' => 'Wartung Titel'))
|
->add('maintenanceTitle', TextType::class, array('required' => false, 'label' => 'Wartung Titel'))
|
||||||
@ -75,7 +75,7 @@ class SettingsType extends AbstractType
|
|||||||
->add('supportprotokoll', CheckboxType::class, array('required' => false, 'attr' => array('checked' => 'checked', 'readonly' => true), 'label' => 'Fehlerprotokolle an PrintshopCreator übermitteln'))
|
->add('supportprotokoll', CheckboxType::class, array('required' => false, 'attr' => array('checked' => 'checked', 'readonly' => true), 'label' => 'Fehlerprotokolle an PrintshopCreator übermitteln'))
|
||||||
->add('supportlogin', CheckboxType::class, array('required' => false, 'attr' => array('checked' => 'checked', 'readonly' => true), 'label' => 'PSC Support Login erlauben'))
|
->add('supportlogin', CheckboxType::class, array('required' => false, 'attr' => array('checked' => 'checked', 'readonly' => true), 'label' => 'PSC Support Login erlauben'))
|
||||||
->add('monitoringkey', TextType::class, array('required' => false, 'label' => 'Monitoring Key'));
|
->add('monitoringkey', TextType::class, array('required' => false, 'label' => 'Monitoring Key'));
|
||||||
/** @var \PSC\System\PluginBundle\Form\Interfaces\Field $field */
|
/** @var \PSC\System\PluginBundle\Form\Interfaces\Field $field */
|
||||||
foreach ($this->fields->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::System) as $field) {
|
foreach ($this->fields->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::System) as $field) {
|
||||||
$builder->add($field->buildForm($this->formFactory->createNamedBuilder($field->getGroup(), FormType::class, null, ['mapped' => false]), $options));
|
$builder->add($field->buildForm($this->formFactory->createNamedBuilder($field->getGroup(), FormType::class, null, ['mapped' => false]), $options));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,10 +8,13 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use PSC\Shop\EntityBundle\Entity\Orderpos;
|
use PSC\Shop\EntityBundle\Entity\Orderpos;
|
||||||
use PSC\Shop\EntityBundle\Entity\Upload;
|
use PSC\Shop\EntityBundle\Entity\Upload;
|
||||||
use PSC\Shop\OrderBundle\Model\Order;
|
use PSC\Shop\OrderBundle\Model\Order;
|
||||||
|
use PSC\Shop\OrderBundle\Service\Order as PSCOrder;
|
||||||
use Symfony\Component\HttpKernel\KernelInterface;
|
use Symfony\Component\HttpKernel\KernelInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
|
use horstoeko\zugferd\ZugferdDocumentBuilder;
|
||||||
|
use horstoeko\zugferd\ZugferdProfiles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Package
|
* Package
|
||||||
@ -52,13 +55,14 @@ class Package
|
|||||||
*/
|
*/
|
||||||
protected $position;
|
protected $position;
|
||||||
|
|
||||||
|
protected PSCOrder $orderService;
|
||||||
/**
|
/**
|
||||||
* @var Order
|
* @var Order
|
||||||
*/
|
*/
|
||||||
protected $orderObj;
|
protected $orderObj;
|
||||||
private \PSC\System\PluginBundle\Service\Package $pluginPackageRegistry;
|
private \PSC\System\PluginBundle\Service\Package $pluginPackageRegistry;
|
||||||
|
|
||||||
public function __construct(KernelInterface $kernel, EntityManagerInterface $em, TokenStorageInterface $tokenStorage, DocumentManager $mongoManager, Environment $twig, Printing $printing, \PSC\System\PluginBundle\Service\Package $pluginPackageRegistry)
|
public function __construct(KernelInterface $kernel, EntityManagerInterface $em, TokenStorageInterface $tokenStorage, DocumentManager $mongoManager, Environment $twig, Printing $printing, \PSC\System\PluginBundle\Service\Package $pluginPackageRegistry, PSCOrder $orderService)
|
||||||
{
|
{
|
||||||
$this->entityManager = $em;
|
$this->entityManager = $em;
|
||||||
$this->tokenStorage = $tokenStorage;
|
$this->tokenStorage = $tokenStorage;
|
||||||
@ -67,6 +71,7 @@ class Package
|
|||||||
$this->twig = $twig;
|
$this->twig = $twig;
|
||||||
$this->printing = $printing;
|
$this->printing = $printing;
|
||||||
$this->pluginPackageRegistry = $pluginPackageRegistry;
|
$this->pluginPackageRegistry = $pluginPackageRegistry;
|
||||||
|
$this->orderService = $orderService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createPackage($path)
|
public function createPackage($path)
|
||||||
@ -103,6 +108,39 @@ class Package
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addXRechnung(): void
|
||||||
|
{
|
||||||
|
$orderModel = $this->orderService->getOrderByUuid($this->order->getUuid());
|
||||||
|
$document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_XRECHNUNG_2);
|
||||||
|
|
||||||
|
$document
|
||||||
|
->setDocumentInformation($orderModel->getAlias(), "380", $orderModel->getCreated(), "EUR")
|
||||||
|
->addDocumentNote('Rechnung gemäß Bestellung vom ' . $orderModel->getCreated()->format('d.m.Y'))
|
||||||
|
->setDocumentSupplyChainEvent($orderModel->getCreated())
|
||||||
|
->setDocumentSeller($orderModel->getSenderAddress()->getCompany() . ' ' . $orderModel->getSenderAddress()->getFirstname() . ' ' . $orderModel->getSenderAddress()->getLastname(), "549910")
|
||||||
|
->setDocumentSellerAddress($orderModel->getSenderAddress()->getStreet() . ' ' . $orderModel->getSenderAddress()->getHouseNumber(), "", "", $orderModel->getSenderAddress()->getZip(), $orderModel->getSenderAddress()->getCity(), $orderModel->getSenderAddress()->getCountry())
|
||||||
|
->setDocumentBuyer($orderModel->getInvoiceAddress()->getCompany() . ' ' . $orderModel->getInvoiceAddress()->getFirstname() . ' ' . $orderModel->getInvoiceAddress()->getLastname(), $orderModel->getInvoiceAddress()->getKundenNr())
|
||||||
|
->setDocumentBuyerAddress($orderModel->getInvoiceAddress()->getStreet() . ' ' . $orderModel->getInvoiceAddress()->getHouseNumber(), "", "", $orderModel->getInvoiceAddress()->getZip(), $orderModel->getInvoiceAddress()->getCity(), $orderModel->getInvoiceAddress()->getCountry());
|
||||||
|
|
||||||
|
foreach($orderModel->getTaxes() as $tax) {
|
||||||
|
$document->addDocumentTax("S", "VAT", $tax->getValue() / 100, $tax->getValue() / 100, $tax->getName() / 100);
|
||||||
|
}
|
||||||
|
$document
|
||||||
|
->setDocumentSummation($orderModel->getGross() / 100, $orderModel->getGross() / 100, $orderModel->getNet() / 100, 0.0, 0.0, $orderModel->getNet() / 100, $orderModel->getTaxesSum() / 100, null, 0.0);
|
||||||
|
|
||||||
|
foreach($orderModel->getPositions() as $position) {
|
||||||
|
$document
|
||||||
|
->addNewPosition($position->getPos())
|
||||||
|
->setDocumentPositionProductDetails($position->getProduct()->getTitle())
|
||||||
|
->setDocumentPositionGrossPrice($position->getPrice()->getGross() / 100)
|
||||||
|
->setDocumentPositionNetPrice($position->getPrice()->getNet() / 100)
|
||||||
|
->setDocumentPositionQuantity(1, "H87")
|
||||||
|
->addDocumentPositionTax('S', 'VAT', $position->getPrice()->getTax()->getName() / 100)
|
||||||
|
->setDocumentPositionLineSummation($position->getPrice()->getNet() / 100)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
$this->archive->addFromString("factur-x.xml", $document->getContent());
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $content
|
* @param string $content
|
||||||
@ -207,6 +245,16 @@ class Package
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$orderModel = $this->orderService->getOrderByUuid($this->order->getUuid());
|
||||||
|
$posModel = $orderModel->getPositionByUuid($orderpos->getUuid());
|
||||||
|
if($posModel->getProduct()->getUploadProvidedFile() && $posModel->getProduct()->getUploadProvidedFile()->getUrl() != "") {
|
||||||
|
if ($orderArchive) {
|
||||||
|
$this->archive->addFile('/data/www/new/web/'. $posModel->getProduct()->getUploadProvidedFile()->getUrl(), $path . $posModel->getProduct()->getUploadProvidedFile()->getTitle());
|
||||||
|
} else {
|
||||||
|
$this->archivePosition->addFile('/data/www/new/web/'. $posModel->getProduct()->getUploadProvidedFile()->getUrl(), $path . $posModel->getProduct()->getUploadProvidedFile()->getTitle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addPluginFilesToOrderPackage()
|
public function addPluginFilesToOrderPackage()
|
||||||
|
|||||||
@ -9,6 +9,7 @@ use PSC\Shop\EntityBundle\Entity\Contact;
|
|||||||
use PSC\Shop\EntityBundle\Entity\Orderpos;
|
use PSC\Shop\EntityBundle\Entity\Orderpos;
|
||||||
use PSC\Shop\EntityBundle\Entity\Product;
|
use PSC\Shop\EntityBundle\Entity\Product;
|
||||||
use PSC\Shop\MediaBundle\Document\Media;
|
use PSC\Shop\MediaBundle\Document\Media;
|
||||||
|
use PSC\Shop\OrderBundle\Service\Order;
|
||||||
use Symfony\Component\DomCrawler\Crawler;
|
use Symfony\Component\DomCrawler\Crawler;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
@ -24,14 +25,14 @@ require_once __DIR__ . '/../../../Shop/EntityBundle/Lagacy/TP_Basket_Item.php';
|
|||||||
*/
|
*/
|
||||||
class Printing
|
class Printing
|
||||||
{
|
{
|
||||||
const INVOICE = 1;
|
public const INVOICE = 1;
|
||||||
const DELIVERY = 2;
|
public const DELIVERY = 2;
|
||||||
const LABEL = 3;
|
public const LABEL = 3;
|
||||||
const ORDER = 4;
|
public const ORDER = 4;
|
||||||
const OFFER = 5;
|
public const OFFER = 5;
|
||||||
const STORNO = 6;
|
public const STORNO = 6;
|
||||||
const JOBTICKET = 7;
|
public const JOBTICKET = 7;
|
||||||
const JOBTICKET_PRINTPARTNER = 8;
|
public const JOBTICKET_PRINTPARTNER = 8;
|
||||||
|
|
||||||
protected $entityManager;
|
protected $entityManager;
|
||||||
protected $mongoManager;
|
protected $mongoManager;
|
||||||
@ -39,11 +40,12 @@ class Printing
|
|||||||
protected $twig;
|
protected $twig;
|
||||||
private $projectDir;
|
private $projectDir;
|
||||||
private $templateVars;
|
private $templateVars;
|
||||||
|
private Order $orderService;
|
||||||
private $mpdf;
|
private $mpdf;
|
||||||
|
|
||||||
protected $fileName;
|
protected $fileName;
|
||||||
|
|
||||||
public function __construct($projectDir, EntityManagerInterface $em, TokenStorageInterface $tokenStorage, DocumentManager $mongoManager, Environment $twig, TemplateVars $templateVars)
|
public function __construct($projectDir, EntityManagerInterface $em, TokenStorageInterface $tokenStorage, DocumentManager $mongoManager, Environment $twig, TemplateVars $templateVars, Order $orderService)
|
||||||
{
|
{
|
||||||
$this->entityManager = $em;
|
$this->entityManager = $em;
|
||||||
$this->tokenStorage = $tokenStorage;
|
$this->tokenStorage = $tokenStorage;
|
||||||
@ -51,6 +53,7 @@ class Printing
|
|||||||
$this->projectDir = $projectDir;
|
$this->projectDir = $projectDir;
|
||||||
$this->twig = $twig;
|
$this->twig = $twig;
|
||||||
$this->templateVars = $templateVars;
|
$this->templateVars = $templateVars;
|
||||||
|
$this->orderService = $orderService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,15 +64,41 @@ class Printing
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function generateXRechnung(\PSC\Shop\EntityBundle\Entity\Order $order): string
|
||||||
* @param \PSC\Shop\EntityBundle\Entity\Order $order
|
{
|
||||||
* @param int $type
|
$orderModel = $this->orderService->getOrderByUuid($order->getUuid());
|
||||||
* @return bool|string
|
$document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_XRECHNUNG_3);
|
||||||
* @throws \Mpdf\MpdfException
|
|
||||||
* @throws \Throwable
|
$document
|
||||||
* @throws \Twig_Error_Loader
|
->setDocumentInformation($orderModel->getAlias(), "380", $orderModel->getCreated(), "EUR")
|
||||||
* @throws \Twig_Error_Syntax
|
->addDocumentNote('Rechnung gemäß Bestellung vom ' . $orderModel->getCreated()->format('d.m.Y'))
|
||||||
*/
|
->setDocumentSupplyChainEvent($orderModel->getCreated())
|
||||||
|
->setDocumentSeller($orderModel->getSenderAddress()->getCompany() . ' ' . $orderModel->getSenderAddress()->getFirstname() . ' ' . $orderModel->getSenderAddress()->getLastname(), "549910")
|
||||||
|
->setDocumentSellerAddress($orderModel->getSenderAddress()->getStreet() . ' ' . $orderModel->getSenderAddress()->getHouseNumber(), "", "", $orderModel->getSenderAddress()->getZip(), $orderModel->getSenderAddress()->getCity(), $orderModel->getSenderAddress()->getCountry())
|
||||||
|
->setDocumentBuyer($orderModel->getInvoiceAddress()->getCompany() . ' ' . $orderModel->getInvoiceAddress()->getFirstname() . ' ' . $orderModel->getInvoiceAddress()->getLastname(), $orderModel->getInvoiceAddress()->getKundenNr())
|
||||||
|
->setDocumentBuyerAddress($orderModel->getInvoiceAddress()->getStreet() . ' ' . $orderModel->getInvoiceAddress()->getHouseNumber(), "", "", $orderModel->getInvoiceAddress()->getZip(), $orderModel->getInvoiceAddress()->getCity(), $orderModel->getInvoiceAddress()->getCountry());
|
||||||
|
|
||||||
|
foreach($orderModel->getTaxes() as $tax) {
|
||||||
|
$document->addDocumentTax("S", "VAT", $tax->getValue() / 100, $tax->getValue() / 100, $tax->getName() / 100);
|
||||||
|
}
|
||||||
|
$document
|
||||||
|
->setDocumentSummation($orderModel->getGross() / 100, $orderModel->getGross() / 100, $orderModel->getNet() / 100, 0.0, 0.0, $orderModel->getNet() / 100, $orderModel->getTaxesSum() / 100, null, 0.0);
|
||||||
|
|
||||||
|
foreach($orderModel->getPositions() as $position) {
|
||||||
|
$document
|
||||||
|
->addNewPosition($position->getPos())
|
||||||
|
->setDocumentPositionProductDetails($position->getProduct()->getTitle())
|
||||||
|
->setDocumentPositionGrossPrice($position->getPrice()->getGross() / 100)
|
||||||
|
->setDocumentPositionNetPrice($position->getPrice()->getNet() / 100)
|
||||||
|
->setDocumentPositionQuantity(1, "H87")
|
||||||
|
->addDocumentPositionTax('S', 'VAT', $position->getPrice()->getTax()->getName() / 100)
|
||||||
|
->setDocumentPositionLineSummation($position->getPrice()->getNet() / 100)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $document->getContent();
|
||||||
|
}
|
||||||
|
|
||||||
public function generateOrder(\PSC\Shop\EntityBundle\Entity\Order $order, $type = self::INVOICE)
|
public function generateOrder(\PSC\Shop\EntityBundle\Entity\Order $order, $type = self::INVOICE)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -89,57 +118,64 @@ class Printing
|
|||||||
->getRepository('PSC\Shop\EntityBundle\Document\Shop')
|
->getRepository('PSC\Shop\EntityBundle\Document\Shop')
|
||||||
->findOneBy(array('uid' => (string)$shop->getUid()));
|
->findOneBy(array('uid' => (string)$shop->getUid()));
|
||||||
|
|
||||||
|
$addXRechnung = false;
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::DELIVERY:
|
case self::DELIVERY:
|
||||||
$reportXml = $shopObj->getDocDeliveryJasperXml();
|
$reportXml = $shopObj->getDocDeliveryJasperXml();
|
||||||
$bg = $shopObj->getDocDeliveryBg();
|
$bg = $shopObj->getDocDeliveryBg();
|
||||||
$fileName = $shopObj->getDocDeliveryFileName();
|
$fileName = $shopObj->getDocDeliveryFileName();
|
||||||
$fileNameOrg = "delivery_" . $order->getUID() . ".pdf";
|
$fileNameOrg = "delivery_" . $order->getUID() . ".pdf";
|
||||||
break;
|
$addXRechnung = $shopObj->isDocDeliveryXML();
|
||||||
case self::LABEL:
|
break;
|
||||||
$reportXml = $shopObj->getDocLabelJasperXml();
|
case self::LABEL:
|
||||||
$bg = $shopObj->getDocLabelBg();
|
$reportXml = $shopObj->getDocLabelJasperXml();
|
||||||
$fileName = $shopObj->getDocLabelFileName();
|
$bg = $shopObj->getDocLabelBg();
|
||||||
$fileNameOrg = "label_" . $order->getUID() . ".pdf";
|
$fileName = $shopObj->getDocLabelFileName();
|
||||||
break;
|
$fileNameOrg = "label_" . $order->getUID() . ".pdf";
|
||||||
case self::JOBTICKET:
|
break;
|
||||||
$reportXml = $shopObj->getDocJobticketJasperXml();
|
case self::JOBTICKET:
|
||||||
$bg = $shopObj->getDocJobticketBg();
|
$reportXml = $shopObj->getDocJobticketJasperXml();
|
||||||
$fileName = $shopObj->getDocJobticketFileName();
|
$bg = $shopObj->getDocJobticketBg();
|
||||||
$fileNameOrg = "jobticket_" . $order->getUID() . ".pdf";
|
$fileName = $shopObj->getDocJobticketFileName();
|
||||||
break;
|
$fileNameOrg = "jobticket_" . $order->getUID() . ".pdf";
|
||||||
case self::JOBTICKET_PRINTPARTNER:
|
$addXRechnung = $shopObj->isDocJobticketXML();
|
||||||
$reportXml = $shopObj->getDocJobticketPPJasperXml();
|
break;
|
||||||
$bg = $shopObj->getDocJobticketPPBg();
|
case self::JOBTICKET_PRINTPARTNER:
|
||||||
$fileName = $shopObj->getDocJobticketPPFileName();
|
$reportXml = $shopObj->getDocJobticketPPJasperXml();
|
||||||
$fileNameOrg = "jobticketpp_" . $order->getUID() . ".pdf";
|
$bg = $shopObj->getDocJobticketPPBg();
|
||||||
break;
|
$fileName = $shopObj->getDocJobticketPPFileName();
|
||||||
case self::OFFER:
|
$fileNameOrg = "jobticketpp_" . $order->getUID() . ".pdf";
|
||||||
$reportXml = $shopObj->getDocOfferJasperXml();
|
break;
|
||||||
$bg = $shopObj->getDocOfferBg();
|
case self::OFFER:
|
||||||
$fileName = $shopObj->getDocOfferFileName();
|
$reportXml = $shopObj->getDocOfferJasperXml();
|
||||||
$fileNameOrg = "offer_" . $order->getUID() . ".pdf";
|
$bg = $shopObj->getDocOfferBg();
|
||||||
break;
|
$fileName = $shopObj->getDocOfferFileName();
|
||||||
case self::STORNO:
|
$fileNameOrg = "offer_" . $order->getUID() . ".pdf";
|
||||||
$reportXml = $shopObj->getDocStornoJasperXml();
|
$addXRechnung = $shopObj->isDocOfferXML();
|
||||||
$bg = $shopObj->getDocStornoBg();
|
break;
|
||||||
$fileName = $shopObj->getDocStornoFileName();
|
case self::STORNO:
|
||||||
$fileNameOrg = "storno_" . $order->getUID() . ".pdf";
|
$reportXml = $shopObj->getDocStornoJasperXml();
|
||||||
break;
|
$bg = $shopObj->getDocStornoBg();
|
||||||
case self::ORDER:
|
$fileName = $shopObj->getDocStornoFileName();
|
||||||
$reportXml = $shopObj->getDocOrderJasperXml();
|
$fileNameOrg = "storno_" . $order->getUID() . ".pdf";
|
||||||
$bg = $shopObj->getDocOrderBg();
|
$addXRechnung = $shopObj->isDocStornoXML();
|
||||||
$fileName = $shopObj->getDocOrderFileName();
|
break;
|
||||||
$fileNameOrg = "order_" . $order->getUID() . ".pdf";
|
case self::ORDER:
|
||||||
break;
|
$reportXml = $shopObj->getDocOrderJasperXml();
|
||||||
default:
|
$bg = $shopObj->getDocOrderBg();
|
||||||
case self::INVOICE:
|
$fileName = $shopObj->getDocOrderFileName();
|
||||||
$reportXml = $shopObj->getDocInvoiceJasperXml();
|
$fileNameOrg = "order_" . $order->getUID() . ".pdf";
|
||||||
$bg = $shopObj->getDocInvoiceBg();
|
$addXRechnung = $shopObj->isDocOrderXML();
|
||||||
$fileName = $shopObj->getDocInvoiceFileName();
|
break;
|
||||||
$fileNameOrg = "invoice_" . $order->getUID() . ".pdf";
|
default:
|
||||||
break;
|
case self::INVOICE:
|
||||||
|
$reportXml = $shopObj->getDocInvoiceJasperXml();
|
||||||
|
$bg = $shopObj->getDocInvoiceBg();
|
||||||
|
$fileName = $shopObj->getDocInvoiceFileName();
|
||||||
|
$fileNameOrg = "invoice_" . $order->getUID() . ".pdf";
|
||||||
|
$addXRechnung = $shopObj->isDocInvoiceXML();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($reportXml == "") {
|
if ($reportXml == "") {
|
||||||
@ -155,38 +191,6 @@ class Printing
|
|||||||
$this->fileName = $fileNameOrg;
|
$this->fileName = $fileNameOrg;
|
||||||
}
|
}
|
||||||
|
|
||||||
$document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_XRECHNUNG_2);
|
|
||||||
|
|
||||||
$document
|
|
||||||
->setDocumentInformation("471102", "380", \DateTime::createFromFormat("Ymd", "20180305"), "EUR")
|
|
||||||
->addDocumentNote('Rechnung gemäß Bestellung vom 01.03.2018.')
|
|
||||||
->setDocumentSupplyChainEvent(\DateTime::createFromFormat('Ymd', '20180305'))
|
|
||||||
->setDocumentSeller("Lieferant GmbH", "549910")
|
|
||||||
->addDocumentSellerGlobalId("4000001123452", "0088")
|
|
||||||
->addDocumentSellerTaxRegistration("FC", "201/113/40209")
|
|
||||||
->addDocumentSellerTaxRegistration("VA", "DE123456789")
|
|
||||||
->setDocumentSellerAddress("Lieferantenstraße 20", "", "", "80333", "München", "DE")
|
|
||||||
->setDocumentBuyer("Kunden AG Mitte", "GE2020211")
|
|
||||||
->setDocumentBuyerAddress("Kundenstraße 15", "", "", "69876", "Frankfurt", "DE")
|
|
||||||
->addDocumentTax("S", "VAT", 275.0, 19.25, 7.0)
|
|
||||||
->addDocumentTax("S", "VAT", 198.0, 37.02, 19.0)
|
|
||||||
->setDocumentSummation(529.87, 529.87, 473.00, 0.0, 0.0, 473.00, 56.87, null, 0.0)
|
|
||||||
->addDocumentPaymentTerm("Zahlbar innerhalb 30 Tagen netto bis 04.04.2018, 3% Skonto innerhalb 10 Tagen bis 15.03.2018")
|
|
||||||
->addNewPosition("1")
|
|
||||||
->setDocumentPositionProductDetails("Trennblätter A4", "", "TB100A4", null, "0160", "4012345001235")
|
|
||||||
->setDocumentPositionGrossPrice(9.9000)
|
|
||||||
->setDocumentPositionNetPrice(9.9000)
|
|
||||||
->setDocumentPositionQuantity(20, "H87")
|
|
||||||
->addDocumentPositionTax('S', 'VAT', 19)
|
|
||||||
->setDocumentPositionLineSummation(198.0)
|
|
||||||
->addNewPosition("2")
|
|
||||||
->setDocumentPositionProductDetails("Joghurt Banane", "", "ARNR2", null, "0160", "4000050986428")
|
|
||||||
->SetDocumentPositionGrossPrice(5.5000)
|
|
||||||
->SetDocumentPositionNetPrice(5.5000)
|
|
||||||
->SetDocumentPositionQuantity(50, "H87")
|
|
||||||
->AddDocumentPositionTax('S', 'VAT', 7)
|
|
||||||
->SetDocumentPositionLineSummation(275.0);
|
|
||||||
|
|
||||||
if ($bg) {
|
if ($bg) {
|
||||||
/**
|
/**
|
||||||
* @var Media $bg
|
* @var Media $bg
|
||||||
@ -220,8 +224,41 @@ class Printing
|
|||||||
$this->mpdf->WriteHTML($html);
|
$this->mpdf->WriteHTML($html);
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $this->mpdf->Output(null, \Mpdf\Output\Destination::STRING_RETURN);
|
if($addXRechnung) {
|
||||||
$output = (new ZugferdDocumentPdfMerger($document->getContent(), $output))->generateDocument()->downloadString("file");
|
$orderModel = $this->orderService->getOrderByUuid($order->getUuid());
|
||||||
|
$document = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_XRECHNUNG_2);
|
||||||
|
|
||||||
|
$document
|
||||||
|
->setDocumentInformation($orderModel->getAlias(), "380", $orderModel->getCreated(), "EUR")
|
||||||
|
->addDocumentNote('Rechnung gemäß Bestellung vom ' . $orderModel->getCreated()->format('d.m.Y'))
|
||||||
|
->setDocumentSupplyChainEvent($orderModel->getCreated())
|
||||||
|
->setDocumentSeller($orderModel->getSenderAddress()->getCompany() . ' ' . $orderModel->getSenderAddress()->getFirstname() . ' ' . $orderModel->getSenderAddress()->getLastname(), "549910")
|
||||||
|
->setDocumentSellerAddress($orderModel->getSenderAddress()->getStreet() . ' ' . $orderModel->getSenderAddress()->getHouseNumber(), "", "", $orderModel->getSenderAddress()->getZip(), $orderModel->getSenderAddress()->getCity(), $orderModel->getSenderAddress()->getCountry())
|
||||||
|
->setDocumentBuyer($orderModel->getInvoiceAddress()->getCompany() . ' ' . $orderModel->getInvoiceAddress()->getFirstname() . ' ' . $orderModel->getInvoiceAddress()->getLastname(), $orderModel->getInvoiceAddress()->getKundenNr())
|
||||||
|
->setDocumentBuyerAddress($orderModel->getInvoiceAddress()->getStreet() . ' ' . $orderModel->getInvoiceAddress()->getHouseNumber(), "", "", $orderModel->getInvoiceAddress()->getZip(), $orderModel->getInvoiceAddress()->getCity(), $orderModel->getInvoiceAddress()->getCountry());
|
||||||
|
|
||||||
|
foreach($orderModel->getTaxes() as $tax) {
|
||||||
|
$document->addDocumentTax("S", "VAT", $tax->getValue() / 100, $tax->getValue() / 100, $tax->getName() / 100);
|
||||||
|
}
|
||||||
|
$document
|
||||||
|
->setDocumentSummation($orderModel->getGross() / 100, $orderModel->getGross() / 100, $orderModel->getNet() / 100, 0.0, 0.0, $orderModel->getNet() / 100, $orderModel->getTaxesSum() / 100, null, 0.0);
|
||||||
|
|
||||||
|
foreach($orderModel->getPositions() as $position) {
|
||||||
|
$document
|
||||||
|
->addNewPosition($position->getPos())
|
||||||
|
->setDocumentPositionProductDetails($position->getProduct()->getTitle())
|
||||||
|
->setDocumentPositionGrossPrice($position->getPrice()->getGross() / 100)
|
||||||
|
->setDocumentPositionNetPrice($position->getPrice()->getNet() / 100)
|
||||||
|
->setDocumentPositionQuantity(1, "H87")
|
||||||
|
->addDocumentPositionTax('S', 'VAT', $position->getPrice()->getTax()->getName() / 100)
|
||||||
|
->setDocumentPositionLineSummation($position->getPrice()->getNet() / 100)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
$output = $this->mpdf->Output(null, \Mpdf\Output\Destination::STRING_RETURN);
|
||||||
|
$output = (new ZugferdDocumentPdfMerger($document->getContent(), $output))->generateDocument()->downloadString("file");
|
||||||
|
} else {
|
||||||
|
$output = $this->mpdf->Output(null, \Mpdf\Output\Destination::STRING_RETURN);
|
||||||
|
}
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,39 +292,39 @@ class Printing
|
|||||||
|
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::DELIVERY:
|
case self::DELIVERY:
|
||||||
$reportXml = $shopObj->getDocDeliveryPosition();
|
$reportXml = $shopObj->getDocDeliveryPosition();
|
||||||
$bg = $shopObj->getDocDeliveryPositionBg();
|
$bg = $shopObj->getDocDeliveryPositionBg();
|
||||||
break;
|
break;
|
||||||
case self::LABEL:
|
case self::LABEL:
|
||||||
$reportXml = $shopObj->getDocLabelPosition();
|
$reportXml = $shopObj->getDocLabelPosition();
|
||||||
$bg = $shopObj->getDocLabelPositionBg();
|
$bg = $shopObj->getDocLabelPositionBg();
|
||||||
break;
|
break;
|
||||||
case self::JOBTICKET:
|
case self::JOBTICKET:
|
||||||
$reportXml = $shopObj->getDocJobticketPosition();
|
$reportXml = $shopObj->getDocJobticketPosition();
|
||||||
$bg = $shopObj->getDocJobticketPositionBg();
|
$bg = $shopObj->getDocJobticketPositionBg();
|
||||||
break;
|
break;
|
||||||
case self::JOBTICKET_PRINTPARTNER:
|
case self::JOBTICKET_PRINTPARTNER:
|
||||||
$reportXml = $shopObj->getDocJobticketPPPosition();
|
$reportXml = $shopObj->getDocJobticketPPPosition();
|
||||||
$bg = $shopObj->getDocJobticketPPPositionBg();
|
$bg = $shopObj->getDocJobticketPPPositionBg();
|
||||||
break;
|
break;
|
||||||
case self::OFFER:
|
case self::OFFER:
|
||||||
$reportXml = $shopObj->getDocOfferPosition();
|
$reportXml = $shopObj->getDocOfferPosition();
|
||||||
$bg = $shopObj->getDocOfferPositionBg();
|
$bg = $shopObj->getDocOfferPositionBg();
|
||||||
break;
|
break;
|
||||||
case self::STORNO:
|
case self::STORNO:
|
||||||
$reportXml = $shopObj->getDocStornoPosition();
|
$reportXml = $shopObj->getDocStornoPosition();
|
||||||
$bg = $shopObj->getDocStornoPositionBg();
|
$bg = $shopObj->getDocStornoPositionBg();
|
||||||
break;
|
break;
|
||||||
case self::ORDER:
|
case self::ORDER:
|
||||||
$reportXml = $shopObj->getDocOrderPosition();
|
$reportXml = $shopObj->getDocOrderPosition();
|
||||||
$bg = $shopObj->getDocOrderPositionBg();
|
$bg = $shopObj->getDocOrderPositionBg();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case self::INVOICE:
|
case self::INVOICE:
|
||||||
$reportXml = $shopObj->getDocInvoicePosition();
|
$reportXml = $shopObj->getDocInvoicePosition();
|
||||||
$bg = $shopObj->getDocInvoicePositionBg();
|
$bg = $shopObj->getDocInvoicePositionBg();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($reportXml == "") {
|
if ($reportXml == "") {
|
||||||
@ -330,7 +367,7 @@ class Printing
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateProductOffer(Product $product, Contact $contact, $count, $options, $netto, $steuer, $brutto, $xmlProduct = "")
|
public function generateProductOffer(Product $product, Contact $contact, $count, $options, $additionalInfos, $netto, $steuer, $brutto, $xmlProduct = "")
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \PSC\Shop\EntityBundle\Entity\Shop $shop
|
* @var \PSC\Shop\EntityBundle\Entity\Shop $shop
|
||||||
@ -350,7 +387,7 @@ class Printing
|
|||||||
$this->mpdf = new \Mpdf\Mpdf(['tempDir' => sys_get_temp_dir(), 'setAutoTopMargin' => 'false']);
|
$this->mpdf = new \Mpdf\Mpdf(['tempDir' => sys_get_temp_dir(), 'setAutoTopMargin' => 'false']);
|
||||||
|
|
||||||
$twig = $this->twig->createTemplate($reportXml);
|
$twig = $this->twig->createTemplate($reportXml);
|
||||||
$html = $twig->render($this->templateVars->getProductTwigVars($product, $contact, $count, $options, $netto, $steuer, $brutto, $xmlProduct));
|
$html = $twig->render($this->templateVars->getProductTwigVars($product, $contact, $count, $options, $additionalInfos, $netto, $steuer, $brutto, $xmlProduct));
|
||||||
|
|
||||||
if ($bg) {
|
if ($bg) {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -17,12 +17,13 @@ class Shop
|
|||||||
{
|
{
|
||||||
protected $currentShopForMail;
|
protected $currentShopForMail;
|
||||||
|
|
||||||
public function __construct(protected EntityManagerInterface $entityManager,
|
public function __construct(
|
||||||
protected TokenStorageInterface $tokenStorage,
|
protected EntityManagerInterface $entityManager,
|
||||||
protected DocumentManager $mongoManager,
|
protected TokenStorageInterface $tokenStorage,
|
||||||
protected RequestStack $requestStack,
|
protected DocumentManager $mongoManager,
|
||||||
protected \PSC\Component\ApiBundle\Hydrate\Shop $shopHydrate)
|
protected RequestStack $requestStack,
|
||||||
{
|
protected \PSC\Component\ApiBundle\Hydrate\Shop $shopHydrate
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,11 +72,11 @@ class Shop
|
|||||||
public function getShopByUid($uid)
|
public function getShopByUid($uid)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(strlen($uid) < 20) {
|
if (strlen($uid) < 20) {
|
||||||
$selectedShop = $this->entityManager
|
$selectedShop = $this->entityManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Shop')->findOneBy(array('uid' => (string)$uid));
|
->getRepository('PSC\Shop\EntityBundle\Entity\Shop')->findOneBy(array('uid' => (string)$uid));
|
||||||
|
|
||||||
if(!$selectedShop) {
|
if (!$selectedShop) {
|
||||||
$selectedShop = $this->entityManager
|
$selectedShop = $this->entityManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Shop')->findOneBy(array('uuid' => $uid));
|
->getRepository('PSC\Shop\EntityBundle\Entity\Shop')->findOneBy(array('uuid' => $uid));
|
||||||
}
|
}
|
||||||
@ -128,9 +129,6 @@ class Shop
|
|||||||
$selectedShop = $this->entityManager
|
$selectedShop = $this->entityManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Domain')->findOneBy(['host' => $_SERVER["SERVER_NAME"]]);
|
->getRepository('PSC\Shop\EntityBundle\Entity\Domain')->findOneBy(['host' => $_SERVER["SERVER_NAME"]]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!$selectedShop) {
|
if (!$selectedShop) {
|
||||||
$selectedShop = $this->entityManager
|
$selectedShop = $this->entityManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Shop')->findAll()[0];
|
->getRepository('PSC\Shop\EntityBundle\Entity\Shop')->findAll()[0];
|
||||||
@ -141,7 +139,8 @@ class Shop
|
|||||||
return $selectedShop->getShop();
|
return $selectedShop->getShop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShopByDomainModel(): \PSC\Component\ApiBundle\Model\Shop {
|
public function getShopByDomainModel(): \PSC\Component\ApiBundle\Model\Shop
|
||||||
|
{
|
||||||
return $this->shopHydrate->hydrateToModel($this->getShopByDomain());
|
return $this->shopHydrate->hydrateToModel($this->getShopByDomain());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,8 @@ use PSC\Shop\EntityBundle\Entity\ContactAddress;
|
|||||||
use PSC\Shop\EntityBundle\Entity\Layoutdesigndata;
|
use PSC\Shop\EntityBundle\Entity\Layoutdesigndata;
|
||||||
use PSC\Shop\EntityBundle\Entity\Orderpos;
|
use PSC\Shop\EntityBundle\Entity\Orderpos;
|
||||||
use PSC\Shop\EntityBundle\Entity\Product;
|
use PSC\Shop\EntityBundle\Entity\Product;
|
||||||
|
use PSC\Shop\OrderBundle\Model\Base;
|
||||||
|
use PSC\Shop\OrderBundle\Service\Order;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
@ -59,9 +61,13 @@ class TemplateVars
|
|||||||
/** @var Orderpos */
|
/** @var Orderpos */
|
||||||
protected $positions;
|
protected $positions;
|
||||||
|
|
||||||
|
protected Order $orderService;
|
||||||
|
|
||||||
|
protected Base $orderModel;
|
||||||
|
|
||||||
protected $twigVars = array();
|
protected $twigVars = array();
|
||||||
|
|
||||||
public function __construct($projectDir, EntityManagerInterface $em, TokenStorageInterface $tokenStorage, DocumentManager $mongoManager, Environment $twig, PaperDB $paperDb)
|
public function __construct($projectDir, EntityManagerInterface $em, TokenStorageInterface $tokenStorage, DocumentManager $mongoManager, Environment $twig, PaperDB $paperDb, Order $orderService)
|
||||||
{
|
{
|
||||||
$this->entityManager = $em;
|
$this->entityManager = $em;
|
||||||
$this->tokenStorage = $tokenStorage;
|
$this->tokenStorage = $tokenStorage;
|
||||||
@ -69,6 +75,7 @@ class TemplateVars
|
|||||||
$this->projectDir = $projectDir;
|
$this->projectDir = $projectDir;
|
||||||
$this->twig = $twig;
|
$this->twig = $twig;
|
||||||
$this->paperDb = $paperDb;
|
$this->paperDb = $paperDb;
|
||||||
|
$this->orderService = $orderService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -83,6 +90,7 @@ class TemplateVars
|
|||||||
|
|
||||||
$this->order = $orderRepo->findOneBy(array('uuid' => $uuid));
|
$this->order = $orderRepo->findOneBy(array('uuid' => $uuid));
|
||||||
$this->positions = $this->order->getPositions();
|
$this->positions = $this->order->getPositions();
|
||||||
|
$this->orderModel = $this->orderService->getOrderByUuid($uuid);
|
||||||
$this->generateTwigVars();
|
$this->generateTwigVars();
|
||||||
|
|
||||||
$this->loaded = true;
|
$this->loaded = true;
|
||||||
@ -187,7 +195,7 @@ class TemplateVars
|
|||||||
$engine->setActiveArticle($objDoc->getSpecialProductTypeObject()['kalk_artikel']);
|
$engine->setActiveArticle($objDoc->getSpecialProductTypeObject()['kalk_artikel']);
|
||||||
}
|
}
|
||||||
$engine->calc();
|
$engine->calc();
|
||||||
}else{
|
} else {
|
||||||
$engine->setVariables($objPosition->getOptions());
|
$engine->setVariables($objPosition->getOptions());
|
||||||
if(isset($objPosition->getOptions()['kalk_artikel'])) {
|
if(isset($objPosition->getOptions()['kalk_artikel'])) {
|
||||||
$engine->setActiveArticle($objPosition->getOptions()['kalk_artikel']);
|
$engine->setActiveArticle($objPosition->getOptions()['kalk_artikel']);
|
||||||
@ -367,7 +375,8 @@ class TemplateVars
|
|||||||
'order' => $this->order,
|
'order' => $this->order,
|
||||||
'orderObj' => $orderObj,
|
'orderObj' => $orderObj,
|
||||||
'orderDoc' => $orderObj,
|
'orderDoc' => $orderObj,
|
||||||
'positions' => $positions
|
'positions' => $positions,
|
||||||
|
'orderModel' => $this->orderModel
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +410,7 @@ class TemplateVars
|
|||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProductTwigVars(Product $product, Contact $contact, $count, $options, $netto, $steuer, $brutto, $xmlProduct = "")
|
public function getProductTwigVars(Product $product, Contact $contact, $count, $options, $additionalInfos, $netto, $steuer, $brutto, $xmlProduct = "")
|
||||||
{
|
{
|
||||||
$shop = $product->getShop();
|
$shop = $product->getShop();
|
||||||
|
|
||||||
@ -422,8 +431,7 @@ class TemplateVars
|
|||||||
|
|
||||||
|
|
||||||
$anonym = true;
|
$anonym = true;
|
||||||
|
if ($contact->getUid() != null) {
|
||||||
if ($contact->getUsername() != 'anonymus') {
|
|
||||||
$account = $contact->getAccount();
|
$account = $contact->getAccount();
|
||||||
$invoiceAddress = $contact->getStandartInvoice();
|
$invoiceAddress = $contact->getStandartInvoice();
|
||||||
$deliveryAddress = $contact->getStandartDelivery();
|
$deliveryAddress = $contact->getStandartDelivery();
|
||||||
@ -490,9 +498,9 @@ class TemplateVars
|
|||||||
'netto' => $netto,
|
'netto' => $netto,
|
||||||
'steuer' => $steuer,
|
'steuer' => $steuer,
|
||||||
'brutto' => $brutto,
|
'brutto' => $brutto,
|
||||||
|
'additionalInfos' => $additionalInfos
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var \PSC\Shop\EntityBundle\Document\Shop $shop */
|
/** @var \PSC\Shop\EntityBundle\Document\Shop $shop */
|
||||||
$shopDoc = $this->mongoManager
|
$shopDoc = $this->mongoManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Document\Shop')
|
->getRepository('PSC\Shop\EntityBundle\Document\Shop')
|
||||||
@ -510,7 +518,7 @@ class TemplateVars
|
|||||||
'shopObj' => $shopDoc,
|
'shopObj' => $shopDoc,
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'productObj' => $productDoc,
|
'productObj' => $productDoc,
|
||||||
'pos' => $tmp
|
'pos' => $tmp,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class Barcode extends Node
|
|||||||
{
|
{
|
||||||
if ($this->hasNode('parameters')) {
|
if ($this->hasNode('parameters')) {
|
||||||
$compiler->raw('$_options = ')->subcompile($this->getNode('parameters'))->raw(';');
|
$compiler->raw('$_options = ')->subcompile($this->getNode('parameters'))->raw(';');
|
||||||
}else{
|
} else {
|
||||||
$compiler->raw('$_options = [];');
|
$compiler->raw('$_options = [];');
|
||||||
}
|
}
|
||||||
$node = $this->getNode('body');
|
$node = $this->getNode('body');
|
||||||
@ -40,49 +40,74 @@ class Barcode extends Node
|
|||||||
->raw(PHP_EOL);
|
->raw(PHP_EOL);
|
||||||
$compiler->raw(
|
$compiler->raw(
|
||||||
'
|
'
|
||||||
$options = new \chillerlan\QRCode\QROptions();
|
$options = new \PSC\System\SettingsBundle\Barcode\QRGdWithLogoOptions();
|
||||||
$options->version = \chillerlan\QRCode\Common\Version::AUTO;
|
$options->version = 7;
|
||||||
$options->outputInterface = \chillerlan\QRCode\Output\QRMarkupSVG::class;
|
$options->eccLevel = \chillerlan\QRCode\Common\EccLevel::H;
|
||||||
$options->bgColor = $_options["bgcolor"]?? "rgb(255, 255, 255)";
|
$options->outputType = \chillerlan\QRCode\Output\QROutputInterface::CUSTOM;
|
||||||
$options->outputBase64 = false;
|
if(isset($_options["logo"]) && $_options["logo"] == true) {
|
||||||
$options->svgAddXmlHeader = false;
|
$options->logo = $_options["logo"];
|
||||||
if(isset($_options["width"]) && $_options["width"] != 0) {
|
if(isset($_options["melt"]) && $_options["melt"] == true) {
|
||||||
$options->svgWidth = (string)$_options["width"];
|
$options->outputInterface = \PSC\System\SettingsBundle\Barcode\QRGdRounded::class;
|
||||||
}else{
|
}else{
|
||||||
$options->svgWidth = "20";
|
$options->outputInterface = \chillerlan\QRCode\Output\QRGdImagePNG::class;
|
||||||
}
|
}
|
||||||
if(isset($_options["height"]) && $_options["height"] != 0) {
|
}else{
|
||||||
$options->svgHeight = (string)$_options["height"];
|
if(isset($_options["melt"]) && $_options["melt"] == true) {
|
||||||
}else{
|
$options->outputInterface = \PSC\System\SettingsBundle\Barcode\QRGdRounded::class;
|
||||||
$options->svgHeight = "20";
|
}else{
|
||||||
}
|
$options->outputInterface = \chillerlan\QRCode\Output\QRGdImagePNG::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$options->outputBase64 = false;
|
||||||
|
$options->scale = 30;
|
||||||
|
if(isset($_options["logo"]) && $_options["logo"] !== "") {
|
||||||
|
$options->addLogoSpace = true;
|
||||||
|
$options->logoSpaceWidth = 13;
|
||||||
|
$options->logoSpaceHeight = 13;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_options["color"]) && !is_array($_options["color"])) {
|
||||||
|
unset($_options["color"]);
|
||||||
|
}
|
||||||
|
if(isset($_options["finderdot"]) && !is_array($_options["finderdot"])) {
|
||||||
|
unset($_options["finderdot"]);
|
||||||
|
}
|
||||||
|
if(isset($_options["finderdotdark"]) && !is_array($_options["finderdotdark"])) {
|
||||||
|
unset($_options["finderdotdark"]);
|
||||||
|
}
|
||||||
|
if(isset($_options["bgcolor"]) && !is_array($_options["bgcolor"])) {
|
||||||
|
unset($_options["bgcolor"]);
|
||||||
|
}
|
||||||
$options->moduleValues = [
|
$options->moduleValues = [
|
||||||
// finder
|
// finder
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_FINDER_DARK => $_options["finderdotdark"]?? "rgb(0, 0, 0)",
|
\chillerlan\QRCode\Data\QRMatrix::M_FINDER_DARK => $_options["finderdotdark"]?? [0, 0, 0],
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_FINDER_DOT => $_options["finderdot"]?? "rgb(0, 0, 0)",
|
\chillerlan\QRCode\Data\QRMatrix::M_FINDER_DOT => $_options["finderdot"]?? [0, 0, 0],
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_FINDER => $_options["bgcolor"]?? "rgb(255, 255, 255)",
|
\chillerlan\QRCode\Data\QRMatrix::M_FINDER => $_options["bgcolor"]?? [255, 255, 255],
|
||||||
// alignment
|
// alignment
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_ALIGNMENT_DARK => $_options["color"]?? "rgb(0, 0, 0)",
|
\chillerlan\QRCode\Data\QRMatrix::M_ALIGNMENT_DARK => $_options["color"]?? [0, 0, 0],
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_ALIGNMENT => $_options["bgcolor"]?? "rgb(255, 255, 255)",
|
\chillerlan\QRCode\Data\QRMatrix::M_ALIGNMENT => $_options["bgcolor"]?? [255, 255, 255],
|
||||||
// timing
|
// timing
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_TIMING_DARK => $_options["color"]?? "rgb(0, 0, 0)",
|
\chillerlan\QRCode\Data\QRMatrix::M_TIMING_DARK => $_options["color"]?? [0, 0, 0],
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_TIMING => $_options["bgcolor"]?? "rgb(255, 255, 255)",
|
\chillerlan\QRCode\Data\QRMatrix::M_TIMING => $_options["bgcolor"]?? [255, 255, 255],
|
||||||
// format
|
// format
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_FORMAT_DARK => $_options["color"]?? "rgb(0, 0, 0)",
|
\chillerlan\QRCode\Data\QRMatrix::M_FORMAT_DARK => $_options["color"]?? [0, 0, 0],
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_FORMAT => $_options["bgcolor"]?? "rgb(255, 255, 255)",
|
\chillerlan\QRCode\Data\QRMatrix::M_FORMAT => $_options["bgcolor"]?? [255, 255, 255],
|
||||||
// version
|
// version
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_VERSION_DARK => $_options["color"]?? "rgb(0, 0, 0)",
|
\chillerlan\QRCode\Data\QRMatrix::M_VERSION_DARK => $_options["color"]?? [0, 0, 0],
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_VERSION => $_options["bgcolor"]?? "rgb(255, 255, 255)",
|
\chillerlan\QRCode\Data\QRMatrix::M_VERSION => $_options["bgcolor"]?? [255, 255, 255],
|
||||||
// data
|
// data
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_DATA_DARK => $_options["color"]?? "rgb(0, 0, 0)",
|
\chillerlan\QRCode\Data\QRMatrix::M_DATA_DARK => $_options["color"]?? [0, 0, 0],
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_DATA => $_options["bgcolor"]?? "rgb(255, 255, 255)",
|
\chillerlan\QRCode\Data\QRMatrix::M_DATA => $_options["bgcolor"]?? [255, 255, 255],
|
||||||
// darkmodule
|
// darkmodule
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_DARKMODULE => $_options["color"]?? "rgb(0, 0, 0)",
|
\chillerlan\QRCode\Data\QRMatrix::M_DARKMODULE => $_options["color"]?? [0, 0, 0],
|
||||||
// separator
|
// separator
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_QUIETZONE => $_options["bgcolor"]?? "rgb(255, 255, 255)",
|
\chillerlan\QRCode\Data\QRMatrix::M_QUIETZONE => $_options["bgcolor"]?? [255, 255, 255],
|
||||||
\chillerlan\QRCode\Data\QRMatrix::M_SEPARATOR => $_options["bgcolor"]?? "rgb(255, 255, 255)",
|
\chillerlan\QRCode\Data\QRMatrix::M_SEPARATOR => $_options["bgcolor"]?? [255, 255, 255],
|
||||||
];
|
];
|
||||||
echo (new \chillerlan\QRCode\QRCode($options))->render(trim($context["barcode"]));'
|
$filename = md5(trim($context["barcode"])).".png";
|
||||||
|
(new \chillerlan\QRCode\QRCode($options))->render(trim($context["barcode"]), "/tmp/" . $filename);
|
||||||
|
echo "<img src=\"/tmp/$filename\" />";
|
||||||
|
'
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -814,6 +814,15 @@
|
|||||||
"symfony/service-contracts": {
|
"symfony/service-contracts": {
|
||||||
"version": "v2.0.1"
|
"version": "v2.0.1"
|
||||||
},
|
},
|
||||||
|
"symfony/stimulus-bundle": {
|
||||||
|
"version": "2.19",
|
||||||
|
"recipe": {
|
||||||
|
"repo": "github.com/symfony/recipes",
|
||||||
|
"branch": "main",
|
||||||
|
"version": "2.8",
|
||||||
|
"ref": "9e33a8a3794b603fb4be6c04ee5ecab901ce549e"
|
||||||
|
}
|
||||||
|
},
|
||||||
"symfony/stopwatch": {
|
"symfony/stopwatch": {
|
||||||
"version": "v5.1.2"
|
"version": "v5.1.2"
|
||||||
},
|
},
|
||||||
@ -868,6 +877,9 @@
|
|||||||
"config/routes/ux_autocomplete.yaml"
|
"config/routes/ux_autocomplete.yaml"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"symfony/ux-chartjs": {
|
||||||
|
"version": "v2.19.3"
|
||||||
|
},
|
||||||
"symfony/ux-live-component": {
|
"symfony/ux-live-component": {
|
||||||
"version": "2.12",
|
"version": "2.12",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
|
|||||||
@ -9,7 +9,6 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
|||||||
|
|
||||||
class OrdersTest extends KernelTestCase
|
class OrdersTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
use RefreshDatabaseTrait;
|
use RefreshDatabaseTrait;
|
||||||
|
|
||||||
private \Doctrine\ORM\EntityManager $entityManager;
|
private \Doctrine\ORM\EntityManager $entityManager;
|
||||||
@ -23,10 +22,11 @@ class OrdersTest extends KernelTestCase
|
|||||||
->getManager();
|
->getManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCreateOrderPos() {
|
public function testCreateOrderPos()
|
||||||
|
{
|
||||||
|
|
||||||
$order = new Order();
|
$order = new Order();
|
||||||
|
$order->setUuid("1234-1234-12345-12345-1234");
|
||||||
$this->entityManager->persist($order);
|
$this->entityManager->persist($order);
|
||||||
|
|
||||||
$orderpos = new Orderpos();
|
$orderpos = new Orderpos();
|
||||||
|
|||||||
37
src/new/tests/PSC/Shop/Media/Api/UploadTest.php
Normal file
37
src/new/tests/PSC/Shop/Media/Api/UploadTest.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Tests\PSC\Shop\Media\Api;
|
||||||
|
|
||||||
|
use PSC\Shop\ContactBundle\Repository\ContactRepository;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
use Tests\RefreshDatabaseTrait;
|
||||||
|
|
||||||
|
class UploadTest extends WebTestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabaseTrait;
|
||||||
|
|
||||||
|
public function testUploadMedia(): void
|
||||||
|
{
|
||||||
|
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||||
|
$client = static::createClient();
|
||||||
|
|
||||||
|
$userRepository = static::getContainer()->get(ContactRepository::class);
|
||||||
|
|
||||||
|
$testUser = $userRepository->loadUserByUsername('admin@shop.de');
|
||||||
|
|
||||||
|
$client->loginUser($testUser, 'api');
|
||||||
|
|
||||||
|
$uploadedFile = new UploadedFile(
|
||||||
|
__DIR__.'/../../../../kenny.jpg',
|
||||||
|
'kenney.jpg'
|
||||||
|
);
|
||||||
|
$client->request('POST', '/api/media/create', [], [
|
||||||
|
'file' => $uploadedFile
|
||||||
|
]);
|
||||||
|
|
||||||
|
$media = json_decode($client->getResponse()->getContent(), true);
|
||||||
|
|
||||||
|
self::assertSame('kenney.jpg', $media['title']);
|
||||||
|
}
|
||||||
|
}
|
||||||
86
src/new/tests/PSC/Shop/Media/Api/UploadVariantTest.php
Normal file
86
src/new/tests/PSC/Shop/Media/Api/UploadVariantTest.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Tests\PSC\Shop\Media\Api;
|
||||||
|
|
||||||
|
use PSC\Shop\ContactBundle\Repository\ContactRepository;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
|
use Tests\RefreshDatabaseTrait;
|
||||||
|
|
||||||
|
class UploadVariantTest extends WebTestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabaseTrait;
|
||||||
|
|
||||||
|
public function testUploadMedia(): void
|
||||||
|
{
|
||||||
|
$_SERVER['SERVER_NAME'] = 'localhost';
|
||||||
|
$client = static::createClient();
|
||||||
|
|
||||||
|
$userRepository = static::getContainer()->get(ContactRepository::class);
|
||||||
|
|
||||||
|
$testUser = $userRepository->loadUserByUsername('admin@shop.de');
|
||||||
|
|
||||||
|
$client->loginUser($testUser, 'api');
|
||||||
|
|
||||||
|
$uploadedFile = new UploadedFile(
|
||||||
|
__DIR__.'/../../../../kenny.jpg',
|
||||||
|
'kenney.jpg'
|
||||||
|
);
|
||||||
|
$client->request('POST', '/api/media/create', [], [
|
||||||
|
'file' => $uploadedFile
|
||||||
|
]);
|
||||||
|
|
||||||
|
$media = json_decode($client->getResponse()->getContent(), true);
|
||||||
|
|
||||||
|
self::assertSame('kenney.jpg', $media['title']);
|
||||||
|
self::assertNotEmpty($media['url']);
|
||||||
|
|
||||||
|
$uploadedFile = new UploadedFile(
|
||||||
|
__DIR__.'/../../../../kenny_crop.jpg',
|
||||||
|
'kenny_crop.jpg'
|
||||||
|
);
|
||||||
|
$client->request('POST', '/api/media/variant/create', [
|
||||||
|
'uuid' => $media['uuid'],
|
||||||
|
'settings' => '1/2'
|
||||||
|
], [
|
||||||
|
'file' => $uploadedFile
|
||||||
|
]);
|
||||||
|
|
||||||
|
$mediaVariant = json_decode($client->getResponse()->getContent(), true);
|
||||||
|
self::assertNotEmpty($mediaVariant['variants'][0]['url']);
|
||||||
|
self::assertSame('kenny-crop.jpg', $mediaVariant['variants'][0]['title']);
|
||||||
|
self::assertCount(1, $mediaVariant['variants']);
|
||||||
|
|
||||||
|
$uploadedFile = new UploadedFile(
|
||||||
|
__DIR__.'/../../../../kenny_crop1.jpg',
|
||||||
|
'kenny_crop1.jpg'
|
||||||
|
);
|
||||||
|
$client->request('POST', '/api/media/variant/create', [
|
||||||
|
'uuid' => $media['uuid'],
|
||||||
|
'settings' => '1/4'
|
||||||
|
], [
|
||||||
|
'file' => $uploadedFile
|
||||||
|
]);
|
||||||
|
|
||||||
|
$mediaVariant = json_decode($client->getResponse()->getContent(), true);
|
||||||
|
self::assertNotEmpty($mediaVariant['variants'][1]['url']);
|
||||||
|
self::assertSame('kenny-crop1.jpg', $mediaVariant['variants'][1]['title']);
|
||||||
|
self::assertCount(2, $mediaVariant['variants']);
|
||||||
|
|
||||||
|
$uploadedFile = new UploadedFile(
|
||||||
|
__DIR__.'/../../../../kenny_crop_better.jpg',
|
||||||
|
'kenny_crop_better.jpg'
|
||||||
|
);
|
||||||
|
$client->request('POST', '/api/media/variant/create', [
|
||||||
|
'uuid' => $media['uuid'],
|
||||||
|
'settings' => '1/2'
|
||||||
|
], [
|
||||||
|
'file' => $uploadedFile
|
||||||
|
]);
|
||||||
|
|
||||||
|
$mediaVariant = json_decode($client->getResponse()->getContent(), true);
|
||||||
|
self::assertNotEmpty($mediaVariant['variants'][1]['url']);
|
||||||
|
self::assertCount(2, $mediaVariant['variants']);
|
||||||
|
self::assertSame('kenny-crop-better.jpg', $mediaVariant['variants'][0]['title']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Tests;
|
namespace Tests;
|
||||||
@ -11,6 +12,7 @@ use PSC\Shop\EntityBundle\Document\Instance;
|
|||||||
use PSC\Shop\EntityBundle\Document\Order;
|
use PSC\Shop\EntityBundle\Document\Order;
|
||||||
use PSC\Shop\EntityBundle\Document\Position;
|
use PSC\Shop\EntityBundle\Document\Position;
|
||||||
use PSC\Shop\EntityBundle\Document\Shop;
|
use PSC\Shop\EntityBundle\Document\Shop;
|
||||||
|
use PSC\Shop\MediaBundle\Document\Media;
|
||||||
use PSC\System\PluginBundle\Document\Plugin;
|
use PSC\System\PluginBundle\Document\Plugin;
|
||||||
use Symfony\Component\HttpKernel\KernelInterface;
|
use Symfony\Component\HttpKernel\KernelInterface;
|
||||||
|
|
||||||
@ -38,12 +40,13 @@ trait RefreshDatabaseTrait
|
|||||||
/** @var DocumentManager $doc */
|
/** @var DocumentManager $doc */
|
||||||
$doc = $container->get('doctrine_mongodb.odm.document_manager');
|
$doc = $container->get('doctrine_mongodb.odm.document_manager');
|
||||||
|
|
||||||
|
$doc->getSchemaManager()->dropDocumentCollection(Media::class);
|
||||||
$doc->getSchemaManager()->dropDocumentCollection(Order::class);
|
$doc->getSchemaManager()->dropDocumentCollection(Order::class);
|
||||||
$doc->getSchemaManager()->dropDocumentCollection(Position::class);
|
$doc->getSchemaManager()->dropDocumentCollection(Position::class);
|
||||||
$doc->getSchemaManager()->dropDocumentCollection(Instance::class);
|
$doc->getSchemaManager()->dropDocumentCollection(Instance::class);
|
||||||
$doc->getSchemaManager()->dropDocumentCollection(Shop::class);
|
$doc->getSchemaManager()->dropDocumentCollection(Shop::class);
|
||||||
|
|
||||||
if(!$doc->getRepository(Plugin::class)->findOneBy(['pluginId' => '19ff3fd21de9dbd7452fd0a67c928758'])) {
|
if (!$doc->getRepository(Plugin::class)->findOneBy(['pluginId' => '19ff3fd21de9dbd7452fd0a67c928758'])) {
|
||||||
$plugin = new Plugin();
|
$plugin = new Plugin();
|
||||||
$plugin->setInstalled(true);
|
$plugin->setInstalled(true);
|
||||||
$plugin->setPluginId('19ff3fd21de9dbd7452fd0a67c928758');
|
$plugin->setPluginId('19ff3fd21de9dbd7452fd0a67c928758');
|
||||||
@ -55,7 +58,7 @@ trait RefreshDatabaseTrait
|
|||||||
$doc->clear();
|
$doc->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$doc->getRepository(Instance::class)->findOneBy(['appId' => '1'])) {
|
if (!$doc->getRepository(Instance::class)->findOneBy(['appId' => '1'])) {
|
||||||
$instance = new Instance();
|
$instance = new Instance();
|
||||||
$instance->setAppId("1");
|
$instance->setAppId("1");
|
||||||
$instance->setInvoiceNumberStart(1);
|
$instance->setInvoiceNumberStart(1);
|
||||||
@ -80,7 +83,7 @@ trait RefreshDatabaseTrait
|
|||||||
|
|
||||||
$shopEntity = $em->getRepository(\PSC\Shop\EntityBundle\Entity\Shop::class)->findOneBy(['title' => 'Printchampion']);
|
$shopEntity = $em->getRepository(\PSC\Shop\EntityBundle\Entity\Shop::class)->findOneBy(['title' => 'Printchampion']);
|
||||||
|
|
||||||
if(!$doc->getRepository(Shop::class)->findOneBy(['uid' => $shopEntity->getUid()])) {
|
if (!$doc->getRepository(Shop::class)->findOneBy(['uid' => $shopEntity->getUid()])) {
|
||||||
$shop = new Shop();
|
$shop = new Shop();
|
||||||
$shop->setUid($shopEntity->getUid());
|
$shop->setUid($shopEntity->getUid());
|
||||||
$shop->setInvoiceNumberStart(1);
|
$shop->setInvoiceNumberStart(1);
|
||||||
@ -111,7 +114,7 @@ trait RefreshDatabaseTrait
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$doc->getRepository(Country::class)->findOneBy(['code' => 'DE'])) {
|
if (!$doc->getRepository(Country::class)->findOneBy(['code' => 'DE'])) {
|
||||||
$country = new Country();
|
$country = new Country();
|
||||||
$country->setCode('DE');
|
$country->setCode('DE');
|
||||||
$country->setShop($shopEntity->getUid());
|
$country->setShop($shopEntity->getUid());
|
||||||
|
|||||||
@ -10,8 +10,11 @@ if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
|
|||||||
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_exists(__DIR__ . '/../var/test.sqlite')) {
|
if (file_exists(__DIR__ . '/../var/test.sqlite')) {
|
||||||
unlink(__DIR__ . '/../var/test.sqlite');
|
unlink(__DIR__ . '/../var/test.sqlite');
|
||||||
}
|
}
|
||||||
system('sqlite3 '. __DIR__ . '/../var/test.sqlite < ' . __DIR__ .'/article.sql');
|
//system('sqlite3 '. __DIR__ . '/../var/test.sqlite < ' . __DIR__ .'/article.sql');
|
||||||
system('sqlite3 '. __DIR__ . '/../var/test.sqlite < ' . __DIR__ .'/sqlite.sql');
|
//system('sqlite3 '. __DIR__ . '/../var/test.sqlite < ' . __DIR__ .'/sqlite.sql');
|
||||||
|
system('mysql -u root --password=Wichtig1 -h mysql --execute="drop database psc_test"');
|
||||||
|
system('mysql -u root --password=Wichtig1 -h mysql --execute="create database psc_test"');
|
||||||
|
system('mysql -u root --password=Wichtig1 -h mysql psc_test < '.__DIR__.'/mysql.sql');
|
||||||
|
|||||||
BIN
src/new/tests/kenny.jpg
Normal file
BIN
src/new/tests/kenny.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
BIN
src/new/tests/kenny_crop.jpg
Normal file
BIN
src/new/tests/kenny_crop.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
BIN
src/new/tests/kenny_crop1.jpg
Normal file
BIN
src/new/tests/kenny_crop1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
BIN
src/new/tests/kenny_crop_better.jpg
Normal file
BIN
src/new/tests/kenny_crop_better.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
2471
src/new/tests/mysql.sql
Normal file
2471
src/new/tests/mysql.sql
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,235 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.044/cXML.dtd">
|
|
||||||
<cXML payloadID="1695903423301.672245757.000018299@0KPbJ2Dpc/FfGpTNwTR4lGm/I6A=" timestamp="2023-09-28T05:17:03-07:00" version="1.2.044" xml:lang="en-US"><Header>
|
|
||||||
<From>
|
|
||||||
|
|
||||||
<Credential
|
|
||||||
domain="NetworkId">
|
|
||||||
|
|
||||||
<Identity>AN01500590650</Identity>
|
|
||||||
</Credential><Credential
|
|
||||||
domain="SystemID">
|
|
||||||
|
|
||||||
<Identity>CHILD1</Identity>
|
|
||||||
</Credential>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</From>
|
|
||||||
<To>
|
|
||||||
|
|
||||||
<Credential
|
|
||||||
domain="DUNS">
|
|
||||||
|
|
||||||
<Identity>322193897</Identity>
|
|
||||||
</Credential>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Credential
|
|
||||||
domain="internalsupplierid">
|
|
||||||
|
|
||||||
<Identity>0090008188</Identity>
|
|
||||||
</Credential>
|
|
||||||
|
|
||||||
<Credential
|
|
||||||
domain="buyersystemid">
|
|
||||||
|
|
||||||
<Identity>0090008188</Identity>
|
|
||||||
</Credential>
|
|
||||||
|
|
||||||
<Credential
|
|
||||||
domain="sourcingnetworkid">
|
|
||||||
|
|
||||||
<Identity>an01056401444</Identity>
|
|
||||||
</Credential>
|
|
||||||
|
|
||||||
<Credential
|
|
||||||
domain="networkid">
|
|
||||||
|
|
||||||
<Identity>an01056401444</Identity>
|
|
||||||
</Credential>
|
|
||||||
|
|
||||||
<Correspondent
|
|
||||||
preferredLanguage="de-DE">
|
|
||||||
|
|
||||||
<Contact
|
|
||||||
role="correspondent">
|
|
||||||
<Name
|
|
||||||
xml:lang="de">Hülswitt GmbH</Name>
|
|
||||||
|
|
||||||
|
|
||||||
<PostalAddress
|
|
||||||
name="Standardwert">
|
|
||||||
<Street>Neckarstr. 9</Street>
|
|
||||||
<City>Marl</City>
|
|
||||||
<PostalCode>45768</PostalCode>
|
|
||||||
<Country
|
|
||||||
isoCountryCode="DE">Deutschland</Country>
|
|
||||||
</PostalAddress>
|
|
||||||
|
|
||||||
|
|
||||||
<Email
|
|
||||||
name="work"
|
|
||||||
preferredLang="de-DE">info@huelswitt.de</Email><Email
|
|
||||||
name="routing"
|
|
||||||
preferredLang="de-DE">info@huelswitt.de</Email>
|
|
||||||
<Phone
|
|
||||||
name="work"><TelephoneNumber>
|
|
||||||
<CountryCode
|
|
||||||
isoCountryCode="DE">49</CountryCode>
|
|
||||||
<AreaOrCityCode>02365</AreaOrCityCode>
|
|
||||||
<Number>207170</Number>
|
|
||||||
</TelephoneNumber>
|
|
||||||
</Phone>
|
|
||||||
|
|
||||||
|
|
||||||
</Contact>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</Correspondent>
|
|
||||||
|
|
||||||
|
|
||||||
</To>
|
|
||||||
<Sender>
|
|
||||||
<Credential domain="AribaNetworkUserId">
|
|
||||||
|
|
||||||
<Identity>sysadmin@ariba.com</Identity>
|
|
||||||
|
|
||||||
</Credential>
|
|
||||||
|
|
||||||
<UserAgent>Buyer 14s2</UserAgent>
|
|
||||||
</Sender>
|
|
||||||
|
|
||||||
</Header>
|
|
||||||
<Request deploymentMode="production">
|
|
||||||
<OrderRequest>
|
|
||||||
<OrderRequestHeader orderVersion="1" orderType="regular" orderID="70001256790" type="new" orderDate="2023-09-28T05:16:57-07:00">
|
|
||||||
|
|
||||||
<Total>
|
|
||||||
|
|
||||||
<Money alternateCurrency="" alternateAmount="" currency="EUR">151.5</Money>
|
|
||||||
</Total>
|
|
||||||
<ShipTo>
|
|
||||||
|
|
||||||
<Address isoCountryCode="DE" addressID="RO24">
|
|
||||||
<Name xml:lang="en">Röhm GmbH - Innovation Center</Name>
|
|
||||||
|
|
||||||
|
|
||||||
<PostalAddress name="Standardwert">
|
|
||||||
<DeliverTo>ICW/B. Fath/Tel. 06241/4026466</DeliverTo>
|
|
||||||
<DeliverTo>Röhm GmbH - Innovation Center</DeliverTo>
|
|
||||||
<Street>Im Pfaffenwinkel 6</Street>
|
|
||||||
<City>Worms</City>
|
|
||||||
<State>07</State>
|
|
||||||
<PostalCode>67547</PostalCode>
|
|
||||||
<Country isoCountryCode="DE">Deutschland</Country>
|
|
||||||
</PostalAddress>
|
|
||||||
|
|
||||||
|
|
||||||
<Email preferredLang="de-DE" name="Standardwert">tpeterson@printshopcreator.com</Email>
|
|
||||||
</Address>
|
|
||||||
|
|
||||||
</ShipTo>
|
|
||||||
<BillTo>
|
|
||||||
|
|
||||||
<Address isoCountryCode="DE" addressID="INVADR_0001">
|
|
||||||
<Name xml:lang="en">Röhm GmbH - Rechnungseingang</Name>
|
|
||||||
|
|
||||||
|
|
||||||
<PostalAddress name="Standardwert">
|
|
||||||
<Street>Deutsche-Telekom-Allee 9</Street>
|
|
||||||
<City>Darmstadt</City>
|
|
||||||
<PostalCode>64295</PostalCode>
|
|
||||||
<Country isoCountryCode="DE">Deutschland</Country>
|
|
||||||
</PostalAddress>
|
|
||||||
|
|
||||||
|
|
||||||
</Address>
|
|
||||||
|
|
||||||
</BillTo>
|
|
||||||
<PaymentTerm payInNumberOfDays="30">
|
|
||||||
</PaymentTerm>
|
|
||||||
<PaymentTerm payInNumberOfDays="14">
|
|
||||||
<Discount>
|
|
||||||
<DiscountPercent percent="2"></DiscountPercent>
|
|
||||||
</Discount>
|
|
||||||
</PaymentTerm>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Extrinsic name="VAT ID"></Extrinsic>
|
|
||||||
<Extrinsic name="CompanyCode">0001</Extrinsic>
|
|
||||||
<Extrinsic name="PUName">DE</Extrinsic>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</OrderRequestHeader>
|
|
||||||
|
|
||||||
<ItemOut quantity="5" requestedDeliveryDate="2023-10-12T03:30:00-07:00" lineNumber="1">
|
|
||||||
<ItemID>
|
|
||||||
<SupplierPartID>640000100</SupplierPartID>
|
|
||||||
</ItemID>
|
|
||||||
|
|
||||||
<ItemDetail>
|
|
||||||
<UnitPrice>
|
|
||||||
|
|
||||||
|
|
||||||
<Money alternateCurrency="" alternateAmount="" currency="EUR">30.3</Money>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</UnitPrice>
|
|
||||||
<Description xml:lang="en">Visitenkarten Röhm, VE 100 Stück,WICHTIGER HINWEIS ZU IHRER BESTELLUNG !!! Nach Abschluss Ihrer Bestellung erhalten Sie eine E-Mail. &nbsp;Diese E-Mail enthält weitere Informationen und einen Link zum Visitenkartenkonfigurator. Ein Konfigurator öffnet sich und Sie können alle Angaben für die Geschäftskarten erfassen. Ohne die Erfassung Ihrer Daten können wir keine Geschäftskarten liefern.</Description>
|
|
||||||
<UnitOfMeasure>PG</UnitOfMeasure>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Classification domain="custom">41090000</Classification>
|
|
||||||
|
|
||||||
|
|
||||||
<ManufacturerPartID>640000100</ManufacturerPartID>
|
|
||||||
<ManufacturerName>Huelswitt GmbH</ManufacturerName>
|
|
||||||
<URL name="__lr2bb">http://www.huelswitt.de</URL>
|
|
||||||
<LeadTime>5</LeadTime>
|
|
||||||
<Extrinsic name="Req. Line No.">1</Extrinsic>
|
|
||||||
<Extrinsic name="Requester">Beate Fath</Extrinsic>
|
|
||||||
<Extrinsic name="PR No.">PR97668</Extrinsic>
|
|
||||||
<Extrinsic name="incoTerm"></Extrinsic>
|
|
||||||
<Extrinsic name="incoTermLocation"></Extrinsic>
|
|
||||||
|
|
||||||
<Extrinsic name="QuoteReference"></Extrinsic>
|
|
||||||
<Extrinsic name="QuoteLineReference"></Extrinsic>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ItemDetail>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ItemOut>
|
|
||||||
|
|
||||||
|
|
||||||
</OrderRequest>
|
|
||||||
</Request>
|
|
||||||
|
|
||||||
</cXML>
|
|
||||||
@ -28,6 +28,8 @@ use PSC\Shop\QueueBundle\Event\EventInterface;
|
|||||||
use PSC\Shop\QueueBundle\Event\Position\Printpartner\Notify;
|
use PSC\Shop\QueueBundle\Event\Position\Printpartner\Notify;
|
||||||
use PSC\Shop\QueueBundle\Type\ConfigurableElementInterface;
|
use PSC\Shop\QueueBundle\Type\ConfigurableElementInterface;
|
||||||
use PSC\Shop\QueueBundle\Type\QueueInterface;
|
use PSC\Shop\QueueBundle\Type\QueueInterface;
|
||||||
|
use PSC\Shop\QueueBundle\Event\Order\Create;
|
||||||
|
use PSC\Shop\QueueBundle\Service\Event\Manager;
|
||||||
use PSC\System\SettingsBundle\Service\Shop;
|
use PSC\System\SettingsBundle\Service\Shop;
|
||||||
use Ramsey\Uuid\Uuid;
|
use Ramsey\Uuid\Uuid;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
@ -54,6 +56,8 @@ class Import implements QueueInterface, ConfigurableElementInterface
|
|||||||
private $_entityManager = null;
|
private $_entityManager = null;
|
||||||
private $_shopTransformer = null;
|
private $_shopTransformer = null;
|
||||||
private $_productHydration = null;
|
private $_productHydration = null;
|
||||||
|
private $_eventManager;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Shop
|
* @var Shop
|
||||||
@ -62,7 +66,7 @@ class Import implements QueueInterface, ConfigurableElementInterface
|
|||||||
|
|
||||||
function __construct(
|
function __construct(
|
||||||
\PSC\Shop\ProductBundle\Hydrate\Product $productHydration,
|
\PSC\Shop\ProductBundle\Hydrate\Product $productHydration,
|
||||||
\PSC\Component\ApiBundle\Transformer\Shop $shopTransformer, FormFactoryInterface $formFactory, TokenStorageInterface $securityContext, Order $orderService, Shop $shopService, EntityManagerInterface $entityManager)
|
\PSC\Component\ApiBundle\Transformer\Shop $shopTransformer, FormFactoryInterface $formFactory, TokenStorageInterface $securityContext, Order $orderService, Shop $shopService, EntityManagerInterface $entityManager, Manager $eventManager)
|
||||||
{
|
{
|
||||||
$this->_formFactory = $formFactory;
|
$this->_formFactory = $formFactory;
|
||||||
$this->_securityContext = $securityContext;
|
$this->_securityContext = $securityContext;
|
||||||
@ -71,6 +75,7 @@ class Import implements QueueInterface, ConfigurableElementInterface
|
|||||||
$this->_entityManager = $entityManager;
|
$this->_entityManager = $entityManager;
|
||||||
$this->_shopTransformer = $shopTransformer;
|
$this->_shopTransformer = $shopTransformer;
|
||||||
$this->_productHydration = $productHydration;
|
$this->_productHydration = $productHydration;
|
||||||
|
$this->_eventManager = $eventManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -304,6 +309,12 @@ class Import implements QueueInterface, ConfigurableElementInterface
|
|||||||
|
|
||||||
if(count($order->getPositions()) > 0) {
|
if(count($order->getPositions()) > 0) {
|
||||||
$this->_orderService->storeOrder($order);
|
$this->_orderService->storeOrder($order);
|
||||||
|
|
||||||
|
$notify = new Create();
|
||||||
|
$notify->setShop($order->getShop()->getId());
|
||||||
|
$notify->setOrder($order->getUuid());
|
||||||
|
$this->_eventManager->addJob($notify);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($doc->getPos() == 9) {
|
if($doc->getPos() == 9) {
|
||||||
|
|||||||
@ -38,113 +38,116 @@ class Form extends AbstractController
|
|||||||
#[Route(path: '/form/{uuid}/{contactUuid}', methods: ['PUT'])]
|
#[Route(path: '/form/{uuid}/{contactUuid}', methods: ['PUT'])]
|
||||||
#[ParamConverter('data', class: Input::class, converter: 'psc_rest.request_body')]
|
#[ParamConverter('data', class: Input::class, converter: 'psc_rest.request_body')]
|
||||||
#[Tag('Plugin/Custom/PSC/CollectLayouter')]
|
#[Tag('Plugin/Custom/PSC/CollectLayouter')]
|
||||||
#[RequestBody(description: 'content',content: new JsonContent(ref: Input::class))]
|
#[RequestBody(description: 'content', content: new JsonContent(ref: Input::class))]
|
||||||
#[Response(response: 200, description: 'return customerForm', ref: new Items(ref: new Model(type: Element::class)))]
|
#[Response(response: 200, description: 'return customerForm', ref: new Items(ref: new Model(type: Element::class)))]
|
||||||
public function generateForm(Input $input, string $uuid, string $contactUuid = ""): JsonResponse {
|
public function generateForm(Input $input, string $uuid, string $contactUuid = ""): JsonResponse
|
||||||
|
{
|
||||||
|
|
||||||
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
||||||
|
|
||||||
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
||||||
/** @var Setting $settings */
|
/** @var Setting $settings */
|
||||||
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json');
|
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||||
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
||||||
$layouterSettings = [];
|
$layouterSettings = [];
|
||||||
if($contactUuid != "") {
|
if ($contactUuid != "") {
|
||||||
$contactEntity = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Contact::class)->findOneBy(['uuid' => $contactUuid]);
|
$contactEntity = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Contact::class)->findOneBy(['uuid' => $contactUuid]);
|
||||||
$this->contactTransformer->fromDb($contact, $contactEntity);
|
$this->contactTransformer->fromDb($contact, $contactEntity);
|
||||||
$layouterSettings = $contact->getLayouterData()->getSettingForLayouter('collectlayouter');
|
$layouterSettings = $contact->getLayouterData()->getSettingForLayouter('collectlayouter');
|
||||||
}elseif($this->getUser()) {
|
} elseif ($this->getUser()) {
|
||||||
$this->contactTransformer->fromDb($contact, $this->getUser());
|
$this->contactTransformer->fromDb($contact, $this->getUser());
|
||||||
$layouterSettings = $contact->getLayouterData()->getSettingForLayouter('collectlayouter');
|
$layouterSettings = $contact->getLayouterData()->getSettingForLayouter('collectlayouter');
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp = [];
|
$temp = [];
|
||||||
|
|
||||||
foreach($settings->getCustomerForm() as $setting) {
|
foreach ($settings->getCustomerForm() as $setting) {
|
||||||
|
|
||||||
if($setting->getBinding()) {
|
if ($setting->getBinding()) {
|
||||||
$value = match($setting->getBinding()) {
|
$value = match($setting->getBinding()) {
|
||||||
ElementBinding::none => $setting->getDefaultForType(),
|
ElementBinding::none => $setting->getDefaultForType(),
|
||||||
ElementBinding::UsernameLogin => array_merge([$contact->getEmail()], explode('@', $contact->getEmail())),
|
ElementBinding::UsernameLogin => array_merge([$contact->getEmail()], explode('@', $contact->getEmail())),
|
||||||
ElementBinding::UserCountry => $contact->getCountryCode(),
|
ElementBinding::UserCountry => $contact->getCountryCode(),
|
||||||
ElementBinding::Company => $contact->getLayouterData()->getCompany(),
|
ElementBinding::Company => $contact->getLayouterData()->getCompany(),
|
||||||
ElementBinding::Company2 => $contact->getLayouterData()->getCompany2(),
|
ElementBinding::Company2 => $contact->getLayouterData()->getCompany2(),
|
||||||
ElementBinding::Firstname => $contact->getLayouterData()->getFirstname(),
|
ElementBinding::Firstname => $contact->getLayouterData()->getFirstname(),
|
||||||
ElementBinding::Lastname => $contact->getLayouterData()->getLastname(),
|
ElementBinding::Lastname => $contact->getLayouterData()->getLastname(),
|
||||||
ElementBinding::Title => $contact->getLayouterData()->getTitle(),
|
ElementBinding::Title => $contact->getLayouterData()->getTitle(),
|
||||||
ElementBinding::Position => $contact->getLayouterData()->getPosition(),
|
ElementBinding::Position => $contact->getLayouterData()->getPosition(),
|
||||||
ElementBinding::Function => $contact->getLayouterData()->getFunction(),
|
ElementBinding::Function => $contact->getLayouterData()->getFunction(),
|
||||||
ElementBinding::StreetHouseNumber => [$contact->getLayouterData()->getStreet(), $contact->getLayouterData()->getHouseNumber()],
|
ElementBinding::StreetHouseNumber => [$contact->getLayouterData()->getStreet(), $contact->getLayouterData()->getHouseNumber()],
|
||||||
ElementBinding::ZipCity => [$contact->getLayouterData()->getZip(), $contact->getLayouterData()->getCity()],
|
ElementBinding::ZipCity => [$contact->getLayouterData()->getZip(), $contact->getLayouterData()->getCity()],
|
||||||
ElementBinding::Fon => [$contact->getLayouterData()->getPhoneAreaCode(), $contact->getLayouterData()->getPhonePrefix(), $contact->getLayouterData()->getPhone(), $contact->getLayouterData()->getPhoneAppendix()],
|
ElementBinding::Fon => [$contact->getLayouterData()->getPhoneAreaCode(), $contact->getLayouterData()->getPhonePrefix(), $contact->getLayouterData()->getPhone(), $contact->getLayouterData()->getPhoneAppendix()],
|
||||||
ElementBinding::Mobile => [$contact->getLayouterData()->getMobileAreaCode(), $contact->getLayouterData()->getMobilePrefix(), $contact->getLayouterData()->getMobile(), $contact->getLayouterData()->getMobileAppendix()],
|
ElementBinding::Mobile => [$contact->getLayouterData()->getMobileAreaCode(), $contact->getLayouterData()->getMobilePrefix(), $contact->getLayouterData()->getMobile(), $contact->getLayouterData()->getMobileAppendix()],
|
||||||
ElementBinding::Fax => [$contact->getLayouterData()->getFaxAreaCode(), $contact->getLayouterData()->getFaxPrefix(), $contact->getLayouterData()->getFax(), $contact->getLayouterData()->getFaxAppendix()],
|
ElementBinding::Fax => [$contact->getLayouterData()->getFaxAreaCode(), $contact->getLayouterData()->getFaxPrefix(), $contact->getLayouterData()->getFax(), $contact->getLayouterData()->getFaxAppendix()],
|
||||||
ElementBinding::Abteilung => $contact->getLayouterData()->getAbteilung(),
|
ElementBinding::Abteilung => $contact->getLayouterData()->getAbteilung(),
|
||||||
ElementBinding::Custom1 => $contact->getCustom1(),
|
ElementBinding::Custom1 => $contact->getCustom1(),
|
||||||
ElementBinding::Custom2 => $contact->getCustom2(),
|
ElementBinding::Custom2 => $contact->getCustom2(),
|
||||||
ElementBinding::Custom3 => $contact->getCustom3(),
|
ElementBinding::Custom3 => $contact->getCustom3(),
|
||||||
ElementBinding::Custom4 => $contact->getCustom4(),
|
ElementBinding::Custom4 => $contact->getCustom4(),
|
||||||
ElementBinding::Custom5 => $contact->getCustom5(),
|
ElementBinding::Custom5 => $contact->getCustom5(),
|
||||||
ElementBinding::Custom6 => $contact->getCustom6(),
|
ElementBinding::Custom6 => $contact->getCustom6(),
|
||||||
ElementBinding::Custom7 => $contact->getCustom7(),
|
ElementBinding::Custom7 => $contact->getCustom7(),
|
||||||
ElementBinding::Custom8 => $contact->getCustom8(),
|
ElementBinding::Custom8 => $contact->getCustom8(),
|
||||||
ElementBinding::Custom9 => $contact->getCustom9(),
|
ElementBinding::Custom9 => $contact->getCustom9(),
|
||||||
ElementBinding::Custom10 => $contact->getCustom10(),
|
ElementBinding::Custom10 => $contact->getCustom10(),
|
||||||
ElementBinding::Custom11 => $contact->getCustom11(),
|
ElementBinding::Custom11 => $contact->getCustom11(),
|
||||||
ElementBinding::Custom12 => $contact->getCustom12(),
|
ElementBinding::Custom12 => $contact->getCustom12(),
|
||||||
ElementBinding::Custom13 => $contact->getCustom13(),
|
ElementBinding::Custom13 => $contact->getCustom13(),
|
||||||
ElementBinding::Custom14 => $contact->getCustom14(),
|
ElementBinding::Custom14 => $contact->getCustom14(),
|
||||||
ElementBinding::Custom15 => $contact->getCustom15(),
|
ElementBinding::Custom15 => $contact->getCustom15(),
|
||||||
ElementBinding::Custom16 => $contact->getCustom16(),
|
ElementBinding::Custom16 => $contact->getCustom16(),
|
||||||
ElementBinding::Custom17 => $contact->getCustom17(),
|
ElementBinding::Custom17 => $contact->getCustom17(),
|
||||||
ElementBinding::Custom18 => $contact->getCustom18(),
|
ElementBinding::Custom18 => $contact->getCustom18(),
|
||||||
ElementBinding::Custom19 => $contact->getCustom19(),
|
ElementBinding::Custom19 => $contact->getCustom19(),
|
||||||
ElementBinding::Custom20 => $contact->getCustom20(),
|
ElementBinding::Custom20 => $contact->getCustom20(),
|
||||||
ElementBinding::Custom21 => $contact->getCustom21(),
|
ElementBinding::Custom21 => $contact->getCustom21(),
|
||||||
ElementBinding::Custom22 => $contact->getCustom22(),
|
ElementBinding::Custom22 => $contact->getCustom22(),
|
||||||
ElementBinding::Custom23 => $contact->getCustom23(),
|
ElementBinding::Custom23 => $contact->getCustom23(),
|
||||||
ElementBinding::Custom24 => $contact->getCustom24(),
|
ElementBinding::Custom24 => $contact->getCustom24(),
|
||||||
ElementBinding::LayouterMail => array_merge([$contact->getLayouterData()->getEmail()], explode('@', $contact->getLayouterData()->getEmail())),
|
ElementBinding::LayouterMail => array_merge([$contact->getLayouterData()->getEmail()], explode('@', $contact->getLayouterData()->getEmail())),
|
||||||
ElementBinding::LayouterCountryName => $contact->getLayouterData()->getCountryName(),
|
ElementBinding::LayouterCountryName => $contact->getLayouterData()->getCountryName(),
|
||||||
ElementBinding::LayouterCountryCode => $contact->getLayouterData()->getCountryCode(),
|
ElementBinding::LayouterCountryCode => $contact->getLayouterData()->getCountryCode(),
|
||||||
ElementBinding::Birthday => $contact->getLayouterData()->getBirthday(),
|
ElementBinding::Birthday => $contact->getLayouterData()->getBirthday(),
|
||||||
ElementBinding::Homepages => $contact->getLayouterData()->getHomepage(),
|
ElementBinding::Homepages => $contact->getLayouterData()->getHomepage(),
|
||||||
ElementBinding::Salutation => $contact->getLayouterData()->getSalutation(),
|
ElementBinding::Salutation => $contact->getLayouterData()->getSalutation(),
|
||||||
ElementBinding::UstId => $contact->getLayouterData()->getUstid(),
|
ElementBinding::UstId => $contact->getLayouterData()->getUstid(),
|
||||||
ElementBinding::KSt => $contact->getLayouterData()->getKst(),
|
ElementBinding::KSt => $contact->getLayouterData()->getKst(),
|
||||||
ElementBinding::State => $contact->getLayouterData()->getState(),
|
ElementBinding::State => $contact->getLayouterData()->getState(),
|
||||||
ElementBinding::District => $contact->getLayouterData()->getDistrict(),
|
ElementBinding::District => $contact->getLayouterData()->getDistrict(),
|
||||||
};
|
ElementBinding::Image1 => $contact->getLayouterData()->getImage1(),
|
||||||
|
ElementBinding::Image2 => $contact->getLayouterData()->getImage2(),
|
||||||
|
};
|
||||||
|
|
||||||
$elmEnable = array_values(array_filter($layouterSettings, function($el) use ($setting) {
|
$elmEnable = array_values(array_filter($layouterSettings, function ($el) use ($setting) {
|
||||||
if($el['name'] == 'data[' . $setting->getId() . '][enable]') {
|
if ($el['name'] == 'data[' . $setting->getId() . '][enable]') {
|
||||||
return $el;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
$elmValue = array_values(array_filter($layouterSettings, function($el) use ($setting) {
|
|
||||||
if($el['name'] == 'data[' . $setting->getId() . '][value]') {
|
|
||||||
return $el;
|
return $el;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(count($elmEnable) === 1 && $elmEnable[0]['value'] === "1") {
|
$elmValue = array_values(array_filter($layouterSettings, function ($el) use ($setting) {
|
||||||
|
if ($el['name'] == 'data[' . $setting->getId() . '][value]') {
|
||||||
|
return $el;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (count($elmEnable) === 1 && $elmEnable[0]['value'] === "1") {
|
||||||
$setting->setOptionalDefault(true);
|
$setting->setOptionalDefault(true);
|
||||||
}
|
}
|
||||||
if(count($elmEnable) === 1 && $elmEnable[0]['value'] === "0") {
|
if (count($elmEnable) === 1 && $elmEnable[0]['value'] === "0") {
|
||||||
|
$setting->setOptionalDefault(false);
|
||||||
|
}
|
||||||
|
if (count($elmEnable) === 0 && count($elmValue) === 1 && $setting->getOptional()) {
|
||||||
$setting->setOptionalDefault(false);
|
$setting->setOptionalDefault(false);
|
||||||
}
|
}
|
||||||
if(count($elmEnable) === 0 && count($elmValue) === 1 && $setting->getOptional()) {
|
|
||||||
$setting->setOptionalDefault(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$setting->setValue($value);
|
$setting->setValue($value);
|
||||||
|
|
||||||
}
|
}
|
||||||
$temp[] = $setting;
|
$temp[] = $setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($temp, function($a, $b) {
|
usort($temp, function ($a, $b) {
|
||||||
return $a->getPos() <=> $b->getPos();
|
return $a->getPos() <=> $b->getPos();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -154,24 +157,25 @@ class Form extends AbstractController
|
|||||||
#[Route(path: '/newform/{uuid}', methods: ['PUT'])]
|
#[Route(path: '/newform/{uuid}', methods: ['PUT'])]
|
||||||
#[ParamConverter('data', class: Input::class, converter: 'psc_rest.request_body')]
|
#[ParamConverter('data', class: Input::class, converter: 'psc_rest.request_body')]
|
||||||
#[Tag('Plugin/Custom/PSC/CollectLayouter')]
|
#[Tag('Plugin/Custom/PSC/CollectLayouter')]
|
||||||
#[RequestBody(description: 'content',content: new JsonContent(ref: Input::class))]
|
#[RequestBody(description: 'content', content: new JsonContent(ref: Input::class))]
|
||||||
#[Response(response: 200, description: 'return customerForm', ref: new Items(ref: new Model(type: Element::class)))]
|
#[Response(response: 200, description: 'return customerForm', ref: new Items(ref: new Model(type: Element::class)))]
|
||||||
public function generateNewForm(Input $input, string $uuid, string $contactUuid = ""): JsonResponse {
|
public function generateNewForm(Input $input, string $uuid, string $contactUuid = ""): JsonResponse
|
||||||
|
{
|
||||||
|
|
||||||
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
||||||
|
|
||||||
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
||||||
/** @var Setting $settings */
|
/** @var Setting $settings */
|
||||||
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json');
|
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||||
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
||||||
|
|
||||||
$temp = [];
|
$temp = [];
|
||||||
|
|
||||||
foreach($settings->getCustomerForm() as $setting) {
|
foreach ($settings->getCustomerForm() as $setting) {
|
||||||
$temp[] = $setting;
|
$temp[] = $setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($temp, function($a, $b) {
|
usort($temp, function ($a, $b) {
|
||||||
return $a->getPos() <=> $b->getPos();
|
return $a->getPos() <=> $b->getPos();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -9,10 +9,13 @@ use OpenApi\Attributes\JsonContent;
|
|||||||
use OpenApi\Attributes\RequestBody;
|
use OpenApi\Attributes\RequestBody;
|
||||||
use OpenApi\Attributes\Response;
|
use OpenApi\Attributes\Response;
|
||||||
use OpenApi\Attributes\Tag;
|
use OpenApi\Attributes\Tag;
|
||||||
|
use PSC\Shop\MediaBundle\Model\Media;
|
||||||
|
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Dto\Preview\Input;
|
use Plugin\Custom\PSC\CollectLayouter\Dto\Preview\Input;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Helper\MPDF;
|
use Plugin\Custom\PSC\CollectLayouter\Helper\MPDF;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\Element;
|
use Plugin\Custom\PSC\CollectLayouter\Model\Element;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
||||||
|
use Plugin\Custom\PSC\CollectLayouter\Model\ElementType;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
|
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
|
||||||
use PSC\Shop\ContactBundle\Transformer\Model\Contact;
|
use PSC\Shop\ContactBundle\Transformer\Model\Contact;
|
||||||
use PSC\Shop\EntityBundle\Entity\Product;
|
use PSC\Shop\EntityBundle\Entity\Product;
|
||||||
@ -30,31 +33,36 @@ use Twig\Environment;
|
|||||||
|
|
||||||
class Preview extends AbstractController
|
class Preview extends AbstractController
|
||||||
{
|
{
|
||||||
public function __construct(readonly private MPDF $mpdf,
|
public function __construct(
|
||||||
readonly private EntityManagerInterface $entityManager, readonly private DocumentManager $documentManager,
|
readonly private MPDF $mpdf,
|
||||||
readonly private SerializerInterface $serializer, readonly private Contact $contactTransformer,
|
readonly private EntityManagerInterface $entityManager,
|
||||||
readonly private RequestStack $requestStack)
|
readonly private DocumentManager $documentManager,
|
||||||
{
|
readonly private SerializerInterface $serializer,
|
||||||
|
readonly private Contact $contactTransformer,
|
||||||
|
readonly private RequestStack $requestStack,
|
||||||
|
readonly private MediaManager $mediaManager
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route(path: '/preview/{uuid}/{type}/{contactUuid}', methods: ['PUT'], defaults: ['contactUuid' => ''])]
|
#[Route(path: '/preview/{uuid}/{type}/{contactUuid}', methods: ['PUT'], defaults: ['contactUuid' => ''])]
|
||||||
#[ParamConverter('data', class: Input::class, converter: 'psc_rest.request_body')]
|
#[ParamConverter('data', class: Input::class, converter: 'psc_rest.request_body')]
|
||||||
#[Tag('Plugin/Custom/PSC/CollectLayouter')]
|
#[Tag('Plugin/Custom/PSC/CollectLayouter')]
|
||||||
#[RequestBody(description: 'content',content: new JsonContent(ref: Input::class))]
|
#[RequestBody(description: 'content', content: new JsonContent(ref: Input::class))]
|
||||||
#[Response(response: 200, description: 'return previews', content: new JsonContent(type: 'bool'))]
|
#[Response(response: 200, description: 'return previews', content: new JsonContent(type: 'bool'))]
|
||||||
public function generatePreview(Input $data, string $uuid, string $contactUuid = "", int $type = 1): JsonResponse {
|
public function generatePreview(Input $data, string $uuid, string $contactUuid = "", int $type = 1): JsonResponse
|
||||||
|
{
|
||||||
|
|
||||||
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
||||||
|
|
||||||
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
||||||
$setting = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json');
|
$setting = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||||
|
|
||||||
|
|
||||||
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
||||||
if($contactUuid != "") {
|
if ($contactUuid != "") {
|
||||||
$contactEntity = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Contact::class)->findOneBy(['uuid' => $contactUuid]);
|
$contactEntity = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Contact::class)->findOneBy(['uuid' => $contactUuid]);
|
||||||
$this->contactTransformer->fromDb($contact, $contactEntity, new \PSC\Shop\EntityBundle\Document\Contact());
|
$this->contactTransformer->fromDb($contact, $contactEntity, new \PSC\Shop\EntityBundle\Document\Contact());
|
||||||
}elseif($this->getUser()) {
|
} elseif ($this->getUser()) {
|
||||||
$this->contactTransformer->fromDb($contact, $this->getUser(), new \PSC\Shop\EntityBundle\Document\Contact());
|
$this->contactTransformer->fromDb($contact, $this->getUser(), new \PSC\Shop\EntityBundle\Document\Contact());
|
||||||
}
|
}
|
||||||
$this->mpdf->setSetting($setting);
|
$this->mpdf->setSetting($setting);
|
||||||
@ -62,76 +70,88 @@ class Preview extends AbstractController
|
|||||||
$formData = [];
|
$formData = [];
|
||||||
|
|
||||||
/** @var Element $element */
|
/** @var Element $element */
|
||||||
foreach($setting->getCustomerForm() as $element) {
|
foreach ($setting->getCustomerForm() as $element) {
|
||||||
$value = match($element->getBinding()) {
|
$value = match($element->getBinding()) {
|
||||||
ElementBinding::none => $element->getDefaultForTypePreview(),
|
ElementBinding::none => $element->getDefaultForTypePreview(),
|
||||||
ElementBinding::StreetHouseNumber => ['street' => $contact->getLayouterData()->getStreet()?? $element->getDefault1(), 'houseNumber' => $contact->getLayouterData()->getHouseNumber()?? $element->getDefault2()],
|
ElementBinding::StreetHouseNumber => ['street' => $contact->getLayouterData()->getStreet() ?? $element->getDefault1(), 'houseNumber' => $contact->getLayouterData()->getHouseNumber() ?? $element->getDefault2()],
|
||||||
ElementBinding::ZipCity => ['zip' => $contact->getLayouterData()->getZip()?? $element->getDefault1(), 'city' => $contact->getLayouterData()->getCity()?? $element->getDefault2()],
|
ElementBinding::ZipCity => ['zip' => $contact->getLayouterData()->getZip() ?? $element->getDefault1(), 'city' => $contact->getLayouterData()->getCity() ?? $element->getDefault2()],
|
||||||
ElementBinding::Firstname => $contact->getLayouterData()->getFirstname()?? $element->getDefault1(),
|
ElementBinding::Firstname => $contact->getLayouterData()->getFirstname() ?? $element->getDefault1(),
|
||||||
ElementBinding::Lastname => $contact->getLayouterData()->getLastname()?? $element->getDefault1(),
|
ElementBinding::Lastname => $contact->getLayouterData()->getLastname() ?? $element->getDefault1(),
|
||||||
ElementBinding::Mobile => [
|
ElementBinding::Mobile => [
|
||||||
'areacode' => $contact->getLayouterData()->getMobileAreaCode()?? $element->getDefault1(),
|
'areacode' => $contact->getLayouterData()->getMobileAreaCode() ?? $element->getDefault1(),
|
||||||
'prefix' => $contact->getLayouterData()->getMobilePrefix()?? $element->getDefault2(),
|
'prefix' => $contact->getLayouterData()->getMobilePrefix() ?? $element->getDefault2(),
|
||||||
'number' => $contact->getLayouterData()->getMobile()?? $element->getDefault3(),
|
'number' => $contact->getLayouterData()->getMobile() ?? $element->getDefault3(),
|
||||||
'appendix' => $contact->getLayouterData()->getMobileAppendix()?? $element->getDefault4()],
|
'appendix' => $contact->getLayouterData()->getMobileAppendix() ?? $element->getDefault4()],
|
||||||
ElementBinding::Fax => [
|
ElementBinding::Fax => [
|
||||||
'areacode' => $contact->getLayouterData()->getFaxAreaCode()?? $element->getDefault1(),
|
'areacode' => $contact->getLayouterData()->getFaxAreaCode() ?? $element->getDefault1(),
|
||||||
'prefix' => $contact->getLayouterData()->getFaxPrefix()?? $element->getDefault2(),
|
'prefix' => $contact->getLayouterData()->getFaxPrefix() ?? $element->getDefault2(),
|
||||||
'number' => $contact->getLayouterData()->getFax()?? $element->getDefault3(),
|
'number' => $contact->getLayouterData()->getFax() ?? $element->getDefault3(),
|
||||||
'appendix' => $contact->getLayouterData()->getFaxAppendix()?? $element->getDefault4()],
|
'appendix' => $contact->getLayouterData()->getFaxAppendix() ?? $element->getDefault4()],
|
||||||
ElementBinding::UsernameLogin => $contact->getEmail()?? $element->getDefault1(),
|
ElementBinding::UsernameLogin => $contact->getEmail() ?? $element->getDefault1(),
|
||||||
ElementBinding::Company => $contact->getLayouterData()->getCompany()?? $element->getDefault1(),
|
ElementBinding::Company => $contact->getLayouterData()->getCompany() ?? $element->getDefault1(),
|
||||||
ElementBinding::Company2 => $contact->getLayouterData()->getCompany2()?? $element->getDefault1(),
|
ElementBinding::Company2 => $contact->getLayouterData()->getCompany2() ?? $element->getDefault1(),
|
||||||
ElementBinding::Title => $contact->getLayouterData()->getTitle()?? $element->getDefault1(),
|
ElementBinding::Title => $contact->getLayouterData()->getTitle() ?? $element->getDefault1(),
|
||||||
ElementBinding::Position => $contact->getLayouterData()->getPosition()?? $element->getDefault1(),
|
ElementBinding::Position => $contact->getLayouterData()->getPosition() ?? $element->getDefault1(),
|
||||||
ElementBinding::Function => $contact->getLayouterData()->getFunction()?? $element->getDefault1(),
|
ElementBinding::Function => $contact->getLayouterData()->getFunction() ?? $element->getDefault1(),
|
||||||
ElementBinding::UserCountry => $contact->getCountryCode()?? $element->getDefault1(),
|
ElementBinding::UserCountry => $contact->getCountryCode() ?? $element->getDefault1(),
|
||||||
ElementBinding::Fon => [
|
ElementBinding::Fon => [
|
||||||
'areacode' => $contact->getLayouterData()->getPhoneAreaCode()?? $element->getDefault1(),
|
'areacode' => $contact->getLayouterData()->getPhoneAreaCode() ?? $element->getDefault1(),
|
||||||
'prefix' => $contact->getLayouterData()->getPhonePrefix()?? $element->getDefault2(),
|
'prefix' => $contact->getLayouterData()->getPhonePrefix() ?? $element->getDefault2(),
|
||||||
'number' => $contact->getLayouterData()->getPhone()?? $element->getDefault3(),
|
'number' => $contact->getLayouterData()->getPhone() ?? $element->getDefault3(),
|
||||||
'appendix' => $contact->getLayouterData()->getPhoneAppendix()?? $element->getDefault4()],
|
'appendix' => $contact->getLayouterData()->getPhoneAppendix() ?? $element->getDefault4()],
|
||||||
ElementBinding::Abteilung => $contact->getLayouterData()->getAbteilung()?? $element->getDefault1(),
|
ElementBinding::Abteilung => $contact->getLayouterData()->getAbteilung() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom1 => $contact->getCustom1()?? $element->getDefault1(),
|
ElementBinding::Custom1 => $contact->getCustom1() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom2 => $contact->getCustom2()?? $element->getDefault1(),
|
ElementBinding::Custom2 => $contact->getCustom2() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom3 => $contact->getCustom3()?? $element->getDefault1(),
|
ElementBinding::Custom3 => $contact->getCustom3() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom4 => $contact->getCustom4()?? $element->getDefault1(),
|
ElementBinding::Custom4 => $contact->getCustom4() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom5 => $contact->getCustom5()?? $element->getDefault1(),
|
ElementBinding::Custom5 => $contact->getCustom5() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom6 => $contact->getCustom6()?? $element->getDefault1(),
|
ElementBinding::Custom6 => $contact->getCustom6() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom7 => $contact->getCustom7()?? $element->getDefault1(),
|
ElementBinding::Custom7 => $contact->getCustom7() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom8 => $contact->getCustom8()?? $element->getDefault1(),
|
ElementBinding::Custom8 => $contact->getCustom8() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom9 => $contact->getCustom9()?? $element->getDefault1(),
|
ElementBinding::Custom9 => $contact->getCustom9() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom10 => $contact->getCustom10()?? $element->getDefault1(),
|
ElementBinding::Custom10 => $contact->getCustom10() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom11 => $contact->getCustom11()?? $element->getDefault1(),
|
ElementBinding::Custom11 => $contact->getCustom11() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom12 => $contact->getCustom12()?? $element->getDefault1(),
|
ElementBinding::Custom12 => $contact->getCustom12() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom13 => $contact->getCustom13()?? $element->getDefault1(),
|
ElementBinding::Custom13 => $contact->getCustom13() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom14 => $contact->getCustom14()?? $element->getDefault1(),
|
ElementBinding::Custom14 => $contact->getCustom14() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom15 => $contact->getCustom15()?? $element->getDefault1(),
|
ElementBinding::Custom15 => $contact->getCustom15() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom16 => $contact->getCustom16()?? $element->getDefault1(),
|
ElementBinding::Custom16 => $contact->getCustom16() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom17 => $contact->getCustom17()?? $element->getDefault1(),
|
ElementBinding::Custom17 => $contact->getCustom17() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom18 => $contact->getCustom18()?? $element->getDefault1(),
|
ElementBinding::Custom18 => $contact->getCustom18() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom19 => $contact->getCustom19()?? $element->getDefault1(),
|
ElementBinding::Custom19 => $contact->getCustom19() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom20 => $contact->getCustom20()?? $element->getDefault1(),
|
ElementBinding::Custom20 => $contact->getCustom20() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom21 => $contact->getCustom21()?? $element->getDefault1(),
|
ElementBinding::Custom21 => $contact->getCustom21() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom22 => $contact->getCustom22()?? $element->getDefault1(),
|
ElementBinding::Custom22 => $contact->getCustom22() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom23 => $contact->getCustom23()?? $element->getDefault1(),
|
ElementBinding::Custom23 => $contact->getCustom23() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom24 => $contact->getCustom24()?? $element->getDefault1(),
|
ElementBinding::Custom24 => $contact->getCustom24() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterMail => $contact->getLayouterData()->getEmail()?? $element->getDefault1(),
|
ElementBinding::LayouterMail => $contact->getLayouterData()->getEmail() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterCountryName => $contact->getLayouterData()->getCountryName()?? $element->getDefault1(),
|
ElementBinding::LayouterCountryName => $contact->getLayouterData()->getCountryName() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterCountryCode => $contact->getLayouterData()->getCountryCode()?? $element->getDefault1(),
|
ElementBinding::LayouterCountryCode => $contact->getLayouterData()->getCountryCode() ?? $element->getDefault1(),
|
||||||
ElementBinding::Birthday => $contact->getLayouterData()->getBirthday()?? $element->getDefault1(),
|
ElementBinding::Birthday => $contact->getLayouterData()->getBirthday() ?? $element->getDefault1(),
|
||||||
ElementBinding::Homepages => $contact->getLayouterData()->getHomepage()?? $element->getDefault1(),
|
ElementBinding::Homepages => $contact->getLayouterData()->getHomepage() ?? $element->getDefault1(),
|
||||||
ElementBinding::Salutation => $contact->getLayouterData()->getSalutation()?? $element->getDefault1(),
|
ElementBinding::Salutation => $contact->getLayouterData()->getSalutation() ?? $element->getDefault1(),
|
||||||
ElementBinding::UstId => $contact->getLayouterData()->getUstid()?? $element->getDefault1(),
|
ElementBinding::UstId => $contact->getLayouterData()->getUstid() ?? $element->getDefault1(),
|
||||||
ElementBinding::KSt => $contact->getLayouterData()->getKst()?? $element->getDefault1(),
|
ElementBinding::KSt => $contact->getLayouterData()->getKst() ?? $element->getDefault1(),
|
||||||
ElementBinding::State => $contact->getLayouterData()->getState()?? $element->getDefault1(),
|
ElementBinding::State => $contact->getLayouterData()->getState() ?? $element->getDefault1(),
|
||||||
ElementBinding::District => $contact->getLayouterData()->getDistrict()?? $element->getDefault1(),
|
ElementBinding::District => $contact->getLayouterData()->getDistrict() ?? $element->getDefault1(),
|
||||||
|
ElementBinding::Image1 => $contact->getLayouterData()->getImage1() ?? $element->getDefault1(),
|
||||||
|
ElementBinding::Image2 => $contact->getLayouterData()->getImage2() ?? $element->getDefault1(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if($elm = $data->getElement($element, $contact)) {
|
if ($elm = $data->getElement($element, $contact)) {
|
||||||
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => (bool)$elm['enable']];
|
if ($element->getType() == ElementType::Image && $elm['value'] != "") {
|
||||||
}else{
|
$media = $this->mediaManager->getModelByUuid($elm['value']);
|
||||||
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional()? $element->getOptionalDefault(): true];
|
$formData[$element->getId()] = ['value' => $media, 'enable' => (bool)$elm['enable']];
|
||||||
|
} else {
|
||||||
|
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => (bool)$elm['enable']];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($element->getType() == ElementType::Image && $formData[$element->getId()]['value'] instanceof Media) {
|
||||||
|
$formData[$element->getId()]['value'] = $formData[$element->getId()]['value']->getVariant($element->getImage()->aspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -139,7 +159,7 @@ class Preview extends AbstractController
|
|||||||
$this->mpdf->setData($formData);
|
$this->mpdf->setData($formData);
|
||||||
$this->mpdf->generate($type == 2);
|
$this->mpdf->generate($type == 2);
|
||||||
$tmp = [];
|
$tmp = [];
|
||||||
foreach($this->mpdf->getPreviewFiles() as $d) {
|
foreach ($this->mpdf->getPreviewFiles() as $d) {
|
||||||
$tmp[] = base64_encode(file_get_contents($d));
|
$tmp[] = base64_encode(file_get_contents($d));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,8 +8,10 @@ use OpenApi\Attributes\JsonContent;
|
|||||||
use OpenApi\Attributes\RequestBody;
|
use OpenApi\Attributes\RequestBody;
|
||||||
use OpenApi\Attributes\Response;
|
use OpenApi\Attributes\Response;
|
||||||
use OpenApi\Attributes\Tag;
|
use OpenApi\Attributes\Tag;
|
||||||
|
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Dto\Save\Input;
|
use Plugin\Custom\PSC\CollectLayouter\Dto\Save\Input;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
||||||
|
use Plugin\Custom\PSC\CollectLayouter\Model\ElementType;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
|
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
|
||||||
use PSC\Shop\ContactBundle\Transformer\Model\Contact;
|
use PSC\Shop\ContactBundle\Transformer\Model\Contact;
|
||||||
use PSC\Shop\EntityBundle\Entity\Layoutdesigndata;
|
use PSC\Shop\EntityBundle\Entity\Layoutdesigndata;
|
||||||
@ -25,14 +27,16 @@ use Twig\Environment;
|
|||||||
|
|
||||||
class Save extends AbstractController
|
class Save extends AbstractController
|
||||||
{
|
{
|
||||||
public function __construct(readonly private \Plugin\Custom\PSC\CollectLayouter\Helper\SaveFiles $saveFilesHelper,
|
public function __construct(
|
||||||
|
readonly private \Plugin\Custom\PSC\CollectLayouter\Helper\SaveFiles $saveFilesHelper,
|
||||||
readonly private \Plugin\Custom\PSC\CollectLayouter\Helper\SaveContact $saveContactHelper,
|
readonly private \Plugin\Custom\PSC\CollectLayouter\Helper\SaveContact $saveContactHelper,
|
||||||
private EntityManagerInterface $entityManager,
|
private EntityManagerInterface $entityManager,
|
||||||
private DocumentManager $documentManager,
|
private DocumentManager $documentManager,
|
||||||
private SerializerInterface $serializer,
|
private SerializerInterface $serializer,
|
||||||
private Contact $contactTransformer,
|
private Contact $contactTransformer,
|
||||||
private RequestStack $requestStack,
|
private RequestStack $requestStack,
|
||||||
private Environment $twig
|
private Environment $twig,
|
||||||
|
private MediaManager $mediaManager
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,10 +53,10 @@ class Save extends AbstractController
|
|||||||
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
||||||
|
|
||||||
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
||||||
$setting = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json');
|
$setting = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||||
|
|
||||||
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
||||||
if($this->getUser()) {
|
if ($this->getUser()) {
|
||||||
$this->contactTransformer->fromDb($contact, $this->getUser());
|
$this->contactTransformer->fromDb($contact, $this->getUser());
|
||||||
}
|
}
|
||||||
$this->saveFilesHelper->setSetting($setting);
|
$this->saveFilesHelper->setSetting($setting);
|
||||||
@ -61,96 +65,105 @@ class Save extends AbstractController
|
|||||||
|
|
||||||
$this->saveFilesHelper->storeFiles();
|
$this->saveFilesHelper->storeFiles();
|
||||||
|
|
||||||
if($contact->getUuid() != "") {
|
if ($contact->getUuid() != "") {
|
||||||
$this->saveContactHelper->setSetting($setting);
|
$this->saveContactHelper->setSetting($setting);
|
||||||
$this->saveContactHelper->setContact($contact);
|
$this->saveContactHelper->setContact($contact);
|
||||||
$this->saveContactHelper->setData($data);
|
$this->saveContactHelper->setData($data);
|
||||||
$this->saveContactHelper->saveData();
|
$this->saveContactHelper->saveData();
|
||||||
}
|
}
|
||||||
|
|
||||||
$formData = [];
|
$formData = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Element $element
|
* @var Element $element
|
||||||
*/
|
*/
|
||||||
foreach($setting->getCustomerForm() as $element) {
|
foreach ($setting->getCustomerForm() as $element) {
|
||||||
$value = match($element->getBinding()) {
|
$value = match($element->getBinding()) {
|
||||||
ElementBinding::none => $element->getDefaultForTypePreview(),
|
ElementBinding::none => $element->getDefaultForTypePreview(),
|
||||||
ElementBinding::StreetHouseNumber => ['street' => $contact->getLayouterData()->getStreet()?? $element->getDefault1(), 'houseNumber' => $contact->getLayouterData()->getHouseNumber()?? $element->getDefault2()],
|
ElementBinding::StreetHouseNumber => ['street' => $contact->getLayouterData()->getStreet() ?? $element->getDefault1(), 'houseNumber' => $contact->getLayouterData()->getHouseNumber() ?? $element->getDefault2()],
|
||||||
ElementBinding::ZipCity => ['zip' => $contact->getLayouterData()->getZip()?? $element->getDefault1(), 'city' => $contact->getLayouterData()->getCity()?? $element->getDefault2()],
|
ElementBinding::ZipCity => ['zip' => $contact->getLayouterData()->getZip() ?? $element->getDefault1(), 'city' => $contact->getLayouterData()->getCity() ?? $element->getDefault2()],
|
||||||
ElementBinding::Firstname => $contact->getLayouterData()->getFirstname()?? $element->getDefault1(),
|
ElementBinding::Firstname => $contact->getLayouterData()->getFirstname() ?? $element->getDefault1(),
|
||||||
ElementBinding::Lastname => $contact->getLayouterData()->getLastname()?? $element->getDefault1(),
|
ElementBinding::Lastname => $contact->getLayouterData()->getLastname() ?? $element->getDefault1(),
|
||||||
ElementBinding::Mobile => [
|
ElementBinding::Mobile => [
|
||||||
'areacode' => $contact->getLayouterData()->getMobileAreaCode()?? $element->getDefault1(),
|
'areacode' => $contact->getLayouterData()->getMobileAreaCode() ?? $element->getDefault1(),
|
||||||
'prefix' => $contact->getLayouterData()->getMobilePrefix()?? $element->getDefault2(),
|
'prefix' => $contact->getLayouterData()->getMobilePrefix() ?? $element->getDefault2(),
|
||||||
'number' => $contact->getLayouterData()->getMobile()?? $element->getDefault3(),
|
'number' => $contact->getLayouterData()->getMobile() ?? $element->getDefault3(),
|
||||||
'appendix' => $contact->getLayouterData()->getMobileAppendix()?? $element->getDefault4()],
|
'appendix' => $contact->getLayouterData()->getMobileAppendix() ?? $element->getDefault4()],
|
||||||
ElementBinding::Fax => [
|
ElementBinding::Fax => [
|
||||||
'areacode' => $contact->getLayouterData()->getFaxAreaCode()?? $element->getDefault1(),
|
'areacode' => $contact->getLayouterData()->getFaxAreaCode() ?? $element->getDefault1(),
|
||||||
'prefix' => $contact->getLayouterData()->getFaxPrefix()?? $element->getDefault2(),
|
'prefix' => $contact->getLayouterData()->getFaxPrefix() ?? $element->getDefault2(),
|
||||||
'number' => $contact->getLayouterData()->getFax()?? $element->getDefault3(),
|
'number' => $contact->getLayouterData()->getFax() ?? $element->getDefault3(),
|
||||||
'appendix' => $contact->getLayouterData()->getFaxAppendix()?? $element->getDefault4()],
|
'appendix' => $contact->getLayouterData()->getFaxAppendix() ?? $element->getDefault4()],
|
||||||
ElementBinding::UsernameLogin => $contact->getEmail()?? $element->getDefault1(),
|
ElementBinding::UsernameLogin => $contact->getEmail() ?? $element->getDefault1(),
|
||||||
ElementBinding::Company => $contact->getLayouterData()->getCompany()?? $element->getDefault1(),
|
ElementBinding::Company => $contact->getLayouterData()->getCompany() ?? $element->getDefault1(),
|
||||||
ElementBinding::Company2 => $contact->getLayouterData()->getCompany2()?? $element->getDefault1(),
|
ElementBinding::Company2 => $contact->getLayouterData()->getCompany2() ?? $element->getDefault1(),
|
||||||
ElementBinding::Title => $contact->getLayouterData()->getTitle()?? $element->getDefault1(),
|
ElementBinding::Title => $contact->getLayouterData()->getTitle() ?? $element->getDefault1(),
|
||||||
ElementBinding::Position => $contact->getLayouterData()->getPosition()?? $element->getDefault1(),
|
ElementBinding::Position => $contact->getLayouterData()->getPosition() ?? $element->getDefault1(),
|
||||||
ElementBinding::Function => $contact->getLayouterData()->getFunction()?? $element->getDefault1(),
|
ElementBinding::Function => $contact->getLayouterData()->getFunction() ?? $element->getDefault1(),
|
||||||
ElementBinding::UserCountry => $contact->getCountryCode()?? $element->getDefault1(),
|
ElementBinding::UserCountry => $contact->getCountryCode() ?? $element->getDefault1(),
|
||||||
ElementBinding::Fon => [
|
ElementBinding::Fon => [
|
||||||
'areacode' => $contact->getLayouterData()->getPhoneAreaCode()?? $element->getDefault1(),
|
'areacode' => $contact->getLayouterData()->getPhoneAreaCode() ?? $element->getDefault1(),
|
||||||
'prefix' => $contact->getLayouterData()->getPhonePrefix()?? $element->getDefault2(),
|
'prefix' => $contact->getLayouterData()->getPhonePrefix() ?? $element->getDefault2(),
|
||||||
'number' => $contact->getLayouterData()->getPhone()?? $element->getDefault3(),
|
'number' => $contact->getLayouterData()->getPhone() ?? $element->getDefault3(),
|
||||||
'appendix' => $contact->getLayouterData()->getPhoneAppendix()?? $element->getDefault4()],
|
'appendix' => $contact->getLayouterData()->getPhoneAppendix() ?? $element->getDefault4()],
|
||||||
ElementBinding::Abteilung => $contact->getLayouterData()->getAbteilung()?? $element->getDefault1(),
|
ElementBinding::Abteilung => $contact->getLayouterData()->getAbteilung() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom1 => $contact->getCustom1()?? $element->getDefault1(),
|
ElementBinding::Custom1 => $contact->getCustom1() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom2 => $contact->getCustom2()?? $element->getDefault1(),
|
ElementBinding::Custom2 => $contact->getCustom2() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom3 => $contact->getCustom3()?? $element->getDefault1(),
|
ElementBinding::Custom3 => $contact->getCustom3() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom4 => $contact->getCustom4()?? $element->getDefault1(),
|
ElementBinding::Custom4 => $contact->getCustom4() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom5 => $contact->getCustom5()?? $element->getDefault1(),
|
ElementBinding::Custom5 => $contact->getCustom5() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom6 => $contact->getCustom6()?? $element->getDefault1(),
|
ElementBinding::Custom6 => $contact->getCustom6() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom7 => $contact->getCustom7()?? $element->getDefault1(),
|
ElementBinding::Custom7 => $contact->getCustom7() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom8 => $contact->getCustom8()?? $element->getDefault1(),
|
ElementBinding::Custom8 => $contact->getCustom8() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom9 => $contact->getCustom9()?? $element->getDefault1(),
|
ElementBinding::Custom9 => $contact->getCustom9() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom10 => $contact->getCustom10()?? $element->getDefault1(),
|
ElementBinding::Custom10 => $contact->getCustom10() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom11 => $contact->getCustom11()?? $element->getDefault1(),
|
ElementBinding::Custom11 => $contact->getCustom11() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom12 => $contact->getCustom12()?? $element->getDefault1(),
|
ElementBinding::Custom12 => $contact->getCustom12() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom13 => $contact->getCustom13()?? $element->getDefault1(),
|
ElementBinding::Custom13 => $contact->getCustom13() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom14 => $contact->getCustom14()?? $element->getDefault1(),
|
ElementBinding::Custom14 => $contact->getCustom14() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom15 => $contact->getCustom15()?? $element->getDefault1(),
|
ElementBinding::Custom15 => $contact->getCustom15() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom16 => $contact->getCustom16()?? $element->getDefault1(),
|
ElementBinding::Custom16 => $contact->getCustom16() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom17 => $contact->getCustom17()?? $element->getDefault1(),
|
ElementBinding::Custom17 => $contact->getCustom17() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom18 => $contact->getCustom18()?? $element->getDefault1(),
|
ElementBinding::Custom18 => $contact->getCustom18() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom19 => $contact->getCustom19()?? $element->getDefault1(),
|
ElementBinding::Custom19 => $contact->getCustom19() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom20 => $contact->getCustom20()?? $element->getDefault1(),
|
ElementBinding::Custom20 => $contact->getCustom20() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom21 => $contact->getCustom21()?? $element->getDefault1(),
|
ElementBinding::Custom21 => $contact->getCustom21() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom22 => $contact->getCustom22()?? $element->getDefault1(),
|
ElementBinding::Custom22 => $contact->getCustom22() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom23 => $contact->getCustom23()?? $element->getDefault1(),
|
ElementBinding::Custom23 => $contact->getCustom23() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom24 => $contact->getCustom24()?? $element->getDefault1(),
|
ElementBinding::Custom24 => $contact->getCustom24() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterMail => $contact->getLayouterData()->getEmail()?? $element->getDefault1(),
|
ElementBinding::LayouterMail => $contact->getLayouterData()->getEmail() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterCountryName => $contact->getLayouterData()->getCountryName()?? $element->getDefault1(),
|
ElementBinding::LayouterCountryName => $contact->getLayouterData()->getCountryName() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterCountryCode => $contact->getLayouterData()->getCountryCode()?? $element->getDefault1(),
|
ElementBinding::LayouterCountryCode => $contact->getLayouterData()->getCountryCode() ?? $element->getDefault1(),
|
||||||
ElementBinding::Birthday => $contact->getLayouterData()->getBirthday()?? $element->getDefault1(),
|
ElementBinding::Birthday => $contact->getLayouterData()->getBirthday() ?? $element->getDefault1(),
|
||||||
ElementBinding::Homepages => $contact->getLayouterData()->getHomepage()?? $element->getDefault1(),
|
ElementBinding::Homepages => $contact->getLayouterData()->getHomepage() ?? $element->getDefault1(),
|
||||||
ElementBinding::Salutation => $contact->getLayouterData()->getSalutation()?? $element->getDefault1(),
|
ElementBinding::Salutation => $contact->getLayouterData()->getSalutation() ?? $element->getDefault1(),
|
||||||
ElementBinding::UstId => $contact->getLayouterData()->getUstid()?? $element->getDefault1(),
|
ElementBinding::UstId => $contact->getLayouterData()->getUstid() ?? $element->getDefault1(),
|
||||||
ElementBinding::KSt => $contact->getLayouterData()->getKst()?? $element->getDefault1(),
|
ElementBinding::KSt => $contact->getLayouterData()->getKst() ?? $element->getDefault1(),
|
||||||
ElementBinding::State => $contact->getLayouterData()->getState()?? $element->getDefault1(),
|
ElementBinding::State => $contact->getLayouterData()->getState() ?? $element->getDefault1(),
|
||||||
ElementBinding::District => $contact->getLayouterData()->getDistrict()?? $element->getDefault1(),
|
ElementBinding::District => $contact->getLayouterData()->getDistrict() ?? $element->getDefault1(),
|
||||||
|
ElementBinding::Image1 => $contact->getLayouterData()->getImage1() ?? $element->getDefault1(),
|
||||||
|
ElementBinding::Image2 => $contact->getLayouterData()->getImage2() ?? $element->getDefault1(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if($elm = $data->getElement($element, $contact)) {
|
if ($elm = $data->getElement($element, $contact)) {
|
||||||
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => (bool)$elm['enable']];
|
if ($element->getType() == ElementType::Image && $elm['value'] != "") {
|
||||||
}else{
|
$media = $this->mediaManager->getModelByUuid($elm['value']);
|
||||||
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional()? $element->getOptionalDefault(): true];
|
$elmMedia = $media->getVariant($element->getImage()->aspectRatio);
|
||||||
|
$formData[$element->getId()] = ['value' => $elmMedia, 'enable' => (bool)$elm['enable']];
|
||||||
|
} else {
|
||||||
|
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => (bool)$elm['enable']];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($setting->getBasketField1Format() != "") {
|
if ($setting->getBasketField1Format() != "") {
|
||||||
$twigBF1 = $this->twig->createTemplate($setting->getBasketField1Format());
|
$twigBF1 = $this->twig->createTemplate($setting->getBasketField1Format());
|
||||||
$basketField1 = $twigBF1->render(['form' => $formData]);
|
$basketField1 = $twigBF1->render(['form' => $formData]);
|
||||||
}
|
}
|
||||||
if($setting->getBasketField2Format() != "") {
|
if ($setting->getBasketField2Format() != "") {
|
||||||
$twigBF2 = $this->twig->createTemplate($setting->getBasketField2Format());
|
$twigBF2 = $this->twig->createTemplate($setting->getBasketField2Format());
|
||||||
$basketField2 = $twigBF2->render(['form' => $formData]);
|
$basketField2 = $twigBF2->render(['form' => $formData]);
|
||||||
}
|
}
|
||||||
@ -174,7 +187,7 @@ class Save extends AbstractController
|
|||||||
$this->documentManager->persist($layouterDesignDataDoc);
|
$this->documentManager->persist($layouterDesignDataDoc);
|
||||||
$this->documentManager->flush();
|
$this->documentManager->flush();
|
||||||
|
|
||||||
if($data->isSek()) {
|
if ($data->isSek()) {
|
||||||
$this->requestStack->getSession()->getFlashBag()->add('success', 'Produkt in den Warenkorb gelegt');
|
$this->requestStack->getSession()->getFlashBag()->add('success', 'Produkt in den Warenkorb gelegt');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,23 +21,30 @@ use Symfony\Component\Serializer\SerializerInterface;
|
|||||||
|
|
||||||
class Update extends AbstractController
|
class Update extends AbstractController
|
||||||
{
|
{
|
||||||
public function __construct(readonly private \Plugin\Custom\PSC\CollectLayouter\Helper\SaveFiles $saveFilesHelper, private EntityManagerInterface $entityManager, private DocumentManager $documentManager, private SerializerInterface $serializer, private Contact $contactTransformer)
|
public function __construct(
|
||||||
{
|
readonly private \Plugin\Custom\PSC\CollectLayouter\Helper\SaveFiles $saveFilesHelper,
|
||||||
|
readonly private \Plugin\Custom\PSC\CollectLayouter\Helper\SaveContact $saveContactHelper,
|
||||||
|
private EntityManagerInterface $entityManager,
|
||||||
|
private DocumentManager $documentManager,
|
||||||
|
private SerializerInterface $serializer,
|
||||||
|
private Contact $contactTransformer
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route(path: '/update/{uuid}/{layouterUuid}', methods: ['PUT'])]
|
#[Route(path: '/update/{uuid}/{layouterUuid}', methods: ['PUT'])]
|
||||||
#[ParamConverter('data', class: Input::class, converter: 'psc_rest.request_body')]
|
#[ParamConverter('data', class: Input::class, converter: 'psc_rest.request_body')]
|
||||||
#[Tag('Plugin/Custom/PSC/CollectLayouter')]
|
#[Tag('Plugin/Custom/PSC/CollectLayouter')]
|
||||||
#[RequestBody(description: 'content',content: new JsonContent(ref: Input::class))]
|
#[RequestBody(description: 'content', content: new JsonContent(ref: Input::class))]
|
||||||
#[Response(response: 200, description: 'save config in session', content: new JsonContent(type: 'bool'))]
|
#[Response(response: 200, description: 'save config in session', content: new JsonContent(type: 'bool'))]
|
||||||
public function generatePreview(Input $data, string $uuid, string $layouterUuid): JsonResponse {
|
public function update(Input $data, string $uuid, string $layouterUuid): JsonResponse
|
||||||
|
{
|
||||||
|
|
||||||
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
||||||
|
|
||||||
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
||||||
$setting = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json');
|
$setting = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||||
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
||||||
if($this->getUser()) {
|
if ($this->getUser()) {
|
||||||
$this->contactTransformer->fromDb($contact, $this->getUser(), new \PSC\Shop\EntityBundle\Document\Contact());
|
$this->contactTransformer->fromDb($contact, $this->getUser(), new \PSC\Shop\EntityBundle\Document\Contact());
|
||||||
}
|
}
|
||||||
$this->saveFilesHelper->setSetting($setting);
|
$this->saveFilesHelper->setSetting($setting);
|
||||||
@ -45,6 +52,14 @@ class Update extends AbstractController
|
|||||||
$this->saveFilesHelper->setData($data);
|
$this->saveFilesHelper->setData($data);
|
||||||
|
|
||||||
$this->saveFilesHelper->storeFiles();
|
$this->saveFilesHelper->storeFiles();
|
||||||
|
|
||||||
|
if ($contact->getUuid() != "") {
|
||||||
|
$this->saveContactHelper->setSetting($setting);
|
||||||
|
$this->saveContactHelper->setContact($contact);
|
||||||
|
$this->saveContactHelper->setData($data);
|
||||||
|
$this->saveContactHelper->saveData();
|
||||||
|
}
|
||||||
|
|
||||||
$layoutDesignData = $this->entityManager
|
$layoutDesignData = $this->entityManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouterUuid));
|
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouterUuid));
|
||||||
|
|
||||||
@ -58,7 +73,7 @@ class Update extends AbstractController
|
|||||||
$layouterDesignDataDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\LayouterSession::class)
|
$layouterDesignDataDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\LayouterSession::class)
|
||||||
->findOneBy(['uid' => $layouterSession->getUID()]);
|
->findOneBy(['uid' => $layouterSession->getUID()]);
|
||||||
|
|
||||||
if(!$layouterDesignDataDoc) {
|
if (!$layouterDesignDataDoc) {
|
||||||
$layouterDesignDataDoc = new \PSC\Shop\EntityBundle\Document\LayouterSession();
|
$layouterDesignDataDoc = new \PSC\Shop\EntityBundle\Document\LayouterSession();
|
||||||
$layouterDesignDataDoc->setUid((string)$layoutDesignData->getUID());
|
$layouterDesignDataDoc->setUid((string)$layoutDesignData->getUID());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Plugin\Custom\PSC\CollectLayouter\Controller\Frontend;
|
namespace Plugin\Custom\PSC\CollectLayouter\Controller\Frontend;
|
||||||
|
|
||||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
|
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
|
||||||
use OpenApi\Attributes\Response;
|
use OpenApi\Attributes\Response;
|
||||||
|
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Dto\Preview\Input;
|
use Plugin\Custom\PSC\CollectLayouter\Dto\Preview\Input;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Helper\MPDF;
|
use Plugin\Custom\PSC\CollectLayouter\Helper\MPDF;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\Element;
|
use Plugin\Custom\PSC\CollectLayouter\Model\Element;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
||||||
|
use Plugin\Custom\PSC\CollectLayouter\Model\ElementType;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
|
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
|
||||||
use PSC\Shop\ContactBundle\Repository\ContactRepository;
|
use PSC\Shop\ContactBundle\Repository\ContactRepository;
|
||||||
use PSC\Shop\ContactBundle\Transformer\Model\Contact;
|
use PSC\Shop\ContactBundle\Transformer\Model\Contact;
|
||||||
@ -23,12 +26,15 @@ use Symfony\Component\Serializer\SerializerInterface;
|
|||||||
#[Route('/designer')]
|
#[Route('/designer')]
|
||||||
class DesignerController extends AbstractController
|
class DesignerController extends AbstractController
|
||||||
{
|
{
|
||||||
|
public function __construct(
|
||||||
public function __construct(readonly private Contact $contactTransformer, readonly private MPDF $mpdf,
|
readonly private Contact $contactTransformer,
|
||||||
readonly private EntityManagerInterface $entityManager,
|
readonly private MPDF $mpdf,
|
||||||
readonly private DocumentManager $documentManager,
|
readonly private EntityManagerInterface $entityManager,
|
||||||
readonly private SerializerInterface $serializer, readonly private RequestStack $requestStack)
|
readonly private DocumentManager $documentManager,
|
||||||
{
|
readonly private SerializerInterface $serializer,
|
||||||
|
readonly private RequestStack $requestStack,
|
||||||
|
readonly private MediaManager $mediaManager
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Template()]
|
#[Template()]
|
||||||
@ -48,18 +54,18 @@ class DesignerController extends AbstractController
|
|||||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||||
|
|
||||||
$token = null;
|
$token = null;
|
||||||
if($contactUuid) {
|
if ($contactUuid) {
|
||||||
$user = $contactRepository->findOneBy(['uuid' => $contactUuid]);
|
$user = $contactRepository->findOneBy(['uuid' => $contactUuid]);
|
||||||
$token = $JWTTokenManager->create($user);
|
$token = $JWTTokenManager->create($user);
|
||||||
}
|
}
|
||||||
/** @var Setting $settings */
|
/** @var Setting $settings */
|
||||||
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json');
|
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||||
return [
|
return [
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'productDoc' => $productDoc,
|
'productDoc' => $productDoc,
|
||||||
'contactUuid' => $contactUuid,
|
'contactUuid' => $contactUuid,
|
||||||
'settings' => $settings,
|
'settings' => $settings,
|
||||||
'jwt' => $token? : ''
|
'jwt' => $token ?: ''
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,18 +86,18 @@ class DesignerController extends AbstractController
|
|||||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||||
|
|
||||||
$token = null;
|
$token = null;
|
||||||
if($contactUuid) {
|
if ($contactUuid) {
|
||||||
$user = $contactRepository->findOneBy(['uuid' => $contactUuid]);
|
$user = $contactRepository->findOneBy(['uuid' => $contactUuid]);
|
||||||
$token = $JWTTokenManager->create($user);
|
$token = $JWTTokenManager->create($user);
|
||||||
}
|
}
|
||||||
/** @var Setting $settings */
|
/** @var Setting $settings */
|
||||||
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json');
|
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||||
return [
|
return [
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'productDoc' => $productDoc,
|
'productDoc' => $productDoc,
|
||||||
'contactUuid' => $contactUuid,
|
'contactUuid' => $contactUuid,
|
||||||
'settings' => $settings,
|
'settings' => $settings,
|
||||||
'jwt' => $token? : '',
|
'jwt' => $token ?: '',
|
||||||
'layouterUuid' => Uuid::uuid4(),
|
'layouterUuid' => Uuid::uuid4(),
|
||||||
'mode' => $mode
|
'mode' => $mode
|
||||||
];
|
];
|
||||||
@ -115,12 +121,12 @@ class DesignerController extends AbstractController
|
|||||||
|
|
||||||
|
|
||||||
/** @var Setting $settings */
|
/** @var Setting $settings */
|
||||||
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json');
|
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||||
$layoutDesignData = $this->entityManager
|
$layoutDesignData = $this->entityManager
|
||||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouterId));
|
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouterId));
|
||||||
|
|
||||||
$token = null;
|
$token = null;
|
||||||
if($contactUuid) {
|
if ($contactUuid) {
|
||||||
$user = $contactRepository->findOneBy(['uuid' => $layoutDesignData->getDesign()['contactUuid']]);
|
$user = $contactRepository->findOneBy(['uuid' => $layoutDesignData->getDesign()['contactUuid']]);
|
||||||
$token = $JWTTokenManager->create($user);
|
$token = $JWTTokenManager->create($user);
|
||||||
}
|
}
|
||||||
@ -130,19 +136,20 @@ class DesignerController extends AbstractController
|
|||||||
'productDoc' => $productDoc,
|
'productDoc' => $productDoc,
|
||||||
'contactUuid' => $layoutDesignData->getDesign()['contactUuid'],
|
'contactUuid' => $layoutDesignData->getDesign()['contactUuid'],
|
||||||
'settings' => $settings,
|
'settings' => $settings,
|
||||||
'jwt' => $token? : '',
|
'jwt' => $token ?: '',
|
||||||
'layouterId' => $layouterId,
|
'layouterId' => $layouterId,
|
||||||
'data' => $layoutDesignData->getDesign()['data']
|
'data' => $layoutDesignData->getDesign()['data']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route(path: '/preview/pdf/{uuid}/{contact}/{type}', name: 'plugin_custom_psc_collectlayouter_preview')]
|
#[Route(path: '/preview/pdf/{uuid}/{contact}/{type}', name: 'plugin_custom_psc_collectlayouter_preview')]
|
||||||
public function preview(string $uuid, string $contact, int $type = 1): Response {
|
public function preview(string $uuid, string $contact, int $type = 1): Response
|
||||||
|
{
|
||||||
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
||||||
$contactEntity = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Contact::class)->findOneBy(['uuid' => $contact]);
|
$contactEntity = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Contact::class)->findOneBy(['uuid' => $contact]);
|
||||||
|
|
||||||
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
||||||
$setting = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config')?? '{}', Setting::class, 'json');
|
$setting = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||||
|
|
||||||
|
|
||||||
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
||||||
@ -153,76 +160,84 @@ class DesignerController extends AbstractController
|
|||||||
$formData = [];
|
$formData = [];
|
||||||
|
|
||||||
/** @var Element $element */
|
/** @var Element $element */
|
||||||
foreach($setting->getCustomerForm() as $element) {
|
foreach ($setting->getCustomerForm() as $element) {
|
||||||
$value = match($element->getBinding()) {
|
$value = match($element->getBinding()) {
|
||||||
ElementBinding::none => $element->getDefaultForTypePreview(),
|
ElementBinding::none => $element->getDefaultForTypePreview(),
|
||||||
ElementBinding::StreetHouseNumber => ['street' => $contact->getLayouterData()->getStreet()?? $element->getDefault1(), 'houseNumber' => $contact->getLayouterData()->getHouseNumber()?? $element->getDefault2()],
|
ElementBinding::StreetHouseNumber => ['street' => $contact->getLayouterData()->getStreet() ?? $element->getDefault1(), 'houseNumber' => $contact->getLayouterData()->getHouseNumber() ?? $element->getDefault2()],
|
||||||
ElementBinding::ZipCity => ['zip' => $contact->getLayouterData()->getZip()?? $element->getDefault1(), 'city' => $contact->getLayouterData()->getCity()?? $element->getDefault2()],
|
ElementBinding::ZipCity => ['zip' => $contact->getLayouterData()->getZip() ?? $element->getDefault1(), 'city' => $contact->getLayouterData()->getCity() ?? $element->getDefault2()],
|
||||||
ElementBinding::Firstname => $contact->getLayouterData()->getFirstname()?? $element->getDefault1(),
|
ElementBinding::Firstname => $contact->getLayouterData()->getFirstname() ?? $element->getDefault1(),
|
||||||
ElementBinding::Lastname => $contact->getLayouterData()->getLastname()?? $element->getDefault1(),
|
ElementBinding::Lastname => $contact->getLayouterData()->getLastname() ?? $element->getDefault1(),
|
||||||
ElementBinding::Mobile => [
|
ElementBinding::Mobile => [
|
||||||
'areacode' => $contact->getLayouterData()->getMobileAreaCode()?? $element->getDefault1(),
|
'areacode' => $contact->getLayouterData()->getMobileAreaCode() ?? $element->getDefault1(),
|
||||||
'appendix' => $contact->getLayouterData()->getMobileAppendix()?? $element->getDefault2(),
|
'appendix' => $contact->getLayouterData()->getMobileAppendix() ?? $element->getDefault2(),
|
||||||
'number' => $contact->getLayouterData()->getMobile()?? $element->getDefault3(),
|
'number' => $contact->getLayouterData()->getMobile() ?? $element->getDefault3(),
|
||||||
'prefix' => $contact->getLayouterData()->getMobilePrefix()?? $element->getDefault4()],
|
'prefix' => $contact->getLayouterData()->getMobilePrefix() ?? $element->getDefault4()],
|
||||||
ElementBinding::UsernameLogin => $contact->getEmail()?? $element->getDefault1(),
|
ElementBinding::UsernameLogin => $contact->getEmail() ?? $element->getDefault1(),
|
||||||
ElementBinding::Company => $contact->getLayouterData()->getCompany()?? $element->getDefault1(),
|
ElementBinding::Company => $contact->getLayouterData()->getCompany() ?? $element->getDefault1(),
|
||||||
ElementBinding::Company2 => $contact->getLayouterData()->getCompany2()?? $element->getDefault1(),
|
ElementBinding::Company2 => $contact->getLayouterData()->getCompany2() ?? $element->getDefault1(),
|
||||||
ElementBinding::Title => $contact->getLayouterData()->getTitle()?? $element->getDefault1(),
|
ElementBinding::Title => $contact->getLayouterData()->getTitle() ?? $element->getDefault1(),
|
||||||
ElementBinding::Position => $contact->getLayouterData()->getPosition()?? $element->getDefault1(),
|
ElementBinding::Position => $contact->getLayouterData()->getPosition() ?? $element->getDefault1(),
|
||||||
ElementBinding::Function => $contact->getLayouterData()->getFunction()?? $element->getDefault1(),
|
ElementBinding::Function => $contact->getLayouterData()->getFunction() ?? $element->getDefault1(),
|
||||||
ElementBinding::UserCountry => $contact->getCountryCode()?? $element->getDefault1(),
|
ElementBinding::UserCountry => $contact->getCountryCode() ?? $element->getDefault1(),
|
||||||
ElementBinding::Fon => [
|
ElementBinding::Fon => [
|
||||||
'areacode' => $contact->getLayouterData()->getPhoneAreaCode()?? $element->getDefault1(),
|
'areacode' => $contact->getLayouterData()->getPhoneAreaCode() ?? $element->getDefault1(),
|
||||||
'appendix' => $contact->getLayouterData()->getPhoneAppendix()?? $element->getDefault2(),
|
'appendix' => $contact->getLayouterData()->getPhoneAppendix() ?? $element->getDefault2(),
|
||||||
'number' => $contact->getLayouterData()->getPhone()?? $element->getDefault3(),
|
'number' => $contact->getLayouterData()->getPhone() ?? $element->getDefault3(),
|
||||||
'prefix' => $contact->getLayouterData()->getPhonePrefix()?? $element->getDefault4()],
|
'prefix' => $contact->getLayouterData()->getPhonePrefix() ?? $element->getDefault4()],
|
||||||
ElementBinding::Fax => [
|
ElementBinding::Fax => [
|
||||||
'areacode' => $contact->getLayouterData()->getFaxAreaCode()?? $element->getDefault1(),
|
'areacode' => $contact->getLayouterData()->getFaxAreaCode() ?? $element->getDefault1(),
|
||||||
'appendix' => $contact->getLayouterData()->getFaxPrefix()?? $element->getDefault2(),
|
'appendix' => $contact->getLayouterData()->getFaxPrefix() ?? $element->getDefault2(),
|
||||||
'number' => $contact->getLayouterData()->getFax()?? $element->getDefault3(),
|
'number' => $contact->getLayouterData()->getFax() ?? $element->getDefault3(),
|
||||||
'prefix' => $contact->getLayouterData()->getFaxAppendix()?? $element->getDefault4()],
|
'prefix' => $contact->getLayouterData()->getFaxAppendix() ?? $element->getDefault4()],
|
||||||
ElementBinding::Abteilung => $contact->getLayouterData()->getAbteilung()?? $element->getDefault1(),
|
ElementBinding::Abteilung => $contact->getLayouterData()->getAbteilung() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom1 => $contact->getCustom1()?? $element->getDefault1(),
|
ElementBinding::Custom1 => $contact->getCustom1() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom2 => $contact->getCustom2()?? $element->getDefault1(),
|
ElementBinding::Custom2 => $contact->getCustom2() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom3 => $contact->getCustom3()?? $element->getDefault1(),
|
ElementBinding::Custom3 => $contact->getCustom3() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom4 => $contact->getCustom4()?? $element->getDefault1(),
|
ElementBinding::Custom4 => $contact->getCustom4() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom5 => $contact->getCustom5()?? $element->getDefault1(),
|
ElementBinding::Custom5 => $contact->getCustom5() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom6 => $contact->getCustom6()?? $element->getDefault1(),
|
ElementBinding::Custom6 => $contact->getCustom6() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom7 => $contact->getCustom7()?? $element->getDefault1(),
|
ElementBinding::Custom7 => $contact->getCustom7() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom8 => $contact->getCustom8()?? $element->getDefault1(),
|
ElementBinding::Custom8 => $contact->getCustom8() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom9 => $contact->getCustom9()?? $element->getDefault1(),
|
ElementBinding::Custom9 => $contact->getCustom9() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom10 => $contact->getCustom10()?? $element->getDefault1(),
|
ElementBinding::Custom10 => $contact->getCustom10() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom11 => $contact->getCustom11()?? $element->getDefault1(),
|
ElementBinding::Custom11 => $contact->getCustom11() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom12 => $contact->getCustom12()?? $element->getDefault1(),
|
ElementBinding::Custom12 => $contact->getCustom12() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom13 => $contact->getCustom13()?? $element->getDefault1(),
|
ElementBinding::Custom13 => $contact->getCustom13() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom14 => $contact->getCustom14()?? $element->getDefault1(),
|
ElementBinding::Custom14 => $contact->getCustom14() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom15 => $contact->getCustom15()?? $element->getDefault1(),
|
ElementBinding::Custom15 => $contact->getCustom15() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom16 => $contact->getCustom16()?? $element->getDefault1(),
|
ElementBinding::Custom16 => $contact->getCustom16() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom17 => $contact->getCustom17()?? $element->getDefault1(),
|
ElementBinding::Custom17 => $contact->getCustom17() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom18 => $contact->getCustom18()?? $element->getDefault1(),
|
ElementBinding::Custom18 => $contact->getCustom18() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom19 => $contact->getCustom19()?? $element->getDefault1(),
|
ElementBinding::Custom19 => $contact->getCustom19() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom20 => $contact->getCustom20()?? $element->getDefault1(),
|
ElementBinding::Custom20 => $contact->getCustom20() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom21 => $contact->getCustom21()?? $element->getDefault1(),
|
ElementBinding::Custom21 => $contact->getCustom21() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom22 => $contact->getCustom22()?? $element->getDefault1(),
|
ElementBinding::Custom22 => $contact->getCustom22() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom23 => $contact->getCustom23()?? $element->getDefault1(),
|
ElementBinding::Custom23 => $contact->getCustom23() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom24 => $contact->getCustom24()?? $element->getDefault1(),
|
ElementBinding::Custom24 => $contact->getCustom24() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterMail => $contact->getLayouterData()->getEmail()?? $element->getDefault1(),
|
ElementBinding::LayouterMail => $contact->getLayouterData()->getEmail() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterCountryName => $contact->getLayouterData()->getCountryName()?? $element->getDefault1(),
|
ElementBinding::LayouterCountryName => $contact->getLayouterData()->getCountryName() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterCountryCode => $contact->getLayouterData()->getCountryCode()?? $element->getDefault1(),
|
ElementBinding::LayouterCountryCode => $contact->getLayouterData()->getCountryCode() ?? $element->getDefault1(),
|
||||||
ElementBinding::Birthday => $contact->getLayouterData()->getBirthday()?? $element->getDefault1(),
|
ElementBinding::Birthday => $contact->getLayouterData()->getBirthday() ?? $element->getDefault1(),
|
||||||
ElementBinding::Homepages => $contact->getLayouterData()->getHomepage()?? $element->getDefault1(),
|
ElementBinding::Homepages => $contact->getLayouterData()->getHomepage() ?? $element->getDefault1(),
|
||||||
ElementBinding::Salutation => $contact->getLayouterData()->getSalutation()?? $element->getDefault1(),
|
ElementBinding::Salutation => $contact->getLayouterData()->getSalutation() ?? $element->getDefault1(),
|
||||||
ElementBinding::UstId => $contact->getLayouterData()->getUstid()?? $element->getDefault1(),
|
ElementBinding::UstId => $contact->getLayouterData()->getUstid() ?? $element->getDefault1(),
|
||||||
ElementBinding::KSt => $contact->getLayouterData()->getKst()?? $element->getDefault1(),
|
ElementBinding::KSt => $contact->getLayouterData()->getKst() ?? $element->getDefault1(),
|
||||||
ElementBinding::State => $contact->getLayouterData()->getState()?? $element->getDefault1(),
|
ElementBinding::State => $contact->getLayouterData()->getState() ?? $element->getDefault1(),
|
||||||
ElementBinding::District => $contact->getLayouterData()->getDistrict()?? $element->getDefault1(),
|
ElementBinding::District => $contact->getLayouterData()->getDistrict() ?? $element->getDefault1(),
|
||||||
|
ElementBinding::Image1 => $contact->getLayouterData()->getImage1() ?? $element->getDefault1(),
|
||||||
|
ElementBinding::Image2 => $contact->getLayouterData()->getImage2() ?? $element->getDefault1(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if($elm = $data->getElement($element, $contact)) {
|
if ($elm = $data->getElement($element, $contact)) {
|
||||||
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => $elm['enable']];
|
if ($element->getType() == ElementType::Image && $elm['value'] != "") {
|
||||||
}else{
|
$media = $this->mediaManager->getModelByUuid($elm['value']);
|
||||||
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional()? $element->getOptionalDefault(): true];
|
$elmMedia = $media->getVariant($element->getImage()->aspectRatio);
|
||||||
|
$formData[$element->getId()] = ['value' => $elmMedia, 'enable' => (bool)$elm['enable']];
|
||||||
|
} else {
|
||||||
|
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => $elm['enable']];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -234,10 +249,10 @@ class DesignerController extends AbstractController
|
|||||||
|
|
||||||
|
|
||||||
$filename = '';
|
$filename = '';
|
||||||
if(isset($formData['firstname'])) {
|
if (isset($formData['firstname'])) {
|
||||||
$filename = $formData['firstname']['value'] . '_';
|
$filename = $formData['firstname']['value'] . '_';
|
||||||
}
|
}
|
||||||
if(isset($formData['lastname'])) {
|
if (isset($formData['lastname'])) {
|
||||||
$filename = $filename . $formData['lastname']['value'] . '_';
|
$filename = $filename . $formData['lastname']['value'] . '_';
|
||||||
}
|
}
|
||||||
$filename = $filename . $product->getTitle() . '.pdf';
|
$filename = $filename . $product->getTitle() . '.pdf';
|
||||||
|
|||||||
@ -17,7 +17,6 @@ use Symfonycasts\DynamicForms\DynamicFormBuilder;
|
|||||||
|
|
||||||
class Element extends AbstractType
|
class Element extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder = new DynamicFormBuilder($builder);
|
$builder = new DynamicFormBuilder($builder);
|
||||||
@ -48,19 +47,26 @@ class Element extends AbstractType
|
|||||||
|
|
||||||
$this->buildDefault($builder);
|
$this->buildDefault($builder);
|
||||||
$this->buildPhone($builder);
|
$this->buildPhone($builder);
|
||||||
|
$this->buildImage($builder);
|
||||||
|
|
||||||
return $builder;
|
return $builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildBinding(FormBuilderInterface $builder): void {
|
public function buildBinding(FormBuilderInterface $builder): void
|
||||||
|
{
|
||||||
|
|
||||||
$builder->addDependent('binding', ['type'], function(DependentField $field, ?ElementType $type) {
|
$builder->addDependent('binding', ['type'], function (DependentField $field, ?ElementType $type) {
|
||||||
|
|
||||||
if($type == ElementType::Phone) {
|
if($type == ElementType::Phone) {
|
||||||
$field->add(ChoiceType::class, [
|
$field->add(ChoiceType::class, [
|
||||||
'label' => 'Binding',
|
'label' => 'Binding',
|
||||||
'choices' => ElementBinding::getForTypePhone()]);
|
'choices' => ElementBinding::getForTypePhone()]);
|
||||||
}
|
}
|
||||||
|
if($type == ElementType::Image) {
|
||||||
|
$field->add(ChoiceType::class, [
|
||||||
|
'label' => 'Binding',
|
||||||
|
'choices' => ElementBinding::getForTypeImage()]);
|
||||||
|
}
|
||||||
if($type == ElementType::Text || $type === null) {
|
if($type == ElementType::Text || $type === null) {
|
||||||
$field->add(ChoiceType::class, [
|
$field->add(ChoiceType::class, [
|
||||||
'label' => 'Binding',
|
'label' => 'Binding',
|
||||||
@ -90,9 +96,10 @@ class Element extends AbstractType
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
public function buildPhone(FormBuilderInterface $builder): void {
|
public function buildPhone(FormBuilderInterface $builder): void
|
||||||
|
{
|
||||||
|
|
||||||
$builder->addDependent('phone', ['type'], function(DependentField $field, ?ElementType $type) {
|
$builder->addDependent('phone', ['type'], function (DependentField $field, ?ElementType $type) {
|
||||||
if($type == ElementType::Phone) {
|
if($type == ElementType::Phone) {
|
||||||
$field->add(PhoneType::class, [
|
$field->add(PhoneType::class, [
|
||||||
'label' => 'Phone'
|
'label' => 'Phone'
|
||||||
@ -102,25 +109,39 @@ class Element extends AbstractType
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildDefault(FormBuilderInterface $builder): void {
|
public function buildImage(FormBuilderInterface $builder): void
|
||||||
$builder->addDependent('default1', ['type'], function(DependentField $field, ?ElementType $type) {
|
{
|
||||||
|
|
||||||
|
$builder->addDependent('image', ['type'], function (DependentField $field, ?ElementType $type) {
|
||||||
|
if($type == ElementType::Image) {
|
||||||
|
$field->add(ImageType::class, [
|
||||||
|
'label' => 'Image'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildDefault(FormBuilderInterface $builder): void
|
||||||
|
{
|
||||||
|
$builder->addDependent('default1', ['type'], function (DependentField $field, ?ElementType $type) {
|
||||||
if($type == ElementType::Text) {
|
if($type == ElementType::Text) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => false
|
'label' => false
|
||||||
]);
|
]);
|
||||||
}elseif($type == ElementType::ZipCity) {
|
} elseif($type == ElementType::ZipCity) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'Zip'
|
'label' => 'Zip'
|
||||||
]);
|
]);
|
||||||
}elseif($type == ElementType::StreetHouseNumber) {
|
} elseif($type == ElementType::StreetHouseNumber) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'Street'
|
'label' => 'Street'
|
||||||
]);
|
]);
|
||||||
}elseif($type == ElementType::Phone) {
|
} elseif($type == ElementType::Phone) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'AreaCode'
|
'label' => 'AreaCode'
|
||||||
]);
|
]);
|
||||||
}elseif($type == ElementType::eMail) {
|
} elseif($type == ElementType::eMail) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'Email'
|
'label' => 'Email'
|
||||||
]);
|
]);
|
||||||
@ -128,37 +149,37 @@ class Element extends AbstractType
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$builder->addDependent('default2', ['type'], function(DependentField $field, ?ElementType $type) {
|
$builder->addDependent('default2', ['type'], function (DependentField $field, ?ElementType $type) {
|
||||||
if($type == ElementType::ZipCity) {
|
if($type == ElementType::ZipCity) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'City'
|
'label' => 'City'
|
||||||
]);
|
]);
|
||||||
}elseif($type == ElementType::StreetHouseNumber) {
|
} elseif($type == ElementType::StreetHouseNumber) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'HouseNumber'
|
'label' => 'HouseNumber'
|
||||||
]);
|
]);
|
||||||
}elseif($type == ElementType::Phone) {
|
} elseif($type == ElementType::Phone) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'Prefix'
|
'label' => 'Prefix'
|
||||||
]);
|
]);
|
||||||
}elseif($type == ElementType::eMailSplit) {
|
} elseif($type == ElementType::eMailSplit) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'Name'
|
'label' => 'Name'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$builder->addDependent('default3', ['type'], function(DependentField $field, ?ElementType $type) {
|
$builder->addDependent('default3', ['type'], function (DependentField $field, ?ElementType $type) {
|
||||||
if($type == ElementType::Phone) {
|
if($type == ElementType::Phone) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'Number'
|
'label' => 'Number'
|
||||||
]);
|
]);
|
||||||
}elseif($type == ElementType::eMailSplit) {
|
} elseif($type == ElementType::eMailSplit) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'Domain'
|
'label' => 'Domain'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$builder->addDependent('default4', ['type'], function(DependentField $field, ?ElementType $type) {
|
$builder->addDependent('default4', ['type'], function (DependentField $field, ?ElementType $type) {
|
||||||
if($type == ElementType::Phone) {
|
if($type == ElementType::Phone) {
|
||||||
$field->add(TextType::class, [
|
$field->add(TextType::class, [
|
||||||
'label' => 'Appendix'
|
'label' => 'Appendix'
|
||||||
|
|||||||
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Plugin\Custom\PSC\CollectLayouter\Form;
|
||||||
|
|
||||||
|
use PSC\Shop\MediaBundle\Service\Folder;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class ImageType extends AbstractType
|
||||||
|
{
|
||||||
|
public function __construct(private readonly Folder $folderService)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
{
|
||||||
|
$builder->add('cropAllowed', CheckboxType::class, [
|
||||||
|
'label' => 'Crop Allowed']);
|
||||||
|
|
||||||
|
$builder->add('aspectRatio', TextType::class, [
|
||||||
|
'label' => 'Aspect Ratio (1/1, 1/2 usw. oder leer für keine Einschränkung)']);
|
||||||
|
|
||||||
|
$builder->add('cropMode', ChoiceType::class, [
|
||||||
|
'choices' => ['Rectangle' => 1, 'Circle' => 2],
|
||||||
|
'label' => 'Crop Mode']);
|
||||||
|
|
||||||
|
|
||||||
|
$builder->add('mediaFolder', ChoiceType::class, [
|
||||||
|
'choices' => $this->folderService->getTreeForSelectbox(),
|
||||||
|
'label' => 'mediaFolder']);
|
||||||
|
|
||||||
|
return $builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults(['data_class' => \Plugin\Custom\PSC\CollectLayouter\Model\Image::class, 'allow_extra_fields' => true]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,6 +8,7 @@
|
|||||||
* @license Private
|
* @license Private
|
||||||
* @link http://www.printshopcreator.de
|
* @link http://www.printshopcreator.de
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Plugin\Custom\PSC\CollectLayouter\Form;
|
namespace Plugin\Custom\PSC\CollectLayouter\Form;
|
||||||
|
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Plugin\Custom\PSC\CollectLayouter\Helper;
|
namespace Plugin\Custom\PSC\CollectLayouter\Helper;
|
||||||
|
|
||||||
|
use PSC\Shop\MediaBundle\Model\Media;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Dto\Save\Input;
|
use Plugin\Custom\PSC\CollectLayouter\Dto\Save\Input;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\Element;
|
use Plugin\Custom\PSC\CollectLayouter\Model\Element;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
||||||
@ -11,7 +12,6 @@ use PSC\Shop\ContactBundle\Model\Contact;
|
|||||||
|
|
||||||
class SaveContact
|
class SaveContact
|
||||||
{
|
{
|
||||||
|
|
||||||
private Setting $setting;
|
private Setting $setting;
|
||||||
private Contact $contact;
|
private Contact $contact;
|
||||||
private Input|\Plugin\Custom\PSC\CollectLayouter\Dto\SaveContact\Input $data;
|
private Input|\Plugin\Custom\PSC\CollectLayouter\Dto\SaveContact\Input $data;
|
||||||
@ -37,9 +37,9 @@ class SaveContact
|
|||||||
|
|
||||||
public function saveData()
|
public function saveData()
|
||||||
{
|
{
|
||||||
foreach($this->setting->getCustomerForm() as $element) {
|
foreach ($this->setting->getCustomerForm() as $element) {
|
||||||
if($element->getBinding() != ElementBinding::none && $element->getSaveBack() && $elm = $this->data->getElement($element, $this->contact)) {
|
if ($element->getBinding() != ElementBinding::none && $element->getSaveBack() && $elm = $this->data->getElement($element, $this->contact)) {
|
||||||
switch($element->getBinding()) {
|
switch ($element->getBinding()) {
|
||||||
case ElementBinding::none:
|
case ElementBinding::none:
|
||||||
break;
|
break;
|
||||||
case ElementBinding::UsernameLogin:
|
case ElementBinding::UsernameLogin:
|
||||||
@ -78,22 +78,22 @@ class SaveContact
|
|||||||
$this->contact->setCountryCode($elm['value']);
|
$this->contact->setCountryCode($elm['value']);
|
||||||
break;
|
break;
|
||||||
case ElementBinding::Fon:
|
case ElementBinding::Fon:
|
||||||
$this->contact->getLayouterData()->setPhoneAreaCode((string)($elm['value']['areacode']?? $element->getDefault1()));
|
$this->contact->getLayouterData()->setPhoneAreaCode((string)($elm['value']['areacode'] ?? $element->getDefault1()));
|
||||||
$this->contact->getLayouterData()->setPhonePrefix((string)($elm['value']['prefix']?? $element->getDefault2()));
|
$this->contact->getLayouterData()->setPhonePrefix((string)($elm['value']['prefix'] ?? $element->getDefault2()));
|
||||||
$this->contact->getLayouterData()->setPhone((string)($elm['value']['number']?? $element->getDefault3()));
|
$this->contact->getLayouterData()->setPhone((string)($elm['value']['number'] ?? $element->getDefault3()));
|
||||||
$this->contact->getLayouterData()->setPhoneAppendix((string)($elm['value']['appendix']?? $element->getDefault4()));
|
$this->contact->getLayouterData()->setPhoneAppendix((string)($elm['value']['appendix'] ?? $element->getDefault4()));
|
||||||
break;
|
break;
|
||||||
case ElementBinding::Mobile:
|
case ElementBinding::Mobile:
|
||||||
$this->contact->getLayouterData()->setMobileAreaCode((string)($elm['value']['areacode']?? $element->getDefault1()));
|
$this->contact->getLayouterData()->setMobileAreaCode((string)($elm['value']['areacode'] ?? $element->getDefault1()));
|
||||||
$this->contact->getLayouterData()->setMobilePrefix((string)($elm['value']['prefix']?? $element->getDefault2()));
|
$this->contact->getLayouterData()->setMobilePrefix((string)($elm['value']['prefix'] ?? $element->getDefault2()));
|
||||||
$this->contact->getLayouterData()->setMobile((string)($elm['value']['number']?? $element->getDefault3()));
|
$this->contact->getLayouterData()->setMobile((string)($elm['value']['number'] ?? $element->getDefault3()));
|
||||||
$this->contact->getLayouterData()->setMobileAppendix((string)($elm['value']['appendix']?? $element->getDefault4()));
|
$this->contact->getLayouterData()->setMobileAppendix((string)($elm['value']['appendix'] ?? $element->getDefault4()));
|
||||||
break;
|
break;
|
||||||
case ElementBinding::Fax:
|
case ElementBinding::Fax:
|
||||||
$this->contact->getLayouterData()->setFaxAreaCode((string)($elm['value']['areacode']?? $element->getDefault1()));
|
$this->contact->getLayouterData()->setFaxAreaCode((string)($elm['value']['areacode'] ?? $element->getDefault1()));
|
||||||
$this->contact->getLayouterData()->setFaxPrefix((string)($elm['value']['prefix']?? $element->getDefault2()));
|
$this->contact->getLayouterData()->setFaxPrefix((string)($elm['value']['prefix'] ?? $element->getDefault2()));
|
||||||
$this->contact->getLayouterData()->setFax((string)($elm['value']['number']?? $element->getDefault3()));
|
$this->contact->getLayouterData()->setFax((string)($elm['value']['number'] ?? $element->getDefault3()));
|
||||||
$this->contact->getLayouterData()->setFaxAppendix((string)($elm['value']['appendix']?? $element->getDefault4()));
|
$this->contact->getLayouterData()->setFaxAppendix((string)($elm['value']['appendix'] ?? $element->getDefault4()));
|
||||||
break;
|
break;
|
||||||
case ElementBinding::Abteilung:
|
case ElementBinding::Abteilung:
|
||||||
$this->contact->getLayouterData()->setAbteilung($elm['value']);
|
$this->contact->getLayouterData()->setAbteilung($elm['value']);
|
||||||
@ -200,6 +200,16 @@ class SaveContact
|
|||||||
case ElementBinding::District:
|
case ElementBinding::District:
|
||||||
$this->contact->getLayouterData()->setDistrict((string)$elm['value']);
|
$this->contact->getLayouterData()->setDistrict((string)$elm['value']);
|
||||||
break;
|
break;
|
||||||
|
case ElementBinding::Image1:
|
||||||
|
$media = new Media();
|
||||||
|
$media->setUuid($elm['value']);
|
||||||
|
$this->contact->getLayouterData()->setImage1($media);
|
||||||
|
break;
|
||||||
|
case ElementBinding::Image2:
|
||||||
|
$media = new Media();
|
||||||
|
$media->setUuid($elm['value']);
|
||||||
|
$this->contact->getLayouterData()->setImage2($media);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,16 +2,17 @@
|
|||||||
|
|
||||||
namespace Plugin\Custom\PSC\CollectLayouter\Helper;
|
namespace Plugin\Custom\PSC\CollectLayouter\Helper;
|
||||||
|
|
||||||
|
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Dto\Save\Input;
|
use Plugin\Custom\PSC\CollectLayouter\Dto\Save\Input;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Helper\MPDF;
|
use Plugin\Custom\PSC\CollectLayouter\Helper\MPDF;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\Element;
|
use Plugin\Custom\PSC\CollectLayouter\Model\Element;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
use Plugin\Custom\PSC\CollectLayouter\Model\ElementBinding;
|
||||||
|
use Plugin\Custom\PSC\CollectLayouter\Model\ElementType;
|
||||||
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
|
use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
|
||||||
use PSC\Shop\ContactBundle\Model\Contact;
|
use PSC\Shop\ContactBundle\Model\Contact;
|
||||||
|
|
||||||
class SaveFiles
|
class SaveFiles
|
||||||
{
|
{
|
||||||
|
|
||||||
private Setting $setting;
|
private Setting $setting;
|
||||||
private Contact $contact;
|
private Contact $contact;
|
||||||
private Input $data;
|
private Input $data;
|
||||||
@ -19,7 +20,7 @@ class SaveFiles
|
|||||||
private string $pdfFile = "";
|
private string $pdfFile = "";
|
||||||
private array $images = [];
|
private array $images = [];
|
||||||
|
|
||||||
public function __construct(readonly private MPDF $mpdf)
|
public function __construct(readonly private MPDF $mpdf, readonly private MediaManager $mediaManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,82 +36,92 @@ class SaveFiles
|
|||||||
|
|
||||||
private function rendering(bool $print = false): void
|
private function rendering(bool $print = false): void
|
||||||
{
|
{
|
||||||
if($this->isRendered) return;
|
if ($this->isRendered) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->mpdf->setSetting($this->setting);
|
$this->mpdf->setSetting($this->setting);
|
||||||
$formData = [];
|
$formData = [];
|
||||||
|
|
||||||
/** @var Element $element */
|
/** @var Element $element */
|
||||||
foreach($this->setting->getCustomerForm() as $element) {
|
foreach ($this->setting->getCustomerForm() as $element) {
|
||||||
$value = match($element->getBinding()) {
|
$value = match($element->getBinding()) {
|
||||||
ElementBinding::none => $element->getDefaultForTypePreview(),
|
ElementBinding::none => $element->getDefaultForTypePreview(),
|
||||||
ElementBinding::StreetHouseNumber => ['street' => $this->contact->getLayouterData()->getStreet()?? $element->getDefault1(), 'houseNumber' => $this->contact->getLayouterData()->getHouseNumber()?? $element->getDefault2()],
|
ElementBinding::StreetHouseNumber => ['street' => $this->contact->getLayouterData()->getStreet() ?? $element->getDefault1(), 'houseNumber' => $this->contact->getLayouterData()->getHouseNumber() ?? $element->getDefault2()],
|
||||||
ElementBinding::ZipCity => ['zip' => $this->contact->getLayouterData()->getZip()?? $element->getDefault1(), 'city' => $this->contact->getLayouterData()->getCity()?? $element->getDefault2()],
|
ElementBinding::ZipCity => ['zip' => $this->contact->getLayouterData()->getZip() ?? $element->getDefault1(), 'city' => $this->contact->getLayouterData()->getCity() ?? $element->getDefault2()],
|
||||||
ElementBinding::Firstname => $this->contact->getLayouterData()->getFirstname()?? $element->getDefault1(),
|
ElementBinding::Firstname => $this->contact->getLayouterData()->getFirstname() ?? $element->getDefault1(),
|
||||||
ElementBinding::Lastname => $this->contact->getLayouterData()->getLastname()?? $element->getDefault1(),
|
ElementBinding::Lastname => $this->contact->getLayouterData()->getLastname() ?? $element->getDefault1(),
|
||||||
ElementBinding::Mobile => [
|
ElementBinding::Mobile => [
|
||||||
'areacode' => $this->contact->getLayouterData()->getMobileAreaCode()?? $element->getDefault1(),
|
'areacode' => $this->contact->getLayouterData()->getMobileAreaCode() ?? $element->getDefault1(),
|
||||||
'appendix' => $this->contact->getLayouterData()->getMobileAppendix()?? $element->getDefault4(),
|
'appendix' => $this->contact->getLayouterData()->getMobileAppendix() ?? $element->getDefault4(),
|
||||||
'number' => $this->contact->getLayouterData()->getMobileAreaCode()?? $element->getDefault3(),
|
'number' => $this->contact->getLayouterData()->getMobileAreaCode() ?? $element->getDefault3(),
|
||||||
'prefix' => $this->contact->getLayouterData()->getMobilePrefix()?? $element->getDefault2()],
|
'prefix' => $this->contact->getLayouterData()->getMobilePrefix() ?? $element->getDefault2()],
|
||||||
ElementBinding::UsernameLogin => $this->contact->getEmail()?? $element->getDefault1(),
|
ElementBinding::UsernameLogin => $this->contact->getEmail() ?? $element->getDefault1(),
|
||||||
ElementBinding::Company => $this->contact->getLayouterData()->getCompany()?? $element->getDefault1(),
|
ElementBinding::Company => $this->contact->getLayouterData()->getCompany() ?? $element->getDefault1(),
|
||||||
ElementBinding::Company2 => $this->contact->getLayouterData()->getCompany2()?? $element->getDefault1(),
|
ElementBinding::Company2 => $this->contact->getLayouterData()->getCompany2() ?? $element->getDefault1(),
|
||||||
ElementBinding::Title => $this->contact->getLayouterData()->getTitle()?? $element->getDefault1(),
|
ElementBinding::Title => $this->contact->getLayouterData()->getTitle() ?? $element->getDefault1(),
|
||||||
ElementBinding::Position => $this->contact->getLayouterData()->getPosition()?? $element->getDefault1(),
|
ElementBinding::Position => $this->contact->getLayouterData()->getPosition() ?? $element->getDefault1(),
|
||||||
ElementBinding::Function => $this->contact->getLayouterData()->getFunction()?? $element->getDefault1(),
|
ElementBinding::Function => $this->contact->getLayouterData()->getFunction() ?? $element->getDefault1(),
|
||||||
ElementBinding::UserCountry => $this->contact->getCountryCode()?? $element->getDefault1(),
|
ElementBinding::UserCountry => $this->contact->getCountryCode() ?? $element->getDefault1(),
|
||||||
ElementBinding::Fon => [
|
ElementBinding::Fon => [
|
||||||
'areacode' => $this->contact->getLayouterData()->getPhoneAreaCode()?? $element->getDefault1(),
|
'areacode' => $this->contact->getLayouterData()->getPhoneAreaCode() ?? $element->getDefault1(),
|
||||||
'appendix' => $this->contact->getLayouterData()->getPhoneAppendix()?? $element->getDefault4(),
|
'appendix' => $this->contact->getLayouterData()->getPhoneAppendix() ?? $element->getDefault4(),
|
||||||
'number' => $this->contact->getLayouterData()->getPhone()?? $element->getDefault3(),
|
'number' => $this->contact->getLayouterData()->getPhone() ?? $element->getDefault3(),
|
||||||
'prefix' => $this->contact->getLayouterData()->getPhonePrefix()?? $element->getDefault2()],
|
'prefix' => $this->contact->getLayouterData()->getPhonePrefix() ?? $element->getDefault2()],
|
||||||
ElementBinding::Fax => [
|
ElementBinding::Fax => [
|
||||||
'areacode' => $this->contact->getLayouterData()->getFaxAreaCode()?? $element->getDefault1(),
|
'areacode' => $this->contact->getLayouterData()->getFaxAreaCode() ?? $element->getDefault1(),
|
||||||
'appendix' => $this->contact->getLayouterData()->getFaxAppendix()?? $element->getDefault4(),
|
'appendix' => $this->contact->getLayouterData()->getFaxAppendix() ?? $element->getDefault4(),
|
||||||
'number' => $this->contact->getLayouterData()->getFax()?? $element->getDefault3(),
|
'number' => $this->contact->getLayouterData()->getFax() ?? $element->getDefault3(),
|
||||||
'prefix' => $this->contact->getLayouterData()->getFaxPrefix()?? $element->getDefault2()],
|
'prefix' => $this->contact->getLayouterData()->getFaxPrefix() ?? $element->getDefault2()],
|
||||||
ElementBinding::Abteilung => $this->contact->getLayouterData()->getAbteilung()?? $element->getDefault1(),
|
ElementBinding::Abteilung => $this->contact->getLayouterData()->getAbteilung() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom1 => $this->contact->getCustom1()?? $element->getDefault1(),
|
ElementBinding::Custom1 => $this->contact->getCustom1() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom2 => $this->contact->getCustom2()?? $element->getDefault1(),
|
ElementBinding::Custom2 => $this->contact->getCustom2() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom3 => $this->contact->getCustom3()?? $element->getDefault1(),
|
ElementBinding::Custom3 => $this->contact->getCustom3() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom4 => $this->contact->getCustom4()?? $element->getDefault1(),
|
ElementBinding::Custom4 => $this->contact->getCustom4() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom5 => $this->contact->getCustom5()?? $element->getDefault1(),
|
ElementBinding::Custom5 => $this->contact->getCustom5() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom6 => $this->contact->getCustom6()?? $element->getDefault1(),
|
ElementBinding::Custom6 => $this->contact->getCustom6() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom7 => $this->contact->getCustom7()?? $element->getDefault1(),
|
ElementBinding::Custom7 => $this->contact->getCustom7() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom8 => $this->contact->getCustom8()?? $element->getDefault1(),
|
ElementBinding::Custom8 => $this->contact->getCustom8() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom9 => $this->contact->getCustom9()?? $element->getDefault1(),
|
ElementBinding::Custom9 => $this->contact->getCustom9() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom10 => $this->contact->getCustom10()?? $element->getDefault1(),
|
ElementBinding::Custom10 => $this->contact->getCustom10() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom11 => $this->contact->getCustom11()?? $element->getDefault1(),
|
ElementBinding::Custom11 => $this->contact->getCustom11() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom12 => $this->contact->getCustom12()?? $element->getDefault1(),
|
ElementBinding::Custom12 => $this->contact->getCustom12() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom13 => $this->contact->getCustom13()?? $element->getDefault1(),
|
ElementBinding::Custom13 => $this->contact->getCustom13() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom14 => $this->contact->getCustom14()?? $element->getDefault1(),
|
ElementBinding::Custom14 => $this->contact->getCustom14() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom15 => $this->contact->getCustom15()?? $element->getDefault1(),
|
ElementBinding::Custom15 => $this->contact->getCustom15() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom16 => $this->contact->getCustom16()?? $element->getDefault1(),
|
ElementBinding::Custom16 => $this->contact->getCustom16() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom17 => $this->contact->getCustom17()?? $element->getDefault1(),
|
ElementBinding::Custom17 => $this->contact->getCustom17() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom18 => $this->contact->getCustom18()?? $element->getDefault1(),
|
ElementBinding::Custom18 => $this->contact->getCustom18() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom19 => $this->contact->getCustom19()?? $element->getDefault1(),
|
ElementBinding::Custom19 => $this->contact->getCustom19() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom20 => $this->contact->getCustom20()?? $element->getDefault1(),
|
ElementBinding::Custom20 => $this->contact->getCustom20() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom21 => $this->contact->getCustom21()?? $element->getDefault1(),
|
ElementBinding::Custom21 => $this->contact->getCustom21() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom22 => $this->contact->getCustom22()?? $element->getDefault1(),
|
ElementBinding::Custom22 => $this->contact->getCustom22() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom23 => $this->contact->getCustom23()?? $element->getDefault1(),
|
ElementBinding::Custom23 => $this->contact->getCustom23() ?? $element->getDefault1(),
|
||||||
ElementBinding::Custom24 => $this->contact->getCustom24()?? $element->getDefault1(),
|
ElementBinding::Custom24 => $this->contact->getCustom24() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterMail => $this->contact->getLayouterData()->getEmail()?? $element->getDefault1(),
|
ElementBinding::LayouterMail => $this->contact->getLayouterData()->getEmail() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterCountryName => $this->contact->getLayouterData()->getCountryName()?? $element->getDefault1(),
|
ElementBinding::LayouterCountryName => $this->contact->getLayouterData()->getCountryName() ?? $element->getDefault1(),
|
||||||
ElementBinding::LayouterCountryCode => $this->contact->getLayouterData()->getCountryCode()?? $element->getDefault1(),
|
ElementBinding::LayouterCountryCode => $this->contact->getLayouterData()->getCountryCode() ?? $element->getDefault1(),
|
||||||
ElementBinding::Birthday => $this->contact->getLayouterData()->getBirthday()?? $element->getDefault1(),
|
ElementBinding::Birthday => $this->contact->getLayouterData()->getBirthday() ?? $element->getDefault1(),
|
||||||
ElementBinding::Homepages => $this->contact->getLayouterData()->getHomepage()?? $element->getDefault1(),
|
ElementBinding::Homepages => $this->contact->getLayouterData()->getHomepage() ?? $element->getDefault1(),
|
||||||
ElementBinding::Salutation => $this->contact->getLayouterData()->getSalutation()?? $element->getDefault1(),
|
ElementBinding::Salutation => $this->contact->getLayouterData()->getSalutation() ?? $element->getDefault1(),
|
||||||
ElementBinding::UstId => $this->contact->getLayouterData()->getUstid()?? $element->getDefault1(),
|
ElementBinding::UstId => $this->contact->getLayouterData()->getUstid() ?? $element->getDefault1(),
|
||||||
ElementBinding::KSt => $this->contact->getLayouterData()->getKst()?? $element->getDefault1(),
|
ElementBinding::KSt => $this->contact->getLayouterData()->getKst() ?? $element->getDefault1(),
|
||||||
ElementBinding::State => $this->contact->getLayouterData()->getState()?? $element->getDefault1(),
|
ElementBinding::State => $this->contact->getLayouterData()->getState() ?? $element->getDefault1(),
|
||||||
ElementBinding::District => $this->contact->getLayouterData()->getDistrict()?? $element->getDefault1(),
|
ElementBinding::District => $this->contact->getLayouterData()->getDistrict() ?? $element->getDefault1(),
|
||||||
|
ElementBinding::Image1 => $this->contact->getLayouterData()->getImage1() ?? $element->getDefault1(),
|
||||||
|
ElementBinding::Image2 => $this->contact->getLayouterData()->getImage2() ?? $element->getDefault1(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if($elm = $this->data->getElement($element, $this->contact)) {
|
if ($elm = $this->data->getElement($element, $this->contact)) {
|
||||||
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => $elm['enable']];
|
if ($element->getType() == ElementType::Image && $elm['value'] != "") {
|
||||||
}else{
|
$media = $this->mediaManager->getModelByUuid($elm['value']);
|
||||||
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional()? $element->getOptionalDefault(): true];
|
$elmMedia = $media->getVariant($element->getImage()->aspectRatio);
|
||||||
|
$formData[$element->getId()] = ['value' => $elmMedia, 'enable' => (bool)$elm['enable']];
|
||||||
|
} else {
|
||||||
|
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => $elm['enable']];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,13 +141,13 @@ class SaveFiles
|
|||||||
{
|
{
|
||||||
$contactUUId = $this->contact->getUuid();
|
$contactUUId = $this->contact->getUuid();
|
||||||
|
|
||||||
if($contactUUId == "") {
|
if ($contactUUId == "") {
|
||||||
$contactUUId = 'guest';
|
$contactUUId = 'guest';
|
||||||
}
|
}
|
||||||
if(!file_exists('/data/www/old/market/collectlayouter/temp/' . $contactUUId . '/' . $this->data->getLayouterUuid())) {
|
if (!file_exists('/data/www/old/market/collectlayouter/temp/' . $contactUUId . '/' . $this->data->getLayouterUuid())) {
|
||||||
mkdir('/data/www/old/market/collectlayouter/temp/' . $contactUUId . '/' . $this->data->getLayouterUuid(), 0777, true);
|
mkdir('/data/www/old/market/collectlayouter/temp/' . $contactUUId . '/' . $this->data->getLayouterUuid(), 0777, true);
|
||||||
}
|
}
|
||||||
$this->pdfFile = sprintf( '/data/www/old/market/collectlayouter/temp/%s/%s/print.pdf', $contactUUId, $this->data->getLayouterUuid());
|
$this->pdfFile = sprintf('/data/www/old/market/collectlayouter/temp/%s/%s/print.pdf', $contactUUId, $this->data->getLayouterUuid());
|
||||||
|
|
||||||
$this->rendering(true);
|
$this->rendering(true);
|
||||||
|
|
||||||
@ -148,7 +159,7 @@ class SaveFiles
|
|||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach ($this->mpdf->getPreviewFiles() as $f) {
|
foreach ($this->mpdf->getPreviewFiles() as $f) {
|
||||||
$filename = sprintf( '/data/www/old/market/collectlayouter/temp/%s/%s/%s.jpeg', $contactUUId, $this->data->getLayouterUuid(), $i);
|
$filename = sprintf('/data/www/old/market/collectlayouter/temp/%s/%s/%s.jpeg', $contactUUId, $this->data->getLayouterUuid(), $i);
|
||||||
copy($f, $filename);
|
copy($f, $filename);
|
||||||
$this->images[] = $filename;
|
$this->images[] = $filename;
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Plugin\Custom\PSC\CollectLayouter\Model;
|
namespace Plugin\Custom\PSC\CollectLayouter\Model;
|
||||||
|
|
||||||
|
use PSC\Shop\MediaBundle\Model\Media;
|
||||||
|
|
||||||
class Element
|
class Element
|
||||||
{
|
{
|
||||||
private ?ElementBinding $binding = null;
|
private ?ElementBinding $binding = null;
|
||||||
@ -21,10 +23,12 @@ class Element
|
|||||||
private ?int $pos = 1;
|
private ?int $pos = 1;
|
||||||
|
|
||||||
private ?Phone $phone = null;
|
private ?Phone $phone = null;
|
||||||
|
private ?Image $image = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->phone = new Phone();
|
$this->phone = new Phone();
|
||||||
|
$this->image = new Image();
|
||||||
$this->binding = ElementBinding::LayouterMail;
|
$this->binding = ElementBinding::LayouterMail;
|
||||||
$this->type = ElementType::eMail;
|
$this->type = ElementType::eMail;
|
||||||
}
|
}
|
||||||
@ -143,7 +147,7 @@ class Element
|
|||||||
{
|
{
|
||||||
return match($this->type) {
|
return match($this->type) {
|
||||||
|
|
||||||
default =>$this->default1,
|
default => $this->default1,
|
||||||
ElementType::eMail, ElementType::Text, ElementType::Image => $this->default1,
|
ElementType::eMail, ElementType::Text, ElementType::Image => $this->default1,
|
||||||
ElementType::Phone => [$this->default1, $this->default2, $this->default3, $this->default4],
|
ElementType::Phone => [$this->default1, $this->default2, $this->default3, $this->default4],
|
||||||
ElementType::StreetHouseNumber, ElementType::ZipCity => [$this->default1, $this->default2],
|
ElementType::StreetHouseNumber, ElementType::ZipCity => [$this->default1, $this->default2],
|
||||||
@ -173,6 +177,16 @@ class Element
|
|||||||
$this->required = $required;
|
$this->required = $required;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getImage(): ?Image
|
||||||
|
{
|
||||||
|
return $this->image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setImage(?Image $image): void
|
||||||
|
{
|
||||||
|
$this->image = $image;
|
||||||
|
}
|
||||||
|
|
||||||
public function getPhone(): ?Phone
|
public function getPhone(): ?Phone
|
||||||
{
|
{
|
||||||
return $this->phone;
|
return $this->phone;
|
||||||
@ -183,37 +197,44 @@ class Element
|
|||||||
$this->phone = $phone;
|
$this->phone = $phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setValue(array|string|null $value): void
|
public function setValue(array|string|Media|null $value): void
|
||||||
{
|
{
|
||||||
if($this->type === ElementType::Phone) {
|
if ($this->type === ElementType::Image && $value != null && $value instanceof Media) {
|
||||||
if(isset($value[0]) && !$this->phone->fixAreaCode) {
|
$this->setDefault1($value->getUuid());
|
||||||
|
$this->image->url = $value->getUrl();
|
||||||
|
$this->image->variantUrl = $value->getVariant($this->image->aspectRatio)->getUrl();
|
||||||
|
$this->image->title = $value->getTitle();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($this->type === ElementType::Phone) {
|
||||||
|
if (isset($value[0]) && !$this->phone->fixAreaCode) {
|
||||||
$this->setDefault1((string)$value[0]);
|
$this->setDefault1((string)$value[0]);
|
||||||
}
|
}
|
||||||
if(isset($value[1]) && !$this->phone->fixPrefix) {
|
if (isset($value[1]) && !$this->phone->fixPrefix) {
|
||||||
$this->setDefault2((string)$value[1]);
|
$this->setDefault2((string)$value[1]);
|
||||||
}
|
}
|
||||||
if(isset($value[2]) && !$this->phone->fixNumber) {
|
if (isset($value[2]) && !$this->phone->fixNumber) {
|
||||||
$this->setDefault3((string)$value[2]);
|
$this->setDefault3((string)$value[2]);
|
||||||
}
|
}
|
||||||
if(isset($value[3]) && !$this->phone->fixAppendix) {
|
if (isset($value[3]) && !$this->phone->fixAppendix) {
|
||||||
$this->setDefault4((string)$value[3]);
|
$this->setDefault4((string)$value[3]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(is_array($value)){
|
if (is_array($value)) {
|
||||||
if(isset($value[0])) {
|
if (isset($value[0])) {
|
||||||
$this->setDefault1((string)$value[0]);
|
$this->setDefault1((string)$value[0]);
|
||||||
}
|
}
|
||||||
if(isset($value[1])) {
|
if (isset($value[1])) {
|
||||||
$this->setDefault2((string)$value[1]);
|
$this->setDefault2((string)$value[1]);
|
||||||
}
|
}
|
||||||
if(isset($value[2])) {
|
if (isset($value[2])) {
|
||||||
$this->setDefault3((string)$value[2]);
|
$this->setDefault3((string)$value[2]);
|
||||||
}
|
}
|
||||||
if(isset($value[3])) {
|
if (isset($value[3])) {
|
||||||
$this->setDefault4((string)$value[3]);
|
$this->setDefault4((string)$value[3]);
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
$this->setDefault1((string)$value);
|
$this->setDefault1((string)$value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,8 @@ use PSC\Shop\ContactBundle\Model\Contact;
|
|||||||
use Symfony\Contracts\Translation\TranslatableInterface;
|
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
enum ElementBinding: int {
|
enum ElementBinding: int
|
||||||
|
{
|
||||||
case none = 0;
|
case none = 0;
|
||||||
case UsernameLogin = 1;
|
case UsernameLogin = 1;
|
||||||
case Company = 2;
|
case Company = 2;
|
||||||
@ -57,6 +58,8 @@ enum ElementBinding: int {
|
|||||||
case KSt = 47;
|
case KSt = 47;
|
||||||
case State = 48;
|
case State = 48;
|
||||||
case District = 49;
|
case District = 49;
|
||||||
|
case Image1 = 50;
|
||||||
|
case Image2 = 51;
|
||||||
|
|
||||||
|
|
||||||
public static function getForTypePhone(): array
|
public static function getForTypePhone(): array
|
||||||
@ -68,6 +71,15 @@ enum ElementBinding: int {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getForTypeImage(): array
|
||||||
|
{
|
||||||
|
$tmp = [
|
||||||
|
self::Image1->name => self::Image1,
|
||||||
|
self::Image2->name => self::Image2,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
public static function getForTypeText(): array
|
public static function getForTypeText(): array
|
||||||
{
|
{
|
||||||
$tmp = [
|
$tmp = [
|
||||||
@ -92,7 +104,7 @@ enum ElementBinding: int {
|
|||||||
];
|
];
|
||||||
|
|
||||||
for ($i = 16; $i <= 39; $i++) {
|
for ($i = 16; $i <= 39; $i++) {
|
||||||
$name = 'Custom' . ($i-15);
|
$name = 'Custom' . ($i - 15);
|
||||||
$tmp[$name] = ElementBinding::tryFrom($i);
|
$tmp[$name] = ElementBinding::tryFrom($i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user