Skip to content

Commit

Permalink
Merge pull request #178 from magento-troll/bugfix-GA
Browse files Browse the repository at this point in the history
[Troll & Dragons] Bugfixes
  • Loading branch information
Ganin, Roman(rganin) committed Nov 13, 2015
2 parents 8041c32 + b8a22ae commit ca97943
Show file tree
Hide file tree
Showing 34 changed files with 180 additions and 233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,7 @@ protected function _saveStockItem()
$row['product_id'] = $this->skuProcessor->getNewSku($rowData[self::COL_SKU])['entity_id'];
$productIdsToReindex[] = $row['product_id'];

$row['website_id'] = $this->stockConfiguration->getDefaultWebsiteId();
$row['website_id'] = $this->stockConfiguration->getDefaultScopeId();
$row['stock_id'] = $this->stockRegistry->getStock($row['website_id'])->getStockId();

$stockItemDo = $this->stockRegistry->getStockItem($row['product_id'], $row['website_id']);
Expand Down
17 changes: 0 additions & 17 deletions app/code/Magento/CatalogInventory/Api/Data/StockInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ interface StockInterface extends ExtensibleDataInterface
{
const STOCK_ID = 'stock_id';

const WEBSITE_ID = 'website_id';

const STOCK_NAME = 'stock_name';

/**
Expand All @@ -34,21 +32,6 @@ public function getStockId();
*/
public function setStockId($stockId);

/**
* Retrieve website identifier
*
* @return int
*/
public function getWebsiteId();

/**
* Retrieve website identifier
*
* @param int $websiteId
* @return $this
*/
public function setWebsiteId($websiteId);

/**
* Retrieve stock name
*
Expand Down
16 changes: 0 additions & 16 deletions app/code/Magento/CatalogInventory/Api/Data/StockItemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ interface StockItemInterface extends ExtensibleDataInterface

const ITEM_ID = 'item_id';
const PRODUCT_ID = 'product_id';
const WEBSITE_ID = 'website_id';
const STOCK_ID = 'stock_id';
const QTY = 'qty';
const IS_QTY_DECIMAL = 'is_qty_decimal';
Expand Down Expand Up @@ -77,21 +76,6 @@ public function getProductId();
*/
public function setProductId($productId);

/**
* Retrieve Website Id
*
* @return int|null
*/
public function getWebsiteId();

/**
* Set Website Id
*
* @param int $websiteId
* @return $this
*/
public function setWebsiteId($websiteId);

/**
* Retrieve stock identifier
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ interface StockStatusInterface extends ExtensibleDataInterface
* Stock status object data keys
*/
const PRODUCT_ID = 'product_id';
const WEBSITE_ID = 'website_id';
const STOCK_ID = 'stock_id';
const QTY = 'qty';
const STOCK_STATUS = 'stock_status';
Expand All @@ -36,17 +35,6 @@ public function getProductId();
*/
public function setProductId($productId);

/**
* @return int
*/
public function getWebsiteId();

/**
* @param int $websiteId
* @return $this
*/
public function setWebsiteId($websiteId);

/**
* @return int
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
interface StockConfigurationInterface
{
/**
* Retrieve Default Website ID
* Retrieve Default Scope ID
*
* @return int
*/
public function getDefaultWebsiteId();
public function getDefaultScopeId();

/**
* @param int $filter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ interface StockCriteriaInterface extends \Magento\Framework\Api\CriteriaInterfac
public function addCriteria(\Magento\CatalogInventory\Api\StockCriteriaInterface $criteria);

/**
* Add website filter to collection
* Add scope filter to collection
*
* @param int $website
* @param int $scope
* @return bool
*/
public function setWebsiteFilter($website);
public function setScopeFilter($scope);
}
6 changes: 3 additions & 3 deletions app/code/Magento/CatalogInventory/Api/StockIndexInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
interface StockIndexInterface
{
/**
* Rebuild stock index of the given website
* Rebuild stock index of the given scope
*
* @param int $productId
* @param int $websiteId
* @param int $scopeId
* @return bool
*/
public function rebuild($productId = null, $websiteId = null);
public function rebuild($productId = null, $scopeId = null);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public function setStockStatus($storeId = null);
public function setStockFilter($stock);

/**
* Add website filter to collection
* Add scope filter to collection
*
* @param int $website
* @param int $scope
* @return bool
*/
public function setWebsiteFilter($website);
public function setScopeFilter($scope);

/**
* Add product filter to collection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ interface StockManagementInterface
*
* @param int $productId
* @param float $qty
* @param int $websiteId
* @param int $scopeId
* @return bool
*/
public function backItemQty($productId, $qty, $websiteId = null);
public function backItemQty($productId, $qty, $scopeId = null);
}
32 changes: 16 additions & 16 deletions app/code/Magento/CatalogInventory/Api/StockRegistryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,68 +12,68 @@
interface StockRegistryInterface
{
/**
* @param int $websiteId
* @param int $scopeId
* @return \Magento\CatalogInventory\Api\Data\StockInterface
*/
public function getStock($websiteId = null);
public function getStock($scopeId = null);

/**
* @param int $productId
* @param int $websiteId
* @param int $scopeId
* @return \Magento\CatalogInventory\Api\Data\StockItemInterface
*/
public function getStockItem($productId, $websiteId = null);
public function getStockItem($productId, $scopeId = null);

/**
* @param string $productSku
* @param int $websiteId
* @param int $scopeId
* @return \Magento\CatalogInventory\Api\Data\StockItemInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getStockItemBySku($productSku, $websiteId = null);
public function getStockItemBySku($productSku, $scopeId = null);

/**
* @param int $productId
* @param int $websiteId
* @param int $scopeId
* @return \Magento\CatalogInventory\Api\Data\StockStatusInterface
*/
public function getStockStatus($productId, $websiteId = null);
public function getStockStatus($productId, $scopeId = null);

/**
* @param string $productSku
* @param int $websiteId
* @param int $scopeId
* @return \Magento\CatalogInventory\Api\Data\StockStatusInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getStockStatusBySku($productSku, $websiteId = null);
public function getStockStatusBySku($productSku, $scopeId = null);

/**
* Retrieve Product stock status
*
* @param int $productId
* @param int $websiteId
* @param int $scopeId
* @return int
*/
public function getProductStockStatus($productId, $websiteId = null);
public function getProductStockStatus($productId, $scopeId = null);

/**
* @param string $productSku
* @param int $websiteId
* @param int $scopeId
* @return int
* @throw \Magento\Framework\Exception\NoSuchEntityException
*/
public function getProductStockStatusBySku($productSku, $websiteId = null);
public function getProductStockStatusBySku($productSku, $scopeId = null);

/**
* Retrieves a list of SKU's with low inventory qty
*
* @param int $websiteId
* @param int $scopeId
* @param float $qty
* @param int $currentPage
* @param int $pageSize
* @return \Magento\CatalogInventory\Api\Data\StockStatusCollectionInterface
*/
public function getLowStockItems($websiteId, $qty, $currentPage = 1, $pageSize = 0);
public function getLowStockItems($scopeId, $qty, $currentPage = 1, $pageSize = 0);

/**
* @param string $productSku
Expand Down
24 changes: 12 additions & 12 deletions app/code/Magento/CatalogInventory/Api/StockStateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,56 @@ interface StockStateInterface
{
/**
* @param int $productId
* @param int $websiteId
* @param int $scopeId
* @return bool
*/
public function verifyStock($productId, $websiteId = null);
public function verifyStock($productId, $scopeId = null);

/**
* @param int $productId
* @param int $websiteId
* @param int $scopeId
* @return bool
*/
public function verifyNotification($productId, $websiteId = null);
public function verifyNotification($productId, $scopeId = null);

/**
* @param int $productId
* @param float $itemQty
* @param float $qtyToCheck
* @param float $origQty
* @param int $websiteId
* @param int $scopeId
* @return int
*/
public function checkQuoteItemQty($productId, $itemQty, $qtyToCheck, $origQty, $websiteId = null);
public function checkQuoteItemQty($productId, $itemQty, $qtyToCheck, $origQty, $scopeId = null);

/**
* Check quantity
*
* @param int $productId
* @param float $qty
* @param int $websiteId
* @param int $scopeId
* @throws \Magento\Framework\Exception\LocalizedException
* @return bool
*/
public function checkQty($productId, $qty, $websiteId = null);
public function checkQty($productId, $qty, $scopeId = null);

/**
* Returns suggested qty that satisfies qty increments and minQty/maxQty/minSaleQty/maxSaleQty conditions
* or original qty if such value does not exist
*
* @param int $productId
* @param float $qty
* @param int $websiteId
* @param int $scopeId
* @return float
*/
public function suggestQty($productId, $qty, $websiteId = null);
public function suggestQty($productId, $qty, $scopeId = null);

/**
* Retrieve stock qty whether product is composite or no
*
* @param int $productId
* @param int $websiteId
* @param int $scopeId
* @return float
*/
public function getStockQty($productId, $websiteId = null);
public function getStockQty($productId, $scopeId = null);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ interface StockStatusCriteriaInterface extends \Magento\Framework\Api\CriteriaIn
public function addCriteria(\Magento\CatalogInventory\Api\StockStatusCriteriaInterface $criteria);

/**
* Filter by website(s)
* Filter by scope(s)
*
* @param int $website
* @param int $scope
* @return bool
*/
public function setWebsiteFilter($website);
public function setScopeFilter($scope);

/**
* Add product(s) filter
Expand Down
6 changes: 2 additions & 4 deletions app/code/Magento/CatalogInventory/Model/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,9 @@ public function __construct(
}

/**
* Retrieve Default Website ID
*
* @return int
* {@inheritdoc}
*/
public function getDefaultWebsiteId()
public function getDefaultScopeId()
{
return (int) $this->storeManager->getWebsite()->getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function setStockFilter($stock)
/**
* @inheritdoc
*/
public function setWebsiteFilter($website)
public function setScopeFilter($scope)
{
$this->data['website_filter'] = $website;
$this->data['website_filter'] = $scope;
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public function __construct($mapper = '')
/**
* @inheritdoc
*/
public function setWebsiteFilter($website)
public function setScopeFilter($scope)
{
$this->data['website_filter'] = $website;
$this->data['website_filter'] = $scope;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public function __construct($mapper = '')
/**
* @inheritdoc
*/
public function setWebsiteFilter($website)
public function setScopeFilter($scope)
{
$this->data['website_filter'] = $website;
$this->data['website_filter'] = $scope;
return true;
}

Expand Down
Loading

0 comments on commit ca97943

Please sign in to comment.