Skip to content

Commit

Permalink
Merged in FS-462-verify-module-compatibility-mag247 (pull request #118)
Browse files Browse the repository at this point in the history
FS-462 verify module compatibility mag247

Approved-by: Adrien Chauvin
Approved-by: Guillaume THOMAS
  • Loading branch information
michaelmaslengow authored and AdrienChvnLgw committed Jun 6, 2023
2 parents 3112367 + ef9fe33 commit de87bec
Show file tree
Hide file tree
Showing 12 changed files with 384 additions and 371 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
=============================================================
Version 1.4.4
=============================================================

- BugFix: [Import] Get email for send notification from module when value is null
- BugFix: [Import] Use Lamina_validator instead Send_validator for email validation
- BugFix: [Import] Unblocking import of customer address in orders
- BugFix: [Import] Fix error when importing orders caused by the CollectionFactory class by use array instead
- BugFix: [Import] Fix errors data is null when using the character replacement function
- BugFix: [Export] Fix error when user save catalog linked to CMS in first connexion
- BugFix: [Export] Use ProductInterface instead of ProductInterceptor

=============================================================
Version 1.4.3
=============================================================
Expand Down
7 changes: 4 additions & 3 deletions Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use Magento\Store\Model\ResourceModel\Store\Collection as StoreCollection;
use Magento\Store\Model\ResourceModel\Store\CollectionFactory as StoreCollectionFactory;
use Magento\InventoryApi\Api\SourceRepositoryInterface;
use Laminas\Validator\EmailAddress;

class Config extends AbstractHelper
{
Expand Down Expand Up @@ -1048,11 +1049,11 @@ public function getReportEmailAddress(): array
{
$reportEmailAddress = [];
$emails = $this->get(self::REPORT_MAILS);
$emails = trim(str_replace(["\r\n", ',', ' '], ';', $emails), ';');
$emails = trim(str_replace(["\r\n", ',', ' '], ';', $emails ?? ''), ';');
$emails = explode(';', $emails);
foreach ($emails as $email) {
try {
if ($email !== '' && \Zend_Validate::is($email, 'EmailAddress')) {
if ($email !== '' && (new EmailAddress())->isValid($email)) {
$reportEmailAddress[] = $email;
}
} catch (Exception $e) {
Expand Down Expand Up @@ -1156,7 +1157,7 @@ private function getValueWithCorrectType(string $key, string $value = null)
case self::RETURN_TYPE_ARRAY:
return !empty($value)
? explode(';', trim(str_replace(["\r\n", ',', ' '], ';', $value), ';'))
: array();
: [];
}
}
return $value;
Expand Down
4 changes: 2 additions & 2 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,6 @@ public function replaceAccentedChars(string $str = null): string
'YU',
'ZH',
];
return preg_replace($patterns, $replacements, $str);
return preg_replace($patterns, $replacements, $str ?? '');
}
}
}
4 changes: 3 additions & 1 deletion Model/Catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ public function saveCatalogsLinked(array $catalogSelected = []): bool
$catalogsLinked = true;
$catalogsByStores = [];
foreach ($catalogSelected as $catalog) {
$catalogsByStores[$catalog['shopId']] = $catalog['catalogId'];
if (isset($catalog['shopId']) && isset($catalog['catalogId'])) {
$catalogsByStores[$catalog['shopId']] = $catalog['catalogId'];
}
}
if (!empty($catalogsByStores)) {
// save catalogs ids and active shop in lengow configuration
Expand Down
4 changes: 2 additions & 2 deletions Model/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class Connector
/**
* @var string url of Lengow solution
*/
// const LENGOW_URL = 'lengow.io';
// public const LENGOW_URL = 'lengow.io';
public const LENGOW_URL = 'lengow.net';

/**
* @var string url of the Lengow API
*/
// const LENGOW_API_URL = 'https://api.lengow.io';
// private const LENGOW_API_URL = 'https://api.lengow.io';
private const LENGOW_API_URL = 'https://api.lengow.net';

/* Lengow API routes */
Expand Down
18 changes: 9 additions & 9 deletions Model/Export/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Exception;
use Magento\Framework\App\ObjectManager;
use Magento\GroupedProduct\Model\Product\Type\Grouped;
use Magento\Catalog\Model\Product\Interceptor as ProductInterceptor;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Store\Model\Store\Interceptor as StoreInterceptor;
use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus;
use Magento\Catalog\Model\Product\Visibility as ProductVisibility;
Expand Down Expand Up @@ -102,12 +102,12 @@ class Product
private $shipping;

/**
* @var ProductInterceptor Magento product instance
* @var ProductInterface Magento product instance
*/
private $product;

/**
* @var ProductInterceptor Magento product instance
* @var ProductInterface Magento product instance
*/
private $parentProduct;

Expand Down Expand Up @@ -542,11 +542,11 @@ private function setCounter(): void
* @param integer $productId Magento product is
* @param boolean $forceReload force reload for product repository
*
* @return ProductInterceptor|null
* @return ProductInterface|null
*
* @throws Exception
*/
private function getProduct(int $productId, bool $forceReload = false): ?ProductInterceptor
private function getProduct(int $productId, bool $forceReload = false): ?ProductInterface
{
if ($this->type === Configurable::TYPE_CODE) {
$product = $this->getConfigurableProduct($productId);
Expand All @@ -559,11 +559,11 @@ private function getProduct(int $productId, bool $forceReload = false): ?Product
/**
* Get parent product for simple product
*
* @return ProductInterceptor|null
* @return ProductInterface|null
*
* @throws Exception
*/
private function getParentProduct(): ?ProductInterceptor
private function getParentProduct(): ?ProductInterface
{
$parentProduct = null;
if ($this->type === 'simple') {
Expand All @@ -585,11 +585,11 @@ private function getParentProduct(): ?ProductInterceptor
*
* @param integer $parentId Magento parent entity id
*
* @return ProductInterceptor|null
* @return ProductInterface|null
*
* @throws Exception
*/
protected function getConfigurableProduct(int $parentId): ?ProductInterceptor
protected function getConfigurableProduct(int $parentId): ?ProductInterface
{
if (!isset($this->cacheConfigurableProducts[$parentId])) {
if ($this->clearCacheConfigurable > 300) {
Expand Down
6 changes: 3 additions & 3 deletions Model/Import/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,9 @@ private function splitNames(string $fullName): array
*/
private function getAddressStreet($addressData, bool $isShippingAddress = false): string
{
$street = trim($addressData->first_line);
$secondLine = trim($addressData->second_line);
$complement = trim($addressData->complement);
$street = trim((string)$addressData->first_line);
$secondLine = trim((string)$addressData->second_line);
$complement = trim((string)$addressData->complement);
if (empty($street)) {
if (!empty($secondLine)) {
$street = $secondLine;
Expand Down
8 changes: 3 additions & 5 deletions Plugin/RulesApplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Magento\Quote\Model\Quote\Item\AbstractItem;
use Magento\SalesRule\Model\RulesApplier as RulesApplierModel;
use Magento\SalesRule\Model\ResourceModel\Rule\CollectionFactory as RuleCollectionFactory;
use Magento\SalesRule\Model\ResourceModel\Rule\Collection as RuleCollection;

/*
* Class RulesApplier
Expand Down Expand Up @@ -62,7 +61,7 @@ public function __construct(
* @param RulesApplierModel $subject Magento RulesApplier base class
* @param Closure $proceed Callable (have to be called otherwise magento prevent the execution of the next plugins)
* @param AbstractItem $item Magento Abstract Item representing a Quote
* @param RuleCollection $rules Magento RuleCollection assigned to the Quote
* @param array $rules Magento Rule Collection assigned to the Quote
* @param bool $skipValidation Magento option to skip rule validation
* @param mixed $couponCode Magento Coupon Code
*
Expand All @@ -72,13 +71,12 @@ public function aroundApplyRules(
RulesApplierModel $subject,
Closure $proceed,
AbstractItem $item,
RuleCollection $rules,
array $rules,
bool $skipValidation,
$couponCode
) {
if ($this->backendSession->getIsFromlengow()) {
$nRules = $this->ruleFactory->create()->addFieldToFilter('rule_id', ['eq' => 0]);
return $proceed($item, $nRules, $skipValidation, $couponCode);
$rules = $this->ruleFactory->create()->addFieldToFilter('rule_id', ['eq' => 0]);
}
return $proceed($item, $rules, $skipValidation, $couponCode);
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Lengow for Magento 2

- **Requires at least:** 2.4
- **Tested up to:** 2.4
- **Tested up to:** 2.4.6
- **Requires PHP:** 8.1
- **Stable tag:** 1.4.3
- **Stable tag:** 1.4.4
- **License:** OSL-3.0
- **License URI:** https://opensource.org/licenses/OSL-3.0

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": "lengow/module-connector",
"description": "Lengow allows you to easily export your product catalogue from your Shopware store and sell on Amazon, Cdiscount, Google Shopping, Criteo, LeGuide.com, Ebay, Rakuten, Priceminister. Choose from our 1,800 available marketing channels!",
"type": "magento2-module",
"version": "1.4.3",
"version": "1.4.4",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
Loading

0 comments on commit de87bec

Please sign in to comment.