-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bool scope config and update throws and update use clases #18065
Merged
magento-engcom-team
merged 14 commits into
magento:2.3-develop
from
hryvinskyi:fix-bool-scope-config
Oct 16, 2018
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c0a2ad1
Fix bool scope config and update throws and update use clases
hryvinskyi 7674152
Fix Tests
hryvinskyi 4f849dc
Merge branch '2.3-develop' into fix-bool-scope-config
hryvinskyi 7782252
update variable name
hryvinskyi 8ed0215
update variable name
hryvinskyi ace0bc5
update variable name
hryvinskyi 25b15e5
Update Tests
hryvinskyi 493239c
Update Tests
hryvinskyi efad97e
Fix methods descriptions
hryvinskyi c2db6bf
Fixed
hryvinskyi 75eb9b1
Fixed
hryvinskyi c2fd8e9
Fix test
hryvinskyi dbf7196
Merge branch '2.3-develop' into fix-bool-scope-config
hryvinskyi 6ed47bb
fix test
hryvinskyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
use Magento\CatalogInventory\Helper\Minsaleqty as MinsaleqtyHelper; | ||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Catalog\Model\ProductTypes\ConfigInterface; | ||
use Magento\Store\Model\ScopeInterface; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
|
||
/** | ||
|
@@ -131,6 +132,8 @@ class Configuration implements StockConfigurationInterface | |
protected $storeManager; | ||
|
||
/** | ||
* Configuration constructor. | ||
* | ||
* @param ConfigInterface $config | ||
* @param ScopeConfigInterface $scopeConfig | ||
* @param MinsaleqtyHelper $minsaleqtyHelper | ||
|
@@ -149,7 +152,9 @@ public function __construct( | |
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* Default Scope Id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert the comment and just remove curly braces |
||
* | ||
* @return int | ||
*/ | ||
public function getDefaultScopeId() | ||
{ | ||
|
@@ -159,6 +164,8 @@ public function getDefaultScopeId() | |
} | ||
|
||
/** | ||
* Is Qty Type Ids | ||
* | ||
* @param int|null $filter | ||
* @return array | ||
*/ | ||
|
@@ -182,6 +189,8 @@ public function getIsQtyTypeIds($filter = null) | |
} | ||
|
||
/** | ||
* Is Qty | ||
* | ||
* @param int $productTypeId | ||
* @return bool | ||
*/ | ||
|
@@ -201,25 +210,29 @@ public function canSubtractQty($store = null) | |
{ | ||
return $this->scopeConfig->isSetFlag( | ||
self::XML_PATH_CAN_SUBTRACT, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
||
/** | ||
* Get Min Qty | ||
* | ||
* @param null|string|bool|int|\Magento\Store\Model\Store $store | ||
* @return float | ||
*/ | ||
public function getMinQty($store = null) | ||
{ | ||
return (float)$this->scopeConfig->getValue( | ||
self::XML_PATH_MIN_QTY, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
||
/** | ||
* Get Min Sale Qty | ||
* | ||
* @param null|string|bool|int|\Magento\Store\Model\Store $store | ||
* @param int $customerGroupId | ||
* @return float | ||
|
@@ -230,27 +243,31 @@ public function getMinSaleQty($store = null, $customerGroupId = null) | |
} | ||
|
||
/** | ||
* Get Max Sale Qty | ||
* | ||
* @param null|string|bool|int|\Magento\Store\Model\Store $store | ||
* @return float|null | ||
*/ | ||
public function getMaxSaleQty($store = null) | ||
{ | ||
return (float)$this->scopeConfig->getValue( | ||
self::XML_PATH_MAX_SALE_QTY, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
||
/** | ||
* Get Notify Stock Qty | ||
* | ||
* @param null|string|bool|int|\Magento\Store\Model\Store $store | ||
* @return float | ||
*/ | ||
public function getNotifyStockQty($store = null) | ||
{ | ||
return (float) $this->scopeConfig->getValue( | ||
self::XML_PATH_NOTIFY_STOCK_QTY, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
@@ -264,22 +281,24 @@ public function getNotifyStockQty($store = null) | |
*/ | ||
public function getEnableQtyIncrements($store = null) | ||
{ | ||
return (bool) $this->scopeConfig->getValue( | ||
return $this->scopeConfig->isSetFlag( | ||
self::XML_PATH_ENABLE_QTY_INCREMENTS, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
||
/** | ||
* Get Qty Increments | ||
* | ||
* @param null|string|bool|int|\Magento\Store\Model\Store $store | ||
* @return float | ||
*/ | ||
public function getQtyIncrements($store = null) | ||
{ | ||
return (float)$this->scopeConfig->getValue( | ||
self::XML_PATH_QTY_INCREMENTS, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
@@ -294,7 +313,7 @@ public function getBackorders($store = null) | |
{ | ||
return (int) $this->scopeConfig->getValue( | ||
self::XML_PATH_BACKORDERS, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
@@ -309,7 +328,7 @@ public function getManageStock($store = null) | |
{ | ||
return (int) $this->scopeConfig->isSetFlag( | ||
self::XML_PATH_MANAGE_STOCK, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
@@ -325,7 +344,7 @@ public function getCanBackInStock($store = null) | |
{ | ||
return $this->scopeConfig->isSetFlag( | ||
self::XML_PATH_CAN_BACK_IN_STOCK, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
@@ -340,7 +359,7 @@ public function isShowOutOfStock($store = null) | |
{ | ||
return $this->scopeConfig->isSetFlag( | ||
self::XML_PATH_SHOW_OUT_OF_STOCK, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
@@ -355,14 +374,13 @@ public function isAutoReturnEnabled($store = null) | |
{ | ||
return $this->scopeConfig->isSetFlag( | ||
self::XML_PATH_ITEM_AUTO_RETURN, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
||
/** | ||
* Get 'Display product stock status' option value | ||
* Shows if it is necessary to show product stock status ('in stock'/'out of stock') | ||
* Display product stock status. Shows if it is necessary to show product stock status in stock/out of stock. | ||
* | ||
* @param null|string|bool|int|\Magento\Store\Model\Store $store | ||
* @return bool | ||
|
@@ -371,12 +389,14 @@ public function isDisplayProductStockStatus($store = null) | |
{ | ||
return $this->scopeConfig->isSetFlag( | ||
self::XML_PATH_DISPLAY_PRODUCT_STOCK_STATUS, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
||
/** | ||
* Get Default Config Value | ||
* | ||
* @param string $field | ||
* @param null|string|bool|int|\Magento\Store\Model\Store $store | ||
* @return string|null | ||
|
@@ -385,20 +405,22 @@ public function getDefaultConfigValue($field, $store = null) | |
{ | ||
return $this->scopeConfig->getValue( | ||
self::XML_PATH_ITEM . $field, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
||
/** | ||
* Get Stock Threshold Qty | ||
* | ||
* @param null|string|bool|int|\Magento\Store\Model\Store $store | ||
* @return string|null | ||
*/ | ||
public function getStockThresholdQty($store = null) | ||
{ | ||
return $this->scopeConfig->getValue( | ||
self::XML_PATH_STOCK_THRESHOLD_QTY, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE, | ||
ScopeInterface::SCOPE_STORE, | ||
$store | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the comment and just remove curly braces
{}
. Please refer to the guide https://devdocs.magento.com/guides/v2.3/coding-standards/docblock-standard-general.html#inheritdoc