Skip to content

Commit cf6ae36

Browse files
committed
2.0.0.0-dev85
* Service layer updates: * Implemented API for the CatalogInventory module * Refactored the external usages of the CatalogInventory module to service * Fixed bugs: * Fixed an issue where a coupon usage option was not comprehensible enough * Fixed an issue where products selection for adding to a bundle option was lost when switching between pages with product grids * Fixed an issue where Google Content was not sending the correct 'description' attribute * Fixed an issue where custom attributes were not displayed in layered navigation after a product import * Fixed an issue where the Category URL keys did not work correctly after saving * Fixed an issue where an admin could not create a Target rule with a certain Products to Display condition * Fixed a jQuery error on a product page in the Admin panel, which appeared when switching between product tabs * Framework Improvements: * Created ProductsCustomOptions Service API for Catalog module * Created DownloadableLink Service API for Catalog module * GitHub requests: * [#257] JSON loading should follow OWASP recommendation
1 parent 974d259 commit cf6ae36

File tree

298 files changed

+14124
-2535
lines changed

Some content is hidden

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

298 files changed

+14124
-2535
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2.0.0.0-dev85
2+
=============
3+
* Service layer updates:
4+
* Implemented API for the CatalogInventory module
5+
* Refactored the external usages of the CatalogInventory module to service
6+
* Fixed bugs:
7+
* Fixed an issue where a coupon usage option was not comprehensible enough
8+
* Fixed an issue where products selection for adding to a bundle option was lost when switching between pages with product grids
9+
* Fixed an issue where Google Content was not sending the correct 'description' attribute
10+
* Fixed an issue where custom attributes were not displayed in layered navigation after a product import
11+
* Fixed an issue where the Category URL keys did not work correctly after saving
12+
* Fixed an issue where an admin could not create a Target rule with a certain Products to Display condition
13+
* Fixed a jQuery error on a product page in the Admin panel, which appeared when switching between product tabs
14+
* Framework Improvements:
15+
* Created ProductsCustomOptions Service API for Catalog module
16+
* Created DownloadableLink Service API for Catalog module
17+
* GitHub requests:
18+
* [#257] JSON loading should follow OWASP recommendation
19+
120
2.0.0.0-dev84
221
=============
322
* Fixed bugs:

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function ajaxMarkAsReadAction()
9595
} catch (\Exception $e) {
9696
$responseData['success'] = false;
9797
}
98-
$this->getResponse()->setBody(
98+
$this->getResponse()->representJson(
9999
$this->_objectManager->create('Magento\Core\Helper\Data')->jsonEncode($responseData)
100100
);
101101
}

app/code/Magento/AdminNotification/Controller/Adminhtml/Survey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function indexAction()
4040
if ($this->getRequest()->getParam('isAjax', false)) {
4141
$this->_objectManager->get('Magento\AdminNotification\Model\Survey')->saveSurveyViewed(true);
4242
}
43-
$this->getResponse()->setBody(\Zend_Json::encode(array('survey_decision_saved' => 1)));
43+
$this->getResponse()->representJson(\Zend_Json::encode(array('survey_decision_saved' => 1)));
4444
}
4545

4646
/**

app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ public function listAction()
4141
foreach ($messageCollection->getItems() as $item) {
4242
$result[] = array('severity' => $item->getSeverity(), 'text' => $item->getText());
4343
}
44-
$this->getResponse()->setHeader(
45-
'Content-Type',
46-
'application/json'
47-
)->setBody(
44+
$this->getResponse()->representJson(
4845
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
4946
);
5047
}

app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,14 @@ public function placeAction()
170170
'sales/order_create/'
171171
);
172172
}
173-
174-
$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result));
173+
$this->getResponse()->representJson(
174+
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
175+
);
175176
} else {
176177
$result = array('error_messages' => __('Please choose a payment method.'));
177-
$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result));
178+
$this->getResponse()->representJson(
179+
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
180+
);
178181
}
179182
}
180183

@@ -238,7 +241,7 @@ public function redirectAction()
238241
public function returnQuoteAction()
239242
{
240243
$this->_returnQuote();
241-
$this->getResponse()->setBody(
244+
$this->getResponse()->representJson(
242245
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode(array('success' => 1))
243246
);
244247
}

app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public function cancelAction()
8484
}
8585

8686
$this->_sessionQuote->getQuote()->getPayment()->save();
87-
$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result));
87+
$this->getResponse()->representJson(
88+
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
89+
);
8890
}
8991
}

app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public function cancelAction()
7676
}
7777

7878
$this->_session->getQuote()->getPayment()->save();
79-
$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result));
79+
$this->getResponse()->representJson(
80+
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
81+
);
8082
}
8183
}

app/code/Magento/Authorizenet/Controller/Directpost/Payment.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ public function placeAction()
207207
);
208208
} else {
209209
$result = array('error_messages' => __('Please choose a payment method.'), 'goto_section' => 'payment');
210-
$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result));
210+
$this->getResponse()->representJson(
211+
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
212+
);
211213
}
212214
}
213215

@@ -219,7 +221,7 @@ public function placeAction()
219221
public function returnQuoteAction()
220222
{
221223
$this->_returnCustomerQuote();
222-
$this->getResponse()->setBody(
224+
$this->getResponse()->representJson(
223225
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode(array('success' => 1))
224226
);
225227
}

app/code/Magento/Authorizenet/Model/Directpost/Observer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function addAdditionalFieldsToResponseFrontend(\Magento\Framework\Event\O
137137
$result['directpost'] = array('fields' => $requestToAuthorizenet->getData());
138138

139139
$response->clearHeader('Location');
140-
$response->setBody($this->_coreData->jsonEncode($result));
140+
$response->representJson($this->_coreData->jsonEncode($result));
141141
}
142142
}
143143
}

app/code/Magento/Backend/App/AbstractAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public function _processUrlKeys()
280280
$this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
281281
$this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true);
282282
if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
283-
$this->getResponse()->setBody(
283+
$this->getResponse()->representJson(
284284
$this->_objectManager->get(
285285
'Magento\Core\Helper\Data'
286286
)->jsonEncode(

app/code/Magento/Backend/Controller/Adminhtml/Ajax.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function translateAction()
5858
} catch (\Exception $e) {
5959
$response = "{error:true,message:'" . $e->getMessage() . "'}";
6060
}
61-
$this->getResponse()->setBody($response);
61+
$this->getResponse()->representJson($response);
6262

6363
$this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true);
6464
}

app/code/Magento/Backend/Controller/Adminhtml/Auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function logoutAction()
6767
*/
6868
public function deniedJsonAction()
6969
{
70-
$this->getResponse()->setBody($this->_getDeniedJson());
70+
$this->getResponse()->representJson($this->_getDeniedJson());
7171
}
7272

