Skip to content

Commit 67f080d

Browse files
committed
MAGETWO-70761: Merge branch 'develop' of github.com:magento/magento2ce into MAGETWO-70761-PR-10213
2 parents 48a5df1 + 2e8d837 commit 67f080d

File tree

51 files changed

+970
-316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+970
-316
lines changed

CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at engcom@magento.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

app/bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@
6363
date_default_timezone_set('UTC');
6464

6565
/* Adjustment of precision value for several versions of PHP */
66-
ini_set('precision', 17);
67-
ini_set('serialize_precision', 17);
66+
ini_set('precision', 15);
67+
ini_set('serialize_precision', 15);

app/code/Magento/Catalog/Pricing/Price/TierPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function __construct(
7272
Session $customerSession,
7373
GroupManagementInterface $groupManagement
7474
) {
75-
$quantity = $quantity ?: 1;
75+
$quantity = floatval($quantity) ? $quantity : 1;
7676
parent::__construct($saleableItem, $quantity, $calculator, $priceCurrency);
7777
$this->customerSession = $customerSession;
7878
$this->groupManagement = $groupManagement;

app/code/Magento/Directory/Model/Observer.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,14 @@ public function scheduledUpdateCurrencyRates($schedule)
126126
}
127127
}
128128

129+
$errorRecipient = $this->_scopeConfig->getValue(
130+
self::XML_PATH_ERROR_RECIPIENT,
131+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
132+
);
129133
if (sizeof($importWarnings) == 0) {
130134
$this->_currencyFactory->create()->saveRates($rates);
131-
} else {
135+
} elseif ($errorRecipient) {
136+
//if $errorRecipient is not set, there is no sense send email to nobody
132137
$this->inlineTranslation->suspend();
133138

134139
$this->_transportBuilder->setTemplateIdentifier(
@@ -148,12 +153,7 @@ public function scheduledUpdateCurrencyRates($schedule)
148153
self::XML_PATH_ERROR_IDENTITY,
149154
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
150155
)
151-
)->addTo(
152-
$this->_scopeConfig->getValue(
153-
self::XML_PATH_ERROR_RECIPIENT,
154-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
155-
)
156-
);
156+
)->addTo($errorRecipient);
157157
$transport = $this->_transportBuilder->getTransport();
158158
$transport->sendMessage();
159159

