From e2357ad09fa7b9c702e223631dc5787bc42407d5 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 4 Mar 2025 15:32:33 +0100 Subject: [PATCH] Fixes --- .../docker-compose.local.ci.yml | 2 ++ .../docker-compose.local.dev.yml | 21 +++++++++++++ .../docker-compose/docker-compose.local.yml | 10 ++----- .gitea/workflows/run_tests.yaml | 28 ++++++++++++----- .make/04-docker.mk | 3 +- .../PSC/Shop/EntityBundle/Entity/Voucher.php | 12 ++++++++ .../Form/Backend/VoucherType.php | 3 +- .../translations/core_voucher_edit.de.yaml | 3 +- .../views/backend/edit/create.html.twig | 8 +++++ .../views/backend/edit/edit.html.twig | 8 +++++ .../Migrations/Version20250303120815.php | 30 +++++++++---------- .../Migrations/Version20250304145512.php | 11 +++++++ 12 files changed, 105 insertions(+), 34 deletions(-) create mode 100644 .docker/docker-compose/docker-compose.local.dev.yml create mode 100644 src/new/src/PSC/System/UpdateBundle/Migrations/Version20250304145512.php diff --git a/.docker/docker-compose/docker-compose.local.ci.yml b/.docker/docker-compose/docker-compose.local.ci.yml index 76bf2b0b1..8ba308aca 100644 --- a/.docker/docker-compose/docker-compose.local.ci.yml +++ b/.docker/docker-compose/docker-compose.local.ci.yml @@ -2,6 +2,8 @@ version: '3.7' services: application: + volumes: + - ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?} environment: - APP_ENV=test php-cron: diff --git a/.docker/docker-compose/docker-compose.local.dev.yml b/.docker/docker-compose/docker-compose.local.dev.yml new file mode 100644 index 000000000..0f2db2d66 --- /dev/null +++ b/.docker/docker-compose/docker-compose.local.dev.yml @@ -0,0 +1,21 @@ +version: '3.7' + +services: + application: + environment: + - APP_ENV=dev + volumes: + - ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?} + php-cron: + environment: + - APP_ENV=dev + volumes: + - ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?} + web: + volumes: + - ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?} + php-fpm: + volumes: + - ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?} + environment: + - APP_ENV=test diff --git a/.docker/docker-compose/docker-compose.local.yml b/.docker/docker-compose/docker-compose.local.yml index 764b1f775..3ca65ed2e 100644 --- a/.docker/docker-compose/docker-compose.local.yml +++ b/.docker/docker-compose/docker-compose.local.yml @@ -22,8 +22,6 @@ services: - "SYS_PTRACE" security_opt: - "seccomp=unconfined" - volumes: - - ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?} networks: - network extra_hosts: @@ -31,8 +29,6 @@ services: php-cron: environment: - PHP_IDE_CONFIG=${PHP_IDE_CONFIG?} - volumes: - - ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?} networks: - network cap_add: @@ -43,8 +39,6 @@ services: - host.docker.internal:host-gateway web: - volumes: - - ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?} ports: - "${NGINX_HOST_HTTP_PORT:-80}:80" - "${NGINX_HOST_HTTPS_PORT:-443}:443" @@ -106,8 +100,6 @@ services: - "SYS_PTRACE" security_opt: - "seccomp=unconfined" - volumes: - - ${APPLICATION_CODE_PATH_HOST?}:${APPLICATION_CODE_PATH_CONTAINER?} ports: - "${APPLICATION_SSH_HOST_PORT:-2222}:22" - "${APPLICATION_PANTHER_HOST_PORT:-9001}:9001" @@ -118,6 +110,8 @@ services: - host.docker.internal:host-gateway depends_on: - chrome + - mysql + - mongodb mongodb: image: mongo:${MONGODB_VERSION?} #volumes: diff --git a/.gitea/workflows/run_tests.yaml b/.gitea/workflows/run_tests.yaml index 785fbeb4b..4761abd6b 100644 --- a/.gitea/workflows/run_tests.yaml +++ b/.gitea/workflows/run_tests.yaml @@ -24,12 +24,12 @@ jobs: run: | make make-init ENVS="ENV=ci TAG=latest" make docker-compose-init-test - - name: Build Images + - name: Build Application Image run: | - make docker-compose-build - - name: Run Server + make docker-compose-build DOCKER_SERVICE_NAME=application + - name: Run Application Image run: | - make docker-compose-up + make docker-compose-up DOCKER_SERVICE_NAME=application - name: Load Data run: | docker exec -i psc_ci-mongodb-1 /usr/bin/mongorestore --archive < ./dev_db/mongodb.dump @@ -44,6 +44,12 @@ jobs: - name: Generate Token run: | make console ARGS="lexik:jwt:generate-keypair" + - name: Build Images + run: | + make docker-compose-build + - name: Run Server + run: | + make docker-compose-up - name: Run Tests run: | make test @@ -72,12 +78,12 @@ jobs: run: | make make-init ENVS="ENV=ci TAG=latest" make docker-compose-init-test - - name: Build Images + - name: Build Application Image run: | - make docker-compose-build - - name: Run Server + make docker-compose-build DOCKER_SERVICE_NAME=application + - name: Run Application Image run: | - make docker-compose-up + make docker-compose-up DOCKER_SERVICE_NAME=application - name: Load Data run: | docker exec -i psc_ci-mongodb-1 /usr/bin/mongorestore --archive < ./dev_db/mongodb.dump @@ -92,6 +98,12 @@ jobs: - name: Generate Token run: | make console ARGS="lexik:jwt:generate-keypair" + - name: Build Images + run: | + make docker-compose-build + - name: Run Server + run: | + make docker-compose-up - name: Run Tests run: | make test diff --git a/.make/04-docker.mk b/.make/04-docker.mk index 41d01da9b..b4a2cb527 100644 --- a/.make/04-docker.mk +++ b/.make/04-docker.mk @@ -21,6 +21,7 @@ DOCKER_COMPOSE_DIR:=$(DOCKER_DIR)/docker-compose DOCKER_COMPOSE_FILE_LOCAL_CI_PROD:=$(DOCKER_COMPOSE_DIR)/docker-compose.local.ci.prod.yml DOCKER_COMPOSE_FILE_LOCAL_CI:=$(DOCKER_COMPOSE_DIR)/docker-compose.local.ci.yml DOCKER_COMPOSE_FILE_LOCAL_PROD:=$(DOCKER_COMPOSE_DIR)/docker-compose.local.prod.yml +DOCKER_COMPOSE_FILE_LOCAL_DEV:=$(DOCKER_COMPOSE_DIR)/docker-compose.local.dev.yml DOCKER_COMPOSE_FILE_LOCAL:=$(DOCKER_COMPOSE_DIR)/docker-compose.local.yml DOCKER_COMPOSE_FILE_PHP_BASE:=$(DOCKER_COMPOSE_DIR)/docker-compose-php-base.yml DOCKER_COMPOSE_PROJECT_NAME:=psc_$(ENV) @@ -32,7 +33,7 @@ ifeq ($(ENV),prod) else ifeq ($(ENV),ci) DOCKER_COMPOSE_FILES:=-f $(DOCKER_COMPOSE_FILE_LOCAL_CI_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL_CI) -f $(DOCKER_COMPOSE_FILE_LOCAL_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL) else ifeq ($(ENV),local) - DOCKER_COMPOSE_FILES:=-f $(DOCKER_COMPOSE_FILE_LOCAL_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL) + DOCKER_COMPOSE_FILES:=-f $(DOCKER_COMPOSE_FILE_LOCAL_DEV) -f $(DOCKER_COMPOSE_FILE_LOCAL_PROD) -f $(DOCKER_COMPOSE_FILE_LOCAL) endif # We need a couple of environment variables for docker compose so we define a make variable that we can diff --git a/src/new/src/PSC/Shop/EntityBundle/Entity/Voucher.php b/src/new/src/PSC/Shop/EntityBundle/Entity/Voucher.php index ddfa7fa82..38a41a098 100755 --- a/src/new/src/PSC/Shop/EntityBundle/Entity/Voucher.php +++ b/src/new/src/PSC/Shop/EntityBundle/Entity/Voucher.php @@ -153,6 +153,9 @@ class Voucher */ #[ORM\Column(name: 'wert', type: 'float')] protected $value; + + #[ORM\Column(name: 'min_basket_value', type: 'float')] + protected $minBasketValue; /** * Code * @@ -191,6 +194,7 @@ class Voucher $this->toDate = new \DateTime(); $this->createdAt = new \DateTime(); $this->updatedAt = new \DateTime(); + $this->minBasketValue = 0; } @@ -506,6 +510,14 @@ class Voucher $this->zeroPayment = $zeroPayment; } + public function setMinBasketValue(float $minBasketValue): void + { + $this->minBasketValue = $minBasketValue; + } + public function getMinBasketValue(): float + { + return $this->minBasketValue; + } } diff --git a/src/new/src/PSC/Shop/VoucherBundle/Form/Backend/VoucherType.php b/src/new/src/PSC/Shop/VoucherBundle/Form/Backend/VoucherType.php index d7e9ff111..2fa63254d 100755 --- a/src/new/src/PSC/Shop/VoucherBundle/Form/Backend/VoucherType.php +++ b/src/new/src/PSC/Shop/VoucherBundle/Form/Backend/VoucherType.php @@ -46,6 +46,7 @@ class VoucherType extends AbstractType ->add('more', CheckboxType::class, ['label' => 'notindividualcodes', 'required' => false]) ->add('value', NumberType::class, ['label' => 'Value', 'required' => false]) ->add('count', NumberType::class, ['label' => 'Count', 'required' => false]) + ->add('minBasketValue', NumberType::class, ['label' => 'min BasketValue', 'required' => false]) ->add('code', TextType::class, ['label' => 'Code', 'required' => false]) ->add('mode', ChoiceType::class, array( 'label' => 'Modus', @@ -61,7 +62,7 @@ class VoucherType extends AbstractType ->add('zeroPayment', CheckboxType::class, ['label' => 'Zero Payment', 'required' => false]) ->add('productIds', TextType::class, ['label' => 'ProductID', 'required' => false]) ->add('productGroupIds', TextType::class, ['label' => 'ProductgroupID', 'required' => false]) - ; + ; foreach ($this->fields->getFields(\PSC\System\PluginBundle\Form\Interfaces\Field::Voucher) as $field) { $field->buildForm($builder, $options); } diff --git a/src/new/src/PSC/Shop/VoucherBundle/Resources/translations/core_voucher_edit.de.yaml b/src/new/src/PSC/Shop/VoucherBundle/Resources/translations/core_voucher_edit.de.yaml index 5865a8ed7..f680bac90 100755 --- a/src/new/src/PSC/Shop/VoucherBundle/Resources/translations/core_voucher_edit.de.yaml +++ b/src/new/src/PSC/Shop/VoucherBundle/Resources/translations/core_voucher_edit.de.yaml @@ -1,6 +1,7 @@ Uid: Uid active: Aktiv Name: Name +min BasketValue: ab Warenkorb Wert General: Allgemein from: von to: bis @@ -20,4 +21,4 @@ Totalshoppingcart: Gesamter Warenkorb Calculationvalue: Kalkulationswert (calc_voucher) Payment: Zahlartkosten reduzieren Shipping: Versandkosten reduzieren -create: erstellen \ No newline at end of file +create: erstellen diff --git a/src/new/src/PSC/Shop/VoucherBundle/Resources/views/backend/edit/create.html.twig b/src/new/src/PSC/Shop/VoucherBundle/Resources/views/backend/edit/create.html.twig index af59dc345..8ba7296dd 100755 --- a/src/new/src/PSC/Shop/VoucherBundle/Resources/views/backend/edit/create.html.twig +++ b/src/new/src/PSC/Shop/VoucherBundle/Resources/views/backend/edit/create.html.twig @@ -164,6 +164,14 @@ +
+
+ +
+ {{ form_widget(form.minBasketValue) }} +
+
+
diff --git a/src/new/src/PSC/Shop/VoucherBundle/Resources/views/backend/edit/edit.html.twig b/src/new/src/PSC/Shop/VoucherBundle/Resources/views/backend/edit/edit.html.twig index dae6eaa8c..ddacf87a6 100755 --- a/src/new/src/PSC/Shop/VoucherBundle/Resources/views/backend/edit/edit.html.twig +++ b/src/new/src/PSC/Shop/VoucherBundle/Resources/views/backend/edit/edit.html.twig @@ -146,6 +146,14 @@
+
+
+ +
+ {{ form_widget(form.minBasketValue) }} +
+
+
diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120815.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120815.php index efa532ff9..8f7860a99 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120815.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120815.php @@ -17,20 +17,20 @@ class Version20250303120815 extends Base { public function migrateDatabase() { - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY preis float default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY enable tinyint(1) default 1"); - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY delivery_same int(1) default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY sender_same int(1) default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY invoice_same int(1) default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY zahlkosten float default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY versandkosten float default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY gutscheinabzugtyp int(1) default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY use_account_as_invoice int(1) default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY mwertalle mediumtext default null"); - $this->entityManager->getConnection()->exec("ALTER TABLE order MODIFY version int(5) default 1"); - $this->entityManager->getConnection()->exec("ALTER TABLE orderpos MODIFY resale_price float default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE orderpos MODIFY status int(3) default 10"); - $this->entityManager->getConnection()->exec("ALTER TABLE orderpos MODIFY layouter_mode int(1) default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE orderpos MODIFY render_print int(1) default 0"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY preis float default 0;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY enable tinyint(1) default 1;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY delivery_same int(1) default 0;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY sender_same int(1) default 0;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY invoice_same int(1) default 0;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY zahlkosten float default 0;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY versandkosten float default 0;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY gutscheinabzugtyp int(1) default 0;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY use_account_as_invoice int(1) default 0;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY mwertalle mediumtext default null;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY version int(5) default 1;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orderspos MODIFY resale_price float default 0;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orderspos MODIFY status int(3) default 10;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orderspos MODIFY layouter_mode int(1) default 0;"); + $this->entityManager->getConnection()->exec("ALTER TABLE orderspos MODIFY render_print int(1) default 0;"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250304145512.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250304145512.php new file mode 100644 index 000000000..0aaf1364e --- /dev/null +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250304145512.php @@ -0,0 +1,11 @@ +entityManager->getConnection()->exec("ALTER TABLE credit_system ADD min_basket_value float null default 0;"); + } +}