7373
/**

app/code/Magento/Backend/Controller/Adminhtml/Index.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ public function globalSearchAction()
9999
}
100100
}
101101
}
102-
103-
$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($items));
102+
$this->getResponse()->representJson(
103+
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($items)
104+
);
104105
}
105106

106107
/**

app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,6 @@ public function statusAction()
180180
}
181181
$result['state'] = $state;
182182
$result = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result);
183-
$this->_response->setBody($result);
183+
$this->_response->representJson($result);
184184
}
185185
}

app/code/Magento/Backend/Controller/Adminhtml/System/Variable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function validateAction()
149149
$response->setError(true);
150150
$response->setHtmlMessage($this->_view->getLayout()->getMessagesBlock()->getGroupedHtml());
151151
}
152-
$this->getResponse()->setBody($response->toJson());
152+
$this->getResponse()->representJson($response->toJson());
153153
}
154154

155155
/**
@@ -223,7 +223,7 @@ public function wysiwygPluginAction()
223223
true
224224
);
225225
$variables = array($storeContactVariabls, $customVariables);
226-
$this->getResponse()->setBody(\Zend_Json::encode($variables));
226+
$this->getResponse()->representJson(\Zend_Json::encode($variables));
227227
}
228228

229229
/**

app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function productGridAction()
183183
public function categoriesJsonAction()
184184
{
185185
$categoryId = $this->getRequest()->getParam('id', null);
186-
$this->getResponse()->setBody(
186+
$this->getResponse()->representJson(
187187
$this->_objectManager->get(
188188
'Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree'
189189
)->getTreeArray(

app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@
9999
'<?php echo $this->getViewFileUrl('jquery/jstree/jquery.hotkeys.js') ?>',
100100
'<?php echo $this->getViewFileUrl('jquery/jstree/jquery.jstree.js') ?>',
101101
'<?php echo $this->getViewFileUrl('Magento_Catalog::js/category-tree.js') ?>'
102+
],
103+
collapsible: [
104+
'<?php echo $this->getViewFileUrl('mage/collapsible.js') ?>'
102105
]
103106
})
104107
/**

app/code/Magento/Backup/Controller/Adminhtml/Index.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function createAction()
173173
. 'putting your store into maintenance mode."
174174
)
175175
);
176-
return $this->getResponse()->setBody($response->toJson());
176+
return $this->getResponse()->representJson($response->toJson());
177177
}
178178
}
179179

@@ -211,7 +211,7 @@ public function createAction()
211211
$this->maintenanceMode->turnOff();
212212
}
213213

214-
$this->getResponse()->setBody($response->toJson());
214+
$this->getResponse()->representJson($response->toJson());
215215
}
216216

217217
/**
@@ -308,7 +308,7 @@ public function rollbackAction()
308308
if (!$passwordValid) {
309309
$response->setError(__('Please correct the password.'));
310310
$backupManager->setErrorMessage(__('Please correct the password.'));
311-
return $this->getResponse()->setBody($response->toJson());
311+
$this->getResponse()->representJson($response->toJson());
312312
}
313313

314314
if ($this->getRequest()->getParam('maintenance_mode')) {
@@ -327,7 +327,7 @@ public function rollbackAction()
327327
. 'putting your store into maintenance mode."
328328
)
329329
);
330-
return $this->getResponse()->setBody($response->toJson());
330+
return $this->getResponse()->representJson($response->toJson());
331331
}
332332
}
333333

@@ -380,7 +380,7 @@ public function rollbackAction()
380380
$this->maintenanceMode->turnOff();
381381
}
382382

383-
$this->getResponse()->setBody($response->toJson());
383+
$this->getResponse()->representJson($response->toJson());
384384
}
385385

386386
/**

app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
*/
2424
namespace Magento\Bundle\Block\Adminhtml\Sales\Order\Items;
2525

