From 8cc84d0fd0dcbaef8824cc769cd4787296862c97 Mon Sep 17 00:00:00 2001 From: s j <sj@1729.be> Date: Mon, 8 Jan 2024 22:18:39 +0100 Subject: [PATCH 1/2] imp: I-7891 issue transaction cost --- composer.json | 2 +- .../ShareholderMappingWebformHandler.php | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index ce8c95f..77862f4 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "drupal/mollie_payment": "^3.0", "drupal/payment": "^2.0", "drupal/route_condition":"^2.0", - "drupal/shareholder_register": "^v1.1.8", + "drupal/shareholder_register": "^v1.1.11", "drupal/shareholder_register_accounting": "^2.0", "drupal/simple_workflows": "^1.0.4", "drupal/vbo_export": "^4.0", diff --git a/modules/dsr_sign_up_form/src/Plugin/WebformHandler/ShareholderMappingWebformHandler.php b/modules/dsr_sign_up_form/src/Plugin/WebformHandler/ShareholderMappingWebformHandler.php index be9c505..1c2225d 100644 --- a/modules/dsr_sign_up_form/src/Plugin/WebformHandler/ShareholderMappingWebformHandler.php +++ b/modules/dsr_sign_up_form/src/Plugin/WebformHandler/ShareholderMappingWebformHandler.php @@ -11,6 +11,7 @@ use Drupal\dsr_sign_up_form\Event\SignUpEvent; use Drupal\shareholder_register\Entity\ShareIssue; use Drupal\shareholder_register\Entity\Shareholder; use Drupal\shareholder_register\Exception\ShareholderRegisterException; +use Drupal\shareholder_register_webform\Element\ShareholderShares; use Drupal\accounting\Entity\AccountingAccount; @@ -29,7 +30,7 @@ use Drupal\accounting\Entity\AccountingAccount; * ) */ class ShareholderMappingWebformHandler extends WebformHandlerBase { - + /** * {@inheritdoc} */ @@ -120,10 +121,13 @@ class ShareholderMappingWebformHandler extends WebformHandlerBase { $shareholder_shares_key = $this->configuration['shares_key']; $data = $submission->getData(); - $share_issue = ShareIssue::load($data[$shareholder_shares_key]['share_issue']); + $share_price = ShareholderShares::getSharePrice( + $data[$shareholder_shares_key]['share_issue'], + $data[$shareholder_shares_key]['share_quantity'] + ); - if ($account->getCreditBalance() >= $share_issue->getSharePrice() * $data[$shareholder_shares_key]['share_quantity']) { - return $account->getCreditBalanceDate($share_issue->getSharePrice() * $data[$shareholder_shares_key]['share_quantity']); + if ($account->getCreditBalance() >= $share_price['total']) { + return $account->getCreditBalanceDate($share_price['total']); } return FALSE; } -- GitLab From 25382648ff73f158d617b15c0a151344ead4a992 Mon Sep 17 00:00:00 2001 From: s j <sj@1729.be> Date: Mon, 8 Jan 2024 22:21:18 +0100 Subject: [PATCH 2/2] ref: update gitlabci --- .gitlab-ci.yml | 170 +------------------------- .gitlab-ci/build.php | 97 --------------- .gitlab-ci/webform_views-schema.patch | 26 ---- composer.json | 6 +- 4 files changed, 8 insertions(+), 291 deletions(-) delete mode 100644 .gitlab-ci/build.php delete mode 100644 .gitlab-ci/webform_views-schema.patch diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cb16b70..d6afb7b 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,168 +1,4 @@ -################################################################################ -# Gitlab CI integration for Drupal 8/9 project or module: tests, code quality, -# linting, metrics and deploy samples. -# -# Project: https://gitlab.com/mog33/gitlab-ci-drupal -# Documentation: https://mog33.gitlab.io/gitlab-ci-drupal -# Issues: https://gitlab.com/mog33/gitlab-ci-drupal/-/issues -# Author: Jean Valverde contact@dev-drupal.com -# License: GPL-3 -# -# If you want to support this project, you can -# - Buy me a coffee: https://bit.ly/34jPKcE -# - Hire me as a freelance for any Drupal related work -# - Promote me to any company looking for any Drupal related work -# - Help me with testing / documentation / grammar fixes / use cases... -# -################################################################################ - -# The ref is relative to the version of the project to use. include: - # If hosted on gitlab.com. - # - project: 'mog33/gitlab-ci-drupal' - # ref: 3.x-dev - # file: '/.gitlab-ci/.gitlab-ci-template.yml' - # If hosted on an other Gitlab instance. - # - remote: 'https://gitlab.com/mog33/gitlab-ci-drupal/-/raw/3.x-dev/.gitlab-ci/.gitlab-ci-template.yml' - - remote: 'https://git.startx.be/forks/gitlab-ci-drupal/-/raw/startx/.gitlab-ci/.gitlab-ci-template.yml' - -# If needed by your Gitlab-ci instance, you can set global tags for all jobs. -# default: -# tags: -# - docker - -################################################################################ -# Gitlab-CI variables documentation: -# https://docs.gitlab.com/ee/ci/variables/ -# -# Variables, can be set here or on -# Gitlab CI UI > settings > CI/CD > variables -# UI take precedence on variables here. -# https://docs.gitlab.com/ee/ci/variables/README.html#priority-of-environment-variables -################################################################################ - -variables: - # This is mandatory to get default variables. - extends: .default_variables - - # Global config remote files ref. - # SHOULD be the same as 'include: ref:' from above. - CI_REF: 3.x-dev - - # Minor Drupal version to work with, limited to tags on - # https://hub.docker.com/r/mogtofu33/drupal8ci/tags?name=3.x - # CI_DRUPAL_VERSION: "9.2" - - ############################################################################## - # Tests disabled by default because need a specific setup / configuration. - # - # Only needed if you have Behat tests, comment or set to 0 to enable. - # https://mog33.gitlab.io/gitlab-ci-drupal/advanced-usage/#behat-tests - SKIP_TEST_BEHAT: 1 - # Can use a profile setup or a dump file in dump/ - BEHAT_INSTALL_PROFILE: "minimal" - - # Accessibility tests. - # https://mog33.gitlab.io/gitlab-ci-drupal/advanced-usage/#accessibility-with-pa11y - SKIP_TEST_PA11Y: 1 - # Can use a profile setup or a dump file in dump/ - PA11Y_INSTALL_PROFILE: "minimal" - - # Only if you have Nightwatch tests in your code. - # https://mog33.gitlab.io/gitlab-ci-drupal/advanced-usage/#nightwatchjs - SKIP_TEST_NIGHTWATCH: 1 - # Default is '--skiptags core', add your tag. - # NIGHTWATCH_TESTS: --tag my_module - - # Phpunit tests to run, default provide only custom code or if this variable - # is empty all tests (including Drupal core). - # https://mog33.gitlab.io/gitlab-ci-drupal/advanced-usage/#phpunit-tests - PHPUNIT_TESTS: "custom" - - # Specify a group of tests to run rather than all tests in the suite. - # PHPUNIT_GROUP: my_group_1,my_group_2 - - ############################################################################## - # Override default variables for a module. - # - # Default CI setup is for a 'project' (full Drupal with a composer.json), next - # section contains common variables to change for a module (module, theme or - # profile). Simply uncomment and adapt dirs to set the CI for a module. - # - CI_TYPE: module - # Code quality dirs, must include your PHP code to check. - # Phpstan need autoloading, that's why we use web_root. - DIRS_QA: "${WEB_ROOT}/modules/custom" - # Eslint / Stylelint files to test. - DIRS_JS: "${CI_PROJECT_DIR}/js/*.js" - DIRS_CSS: "${CI_PROJECT_DIR}/css/*.css" - # Twig files to test. - DIRS_TWIG: "${CI_PROJECT_DIR}/templates" - # phpmetrics / phpstats dirs to include. - DIRS_PHP: "${CI_PROJECT_DIR}" - # Set SKIP_XXX variable to 1 to skip. - # Security is for a Drupal project with third party. - SKIP_TEST_SECURITY: 1 - # If you don't have any css files, you can skip with - SKIP_LINT_CSS: 1 - # If you don't have any javascript files, you can skip with - SKIP_LINT_JS: 1 - # If you don't have any twig files, you can skip with - SKIP_LINT_TWIG: 1 - # - ############################################################################## - - ############################################################################## - # As a sample here is a list of some variables, see documentation for more - # variables. - # - # List of DIRS_* variables to define dirs to analyse for specific jobs. - # Code quality dirs, must include your PHP code to check. - # - # DIRS_QA: "${WEB_ROOT}/modules/custom,${WEB_ROOT}/themes/custom" - # - # Eslint / Stylelint files to test. - # Space separated for multiple folders. - # Default is to check files under all custom folders. - # - # DIRS_JS: "${WEB_ROOT}/**/custom/**/*.js" - # DIRS_CSS: "${WEB_ROOT}/**/custom/**/css/*.css" - # - # Twig files to test, recursive. - # - # DIRS_TWIG: "${WEB_ROOT}/themes/custom" - # - # Phpmetrics / Phpstats dirs to include. - # Default is to check all dirs. - # - # DIRS_PHP: "${WEB_ROOT}/modules/custom,${WEB_ROOT}/themes/custom" - # - # # ALL SKIP variables, uncomment and set to 1 to skip a job. - # SKIP_BUILD: 1 # if not running any tests or deploy. - # - # SKIP_TESTS: 1 # Skip all tests, ignore SKIP_TEST_*. - # SKIP_TEST_UNITKERNEL: 1 - # SKIP_TEST_FUNCTIONAL: 1 - # SKIP_TEST_FUNCTIONALJS: 1 - # SKIP_TEST_SECURITY: 1 - # - # SKIP_QA: 1 - # - # SKIP_LINT: 1 # Skip all lint, ignore SKIP_LINT_*. - # SKIP_LINT_CSS: 1 - # SKIP_LINT_JS: 1 - # SKIP_LINT_TWIG: 1 - # - # SKIP_METRICS: 1 - - # QA and Metrics tools. - # See Phpqa available tools: https://github.com/EdgedesignCZ/phpqa#available-tools - # ':0' is the number of errors allowed, default here is very strict. - # - # TOOLS_QA: "phpcs:0,phpmd:0,parallel-lint:0,phpstan:0,phpcpd:0" - # TOOLS_METRICS: "phpmetrics,phploc,pdepend" - -################################################################################ -# Advanced usage with this file, see doc. -# https://mog33.gitlab.io/gitlab-ci-drupal/advanced-usage -################################################################################ + - remote: 'https://git.drupalcode.org/project/gitlab_templates/-/raw/1.0.x/includes/include.drupalci.main.yml' + - remote: 'https://git.drupalcode.org/project/gitlab_templates/-/raw/1.0.x/includes/include.drupalci.variables.yml' + - remote: 'https://git.drupalcode.org/project/gitlab_templates/-/raw/1.0.x/includes/include.drupalci.workflows.yml' diff --git a/.gitlab-ci/build.php b/.gitlab-ci/build.php deleted file mode 100644 index 1e87daf..0000000 --- a/.gitlab-ci/build.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -/** - * @file - * You can use this file to run extra Robo build tasks. - * - * See RoboFile.php and https://robo.li/ documentation to run a task. - * - * For CI_TYPE='project', this file is executed directly during the Build job - * script after the regular composer install. - * - * For CI_TYPE='module', this file is executed on each 'before_script' part of - * jobs. - * - * It's important to have any action relative to the docRoot or webRoot as - * we are not working from the CI_PROJECT_DIR. - * - * Examples: - * - * $this->say("This will be run in Build script!"); - * - * $this->taskGulpRun() - * ->dir($this->webRoot . 'themes/my_theme_with_gulp_task') - * ->run(); - * - * $this->taskComposerRequire() - * ->noInteraction() - * ->noAnsi() - * ->workingDir($this->docRoot); - * ->dependency('drupal/webform', '^5.13') - * ->run(); - * - * Or shortcut method in the RoboFile.php with this project: - * $this->composerRequire() - * ->dependency('drupal/webform', '^5.13') - * ->run(); - */ - -$this->taskComposerConfig() - ->noInteraction() - ->noAnsi() - ->workingDir($this->docRoot) - ->repository("1", "https://packages.startx.be", "composer") - ->run(); - -$this->taskComposerConfig() - ->noInteraction() - ->noAnsi() - ->workingDir($this->docRoot) - ->repository("0", "https://packages.drupal.org/8", "composer") - ->run(); - -$this->taskComposerConfig() - ->noInteraction() - ->noAnsi() - ->workingDir($this->docRoot) - ->args(["minimum-stability", "dev"]) - ->run(); - -// $this->_exec("cat /opt/drupal/composer.json"); -$this->composerRequire() - ->dependency("drupal/accounting", "^1.0.11") - ->dependency('drupal/address', '^1.8') - ->dependency("drupal/admin_toolbar", "^3.0") - ->dependency("drupal/advanced_help", "^1.0@alpha") - ->dependency("drupal/charts", "3.x-dev") - ->dependency("drupal/cleave_js", "^1.0") - ->dependency("drupal/currency", "^3.2") - ->dependency("drupal/drush_language", "^1.0@RC") - ->dependency("drupal/formtips", "^1.1") - ->dependency("drupal/banking", "^v2.0") - ->dependency("drupal/banking_import_camt", "^1.0") - ->dependency("drupal/banking_import_coda", "^1.0.2") - ->dependency("drupal/banking_import_myponto", "^1.0.0") - ->dependency("drupal/banking_orders", "^1.0.2") - ->dependency("drupal/banking_orders_accounting", "^1.0.3") - ->dependency("drupal/iban_bic_field", "^1.0") - ->dependency('drupal/inline_entity_form', '^1.0') - ->dependency("drupal/mail_template", "^1.0.7") - ->dependency("drupal/mollie_payment", "^3.0") - ->dependency("drupal/payment", "^2.0") - ->dependency("drupal/route_condition", "^2.0") - ->dependency("drupal/shareholder_register", "^1.0.26") - ->dependency("drupal/shareholder_register_accounting", "^1.0.21") - ->dependency("drupal/simple_workflows", "^1.0.3") - ->dependency('drupal/views_bulk_operations', '^4.0') - ->dependency("drupal/vbo_export", "^4.0") - ->dependency("drupal/webform", "^6.0") - ->dependency("drupal/webform_views", "^5.0@alpha") - // ->dependency("google/charts", "45") - ->dependency("drupal/swiftmailer", "^2.0") - ->dependency("drupal/twig_tweak", "^2.0") - ->dependency("drupal/drush_language", "1.x-dev") - ->run(); - -$this->_exec("cat /builds/DAR/dsr/.gitlab-ci/webform_views-schema.patch | patch -p 1 -d {$this->webRoot}/modules/contrib/webform_views/"); -$this->_exec("curl -fsSL https://www.drupal.org/files/issues/2021-12-02/2429699-453-9.3.x.patch | patch -p 1 -d {$this->webRoot}"); diff --git a/.gitlab-ci/webform_views-schema.patch b/.gitlab-ci/webform_views-schema.patch deleted file mode 100644 index e6a66cf..0000000 --- a/.gitlab-ci/webform_views-schema.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/config/schema/webform_views.schema.yml b/config/schema/webform_views.schema.yml -index 4d5a84d..462f742 100644 ---- a/config/schema/webform_views.schema.yml -+++ b/config/schema/webform_views.schema.yml -@@ -13,6 +13,21 @@ views.field.webform_submission_field: - type: integer - label: 'Delta to use' - -+# Schema definition for webform submission composite field. -+views.field.webform_submission_composite_field: -+ type: views.field.webform_submission_field -+ label: 'Webform submission composite field' -+ mapping: -+ webform_element_format: -+ type: string -+ label: 'Format' -+ webform_multiple_value: -+ type: boolean -+ label: 'Whether to show all multiple values in a single field' -+ webform_multiple_delta: -+ type: integer -+ label: 'Delta to use' -+ - # Schema definition for select filter. - views.filter.webform_submission_select_filter: - type: views.filter.in_operator diff --git a/composer.json b/composer.json index 77862f4..9d3ed1c 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,10 @@ "source": "http://cgit.drupalcode.org/dsr" }, "repositories": [ + { + "type": "composer", + "url": "https://packages.startx.be" + }, { "type": "package", "package": { @@ -51,7 +55,7 @@ "drupal/mollie_payment": "^3.0", "drupal/payment": "^2.0", "drupal/route_condition":"^2.0", - "drupal/shareholder_register": "^v1.1.11", + "drupal/shareholder_register": "^1.1.11", "drupal/shareholder_register_accounting": "^2.0", "drupal/simple_workflows": "^1.0.4", "drupal/vbo_export": "^4.0", -- GitLab