Skip to content

Commit

Permalink
2.0.0.0-dev85
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
magento-team committed Jul 4, 2014
1 parent 974d259 commit cf6ae36
Show file tree
Hide file tree
Showing 298 changed files with 14,124 additions and 2,535 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
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

2.0.0.0-dev84
=============
* Fixed bugs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function ajaxMarkAsReadAction()
} catch (\Exception $e) {
$responseData['success'] = false;
}
$this->getResponse()->setBody(
$this->getResponse()->representJson(
$this->_objectManager->create('Magento\Core\Helper\Data')->jsonEncode($responseData)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function indexAction()
if ($this->getRequest()->getParam('isAjax', false)) {
$this->_objectManager->get('Magento\AdminNotification\Model\Survey')->saveSurveyViewed(true);
}
$this->getResponse()->setBody(\Zend_Json::encode(array('survey_decision_saved' => 1)));
$this->getResponse()->representJson(\Zend_Json::encode(array('survey_decision_saved' => 1)));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ public function listAction()
foreach ($messageCollection->getItems() as $item) {
$result[] = array('severity' => $item->getSeverity(), 'text' => $item->getText());
}
$this->getResponse()->setHeader(
'Content-Type',
'application/json'
)->setBody(
$this->getResponse()->representJson(
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,14 @@ public function placeAction()
'sales/order_create/'
);
}

$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result));
$this->getResponse()->representJson(
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
);
} else {
$result = array('error_messages' => __('Please choose a payment method.'));
$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result));
$this->getResponse()->representJson(
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
);
}
}

Expand Down Expand Up @@ -238,7 +241,7 @@ public function redirectAction()
public function returnQuoteAction()
{
$this->_returnQuote();
$this->getResponse()->setBody(
$this->getResponse()->representJson(
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode(array('success' => 1))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public function cancelAction()
}

$this->_sessionQuote->getQuote()->getPayment()->save();
$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result));
$this->getResponse()->representJson(
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public function cancelAction()
}

$this->_session->getQuote()->getPayment()->save();
$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result));
$this->getResponse()->representJson(
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ public function placeAction()
);
} else {
$result = array('error_messages' => __('Please choose a payment method.'), 'goto_section' => 'payment');
$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result));
$this->getResponse()->representJson(
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)
);
}
}

