Skip to content

Commit 0c3e67e

Browse files
committed
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](#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
1 parent 93f38e9 commit 0c3e67e

File tree

584 files changed

+68436
-2398
lines changed

Some content is hidden

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

584 files changed

+68436
-2398
lines changed

CHANGELOG.markdown

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
Update as of 6/20/2012
2+
=====================
3+
* Implemented locale translation inheritance
4+
* Implemented new format for exporting customer data
5+
* Added initial Javascript code for globalization and localization
6+
* Added initial Javascript unit tests
7+
* Implemented file signature for urls of static files - better CDN support
8+
* Implemented optional tracking of changes in view files fallback - cached by default, tracked in developer mode
9+
* Introduced `@magentoDbIsolation` annotation in integration tests - isolates DB modifications made by tests
10+
* Started refactoring of Visual Design Editor Javascript architecture
11+
* Github requests:
12+
* [#25](https://github.com/magento/magento2/issues/25) Removed unused `Mage_Core_Block_Abstract::getHelper()` method
13+
* Fixed:
14+
* "$_FILES array is empty" messages in exception log upon installation
15+
* Long attribute table aliases, that were producing errors at DB with lower identifier limitation than MySQL
16+
* Watermark opacity function did not work with ImageMagick
17+
* `Magento_Test_TestCase_ControllerAbstract::assertRedirect` was used in a wrong way
18+
* Inability to reorder a downloadable product
19+
* ACL tables aliases interference with other table aliases
20+
* Several tests are made incomplete temporary, appropriate bugs to be fixed in the nearest future
21+
122
Update as of 6/7/2012
223
=====================
324
* Fixed various crashes of visual design editor

app/code/community/Phoenix/Moneybookers/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function activateEmail()
5454
$translate->setTranslateInline(false);
5555

5656
Mage::getModel('Mage_Core_Model_Email_Template')
57-
->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
57+
->setDesignConfig(array('area' => Mage_Core_Model_App_Area::AREA_FRONTEND, 'store' => $storeId))
5858
->sendTransactional(
5959
'moneybookers_activateemail',
6060
Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $storeId),

app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php

Lines changed: 36 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -262,42 +262,28 @@ public function setQuote(Mage_Sales_Model_Quote $quote)
262262
* Initialize creation data from existing order
263263
*
264264
* @param Mage_Sales_Model_Order $order
265-
* @return unknown
265+
* @return Mage_Adminhtml_Model_Sales_Order_Create
266266
*/
267267
public function initFromOrder(Mage_Sales_Model_Order $order)
268268
{
269-
if (!$order->getReordered()) {
270-
$this->getSession()->setOrderId($order->getId());
271-
} else {
272-
$this->getSession()->setReordered($order->getId());
273-
}
274-
275-
/**
276-
* Check if we edit quest order
277-
*/
278-
$this->getSession()->setCurrencyId($order->getOrderCurrencyCode());
279-
if ($order->getCustomerId()) {
280-
$this->getSession()->setCustomerId($order->getCustomerId());
281-
} else {
282-
$this->getSession()->setCustomerId(false);
283-
}
284-
285-
$this->getSession()->setStoreId($order->getStoreId());
286-
287-
/**
288-
* Initialize catalog rule data with new session values
289-
*/
269+
$session = $this->getSession();
270+
$session->setData($order->getReordered() ? 'reordered' : 'order_id', $order->getId());
271+
$session->setCurrencyId($order->getOrderCurrencyCode());
272+
/* Check if we edit guest order */
273+
$session->setCustomerId($order->getCustomerId() ?: false);
274+
$session->setStoreId($order->getStoreId());
275+
276+
/* Initialize catalog rule data with new session values */
290277
$this->initRuleData();
291278
foreach ($order->getItemsCollection(
292279
array_keys(Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray()),
293280
true
294-
) as $orderItem) {
281+
) as $orderItem) {
295282
/* @var $orderItem Mage_Sales_Model_Order_Item */
296283
if (!$orderItem->getParentItem()) {
297-
if ($order->getReordered()) {
298-
$qty = $orderItem->getQtyOrdered();
299-
} else {
300-
$qty = $orderItem->getQtyOrdered() - $orderItem->getQtyShipped() - $orderItem->getQtyInvoiced();
284+
$qty = $orderItem->getQtyOrdered();
285+
if (!$order->getReordered()) {
286+
$qty -= $orderItem->getQtyShipped() + $orderItem->getQtyInvoiced();
301287
}
302288

303289
if ($qty > 0) {
@@ -309,52 +295,44 @@ public function initFromOrder(Mage_Sales_Model_Order $order)
309295
}
310296
}
311297

312-
$addressDiff = array_diff_assoc(
313-
$order->getShippingAddress()->getData(),
314-
$order->getBillingAddress()->getData()
315-
);
316-
unset($addressDiff['address_type'], $addressDiff['entity_id']);
317-
$order->getShippingAddress()->setSameAsBilling(empty($addressDiff));
298+
$shippingAddress = $order->getShippingAddress();
299+
if ($shippingAddress) {
300+
$addressDiff = array_diff_assoc($shippingAddress->getData(), $order->getBillingAddress()->getData());
301+
unset($addressDiff['address_type'], $addressDiff['entity_id']);
302+
$shippingAddress->setSameAsBilling(empty($addressDiff));
303+
}
318304

319305
$this->_initBillingAddressFromOrder($order);
320306
$this->_initShippingAddressFromOrder($order);
321307

322-
if (!$this->getQuote()->isVirtual() && $this->getShippingAddress()->getSameAsBilling()) {
308+
$quote = $this->getQuote();
309+
if (!$quote->isVirtual() && $this->getShippingAddress()->getSameAsBilling()) {
323310
$this->setShippingAsBilling(1);
324311
}
325312

326313
$this->setShippingMethod($order->getShippingMethod());
327-
$this->getQuote()->getShippingAddress()->setShippingDescription($order->getShippingDescription());
328-
329-
$this->getQuote()->getPayment()->addData($order->getPayment()->getData());
314+
$quote->getShippingAddress()->setShippingDescription($order->getShippingDescription());
330315

316+
$quote->getPayment()->addData($order->getPayment()->getData());
331317

332318
$orderCouponCode = $order->getCouponCode();
333319
if ($orderCouponCode) {
334-
$this->getQuote()->setCouponCode($orderCouponCode);
320+
$quote->setCouponCode($orderCouponCode);
335321
}
336322

337-
if ($this->getQuote()->getCouponCode()) {
338-
$this->getQuote()->collectTotals();
323+
if ($quote->getCouponCode()) {
324+
$quote->collectTotals();
339325
}
340326

341-
Mage::helper('Mage_Core_Helper_Data')->copyFieldset(
342-
'sales_copy_order',
343-
'to_edit',
344-
$order,
345-
$this->getQuote()
346-
);
327+
Mage::helper('Mage_Core_Helper_Data')->copyFieldset('sales_copy_order', 'to_edit', $order, $quote);
347328

348-
Mage::dispatchEvent('sales_convert_order_to_quote', array(
349-
'order' => $order,
350-
'quote' => $this->getQuote()
351-
));
329+
Mage::dispatchEvent('sales_convert_order_to_quote', array('order' => $order, 'quote' => $quote));
352330

353331
if (!$order->getCustomerId()) {
354-
$this->getQuote()->setCustomerIsGuest(true);
332+
$quote->setCustomerIsGuest(true);
355333
}
356334

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

372-
// Make collect rates when user click "Get shipping methods and rates" in order creating
373-
// $this->getQuote()->getShippingAddress()->setCollectShippingRates(true);
374-
// $this->getQuote()->getShippingAddress()->collectShippingRates();
375-
376-
$this->getQuote()->save();
350+
$quote->save();
377351

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

392366
protected function _initShippingAddressFromOrder(Mage_Sales_Model_Order $order)
393367
{
394-
$this->getQuote()->getShippingAddress()
368+
$orderShippingAddress = $order->getShippingAddress();
369+
$quoteShippingAddress = $this->getQuote()->getShippingAddress()
395370
->setCustomerAddressId('')
396-
->setSameAsBilling($order->getShippingAddress()->getSameAsBilling());
371+
->setSameAsBilling($orderShippingAddress && $orderShippingAddress->getSameAsBilling());
397372
Mage::helper('Mage_Core_Helper_Data')->copyFieldset(
398373
'sales_copy_order_shipping_address',
399374
'to_order',
400-
$order->getShippingAddress(),
401-
$this->getQuote()->getShippingAddress()
375+
$orderShippingAddress,
376+
$quoteShippingAddress
402377
);
403378
}
404379

app/code/core/Mage/Adminhtml/Model/System/Config/Source/Image/Adapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function toOptionArray()
3636
{
3737
return array(
3838
Varien_Image_Adapter::ADAPTER_IM => Mage::helper('Mage_Adminhtml_Helper_Data')->__('ImageMagick'),
39-
Varien_Image_Adapter::ADAPTER_GD2 => Mage::helper('Mage_Adminhtml_Helper_Data')->__('PHP Gd 2'),
39+
Varien_Image_Adapter::ADAPTER_GD2 => Mage::helper('Mage_Adminhtml_Helper_Data')->__('PHP GD2'),
4040
);
4141
}
4242
}

app/code/core/Mage/Api2/Model/Resource/Acl/Global/Role/Collection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public function addFilterByAdminId($id)
5353
{
5454
$this->getSelect()
5555
->joinInner(
56-
array('user' => $this->getTable('api2_acl_user')),
57-
'main_table.entity_id = user.role_id',
58-
array('admin_id' => 'user.admin_id'))
59-
->where('user.admin_id = ?', $id, Zend_Db::INT_TYPE);
56+
array('acl_global_role_user' => $this->getTable('api2_acl_user')),
57+
'main_table.entity_id = acl_global_role_user.role_id',
58+
array('admin_id' => 'acl_global_role_user.admin_id'))
59+
->where('acl_global_role_user.admin_id = ?', $id, Zend_Db::INT_TYPE);
6060

6161
return $this;
6262
}

app/code/core/Mage/Backend/view/adminhtml/widget/form/renderer/fieldset.phtml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@
2424
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
2525
*/
2626
?>
27+
<?php /** @var $_element Varien_Data_Form_Element_Fieldset */ ?>
2728
<?php $_element = $this->getElement() ?>
2829
<?php if ($_element->getFieldsetContainerId()): ?>
29-
<div id="<?php echo $_element->getFieldsetContainerId(); ?>">
30+
<div id="<?php echo $_element->getFieldsetContainerId(); ?>"<?php echo $_element->serialize(array('style')) ?>>
3031
<?php endif; ?>
3132
<?php if ($_element->getLegend()): ?>
32-
<div class="entry-edit-head">
33+
<div class="entry-edit-head"<?php echo $_element->serialize(array('style')) ?>
34+
id="head-<?php echo $_element->getHtmlId() ?>">
3335
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $_element->getLegend() ?></h4>
3436
<div class="form-buttons"><?php echo $_element->getHeaderBar() ?></div>
3537
</div>
3638
<?php endif; ?>
3739
<?php if (!$_element->getNoContainer()): ?>
38-
<div class="fieldset <?php echo $_element->getClass() ?>" id="<?php echo $_element->getHtmlId() ?>">
40+
<div class="fieldset <?php echo $_element->getClass() ?>" id="<?php echo $_element->getHtmlId() ?>"
41+
<?php echo $_element->serialize(array('style')) ?>>
3942
<?php endif; ?>
4043
<div class="hor-scroll">
4144
<?php if ($_element->getComment()): ?>

app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Image.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,22 @@ class Mage_Catalog_Model_Category_Attribute_Backend_Image extends Mage_Eav_Model
3939
* Save uploaded file and set its name to category
4040
*
4141
* @param Varien_Object $object
42+
* @return Mage_Catalog_Model_Category_Attribute_Backend_Image
4243
*/
4344
public function afterSave($object)
4445
{
4546
$value = $object->getData($this->getAttribute()->getName());
4647

48+
// if no image was set - nothing to do
49+
if (empty($value) && empty($_FILES)) {
50+
return $this;
51+
}
52+
4753
if (is_array($value) && !empty($value['delete'])) {
4854
$object->setData($this->getAttribute()->getName(), '');
4955
$this->getAttribute()->getEntity()
5056
->saveAttribute($object, $this->getAttribute()->getName());
51-
return;
57+
return $this;
5258
}
5359

5460
$path = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'category' . DS;
@@ -66,7 +72,7 @@ public function afterSave($object)
6672
Mage::logException($e);
6773
}
6874
/** @TODO ??? */
69-
return;
7075
}
76+
return $this;
7177
}
7278
}

app/code/core/Mage/Catalog/controllers/ProductController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
* @category Mage
3131
* @package Mage_Catalog
3232
*/
33-
class Mage_Catalog_ProductController extends Mage_Core_Controller_Front_Action
33+
class Mage_Catalog_ProductController
34+
extends Mage_Core_Controller_Front_Action
3435
implements Mage_Catalog_Controller_Product_View_Interface
3536
{
3637
/**
@@ -40,8 +41,8 @@ class Mage_Catalog_ProductController extends Mage_Core_Controller_Front_Action
4041
*/
4142
protected function _initProduct()
4243
{
43-
$categoryId = (int) $this->getRequest()->getParam('category', false);
44-
$productId = (int) $this->getRequest()->getParam('id');
44+
$categoryId = (int)$this->getRequest()->getParam('category', false);
45+
$productId = (int)$this->getRequest()->getParam('id');
4546

4647
$params = new Varien_Object();
4748
$params->setCategoryId($categoryId);

app/code/core/Mage/Checkout/Helper/Data.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,10 @@ public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'one
199199
$total = $checkout->getStoreCurrencyCode() . ' ' . $checkout->getGrandTotal();
200200

201201
foreach ($sendTo as $recipient) {
202-
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$checkout->getStoreId()))
202+
$mailTemplate->setDesignConfig(array(
203+
'area' => Mage_Core_Model_App_Area::AREA_FRONTEND,
204+
'store' => $checkout->getStoreId()
205+
))
203206
->sendTransactional(
204207
$template,
205208
Mage::getStoreConfig('checkout/payment_failed/identity', $checkout->getStoreId()),

app/code/core/Mage/Checkout/controllers/CartController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
/**
2828
* Shopping cart controller
2929
*/
30-
class Mage_Checkout_CartController extends Mage_Core_Controller_Front_Action
30+
class Mage_Checkout_CartController
31+
extends Mage_Core_Controller_Front_Action
3132
implements Mage_Catalog_Controller_Product_View_Interface
3233
{
3334
/**
@@ -293,7 +294,9 @@ public function configureAction()
293294
$params->setConfigureMode(true);
294295
$params->setBuyRequest($quoteItem->getBuyRequest());
295296

296-
Mage::helper('Mage_Catalog_Helper_Product_View')->prepareAndRender($quoteItem->getProduct()->getId(), $this, $params);
297+
Mage::helper('Mage_Catalog_Helper_Product_View')->prepareAndRender(
298+
$quoteItem->getProduct()->getId(), $this, $params
299+
);
297300
} catch (Exception $e) {
298301
$this->_getSession()->addError($this->__('Cannot configure product.'));
299302
Mage::logException($e);

app/code/core/Mage/Checkout/controllers/OnepageController.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,6 @@ public function saveOrderAction()
505505

506506
$data = $this->getRequest()->getPost('payment', array());
507507
if ($data) {
508-
if (!isset($data['method'])) {
509-
$data['method'] = 'free';
510-
}
511508
$data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
512509
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
513510
| Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY

app/code/core/Mage/Contacts/controllers/IndexController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ public function postAction()
9393
}
9494
$mailTemplate = Mage::getModel('Mage_Core_Model_Email_Template');
9595
/* @var $mailTemplate Mage_Core_Model_Email_Template */
96-
$mailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => Mage::app()->getStore()->getId()))
96+
$mailTemplate->setDesignConfig(array(
97+
'area' => Mage_Core_Model_App_Area::AREA_FRONTEND,
98+
'store' => Mage::app()->getStore()->getId()
99+
))
97100
->setReplyTo($post['email'])
98101
->sendTransactional(
99102
Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),

app/code/core/Mage/Core/Block/Abstract.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -708,21 +708,10 @@ public function setMessagesBlock(Mage_Core_Block_Messages $block)
708708
}
709709

710710
/**
711-
* Return block helper
712-
*
713-
* @param string $type
714-
* @return Mage_Core_Block_Abstract
715-
*/
716-
public function getHelper($type)
717-
{
718-
return $this->getLayout()->getBlockSingleton($type);
719-
}
720-
721-
/**
722-
* Returns helper object
711+
* Return helper object
723712
*
724713
* @param string $name
725-
* @return Mage_Core_Block_Abstract
714+
* @return Mage_Core_Helper_Abstract
726715
*/
727716
public function helper($name)
728717
{

app/code/core/Mage/Core/Block/Template.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ public function setTemplate($template)
121121
*/
122122
public function getTemplateFile()
123123
{
124-
$params = array('_module' => $this->getModuleName());
124+
$params = array('module' => $this->getModuleName());
125125
$area = $this->getArea();
126126
if ($area) {
127-
$params['_area'] = $area;
127+
$params['area'] = $area;
128128
}
129129
$templateName = Mage::getDesign()->getFilename($this->getTemplate(), $params);
130130
return $templateName;

0 commit comments

Comments
 (0)