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

This commit is contained in:
djfm
2013-07-16 13:08:36 +00:00
44 changed files with 361 additions and 134 deletions
+45 -2
View File
@@ -37,7 +37,6 @@ $height = Tools::getValue('height');
$id_employee = Tools::getValue('id_employee');
$id_lang = Tools::getValue('id_lang');
if (!isset($cookie->id_employee) || !$cookie->id_employee || $cookie->id_employee != $id_employee)
die(Tools::displayError());
@@ -47,6 +46,51 @@ if (!Validate::isModuleName($module))
if (!Tools::file_exists_cache($module_path = dirname(__FILE__).'/../modules/'.$module.'/'.$module.'.php'))
die(Tools::displayError());
$shop_id = '';
Shop::setContext(Shop::CONTEXT_ALL);
if (Context::getContext()->cookie->shopContext)
{
$split = explode('-', Context::getContext()->cookie->shopContext);
if (count($split) == 2)
{
if ($split[0] == 'g')
{
if (Context::getContext()->employee->hasAuthOnShopGroup($split[1]))
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
else
{
$shop_id = Context::getContext()->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
else if (Shop::getShop($split[1]) && Context::getContext()->employee->hasAuthOnShop($split[1]))
{
$shop_id = $split[1];
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
else
{
$shop_id = Context::getContext()->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
}
// Check multishop context and set right context if need
if (Shop::getContext())
{
if (Shop::getContext() == Shop::CONTEXT_SHOP && !Shop::CONTEXT_SHOP)
Shop::setContext(Shop::CONTEXT_GROUP, Shop::getContextShopGroupID());
if (Shop::getContext() == Shop::CONTEXT_GROUP && !Shop::CONTEXT_GROUP)
Shop::setContext(Shop::CONTEXT_ALL);
}
// Replace existing shop if necessary
if (!$shop_id)
Context::getContext()->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
elseif (Context::getContext()->shop->id != $shop_id)
Context::getContext()->shop = new Shop($shop_id);
require_once($module_path);
$graph = new $module();
@@ -57,4 +101,3 @@ if ($option)
$graph->create($render, $type, $width, $height, $layers);
$graph->draw();
+47
View File
@@ -50,6 +50,53 @@ if (!Validate::isModuleName($module))
if (!Tools::file_exists_cache($module_path = dirname(__FILE__).'/../modules/'.$module.'/'.$module.'.php'))
die(Tools::displayError());
$shop_id = '';
Shop::setContext(Shop::CONTEXT_ALL);
if (Context::getContext()->cookie->shopContext)
{
$split = explode('-', Context::getContext()->cookie->shopContext);
if (count($split) == 2)
{
if ($split[0] == 'g')
{
if (Context::getContext()->employee->hasAuthOnShopGroup($split[1]))
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
else
{
$shop_id = Context::getContext()->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
else if (Shop::getShop($split[1]) && Context::getContext()->employee->hasAuthOnShop($split[1]))
{
$shop_id = $split[1];
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
else
{
$shop_id = Context::getContext()->employee->getDefaultShopID();
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
}
}
}
// Check multishop context and set right context if need
if (Shop::getContext())
{
if (Shop::getContext() == Shop::CONTEXT_SHOP && !Shop::CONTEXT_SHOP)
Shop::setContext(Shop::CONTEXT_GROUP, Shop::getContextShopGroupID());
if (Shop::getContext() == Shop::CONTEXT_GROUP && !Shop::CONTEXT_GROUP)
Shop::setContext(Shop::CONTEXT_ALL);
}
// Replace existing shop if necessary
if (!$shop_id)
Context::getContext()->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
elseif (Context::getContext()->shop->id != $shop_id)
Context::getContext()->shop = new Shop($shop_id);
require_once($module_path);
$grid = new $module();
@@ -68,9 +68,9 @@
{/if}
{if get_class($document) eq 'OrderInvoice'}
{if isset($document->is_delivery)}
#{Configuration::get('PS_DELIVERY_PREFIX', $current_id_lang)}{'%06d'|sprintf:$document->delivery_number}
#{Configuration::get('PS_DELIVERY_PREFIX', $current_id_lang, null, $order->id_shop)}{'%06d'|sprintf:$document->delivery_number}
{else}
{$document->getInvoiceNumberFormatted($current_id_lang)}
{$document->getInvoiceNumberFormatted($current_id_lang, $order->id_shop)}
{/if}
{elseif get_class($document) eq 'OrderSlip'}
#{Configuration::get('PS_CREDIT_SLIP_PREFIX', $current_id_lang)}{'%06d'|sprintf:$document->id}
@@ -325,7 +325,7 @@
<td>{displayPrice price=$payment->amount currency=$payment->id_currency}</td>
<td>
{if $invoice = $payment->getOrderInvoice($order->id)}
{$invoice->getInvoiceNumberFormatted($current_id_lang)}
{$invoice->getInvoiceNumberFormatted($current_id_lang, $order->id_shop)}
{else}
{l s='No invoice'}
{/if}
@@ -404,7 +404,7 @@
<td>
<select name="payment_invoice" id="payment_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" selected="selected">{$invoice->getInvoiceNumberFormatted($current_id_lang)}</option>
<option value="{$invoice->id}" selected="selected">{$invoice->getInvoiceNumberFormatted($current_id_lang, $order->id_shop)}</option>
{/foreach}
</select>
</td>
@@ -64,7 +64,7 @@
{$type = 'checkbox'}
{/if}
{if $type != 'null'}
<input type="checkbox" name="{$module->name}_{$list['name_id']}[]" value="{$item[$list['identifier']]}" {if $item['check_list'][$key_module] == 'checked'}checked="checked"{/if}/>
<input type="{$type}" name="{$module->name}_{$list['name_id']}[]" value="{$item[$list['identifier']]}" {if $item['check_list'][$key_module] == 'checked'}checked="checked"{/if}/>
{else}
<input type="hidden" name="{$module->name}_{$list['name_id']}[]" value="{$item[$list['identifier']]}"/>--
{/if}
@@ -343,13 +343,13 @@
{/if}
{/if}
{/foreach}
{hook h='displayAdminForm'}
{hook h='displayAdminForm' fieldset=$f}
{if isset($name_controller)}
{capture name=hookName assign=hookName}display{$name_controller|ucfirst}Form{/capture}
{hook h=$hookName}
{hook h=$hookName fieldset=$f}
{elseif isset($smarty.get.controller)}
{capture name=hookName assign=hookName}display{$smarty.get.controller|ucfirst|htmlentities}Form{/capture}
{hook h=$hookName}
{hook h=$hookName fieldset=$f}
{/if}
{elseif $key == 'submit'}
<div class="margin-form">
+8 -1
View File
@@ -102,7 +102,14 @@ class CombinationCore extends ObjectModel
// Removes the product from StockAvailable, for the current shop
StockAvailable::removeProductFromStockAvailable((int)$this->id_product, (int)$this->id);
if ($specific_prices = SpecificPrice::getByProductId((int)$this->id_product, (int)$this->id))
foreach ($specific_prices as $specific_price)
{
$price = new SpecificPrice((int)$specific_price['id_specific_price']);
$price->delete();
}
if (!$this->hasMultishopEntries() && !$this->deleteAssociations())
return false;
return true;
+4 -1
View File
@@ -482,7 +482,10 @@ class LinkCore
public function getCatImageLink($name, $id_category, $type = null)
{
$uri_path = ($this->allow == 1) ? (__PS_BASE_URI__.'c/'.$id_category.($type ? '-'.$type : '').'/'.$name.'.jpg') : (_THEME_CAT_DIR_.$id_category.($type ? '-'.$type : '').'.jpg');
if($this->allow == 1 && $type)
$uri_path = __PS_BASE_URI__.'c/'.$id_category.'-'.$type.'/'.$name.'.jpg';
else
$uri_path = _THEME_CAT_DIR_.$id_category.($type ? '-'.$type : '').'.jpg';
return $this->protocol_content.Tools::getMediaServer($uri_path).$uri_path;
}
+30 -29
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2012 PrestaShop
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -30,36 +30,37 @@ class MediaCore
'ui.core' => array('fileName' => 'jquery.ui.core.min.js', 'dependencies' => array(), 'theme' => true),
'ui.widget' => array('fileName' => 'jquery.ui.widget.min.js', 'dependencies' => array(), 'theme' => false),
'ui.mouse' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => false),
'ui.position' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array(), 'theme' => false),
'ui.draggable' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => false),
'ui.droppable' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse', 'ui.draggable'), 'theme' => false),
'ui.resizable' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.selectable' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.sortable' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.accordion' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.autocomplete' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true),
'ui.button' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.dialog' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true),
'ui.slider' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.tabs' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.datepicker' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core'), 'theme' => true),
'ui.progressbar' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'effects.core' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array(), 'theme' => false),
'effects.blind' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.bounce' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.clip' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.drop' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.explode' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.fade' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.fold' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.highlight' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.pulsate' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.scale' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.shake' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.slide' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.transfer' => array('fileName' => 'jquery.ui.mouse.min.js', 'dependencies' => array('effects.core'), 'theme' => false)
'ui.position' => array('fileName' => 'jquery.ui.position.min.js', 'dependencies' => array(), 'theme' => false),
'ui.draggable' => array('fileName' => 'jquery.ui.draggable.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => false),
'ui.droppable' => array('fileName' => 'jquery.ui.droppable.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse', 'ui.draggable'), 'theme' => false),
'ui.resizable' => array('fileName' => 'jquery.ui.resizable.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.selectable' => array('fileName' => 'jquery.ui.selectable.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.sortable' => array('fileName' => 'jquery.ui.sortable.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true),
'ui.button' => array('fileName' => 'jquery.ui.button.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true),
'ui.slider' => array('fileName' => 'jquery.ui.slider.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.tabs' => array('fileName' => 'jquery.ui.tabs.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.datepicker' => array('fileName' => 'jquery.ui.datepicker.min.js', 'dependencies' => array('ui.core'), 'theme' => true),
'ui.progressbar' => array('fileName' => 'jquery.ui.progressbar.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'effects.core' => array('fileName' => 'jquery.effects.core.min.js', 'dependencies' => array(), 'theme' => false),
'effects.blind' => array('fileName' => 'jquery.effects.blind.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.bounce' => array('fileName' => 'jquery.effects.bounce.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.clip' => array('fileName' => 'jquery.effects.clip.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.drop' => array('fileName' => 'jquery.effects.drop.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.explode' => array('fileName' => 'jquery.effects.explode.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.fade' => array('fileName' => 'jquery.effects.fade.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.fold' => array('fileName' => 'jquery.effects.fold.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.highlight' => array('fileName' => 'jquery.effects.highlight.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.pulsate' => array('fileName' => 'jquery.effects.pulsate.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.scale' => array('fileName' => 'jquery.effects.scale.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.shake' => array('fileName' => 'jquery.effects.shake.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.slide' => array('fileName' => 'jquery.effects.slide.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.transfer' => array('fileName' => 'jquery.effects.transfer.min.js', 'dependencies' => array('effects.core'), 'theme' => false)
);
public static function minifyHTML($html_content)
{
if (strlen($html_content) > 0)
+1 -1
View File
@@ -135,7 +135,7 @@ class SpecificPriceCore extends ObjectModel
SELECT *
FROM `'._DB_PREFIX_.'specific_price`
WHERE `id_product` = '.(int)$id_product.
($id_product_attribute ? 'AND id_product_attribute = '.(int)$id_product_attribute : '').'
($id_product_attribute ? ' AND id_product_attribute = '.(int)$id_product_attribute : '').'
AND id_cart = '.(int)$id_cart);
}
+3
View File
@@ -2127,6 +2127,9 @@ exit;
}
}
/**
* @deprecated as of 1.5 use Controller::getController('PageNotFoundController')->run();
*/
public static function display404Error()
{
header('HTTP/1.1 404 Not Found');
+2 -2
View File
@@ -2204,9 +2204,9 @@ class AdminControllerCore extends Controller
}
else
$this->_listsql .= ($this->lang ? 'b.*,' : '').' a.*';
$this->_listsql .= '
'.(isset($this->_select) ? ', '.$this->_select : '').$select_shop.'
'.(isset($this->_select) ? ', '.rtrim($this->_select, ', ') : '').$select_shop.'
FROM `'._DB_PREFIX_.$sql_table.'` a
'.$lang_join.'
'.(isset($this->_join) ? $this->_join.' ' : '').'
+1 -1
View File
@@ -1612,7 +1612,7 @@ abstract class ModuleCore
{
if ($name === null)
$name = $this->name;
return $name.'|'.(int)Tools::usingSecureMode().'|'.(int)$this->context->shop->id.'|'.(int)Group::getCurrent()->id.'|'.(int)$this->context->language->id;
return $name.'|'.(int)Tools::usingSecureMode().'|'.(int)$this->context->shop->id.'|'.(int)Group::getCurrent()->id.'|'.(int)$this->context->language->id.'|'.(int)$this->context->currency->id;
}
public function display($file, $template, $cacheId = null, $compileId = null)
+7 -3
View File
@@ -161,6 +161,9 @@ class OrderHistoryCore extends ObjectModel
$manager = null;
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$manager = StockManagerFactory::getManager();
$errorOrCanceledStatuses = array(Configuration::get('PS_OS_ERROR'), Configuration::get('PS_OS_CANCELED'));
// foreach products of the order
if (Validate::isLoadedObject($old_os))
foreach ($order->getProductsDetail() as $product)
@@ -171,7 +174,7 @@ class OrderHistoryCore extends ObjectModel
ProductSale::addProductSale($product['product_id'], $product['product_quantity']);
// @since 1.5.0 - Stock Management
if (!Pack::isPack($product['product_id']) &&
($old_os->id == Configuration::get('PS_OS_ERROR') || $old_os->id == Configuration::get('PS_OS_CANCELED')) &&
in_array($old_os->id, $errorOrCanceledStatuses) &&
!StockAvailable::dependsOnStock($product['id_product'], (int)$order->id_shop))
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], -(int)$product['product_quantity'], $order->id_shop);
}
@@ -182,13 +185,14 @@ class OrderHistoryCore extends ObjectModel
// @since 1.5.0 - Stock Management
if (!Pack::isPack($product['product_id']) &&
($new_os->id == Configuration::get('PS_OS_ERROR') || $new_os->id == Configuration::get('PS_OS_CANCELED')) &&
in_array($new_os->id, $errorOrCanceledStatuses) &&
!StockAvailable::dependsOnStock($product['id_product']))
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], (int)$product['product_quantity'], $order->id_shop);
}
// if waiting for payment => payment error/canceled
elseif (!$new_os->logable && !$old_os->logable &&
($new_os->id == Configuration::get('PS_OS_ERROR') || $new_os->id == Configuration::get('PS_OS_CANCELED')) &&
in_array($new_os->id, $errorOrCanceledStatuses) &&
!in_array($old_os->id, $errorOrCanceledStatuses) &&
!StockAvailable::dependsOnStock($product['id_product']))
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], (int)$product['product_quantity'], $order->id_shop);
// @since 1.5.0 : if the order is being shipped and this products uses the advanced stock management :
+1 -1
View File
@@ -90,7 +90,7 @@ class HTMLTemplateDeliverySlipCore extends HTMLTemplate
*/
public function getFilename()
{
return Configuration::get('PS_DELIVERY_PREFIX').sprintf('%06d', $this->order->invoice_number).'.pdf';
return Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id, null, $this->order->id_shop).sprintf('%06d', $this->order->invoice_number).'.pdf';
}
}
+1 -1
View File
@@ -139,7 +139,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
*/
public function getFilename()
{
return Configuration::get('PS_INVOICE_PREFIX').sprintf('%06d', $this->order_invoice->number).'.pdf';
return Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id, null, $this->order->id_shop).sprintf('%06d', $this->order_invoice->number).'.pdf';
}
}
+2 -2
View File
@@ -113,11 +113,11 @@ class TaxRulesGroupCore extends ObjectModel
);
}
public function hasUniqueTaxRuleForCountry($id_country, $id_state)
public function hasUniqueTaxRuleForCountry($id_country, $id_state, $id_tax_rule = false)
{
$rules = TaxRule::getTaxRulesByGroupId((int)Context::getContext()->language->id, (int)$this->id);
foreach ($rules as $rule)
if ($rule['id_country'] == $id_country && $id_state == $rule['id_state'] && !$rule['behavior'])
if ($rule['id_country'] == $id_country && $id_state == $rule['id_state'] && !$rule['behavior'] && (int)$id_tax_rule != $rule['id_tax_rule'])
return true;
return false;
+13 -8
View File
@@ -76,7 +76,7 @@ class AdminProductsControllerCore extends AdminController
$this->allow_export = true;
// @since 1.5 : translations for tabs
$this->available_tabs_lang = array (
$this->available_tabs_lang = array(
'Informations' => $this->l('Information'),
'Pack' => $this->l('Pack'),
'VirtualProduct' => $this->l('Virtual Product'),
@@ -160,7 +160,11 @@ class AdminProductsControllerCore extends AdminController
if (Validate::isLoadedObject($this->_category) && empty($this->_filter))
$join_category = true;
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = a.`id_product` '.(!Shop::isFeatureActive() ? ' AND i.cover=1' : '').')';
$this->_join .= '
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = a.`id_product` '.(!Shop::isFeatureActive() ? ' AND i.cover=1' : '').')
LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0
'.StockAvailable::addSqlShopRestriction(null, null, 'sav').') ';
if (Shop::isFeatureActive())
{
$alias = 'sa';
@@ -188,12 +192,13 @@ class AdminProductsControllerCore extends AdminController
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = 1)';
}
$this->_select .= 'MAX('.$alias_image.'.id_image) id_image,';
$this->_select .= 'MAX('.$alias_image.'.id_image) id_image, cl.name `name_category`, '.$alias.'.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, '.$alias.'.`active`, ';
$this->_join .= ($join_category ? 'INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = '.(int)$this->_category->id.')' : '').'
LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0
'.StockAvailable::addSqlShopRestriction(null, null, 'sav').') ';
$this->_select .= 'cl.name `name_category` '.($join_category ? ', cp.`position`' : '').', '.$alias.'.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, '.$alias.'.`active`';
if ($join_category)
{
$this->_join .= ' INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = '.(int)$this->_category->id.') ';
$this->_select .= ' cp.`position`, ';
}
$this->_group = 'GROUP BY '.$alias.'.id_product';
@@ -270,7 +275,7 @@ class AdminProductsControllerCore extends AdminController
'orderby' => false
);
if ((int)$this->id_current_category)
if ($join_category && (int)$this->id_current_category)
$this->fields_list['position'] = array(
'title' => $this->l('Position'),
'width' => 70,
@@ -394,6 +394,42 @@ class AdminShopUrlControllerCore extends AdminController
if ($this->redirect_shop_url)
$this->redirect_after = $object->getBaseURI().basename(_PS_ADMIN_DIR_).'/'.$this->context->link->getAdminLink('AdminShopUrl');
}
/**
* @param string $token
* @param integer $id
* @param string $name
* @return mixed
*/
public function displayDeleteLink($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('helpers/list/list_action_delete.tpl');
if (!array_key_exists('Delete', self::$cache_lang))
self::$cache_lang['Delete'] = $this->l('Delete', 'Helper');
if (!array_key_exists('DeleteItem', self::$cache_lang))
self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper');
if (!array_key_exists('Name', self::$cache_lang))
self::$cache_lang['Name'] = $this->l('Name:', 'Helper');
if (!is_null($name))
$name = '\n\n'.self::$cache_lang['Name'].' '.$name;
$data = array(
$this->identifier => $id,
'href' => Tools::safeOutput(self::$currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&id_shop='.$this->id_shop.'&token='.($token != null ? $token : $this->token)),
'action' => self::$cache_lang['Delete'],
);
if ($this->specificConfirmDelete !== false)
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : self::$cache_lang['DeleteItem'].$name;
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
return $tpl->fetch();
}
}
@@ -1060,8 +1060,8 @@ class AdminStockManagementControllerCore extends AdminController
{
$helper->fields_value['id_warehouse_from'] = Tools::getValue('id_warehouse_from', '');
$helper->fields_value['id_warehouse_to'] = Tools::getValue('id_warehouse_to', '');
$helper->fields_value['usable_from'] = Tools::getValue('usable_from', '');
$helper->fields_value['usable_to'] = Tools::getValue('usable_to', '');
$helper->fields_value['usable_from'] = Tools::getValue('usable_from', '1');
$helper->fields_value['usable_to'] = Tools::getValue('usable_to', '1');
}
$this->content .= $helper->generateForm($this->fields_form);
@@ -404,7 +404,7 @@ class AdminTaxRulesGroupControllerCore extends AdminController
{
foreach ($this->selected_states as $id_state)
{
if ($tax_rules_group->hasUniqueTaxRuleForCountry($id_country, $id_state))
if ($tax_rules_group->hasUniqueTaxRuleForCountry($id_country, $id_state, $id_rule))
{
$this->errors[] = Tools::displayError('A tax rule already exists for this country/state with tax only behavior');
continue;
@@ -983,8 +983,6 @@ class AdminTranslationsControllerCore extends AdminController
'header.inc.php',
'footer.inc.php',
'index.php',
'login.php',
'password.php',
'functions.php'
)
)
+3 -2
View File
@@ -57,13 +57,14 @@ class IdentityControllerCore extends FrontController
{
$email = trim(Tools::getValue('email'));
$this->customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']);
$_POST['old_passwd'] = trim($_POST['old_passwd']);
if (isset($_POST['old_passwd']))
$_POST['old_passwd'] = trim($_POST['old_passwd']);
if (!Validate::isEmail($email))
$this->errors[] = Tools::displayError('This email address is not valid');
elseif ($this->customer->email != $email && Customer::customerExists($email, true))
$this->errors[] = Tools::displayError('An account using this email address has already been registered.');
elseif (empty($_POST['old_passwd']) || (Tools::encrypt($_POST['old_passwd']) != $this->context->cookie->passwd))
elseif ((!isset($_POST['old_passwd']) || empty($_POST['old_passwd'])) || (Tools::encrypt($_POST['old_passwd']) != $this->context->cookie->passwd))
$this->errors[] = Tools::displayError('The password you entered is incorrect.');
elseif ($_POST['passwd'] != $_POST['confirmation'])
$this->errors[] = Tools::displayError('The password and confirmation do not match.');
+1 -1
View File
@@ -36,7 +36,7 @@ class PasswordControllerCore extends FrontController
{
if (Tools::isSubmit('email'))
{
if (!($email = Tools::getValue('email')) || !Validate::isEmail($email))
if (!($email = trim(Tools::getValue('email'))) || !Validate::isEmail($email))
$this->errors[] = Tools::displayError('Invalid email address.');
else
{
+3 -3
View File
@@ -1,4 +1,4 @@
2007-2012 PrestaShop
2007-2013 PrestaShop
NOTICE OF LICENSE
@@ -17,7 +17,7 @@ versions in the future. If you wish to customize PrestaShop for your
needs please refer to http://www.prestashop.com for more information.
@author PrestaShop SA <contact@prestashop.com>
@copyright 2007-2012 PrestaShop SA
@copyright 2007-2013 PrestaShop SA
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
International Registred Trademark & Property of PrestaShop SA
@@ -7578,4 +7578,4 @@ Release Notes for PrestaShop 1.5
[+] SQL : add the replication SQL
Release Notes for PrestaShop 1.3
Release Notes for PrestaShop 1.3
Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

+2 -2
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2012 PrestaShop
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -19,7 +19,7 @@
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2012 PrestaShop
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -19,7 +19,7 @@
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2012 PrestaShop
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -19,7 +19,7 @@
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
+2 -2
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2012 PrestaShop
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -19,7 +19,7 @@
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
+4 -1
View File
@@ -24,8 +24,11 @@
* International Registered Trademark & Property of PrestaShop SA
*/
function add_new_tab($className, $name, $id_parent, $returnId = false)
function add_new_tab($className, $name, $id_parent, $returnId = false, $parentTab = null)
{
if (!is_null($parentTab) && !empty($parentTab))
$id_parent = (int)Db::getInstance()->getValue('SELECT `id_tab` FROM `'._DB_PREFIX_.'tab` WHERE `class_name` = \''.pSQL($parentTab).'\'');
$array = array();
foreach (explode('|', $name) AS $item)
{
+1 -1
View File
@@ -31,7 +31,7 @@ CREATE TABLE `PREFIX_tab_module_preference` (
UNIQUE KEY `employee_module` (`id_employee`, `id_tab`, `module`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
/* PHP:add_new_tab(AdminMarketing, es:Marketing|it:Marketing|en:Marketing|de:Marketing|fr:Marketing, 1); */;
/* PHP:add_new_tab(AdminMarketing, es:Marketing|it:Marketing|en:Marketing|de:Marketing|fr:Marketing, 0, false, AdminPriceRule); */;
/* PHP:p1540_add_missing_columns(); */;
+4 -1
View File
@@ -20,4 +20,7 @@ CHANGE `module_name` `module_name` VARCHAR(64) NULL DEFAULT NULL;
/* PHP:add_module_to_hook(blockmyaccount, actionModuleUnRegisterHookAfter); */;
/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleUnRegisterHookAfter); */;
ALTER TABLE `PREFIX_log` ADD `id_employee` INT(10) UNSIGNED NULL AFTER `object_id`;
ALTER TABLE `PREFIX_log` ADD `id_employee` INT(10) UNSIGNED NULL AFTER `object_id`;
SET @id_parent = (SELECT IFNULL(id_tab, 1) FROM `PREFIX_tab` WHERE `class_name` = 'AdminPriceRule' LIMIT 1);
UPDATE `PREFIX_tab` SET id_parent = @id_parent WHERE `id_parent` = 1 AND `class_name` = 'AdminMarketing' LIMIT 1;
+1 -1
View File
@@ -1414,7 +1414,7 @@ product_tabs['Warehouses'] = new function(){
// Resize the accordion once the page is visible because of the bug with accordions initialized
// inside a display:none block not having the correct size.
$('#warehouse_accordion').parents('.product-tab-content').bind('displayed', function(){
$('#warehouse_accordion').accordion("resize");
$('#warehouse_accordion').accordion("refresh");
});
};
}
+1 -1
View File
@@ -211,7 +211,7 @@ function displayFlags(languages, defaultLanguageID, employee_cookie)
$.each(languages, function(key, language) {
var img = $('<img>')
.addClass('pointer')
.css('margin', '0 2px')
.css('margin', '2px 2px')
.attr('src', '../img/l/' + language['id_lang'] + '.jpg')
.attr('alt', language['name'])
.click(function() {
+5 -6
View File
@@ -348,13 +348,12 @@ var ajaxCart = {
});
});
}
var removeLinks = $('#cart_block_product_' + domIdProduct).find('.ajax_cart_block_remove_link');
var removeLinks = $('#' + domIdProduct).find('.ajax_cart_block_remove_link');
if (!product.hasCustomizedDatas && !removeLinks.length)
{
$('#cart_block_product_' + domIdProduct + ' span.remove_link').html('<a class="ajax_cart_block_remove_link" rel="nofollow" href="' + baseUri + '?controller=cart&amp;delete=1&amp;id_product=' + product['id'] + '&amp;ipa=' + product['idCombination'] + '&amp;token=' + static_token + '"> </a>');
}
$('#' + domIdProduct + ' span.remove_link').html('<a class="ajax_cart_block_remove_link" rel="nofollow" href="' + baseUri + '?controller=cart&amp;delete=1&amp;id_product=' + product['id'] + '&amp;ipa=' + product['idCombination'] + '&amp;token=' + static_token + '"> </a>');
if (product.is_gift)
$('#cart_block_product_' + domIdProduct + ' span.remove_link').html('');
$('#' + domIdProduct + ' span.remove_link').html('');
},
doesCustomizationStillExist : function (product, customizationId)
@@ -448,7 +447,7 @@ var ajaxCart = {
var name = (this.name.length > 12 ? this.name.substring(0, 10) + '...' : this.name);
content += '<a href="' + this.link + '" title="' + this.name + '" class="cart_block_product_name">' + name + '</a>';
if (this.is_gift != undefined && this.is_gift == 1)
if (typeof(this.is_gift) == 'undefined' || this.is_gift == 0)
content += '<span class="remove_link"><a rel="nofollow" class="ajax_cart_block_remove_link" href="' + baseUri + '?controller=cart&amp;delete=1&amp;id_product=' + productId + '&amp;token=' + static_token + (this.hasAttributes ? '&amp;ipa=' + parseInt(this.idCombination) : '') + '"> </a></span>';
else
content += '<span class="remove_link"></span>';
+33 -4
View File
@@ -106,10 +106,39 @@ class LoyaltyDefaultModuleFrontController extends ModuleFrontController
$cart_rule->name[(int)$language['id_lang']] = $text ? strval($text) : strval($default_text);
}
if (is_array($categories) && count($categories))
$cart_rule->add(true, false, $categories);
else
$cart_rule->add();
$contains_categories = is_array($categories) && count($categories);
if ($contains_categories)
$cart_rule->product_restriction = 1;
$cart_rule->add();
//Restrict cartRules with categories
if ($contains_categories)
{
//Creating rule group
$id_cart_rule = (int)$cart_rule->id;
$sql = "INSERT INTO "._DB_PREFIX_."cart_rule_product_rule_group (id_cart_rule, quantity) VALUES ('$id_cart_rule', 1)";
Db::getInstance()->execute($sql);
$id_group = (int)Db::getInstance()->Insert_ID();
//Creating product rule
$sql = "INSERT INTO "._DB_PREFIX_."cart_rule_product_rule (id_product_rule_group, type) VALUES ('$id_group', 'categories')";
Db::getInstance()->execute($sql);
$id_product_rule = (int)Db::getInstance()->Insert_ID();
//Creating restrictions
$values = array();
foreach ($categories as $category) {
$category = (int)$category;
$values[] = "('$id_product_rule', '$category')";
}
$values = implode(',', $values);
$sql = "INSERT INTO "._DB_PREFIX_."cart_rule_product_rule_value (id_product_rule, id_item) VALUES $values";
Db::getInstance()->execute($sql);
}
// Register order(s) which contributed to create this voucher
if (!LoyaltyModule::registerDiscount($cart_rule))
+9 -3
View File
@@ -144,6 +144,8 @@ class Newsletter extends Module
AND a.`id_customer` = c.`id_customer`
AND a.`id_country` = '.(int)Tools::getValue('COUNTRY').') >= 1');
if (Context::getContext()->cookie->shopContext)
$dbquery->where('c.id_shop = '.(int)Context::getContext()->shop->id);
$rq = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($dbquery->build());
@@ -154,10 +156,14 @@ class Newsletter extends Module
private function _getBlockNewsletter()
{
$rq = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT `id`, `email`, `newsletter_date_add`, `ip_registration_newsletter`
$rqSql = 'SELECT `id`, `email`, `newsletter_date_add`, `ip_registration_newsletter`
FROM `'._DB_PREFIX_.'newsletter`
WHERE `active` = 1');
WHERE `active` = 1';
if (Context::getContext()->cookie->shopContext)
$rqSql .= ' AND `id_shop` = '.(int)Context::getContext()->shop->id;
$rq = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($rqSql);
$header = array('id_customer', 'email', 'newsletter_date_add', 'ip_address', 'http_referer');
$result = (is_array($rq) ? array_merge(array($header), $rq) : $header);
+15 -5
View File
@@ -49,7 +49,19 @@ class PSCleaner extends Module
{
$html = '<h2>'.$this->l('Be really careful with this tool - There is no possible rollback!').'</h2>';
if (Tools::isSubmit('submitCheckAndFix'))
$html .= $this->displayConfirmation((count($logs = self::checkAndFix()) ? '<pre>'.print_r($logs, true).'</pre>' : $this->l('Nothing that need to be cleaned')).'<br /><br />');
{
$logs = self::checkAndFix();
if (count($logs))
{
$conf = $this->l('The following queries successfuly fixed broken data:').'<br /><ul>';
foreach ($logs as $query => $entries)
$conf .= '<li>'.Tools::htmlentitiesUTF8($query).'<br />'.sprintf($this->l('%d line(s)'), $entries).'</li>';
$conf .= '</ul>';
}
else
$conf = $this->l('Nothing that need to be cleaned');
$html .= $this->displayConfirmation($conf);
}
if (Tools::isSubmit('submitTruncateCatalog'))
{
self::truncate('catalog');
@@ -330,7 +342,7 @@ class PSCleaner extends Module
if ($affected_rows = $db->Affected_Rows())
$logs[$query] = $affected_rows;
}
Category::regenerateEntireNtree();
// @Todo: Remove attachment files, images...
@@ -522,8 +534,6 @@ class PSCleaner extends Module
protected function clearAllCaches()
{
$this->_clearCache('blockcategories.tpl');
$this->_clearCache('blockcategories_footer.tpl');
$this->_clearCache('blocktopmenu.tpl');
Context::getContext()->smarty->clearAllCache();
}
}
+11 -10
View File
@@ -105,8 +105,14 @@ class SEKeywords extends ModuleGraph
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query.ModuleGraph::getDateBetween().$this->_query2);
$total = count($result);
$this->html = '<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2>
<p>'.
($total == 1 ? sprintf($this->l('%d keyword matches your query.'), $total) : sprintf($this->l('%d keywords match your query.'), $total)).'</p>';
<p>'.($total == 1 ? sprintf($this->l('%d keyword matches your query.'), $total) : sprintf($this->l('%d keywords match your query.'), $total)).'</p>';
$form = '<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">
'.$this->l('Filter by keyword').' <input type="text" name="SEK_FILTER_KW" value="'.Tools::htmlentitiesUTF8(Configuration::get('SEK_FILTER_KW')).'" />
'.$this->l('And min occurrences').' <input type="text" name="SEK_MIN_OCCURENCES" value="'.(int)Configuration::get('SEK_MIN_OCCURENCES').'" />
<input type="submit" class="button" name="submitSEK" value="'.$this->l('Apply ').'" />
</form>';
if ($result && $total)
{
$table = '
@@ -125,16 +131,11 @@ class SEKeywords extends ModuleGraph
$table .= '</tbody></table></div>';
$this->html .= '<div>'.$this->engine(array('type' => 'pie')).'</div>
<br/>
<p><a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=language"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p><br/>
<form action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post">
'.$this->l('Filter by keyword').' <input type="text" name="SEK_FILTER_KW" value="'.Tools::htmlentitiesUTF8(Configuration::get('SEK_FILTER_KW')).'" />
'.$this->l('And min occurrences').' <input type="text" name="SEK_MIN_OCCURENCES" value="'.(int)Configuration::get('SEK_MIN_OCCURENCES').'" />
<input type="submit" class="button" name="submitSEK" value="'.$this->l('Apply ').'" />
</form>
<br/>'.$table;
<p><a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=language"><img src="../img/admin/asterisk.gif" /> '.$this->l('CSV Export').'</a></p><br/>
'.$form.'<br/>'.$table;
}
else
$this->html .= '<p><strong>'.$this->l('No keywords').'</strong></p>';
$this->html .= '<p>'.$form.'<strong>'.$this->l('No keywords').'</strong></p>';
$this->html .= '</div><br/>
<div class="blocStats"><h2 class="icon-guide"><span></span>'.$this->l('Guide').'</h2>
+44 -15
View File
@@ -57,18 +57,37 @@ class StatsLive extends Module
*/
private function getCustomersOnline()
{
$sql = 'SELECT u.id_customer, u.firstname, u.lastname, pt.name as page
FROM `'._DB_PREFIX_.'connections` c
LEFT JOIN `'._DB_PREFIX_.'connections_page` cp ON c.id_connections = cp.id_connections
LEFT JOIN `'._DB_PREFIX_.'page` p ON p.id_page = cp.id_page
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON p.id_page_type = pt.id_page_type
INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest
INNER JOIN `'._DB_PREFIX_.'customer` u ON u.id_customer = g.id_customer
WHERE cp.`time_end` IS NULL
'.Shop::addSqlRestriction(false, 'c').'
AND TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900
GROUP BY c.id_connections
ORDER BY u.firstname, u.lastname';
if ($maintenance_ips = Configuration::get('PS_MAINTENANCE_IP'))
$maintenance_ips = implode(',', array_map('ip2long', array_map('trim', explode(',', $maintenance_ips))));
if (Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS'))
{
$sql = 'SELECT u.id_customer, u.firstname, u.lastname, pt.name as page
FROM `'._DB_PREFIX_.'connections` c
LEFT JOIN `'._DB_PREFIX_.'connections_page` cp ON c.id_connections = cp.id_connections
LEFT JOIN `'._DB_PREFIX_.'page` p ON p.id_page = cp.id_page
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON p.id_page_type = pt.id_page_type
INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest
INNER JOIN `'._DB_PREFIX_.'customer` u ON u.id_customer = g.id_customer
WHERE cp.`time_end` IS NULL
'.Shop::addSqlRestriction(false, 'c').'
AND TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900
'.($maintenance_ips ? 'AND c.ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '').'
GROUP BY u.id_customer
ORDER BY u.firstname, u.lastname';
}
else
{
$sql = 'SELECT u.id_customer, u.firstname, u.lastname, "-" as page
FROM `'._DB_PREFIX_.'connections` c
INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest
INNER JOIN `'._DB_PREFIX_.'customer` u ON u.id_customer = g.id_customer
WHERE TIME_TO_SEC(TIMEDIFF(NOW(), c.`date_add`)) < 900
'.Shop::addSqlRestriction(false, 'c').'
'.($maintenance_ips ? 'AND c.ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '').'
GROUP BY u.id_customer
ORDER BY u.firstname, u.lastname';
}
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
return array($results, Db::getInstance()->NumRows());
}
@@ -80,6 +99,9 @@ class StatsLive extends Module
*/
private function getVisitorsOnline()
{
if ($maintenance_ips = Configuration::get('PS_MAINTENANCE_IP'))
$maintenance_ips = implode(',', array_map('ip2long', array_map('trim', explode(',', $maintenance_ips))));
if (Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS'))
{
$sql = 'SELECT c.id_guest, c.ip_address, c.date_add, c.http_referer, pt.name as page
@@ -91,18 +113,20 @@ class StatsLive extends Module
WHERE (g.id_customer IS NULL OR g.id_customer = 0)
'.Shop::addSqlRestriction(false, 'c').'
AND cp.`time_end` IS NULL
AND TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900
AND TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900
'.($maintenance_ips ? 'AND c.ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '').'
GROUP BY c.id_connections
ORDER BY c.date_add DESC';
}
else
{
$sql = 'SELECT c.id_guest, c.ip_address, c.date_add, c.http_referer
$sql = 'SELECT c.id_guest, c.ip_address, c.date_add, c.http_referer, "-" as page
FROM `'._DB_PREFIX_.'connections` c
INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest
WHERE (g.id_customer IS NULL OR g.id_customer = 0)
'.Shop::addSqlRestriction(false, 'c').'
AND TIME_TO_SEC(TIMEDIFF(NOW(), c.`date_add`)) < 900
'.($maintenance_ips ? 'AND c.ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '').'
ORDER BY c.date_add DESC';
}
@@ -168,7 +192,12 @@ class StatsLive extends Module
}
else
$this->html .= $this->l('There are no visitors online.');
$this->html .= '</fieldset>';
$this->html .= '</fieldset>
<br />
<fieldset><legend>'.$this->l('Notice').'</legend>
'.$this->l('Maintenance IP(s) are excluded from the online visitors.').'<br />
<a href="index.php?controller=AdminMaintenance&token='.Tools::getAdminTokenLite('AdminMaintenance').'">'.$this->l('Add or remove an IP address.').'</a>
</fieldset>';
return $this->html;
}
+3 -6
View File
@@ -164,7 +164,7 @@
</tr>
{foreach $order_detail.customizedDatas as $customizationPerAddress}
{foreach $customizationPerAddress as $customizationId => $customization}
<tr style="line-height:6px;background-color:{$bgcolor}; ">
<tr style="line-height:6px;background-color:{$bgcolor};">
<td style="line-height:3px; text-align: left; width: 45%; vertical-align: top">
<blockquote>
@@ -198,11 +198,8 @@
<!-- CART RULES -->
{assign var="shipping_discount_tax_incl" value="0"}
{foreach $cart_rules as $cart_rule}
{if $cart_rule.free_shipping}
{assign var="shipping_discount_tax_incl" value=$order_invoice->total_shipping_tax_incl}
{/if}
{cycle values='#FFF,#DDD' assign=bgcolor}
<tr style="line-height:6px;background-color:{$bgcolor}" text-align="left">
<tr style="line-height:6px;background-color:{$bgcolor};text-align:left;">
<td style="line-height:3px;text-align:left;width:60%;vertical-align:top" colspan="{if !$tax_excluded_display}5{else}4{/if}">{$cart_rule.name}</td>
<td>
{if $tax_excluded_display}
@@ -237,7 +234,7 @@
{if $order_invoice->total_discount_tax_incl > 0}
<tr style="line-height:5px;">
<td style="text-align: right; font-weight: bold">{l s='Total Vouchers' pdf='true'}</td>
<td style="width: 17%; text-align: right;">-{displayPrice currency=$order->id_currency price=($order_invoice->total_discount_tax_incl + $shipping_discount_tax_incl)}</td>
<td style="width: 17%; text-align: right;">-{displayPrice currency=$order->id_currency price=($order_invoice->total_discount_tax_incl)}</td>
</tr>
{/if}
+2
View File
@@ -377,6 +377,8 @@ function deleteProductFromSummary(id)
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (typeof(getCarrierListAndUpdate) !== 'undefined' && jsonData.summary.products.length > 0)
getCarrierListAndUpdate();
if (typeof(updatePaymentMethodsDisplay) !== 'undefined')
updatePaymentMethodsDisplay();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
+1 -1
View File
@@ -37,7 +37,7 @@
<ul class="step" id="order_step">
<li class="{if $current_step=='summary'}step_current{else}{if $current_step=='payment' || $current_step=='shipping' || $current_step=='address' || $current_step=='login'}step_done{else}step_todo{/if}{/if}">
{if $current_step=='payment' || $current_step=='shipping' || $current_step=='address' || $current_step=='login'}
<a href="{$link->getPageLink('order', true, NULL, "{$smarty.capture.url_back}&multi-shipping={$multi_shipping}")|escape:'html'}">
<a href="{$link->getPageLink('order', true)}">
1. {l s='Summary'}
</a>
{else}