Expand All @@ -219,7 +221,7 @@ public function placeAction()
public function returnQuoteAction()
{
$this->_returnCustomerQuote();
$this->getResponse()->setBody(
$this->getResponse()->representJson(
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode(array('success' => 1))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function addAdditionalFieldsToResponseFrontend(\Magento\Framework\Event\O
$result['directpost'] = array('fields' => $requestToAuthorizenet->getData());

$response->clearHeader('Location');
$response->setBody($this->_coreData->jsonEncode($result));
$response->representJson($this->_coreData->jsonEncode($result));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/App/AbstractAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function _processUrlKeys()
$this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
$this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true);
if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
$this->getResponse()->setBody(
$this->getResponse()->representJson(
$this->_objectManager->get(
'Magento\Core\Helper\Data'
)->jsonEncode(
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Controller/Adminhtml/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function translateAction()
} catch (\Exception $e) {
$response = "{error:true,message:'" . $e->getMessage() . "'}";
}
$this->getResponse()->setBody($response);
$this->getResponse()->representJson($response);

$this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true);
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Controller/Adminhtml/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function logoutAction()
*/
public function deniedJsonAction()
{
$this->getResponse()->setBody($this->_getDeniedJson());
$this->getResponse()->representJson($this->_getDeniedJson());
}

/**
Expand Down
5 changes: 3 additions & 2 deletions app/code/Magento/Backend/Controller/Adminhtml/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ public function globalSearchAction()
}
}
}

$this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($items));
$this->getResponse()->representJson(
$this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($items)
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,6 @@ public function statusAction()
}
$result['state'] = $state;
$result = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result);
$this->_response->setBody($result);
$this->_response->representJson($result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function validateAction()
$response->setError(true);
$response->setHtmlMessage($this->_view->getLayout()->getMessagesBlock()->getGroupedHtml());
}
$this->getResponse()->setBody($response->toJson());
$this->getResponse()->representJson($response->toJson());
}

/**
Expand Down Expand Up @@ -223,7 +223,7 @@ public function wysiwygPluginAction()
true
);
$variables = array($storeContactVariabls, $customVariables);
$this->getResponse()->setBody(\Zend_Json::encode($variables));
$this->getResponse()->representJson(\Zend_Json::encode($variables));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function productGridAction()
public function categoriesJsonAction()
{
$categoryId = $this->getRequest()->getParam('id', null);
$this->getResponse()->setBody(
$this->getResponse()->representJson(
$this->_objectManager->get(
'Magento\Backend\Block\Urlrewrite\Catalog\Category\Tree'
)->getTreeArray(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
'<?php echo $this->getViewFileUrl('jquery/jstree/jquery.hotkeys.js') ?>',
'<?php echo $this->getViewFileUrl('jquery/jstree/jquery.jstree.js') ?>',
'<?php echo $this->getViewFileUrl('Magento_Catalog::js/category-tree.js') ?>'
],
collapsible: [
'<?php echo $this->getViewFileUrl('mage/collapsible.js') ?>'
]
})
/**
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Backup/Controller/Adminhtml/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function createAction()
. 'putting your store into maintenance mode."
)
);
return $this->getResponse()->setBody($response->toJson());
return $this->getResponse()->representJson($response->toJson());
}
}

Expand Down Expand Up @@ -211,7 +211,7 @@ public function createAction()
$this->maintenanceMode->turnOff();
}

$this->getResponse()->setBody($response->toJson());
$this->getResponse()->representJson($response->toJson());
}

/**
Expand Down Expand Up @@ -308,7 +308,7 @@ public function rollbackAction()
if (!$passwordValid) {
$response->setError(__('Please correct the password.'));
$backupManager->setErrorMessage(__('Please correct the password.'));
return $this->getResponse()->setBody($response->toJson());
$this->getResponse()->representJson($response->toJson());
}

if ($this->getRequest()->getParam('maintenance_mode')) {
Expand All @@ -327,7 +327,7 @@ public function rollbackAction()
. 'putting your store into maintenance mode."
)
);
return $this->getResponse()->setBody($response->toJson());
return $this->getResponse()->representJson($response->toJson());
}
}

Expand Down Expand Up @@ -380,7 +380,7 @@ public function rollbackAction()
$this->maintenanceMode->turnOff();
}

$this->getResponse()->setBody($response->toJson());
$this->getResponse()->representJson($response->toJson());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*/
namespace Magento\Bundle\Block\Adminhtml\Sales\Order\Items;

use Magento\Catalog\Model\Product\Type\AbstractType;

/**
* Adminhtml sales order item renderer
*/
Expand Down Expand Up @@ -56,11 +58,12 @@ public function getChilds($item)
{
$itemsArray = array();

$items = false;
if ($item instanceof \Magento\Sales\Model\Order\Invoice\Item) {
$items = $item->getInvoice()->getAllItems();
} else if ($item instanceof \Magento\Sales\Model\Order\Shipment\Item) {
} elseif ($item instanceof \Magento\Sales\Model\Order\Shipment\Item) {
$items = $item->getShipment()->getAllItems();
} else if ($item instanceof \Magento\Sales\Model\Order\Creditmemo\Item) {
} elseif ($item instanceof \Magento\Sales\Model\Order\Creditmemo\Item) {
$items = $item->getCreditmemo()->getAllItems();
}

Expand Down Expand Up @@ -96,11 +99,8 @@ public function isShipmentSeparately($item = null)
if ($parentItem) {
$options = $parentItem->getProductOptions();
if ($options) {
if (isset(
$options['shipment_type']
) &&
$options['shipment_type'] ==
\Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY
if (isset($options['shipment_type'])
&& $options['shipment_type'] == AbstractType::SHIPMENT_SEPARATELY
) {
return true;
} else {
Expand All @@ -110,11 +110,8 @@ public function isShipmentSeparately($item = null)
} else {
$options = $item->getProductOptions();
if ($options) {
if (isset(
$options['shipment_type']
) &&
$options['shipment_type'] ==
\Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY
if (isset($options['shipment_type'])
&& $options['shipment_type'] == AbstractType::SHIPMENT_SEPARATELY
) {
return false;
} else {
Expand All @@ -126,9 +123,8 @@ public function isShipmentSeparately($item = null)

$options = $this->getOrderItem()->getProductOptions();
if ($options) {
if (isset(
$options['shipment_type']
) && $options['shipment_type'] == \Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY
if (isset($options['shipment_type'])
&& $options['shipment_type'] == AbstractType::SHIPMENT_SEPARATELY
) {
return true;
}
Expand All @@ -150,11 +146,8 @@ public function isChildCalculated($item = null)
if ($parentItem) {
$options = $parentItem->getProductOptions();
if ($options) {
if (isset(
$options['product_calculations']
) &&
$options['product_calculations'] ==
\Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD
if (isset($options['product_calculations'])
&& $options['product_calculations'] == AbstractType::CALCULATE_CHILD
) {
return true;
} else {
Expand All @@ -164,11 +157,8 @@ public function isChildCalculated($item = null)
} else {
$options = $item->getProductOptions();
if ($options) {
if (isset(
$options['product_calculations']
) &&
$options['product_calculations'] ==
\Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD
if (isset($options['product_calculations'])
&& $options['product_calculations'] == AbstractType::CALCULATE_CHILD
) {
return false;
} else {
Expand All @@ -180,9 +170,8 @@ public function isChildCalculated($item = null)

$options = $this->getOrderItem()->getProductOptions();
if ($options) {
if (isset(
$options['product_calculations']
) && $options['product_calculations'] == \Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD
if (isset($options['product_calculations'])
&& $options['product_calculations'] == AbstractType::CALCULATE_CHILD
) {
return true;
}
Expand All @@ -208,10 +197,9 @@ public function getSelectionAttributes($item)
}

/**
* @param mixed $item
* @return array
*/
public function getOrderOptions($item = null)
public function getOrderOptions()
{
$result = array();
$options = $this->getOrderItem()->getProductOptions();
Expand Down Expand Up @@ -269,8 +257,8 @@ public function getValueHtml($item)
*/
public function canShowPriceInfo($item)
{
if ($item->getOrderItem()->getParentItem() && $this->isChildCalculated() ||
!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated()
if ($item->getOrderItem()->getParentItem() && $this->isChildCalculated()
|| !$item->getOrderItem()->getParentItem() && !$this->isChildCalculated()
) {
return true;
}
Expand Down
Loading

0 comments on commit cf6ae36

Please sign in to comment.