app/code/Magento/Eav/Model/Entity/Attribute.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im
2121
\Magento\Framework\DataObject\IdentityInterface
2222
{
2323
/**
24-
* Attribute code max length
24+
* Attribute code max length.
25+
*
26+
* The value is defined as 60 because in the flat mode attribute code will be transformed into column name.
27+
* MySQL allows only 64 symbols in column name.
2528
*/
26-
const ATTRIBUTE_CODE_MAX_LENGTH = 255;
29+
const ATTRIBUTE_CODE_MAX_LENGTH = 60;
2730

2831
/**
2932
* Cache tag

app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Webapi.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ private function getAclResources()
190190
$configResource = array_filter(
191191
$resources,
192192
function ($node) {
193-
return $node['id'] == 'Magento_Backend::admin';
193+
return isset($node['id'])
194+
&& $node['id'] == 'Magento_Backend::admin';
194195
}
195196
);
196197
$configResource = reset($configResource);

app/code/Magento/Newsletter/Model/Queue/TransportBuilder.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ protected function prepareMessage()
4848
$template = $this->getTemplate()->setData($this->templateData);
4949
$this->setTemplateFilter($template);
5050

51-
$this->message->setMessageType(
52-
\Magento\Framework\Mail\MessageInterface::TYPE_HTML
53-
)->setBody(
51+
$this->message->setBodyHtml(
5452
$template->getProcessedTemplate($this->templateVars)
5553
)->setSubject(
5654
$template->getSubject()

app/code/Magento/Newsletter/Model/Template.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ class Template extends \Magento\Email\Model\AbstractTemplate
4040
{
4141
/**
4242
* Mail object
43+
*
44+
* @deprecated Unused property
4345
*
44-
* @var \Zend_Mail
4546
*/
4647
protected $_mail;
4748

app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,12 @@ public function setUp()
7474

7575
/**
7676
* @param int $templateType
77-
* @param string $messageType
7877
* @param string $bodyText
7978
* @return void
8079
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
8180
*/
8281
public function testGetTransport(
8382
$templateType = TemplateTypesInterface::TYPE_HTML,
84-
$messageType = MessageInterface::TYPE_HTML,
8583
$bodyText = '<h1>Html message</h1>'
8684
) {
8785
$filter = $this->getMock(\Magento\Email\Model\Template\Filter::class, [], [], '', false);
@@ -137,16 +135,7 @@ public function testGetTransport(
137135
$this->messageMock->expects(
138136
$this->once()
139137
)->method(
140-
'setMessageType'
141-
)->with(
142-
$this->equalTo($messageType)
143-
)->will(
144-
$this->returnSelf()
145-
);
146-
$this->messageMock->expects(
147-
$this->once()
148-
)->method(
149-
'setBody'
138+
'setBodyHtml'
150139
)->with(
151140
$this->equalTo($bodyText)
152141
)->will(

app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,21 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
// @codingStandardsIgnoreFile
8-
96
namespace Magento\ProductAlert\Block\Email;
107

118
use Magento\Framework\Pricing\PriceCurrencyInterface;
9+
use Magento\Framework\App\ObjectManager;
10+
use Magento\ProductAlert\Block\Product\ImageProvider;
1211

1312
/**
1413
* Product Alert Abstract Email Block
15-
*
16-
* @author Magento Core Team <core@magentocommerce.com>
1714
*/
1815
abstract class AbstractEmail extends \Magento\Framework\View\Element\Template
1916
{
2017
/**
2118
* Product collection array
2219
*
23-
* @var array
20+
* @var \Magento\Catalog\Model\Product[]
2421
*/
2522
protected $_products = [];
2623

@@ -42,36 +39,45 @@ abstract class AbstractEmail extends \Magento\Framework\View\Element\Template
4239
protected $priceCurrency;
4340

4441
/**
45-
* @var \Magento\Catalog\Helper\Image
42+
* @var \Magento\Catalog\Block\Product\ImageBuilder
4643
*/
4744
protected $imageBuilder;
4845

46+
/**
47+
* @var ImageProvider
48+
*/
49+
private $imageProvider;
50+
4951
/**
5052
* @param \Magento\Framework\View\Element\Template\Context $context
5153
* @param \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode
5254
* @param PriceCurrencyInterface $priceCurrency
5355
* @param \Magento\Catalog\Block\Product\ImageBuilder $imageBuilder
5456
* @param array $data
57+
* @param ImageProvider $imageProvider
5558
*/
5659
public function __construct(
5760
\Magento\Framework\View\Element\Template\Context $context,
5861
\Magento\Framework\Filter\Input\MaliciousCode $maliciousCode,
5962
PriceCurrencyInterface $priceCurrency,
6063
\Magento\Catalog\Block\Product\ImageBuilder $imageBuilder,
61-
array $data = []
64+
array $data = [],
65+
ImageProvider $imageProvider = null
6266
) {
6367
$this->imageBuilder = $imageBuilder;
6468
$this->priceCurrency = $priceCurrency;
6569
$this->_maliciousCode = $maliciousCode;
70+
$this->imageProvider = $imageProvider ?: ObjectManager::getInstance()->get(ImageProvider::class);
71+
6672
parent::__construct($context, $data);
6773
}
6874

6975
/**
70-
* Filter malicious code before insert content to email
71-
*
72-
* @param string|array $content
73-
* @return string|array
74-
*/
76+
* Filter malicious code before insert content to email
77+
*
78+
* @param string|array $content
79+
* @return string|array
80+
*/
7581
public function getFilteredContent($content)
7682
{
7783
return $this->_maliciousCode->filter($content);
@@ -104,7 +110,7 @@ public function setStore($store)
104110
*/
105111
public function getStore()
106112
{
107-
if (is_null($this->_store)) {
113+
if ($this->_store === null) {
108114
$this->_store = $this->_storeManager->getStore();
109115
}
110116
return $this->_store;
@@ -114,9 +120,9 @@ public function getStore()
114120
* Convert price from default currency to current currency
115121
*
116122
* @param float $price
117-
* @param boolean $format Format price to currency format
118-
* @param boolean $includeContainer Enclose into <span class="price"><span>
119-
* @return float
123+
* @param bool $format Format price to currency format
124+
* @param bool $includeContainer Enclose into <span class="price"><span>
125+
* @return float|string
120126
*/
121127
public function formatPrice($price, $format = true, $includeContainer = true)
122128
{
@@ -149,7 +155,7 @@ public function addProduct(\Magento\Catalog\Model\Product $product)
149155
/**
150156
* Retrieve product collection array
151157
*
152-
* @return array
158+
* @return \Magento\Catalog\Model\Product[]
153159
*/
154160
public function getProducts()
155161
{
@@ -212,7 +218,7 @@ public function getProductPriceHtml(
212218
}
213219

214220
/**
215-
* Retrieve product image
221+
* Retrieve product image.
216222
*
217223
* @param \Magento\Catalog\Model\Product $product
218224
* @param string $imageId
@@ -221,9 +227,6 @@ public function getProductPriceHtml(
221227
*/
222228
public function getImage($product, $imageId, $attributes = [])
223229
{
224-
return $this->imageBuilder->setProduct($product)
225-
->setImageId($imageId)
226-
->setAttributes($attributes)
227-
->create();
230+
return $this->imageProvider->getImage($product, $imageId, $attributes);
228231
}
229232
}

0 commit comments

Comments
 (0)