diff --git a/admin-dev/drawer.php b/admin-dev/drawer.php index c52ea4547..22baa705c 100644 --- a/admin-dev/drawer.php +++ b/admin-dev/drawer.php @@ -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(); - diff --git a/admin-dev/grider.php b/admin-dev/grider.php index 6e97baf68..a8506a94d 100644 --- a/admin-dev/grider.php +++ b/admin-dev/grider.php @@ -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(); diff --git a/admin-dev/themes/default/template/controllers/orders/_documents.tpl b/admin-dev/themes/default/template/controllers/orders/_documents.tpl index 45b9123bd..47671da59 100644 --- a/admin-dev/themes/default/template/controllers/orders/_documents.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_documents.tpl @@ -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} diff --git a/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl index 4c592b9a1..c43c3c0fc 100755 --- a/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -325,7 +325,7 @@ {displayPrice price=$payment->amount currency=$payment->id_currency} {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 @@ diff --git a/admin-dev/themes/default/template/controllers/payment/restrictions.tpl b/admin-dev/themes/default/template/controllers/payment/restrictions.tpl index 9cfb18625..80e705eb4 100644 --- a/admin-dev/themes/default/template/controllers/payment/restrictions.tpl +++ b/admin-dev/themes/default/template/controllers/payment/restrictions.tpl @@ -64,7 +64,7 @@ {$type = 'checkbox'} {/if} {if $type != 'null'} - + {else} -- {/if} diff --git a/admin-dev/themes/default/template/helpers/form/form.tpl b/admin-dev/themes/default/template/helpers/form/form.tpl index 96d43a781..e737e5b43 100644 --- a/admin-dev/themes/default/template/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/helpers/form/form.tpl @@ -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'}
diff --git a/classes/Combination.php b/classes/Combination.php index 27148b7b3..47b8e2eca 100644 --- a/classes/Combination.php +++ b/classes/Combination.php @@ -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; diff --git a/classes/Link.php b/classes/Link.php index 9c5658ade..e5019b07a 100644 --- a/classes/Link.php +++ b/classes/Link.php @@ -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; } diff --git a/classes/Media.php b/classes/Media.php index a769218e2..31b960cf9 100755 --- a/classes/Media.php +++ b/classes/Media.php @@ -1,6 +1,6 @@ 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) diff --git a/classes/SpecificPrice.php b/classes/SpecificPrice.php index f47f1a5c4..27475c771 100644 --- a/classes/SpecificPrice.php +++ b/classes/SpecificPrice.php @@ -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); } diff --git a/classes/Tools.php b/classes/Tools.php index fab8c7385..558f13c52 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -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'); diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index db328b8de..48366d2c4 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -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.' ' : '').' diff --git a/classes/module/Module.php b/classes/module/Module.php index 4f7281ba4..6067612b6 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -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) diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php index b12bcd91a..d78c5318c 100644 --- a/classes/order/OrderHistory.php +++ b/classes/order/OrderHistory.php @@ -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 : diff --git a/classes/pdf/HTMLTemplateDeliverySlip.php b/classes/pdf/HTMLTemplateDeliverySlip.php index e6cf7faf0..b5ea014fe 100755 --- a/classes/pdf/HTMLTemplateDeliverySlip.php +++ b/classes/pdf/HTMLTemplateDeliverySlip.php @@ -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'; } } diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index b66d092a4..8116eb03c 100755 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -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'; } } diff --git a/classes/tax/TaxRulesGroup.php b/classes/tax/TaxRulesGroup.php index 02391e134..1ef0dac0f 100644 --- a/classes/tax/TaxRulesGroup.php +++ b/classes/tax/TaxRulesGroup.php @@ -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; diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index f9d9a803a..9ca3c4fba 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -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, diff --git a/controllers/admin/AdminShopUrlController.php b/controllers/admin/AdminShopUrlController.php index f7fd28c78..05d3ca9d1 100644 --- a/controllers/admin/AdminShopUrlController.php +++ b/controllers/admin/AdminShopUrlController.php @@ -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(); + } } diff --git a/controllers/admin/AdminStockManagementController.php b/controllers/admin/AdminStockManagementController.php index cb14e032d..22319e557 100644 --- a/controllers/admin/AdminStockManagementController.php +++ b/controllers/admin/AdminStockManagementController.php @@ -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); diff --git a/controllers/admin/AdminTaxRulesGroupController.php b/controllers/admin/AdminTaxRulesGroupController.php index ac37c2d72..63772700d 100644 --- a/controllers/admin/AdminTaxRulesGroupController.php +++ b/controllers/admin/AdminTaxRulesGroupController.php @@ -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; diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index a50bb3c4a..36dbaa061 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -983,8 +983,6 @@ class AdminTranslationsControllerCore extends AdminController 'header.inc.php', 'footer.inc.php', 'index.php', - 'login.php', - 'password.php', 'functions.php' ) ) diff --git a/controllers/front/IdentityController.php b/controllers/front/IdentityController.php index 048a1d07a..7f0eb50b4 100644 --- a/controllers/front/IdentityController.php +++ b/controllers/front/IdentityController.php @@ -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.'); diff --git a/controllers/front/PasswordController.php b/controllers/front/PasswordController.php index 1a7959887..e36d84a9a 100644 --- a/controllers/front/PasswordController.php +++ b/controllers/front/PasswordController.php @@ -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 { diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 7244ffb36..c1a2c6ca4 100755 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -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 -@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 \ No newline at end of file diff --git a/img/admin/external_link.png b/img/admin/external_link.png new file mode 100644 index 000000000..8951d24d4 Binary files /dev/null and b/img/admin/external_link.png differ diff --git a/install-dev/langs/pl/img/index.php b/install-dev/langs/pl/img/index.php index f9382edba..5ddf5bce0 100644 --- a/install-dev/langs/pl/img/index.php +++ b/install-dev/langs/pl/img/index.php @@ -1,6 +1,6 @@ -* @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 */ diff --git a/install-dev/langs/pl/index.php b/install-dev/langs/pl/index.php index 04675e9e1..8fdf0d3e3 100644 --- a/install-dev/langs/pl/index.php +++ b/install-dev/langs/pl/index.php @@ -1,6 +1,6 @@ -* @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 */ diff --git a/install-dev/langs/ru/img/index.php b/install-dev/langs/ru/img/index.php index f9382edba..5ddf5bce0 100644 --- a/install-dev/langs/ru/img/index.php +++ b/install-dev/langs/ru/img/index.php @@ -1,6 +1,6 @@ -* @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 */ diff --git a/install-dev/langs/ru/index.php b/install-dev/langs/ru/index.php index 04675e9e1..8fdf0d3e3 100644 --- a/install-dev/langs/ru/index.php +++ b/install-dev/langs/ru/index.php @@ -1,6 +1,6 @@ -* @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 */ diff --git a/install-dev/upgrade/php/add_new_tab.php b/install-dev/upgrade/php/add_new_tab.php index 009244a3e..602b2477a 100644 --- a/install-dev/upgrade/php/add_new_tab.php +++ b/install-dev/upgrade/php/add_new_tab.php @@ -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) { diff --git a/install-dev/upgrade/sql/1.5.4.0.sql b/install-dev/upgrade/sql/1.5.4.0.sql index 75da0cf64..9f486c66c 100644 --- a/install-dev/upgrade/sql/1.5.4.0.sql +++ b/install-dev/upgrade/sql/1.5.4.0.sql @@ -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(); */; diff --git a/install-dev/upgrade/sql/1.5.5.0.sql b/install-dev/upgrade/sql/1.5.5.0.sql index d901a9386..934492867 100644 --- a/install-dev/upgrade/sql/1.5.5.0.sql +++ b/install-dev/upgrade/sql/1.5.5.0.sql @@ -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`; \ No newline at end of file +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; diff --git a/js/admin-products.js b/js/admin-products.js index a7f47dd46..dbe4cfd4a 100644 --- a/js/admin-products.js +++ b/js/admin-products.js @@ -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"); }); }; } diff --git a/js/admin.js b/js/admin.js index d5ef76b71..eeb866364 100644 --- a/js/admin.js +++ b/js/admin.js @@ -211,7 +211,7 @@ function displayFlags(languages, defaultLanguageID, employee_cookie) $.each(languages, function(key, language) { var 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() { diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index ba49d6c75..3c2658756 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -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(' '); - } + $('#' + domIdProduct + ' span.remove_link').html(' '); 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 += '' + name + ''; - if (this.is_gift != undefined && this.is_gift == 1) + if (typeof(this.is_gift) == 'undefined' || this.is_gift == 0) content += ' '; else content += ''; diff --git a/modules/loyalty/controllers/front/default.php b/modules/loyalty/controllers/front/default.php index 9195706c4..64e152db0 100644 --- a/modules/loyalty/controllers/front/default.php +++ b/modules/loyalty/controllers/front/default.php @@ -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)) diff --git a/modules/newsletter/newsletter.php b/modules/newsletter/newsletter.php index 4c2a2b815..e125305b9 100644 --- a/modules/newsletter/newsletter.php +++ b/modules/newsletter/newsletter.php @@ -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); diff --git a/modules/pscleaner/pscleaner.php b/modules/pscleaner/pscleaner.php index 35e6f62de..67ea6595c 100644 --- a/modules/pscleaner/pscleaner.php +++ b/modules/pscleaner/pscleaner.php @@ -49,7 +49,19 @@ class PSCleaner extends Module { $html = '

