Skip to content

Commit

Permalink
Merge pull request #39 from Datatrics/release/1.6.6
Browse files Browse the repository at this point in the history
Release/1.6.6
  • Loading branch information
Marvin-Magmodules authored May 2, 2023
2 parents d114379 + 33c608c commit b5e2e1a
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 68 deletions.
34 changes: 6 additions & 28 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,22 @@ name: Lint PHP files
on: [push, pull_request]

jobs:
php-71:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/actions-php-lint@7.1
with:
dir: './'

php-72:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/actions-php-lint@7.2
with:
dir: './'

php-73:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/actions-php-lint@7.3
with:
dir: './'
- uses: prestashop/github-action-php-lint/7.3@v2.1

php-74:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/actions-php-lint@7.4
with:
dir: './'
- uses: prestashop/github-action-php-lint/7.4@v2.1

php-80:
php-81:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/actions-php-lint@8.0
with:
dir: './'
- uses: prestashop/github-action-php-lint/8.1@v2.1

php-81:
php-82:
runs-on: ubuntu-latest
steps:
- uses: StephaneBour/actions-php-lint@8.1
with:
dir: './'
- uses: prestashop/github-action-php-lint/8.2@v2.1
10 changes: 5 additions & 5 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: phpstan
on: [pull_request]
on: [ pull_request ]

jobs:
build:
strategy:
matrix:
include:
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.4
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6

runs-on: ubuntu-latest
steps:
Expand All @@ -23,10 +23,10 @@ jobs:
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/

- name: Install the extensions in Magento
run: docker exec magento-project-community-edition composer require datatrics/magento2-integration:dev-continuous-integration-test-branch
run: docker exec magento-project-community-edition composer require datatrics/magento2-integration:@dev --no-plugins

- name: Activate the extension
run: docker exec magento-project-community-edition bash -c "php bin/magento module:enable Datatrics_Connect && php bin/magento setup:upgrade && php bin/magento setup:di:compile"
run: docker exec magento-project-community-edition ./retry "php bin/magento module:enable Datatrics_Connect && php bin/magento setup:upgrade && php bin/magento setup:di:compile"

- name: Run PHPStan
run: docker exec magento-project-community-edition /bin/bash -c "./vendor/bin/phpstan analyse --no-progress -c /data/extensions/*/phpstan.neon /data/extensions"
24 changes: 12 additions & 12 deletions .github/workflows/setup-di-compile.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
name: Run setup:upgrade and setup:di:compile
on: [pull_request]
on: [ pull_request ]

jobs:
build:
strategy:
matrix:
include:
- PHP_VERSION: php72-fpm
MAGENTO_VERSION: 2.3.3
- PHP_VERSION: php73-fpm
MAGENTO_VERSION: 2.3.7
- PHP_VERSION: php74-fpm
MAGENTO_VERSION: 2.4.2
- PHP_VERSION: php81-fpm
MAGENTO_VERSION: 2.4.4
MAGENTO_VERSION: 2.4.0
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6
- PHP_VERSION: php82-fpm
MAGENTO_VERSION: 2.4.6
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v1

- name: Start Docker
run: PHP_VERSION=${{ matrix.PHP_VERSION }} MAGENTO_VERSION=magento${{ matrix.MAGENTO_VERSION }} docker-compose -f .github/workflows/templates/docker-compose.yml up -d
run: docker run --detach --name magento-project-community-edition michielgerritsen/magento-project-community-edition:${{ matrix.PHP_VERSION }}-magento${{ matrix.MAGENTO_VERSION }}

- name: Create branch for Composer and remove version from composer.json
run: git checkout -b continuous-integration-test-branch && sed -i '/version/d' ./composer.json
- name: Upload our code into the docker container
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/

- name: Upload the code into the docker container
run: docker cp $(pwd) magento-project-community-edition:/data/extensions/ && docker exec magento-project-community-edition composer require datatrics/magento2-integration:dev-continuous-integration-test-branch
run: docker exec magento-project-community-edition composer require datatrics/magento2-integration:@dev --no-plugins

- name: Activate the extension and run setup:upgrade and setup:di:compile
run: docker exec magento-project-community-edition bash -c "php bin/magento module:enable Datatrics_Connect && php bin/magento setup:upgrade && php bin/magento setup:di:compile"
run: docker exec magento-project-community-edition ./retry "php bin/magento setup:upgrade && php bin/magento setup:di:compile"
3 changes: 2 additions & 1 deletion Console/Command/Selftest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Datatrics\Connect\Console\Command;

