Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development

This commit is contained in:
vAugagneur
2013-04-17 10:02:37 +02:00
14 changed files with 43 additions and 27 deletions
@@ -27,7 +27,7 @@
{block name="label"}
{if $input.type == 'color'}
<div id="colorAttributeProperties" style="display:{if $colorAttributeProperties}block{else}none{/if}";>
<div id="colorAttributeProperties" style="display:{if $colorAttributeProperties}block{else}none{/if};">
{/if}
{$smarty.block.parent}
{/block}
+7 -2
View File
@@ -953,6 +953,7 @@ class CartCore extends ObjectModel
$this->update(true);
$context = Context::getContext()->cloneContext();
$context->cart = $this;
Cache::clean('getContextualValue_*');
if ($auto_add_cart_rule)
CartRule::autoAddToCart($context);
@@ -2869,8 +2870,12 @@ class CartCore extends ObjectModel
{
$cart_rule['value_real'] -= $total_shipping;
$cart_rule['value_tax_exc'] -= $total_shipping_tax_exc;
$total_discounts -= $total_shipping;
$total_discounts_tax_exc -= $total_shipping_tax_exc;
$cart_rule['value_real'] = Tools::ps_round($cart_rule['value_real'], (int)$context->currency->decimals * _PS_PRICE_DISPLAY_PRECISION_);
$cart_rule['value_tax_exc'] = Tools::ps_round($cart_rule['value_tax_exc'], (int)$context->currency->decimals * _PS_PRICE_DISPLAY_PRECISION_);
if ($total_discounts > $cart_rule['value_real'])
$total_discounts -= $total_shipping;
if ($total_discounts_tax_exc > $cart_rule['value_tax_exc'])
$total_discounts_tax_exc -= $total_shipping_tax_exc;
// Update total shipping
$total_shipping = 0;
+1 -1
View File
@@ -912,7 +912,7 @@ class CartRuleCore extends ObjectModel
if ($cart_vat_amount == 0 || $cart_amount_te == 0)
$cart_average_vat_rate = 0;
else
$cart_average_vat_rate = $cart_vat_amount / $cart_amount_te;
$cart_average_vat_rate = Tools::ps_round($cart_vat_amount / $cart_amount_te, 3);
if ($this->reduction_tax && !$use_tax)
$reduction_value += $prorata * $reduction_amount / (1 + $cart_average_vat_rate);
+3 -2
View File
@@ -429,13 +429,14 @@ abstract class PaymentModuleCore extends Module
// Set the new voucher value
if ($voucher->reduction_tax)
$voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt;
$voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt - $order->total_shipping_tax_incl;
else
$voucher->reduction_amount = $values['tax_excl'] - $order->total_products;
$voucher->reduction_amount = $values['tax_excl'] - $order->total_products - $order->total_shipping_tax_excl;
$voucher->id_customer = $order->id_customer;
$voucher->quantity = 1;
$voucher->quantity_per_user = 1;
$voucher->free_shipping = 0;
if ($voucher->add())
{
// If the voucher has conditions, they are now copied to the new voucher
+6 -6
View File
@@ -2347,16 +2347,16 @@ exit;
$addons_url = 'api.addons.prestashop.com';
$postData = '';
$postDataArray = array(
'version' => _PS_VERSION_,
'iso_lang' => strtolower(Context::getContext()->language->iso_code),
'iso_code' => strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))),
'shop_url' => urlencode(Tools::getShopDomain()),
'mail' => urlencode(Configuration::get('PS_SHOP_EMAIL'))
'version' => isset($params['version']) ? $params['version'] : _PS_VERSION_,
'iso_lang' => Tools::strtolower(isset($params['iso_lang']) ? $params['iso_lang'] : Context::getContext()->language->iso_code),
'iso_code' => Tools::strtolower(isset($params['iso_country']) ? $params['iso_country'] : Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))),
'shop_url' => urlencode(isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain()),
'mail' => urlencode(isset($params['email']) ? $params['email'] : Configuration::get('email'))
);
foreach ($postDataArray as $postDataKey => $postDataValue)
$postData .= '&'.$postDataKey.'='.$postDataValue;
$postData = ltrim($postData, '&');
// Config for each request
if ($request == 'native')
{
+2 -2
View File
@@ -175,8 +175,8 @@ abstract class ControllerCore
// then using displayAjax[action]
if ($this->ajax)
{
$action = Tools::getValue('action');
if (!empty($action) && method_exists($this, 'displayAjax'.Tools::toCamelCase($action, true)))
$action = Tools::toCamelCase(Tools::getValue('action', true));
if (!empty($action) && method_exists($this, $action))
$this->{'displayAjax'.$action}();
elseif (method_exists($this, 'displayAjax'))
$this->displayAjax();
+3 -2
View File
@@ -101,15 +101,15 @@ class AdminCartsControllerCore extends AdminController
{
if (!($cart = $this->loadObject(true)))
return;
$customer = new Customer($cart->id_customer);
$currency = new Currency($cart->id_currency);
$this->context->cart = $cart;
$this->context->currency = $currency;
$this->context->customer = $customer;
$products = $cart->getProducts();
$customized_datas = Product::getAllCustomizedDatas((int)$cart->id);
Product::addCustomizationPrice($products, $customized_datas);
$summary = $cart->getSummaryDetails();
$currency = new Currency($cart->id_currency);
/* Display order information */
$id_order = (int)Order::getOrderByCartId($cart->id);
@@ -739,6 +739,7 @@ class AdminCartsControllerCore extends AdminController
{
$context = Context::getContext();
$context->cart = new Cart($id_cart);
$context->currency = new Currency((int)$context->cart->id_currency);
$context->customer = new Customer((int)$context->cart->id_customer);
return Cart::getTotalCart($id_cart, true, Cart::BOTH_WITHOUT_SHIPPING);
}
@@ -442,7 +442,7 @@ class AdminCountriesControllerCore extends AdminController
$html .= '<li>
<a href="javascript:void(0);" onClick="displayAvailableFields(\''.$class_name.'\')">'.$class_name.'</a>';
foreach (AddressFormat::getValidateFields($class_name) as $name)
$fields[] = '<a style="color:#4B8;" href="javascript:void(0);" class="addPattern" '.$name.' id="'.($class_name == 'Address' ? $name : $class_name.':'.$name).'">
$fields[] = '<a style="color:#4B8;" href="javascript:void(0);" class="addPattern" id="'.($class_name == 'Address' ? $name : $class_name.':'.$name).'">
'.$name.'</a>';
$html .= '
<div class="availableFieldsList" id="availableListFieldsFor_'.$class_name.'" style="width:300px;">
+8 -3
View File
@@ -331,8 +331,6 @@ class InstallControllerHttpProcess extends InstallControllerHttp
*/
public function display()
{
$this->initializeContext();
// The installer SHOULD take less than 32M, but may take up to 35/36M sometimes. So 42M is a good value :)
$low_memory = Tools::getMemoryLimit() < Tools::getOctets('42M');
@@ -361,8 +359,15 @@ class InstallControllerHttpProcess extends InstallControllerHttp
$this->process_steps[] = $install_modules;
$install_modules = array('key' => 'installModulesAddons', 'lang' => $this->l('Install modules Addons'));
$params = array('iso_lang' => $this->language->getLanguageIso(),
'iso_country' => $this->session->shop_country,
'email' => $this->session->admin_email,
'shop_url' => Tools::getHttpHost(),
'version' => _PS_INSTALL_VERSION_);
if ($low_memory)
foreach ($this->model_install->getAddonsModulesList() as $module)
foreach ($this->model_install->getAddonsModulesList($params) as $module)
$install_modules['subtasks'][] = array('module' => (string)$module['name'], 'id_module' => (string)$module['id_module']);
$this->process_steps[] = $install_modules;
+2 -2
View File
@@ -587,10 +587,10 @@ class InstallModelInstall extends InstallAbstractModel
return $modules;
}
public function getAddonsModulesList()
public function getAddonsModulesList($params = array())
{
$addons_modules = array();
$content = Tools::addonsRequest('install-modules');
$content = Tools::addonsRequest('install-modules', $params);
$xml = @simplexml_load_string($content, null, LIBXML_NOCDATA);
if ($xml !== false and isset($xml->module))
+1 -1
View File
@@ -220,7 +220,7 @@ $(function(){ldelim}
</p>
<p class="required text" id="adress_alias">
<label for="alias">{l s='Please assign an address title for future reference.'} <sup>*</sup></label>
<input type="text" id="alias" name="alias" value="{if isset($smarty.post.alias)}{$smarty.post.alias}{else if isset($address->alias)}{$address->alias}{else if !isset($select_address)}{l s='My address'}{/if}" />
<input type="text" id="alias" name="alias" value="{if isset($smarty.post.alias)}{$smarty.post.alias}{else if isset($address->alias)}{$address->alias}{elseif !$select_address}{l s='My address'}{/if}" />
</p>
</fieldset>
<p class="submit2">
+4 -2
View File
@@ -655,9 +655,9 @@ function updateCartSummary(json)
location.reload();
if (priceDisplayMethod !== 0)
$('#total_discount').html(formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank));
$('#total_discount').html('-' + formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank));
else
$('#total_discount').html(formatCurrency(json.total_discounts, currencyFormat, currencySign, currencyBlank));
$('#total_discount').html('-' + formatCurrency(json.total_discounts, currencyFormat, currencySign, currencyBlank));
$('.cart_discount').each(function(){
var idElmt = $(this).attr('id').replace('cart_discount_','');
@@ -667,10 +667,12 @@ function updateCartSummary(json)
if (json.discounts[i].id_discount == idElmt)
{
if (json.discounts[i].value_real !== '!')
{
if (priceDisplayMethod !== 0)
$('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_tax_exc * -1, currencyFormat, currencySign, currencyBlank));
else
$('#cart_discount_' + idElmt + ' td.cart_discount_price span.price-discount').html(formatCurrency(json.discounts[i].value_real * -1, currencyFormat, currencySign, currencyBlank));
}
toDelete = false;
}
if (toDelete)
+2
View File
@@ -265,6 +265,7 @@ function confirmFreeOrder()
else
$('#opc_account-overlay').fadeIn('slow');
$('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
$('#confirmOrder').attr('disabled', 'disabled');
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
@@ -275,6 +276,7 @@ function confirmFreeOrder()
data: 'ajax=true&method=makeFreeOrder&token=' + static_token ,
success: function(html)
{
$('#confirmOrder').attr('disabled', '');
var array_split = html.split(':');
if (array_split[0] == 'freeorder')
{
+2 -2
View File
@@ -227,8 +227,8 @@ abstract class Controller extends ControllerCore
// then using displayAjax[action]
if ($this->ajax)
{
$action = Tools::getValue('action');
if (!empty($action) && method_exists($this, 'displayAjax'.Tools::toCamelCase($action)))
$action = 'displayAjax'.Tools::toCamelCase(Tools::getValue('action', true));
if (!empty($action) && method_exists($this, $action))
$this->{'displayAjax'.$action}();
elseif (method_exists($this, 'displayAjax'))
$this->displayAjax();