diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b95feb23..1532c5f1e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,9 +6,11 @@ variables: COMPOSER_HOME: $CI_PROJECT_DIR/.composer NO_PROXY: "gitlab.vtk.be" - build: stage: build + before_script: + - export PATH="/usr/bin/php7.4:$PATH" + - php -v script: - composer update --no-dev - composer install --no-dev @@ -28,9 +30,12 @@ build: .deploy: &deploy stage: deploy before_script: + - export PATH="/usr/bin/php7.4:$PATH" + - php -v - eval $(ssh-agent -s) - ssh-add <(echo $SSH_PRIVATE_KEY | base64 -d) script: + - export SENTRY_LOG_LEVEL=debug - scp -o StrictHostKeyChecking=no litus.tar.gz root@$SSH_HOSTNAME:/tmp - ssh -o StrictHostKeyChecking=no root@$SSH_HOSTNAME /usr/local/sbin/deploy.sh only: @@ -54,4 +59,3 @@ deploy_liv: environment: name: liv url: https://vtk.be - diff --git a/module/ShopBundle/Controller/ShopController.php b/module/ShopBundle/Controller/ShopController.php index 13ce2ac42..57381b500 100644 --- a/module/ShopBundle/Controller/ShopController.php +++ b/module/ShopBundle/Controller/ShopController.php @@ -31,6 +31,14 @@ public function reserveproductsAction() ); } + if (!$this->saleSessionIsOpen()) { + $this->flashMessenger()->error( + 'Error', + 'No session was found!' + ); + $this->redirect()->toRoute('shop'); + } + $salesSession = $this->getSalesSessionEntity(); $stockEntries = $this->getStockEntries($salesSession); @@ -550,4 +558,18 @@ private function getStockEntries($salesSession) ) ); } + + private function saleSessionIsOpen() + { + $salesSessionId = $this->getSalesSessionEntity()->getId(); + $openSaleSessions = $this->getSalesSessions(); + $openSaleSessionsIds = array_map( + function ($session) { + return $session->getId(); + }, + $openSaleSessions + ); + + return in_array($salesSessionId, $openSaleSessionsIds); + } }