Skip to content

Commit

Permalink
Update as of 6/20/2012
Browse files Browse the repository at this point in the history
* Implemented locale translation inheritance
* Implemented new format for exporting customer data
* Added initial Javascript code for globalization and localization
* Added initial Javascript unit tests
* Implemented file signature for urls of static files - better CDN support
* Implemented optional tracking of changes in view files fallback - cached by default, tracked in developer mode
* Introduced `@magentoDbIsolation` annotation in integration tests - isolates DB modifications made by tests
* Started refactoring of Visual Design Editor Javascript architecture
* Github requests:
  * [#25](#25) Removed unused `Mage_Core_Block_Abstract::getHelper()` method
* Fixed:
  * "$_FILES array is empty" messages in exception log upon installation
  * Long attribute table aliases, that were producing errors at DB with lower identifier limitation than MySQL
  * Watermark opacity function did not work with ImageMagick
  * `Magento_Test_TestCase_ControllerAbstract::assertRedirect` was used in a wrong way
  * Inability to reorder a downloadable product
  * ACL tables aliases interference with other table aliases
* Several tests are made incomplete temporary, appropriate bugs to be fixed in the nearest future
  • Loading branch information
magento-team committed Jun 21, 2012
1 parent 93f38e9 commit 0c3e67e
Show file tree
Hide file tree
Showing 584 changed files with 68,436 additions and 2,398 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
Update as of 6/20/2012
=====================
* Implemented locale translation inheritance
* Implemented new format for exporting customer data
* Added initial Javascript code for globalization and localization
* Added initial Javascript unit tests
* Implemented file signature for urls of static files - better CDN support
* Implemented optional tracking of changes in view files fallback - cached by default, tracked in developer mode
* Introduced `@magentoDbIsolation` annotation in integration tests - isolates DB modifications made by tests
* Started refactoring of Visual Design Editor Javascript architecture
* Github requests:
* [#25](https://github.com/magento/magento2/issues/25) Removed unused `Mage_Core_Block_Abstract::getHelper()` method
* Fixed:
* "$_FILES array is empty" messages in exception log upon installation
* Long attribute table aliases, that were producing errors at DB with lower identifier limitation than MySQL
* Watermark opacity function did not work with ImageMagick
* `Magento_Test_TestCase_ControllerAbstract::assertRedirect` was used in a wrong way
* Inability to reorder a downloadable product
* ACL tables aliases interference with other table aliases
* Several tests are made incomplete temporary, appropriate bugs to be fixed in the nearest future

Update as of 6/7/2012
=====================
* Fixed various crashes of visual design editor
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Phoenix/Moneybookers/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function activateEmail()
$translate->setTranslateInline(false);

Mage::getModel('Mage_Core_Model_Email_Template')
->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
->setDesignConfig(array('area' => Mage_Core_Model_App_Area::AREA_FRONTEND, 'store' => $storeId))
->sendTransactional(
'moneybookers_activateemail',
Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $storeId),
Expand Down
97 changes: 36 additions & 61 deletions app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,42 +262,28 @@ public function setQuote(Mage_Sales_Model_Quote $quote)
* Initialize creation data from existing order
*
* @param Mage_Sales_Model_Order $order
* @return unknown
* @return Mage_Adminhtml_Model_Sales_Order_Create
*/
public function initFromOrder(Mage_Sales_Model_Order $order)
{
if (!$order->getReordered()) {
$this->getSession()->setOrderId($order->getId());
} else {
$this->getSession()->setReordered($order->getId());
}

/**
* Check if we edit quest order
*/
$this->getSession()->setCurrencyId($order->getOrderCurrencyCode());
if ($order->getCustomerId()) {
$this->getSession()->setCustomerId($order->getCustomerId());
} else {
$this->getSession()->setCustomerId(false);
}

$this->getSession()->setStoreId($order->getStoreId());

/**
* Initialize catalog rule data with new session values
*/
$session = $this->getSession();
$session->setData($order->getReordered() ? 'reordered' : 'order_id', $order->getId());
$session->setCurrencyId($order->getOrderCurrencyCode());
/* Check if we edit guest order */
$session->setCustomerId($order->getCustomerId() ?: false);
$session->setStoreId($order->getStoreId());

/* Initialize catalog rule data with new session values */
$this->initRuleData();
foreach ($order->getItemsCollection(
array_keys(Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray()),
true
) as $orderItem) {
) as $orderItem) {
/* @var $orderItem Mage_Sales_Model_Order_Item */
if (!$orderItem->getParentItem()) {
if ($order->getReordered()) {
$qty = $orderItem->getQtyOrdered();
} else {
$qty = $orderItem->getQtyOrdered() - $orderItem->getQtyShipped() - $orderItem->getQtyInvoiced();
$qty = $orderItem->getQtyOrdered();
if (!$order->getReordered()) {
$qty -= $orderItem->getQtyShipped() + $orderItem->getQtyInvoiced();
}

if ($qty > 0) {
Expand All @@ -309,52 +295,44 @@ public function initFromOrder(Mage_Sales_Model_Order $order)
}
}

$addressDiff = array_diff_assoc(
$order->getShippingAddress()->getData(),
$order->getBillingAddress()->getData()
);
unset($addressDiff['address_type'], $addressDiff['entity_id']);
$order->getShippingAddress()->setSameAsBilling(empty($addressDiff));
$shippingAddress = $order->getShippingAddress();
if ($shippingAddress) {
$addressDiff = array_diff_assoc($shippingAddress->getData(), $order->getBillingAddress()->getData());
unset($addressDiff['address_type'], $addressDiff['entity_id']);
$shippingAddress->setSameAsBilling(empty($addressDiff));
}

$this->_initBillingAddressFromOrder($order);
$this->_initShippingAddressFromOrder($order);

if (!$this->getQuote()->isVirtual() && $this->getShippingAddress()->getSameAsBilling()) {
$quote = $this->getQuote();
if (!$quote->isVirtual() && $this->getShippingAddress()->getSameAsBilling()) {
$this->setShippingAsBilling(1);
}

$this->setShippingMethod($order->getShippingMethod());
$this->getQuote()->getShippingAddress()->setShippingDescription($order->getShippingDescription());

$this->getQuote()->getPayment()->addData($order->getPayment()->getData());
$quote->getShippingAddress()->setShippingDescription($order->getShippingDescription());

$quote->getPayment()->addData($order->getPayment()->getData());

$orderCouponCode = $order->getCouponCode();
if ($orderCouponCode) {
$this->getQuote()->setCouponCode($orderCouponCode);
$quote->setCouponCode($orderCouponCode);
}

if ($this->getQuote()->getCouponCode()) {
$this->getQuote()->collectTotals();
if ($quote->getCouponCode()) {
$quote->collectTotals();
}

Mage::helper('Mage_Core_Helper_Data')->copyFieldset(
'sales_copy_order',
'to_edit',
$order,
$this->getQuote()
);
Mage::helper('Mage_Core_Helper_Data')->copyFieldset('sales_copy_order', 'to_edit', $order, $quote);

Mage::dispatchEvent('sales_convert_order_to_quote', array(
'order' => $order,
'quote' => $this->getQuote()
));
Mage::dispatchEvent('sales_convert_order_to_quote', array('order' => $order, 'quote' => $quote));

if (!$order->getCustomerId()) {
$this->getQuote()->setCustomerIsGuest(true);
$quote->setCustomerIsGuest(true);
}

if ($this->getSession()->getUseOldShippingMethod(true)) {
if ($session->getUseOldShippingMethod(true)) {
/*
* if we are making reorder or editing old order
* we need to show old shipping as preselected
Expand All @@ -369,11 +347,7 @@ public function initFromOrder(Mage_Sales_Model_Order $order)
$this->collectRates();
}

// Make collect rates when user click "Get shipping methods and rates" in order creating
// $this->getQuote()->getShippingAddress()->setCollectShippingRates(true);
// $this->getQuote()->getShippingAddress()->collectShippingRates();

$this->getQuote()->save();
$quote->save();

return $this;
}
Expand All @@ -391,14 +365,15 @@ protected function _initBillingAddressFromOrder(Mage_Sales_Model_Order $order)

protected function _initShippingAddressFromOrder(Mage_Sales_Model_Order $order)
{
$this->getQuote()->getShippingAddress()
$orderShippingAddress = $order->getShippingAddress();
$quoteShippingAddress = $this->getQuote()->getShippingAddress()
->setCustomerAddressId('')
->setSameAsBilling($order->getShippingAddress()->getSameAsBilling());
->setSameAsBilling($orderShippingAddress && $orderShippingAddress->getSameAsBilling());
Mage::helper('Mage_Core_Helper_Data')->copyFieldset(
'sales_copy_order_shipping_address',
'to_order',
$order->getShippingAddress(),
$this->getQuote()->getShippingAddress()
$orderShippingAddress,
$quoteShippingAddress
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function toOptionArray()
{
return array(
Varien_Image_Adapter::ADAPTER_IM => Mage::helper('Mage_Adminhtml_Helper_Data')->__('ImageMagick'),
Varien_Image_Adapter::ADAPTER_GD2 => Mage::helper('Mage_Adminhtml_Helper_Data')->__('PHP Gd 2'),
Varien_Image_Adapter::ADAPTER_GD2 => Mage::helper('Mage_Adminhtml_Helper_Data')->__('PHP GD2'),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public function addFilterByAdminId($id)
{
$this->getSelect()
->joinInner(
array('user' => $this->getTable('api2_acl_user')),
'main_table.entity_id = user.role_id',
array('admin_id' => 'user.admin_id'))
->where('user.admin_id = ?', $id, Zend_Db::INT_TYPE);
array('acl_global_role_user' => $this->getTable('api2_acl_user')),
'main_table.entity_id = acl_global_role_user.role_id',
array('admin_id' => 'acl_global_role_user.admin_id'))
->where('acl_global_role_user.admin_id = ?', $id, Zend_Db::INT_TYPE);

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php /** @var $_element Varien_Data_Form_Element_Fieldset */ ?>
<?php $_element = $this->getElement() ?>
<?php if ($_element->getFieldsetContainerId()): ?>
<div id="<?php echo $_element->getFieldsetContainerId(); ?>">
<div id="<?php echo $_element->getFieldsetContainerId(); ?>"<?php echo $_element->serialize(array('style')) ?>>
<?php endif; ?>
<?php if ($_element->getLegend()): ?>
<div class="entry-edit-head">
<div class="entry-edit-head"<?php echo $_element->serialize(array('style')) ?>
id="head-<?php echo $_element->getHtmlId() ?>">
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $_element->getLegend() ?></h4>
<div class="form-buttons"><?php echo $_element->getHeaderBar() ?></div>
</div>
<?php endif; ?>
<?php if (!$_element->getNoContainer()): ?>
<div class="fieldset <?php echo $_element->getClass() ?>" id="<?php echo $_element->getHtmlId() ?>">
<div class="fieldset <?php echo $_element->getClass() ?>" id="<?php echo $_element->getHtmlId() ?>"
<?php echo $_element->serialize(array('style')) ?>>
<?php endif; ?>
<div class="hor-scroll">
<?php if ($_element->getComment()): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,22 @@ class Mage_Catalog_Model_Category_Attribute_Backend_Image extends Mage_Eav_Model
* Save uploaded file and set its name to category
*
* @param Varien_Object $object
* @return Mage_Catalog_Model_Category_Attribute_Backend_Image
*/
public function afterSave($object)
{
$value = $object->getData($this->getAttribute()->getName());

// if no image was set - nothing to do
if (empty($value) && empty($_FILES)) {
return $this;
}

if (is_array($value) && !empty($value['delete'])) {
$object->setData($this->getAttribute()->getName(), '');
$this->getAttribute()->getEntity()
->saveAttribute($object, $this->getAttribute()->getName());
return;
return $this;
}

$path = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'category' . DS;
Expand All @@ -66,7 +72,7 @@ public function afterSave($object)
Mage::logException($e);
}
/** @TODO ??? */
return;
}
return $this;
}
}
7 changes: 4 additions & 3 deletions app/code/core/Mage/Catalog/controllers/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
* @category Mage
* @package Mage_Catalog
*/
class Mage_Catalog_ProductController extends Mage_Core_Controller_Front_Action
class Mage_Catalog_ProductController
extends Mage_Core_Controller_Front_Action
implements Mage_Catalog_Controller_Product_View_Interface
{
/**
Expand All @@ -40,8 +41,8 @@ class Mage_Catalog_ProductController extends Mage_Core_Controller_Front_Action
*/
protected function _initProduct()
{
$categoryId = (int) $this->getRequest()->getParam('category', false);
$productId = (int) $this->getRequest()->getParam('id');
$categoryId = (int)$this->getRequest()->getParam('category', false);
$productId = (int)$this->getRequest()->getParam('id');

$params = new Varien_Object();
$params->setCategoryId($categoryId);
Expand Down
5 changes: 4 additions & 1 deletion app/code/core/Mage/Checkout/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'one
$total = $checkout->getStoreCurrencyCode() . ' ' . $checkout->getGrandTotal();

foreach ($sendTo as $recipient) {
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$checkout->getStoreId()))
$mailTemplate->setDesignConfig(array(
'area' => Mage_Core_Model_App_Area::AREA_FRONTEND,
'store' => $checkout->getStoreId()
))
->sendTransactional(
$template,
Mage::getStoreConfig('checkout/payment_failed/identity', $checkout->getStoreId()),
Expand Down
7 changes: 5 additions & 2 deletions app/code/core/Mage/Checkout/controllers/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
/**
* Shopping cart controller
*/
class Mage_Checkout_CartController extends Mage_Core_Controller_Front_Action
class Mage_Checkout_CartController
extends Mage_Core_Controller_Front_Action
implements Mage_Catalog_Controller_Product_View_Interface
{
/**
Expand Down Expand Up @@ -293,7 +294,9 @@ public function configureAction()
$params->setConfigureMode(true);
$params->setBuyRequest($quoteItem->getBuyRequest());

Mage::helper('Mage_Catalog_Helper_Product_View')->prepareAndRender($quoteItem->getProduct()->getId(), $this, $params);
Mage::helper('Mage_Catalog_Helper_Product_View')->prepareAndRender(
$quoteItem->getProduct()->getId(), $this, $params
);
} catch (Exception $e) {
$this->_getSession()->addError($this->__('Cannot configure product.'));
Mage::logException($e);
Expand Down
3 changes: 0 additions & 3 deletions app/code/core/Mage/Checkout/controllers/OnepageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,6 @@ public function saveOrderAction()

$data = $this->getRequest()->getPost('payment', array());
if ($data) {
if (!isset($data['method'])) {
$data['method'] = 'free';
}
$data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
Expand Down
5 changes: 4 additions & 1 deletion app/code/core/Mage/Contacts/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ public function postAction()
}
$mailTemplate = Mage::getModel('Mage_Core_Model_Email_Template');
/* @var $mailTemplate Mage_Core_Model_Email_Template */
$mailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => Mage::app()->getStore()->getId()))
$mailTemplate->setDesignConfig(array(
'area' => Mage_Core_Model_App_Area::AREA_FRONTEND,
'store' => Mage::app()->getStore()->getId()
))
->setReplyTo($post['email'])
->sendTransactional(
Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
Expand Down
15 changes: 2 additions & 13 deletions app/code/core/Mage/Core/Block/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -708,21 +708,10 @@ public function setMessagesBlock(Mage_Core_Block_Messages $block)
}

/**
* Return block helper
*
* @param string $type
* @return Mage_Core_Block_Abstract
*/
public function getHelper($type)
{
return $this->getLayout()->getBlockSingleton($type);
}

/**
* Returns helper object
* Return helper object
*
* @param string $name
* @return Mage_Core_Block_Abstract
* @return Mage_Core_Helper_Abstract
*/
public function helper($name)
{
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Core/Block/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ public function setTemplate($template)
*/
public function getTemplateFile()
{
$params = array('_module' => $this->getModuleName());
$params = array('module' => $this->getModuleName());
$area = $this->getArea();
if ($area) {
$params['_area'] = $area;
$params['area'] = $area;
}
$templateName = Mage::getDesign()->getFilename($this->getTemplate(), $params);
return $templateName;
Expand Down
Loading

0 comments on commit 0c3e67e

Please sign in to comment.