From 9603a6e30ca878e965a9397c190ca8870d98be70 Mon Sep 17 00:00:00 2001 From: "nicolas.demangeat" Date: Thu, 29 Jun 2023 08:11:01 +0000 Subject: [PATCH] Resolve "Parse Error Jobs/AutoCloseOldTickets.php" --- .gitlab-ci.yml | 135 +++--------------- app/Console/Commands/AutoCloseOldTickets.php | 38 +++++ .../Commands/WarnBeforeAutoCloseTicket.php | 38 +++++ app/Jobs/AutoCloseOldTickets.php | 2 +- app/Jobs/WarnBeforeAutoCloseTicket.php | 2 +- 5 files changed, 96 insertions(+), 119 deletions(-) create mode 100644 app/Console/Commands/AutoCloseOldTickets.php create mode 100644 app/Console/Commands/WarnBeforeAutoCloseTicket.php diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9288796..f760eea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,118 +1,19 @@ +include: + - project: 'ldc-web/shared-ci' + ref: 'main' + file: 'lint/lint7.3.yml' + - project: 'ldc-web/shared-ci' + ref: 'main' + file: 'security/security7.3.yml' + - project: 'ldc-web/shared-ci' + ref: 'main' + file: 'build/build7.3.yml' + - project: 'ldc-web/shared-ci' + ref: 'main' + file: 'test/test.yml' + stages: - - Security - - CodingStandards - - Builds - -composer-security: - stage: Security - image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0 - script: - - local-php-security-checker --format=json --path=./composer.lock > composer-security-checker-report.json - artifacts: - when: on_failure - expose_as: 'composer-security-checker' - paths: - - composer-security-checker-report.json - allow_failure: true - needs: [] - -npm-security: - stage: Security - image: node:17.9.1 - before_script: - - npm install --location=global audit-ci@^6 - script: - - audit-ci -p npm -o json > npm-security-checker-report.json - artifacts: - when: on_failure - expose_as: 'npm-security-checker' - paths: - - npm-security-checker-report.json - allow_failure: true - needs: [] - -phpcs: - stage: CodingStandards - image: $CI_REGISTRY/service-web-lab/ldc-web-images-docker/ldcweb-qa:php7.3-1.0 - before_script: - - composer config gitlab-token.gitlab.com $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD - - composer install - cache: - paths: - - vendor/ - script: - - vendor/bin/phpcs --report=junit --report-file=phpcs-report.xml - artifacts: - when: on_failure - expose_as: 'phpcs' - paths: - - phpcs-report.xml - reports: - junit: phpcs-report.xml - allow_failure: false - needs: - - composer-security - - npm-security - -eslint: - stage: CodingStandards - image: node:17.9.1 - before_script: - - npm install - cache: - paths: - - node_modules/ - script: - - npm run eslint-ci --silent > eslint-report.xml - artifacts: - when: on_failure - expose_as: 'eslint' - paths: - - eslint-report.xml - reports: - junit: eslint-report.xml - allow_failure: false - needs: - - composer-security - - npm-security - -stylelint: - stage: CodingStandards - image: node:17.9.1 - before_script: - - npm install - cache: - paths: - - node_modules/ - script: - - npm run stylelint-ci --silent > stylelint-report.json - artifacts: - when: on_failure - expose_as: 'stylelint' - paths: - - stylelint-report.json - allow_failure: false - needs: - - composer-security - - npm-security - -front-build: - stage: Builds - image: node:17.9.1 - before_script: - - npm install - cache: - paths: - - node_modules/ - script: - - npm run prod > front-build-report.json - artifacts: - when: on_failure - expose_as: 'front-build-report' - paths: - - front-build-report.json - allow_failure: false - needs: - - phpcs - - eslint - - stylelint \ No newline at end of file + - lint + - security + - build + - test diff --git a/app/Console/Commands/AutoCloseOldTickets.php b/app/Console/Commands/AutoCloseOldTickets.php new file mode 100644 index 0000000..ab5686f --- /dev/null +++ b/app/Console/Commands/AutoCloseOldTickets.php @@ -0,0 +1,38 @@ +info('Running the Job, this could take some time.'); + $job = new JobsAutoCloseOldTickets(); + $job->handle(); + $this->info('Job completed'); + + return 0; + } +} diff --git a/app/Console/Commands/WarnBeforeAutoCloseTicket.php b/app/Console/Commands/WarnBeforeAutoCloseTicket.php new file mode 100644 index 0000000..289eeee --- /dev/null +++ b/app/Console/Commands/WarnBeforeAutoCloseTicket.php @@ -0,0 +1,38 @@ +info('Running the Job, this could take some time.'); + $job = new JobsWarnBeforeAutoCloseTicket(); + $job->handle(); + $this->info('Job completed'); + + return 0; + } +} diff --git a/app/Jobs/AutoCloseOldTickets.php b/app/Jobs/AutoCloseOldTickets.php index 9592ca6..896eb55 100644 --- a/app/Jobs/AutoCloseOldTickets.php +++ b/app/Jobs/AutoCloseOldTickets.php @@ -21,7 +21,7 @@ class AutoCloseOldTickets $message = 'En l\'absence d\'activitée depuis 15 jours ce ticket est automatiquement clos et archivé.'; $tickets = Ticket::where(function ($q) { $q->where('status', TicketStatus::production()) - ->orWhere('status', TicketStatus::waitingValidation()) + ->orWhere('status', TicketStatus::waitingValidation()); })->whereDate('updated_at', '<=', Carbon::now()->subDays($limitDays)) ->whereDoesntHave('messages', function ($q) use ($limitDays) { $q->whereDate('updated_at', '>', Carbon::now()->subDays($limitDays)); diff --git a/app/Jobs/WarnBeforeAutoCloseTicket.php b/app/Jobs/WarnBeforeAutoCloseTicket.php index 15b76b4..a9f8cc4 100644 --- a/app/Jobs/WarnBeforeAutoCloseTicket.php +++ b/app/Jobs/WarnBeforeAutoCloseTicket.php @@ -24,7 +24,7 @@ class WarnBeforeAutoCloseTicket $messageToUser = 'En l\'absence d\'activitée, ou de réponse de votre part ce ticket sera automatiquement clos et archivé dans %s jours.'; $tickets = Ticket::where(function ($q) { $q->where('status', TicketStatus::production()) - ->orWhere('status', TicketStatus::waitingValidation()) + ->orWhere('status', TicketStatus::waitingValidation()); })->whereDate('updated_at', '<=', Carbon::now()->subDays($warningDays)) ->whereDoesntHave('messages', function ($q) use ($warningDays) { $q->whereDate('updated_at', '>', Carbon::now()->subDays($warningDays));