Skip to content

Commit b04dffa

Browse files
author
Melnikov, Igor(imelnikov)
committed
Merge pull request #450 from magento-extensibility/develop
[Extensibility] Bug fixes
2 parents ac52fe3 + 5cc30e5 commit b04dffa

File tree

29 files changed

+713
-165
lines changed

29 files changed

+713
-165
lines changed

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Date.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function __construct(
4747
* Retrieve date format
4848
*
4949
* @return string
50+
* @deprecated
5051
*/
5152
protected function _getFormat()
5253
{
@@ -74,16 +75,18 @@ protected function _getFormat()
7475
*/
7576
public function render(\Magento\Framework\DataObject $row)
7677
{
77-
if ($data = $row->getData($this->getColumn()->getIndex())) {
78-
$timezone = $this->getColumn()->getTimezone() !== false ? $this->_localeDate->getConfigTimezone() : 'UTC';
79-
return $this->dateTimeFormatter->formatObject(
80-
$this->_localeDate->date(
81-
new \DateTime(
82-
$data,
83-
new \DateTimeZone($timezone)
84-
)
85-
),
86-
$this->_getFormat()
78+
$format = $this->getColumn()->getFormat();
79+
$date = $this->_getValue($row);
80+
if ($date) {
81+
if (!($date instanceof \DateTimeInterface)) {
82+
$date = new \DateTime($date);
83+
}
84+
return $this->_localeDate->formatDateTime(
85+
$date,
86+
$format ?: \IntlDateFormatter::MEDIUM,
87+
\IntlDateFormatter::NONE,
88+
null,
89+
$this->getColumn()->getTimezone() === false ? 'UTC' : null
8790
);
8891
}
8992
return $this->getColumn()->getDefault();

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Datetime.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@ class Datetime extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra
2020
public function render(\Magento\Framework\DataObject $row)
2121
{
2222
$format = $this->getColumn()->getFormat();
23-
if ($date = $this->_getValue($row)) {
23+
$date = $this->_getValue($row);
24+
if ($date) {
25+
if (!($date instanceof \DateTimeInterface)) {
26+
$date = new \DateTime($date);
27+
}
2428
return $this->_localeDate->formatDateTime(
25-
$date instanceof \DateTimeInterface ? $date : new \DateTime($date),
29+
$date,
2630
$format ?: \IntlDateFormatter::MEDIUM,
2731
$format ?: \IntlDateFormatter::MEDIUM,
2832
null,
29-
$this->getColumn()->getTimezone() !== false ? null : 'UTC'
33+
$this->getColumn()->getTimezone() === false ? 'UTC' : null
3034
);
3135
}
3236
return $this->getColumn()->getDefault();

app/code/Magento/Captcha/Observer/CheckUserLoginObserver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ public function execute(\Magento\Framework\Event\Observer $observer)
160160
$captchaModel = $this->_helper->getCaptcha($formId);
161161
$controller = $observer->getControllerAction();
162162
$loginParams = $controller->getRequest()->getPost('login');
163-
$login = array_key_exists('username', $loginParams) ? $loginParams['username'] : null;
163+
$login = (is_array($loginParams) && array_key_exists('username', $loginParams))
164+
? $loginParams['username']
165+
: null;
164166
if ($captchaModel->isRequired($login)) {
165167
$word = $this->captchaStringResolver->resolve($controller->getRequest(), $formId);
166168
if (!$captchaModel->isCorrect($word)) {

app/code/Magento/CatalogRule/view/adminhtml/layout/catalog_rule_promo_catalog_block.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<arguments>
4646
<argument name="header" xsi:type="string" translate="true">Start</argument>
4747
<argument name="type" xsi:type="string">date</argument>
48+
<argument name="timezone" xsi:type="boolean">false</argument>
4849
<argument name="index" xsi:type="string">from_date</argument>
4950
<argument name="column_css_class" xsi:type="string">col-date</argument>
5051
<argument name="header_css_class" xsi:type="string">col-date</argument>
@@ -54,6 +55,7 @@
5455
<arguments>
5556
<argument name="header" xsi:type="string" translate="true">End</argument>
5657
<argument name="type" xsi:type="string">date</argument>
58+
<argument name="timezone" xsi:type="boolean">false</argument>
5759
<argument name="default" xsi:type="string">--</argument>
5860
<argument name="index" xsi:type="string">to_date</argument>
5961
<argument name="column_css_class" xsi:type="string">col-date</argument>
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cms\Setup;
7+
8+
use Magento\Cms\Model\Page;
9+
use Magento\Cms\Model\PageFactory;
10+
use Magento\Framework\Setup\ModuleContextInterface;
11+
use Magento\Framework\Setup\ModuleDataSetupInterface;
12+
use Magento\Framework\Setup\UpgradeDataInterface;
13+
14+
class UpgradeData implements UpgradeDataInterface
15+
{
16+
const PRIVACY_COOKIE_PAGE_ID = 4;
17+
18+
/**
19+
* @var PageFactory
20+
*/
21+
private $pageFactory;
22+
23+
/**
24+
* @param PageFactory $pageFactory
25+
*/
26+
public function __construct(PageFactory $pageFactory)
27+
{
28+
$this->pageFactory = $pageFactory;
29+
}
30+
31+
/**
32+
* Create page
33+
*
34+
* @return Page
35+
*/
36+
private function createPage()
37+
{
38+
return $this->pageFactory->create();
39+
}
40+
41+
/**
42+
* Upgrades data for a module
43+
*
44+
* @param ModuleDataSetupInterface $setup
45+
* @param ModuleContextInterface $context
46+
* @return void
47+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
48+
*/
49+
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
50+
{
51+
$setup->startSetup();
52+
if (version_compare($context->getVersion(), '2.0.1', '<')) {
53+
$newPageContent = <<<EOD
54+
<div class="privacy-policy cms-content">
55+
<div class="message info">
56+
<span>
57+
Please replace this text with you Privacy Policy.
58+
Please add any additional cookies your website uses below (e.g. Google Analytics).
59+
</span>
60+
</div>
61+
<p>
62+
This privacy policy sets out how this website (hereafter "the Store") uses and protects any information that
63+
you give the Store while using this website. The Store is committed to ensuring that your privacy is protected.
64+
Should we ask you to provide certain information by which you can be identified when using this website, then
65+
you can be assured that it will only be used in accordance with this privacy statement. The Store may change
66+
this policy from time to time by updating this page. You should check this page from time to time to ensure
67+
that you are happy with any changes.
68+
</p>
69+
<h2>What we collect</h2>
70+
<p>We may collect the following information:</p>
71+
<ul>
72+
<li>name</li>
73+
<li>contact information including email address</li>
74+
<li>demographic information such as postcode, preferences and interests</li>
75+
<li>other information relevant to customer surveys and/or offers</li>
76+
</ul>
77+
<p>
78+
For the exhaustive list of cookies we collect see the <a href="#list">List of cookies we collect</a> section.
79+
</p>
80+
<h2>What we do with the information we gather</h2>
81+
<p>
82+
We require this information to understand your needs and provide you with a better service,
83+
and in particular for the following reasons:
84+
</p>
85+
<ul>
86+
<li>Internal record keeping.</li>
87+
<li>We may use the information to improve our products and services.</li>
88+
<li>
89+
We may periodically send promotional emails about new products, special offers or other information which we
90+
think you may find interesting using the email address which you have provided.
91+
</li>
92+
<li>
93+
From time to time, we may also use your information to contact you for market research purposes.
94+
We may contact you by email, phone, fax or mail. We may use the information to customise the website
95+
according to your interests.
96+
</li>
97+
</ul>
98+
<h2>Security</h2>
99+
<p>
100+
We are committed to ensuring that your information is secure. In order to prevent unauthorised access or
101+
disclosure, we have put in place suitable physical, electronic and managerial procedures to safeguard and
102+
secure the information we collect online.
103+
</p>
104+
<h2>How we use cookies</h2>
105+
<p>
106+
A cookie is a small file which asks permission to be placed on your computer's hard drive.
107+
Once you agree, the file is added and the cookie helps analyse web traffic or lets you know when you visit
108+
a particular site. Cookies allow web applications to respond to you as an individual. The web application
109+
can tailor its operations to your needs, likes and dislikes by gathering and remembering information about
110+
your preferences.
111+
</p>
112+
<p>
113+
We use traffic log cookies to identify which pages are being used. This helps us analyse data about web page
114+
traffic and improve our website in order to tailor it to customer needs. We only use this information for
115+
statistical analysis purposes and then the data is removed from the system.
116+
</p>
117+
<p>
118+
Overall, cookies help us provide you with a better website, by enabling us to monitor which pages you find
119+
useful and which you do not. A cookie in no way gives us access to your computer or any information about you,
120+
other than the data you choose to share with us. You can choose to accept or decline cookies.
121+
Most web browsers automatically accept cookies, but you can usually modify your browser setting
122+
to decline cookies if you prefer. This may prevent you from taking full advantage of the website.
123+
</p>
124+
<h2>Links to other websites</h2>
125+
<p>
126+
Our website may contain links to other websites of interest. However, once you have used these links
127+
to leave our site, you should note that we do not have any control over that other website.
128+
Therefore, we cannot be responsible for the protection and privacy of any information which you provide whilst
129+
visiting such sites and such sites are not governed by this privacy statement.
130+
You should exercise caution and look at the privacy statement applicable to the website in question.
131+
</p>
132+
<h2>Controlling your personal information</h2>
133+
<p>You may choose to restrict the collection or use of your personal information in the following ways:</p>
134+
<ul>
135+
<li>
136+
whenever you are asked to fill in a form on the website, look for the box that you can click to indicate
137+
that you do not want the information to be used by anybody for direct marketing purposes
138+
</li>
139+
<li>
140+
if you have previously agreed to us using your personal information for direct marketing purposes,
141+
you may change your mind at any time by letting us know using our Contact Us information
142+
</li>
143+
</ul>
144+
<p>
145+
We will not sell, distribute or lease your personal information to third parties unless we have your permission
146+
or are required by law to do so. We may use your personal information to send you promotional information
147+
about third parties which we think you may find interesting if you tell us that you wish this to happen.
148+
</p>
149+
<p>
150+
You may request details of personal information which we hold about you under the Data Protection Act 1998.
151+
A small fee will be payable. If you would like a copy of the information held on you please email us this
152+
request using our Contact Us information.
153+
</p>
154+
<p>
155+
If you believe that any information we are holding on you is incorrect or incomplete,
156+
please write to or email us as soon as possible, at the above address.
157+
We will promptly correct any information found to be incorrect.
158+
</p>
159+
<h2><a name="list"></a>List of cookies we collect</h2>
160+
<p>The table below lists the cookies we collect and what information they store.</p>
161+
<table class="data-table data-table-definition-list">
162+
<thead>
163+
<tr>
164+
<th>Cookie Name</th>
165+
<th>Cookie Description</th>
166+
</tr>
167+
</thead>
168+
<tbody>
169+
<tr>
170+
<th>FORM_KEY</th>
171+
<td>Stores randomly generated key used to prevent forged requests.</td>
172+
</tr>
173+
<tr>
174+
<th>PHPSESSID</th>
175+
<td>Your session ID on the server.</td>
176+
</tr>
177+
<tr>
178+
<th>GUEST-VIEW</th>
179+
<td>Allows guests to view and edit their orders.</td>
180+
</tr>
181+
<tr>
182+
<th>PERSISTENT_SHOPPING_CART</th>
183+
<td>A link to information about your cart and viewing history, if you have asked for this.</td>
184+
</tr>
185+
<tr>
186+
<th>STF</th>
187+
<td>Information on products you have emailed to friends.</td>
188+
</tr>
189+
<tr>
190+
<th>STORE</th>
191+
<td>The store view or language you have selected.</td>
192+
</tr>
193+
<tr>
194+
<th>USER_ALLOWED_SAVE_COOKIE</th>
195+
<td>Indicates whether a customer allowed to use cookies.</td>
196+
</tr>
197+
<tr>
198+
<th>MAGE-CACHE-SESSID</th>
199+
<td>Facilitates caching of content on the browser to make pages load faster.</td>
200+
</tr>
201+
<tr>
202+
<th>MAGE-CACHE-STORAGE</th>
203+
<td>Facilitates caching of content on the browser to make pages load faster.</td>
204+
</tr>
205+
<tr>
206+
<th>MAGE-CACHE-STORAGE-SECTION-INVALIDATION</th>
207+
<td>Facilitates caching of content on the browser to make pages load faster.</td>
208+
</tr>
209+
<tr>
210+
<th>MAGE-CACHE-TIMEOUT</th>
211+
<td>Facilitates caching of content on the browser to make pages load faster.</td>
212+
</tr>
213+
<tr>
214+
<th>SECTION-DATA-IDS</th>
215+
<td>Facilitates caching of content on the browser to make pages load faster.</td>
216+
</tr>
217+
<tr>
218+
<th>PRIVATE_CONTENT_VERSION</th>
219+
<td>Facilitates caching of content on the browser to make pages load faster.</td>
220+
</tr>
221+
<tr>
222+
<th>X-MAGENTO-VARY</th>
223+
<td>Facilitates caching of content on the server to make pages load faster.</td>
224+
</tr>
225+
<tr>
226+
<th>MAGE-TRANSLATION-FILE-VERSION</th>
227+
<td>Facilitates translation of content to other languages.</td>
228+
</tr>
229+
<tr>
230+
<th>MAGE-TRANSLATION-STORAGE</th>
231+
<td>Facilitates translation of content to other languages.</td>
232+
</tr>
233+
</tbody>
234+
</table>
235+
</div>
236+
EOD;
237+
$privacyAndCookiePolicyPage = $this->createPage()->load(self::PRIVACY_COOKIE_PAGE_ID);
238+
$privacyAndCookiePolicyPage->setContent($newPageContent);
239+
$privacyAndCookiePolicyPage->save();
240+
}
241+
$setup->endSetup();
242+
}
243+
}

app/code/Magento/Cms/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Cms" setup_version="2.0.0">
9+
<module name="Magento_Cms" setup_version="2.0.1">
1010
<sequence>
1111
<module name="Magento_Store"/>
1212
<module name="Magento_Theme"/>

app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_listing.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@
257257
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
258258
<item name="editor" xsi:type="string">date</item>
259259
<item name="dataType" xsi:type="string">date</item>
260+
<item name="timezone" xsi:type="boolean">false</item>
260261
<item name="label" xsi:type="string" translate="true">Custom design from</item>
261262
<item name="dateFormat" xsi:type="string">MMM d, y</item>
262263
<item name="visible" xsi:type="boolean">false</item>
@@ -270,6 +271,7 @@
270271
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/date</item>
271272
<item name="editor" xsi:type="string">date</item>
272273
<item name="dataType" xsi:type="string">date</item>
274+
<item name="timezone" xsi:type="boolean">false</item>
273275
<item name="label" xsi:type="string" translate="true">Custom design to</item>
274276
<item name="dateFormat" xsi:type="string">MMM d, y</item>
275277
<item name="visible" xsi:type="boolean">false</item>

0 commit comments

Comments
 (0)