'.$this->l('Be really careful with this tool - There is no possible rollback!').'

'; if (Tools::isSubmit('submitCheckAndFix')) - $html .= $this->displayConfirmation((count($logs = self::checkAndFix()) ? '
'.print_r($logs, true).'
' : $this->l('Nothing that need to be cleaned')).'

'); + { + $logs = self::checkAndFix(); + if (count($logs)) + { + $conf = $this->l('The following queries successfuly fixed broken data:').'
'; + } + 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(); } } diff --git a/modules/sekeywords/sekeywords.php b/modules/sekeywords/sekeywords.php index 942f9f053..24be726ad 100644 --- a/modules/sekeywords/sekeywords.php +++ b/modules/sekeywords/sekeywords.php @@ -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 = '

'.$this->displayName.'

-

'. - ($total == 1 ? sprintf($this->l('%d keyword matches your query.'), $total) : sprintf($this->l('%d keywords match your query.'), $total)).'

'; +

'.($total == 1 ? sprintf($this->l('%d keyword matches your query.'), $total) : sprintf($this->l('%d keywords match your query.'), $total)).'

'; + + $form = '
+ '.$this->l('Filter by keyword').' + '.$this->l('And min occurrences').' + +
'; + if ($result && $total) { $table = ' @@ -125,16 +131,11 @@ class SEKeywords extends ModuleGraph $table .= '
'; $this->html .= '
'.$this->engine(array('type' => 'pie')).'

