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'])
|
||||||
|
|||||||
@ -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",
|
||||||
|
|||||||
@ -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,6 +107,12 @@ 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 = "";
|
||||||
|
|
||||||
@ -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="row mb-3">
|
|
||||||
<label class="col-md-6 form-control-label">
|
|
||||||
{{ form_label(form.pos) }}
|
|
||||||
</label>
|
|
||||||
<div class="col-md-6">
|
<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">
|
<div class="row mb-3">
|
||||||
<label class="col-md-3 form-control-label">
|
<div class="text-end">
|
||||||
{{ 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="col-md-offset-1 col-md-11">
|
|
||||||
{{ 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">
|
<div class="row mb-3">
|
||||||
<label class="col-md-3 form-control-label">
|
<div class="text-end">
|
||||||
{{ 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="col-md-offset-1 col-md-11">
|
|
||||||
{{ 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,12 +6,14 @@ 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)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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());
|
||||||
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -515,6 +515,18 @@ class Shop
|
|||||||
protected $senderMobile;
|
protected $senderMobile;
|
||||||
#[Field(type: 'string')]
|
#[Field(type: 'string')]
|
||||||
protected $senderEmail;
|
protected $senderEmail;
|
||||||
|
#[Field(type: 'bool')]
|
||||||
|
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;
|
* @var string $extraSettings;
|
||||||
*/
|
*/
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -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;
|
||||||
@ -90,12 +91,12 @@ class FolderController extends AbstractController
|
|||||||
$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,11 +105,15 @@ 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);
|
||||||
@ -116,19 +121,53 @@ class FolderController extends AbstractController
|
|||||||
$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)
|
||||||
|
|||||||
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,7 +18,9 @@ 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
|
||||||
@ -45,11 +47,12 @@ class Folder
|
|||||||
*/
|
*/
|
||||||
#[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,14 +28,16 @@ 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;
|
||||||
/**
|
/**
|
||||||
@ -113,6 +116,7 @@ class Media implements MediaInterface
|
|||||||
{
|
{
|
||||||
$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,6 +88,7 @@ class ImageHandler extends FileHandler
|
|||||||
parent::prepareMedia($media);
|
parent::prepareMedia($media);
|
||||||
|
|
||||||
if ($media->getContent()) {
|
if ($media->getContent()) {
|
||||||
|
if ('image/svg+xml' !== mime_content_type($media->getContent()->getPathname())) {
|
||||||
$imageInfo = getimagesize($media->getContent());
|
$imageInfo = getimagesize($media->getContent());
|
||||||
$width = $imageInfo[0];
|
$width = $imageInfo[0];
|
||||||
$height = $imageInfo[1];
|
$height = $imageInfo[1];
|
||||||
@ -97,3 +98,4 @@ class ImageHandler extends FileHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
@ -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 '';
|
||||||
|
|||||||
@ -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
|
||||||
@ -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(
|
||||||
@ -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;
|
||||||
@ -172,9 +171,6 @@ class Position extends Base
|
|||||||
}
|
}
|
||||||
$position->setCustomerInfo((string)$positionDoc->getCustomerInfo());
|
$position->setCustomerInfo((string)$positionDoc->getCustomerInfo());
|
||||||
|
|
||||||
/**
|
|
||||||
* Plugin Special Settings
|
|
||||||
*/
|
|
||||||
if ($pos->getProduct()) {
|
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();
|
||||||
|
|||||||
@ -63,6 +63,7 @@ class OfferController extends AbstractController
|
|||||||
/** @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,8 +76,7 @@ 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;
|
||||||
@ -87,7 +87,7 @@ 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';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,6 +58,8 @@ class Package
|
|||||||
*/
|
*/
|
||||||
#[Field(type: 'bool')]
|
#[Field(type: 'bool')]
|
||||||
protected $orderOrder;
|
protected $orderOrder;
|
||||||
|
#[Field(type: 'bool')]
|
||||||
|
protected $orderInvoiceXML = false;
|
||||||
/**
|
/**
|
||||||
* @var boolean $orderStorno
|
* @var boolean $orderStorno
|
||||||
*/
|
*/
|
||||||
@ -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 */
|
||||||
@ -68,7 +69,7 @@ class Mail implements QueueInterface, ConfigurableElementInterface
|
|||||||
* @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;
|
||||||
@ -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) {
|
||||||
|
|||||||
@ -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());
|
||||||
@ -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) {
|
||||||
@ -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) {
|
||||||
@ -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) {
|
||||||
@ -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) {
|
||||||
@ -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) {
|
||||||
@ -832,6 +853,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) {
|
||||||
@ -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) {
|
||||||
@ -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) {
|
||||||
@ -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.
|
||||||
|
|||||||
@ -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'))
|
||||||
|
|||||||
@ -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,6 +118,7 @@ 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:
|
||||||
@ -96,6 +126,7 @@ class Printing
|
|||||||
$bg = $shopObj->getDocDeliveryBg();
|
$bg = $shopObj->getDocDeliveryBg();
|
||||||
$fileName = $shopObj->getDocDeliveryFileName();
|
$fileName = $shopObj->getDocDeliveryFileName();
|
||||||
$fileNameOrg = "delivery_" . $order->getUID() . ".pdf";
|
$fileNameOrg = "delivery_" . $order->getUID() . ".pdf";
|
||||||
|
$addXRechnung = $shopObj->isDocDeliveryXML();
|
||||||
break;
|
break;
|
||||||
case self::LABEL:
|
case self::LABEL:
|
||||||
$reportXml = $shopObj->getDocLabelJasperXml();
|
$reportXml = $shopObj->getDocLabelJasperXml();
|
||||||
@ -108,6 +139,7 @@ class Printing
|
|||||||
$bg = $shopObj->getDocJobticketBg();
|
$bg = $shopObj->getDocJobticketBg();
|
||||||
$fileName = $shopObj->getDocJobticketFileName();
|
$fileName = $shopObj->getDocJobticketFileName();
|
||||||
$fileNameOrg = "jobticket_" . $order->getUID() . ".pdf";
|
$fileNameOrg = "jobticket_" . $order->getUID() . ".pdf";
|
||||||
|
$addXRechnung = $shopObj->isDocJobticketXML();
|
||||||
break;
|
break;
|
||||||
case self::JOBTICKET_PRINTPARTNER:
|
case self::JOBTICKET_PRINTPARTNER:
|
||||||
$reportXml = $shopObj->getDocJobticketPPJasperXml();
|
$reportXml = $shopObj->getDocJobticketPPJasperXml();
|
||||||
@ -120,18 +152,21 @@ class Printing
|
|||||||
$bg = $shopObj->getDocOfferBg();
|
$bg = $shopObj->getDocOfferBg();
|
||||||
$fileName = $shopObj->getDocOfferFileName();
|
$fileName = $shopObj->getDocOfferFileName();
|
||||||
$fileNameOrg = "offer_" . $order->getUID() . ".pdf";
|
$fileNameOrg = "offer_" . $order->getUID() . ".pdf";
|
||||||
|
$addXRechnung = $shopObj->isDocOfferXML();
|
||||||
break;
|
break;
|
||||||
case self::STORNO:
|
case self::STORNO:
|
||||||
$reportXml = $shopObj->getDocStornoJasperXml();
|
$reportXml = $shopObj->getDocStornoJasperXml();
|
||||||
$bg = $shopObj->getDocStornoBg();
|
$bg = $shopObj->getDocStornoBg();
|
||||||
$fileName = $shopObj->getDocStornoFileName();
|
$fileName = $shopObj->getDocStornoFileName();
|
||||||
$fileNameOrg = "storno_" . $order->getUID() . ".pdf";
|
$fileNameOrg = "storno_" . $order->getUID() . ".pdf";
|
||||||
|
$addXRechnung = $shopObj->isDocStornoXML();
|
||||||
break;
|
break;
|
||||||
case self::ORDER:
|
case self::ORDER:
|
||||||
$reportXml = $shopObj->getDocOrderJasperXml();
|
$reportXml = $shopObj->getDocOrderJasperXml();
|
||||||
$bg = $shopObj->getDocOrderBg();
|
$bg = $shopObj->getDocOrderBg();
|
||||||
$fileName = $shopObj->getDocOrderFileName();
|
$fileName = $shopObj->getDocOrderFileName();
|
||||||
$fileNameOrg = "order_" . $order->getUID() . ".pdf";
|
$fileNameOrg = "order_" . $order->getUID() . ".pdf";
|
||||||
|
$addXRechnung = $shopObj->isDocOrderXML();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case self::INVOICE:
|
case self::INVOICE:
|
||||||
@ -139,6 +174,7 @@ class Printing
|
|||||||
$bg = $shopObj->getDocInvoiceBg();
|
$bg = $shopObj->getDocInvoiceBg();
|
||||||
$fileName = $shopObj->getDocInvoiceFileName();
|
$fileName = $shopObj->getDocInvoiceFileName();
|
||||||
$fileNameOrg = "invoice_" . $order->getUID() . ".pdf";
|
$fileNameOrg = "invoice_" . $order->getUID() . ".pdf";
|
||||||
|
$addXRechnung = $shopObj->isDocInvoiceXML();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($addXRechnung) {
|
||||||
|
$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 = $this->mpdf->Output(null, \Mpdf\Output\Destination::STRING_RETURN);
|
||||||
$output = (new ZugferdDocumentPdfMerger($document->getContent(), $output))->generateDocument()->downloadString("file");
|
$output = (new ZugferdDocumentPdfMerger($document->getContent(), $output))->generateDocument()->downloadString("file");
|
||||||
|
} else {
|
||||||
|
$output = $this->mpdf->Output(null, \Mpdf\Output\Destination::STRING_RETURN);
|
||||||
|
}
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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 EntityManagerInterface $entityManager,
|
||||||
protected TokenStorageInterface $tokenStorage,
|
protected TokenStorageInterface $tokenStorage,
|
||||||
protected DocumentManager $mongoManager,
|
protected DocumentManager $mongoManager,
|
||||||
protected RequestStack $requestStack,
|
protected RequestStack $requestStack,
|
||||||
protected \PSC\Component\ApiBundle\Hydrate\Shop $shopHydrate)
|
protected \PSC\Component\ApiBundle\Hydrate\Shop $shopHydrate
|
||||||
{
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -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;
|
||||||
@ -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,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) {
|
|
||||||
$options->svgHeight = (string)$_options["height"];
|
|
||||||
}else{
|
}else{
|
||||||
$options->svgHeight = "20";
|
if(isset($_options["melt"]) && $_options["melt"] == true) {
|
||||||
|
$options->outputInterface = \PSC\System\SettingsBundle\Barcode\QRGdRounded::class;
|
||||||
|
}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,6 +40,7 @@ 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);
|
||||||
|
|||||||
@ -13,5 +13,8 @@ if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
|
|||||||
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) {
|
||||||
|
|||||||
@ -40,7 +40,8 @@ class Form extends AbstractController
|
|||||||
#[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]);
|
||||||
|
|
||||||
@ -114,6 +115,8 @@ class Form extends AbstractController
|
|||||||
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) {
|
||||||
@ -156,7 +159,8 @@ class Form extends AbstractController
|
|||||||
#[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]);
|
||||||
|
|
||||||
|
|||||||
@ -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,11 +33,15 @@ 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' => ''])]
|
||||||
@ -42,7 +49,8 @@ class Preview extends AbstractController
|
|||||||
#[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]);
|
||||||
|
|
||||||
@ -126,14 +134,26 @@ class Preview extends AbstractController
|
|||||||
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)) {
|
||||||
|
if ($element->getType() == ElementType::Image && $elm['value'] != "") {
|
||||||
|
$media = $this->mediaManager->getModelByUuid($elm['value']);
|
||||||
|
$formData[$element->getId()] = ['value' => $media, 'enable' => (bool)$elm['enable']];
|
||||||
|
} else {
|
||||||
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => (bool)$elm['enable']];
|
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => (bool)$elm['enable']];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->mpdf->setData($formData);
|
$this->mpdf->setData($formData);
|
||||||
|
|||||||
@ -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
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +71,7 @@ class Save extends AbstractController
|
|||||||
$this->saveContactHelper->setData($data);
|
$this->saveContactHelper->setData($data);
|
||||||
$this->saveContactHelper->saveData();
|
$this->saveContactHelper->saveData();
|
||||||
}
|
}
|
||||||
|
|
||||||
$formData = [];
|
$formData = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,10 +141,18 @@ class Save extends AbstractController
|
|||||||
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)) {
|
||||||
|
if ($element->getType() == ElementType::Image && $elm['value'] != "") {
|
||||||
|
$media = $this->mediaManager->getModelByUuid($elm['value']);
|
||||||
|
$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']];
|
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => (bool)$elm['enable']];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,8 +21,14 @@ 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'])]
|
||||||
@ -30,7 +36,8 @@ class Update extends AbstractController
|
|||||||
#[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]);
|
||||||
|
|
||||||
@ -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));
|
||||||
|
|
||||||
|
|||||||
@ -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 MPDF $mpdf,
|
||||||
readonly private EntityManagerInterface $entityManager,
|
readonly private EntityManagerInterface $entityManager,
|
||||||
readonly private DocumentManager $documentManager,
|
readonly private DocumentManager $documentManager,
|
||||||
readonly private SerializerInterface $serializer, readonly private RequestStack $requestStack)
|
readonly private SerializerInterface $serializer,
|
||||||
{
|
readonly private RequestStack $requestStack,
|
||||||
|
readonly private MediaManager $mediaManager
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Template()]
|
#[Template()]
|
||||||
@ -137,7 +143,8 @@ class DesignerController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[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]);
|
||||||
|
|
||||||
@ -217,10 +224,18 @@ class DesignerController extends AbstractController
|
|||||||
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)) {
|
||||||
|
if ($element->getType() == ElementType::Image && $elm['value'] != "") {
|
||||||
|
$media = $this->mediaManager->getModelByUuid($elm['value']);
|
||||||
|
$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']];
|
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => $elm['enable']];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,11 +47,13 @@ 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) {
|
||||||
|
|
||||||
@ -61,6 +62,11 @@ class Element extends AbstractType
|
|||||||
'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,7 +96,8 @@ 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) {
|
||||||
@ -102,7 +109,21 @@ class Element extends AbstractType
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildDefault(FormBuilderInterface $builder): void {
|
public function buildImage(FormBuilderInterface $builder): void
|
||||||
|
{
|
||||||
|
|
||||||
|
$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) {
|
$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, [
|
||||||
|
|||||||
@ -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;
|
||||||
@ -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,7 +36,9 @@ 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 = [];
|
||||||
@ -105,10 +108,18 @@ class SaveFiles
|
|||||||
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)) {
|
||||||
|
if ($element->getType() == ElementType::Image && $elm['value'] != "") {
|
||||||
|
$media = $this->mediaManager->getModelByUuid($elm['value']);
|
||||||
|
$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']];
|
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => $elm['enable']];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
@ -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,8 +197,15 @@ 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::Image && $value != null && $value instanceof Media) {
|
||||||
|
$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 ($this->type === ElementType::Phone) {
|
||||||
if (isset($value[0]) && !$this->phone->fixAreaCode) {
|
if (isset($value[0]) && !$this->phone->fixAreaCode) {
|
||||||
$this->setDefault1((string)$value[0]);
|
$this->setDefault1((string)$value[0]);
|
||||||
|
|||||||
@ -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 = [
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Plugin\Custom\PSC\CollectLayouter\Model;
|
||||||
|
|
||||||
|
class Image
|
||||||
|
{
|
||||||
|
public ?bool $cropAllowed = false;
|
||||||
|
|
||||||
|
public ?string $mediaFolder = "";
|
||||||
|
|
||||||
|
public ?string $url = "";
|
||||||
|
|
||||||
|
public ?string $variantUrl = "";
|
||||||
|
|
||||||
|
public ?string $aspectRatio = "";
|
||||||
|
|
||||||
|
public ?int $cropMode = 1;
|
||||||
|
|
||||||
|
public ?string $title = "";
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user