Skip to content

Commit

Permalink
Merge pull request #145 from magmodules/release/1.6.2
Browse files Browse the repository at this point in the history
Release/1.6.2
  • Loading branch information
Marvin-Magmodules authored Mar 3, 2022
2 parents ca047f0 + 60536e8 commit b8da999
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 52 deletions.
4 changes: 2 additions & 2 deletions Controller/Adminhtml/Order/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
*/
class Delete extends Action
{

/**
* Authorization level
*/
const ADMIN_RESOURCE = 'Magmodules_Channable::general_orders';
const ADMIN_RESOURCE = 'Magmodules_Channable::order_delete';

/**
* @var ChannableOrderRepository
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Order/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Import extends Action
/**
* Authorization level
*/
const ADMIN_RESOURCE = 'Magmodules_Channable::general_orders';
const ADMIN_RESOURCE = 'Magmodules_Channable::order_import';

/**
* @var OrderImportService
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Order/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Index extends Action
/**
* Authorization level
*/
const ADMIN_RESOURCE = 'Magmodules_Channable::general_orders';
const ADMIN_RESOURCE = 'Magmodules_Channable::order_view';

/**
* @var PageFactory
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Order/Simulate.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Simulate extends Action
/**
* Authorization level
*/
const ADMIN_RESOURCE = 'Magmodules_Channable::general_orders';
const ADMIN_RESOURCE = 'Magmodules_Channable::order_simulate';

/**
* @var ImportSimulator
Expand Down
11 changes: 1 addition & 10 deletions Helper/Source.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -418,17 +418,8 @@ public function getProductFilters($type)
if ($visibilityFilter) {
$visibility = $this->getStoreValue(self::XPATH_VISIBILITY_OPTIONS);
$filters['visibility'] = explode(',', $visibility);
$filters['visibility_parents'] = $filters['visibility'];
} else {
$filters['visibility'] = [
Visibility::VISIBILITY_IN_CATALOG,
Visibility::VISIBILITY_IN_SEARCH,
Visibility::VISIBILITY_BOTH,
];
$filters['visibility_parents'] = $filters['visibility'];
if (!empty($filters['relations'])) {
array_push($filters['visibility'], Visibility::VISIBILITY_NOT_VISIBLE);
}
$filters['visibility'] = [];
}

$filters['limit'] = preg_replace('/\D/', '', $this->getStoreValue(self::XPATH_LIMIT));
Expand Down
4 changes: 1 addition & 3 deletions Logger/ChannableHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
use Magento\Framework\Logger\Handler\Base;

/**
* Class ChannableHandler
*
* @package Magmodules\Channable\Logger
* @deprecated
*/
class ChannableHandler extends Base
{
Expand Down
4 changes: 1 addition & 3 deletions Logger/ChannableLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
use Monolog\Logger;

/**
* Class ChannableLogger
*
* @package Magmodules\Channable\Logger
* @deprecated
*/
class ChannableLogger extends Logger
{
Expand Down
14 changes: 7 additions & 7 deletions Logger/DebugLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class DebugLogger extends Logger
/**
* DebugLogger constructor.
*
* @param Json $json
* @param Json $json
* @param string $name
* @param array $handlers
* @param array $processors
* @param array $handlers
* @param array $processors
*/
public function __construct(
Json $json,
Expand All @@ -40,17 +40,17 @@ public function __construct(
}

/**
* Add debug data to kiyoh Log
* Add debug data to Channable log
*
* @param string $type
* @param mixed $data
* @param mixed $data
*/
public function addLog(string $type, $data): void
{
if (is_array($data) || is_object($data)) {
$this->addDebug($type . ': ' . $this->json->serialize($data));
$this->addRecord(static::INFO, $type . ': ' . $this->json->serialize($data));
} else {
$this->addDebug($type . ': ' . $data);
$this->addRecord(static::INFO, $type . ': ' . $data);
}
}
}
16 changes: 7 additions & 9 deletions Logger/ErrorLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

/**
* ErrorLogger logger class
*
*/
class ErrorLogger extends Logger
{
Expand All @@ -25,10 +24,10 @@ class ErrorLogger extends Logger
/**
* ErrorLogger constructor.
*
* @param Json $json
* @param Json $json
* @param string $name
* @param array $handlers
* @param array $processors
* @param array $handlers
* @param array $processors
*/
public function __construct(
Json $json,
Expand All @@ -41,18 +40,17 @@ public function __construct(
}

/**
* Add error data to kiyoh Log
* Add error data to Channable log
*
* @param string $type
* @param mixed $data
*
* @param mixed $data
*/
public function addLog($type, $data): void
{
if (is_array($data) || is_object($data)) {
$this->addError($type . ': ' . $this->json->serialize($data));
$this->addRecord(static::ERROR, $type . ': ' . $this->json->serialize($data));
} else {
$this->addEmergency($type . ': ' . $data);
$this->addRecord(static::ERROR, $type . ': ' . $data);
}
}
}
4 changes: 2 additions & 2 deletions Model/Collection/Products.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ public function getParents($parentRelations, $config)
}
}

if (!empty($filters['visibility_parent'])) {
$collection->addAttributeToFilter('visibility', ['in' => $filters['visibility_parent']]);
if (!empty($filters['visibility'])) {
$collection->addAttributeToFilter('visibility', ['in' => $filters['visibility']]);
}

if (!empty($config['inventory']['attributes'])) {
Expand Down
9 changes: 5 additions & 4 deletions Service/Order/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ public function execute(ChannableOrderData $orderData): OrderInterface
$quote->setTotals($totals);
$quote->collectTotals();
$quote->setTotalsCollectedFlag(false)->collectTotals();

if ($customIncrementId = $this->getCustomIncrementId->execute($orderData, $store)) {
$quote->setReservedOrderId($customIncrementId);
}

$quote->save();

if ($lvbOrder && $this->configProvider->disableStockMovementForLvbOrders((int)$store->getId())) {
Expand All @@ -236,10 +241,6 @@ public function execute(ChannableOrderData $orderData): OrderInterface
}
$store->setCurrentCurrencyCode($store->getBaseCurrencyCode());

if ($customIncrementId = $this->getCustomIncrementId->execute($orderData, $store)) {
$order->setIncrementId($customIncrementId);
}

if ($shippingDescription = $this->getShippingDescription->execute($order, $orderData)) {
$order->setShippingDescription($shippingDescription);
}
Expand Down
2 changes: 1 addition & 1 deletion Service/Order/Shipping/CalculatePrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(
public function execute(Quote $quote, array $orderData, StoreInterface $store): float
{
$taxCalculation = $this->configProvider->getNeedsTaxCalulcation('shipping', (int)$store->getId());
$shippingPriceCal = $orderData['price']['shipping'];
$shippingPriceCal = (float) $orderData['price']['shipping'];

if (empty($taxCalculation)) {
$shippingAddress = $quote->getShippingAddress();
Expand Down
3 changes: 3 additions & 0 deletions Service/Order/Shipping/GetMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public function execute(Quote $quote, StoreInterface $store, int $itemCount, flo
$request->setLimitCarrier('');
$request->setBaseSubtotalInclTax($total);
$request->setFreeShipping($shippingPriceCal <= 0);
if (!empty($quote->getShippingAddress()->getWeight())) {
$request->setPackageWeight($quote->getShippingAddress()->getWeight());
}

$shipping = $this->shippingFactory->create();
$result = $shipping->collectRates($request)->getResult();
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": "magmodules/magento2-channable",
"description": "Channable integration for Magento 2",
"type": "magento2-module",
"version": "1.6.1",
"version": "1.6.2",
"license": "BSD-2-Clause",
"homepage": "https://github.com/magmodules/magento2-channable",
"require": {
Expand Down
10 changes: 8 additions & 2 deletions etc/acl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magmodules_Channable::general" title="Channable" sortOrder="50">
<resource id="Magmodules_Channable::general_orders" title="Processed orders" sortOrder="100"/>
<resource id="Magmodules_Channable::general_orders" title="Processed orders" sortOrder="100">
<resource id="Magmodules_Channable::order_view" title="Order View" sortOrder="100"/>
<resource id="Magmodules_Channable::order_import" title="Order Import" sortOrder="110"/>
<resource id="Magmodules_Channable::order_delete" title="Order Delete" sortOrder="130"/>
</resource>
<resource id="Magmodules_Channable::general_item" title="Item Updates" sortOrder="110"/>
<resource id="Magmodules_Channable::general_returns" title="Returns" sortOrder="120"/>
</resource>
Expand All @@ -19,7 +23,9 @@
<resource id="Magento_Config::config">
<resource id="Magmodules_Channable::feed" title="Channable Feed Config" sortOrder="100"/>
<resource id="Magmodules_Channable::marketplace" title="Channable Marketplace Config" sortOrder="110"/>
<resource id="Magmodules_Channable::config_order" title="Channable Order Config" sortOrder="120"/>
<resource id="Magmodules_Channable::config_order" title="Channable Order Config" sortOrder="120">
<resource id="Magmodules_Channable::order_simulate" title="Order Simulate" sortOrder="100"/>
</resource>
</resource>
</resource>
</resource>
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<general>
<enable>0</enable>
<limit>250</limit>
<version>v1.6.1</version>
<version>v1.6.2</version>
</general>
<data>
<name_attribute>name</name_attribute>
Expand Down
14 changes: 10 additions & 4 deletions view/adminhtml/ui_component/channable_order_grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,22 @@
<visible>false</visible>
</settings>
</column>
<column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date">
<column name="created_at"
class="Magento\Ui\Component\Listing\Columns\Date"
component="Magento_Ui/js/grid/columns/date">
<settings>
<filter>text</filter>
<filter>dateRange</filter>
<dataType>date</dataType>
<sorting>desc</sorting>
<label translate="true">Created At</label>
</settings>
</column>
<column name="updated_at" class="Magento\Ui\Component\Listing\Columns\Date">
<column name="updated_at"
class="Magento\Ui\Component\Listing\Columns\Date"
component="Magento_Ui/js/grid/columns/date">
<settings>
<filter>text</filter>
<filter>dateRange</filter>
<dataType>date</dataType>
<sorting>desc</sorting>
<label translate="true">Updated At</label>
</settings>
Expand Down

0 comments on commit b8da999

Please sign in to comment.