-

'.$this->l('CSV Export').'


-
- '.$this->l('Filter by keyword').' - '.$this->l('And min occurrences').' - -
-
'.$table; +

'.$this->l('CSV Export').'


+ '.$form.'
'.$table; } else - $this->html .= '

'.$this->l('No keywords').'

'; + $this->html .= '

'.$form.''.$this->l('No keywords').'

'; $this->html .= '

'.$this->l('Guide').'

diff --git a/modules/statslive/statslive.php b/modules/statslive/statslive.php index e935f54d5..efc222eb5 100644 --- a/modules/statslive/statslive.php +++ b/modules/statslive/statslive.php @@ -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 .= ''; + $this->html .= ' +
+
'.$this->l('Notice').' + '.$this->l('Maintenance IP(s) are excluded from the online visitors.').'
+ '.$this->l('Add or remove an IP address.').' +
'; return $this->html; } diff --git a/pdf/invoice.tpl b/pdf/invoice.tpl index 44c7cc1b0..1f48322ce 100755 --- a/pdf/invoice.tpl +++ b/pdf/invoice.tpl @@ -164,7 +164,7 @@ {foreach $order_detail.customizedDatas as $customizationPerAddress} {foreach $customizationPerAddress as $customizationId => $customization} - +
@@ -198,11 +198,8 @@ {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} - + {$cart_rule.name} {if $tax_excluded_display} @@ -237,7 +234,7 @@ {if $order_invoice->total_discount_tax_incl > 0} {l s='Total Vouchers' pdf='true'} - -{displayPrice currency=$order->id_currency price=($order_invoice->total_discount_tax_incl + $shipping_discount_tax_incl)} + -{displayPrice currency=$order->id_currency price=($order_invoice->total_discount_tax_incl)} {/if} diff --git a/themes/default/js/cart-summary.js b/themes/default/js/cart-summary.js index 8c43483c9..218faf25a 100644 --- a/themes/default/js/cart-summary.js +++ b/themes/default/js/cart-summary.js @@ -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) { diff --git a/themes/default/order-steps.tpl b/themes/default/order-steps.tpl index edb3a549b..91c653bbf 100644 --- a/themes/default/order-steps.tpl +++ b/themes/default/order-steps.tpl @@ -37,7 +37,7 @@