Skip to content

Commit

Permalink
Merge branch 'master' of github.com:LitusProject/Litus
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiddons committed Nov 4, 2024
2 parents d864f8a + 019f6af commit 2a8ac07
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -54,4 +59,3 @@ deploy_liv:
environment:
name: liv
url: https://vtk.be

22 changes: 22 additions & 0 deletions module/ShopBundle/Controller/ShopController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}
}

0 comments on commit 2a8ac07

Please sign in to comment.