Skip to content

Commit a6a11ba

Browse files
committed
Import Magento Release 1.8.1.0
1 parent 94e611e commit a6a11ba

File tree

398 files changed

+12758
-17409
lines changed

Some content is hidden

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

398 files changed

+12758
-17409
lines changed

app/Mage.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
/**
4040
* Set include path
4141
*/
42+
$paths = array();
4243
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'local';
4344
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'community';
4445
$paths[] = BP . DS . 'app' . DS . 'code' . DS . 'core';
@@ -169,7 +170,7 @@ public static function getVersionInfo()
169170
return array(
170171
'major' => '1',
171172
'minor' => '8',
172-
'revision' => '0',
173+
'revision' => '1',
173174
'patch' => '0',
174175
'stability' => '',
175176
'number' => '',

app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Addresses.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ public function initForm()
135135
$this->_setFieldset($attributes, $fieldset);
136136

137137
$regionElement = $form->getElement('region');
138-
$regionElement->setRequired(true);
139138
if ($regionElement) {
139+
$isRequired = Mage::helper('directory')->isRegionRequired($addressModel->getCountryId());
140+
$regionElement->setRequired($isRequired);
140141
$regionElement->setRenderer(Mage::getModel('adminhtml/customer_renderer_region'));
141142
}
142143

app/code/core/Mage/Adminhtml/Block/Review/Edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function __construct()
7777
'delete',
7878
'onclick',
7979
'deleteConfirm('
80-
. '\'' . Mage::helper('review')->__('Are you sure you want to do this?').'\' '
80+
. '\'' . Mage::helper('review')->__('Are you sure you want to do this?').'\', '
8181
. '\'' . $this->getUrl(
8282
'*/*/delete',
8383
array(

app/code/core/Mage/Adminhtml/Block/Review/Rating/Detailed.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,19 @@ public function getRating()
7171
$ratingCollection = Mage::getModel('rating/rating')
7272
->getResourceCollection()
7373
->addEntityFilter('product')
74-
->setStoreFilter(null)
74+
->setStoreFilter(Mage::app()->getStore('default')->getId())
7575
->setPositionOrder()
7676
->load()
7777
->addOptionToItems();
7878
} else {
7979
$ratingCollection = Mage::getModel('rating/rating')
8080
->getResourceCollection()
8181
->addEntityFilter('product')
82-
->setStoreFilter($this->getRequest()->getParam('select_stores') ? $this->getRequest()->getParam('select_stores') : $this->getRequest()->getParam('stores'))
82+
->setStoreFilter(
83+
$this->getRequest()->getParam('select_stores')
84+
? $this->getRequest()->getParam('select_stores')
85+
: $this->getRequest()->getParam('stores')
86+
)
8387
->setPositionOrder()
8488
->load()
8589
->addOptionToItems();

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public function __construct()
4747
$customerId = $this->_getSession()->getCustomerId();
4848
$storeId = $this->_getSession()->getStoreId();
4949

50-
5150
$this->_updateButton('save', 'label', Mage::helper('sales')->__('Submit Order'));
5251
$this->_updateButton('save', 'onclick', "order.submit()");
5352
$this->_updateButton('save', 'id', 'submit_order_top_button');
@@ -60,7 +59,7 @@ public function __construct()
6059

6160
$this->_updateButton('reset', 'id', 'reset_order_top_button');
6261

63-
if (is_null($customerId)) {
62+
if (!$this->_isCanCancel() || is_null($customerId)) {
6463
$this->_updateButton('reset', 'style', 'display:none');
6564
} else {
6665
$this->_updateButton('back', 'style', 'display:none');
@@ -72,6 +71,16 @@ public function __construct()
7271
$this->_updateButton('reset', 'onclick', 'deleteConfirm(\''.$confirm.'\', \'' . $this->getCancelUrl() . '\')');
7372
}
7473

74+
/**
75+
* Check access for cancel action
76+
*
77+
* @return boolean
78+
*/
79+
protected function _isCanCancel()
80+
{
81+
return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel');
82+
}
83+
7584
/**
7685
* Prepare header html
7786
*

app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,17 +204,11 @@ public function getSubtotalWithDiscount()
204204
{
205205
$address = $this->getQuoteAddress();
206206
if ($this->displayTotalsIncludeTax()) {
207-
if ($this->getIsPriceInclTax()) {
208-
return $address->getSubtotalInclTax() + $this->getDiscountAmount();
209-
} else {
210-
return $address->getSubtotal() + $address->getTaxAmount() + $this->getDiscountAmount();
211-
}
207+
$subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount()
208+
+ $address->getHiddenTaxAmount() + $this->getDiscountAmount();
209+
return $subtotalInclTax;
212210
} else {
213-
if ($this->getIsPriceInclTax()) {
214-
return $address->getSubtotalInclTax() - $address->getTaxAmount() + $this->getDiscountAmount();
215-
} else {
216-
return $address->getSubtotal() + $this->getDiscountAmount();
217-
}
211+
return $address->getSubtotal() + $this->getDiscountAmount();
218212
}
219213
}
220214

app/code/core/Mage/Adminhtml/Block/System/Store/Grid.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* @category Mage
3232
* @package Mage_Adminhtml
3333
* @author Magento Core Team <core@magentocommerce.com>
34+
* @deprecated after 1.13.1.0 use Mage_Adminhtml_Block_System_Store_Tree
3435
*/
3536
class Mage_Adminhtml_Block_System_Store_Grid extends Mage_Adminhtml_Block_Widget_Grid
3637
{

app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Group.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @category Mage
3131
* @package Mage_Adminhtml
3232
* @author Magento Core Team <core@magentocommerce.com>
33+
* @deprecated after 1.13.1.0 use Mage_Adminhtml_Block_System_Store_Tree
3334
*/
3435

3536
class Mage_Adminhtml_Block_System_Store_Grid_Render_Group

app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Store.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @category Mage
3131
* @package Mage_Adminhtml
3232
* @author Magento Core Team <core@magentocommerce.com>
33+
* @deprecated after 1.13.1.0 use Mage_Adminhtml_Block_System_Store_Tree
3334
*/
3435

3536
class Mage_Adminhtml_Block_System_Store_Grid_Render_Store

app/code/core/Mage/Adminhtml/Block/System/Store/Grid/Render/Website.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @category Mage
3131
* @package Mage_Adminhtml
3232
* @author Magento Core Team <core@magentocommerce.com>
33+
* @deprecated after 1.13.1.0 use Mage_Adminhtml_Block_System_Store_Tree
3334
*/
3435

3536
class Mage_Adminhtml_Block_System_Store_Grid_Render_Website

app/code/core/Mage/Adminhtml/Block/System/Store/Store.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,24 @@
3232
* @author Magento Core Team <core@magentocommerce.com>
3333
*/
3434

35-
class Mage_Adminhtml_Block_System_Store_Store extends Mage_Adminhtml_Block_Widget_Grid_Container
35+
class Mage_Adminhtml_Block_System_Store_Store extends Mage_Adminhtml_Block_Widget_Container
3636
{
3737
public function __construct()
3838
{
3939
$this->_controller = 'system_store';
4040
$this->_headerText = Mage::helper('adminhtml')->__('Manage Stores');
41+
$this->setTemplate('system/store/container.phtml');
4142
parent::__construct();
4243
}
4344

4445
protected function _prepareLayout()
4546
{
46-
/* Update default add button to add website button */
47-
$this->_updateButton('add', 'label', Mage::helper('core')->__('Create Website'));
48-
$this->_updateButton('add', 'onclick', "setLocation('".$this->getUrl('*/*/newWebsite')."')");
47+
/* Add website button */
48+
$this->_addButton('add', array(
49+
'label' => Mage::helper('core')->__('Create Website'),
50+
'onclick' => 'setLocation(\'' . $this->getUrl('*/*/newWebsite') .'\')',
51+
'class' => 'add',
52+
));
4953

5054
/* Add Store Group button */
5155
$this->_addButton('add_group', array(
@@ -64,6 +68,21 @@ protected function _prepareLayout()
6468
return parent::_prepareLayout();
6569
}
6670

71+
/**
72+
* Retrieve grid
73+
*
74+
* @return string
75+
*/
76+
public function getGridHtml()
77+
{
78+
return $this->getLayout()->createBlock('adminhtml/system_store_tree')->toHtml();
79+
}
80+
81+
/**
82+
* Retrieve buttons
83+
*
84+
* @return string
85+
*/
6786
public function getAddNewButtonHtml()
6887
{
6988
return join(' ', array(
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?php
2+
/**
3+
* Magento
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to license@magentocommerce.com so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade Magento to newer
18+
* versions in the future. If you wish to customize Magento for your
19+
* needs please refer to http://www.magentocommerce.com for more information.
20+
*
21+
* @category Mage
22+
* @package Mage_Adminhtml
23+
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25+
*/
26+
27+
28+
/**
29+
* Adminhtml store tree
30+
*
31+
* @category Mage
32+
* @package Mage_Adminhtml
33+
* @author Magento Core Team <core@magentocommerce.com>
34+
*/
35+
class Mage_Adminhtml_Block_System_Store_Tree extends Mage_Adminhtml_Block_Widget
36+
{
37+
/**
38+
* Cell Template
39+
*
40+
* @var Mage_Adminhtml_Block_Template
41+
*/
42+
protected $_cellTemplate;
43+
44+
/**
45+
* Internal constructor, that is called from real constructor
46+
*/
47+
public function _construct()
48+
{
49+
$this->setTemplate('system/store/tree.phtml');
50+
parent::_construct();
51+
}
52+
53+
/**
54+
* Prepare block layout
55+
*
56+
* @return Mage_Core_Block_Abstract
57+
*/
58+
protected function _prepareLayout()
59+
{
60+
$this->_cellTemplate = $this->getLayout()
61+
->createBlock('adminhtml/template')
62+
->setTemplate('system/store/cell.phtml');
63+
return parent::_prepareLayout();
64+
}
65+
66+
/**
67+
* Get table data
68+
*
69+
* @return array
70+
*/
71+
public function getTableData()
72+
{
73+
$data = array();
74+
foreach (Mage::getModel('core/website')->getCollection() as $website) {
75+
/** @var $website Mage_Core_Model_Website */
76+
$groupCollection = $website->getGroupCollection();
77+
$data[$website->getId()] = array(
78+
'object' => $website,
79+
'storeGroups' => array(),
80+
'count' => 0
81+
);
82+
$defaultGroupId = $website->getDefaultGroupId();
83+
foreach ($groupCollection as $storeGroup) {
84+
/** @var $storeGroup Mage_Core_Model_Store_Group */
85+
$storeCollection = $storeGroup->getStoreCollection();
86+
$storeGroupCount = max(1, $storeCollection->count());
87+
$data[$website->getId()]['storeGroups'][$storeGroup->getId()] = array(
88+
'object' => $storeGroup,
89+
'stores' => array(),
90+
'count' => $storeGroupCount
91+
);
92+
$data[$website->getId()]['count'] += $storeGroupCount;
93+
if ($storeGroup->getId() == $defaultGroupId) {
94+
$storeGroup->setData('is_default', true);
95+
}
96+
$defaultStoreId = $storeGroup->getDefaultStoreId();
97+
foreach ($storeCollection as $store) {
98+
/** @var $store Mage_Core_Model_Store */
99+
$data[$website->getId()]['storeGroups'][$storeGroup->getId()]['stores'][$store->getId()] = array(
100+
'object' => $store
101+
);
102+
if ($store->getId() == $defaultStoreId) {
103+
$store->setData('is_default', true);
104+
}
105+
}
106+
}
107+
108+
$data[$website->getId()]['count'] = max(1, $data[$website->getId()]['count']);
109+
}
110+
return $data;
111+
}
112+
113+
/**
114+
* Create new cell template
115+
*
116+
* @return Mage_Adminhtml_Block_Template
117+
*/
118+
protected function _createCellTemplate()
119+
{
120+
return clone($this->_cellTemplate);
121+
}
122+
123+
/**
124+
* Render website
125+
*
126+
* @param Mage_Core_Model_Website $website
127+
* @return string
128+
*/
129+
public function renderWebsite(Mage_Core_Model_Website $website)
130+
{
131+
return $this->_createCellTemplate()
132+
->setObject($website)
133+
->setLinkUrl($this->getUrl('*/*/editWebsite', array('website_id' => $website->getWebsiteId())))
134+
->setInfo($this->__('Code') . ': ' . $this->escapeHtml($website->getCode()))
135+
->toHtml();
136+
}
137+
138+
/**
139+
* Render store group
140+
*
141+
* @param Mage_Core_Model_Store_Group $storeGroup
142+
* @return string
143+
*/
144+
public function renderStoreGroup(Mage_Core_Model_Store_Group $storeGroup)
145+
{
146+
$rootCategory = Mage::getModel('catalog/category')->load($storeGroup->getRootCategoryId());
147+
return $this->_createCellTemplate()
148+
->setObject($storeGroup)
149+
->setLinkUrl($this->getUrl('*/*/editGroup', array('group_id' => $storeGroup->getGroupId())))
150+
->setInfo($this->__('Root Category') . ': ' . $this->escapeHtml($rootCategory->getName()))
151+
->toHtml();
152+
}
153+
154+
/**
155+
* Render store
156+
*
157+
* @param Mage_Core_Model_Store $store
158+
* @return string
159+
*/
160+
public function renderStore(Mage_Core_Model_Store $store)
161+
{
162+
$cell = $this->_createCellTemplate()
163+
->setObject($store)
164+
->setLinkUrl($this->getUrl('*/*/editStore', array('store_id' => $store->getStoreId())))
165+
->setInfo($this->__('Code') . ': ' . $this->escapeHtml($store->getCode()));
166+
if (!$store->getIsActive()) {
167+
$cell->setClass('strike');
168+
}
169+
return $cell->toHtml();
170+
}
171+
172+
}

0 commit comments

Comments
 (0)