Skip to content

Commit d33f01d

Browse files
committed
Merge pull request #36 from magento-troll/develop
[Troll] Bugfixes
2 parents 9f21d21 + 3eef4fc commit d33f01d

File tree

16 files changed

+306
-76
lines changed

16 files changed

+306
-76
lines changed

app/code/Magento/Catalog/Block/Rss/Product/Special.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ class Special extends \Magento\Framework\View\Element\AbstractBlock implements D
5454
*/
5555
protected $msrpHelper;
5656

57+
/**
58+
* @var \Magento\Framework\Stdlib\DateTime\DateFactory
59+
*/
60+
private $dateFactory;
61+
62+
/**
63+
* @var \Magento\Framework\Locale\ResolverInterface
64+
*/
65+
private $localeResolver;
66+
5767
/**
5868
* @param \Magento\Framework\View\Element\Template\Context $context
5969
* @param \Magento\Framework\App\Http\Context $httpContext
@@ -63,6 +73,8 @@ class Special extends \Magento\Framework\View\Element\AbstractBlock implements D
6373
* @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency
6474
* @param \Magento\Catalog\Model\Rss\Product\Special $rssModel
6575
* @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
76+
* @param \Magento\Framework\Stdlib\DateTime\DateFactory $dateFactory
77+
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
6678
* @param array $data
6779
*/
6880
public function __construct(
@@ -74,6 +86,8 @@ public function __construct(
7486
\Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency,
7587
\Magento\Catalog\Model\Rss\Product\Special $rssModel,
7688
\Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder,
89+
\Magento\Framework\Stdlib\DateTime\DateFactory $dateFactory,
90+
\Magento\Framework\Locale\ResolverInterface $localeResolver,
7791
array $data = []
7892
) {
7993
$this->outputHelper = $outputHelper;
@@ -85,6 +99,8 @@ public function __construct(
8599
$this->httpContext = $httpContext;
86100
$this->storeManager = $context->getStoreManager();
87101
parent::__construct($context, $data);
102+
$this->dateFactory = $dateFactory;
103+
$this->localeResolver = $localeResolver;
88104
}
89105

90106
/**
@@ -167,7 +183,13 @@ protected function getEntryData(\Magento\Catalog\Model\Product $item)
167183
$special = '';
168184
if ($item->getUseSpecial()) {
169185
$special = '<br />' . __('Special Expires On: %1', $this->formatDate(
170-
$item->getSpecialToDate(),
186+
$this->dateFactory->create(
187+
[
188+
'date' => $item->getSpecialToDate(),
189+
'part' => \Magento\Framework\Stdlib\DateTime\Date::ISO_8601,
190+
'locale' => $this->localeResolver->getLocaleCode()
191+
]
192+
),
171193
\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM
172194
));
173195
}

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
385385
protected $stockConfiguration;
386386

387387
/**
388-
* @var \Magento\CatalogInventory\Api\StockStateInterface
388+
* @var \Magento\CatalogInventory\Model\Spi\StockStateProviderInterface
389389
*/
390-
protected $stockState;
390+
protected $stockStateProvider;
391391

392392
/**
393393
* Core event manager proxy
@@ -502,7 +502,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
502502
* @param \Magento\Framework\Event\ManagerInterface $eventManager
503503
* @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
504504
* @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration
505-
* @param \Magento\CatalogInventory\Api\StockStateInterface $stockState
505+
* @param \Magento\CatalogInventory\Model\Spi\StockStateProviderInterface $stockStateProvider
506506
* @param \Magento\Catalog\Helper\Data $catalogData
507507
* @param \Magento\ImportExport\Model\Import\Config $importConfig
508508
* @param Proxy\Product\ResourceFactory $resourceFactory
@@ -537,7 +537,7 @@ public function __construct(
537537
\Magento\Framework\Event\ManagerInterface $eventManager,
538538
\Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
539539
\Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration,
540-
\Magento\CatalogInventory\Api\StockStateInterface $stockState,
540+
\Magento\CatalogInventory\Model\Spi\StockStateProviderInterface $stockStateProvider,
541541
\Magento\Catalog\Helper\Data $catalogData,
542542
\Magento\ImportExport\Model\Import\Config $importConfig,
543543
\Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceFactory $resourceFactory,
@@ -563,7 +563,7 @@ public function __construct(
563563
$this->_eventManager = $eventManager;
564564
$this->stockRegistry = $stockRegistry;
565565
$this->stockConfiguration = $stockConfiguration;
566-
$this->stockState = $stockState;
566+
$this->stockStateProvider = $stockStateProvider;
567567
$this->_catalogData = $catalogData;
568568
$this->_importConfig = $importConfig;
569569
$this->_resourceFactory = $resourceFactory;
@@ -1801,12 +1801,14 @@ protected function _saveStockItem()
18011801
);
18021802

18031803
if ($this->stockConfiguration->isQty($this->_newSku[$rowData[self::COL_SKU]]['type_id'])) {
1804-
$row['is_in_stock'] = $this->stockState->verifyStock($row['product_id'], $row['website_id']);
1805-
if ($this->stockState->verifyNotification($row['product_id'], $row['website_id'])) {
1804+
$stockItemDo->setData($row);
1805+
$row['is_in_stock'] = $this->stockStateProvider->verifyStock($stockItemDo);
1806+
if ($this->stockStateProvider->verifyNotification($stockItemDo)) {
18061807
$row['low_stock_date'] = $this->_localeDate->date(null, null, null, false)
18071808
->toString(\Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT);
18081809
}
1809-
$row['stock_status_changed_auto'] = (int) !$this->stockState->verifyStock($row['product_id'], $row['website_id']);
1810+
$row['stock_status_changed_auto'] =
1811+
(int) !$this->stockStateProvider->verifyStock($stockItemDo);
18101812
} else {
18111813
$row['qty'] = 0;
18121814
}

app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ public function execute()
6363
$resultBlock->addAction(
6464
'show',
6565
'import_validation_container'
66-
)->addAction(
67-
'clear',
68-
[
69-
\Magento\ImportExport\Model\Import::FIELD_NAME_SOURCE_FILE,
70-
\Magento\ImportExport\Model\Import::FIELD_NAME_IMG_ARCHIVE_FILE
71-
]
7266
);
7367

7468
try {

app/code/Magento/ImportExport/Model/Export/AbstractEntity.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
*/
66
namespace Magento\ImportExport\Model\Export;
77

8+
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
89
use Magento\ImportExport\Model\Export\Adapter\AbstractAdapter;
10+
use Magento\ImportExport\Model\Export;
911

1012
/**
1113
* Export entity abstract model
@@ -154,6 +156,20 @@ abstract class AbstractEntity
154156
*/
155157
protected $_scopeConfig;
156158

159+
/**
160+
* Attribute code to its values. Only attributes with options and only default store values used
161+
*
162+
* @var array
163+
*/
164+
protected $_attributeCodes = null;
165+
166+
/**
167+
* Permanent entity columns
168+
*
169+
* @var string[]
170+
*/
171+
protected $_permanentAttributes = [];
172+
157173
/**
158174
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
159175
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
@@ -276,6 +292,38 @@ protected function _exportCollectionByPages(\Magento\Framework\Data\Collection\D
276292
$this->_byPagesIterator->iterate($collection, $this->_pageSize, [[$this, 'exportItem']]);
277293
}
278294

295+
/**
296+
* Get attributes codes which are appropriate for export
297+
*
298+
* @return array
299+
*/
300+
protected function _getExportAttributeCodes()
301+
{
302+
if (null === $this->_attributeCodes) {
303+
if (!empty($this->_parameters[Export::FILTER_ELEMENT_SKIP])
304+
&& is_array($this->_parameters[Export::FILTER_ELEMENT_SKIP])
305+
) {
306+
$skippedAttributes = array_flip(
307+
$this->_parameters[Export::FILTER_ELEMENT_SKIP]
308+
);
309+
} else {
310+
$skippedAttributes = [];
311+
}
312+
$attributeCodes = [];
313+
314+
/** @var $attribute AbstractAttribute */
315+
foreach ($this->filterAttributeCollection($this->getAttributeCollection()) as $attribute) {
316+
if (!isset($skippedAttributes[$attribute->getAttributeId()])
317+
|| in_array($attribute->getAttributeCode(), $this->_permanentAttributes)
318+
) {
319+
$attributeCodes[] = $attribute->getAttributeCode();
320+
}
321+
}
322+
$this->_attributeCodes = $attributeCodes;
323+
}
324+
return $this->_attributeCodes;
325+
}
326+
279327
/**
280328
* Entity type code getter
281329
*

app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Export\AbstractEn
2424
*/
2525
protected $_attributeValues = [];
2626

27-
/**
28-
* Attribute code to its values. Only attributes with options and only default store values used
29-
*
30-
* @var array
31-
*/
32-
protected $_attributeCodes = null;
33-
3427
/**
3528
* Entity type id.
3629
*
@@ -45,13 +38,6 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Export\AbstractEn
4538
*/
4639
protected $_indexValueAttributes = [];
4740

48-
/**
49-
* Permanent entity columns
50-
*
51-
* @var string[]
52-
*/
53-
protected $_permanentAttributes = [];
54-
5541
/**
5642
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
5743
*/
@@ -85,43 +71,6 @@ public function __construct(
8571
}
8672
}
8773

88-
/**
89-
* Get attributes codes which are appropriate for export
90-
*
91-
* @return array
92-
*/
93-
protected function _getExportAttributeCodes()
94-
{
95-
if (null === $this->_attributeCodes) {
96-
if (!empty($this->_parameters[Export::FILTER_ELEMENT_SKIP]) && is_array(
97-
$this->_parameters[Export::FILTER_ELEMENT_SKIP]
98-
)
99-
) {
100-
$skippedAttributes = array_flip(
101-
$this->_parameters[Export::FILTER_ELEMENT_SKIP]
102-
);
103-
} else {
104-
$skippedAttributes = [];
105-
}
106-
$attributeCodes = [];
107-
108-
/** @var $attribute AbstractAttribute */
109-
foreach ($this->filterAttributeCollection($this->getAttributeCollection()) as $attribute) {
110-
if (!isset(
111-
$skippedAttributes[$attribute->getAttributeId()]
112-
) || in_array(
113-
$attribute->getAttributeCode(),
114-
$this->_permanentAttributes
115-
)
116-
) {
117-
$attributeCodes[] = $attribute->getAttributeCode();
118-
}
119-
}
120-
$this->_attributeCodes = $attributeCodes;
121-
}
122-
return $this->_attributeCodes;
123-
}
124-
12574
/**
12675
* Initialize attribute option values
12776
*

app/code/Magento/Newsletter/Helper/Data.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,21 @@
1111
*/
1212
namespace Magento\Newsletter\Helper;
1313

14-
class Data extends \Magento\Framework\App\Helper\AbstractHelper
14+
class Data
1515
{
16+
/**
17+
* @var \Magento\Framework\UrlInterface
18+
*/
19+
protected $_frontendUrlBuilder;
20+
21+
/**
22+
* @param \Magento\Framework\UrlInterface $frontendUrlBuilder
23+
*/
24+
public function __construct(\Magento\Framework\UrlInterface $frontendUrlBuilder)
25+
{
26+
$this->_frontendUrlBuilder = $frontendUrlBuilder;
27+
}
28+
1629
/**
1730
* Retrieve subsription confirmation url
1831
*
@@ -21,7 +34,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
2134
*/
2235
public function getConfirmationUrl($subscriber)
2336
{
24-
return $this->_urlBuilder->setScope(
37+
return $this->_frontendUrlBuilder->setScope(
2538
$subscriber->getStoreId()
2639
)->getUrl(
2740
'newsletter/subscriber/confirm',
@@ -37,7 +50,7 @@ public function getConfirmationUrl($subscriber)
3750
*/
3851
public function getUnsubscribeUrl($subscriber)
3952
{
40-
return $this->_urlBuilder->setScope(
53+
return $this->_frontendUrlBuilder->setScope(
4154
$subscriber->getStoreId()
4255
)->getUrl(
4356
'newsletter/subscriber/unsubscribe',

app/code/Magento/Newsletter/etc/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
<argument name="storage" xsi:type="object">Magento\Newsletter\Model\Session\Storage</argument>
1717
</arguments>
1818
</type>
19+
<type name="Magento\Newsletter\Helper\Data">
20+
<arguments>
21+
<argument name="frontendUrlBuilder" xsi:type="object">Magento\Framework\Url</argument>
22+
</arguments>
23+
</type>
1924
<type name="Magento\Customer\Api\CustomerRepositoryInterface">
2025
<plugin name="update_newsletter_subscription_on_customer_update"
2126
type="Magento\Newsletter\Model\Plugin\CustomerPlugin"/>

app/code/Magento/SalesRule/Block/Rss/Discounts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getRssData()
7373
'store_id' => $storeId,
7474
'cid' => $customerGroupId,
7575
]);
76-
$title = __('%1 - Discounts and Coupons', $storeModel->getName());
76+
$title = __('%1 - Discounts and Coupons', $storeModel->getFrontendName());
7777
$lang = $this->_scopeConfig->getValue(
7878
'general/locale/code',
7979
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,

0 commit comments

Comments
 (0)