From 90cfe9f6a317458e0aecb946c12eb1e65c8b2485 Mon Sep 17 00:00:00 2001 From: Maarten Haine Date: Tue, 15 Oct 2024 03:19:31 +0000 Subject: [PATCH 01/15] Removes all bookings when an article is deleted --- .../Controller/Admin/ArticleController.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/module/CudiBundle/Controller/Admin/ArticleController.php b/module/CudiBundle/Controller/Admin/ArticleController.php index 8d8e165acd..5edfd8f247 100644 --- a/module/CudiBundle/Controller/Admin/ArticleController.php +++ b/module/CudiBundle/Controller/Admin/ArticleController.php @@ -170,10 +170,20 @@ public function deleteAction() { $this->initAjax(); - $article = $this->getArticleEntity(); - if ($article === null) { + $saleArticle = $this->getSaleArticleEntity(); + if ($saleArticle === null) { return new ViewModel(); } + + $bookings = $this->getEntityManager() + ->getRepository('CudiBundle\Entity\Sale\Booking') + ->findAllActiveByArticleAndPeriod($saleArticle, $this->getActiveStockPeriodEntity()); + + $idsCancelled = array(); + foreach ($bookings as $booking) { + $booking->setStatus('canceled', $this->getEntityManager()); + $idsCancelled[] = $booking->getId(); + } $article->setIsHistory(true); $this->getEntityManager()->flush(); From b3301786695562d538bde22a742548ba097d510f Mon Sep 17 00:00:00 2001 From: Maarten Haine Date: Tue, 15 Oct 2024 03:25:21 +0000 Subject: [PATCH 02/15] if article removed bookings all cancelled --- .../Controller/Admin/Sale/ArticleController.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/module/CudiBundle/Controller/Admin/Sale/ArticleController.php b/module/CudiBundle/Controller/Admin/Sale/ArticleController.php index 10ced13e43..7194930299 100644 --- a/module/CudiBundle/Controller/Admin/Sale/ArticleController.php +++ b/module/CudiBundle/Controller/Admin/Sale/ArticleController.php @@ -278,6 +278,21 @@ public function deleteAction() { $this->initAjax(); + $saleArticle = $this->getSaleArticleEntity(); + if ($saleArticle === null) { + return new ViewModel(); + } + + $bookings = $this->getEntityManager() + ->getRepository('CudiBundle\Entity\Sale\Booking') + ->findAllActiveByArticleAndPeriod($saleArticle, $this->getActiveStockPeriodEntity()); + + $idsCancelled = array(); + foreach ($bookings as $booking) { + $booking->setStatus('canceled', $this->getEntityManager()); + $idsCancelled[] = $booking->getId(); + } + $saleArticle = $this->getSaleArticleEntity(); if ($saleArticle === null) { return new ViewModel(); @@ -291,6 +306,7 @@ public function deleteAction() 'result' => (object) array('status' => 'success'), ) ); + } public function assignAllAction() From a746d6056139c57ef13dce17d4c76214f33fe530 Mon Sep 17 00:00:00 2001 From: Maarten Haine Date: Tue, 15 Oct 2024 03:28:21 +0000 Subject: [PATCH 03/15] wrong edit --- .../Controller/Admin/ArticleController.php | 32 ++----------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/module/CudiBundle/Controller/Admin/ArticleController.php b/module/CudiBundle/Controller/Admin/ArticleController.php index 5edfd8f247..b82ba91fdd 100644 --- a/module/CudiBundle/Controller/Admin/ArticleController.php +++ b/module/CudiBundle/Controller/Admin/ArticleController.php @@ -170,20 +170,10 @@ public function deleteAction() { $this->initAjax(); - $saleArticle = $this->getSaleArticleEntity(); - if ($saleArticle === null) { + $article = $this->getArticleEntity(); + if ($article === null) { return new ViewModel(); } - - $bookings = $this->getEntityManager() - ->getRepository('CudiBundle\Entity\Sale\Booking') - ->findAllActiveByArticleAndPeriod($saleArticle, $this->getActiveStockPeriodEntity()); - - $idsCancelled = array(); - foreach ($bookings as $booking) { - $booking->setStatus('canceled', $this->getEntityManager()); - $idsCancelled[] = $booking->getId(); - } $article->setIsHistory(true); $this->getEntityManager()->flush(); @@ -195,24 +185,6 @@ public function deleteAction() ); } - public function historyAction() - { - $article = $this->getArticleEntity(); - if ($article === null) { - return new ViewModel(); - } - - $history = $this->getEntityManager() - ->getRepository('CudiBundle\Entity\Article\History') - ->findAllByArticle($article); - - return new ViewModel( - array( - 'history' => $history, - 'current' => $article, - ) - ); - } public function searchAction() { From 345da730bf4291fe7ff7b31a00668d65872da95d Mon Sep 17 00:00:00 2001 From: Maarten Haine Date: Tue, 15 Oct 2024 04:18:52 +0000 Subject: [PATCH 04/15] fixed that if article removed => bookings cancelled --- .../CudiBundle/Controller/Admin/Sale/ArticleController.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/module/CudiBundle/Controller/Admin/Sale/ArticleController.php b/module/CudiBundle/Controller/Admin/Sale/ArticleController.php index 7194930299..2f18c4394d 100644 --- a/module/CudiBundle/Controller/Admin/Sale/ArticleController.php +++ b/module/CudiBundle/Controller/Admin/Sale/ArticleController.php @@ -293,11 +293,6 @@ public function deleteAction() $idsCancelled[] = $booking->getId(); } - $saleArticle = $this->getSaleArticleEntity(); - if ($saleArticle === null) { - return new ViewModel(); - } - $saleArticle->setIsHistory(true); $this->getEntityManager()->flush(); From e36d06c37a384069e38f4c88b6e7fc7285d01c4c Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Wed, 30 Oct 2024 08:11:45 +0000 Subject: [PATCH 05/15] Updated .gitlab-ci.yml file to debug Sentry --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b95feb23c..b79e3676d7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ stages: variables: COMPOSER_HOME: $CI_PROJECT_DIR/.composer NO_PROXY: "gitlab.vtk.be" - + SENTRY_LOG_LEVEL: debug build: stage: build From 53d31e11eba8ae5348d96b8784174f864c6d9b10 Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Wed, 30 Oct 2024 08:18:53 +0000 Subject: [PATCH 06/15] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b79e3676d7..8711a1f0d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,6 @@ stages: variables: COMPOSER_HOME: $CI_PROJECT_DIR/.composer NO_PROXY: "gitlab.vtk.be" - SENTRY_LOG_LEVEL: debug build: stage: build @@ -46,6 +45,8 @@ deploy_leia: environment: name: leia url: https://liv.vtk.be + script: + - export SENTRY_LOG_LEVEL=debug deploy_liv: <<: *deploy @@ -54,4 +55,6 @@ deploy_liv: environment: name: liv url: https://vtk.be + script: + - export SENTRY_LOG_LEVEL=debug From 0f73ff1025ce13637add3870ae73b7e0a5a87b70 Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Wed, 30 Oct 2024 08:27:59 +0000 Subject: [PATCH 07/15] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8711a1f0d1..55714b8d53 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,6 +30,7 @@ build: - 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: @@ -45,8 +46,6 @@ deploy_leia: environment: name: leia url: https://liv.vtk.be - script: - - export SENTRY_LOG_LEVEL=debug deploy_liv: <<: *deploy @@ -55,6 +54,3 @@ deploy_liv: environment: name: liv url: https://vtk.be - script: - - export SENTRY_LOG_LEVEL=debug - From 21b41498987ed5858c9418ba32cf3706350a0ace Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Wed, 30 Oct 2024 09:02:18 +0000 Subject: [PATCH 08/15] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7df1d49138..e87b2735cc 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "oxcom/zend-twig": "^1.0", "packagelist/yuicompressor-bin": "^2.4", "sendinblue/api-v3-sdk": "8.4.2", - "sentry/sentry": "^1.9", + "sentry/sentry": "^4.9", "symfony/console": "^3.4", "symfony/event-dispatcher": "^4.4", "twitter/bootstrap": "^3.3", From e7f0bfb37c87c48596a6b2b729d7d33c01c842fb Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Wed, 30 Oct 2024 09:06:19 +0000 Subject: [PATCH 09/15] Revert "Update composer.json" This reverts commit 21b41498987ed5858c9418ba32cf3706350a0ace --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e87b2735cc..7df1d49138 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "oxcom/zend-twig": "^1.0", "packagelist/yuicompressor-bin": "^2.4", "sendinblue/api-v3-sdk": "8.4.2", - "sentry/sentry": "^4.9", + "sentry/sentry": "^1.9", "symfony/console": "^3.4", "symfony/event-dispatcher": "^4.4", "twitter/bootstrap": "^3.3", From 63ee4989ce8bd514acb42e381d84339e2706e74e Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Sat, 2 Nov 2024 15:58:29 +0000 Subject: [PATCH 10/15] Revert "Merge branch 'master' into vtk-master" This reverts commit c30ee52a2d372168366e82ed4e8d7cf71d98652a --- .../Controller/ActionController/ApiController.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/module/ApiBundle/Component/Controller/ActionController/ApiController.php b/module/ApiBundle/Component/Controller/ActionController/ApiController.php index 7ab1e2ee55..10851eff3e 100644 --- a/module/ApiBundle/Component/Controller/ActionController/ApiController.php +++ b/module/ApiBundle/Component/Controller/ActionController/ApiController.php @@ -101,18 +101,14 @@ public function onDispatch(MvcEvent $e) ) ) { $error = $this->error(401, 'You do not have sufficient permissions to access this resource'); - if ($result instanceof \Laminas\View\Model\ViewModel) { - $error->setOptions($result->getOptions()); - } + $error->setOptions($result->getOptions()); $e->setResult($error); return $error; } } else { $error = $this->error(401, 'No key or OAuth token was provided or the token was invalid'); - if ($result instanceof \Laminas\View\Model\ViewModel) { - $error->setOptions($result->getOptions()); - } + $error->setOptions($result->getOptions()); $e->setResult($error); return $error; From 0551a7f8db043f0e6116c8d548448d29c6d640d6 Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Sat, 2 Nov 2024 19:02:55 +0000 Subject: [PATCH 11/15] Revert "Revert "Merge branch 'master' into vtk-master"" This reverts commit 63ee4989ce8bd514acb42e381d84339e2706e74e --- .../Controller/ActionController/ApiController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/ApiBundle/Component/Controller/ActionController/ApiController.php b/module/ApiBundle/Component/Controller/ActionController/ApiController.php index 10851eff3e..7ab1e2ee55 100644 --- a/module/ApiBundle/Component/Controller/ActionController/ApiController.php +++ b/module/ApiBundle/Component/Controller/ActionController/ApiController.php @@ -101,14 +101,18 @@ public function onDispatch(MvcEvent $e) ) ) { $error = $this->error(401, 'You do not have sufficient permissions to access this resource'); - $error->setOptions($result->getOptions()); + if ($result instanceof \Laminas\View\Model\ViewModel) { + $error->setOptions($result->getOptions()); + } $e->setResult($error); return $error; } } else { $error = $this->error(401, 'No key or OAuth token was provided or the token was invalid'); - $error->setOptions($result->getOptions()); + if ($result instanceof \Laminas\View\Model\ViewModel) { + $error->setOptions($result->getOptions()); + } $e->setResult($error); return $error; From 97746ed5f9837cdcf4bdd833f5c35f938be67ad3 Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Sun, 3 Nov 2024 20:18:50 +0000 Subject: [PATCH 12/15] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 55714b8d53..a472b86a3a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,15 +3,19 @@ stages: - deploy variables: - COMPOSER_HOME: $CI_PROJECT_DIR/.composer + COMPOSER_HOME: "$CI_PROJECT_DIR/.composer" NO_PROXY: "gitlab.vtk.be" +# Build job build: stage: build script: + - echo "Starting Composer update and install..." - composer update --no-dev - composer install --no-dev - - echo $CI_COMMIT_SHA > COMMIT + - echo "Saving commit SHA to COMMIT file..." + - echo "$CI_COMMIT_SHA" > COMMIT + - echo "Creating tarball of project files..." - tar czf litus.tar.gz bin/ config/ data/ migrations/ module/ public/ shibboleth/ vendor/ COMMIT LICENSE.md NOTICE.md README.md only: - master @@ -23,22 +27,27 @@ build: paths: - litus.tar.gz - +# Common deploy settings .deploy: &deploy stage: deploy before_script: + - echo "Setting up SSH agent and adding key..." - eval $(ssh-agent -s) - - ssh-add <(echo $SSH_PRIVATE_KEY | base64 -d) + - echo "$SSH_PRIVATE_KEY" | base64 -d | ssh-add - script: + - echo "Setting Sentry log level to debug..." - 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 + - echo "Copying tarball to remote host..." + - scp -o StrictHostKeyChecking=no litus.tar.gz root@"$SSH_HOSTNAME":/tmp + - echo "Running deployment script on remote host..." + - ssh -o StrictHostKeyChecking=no root@"$SSH_HOSTNAME" /usr/local/sbin/deploy.sh only: - master when: manual dependencies: - build +# Deploy job for leia deploy_leia: <<: *deploy variables: @@ -47,10 +56,11 @@ deploy_leia: name: leia url: https://liv.vtk.be +# Deploy job for liv deploy_liv: <<: *deploy variables: SSH_HOSTNAME: liv.vtk.be environment: name: liv - url: https://vtk.be + url: https://vtk.be \ No newline at end of file From c54be83d2faba9fa176a471e1bb178c1d09f0d88 Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Sun, 3 Nov 2024 20:20:34 +0000 Subject: [PATCH 13/15] Revert "Update .gitlab-ci.yml file" This reverts commit 97746ed5f9837cdcf4bdd833f5c35f938be67ad3 --- .gitlab-ci.yml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a472b86a3a..55714b8d53 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,19 +3,15 @@ stages: - deploy variables: - COMPOSER_HOME: "$CI_PROJECT_DIR/.composer" + COMPOSER_HOME: $CI_PROJECT_DIR/.composer NO_PROXY: "gitlab.vtk.be" -# Build job build: stage: build script: - - echo "Starting Composer update and install..." - composer update --no-dev - composer install --no-dev - - echo "Saving commit SHA to COMMIT file..." - - echo "$CI_COMMIT_SHA" > COMMIT - - echo "Creating tarball of project files..." + - echo $CI_COMMIT_SHA > COMMIT - tar czf litus.tar.gz bin/ config/ data/ migrations/ module/ public/ shibboleth/ vendor/ COMMIT LICENSE.md NOTICE.md README.md only: - master @@ -27,27 +23,22 @@ build: paths: - litus.tar.gz -# Common deploy settings + .deploy: &deploy stage: deploy before_script: - - echo "Setting up SSH agent and adding key..." - eval $(ssh-agent -s) - - echo "$SSH_PRIVATE_KEY" | base64 -d | ssh-add - + - ssh-add <(echo $SSH_PRIVATE_KEY | base64 -d) script: - - echo "Setting Sentry log level to debug..." - export SENTRY_LOG_LEVEL=debug - - echo "Copying tarball to remote host..." - - scp -o StrictHostKeyChecking=no litus.tar.gz root@"$SSH_HOSTNAME":/tmp - - echo "Running deployment script on remote host..." - - ssh -o StrictHostKeyChecking=no root@"$SSH_HOSTNAME" /usr/local/sbin/deploy.sh + - scp -o StrictHostKeyChecking=no litus.tar.gz root@$SSH_HOSTNAME:/tmp + - ssh -o StrictHostKeyChecking=no root@$SSH_HOSTNAME /usr/local/sbin/deploy.sh only: - master when: manual dependencies: - build -# Deploy job for leia deploy_leia: <<: *deploy variables: @@ -56,11 +47,10 @@ deploy_leia: name: leia url: https://liv.vtk.be -# Deploy job for liv deploy_liv: <<: *deploy variables: SSH_HOSTNAME: liv.vtk.be environment: name: liv - url: https://vtk.be \ No newline at end of file + url: https://vtk.be From 5f4e21d8d780f1ad36723fda4843aac2fdc64963 Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Sun, 3 Nov 2024 20:58:23 +0000 Subject: [PATCH 14/15] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 55714b8d53..16b817963a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,9 @@ variables: build: stage: build + before_script: + - sudo update-alternatives --set php /usr/bin/php7.4 + - php -v script: - composer update --no-dev - composer install --no-dev @@ -27,6 +30,8 @@ build: .deploy: &deploy stage: deploy before_script: + - sudo update-alternatives --set php /usr/bin/php7.4 + - php -v - eval $(ssh-agent -s) - ssh-add <(echo $SSH_PRIVATE_KEY | base64 -d) script: From 7cb4141b8b755bd825b723eebc4ad347b332433f Mon Sep 17 00:00:00 2001 From: Tiddo Nees Date: Sun, 3 Nov 2024 21:03:30 +0000 Subject: [PATCH 15/15] Update .gitlab-ci.yml --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 16b817963a..1532c5f1e6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ variables: build: stage: build before_script: - - sudo update-alternatives --set php /usr/bin/php7.4 + - export PATH="/usr/bin/php7.4:$PATH" - php -v script: - composer update --no-dev @@ -30,7 +30,7 @@ build: .deploy: &deploy stage: deploy before_script: - - sudo update-alternatives --set php /usr/bin/php7.4 + - export PATH="/usr/bin/php7.4:$PATH" - php -v - eval $(ssh-agent -s) - ssh-add <(echo $SSH_PRIVATE_KEY | base64 -d)