Skip to content

Commit

Permalink
Import Magento Release 1.6.0.0-rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeSaferite committed Jul 23, 2011
1 parent 613dace commit 6cea604
Show file tree
Hide file tree
Showing 140 changed files with 2,193 additions and 549 deletions.
219 changes: 219 additions & 0 deletions RELEASE_NOTES.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static function getVersionInfo()
'revision' => '0',
'patch' => '0',
'stability' => 'rc',
'number' => '1',
'number' => '2',
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ protected function _prepareLayout()

if ($this->_getProduct()->getId()) {
$this->setChild('simple',
$this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_super_config_simple')
$this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_super_config_simple',
'catalog.product.edit.tab.super.config.simple')
);

$this->setChild('create_from_configurable',
Expand Down
7 changes: 7 additions & 0 deletions app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ protected function _prepareCollection()

$storeIds = $this->_getStoreIds();;

$orderStatuses = $filterData->getData('order_statuses');
if (is_array($orderStatuses)) {
if (count($orderStatuses) == 1 && strpos($orderStatuses[0],',')!== false) {
$filterData->setData('order_statuses', explode(',',$orderStatuses[0]));
}
}

$resourceCollection = Mage::getResourceModel($this->getResourceCollectionName())
->setPeriod($filterData->getData('period_type'))
->setDateRange($filterData->getData('from', null), $filterData->getData('to', null))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,21 @@ public function hasMethods()
*/
public function getSelectedMethodCode()
{
if ($currentMethodCode = $this->getQuote()->getPayment()->getMethod()) {
return $currentMethodCode;
}
if (count($this->getMethods()) == 1) {
foreach ($this->getMethods() as $method) {
// One available method. Return this method as selected, because no other variant is possible.
$methods = $this->getMethods();
if (count($methods) == 1) {
foreach ($methods as $method) {
return $method->getCode();
}
}

// Several methods. If user has selected some method - then return it.
$currentMethodCode = $this->getQuote()->getPayment()->getMethod();
if ($currentMethodCode) {
return $currentMethodCode;
}

// Several methods, but no preference for one of them.
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ public function getIsAsBilling()
return $this->getCreateOrderModel()->getShippingAddress()->getSameAsBilling();
}

/**
* Saving shipping address must be turned off, when it is the same as billing
*
* @return bool
*/
public function getDontSaveInAddressBook()
{
return $this->getIsAsBilling();
}

/**
* Return Form Elements values
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function getConfigDataJson()
$itemsGridUrl = $this->getUrl('*/sales_order_shipment/getShippingItemsGrid', $urlParams);

foreach ($this->getShipment()->getAllItems() as $item) {
$itemsQty[$item->getOrderItemId()] = $item->getOrderItem()->getQtyOrdered()*1;
$itemsQty[$item->getOrderItemId()] = $item->getQty()*1;
$itemsPrice[$item->getOrderItemId()] = $item->getPrice();
$itemsName[$item->getOrderItemId()] = $item->getName();
$itemsWeight[$item->getOrderItemId()] = $item->getWeight();
Expand Down Expand Up @@ -166,7 +166,8 @@ public function getDeliveryConfirmationTypeByCode($code)
$countryId = $this->getShipment()->getOrder()->getShippingAddress()->getCountryId();
$carrier = $this->getShipment()->getOrder()->getShippingCarrier();
if ($carrier) {
$confirmationTypes = $carrier->getDeliveryConfirmationTypes($countryId);
$params = new Varien_Object(array('country_recipient' => $countryId));
$confirmationTypes = $carrier->getDeliveryConfirmationTypes($params);
$confirmationType = !empty($confirmationTypes[$code]) ? $confirmationTypes[$code] : '';
return $confirmationType;
}
Expand Down Expand Up @@ -218,18 +219,13 @@ public function displayCustomsValue()
{
$storeId = $this->getShipment()->getStoreId();
$order = $this->getShipment()->getOrder();
$carrierCode = $order->getShippingCarrier()->getCarrierCode();
$address = $order->getShippingAddress();
$shipperAddressCountryCode = Mage::getStoreConfig(
Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID,
$storeId
);
$recipientAddressCountryCode = $address->getCountryId();

if (($carrierCode == Mage_Usa_Model_Shipping_Carrier_Fedex::CODE
|| $carrierCode == Mage_Usa_Model_Shipping_Carrier_Dhl::CODE)
&& $shipperAddressCountryCode != $recipientAddressCountryCode
) {
if ($shipperAddressCountryCode != $recipientAddressCountryCode) {
return true;
}
return false;
Expand All @@ -244,8 +240,9 @@ public function getDeliveryConfirmationTypes()
{
$countryId = $this->getShipment()->getOrder()->getShippingAddress()->getCountryId();
$carrier = $this->getShipment()->getOrder()->getShippingCarrier();
if ($carrier && is_array($carrier->getDeliveryConfirmationTypes())) {
return $carrier->getDeliveryConfirmationTypes($countryId);
$params = new Varien_Object(array('country_recipient' => $countryId));
if ($carrier && is_array($carrier->getDeliveryConfirmationTypes($params))) {
return $carrier->getDeliveryConfirmationTypes($params);
}
return array();
}
Expand Down Expand Up @@ -281,4 +278,27 @@ public function isGirthAllowed()
->getShippingCarrier()
->isGirthAllowed($this->getShipment()->getOrder()->getShippingAddress()->getCountryId());
}

/**
* Return content types of package
*
* @return array
*/
public function getContentTypes()
{
$order = $this->getShipment()->getOrder();
$storeId = $this->getShipment()->getStoreId();
$address = $order->getShippingAddress();
$carrier = $order->getShippingCarrier();
$countryShipper = Mage::getStoreConfig(Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID, $storeId);
if ($carrier) {
$params = new Varien_Object(array(
'method' => $order->getShippingMethod(true)->getMethod(),
'country_shipper' => $countryShipper,
'country_recipient' => $address->getCountryId(),
));
return $carrier->getContentTypes($params);
}
return array();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,35 @@ public function getShipment()
return Mage::registry('current_shipment');
}

/**
* Can display customs value
*
* @return bool
*/
public function displayCustomsValue()
{
$storeId = $this->getShipment()->getStoreId();
$order = $this->getShipment()->getOrder();
$address = $order->getShippingAddress();
$shipperAddressCountryCode = Mage::getStoreConfig(
Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID,
$storeId
);
$recipientAddressCountryCode = $address->getCountryId();
if ($shipperAddressCountryCode != $recipientAddressCountryCode) {
return true;
}
return false;
}

/**
* Format price
*
* @param decimal $value
* @return double
*/
public function formatPrice($value)
{
return sprintf('%.2F', $value);
}
}
4 changes: 3 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,10 @@ public function getRenderer()
return $this->_renderer;
}

public function setFilter($column)
public function setFilter($filterClass)
{
$this->_filter = $this->getLayout()->createBlock($filterClass)
->setColumn($this);
}

protected function _getFilterByType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ public function getValue($index=null)
}
if (!empty($value['to']) && !$this->getColumn()->getFilterTime()) {
$datetimeTo = $value['to'];
//set end of the day
$datetimeTo->addSecond(self::END_OF_DAY_IN_SECONDS);

//calculate end date considering timezone specification
$datetimeTo->setTimezone(
Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE)
);
$datetimeTo->addDay(1)->subSecond(1);
$datetimeTo->setTimezone(Mage_Core_Model_Locale::DEFAULT_TIMEZONE);
}
return $value;
}
Expand Down
8 changes: 5 additions & 3 deletions app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,9 @@ public function setShippingAsBilling($flag)
$tmpAddress = clone $this->getBillingAddress();
$tmpAddress->unsAddressId()
->unsAddressType();
$this->getShippingAddress()->addData($tmpAddress->getData());
$data = $tmpAddress->getData();
$data['save_in_address_book'] = 0; // Do not duplicate address (billing address will do saving too)
$this->getShippingAddress()->addData($data);
}
$this->getShippingAddress()->setSameAsBilling($flag);
$this->setRecollect(true);
Expand Down Expand Up @@ -1630,7 +1632,7 @@ protected function _saveCustomerAfterOrder($order)
$order->setCustomerId($this->_customer->getId());
$billing->setCustomerId($this->_customer->getId());
$shipping->setCustomerId($this->_customer->getId());
$this->_customer->sendNewAccountEmail();
$this->_customer->sendNewAccountEmail('registered', '', $order->getStoreId());
} else {
$saveCusstomerAddress = false;

Expand Down Expand Up @@ -1693,7 +1695,7 @@ protected function _saveCustomer()
$this->getBillingAddress()->setCustomerId($customer->getId());
$this->getShippingAddress()->setCustomerId($customer->getId());

$customer->sendNewAccountEmail();
$customer->sendNewAccountEmail('registered', '', $customer->getStoreId());
} else {
$customer = $this->getSession()->getCustomer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public function indexAction()
*/
public function flushAllAction()
{
Mage::app()->getCacheInstance()->flush();
Mage::dispatchEvent('adminhtml_cache_flush_all');
Mage::app()->getCacheInstance()->flush();
$this->_getSession()->addSuccess(Mage::helper('adminhtml')->__("The cache storage has been flushed."));
$this->_redirect('*/*');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,9 @@ public function updateAction()
$this->_initData();

$buyRequest = new Varien_Object($this->getRequest()->getParams());
$qty = $buyRequest->getQty() ? $buyRequest->getQty() : 0;

$this->_wishlist
->updateItem($this->_wishlistItem->getId(), $buyRequest)
->setQty($qty)
->save();

$updateResult->setOk(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,31 +112,26 @@ function changeTaxClassId() {
);
}

$map_enabled = $this->getForm()->getElement('msrp_enabled');
if (Mage::helper('catalog')->isMsrpEnabled() && $map_enabled) {
$map_enabled->setAfterElementHtml(
$mapEnabled = $this->getForm()->getElement('msrp_enabled');
if ($mapEnabled) {
$mapEnabled->setAfterElementHtml(
'<script type="text/javascript">'
. "
function changePriceTypeMap() {
if ($('price_type').value == " . Mage_Bundle_Model_Product_Price::PRICE_TYPE_DYNAMIC . ") {
$('msrp_enabled').setValue("
. Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type_Enabled::MSRP_ENABLE_NO
. ");
$('msrp_enabled').disable();
$('use_config_msrp_enabled').disable();
$('msrp_display_actual_price_type').setValue("
. Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type_Price::TYPE_USE_CONFIG
. ");
$('msrp_display_actual_price_type').disable();
$('use_config_msrp_display_actual_price_type').disable();
$('msrp').setValue('');
$('msrp').disable();
} else {
$('use_config_msrp_enabled').enable();
if ($('use_config_msrp_enabled').checked) {
$('msrp_enabled').disable();
} else {
$('msrp_enabled').enable();
}
$('use_config_msrp_display_actual_price_type').enable();
if ($('use_config_msrp_display_actual_price_type').checked) {
$('msrp_display_actual_price_type').disable();
} else {
$('msrp_display_actual_price_type').enable();
}
$('msrp_enabled').enable();
$('msrp_display_actual_price_type').enable();
$('msrp').enable();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,30 @@ public function getJsonConfig()
);
}

//$canApplyMAP = Mage::helper('catalog')->canApplyMsrp($_selection);
$itemPrice = $_selection->getFinalPrice();
if ($_selection->getSelectionPriceValue() != 0) {
$itemPrice = $_selection->getSelectionPriceValue();
}

$canApplyMAP = false;

/* @var $taxHelper Mage_Tax_Helper_Data */
$taxHelper = Mage::helper('tax');

$_priceInclTax = $taxHelper->getPrice($_selection, $itemPrice, true);
$_priceExclTax = $taxHelper->getPrice($_selection, $itemPrice);

if ($currentProduct->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
$_priceInclTax = $taxHelper->getPrice($currentProduct, $itemPrice, true);
$_priceExclTax = $taxHelper->getPrice($currentProduct, $itemPrice);
}

$selection = array (
'qty' => $_qty,
'customQty' => $_selection->getSelectionCanChangeQty(),
'price' => $coreHelper->currency($_selection->getFinalPrice(), false, false),
'taxPercent'=> $taxPercent,
'priceInclTax' => $coreHelper->currency($_priceInclTax, false, false),
'priceExclTax' => $coreHelper->currency($_priceExclTax, false, false),
'priceValue' => $coreHelper->currency($_selection->getSelectionPriceValue(), false, false),
'priceType' => $_selection->getSelectionPriceType(),
'tierPrice' => $tierPrices,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ public function formatPriceString($price, $includeContainer = true)
{
$taxHelper = Mage::helper('tax');
$coreHelper = $this->helper('core');
if ($this->getFormatProduct()) {
$currentProduct = $this->getProduct();
if (!$currentProduct->getPriceType() == Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED
&& $this->getFormatProduct()
) {
$product = $this->getFormatProduct();
} else {
$product = $this->getProduct();
Expand Down
Loading

0 comments on commit 6cea604

Please sign in to comment.