26+
use Magento\Catalog\Model\Product\Type\AbstractType;
27+
2628
/**
2729
* Adminhtml sales order item renderer
2830
*/
@@ -56,11 +58,12 @@ public function getChilds($item)
5658
{
5759
$itemsArray = array();
5860

61+
$items = false;
5962
if ($item instanceof \Magento\Sales\Model\Order\Invoice\Item) {
6063
$items = $item->getInvoice()->getAllItems();
61-
} else if ($item instanceof \Magento\Sales\Model\Order\Shipment\Item) {
64+
} elseif ($item instanceof \Magento\Sales\Model\Order\Shipment\Item) {
6265
$items = $item->getShipment()->getAllItems();
63-
} else if ($item instanceof \Magento\Sales\Model\Order\Creditmemo\Item) {
66+
} elseif ($item instanceof \Magento\Sales\Model\Order\Creditmemo\Item) {
6467
$items = $item->getCreditmemo()->getAllItems();
6568
}
6669

@@ -96,11 +99,8 @@ public function isShipmentSeparately($item = null)
9699
if ($parentItem) {
97100
$options = $parentItem->getProductOptions();
98101
if ($options) {
99-
if (isset(
100-
$options['shipment_type']
101-
) &&
102-
$options['shipment_type'] ==
103-
\Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY
102+
if (isset($options['shipment_type'])
103+
&& $options['shipment_type'] == AbstractType::SHIPMENT_SEPARATELY
104104
) {
105105
return true;
106106
} else {
@@ -110,11 +110,8 @@ public function isShipmentSeparately($item = null)
110110
} else {
111111
$options = $item->getProductOptions();
112112
if ($options) {
113-
if (isset(
114-
$options['shipment_type']
115-
) &&
116-
$options['shipment_type'] ==
117-
\Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY
113+
if (isset($options['shipment_type'])
114+
&& $options['shipment_type'] == AbstractType::SHIPMENT_SEPARATELY
118115
) {
119116
return false;
120117
} else {
@@ -126,9 +123,8 @@ public function isShipmentSeparately($item = null)
126123

127124
$options = $this->getOrderItem()->getProductOptions();
128125
if ($options) {
129-
if (isset(
130-
$options['shipment_type']
131-
) && $options['shipment_type'] == \Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY
126+
if (isset($options['shipment_type'])
127+
&& $options['shipment_type'] == AbstractType::SHIPMENT_SEPARATELY
132128
) {
133129
return true;
134130
}
@@ -150,11 +146,8 @@ public function isChildCalculated($item = null)
150146
if ($parentItem) {
151147
$options = $parentItem->getProductOptions();
152148
if ($options) {
153-
if (isset(
154-
$options['product_calculations']
155-
) &&
156-
$options['product_calculations'] ==
157-
\Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD
149+
if (isset($options['product_calculations'])
150+
&& $options['product_calculations'] == AbstractType::CALCULATE_CHILD
158151
) {
159152
return true;
160153
} else {
@@ -164,11 +157,8 @@ public function isChildCalculated($item = null)
164157
} else {
165158
$options = $item->getProductOptions();
166159
if ($options) {
167-
if (isset(
168-
$options['product_calculations']
169-
) &&
170-
$options['product_calculations'] ==
171-
\Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD
160+
if (isset($options['product_calculations'])
161+
&& $options['product_calculations'] == AbstractType::CALCULATE_CHILD
172162
) {
173163
return false;
174164
} else {
@@ -180,9 +170,8 @@ public function isChildCalculated($item = null)
180170

181171
$options = $this->getOrderItem()->getProductOptions();
182172
if ($options) {
183-
if (isset(
184-
$options['product_calculations']
185-
) && $options['product_calculations'] == \Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD
173+
if (isset($options['product_calculations'])
174+
&& $options['product_calculations'] == AbstractType::CALCULATE_CHILD
186175
) {
187176
return true;
188177
}
@@ -208,10 +197,9 @@ public function getSelectionAttributes($item)
208197
}
209198

210199
/**
211-
* @param mixed $item
212200
* @return array
213201
*/
214-
public function getOrderOptions($item = null)
202+
public function getOrderOptions()
215203
{
216204
$result = array();
217205
$options = $this->getOrderItem()->getProductOptions();
@@ -269,8 +257,8 @@ public function getValueHtml($item)
269257
*/
270258
public function canShowPriceInfo($item)
271259
{
272-
if ($item->getOrderItem()->getParentItem() && $this->isChildCalculated() ||
273-
!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated()
260+
if ($item->getOrderItem()->getParentItem() && $this->isChildCalculated()
261+
|| !$item->getOrderItem()->getParentItem() && !$this->isChildCalculated()
274262
) {
275263
return true;
276264
}

0 commit comments

Comments
 (0)