use Magento\Framework\Console\Cli;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -71,6 +72,6 @@ public function execute(InputInterface $input, OutputInterface $output)
);
}
}
return 0;
return Cli::RETURN_SUCCESS;
}
}
7 changes: 4 additions & 3 deletions Plugin/CustomerGridCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,17 @@ public function __construct(
*/
public function afterSearch($intercepter, $collection)
{
if ($collection->getMainTable() === $this->resourceConnection->getTableName(self::TABLE)) {
if (method_exists($collection, 'getMainTable') &&
($collection->getMainTable() === $this->resourceConnection->getTableName(self::TABLE))) {
$leftJoinTableName = $this->resourceConnection->getTableName(ProfileResource::ENTITY_TABLE);
$collection
->getSelect()
->distinct()
->joinLeft(
['datatrics_profile' => $leftJoinTableName],
"datatrics_profile.customer_id = main_table.entity_id",
['status' => 'datatrics_profile.status']
);
['status' => new \Zend_Db_Expr('group_concat(`datatrics_profile`.status)')]
)->group('main_table.entity_id');
$where = $collection->getSelect()->getPart(\Magento\Framework\DB\Select::WHERE);
foreach ($where as &$item) {
if (strpos($item, "`main_table`.`status`") !== false) {
Expand Down
8 changes: 4 additions & 4 deletions Service/Product/Data/Stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,17 @@ private function collectMsi(array $channels): array
]
);
foreach ($channels as $channel) {
$stockTable = sprintf('inventory_stock_%s', $channel);
$stockTable = $this->resource->getTableName(sprintf('inventory_stock_%s', $channel));
$selectStock->joinLeft(
$stockTable,
"${stockTable}.website_id = ${stockTablePrimary}.website_id and
${stockTable}.product_id = ${stockTablePrimary}.product_id",
"{$stockTable}.website_id = {$stockTablePrimary}.website_id and
{$stockTable}.product_id = {$stockTablePrimary}.product_id",
[
sprintf('quantity_%s', $channel) => 'quantity'
]
);
}
$selectStock->where("${stockTablePrimary}.product_id IN (?)", $this->entityIds);
$selectStock->where("{$stockTablePrimary}.product_id IN (?)", $this->entityIds);
return $this->resource->getConnection()->fetchAll($selectStock);
}

Expand Down
12 changes: 7 additions & 5 deletions Service/ProductData/AttributeCollector/Data/Stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,12 @@ private function collectMsi(array $channels): array
$channels = array_flip($channels);
unset($channels[$channel]);
$channels = array_flip($channels);

$stockTablePrimary = $this->resource->getTableName(sprintf('inventory_stock_%s', $channel));
if (!$this->resource->getConnection()->isTableExists($stockTablePrimary)) {
return [];
}

$selectStock = $this->resource->getConnection()
->select()
->from(
Expand All @@ -188,27 +190,27 @@ private function collectMsi(array $channels): array
]
);
foreach ($channels as $channel) {
$stockTable = sprintf('inventory_stock_%s', $channel);
$stockTable = $this->resource->getTableName(sprintf('inventory_stock_%s', $channel));
if (!$this->resource->getConnection()->tableColumnExists($stockTable, 'website_id')) {
$selectStock->joinLeft(
$stockTable,
"${stockTable}.sku = ${stockTablePrimary}.sku",
"{$stockTable}.sku = {$stockTablePrimary}.sku",
[
sprintf('quantity_%s', $channel) => 'quantity'
]
);
} else {
$selectStock->joinLeft(
$stockTable,
"${stockTable}.website_id = ${stockTablePrimary}.website_id and
${stockTable}.product_id = ${stockTablePrimary}.product_id",
"{$stockTable}.website_id = {$stockTablePrimary}.website_id and
{$stockTable}.product_id = {$stockTablePrimary}.product_id",
[
sprintf('quantity_%s', $channel) => 'quantity'
]
);
}
}
$selectStock->where("${stockTablePrimary}.product_id IN (?)", $this->entityIds);
$selectStock->where("{$stockTablePrimary}.product_id IN (?)", $this->entityIds);
return $this->resource->getConnection()->fetchAll($selectStock);
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "datatrics/magento2-integration",
"description": "Datatrics Connect extension for Magento 2",
"type": "magento2-module",
"version": "1.6.5",
"version": "1.6.6",
"license": [
"BSD-2-Clause"
],
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<default>
<datatrics_connect_general>
<general>
<version>v1.6.5</version>
<version>v1.6.6</version>
<enable>0</enable>
<source>Magento 2</source>
<debug>0</debug>
Expand Down
16 changes: 8 additions & 8 deletions view/adminhtml/web/template/grid/sync_status.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!-- ko if: ($col.getLabel($row()) == "Error") -->
<span class='grid-severity-major'><!-- ko i18n: 'Error' --><!-- /ko --></span>
<!-- ko if: ($col.getLabel($row()) && $col.getLabel($row()).includes("Error")) -->
<span class='grid-severity-major'><!-- ko i18n: "Error" --><!-- /ko --></span>
<!--/ko-->
<!-- ko if: ($col.getLabel($row()) == "Queued for Update") -->
<span class='grid-severity-minor'><!-- ko i18n: 'Queued for Update' --><!-- /ko --></span>
<!-- ko if: ($col.getLabel($row()) && $col.getLabel($row()).includes("Queued")) -->
<span class='grid-severity-minor'><!-- ko i18n: "Queued for Update" --><!-- /ko --></span>
<!--/ko-->
<!-- ko if: ($col.getLabel($row()) == "Synced") -->
<span class='grid-severity-notice'><!-- ko i18n: 'Synced' --><!-- /ko --></span>
<!-- ko if: ($col.getLabel($row()) && $col.getLabel($row()).includes("Synced")) -->
<span class='grid-severity-notice'><!-- ko i18n: "Synced" --><!-- /ko --></span>
<!--/ko-->
<!-- ko if: ($col.getLabel($row()) == "Failed") -->
<span class='grid-severity-critical'><!-- ko i18n: 'Failed' --><!-- /ko --></span>
<!-- ko if: ($col.getLabel($row()) &&$col.getLabel($row()).includes("Failed")) -->
<span class='grid-severity-critical'><!-- ko i18n: "Failed" --><!-- /ko --></span>
<!--/ko-->

0 comments on commit b5e2e1a

Please sign in to comment.