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

This commit is contained in:
gRoussac
2013-07-18 14:08:36 +02:00
5 changed files with 43 additions and 16 deletions
+14 -13
View File
@@ -1104,29 +1104,30 @@ class CartRuleCore extends ObjectModel
'.($context->customer->id ? 'OR cr.id_customer = '.(int)$context->cart->id_customer : '').'
)
AND (
cr.carrier_restriction = 0
cr.`carrier_restriction` = 0
'.($context->cart->id_carrier ? 'OR c.id_carrier = '.(int)$context->cart->id_carrier : '').'
)
AND (
cr.shop_restriction = 0
cr.`shop_restriction` = 0
'.((Shop::isFeatureActive() && $context->shop->id) ? 'OR crs.id_shop = '.(int)$context->shop->id : '').'
)
AND (
cr.group_restriction = 0
cr.`group_restriction` = 0
'.($context->customer->id ? 'OR 0 < (
SELECT cg.id_group
FROM '._DB_PREFIX_.'customer_group cg
LEFT JOIN '._DB_PREFIX_.'cart_rule_group crg ON (cg.id_group = crg.id_group AND cg.id_group = '.(int)$context->customer->id_default_group.')
WHERE cr.id_cart_rule = crg.id_cart_rule
AND cg.id_customer = '.(int)$context->customer->id.' LIMIT 1
SELECT cg.`id_group`
FROM `'._DB_PREFIX_.'customer_group` cg
INNER JOIN `'._DB_PREFIX_.'cart_rule_group` crg ON cg.id_group = crg.id_group
WHERE cr.`id_cart_rule` = crg.`id_cart_rule`
AND cg.`id_customer` = '.(int)$context->customer->id.'
LIMIT 1
)' : '').'
)
AND (
cr.reduction_product <= 0
OR cr.reduction_product IN (
SELECT id_product
FROM '._DB_PREFIX_.'cart_product
WHERE id_cart = '.(int)$context->cart->id.'
cr.`reduction_product` <= 0
OR cr.`reduction_product` IN (
SELECT `id_product`
FROM `'._DB_PREFIX_.'cart_product`
WHERE `id_cart` = '.(int)$context->cart->id.'
)
)
AND cr.id_cart_rule NOT IN (SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$context->cart->id.')
+2 -2
View File
@@ -431,9 +431,9 @@ abstract class PaymentModuleCore extends Module
// Set the new voucher value
if ($voucher->reduction_tax)
$voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt - $order->total_shipping_tax_incl;
$voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_incl : 0);
else
$voucher->reduction_amount = $values['tax_excl'] - $order->total_products - $order->total_shipping_tax_excl;
$voucher->reduction_amount = $values['tax_excl'] - $order->total_products - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_excl : 0);
$voucher->id_customer = $order->id_customer;
$voucher->quantity = 1;
+8
View File
@@ -571,6 +571,14 @@ class SearchCore
return true;
}
public static function removeProductsSearchIndex($products)
{
if (count($products)) {
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'search_index WHERE id_product IN ('.implode(',', $products).')');
ObjectModel::updateMultishopTable('Product', array('indexed' => 0), 'a.id_product IN ('.implode(',', $products).')');
}
}
protected static function setProductsAsIndexed(&$products)
{
if (count($products))
@@ -181,11 +181,13 @@ class AdminStockInstantStateControllerCore extends AdminController
*/
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
{
if (Tools::isSubmit('csv') && (int)Tools::getValue('id_warehouse') != -1)
if ((Tools::isSubmit('csv_quantities') || Tools::isSubmit('csv_prices')) &&
(int)Tools::getValue('id_warehouse') != -1)
$limit = false;
$order_by_valuation = false;
$order_by_real_quantity = false;
if ($this->context->cookie->{$this->table.'Orderby'} == 'valuation')
{
unset($this->context->cookie->{$this->table.'Orderby'});
@@ -200,6 +202,7 @@ class AdminStockInstantStateControllerCore extends AdminController
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
$nb_items = count($this->_list);
for ($i = 0; $i < $nb_items; ++$i)
{
$item = &$this->_list[$i];
+15
View File
@@ -77,8 +77,23 @@ class AdminTagsControllerCore extends AdminController
public function postProcess()
{
if ($this->tabAccess['edit'] === '1' && Tools::getValue('submitAdd'.$this->table))
{
if (($id = (int)Tools::getValue($this->identifier)) && ($obj = new $this->className($id)) && Validate::isLoadedObject($obj))
{
$previousProducts = $obj->getProducts();
$removedProducts = array();
foreach ($previousProducts as $product)
if (!in_array($product['id_product'], $_POST['products']))
$removedProducts[] = $product['id_product'];
if (Configuration::get('PS_SEARCH_INDEXATION'))
Search::removeProductsSearchIndex($removedProducts);
$obj->setProducts($_POST['products']);
}
}
return parent::postProcess();
}