Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
+2
-2
@@ -8,5 +8,5 @@ All core files you commit in your pull request must have Open Software License (
|
||||
All modules files you commit in your pull request must have Academic Free License (AFL 3.0)
|
||||
|
||||
[1]: https://help.github.com/articles/using-pull-requests
|
||||
[2]: http://docs.prestashop.com/display/PS15/Coding+Standard
|
||||
[3]: http://docs.prestashop.com/display/PS15/How+to+write+a+commit+message
|
||||
[2]: http://docs.prestashop.com/display/PS15/Coding+Standards
|
||||
[3]: http://docs.prestashop.com/display/PS15/How+to+write+a+commit+message
|
||||
|
||||
@@ -25,5 +25,5 @@
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
require(_PS_ADMIN_DIR_.'/config/config.inc.php');
|
||||
require(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
Controller::getController('GetFileController')->run();
|
||||
@@ -49,10 +49,12 @@
|
||||
|
||||
if (perm == 'all' && $(this).parent().parent().hasClass('parent'))
|
||||
{
|
||||
checked = enabled ? 'checked': '';
|
||||
$(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').attr('checked', checked);
|
||||
if (enabled)
|
||||
$(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').attr('checked', 'checked');
|
||||
else
|
||||
$(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').removeAttr('checked');
|
||||
$.ajax({
|
||||
url: "{$link->getAdminLink('AdminAccess')}",
|
||||
url: "{$link->getAdminLink('AdminAccess')|addslashes}",
|
||||
cache: false,
|
||||
data : {
|
||||
ajaxMode : '1',
|
||||
@@ -68,15 +70,12 @@
|
||||
},
|
||||
success : function(res,textStatus,jqXHR)
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
if (res == 'ok')
|
||||
showSuccessMessage("{l s='Update successful'}");
|
||||
else
|
||||
showErrorMessage("{l s='Update error'}");
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
} catch(e) {
|
||||
jAlert('Technical error');
|
||||
}
|
||||
}
|
||||
@@ -85,7 +84,7 @@
|
||||
perfect_access_js_gestion(this, perm, id_tab, tabsize, tabnumber, table);
|
||||
|
||||
$.ajax({
|
||||
url: "{$link->getAdminLink('AdminAccess')}",
|
||||
url: "{$link->getAdminLink('AdminAccess')|addslashes}",
|
||||
cache: false,
|
||||
data : {
|
||||
ajaxMode : '1',
|
||||
@@ -134,7 +133,7 @@
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: "{$link->getAdminLink('AdminAccess')}",
|
||||
url: "{$link->getAdminLink('AdminAccess')|addslashes}",
|
||||
cache: false,
|
||||
data : {
|
||||
ajaxMode: '1',
|
||||
|
||||
@@ -48,6 +48,21 @@
|
||||
</div>
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{/block}
|
||||
{block name="label"}
|
||||
{if $input.name == 'standardization'}
|
||||
<div id="TAASC" style="display: none;">{$smarty.block.parent}
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name="input"}
|
||||
{if $input.name == 'standardization'}
|
||||
{$smarty.block.parent}</div>
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
@@ -85,7 +100,11 @@
|
||||
$('#need_zip_code_on, #need_zip_code_off').change(function() {
|
||||
disableZipFormat();
|
||||
});
|
||||
|
||||
|
||||
$('#iso_code').change(function() {
|
||||
disableTAASC();
|
||||
});
|
||||
disableTAASC();
|
||||
});
|
||||
|
||||
function switchExplanationText(text) {
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
ifSuperAdmin($(this));
|
||||
|
||||
$.ajax({
|
||||
url: "{$link->getAdminLink('AdminEmployees')}",
|
||||
url: "{$link->getAdminLink('AdminEmployees')|addslashes}",
|
||||
cache: false,
|
||||
data : {
|
||||
ajax : '1',
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{$link->getAdminLink('AdminInformation')}',
|
||||
url: '{$link->getAdminLink('AdminInformation')|addslashes}',
|
||||
data: {
|
||||
'action': 'checkFiles',
|
||||
'ajax': 1
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if isset($controller) && !empty($controller) && $controller != 'adminnotfound'}
|
||||
<h1>{l s='The controller %s is missing or invalid.' sprintf=$controller}</h1>
|
||||
{/if}
|
||||
<ul>
|
||||
<li><a href="index.php">{l s='Go to the dashboard.'}</a></li>
|
||||
<li><a href="#" onclick="window.history.back();">{l s='Back to the previous page.'}</a></li>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<span id="shipping_number_show">{if $line.url && $line.tracking_number}<a href="{$line.url|replace:'@':$line.tracking_number}">{$line.tracking_number}</a>{else}{$line.tracking_number}{/if}</span>
|
||||
<span id="shipping_number_show">{if $line.url && $line.tracking_number}<a target="_blank" href="{$line.url|replace:'@':$line.tracking_number}">{$line.tracking_number}</a>{else}{$line.tracking_number}{/if}</span>
|
||||
{if $line.can_edit}
|
||||
<form style="display: inline;" method="post" action="{$link->getAdminLink('AdminOrders')|escape:'htmlall':'UTF-8'}&vieworder&id_order={$order->id|escape:'htmlall':'UTF-8'}">
|
||||
<span class="shipping_number_edit" style="display:none;">
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
var changed_shipping_price = false;
|
||||
var shipping_price_selected_carrier = '';
|
||||
var current_index = '{$current}&token={$token}';
|
||||
var admin_cart_link = '{$link->getAdminLink('AdminCarts')}';
|
||||
var admin_cart_link = '{$link->getAdminLink('AdminCarts')|escape:'html'}';
|
||||
var cart_quantity = new Array();
|
||||
var currencies = new Array();
|
||||
var id_currency = '';
|
||||
@@ -100,7 +100,7 @@
|
||||
$('#show_old_carts').click();
|
||||
$('#payment_module_name').change();
|
||||
$.ajaxSetup({ type:"post" });
|
||||
$("#voucher").autocomplete('{$link->getAdminLink('AdminCartRules')}', {
|
||||
$("#voucher").autocomplete('{$link->getAdminLink('AdminCartRules')|escape:'html'}', {
|
||||
minChars: 3,
|
||||
max: 15,
|
||||
width: 250,
|
||||
@@ -157,7 +157,7 @@
|
||||
free_shipping = 1;
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -217,7 +217,7 @@
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -254,7 +254,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -288,7 +288,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -324,7 +324,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -351,7 +351,7 @@
|
||||
$('#id_cart').val(id_cart);
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: false,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -378,7 +378,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -401,7 +401,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -426,7 +426,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url : "{$link->getAdminLink('AdminOrders')}",
|
||||
url : "{$link->getAdminLink('AdminOrders')|escape:'html'}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -468,7 +468,7 @@
|
||||
$('#new_address').attr('href', address_link.replace(/id_customer=[0-9]+/, 'id_customer='+id_customer));
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url : "{$link->getAdminLink('AdminCarts')}",
|
||||
url : "{$link->getAdminLink('AdminCarts')|escape:'html'}",
|
||||
async: false,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -534,7 +534,7 @@
|
||||
$('#products_part').show();
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminOrders')}",
|
||||
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -766,7 +766,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -822,7 +822,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -845,7 +845,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -868,7 +868,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -899,7 +899,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminOrders')}",
|
||||
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
@@ -957,7 +957,7 @@
|
||||
{
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url: "{$link->getAdminLink('AdminCarts')}",
|
||||
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||
async: true,
|
||||
dataType: "json",
|
||||
data : {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
{block name="override_tpl"}
|
||||
<script type="text/javascript">
|
||||
var admin_order_tab_link = "{$link->getAdminLink('AdminOrders')}";
|
||||
var admin_order_tab_link = "{$link->getAdminLink('AdminOrders')|escape:'html'}";
|
||||
var id_order = {$order->id};
|
||||
var id_lang = {$current_id_lang};
|
||||
var id_currency = {$order->id_currency};
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
{assign var="hook_invoice" value={hook h="displayInvoice" id_order=$order->id}}
|
||||
{if ($hook_invoice)}
|
||||
<div style="float: right; margin: -40px 40px 10px 0;">{$hook_invoice}</div><br class="clear" />';
|
||||
<div style="float: right; margin: -40px 40px 10px 0;">{$hook_invoice}</div><br class="clear" />
|
||||
{/if}
|
||||
|
||||
<div class="bloc-command">
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
$('document').ready( function() {
|
||||
$(".check_product_name")
|
||||
.autocomplete(
|
||||
'{$link->getAdminLink('AdminProducts', true)}', {
|
||||
'{$link->getAdminLink('AdminProducts', true)|escape:'html'}', {
|
||||
minChars: 3,
|
||||
max: 10,
|
||||
width: $(".check_product_name").width(),
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var Customer = new Object();
|
||||
var product_url = '{$link->getAdminLink('AdminProducts', true)}';
|
||||
var product_url = '{$link->getAdminLink('AdminProducts', true)|addslashes}';
|
||||
var ecotax_tax_excl = parseFloat({$ecotax_tax_excl});
|
||||
$(document).ready(function () {
|
||||
Customer = {
|
||||
@@ -56,7 +56,7 @@ $(document).ready(function () {
|
||||
Customer.showLoader();
|
||||
jQuery.ajax({
|
||||
"type": "POST",
|
||||
"url": "{$link->getAdminLink('AdminCustomers')}",
|
||||
"url": "{$link->getAdminLink('AdminCustomers')|addslashes}",
|
||||
"async": true,
|
||||
"dataType": "json",
|
||||
"data": {
|
||||
|
||||
@@ -159,7 +159,10 @@
|
||||
<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="{$up_filename}" />
|
||||
{/if}
|
||||
<div class="conf">
|
||||
<a class="delete_virtual_product" id="delete_downloadable_product" onclick="return confirm('{l s='Delete this file'}')" href="{$currentIndex}&deleteVirtualProduct=true&token={$token}&id_product={$product->id}" class="red">
|
||||
<script>
|
||||
delete_this_file = '{l s='Delete this file'}';
|
||||
</script>
|
||||
<a class="delete_virtual_product" id="delete_downloadable_product" href="{$currentIndex}&deleteVirtualProduct=true&token={$token}&id_product={$product->id}" class="red">
|
||||
<img src="../img/admin/delete.gif" alt="{l s='Delete this file'}"/>
|
||||
</a>
|
||||
</div>
|
||||
@@ -173,7 +176,7 @@
|
||||
</td>
|
||||
<td class="col-right">
|
||||
{$product->productDownload->getHtmlLink(false, true)}
|
||||
<a onclick="return confirm('{l s='Delete this file'})')" href="{$currentIndex}&deleteVirtualProduct=true&token={$token}&id_product={$product->id}" class="red delete_virtual_product">
|
||||
<a href="{$currentIndex}&deleteVirtualProduct=true&token={$token}&id_product={$product->id}" class="red delete_virtual_product">
|
||||
<img src="../img/admin/delete.gif" alt="{l s='Delete this file'}"/>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
@@ -186,7 +186,7 @@ $("#multishop-tree").jstree({
|
||||
'plugins': ["themes","json_data","cookies","contextmenu"],
|
||||
'json_data': {
|
||||
'ajax': {
|
||||
'url': "{$link->getAdminLink('AdminShop')}",
|
||||
'url': "{$link->getAdminLink('AdminShop')|addslashes}",
|
||||
'data': function(n)
|
||||
{
|
||||
return {
|
||||
|
||||
+6
-1
@@ -222,7 +222,7 @@ class AddressCore extends ObjectModel
|
||||
public function validateController($htmlentities = true)
|
||||
{
|
||||
$errors = parent::validateController($htmlentities);
|
||||
if (!Configuration::get('VATNUMBER_CHECKING'))
|
||||
if (!Configuration::get('VATNUMBER_MANAGEMENT') || !Configuration::get('VATNUMBER_CHECKING'))
|
||||
return $errors;
|
||||
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
|
||||
if (class_exists('VatNumber', false))
|
||||
@@ -237,6 +237,8 @@ class AddressCore extends ObjectModel
|
||||
*/
|
||||
public static function getZoneById($id_address)
|
||||
{
|
||||
if(!isset($id_address) || empty($id_address))
|
||||
return false;
|
||||
if (isset(self::$_idZones[$id_address]))
|
||||
return self::$_idZones[$id_address];
|
||||
|
||||
@@ -259,6 +261,9 @@ class AddressCore extends ObjectModel
|
||||
*/
|
||||
public static function isCountryActiveById($id_address)
|
||||
{
|
||||
if(!isset($id_address) || empty($id_address))
|
||||
return false;
|
||||
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT c.`active`
|
||||
FROM `'._DB_PREFIX_.'address` a
|
||||
|
||||
@@ -1676,9 +1676,9 @@ abstract class AdminTabCore
|
||||
elseif (isset($params['float']))
|
||||
echo rtrim(rtrim($tr[$key], '0'), '.');
|
||||
elseif (isset($params['type']) && $params['type'] == 'date')
|
||||
echo Tools::displayDate($tr[$key], $this->context->language->id);
|
||||
echo Tools::displayDate($tr[$key]);
|
||||
elseif (isset($params['type']) && $params['type'] == 'datetime')
|
||||
echo Tools::displayDate($tr[$key], $this->context->language->id, true);
|
||||
echo Tools::displayDate($tr[$key],null , true);
|
||||
elseif (isset($tr[$key]))
|
||||
{
|
||||
if ($key == 'price')
|
||||
|
||||
@@ -71,7 +71,7 @@ class AttributeCore extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!$this->hasMultishopEntries())
|
||||
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
{
|
||||
$result = Db::getInstance()->executeS('SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute_combination WHERE id_attribute = '.(int)$this->id);
|
||||
foreach ($result as $row)
|
||||
@@ -343,4 +343,4 @@ class AttributeCore extends ObjectModel
|
||||
|
||||
return (is_numeric($position)) ? $position : -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,11 @@ class AttributeGroupCore extends ObjectModel
|
||||
|
||||
public function add($autodate = true, $nullValues = false)
|
||||
{
|
||||
if ($this->group_type == 'color')
|
||||
$this->is_color_group = 1;
|
||||
else
|
||||
$this->is_color_group = 0;
|
||||
|
||||
if ($this->position <= 0)
|
||||
$this->position = AttributeGroup::getHigherPosition() + 1;
|
||||
|
||||
@@ -80,11 +85,16 @@ class AttributeGroupCore extends ObjectModel
|
||||
|
||||
public function update($nullValues = false)
|
||||
{
|
||||
if ($this->group_type == 'color')
|
||||
$this->is_color_group = 1;
|
||||
else
|
||||
$this->is_color_group = 0;
|
||||
|
||||
$return = parent::update($nullValues);
|
||||
Hook::exec('actionAttributeGroupSave', array('id_attribute_group' => $this->id));
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
public static function cleanDeadCombinations()
|
||||
{
|
||||
$attribute_combinations = Db::getInstance()->executeS('
|
||||
@@ -109,7 +119,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!$this->hasMultishopEntries())
|
||||
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
{
|
||||
/* Select children in order to find linked combinations */
|
||||
$attribute_ids = Db::getInstance()->executeS('
|
||||
|
||||
@@ -42,7 +42,7 @@ class BlowfishCore extends Crypt_Blowfish
|
||||
$piece = substr($paddedtext, $x, 8);
|
||||
$cipher_piece = parent::encrypt($piece);
|
||||
$encoded = base64_encode($cipher_piece);
|
||||
$ciphertext = $ciphertext.$encoded;
|
||||
$ciphertext = $ciphertext.$encoded;
|
||||
}
|
||||
return $ciphertext.sprintf('%06d', $length);
|
||||
}
|
||||
|
||||
+3
-1
@@ -467,7 +467,9 @@ class CarrierCore extends ObjectModel
|
||||
ORDER BY s.`name` ASC');
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT cl.*,c.*, cl.`name` AS country, zz.`name` AS zone FROM `'._DB_PREFIX_.'country` c
|
||||
SELECT cl.*,c.*, cl.`name` AS country, zz.`name` AS zone
|
||||
FROM `'._DB_PREFIX_.'country` c'.
|
||||
Shop::addSqlAssociation('country', 'c').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
|
||||
INNER JOIN (`'._DB_PREFIX_.'carrier_zone` cz INNER JOIN `'._DB_PREFIX_.'carrier` cr ON ( cr.id_carrier = cz.id_carrier AND cr.deleted = 0 '.
|
||||
($active_carriers ? 'AND cr.active = 1) ' : ') ').'
|
||||
|
||||
+4
-8
@@ -631,8 +631,8 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
$row2 = Db::getInstance()->getRow('
|
||||
SELECT image_shop.`id_image` id_image, il.`legend`
|
||||
FROM `'._DB_PREFIX_.'image` i'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (i.id_image = image_shop.id_image AND image_shop.cover=1 AND image_shop.id_shop='.(int)$row['id_shop'].')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->id_lang.')
|
||||
WHERE i.`id_product` = '.(int)$row['id_product'].' AND image_shop.`cover` = 1'
|
||||
);
|
||||
@@ -2958,12 +2958,8 @@ class CartCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
foreach ($this->getProducts() as $product)
|
||||
|
||||
if (!$product['active']
|
||||
|| (
|
||||
!$product['allow_oosp'] && $product['stock_quantity'] < $product['cart_quantity']
|
||||
)
|
||||
|| !$product['available_for_order'])
|
||||
if (!$product['active'] || !$product['available_for_order']
|
||||
|| (!$product['allow_oosp'] && $product['stock_quantity'] < $product['cart_quantity']))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
+16
-8
@@ -333,11 +333,8 @@ class CartRuleCore extends ObjectModel
|
||||
return array();
|
||||
|
||||
$productRuleGroups = array();
|
||||
$results = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM '._DB_PREFIX_.'cart_rule_product_rule_group prg
|
||||
WHERE prg.id_cart_rule = '.(int)$this->id, false);
|
||||
foreach ($results as $row)
|
||||
$result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'cart_rule_product_rule_group WHERE id_cart_rule = '.(int)$this->id);
|
||||
foreach ($result as $row)
|
||||
{
|
||||
if (!isset($productRuleGroups[$row['id_product_rule_group']]))
|
||||
$productRuleGroups[$row['id_product_rule_group']] = array('id_product_rule_group' => $row['id_product_rule_group'], 'quantity' => $row['quantity']);
|
||||
@@ -533,14 +530,21 @@ class CartRuleCore extends ObjectModel
|
||||
return (!$display_error) ? false : Tools::displayError('You have not reached the minimum amount required to use this voucher');
|
||||
}
|
||||
|
||||
// Check if the voucher is already in the cart of if a non compatible voucher is in the cart
|
||||
// Important note: this MUST be the last check, because if the tested cart rule has priority over a non combinable one in the cart, we will switch them
|
||||
/* This loop checks:
|
||||
- if the voucher is already in the cart
|
||||
- if a non compatible voucher is in the cart
|
||||
- if there are products in the cart (gifts excluded)
|
||||
Important note: this MUST be the last check, because if the tested cart rule has priority over a non combinable one in the cart, we will switch them
|
||||
*/
|
||||
$nb_products = Cart::getNbProducts($context->cart->id);
|
||||
$otherCartRules = $context->cart->getCartRules();
|
||||
if (count($otherCartRules))
|
||||
foreach ($otherCartRules as $otherCartRule)
|
||||
{
|
||||
if ($otherCartRule['id_cart_rule'] == $this->id && !$alreadyInCart)
|
||||
return (!$display_error) ? false : Tools::displayError('This voucher is already in your cart');
|
||||
if ($otherCartRule['gift_product'])
|
||||
--$nb_products;
|
||||
if ($this->cart_rule_restriction && $otherCartRule['cart_rule_restriction'] && $otherCartRule['id_cart_rule'] != $this->id)
|
||||
{
|
||||
$combinable = Db::getInstance()->getValue('
|
||||
@@ -561,6 +565,9 @@ class CartRuleCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
if (!$nb_products)
|
||||
return (!$display_error) ? false : Tools::displayError('Cart is empty');
|
||||
|
||||
if (!$display_error)
|
||||
return true;
|
||||
}
|
||||
@@ -630,7 +637,8 @@ class CartRuleCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'cart_product` cp
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` catp ON cp.id_product = catp.id_product
|
||||
WHERE cp.`id_cart` = '.(int)$context->cart->id.'
|
||||
AND cp.`id_product` IN ('.implode(array_map('intval', $eligibleProductsList), ',').')');
|
||||
AND cp.`id_product` IN ('.implode(array_map('intval', $eligibleProductsList), ',').')
|
||||
AND cp.`id_product` <> '.(int)$this->gift_product);
|
||||
$countMatchingProducts = 0;
|
||||
$matchingProductsList = array();
|
||||
foreach ($cartCategories as $cartCategory)
|
||||
|
||||
@@ -510,7 +510,7 @@ class CategoryCore extends ObjectModel
|
||||
die(Tools::displayError());
|
||||
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '='.(int)Group::getCurrent()->id);
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description
|
||||
@@ -684,8 +684,7 @@ class CategoryCore extends ObjectModel
|
||||
else
|
||||
return new Category($shop->getCategory(), $id_lang);
|
||||
$is_more_than_one_root_category = count(Category::getCategoriesWithoutParent()) > 1;
|
||||
if ((!Shop::isFeatureActive() && $is_more_than_one_root_category) ||
|
||||
Shop::isFeatureActive() && $is_more_than_one_root_category && Shop::getContext() != Shop::CONTEXT_SHOP)
|
||||
if (Shop::isFeatureActive() && $is_more_than_one_root_category && Shop::getContext() != Shop::CONTEXT_SHOP)
|
||||
$category = Category::getTopCategory($id_lang);
|
||||
else
|
||||
$category = new Category($shop->getCategory(), $id_lang);
|
||||
|
||||
@@ -61,32 +61,37 @@ class ConnectionsSourceCore extends ObjectModel
|
||||
$cookie = Context::getContext()->cookie;
|
||||
if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections))
|
||||
return false;
|
||||
|
||||
// If the referrer is not correct, we drop the connection
|
||||
if (isset($_SERVER['HTTP_REFERER']) && !Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER']))
|
||||
return false;
|
||||
// If there is no referrer and we do not want to save direct traffic (as opposed to referral traffic), we drop the connection
|
||||
if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC'))
|
||||
return false;
|
||||
|
||||
$source = new ConnectionsSource();
|
||||
if (isset($_SERVER['HTTP_REFERER']) && Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER']))
|
||||
|
||||
// There are a few more operations if there is a referrer
|
||||
if (isset($_SERVER['HTTP_REFERER']))
|
||||
{
|
||||
// If the referrer is internal (i.e. from your own website), then we drop the connection
|
||||
$parsed = parse_url($_SERVER['HTTP_REFERER']);
|
||||
$parsed_host = parse_url(Tools::getProtocol().Tools::getHttpHost(false, false).__PS_BASE_URI__);
|
||||
if ((!isset($parsed['path']) ||!isset($parsed_host['path'])) || (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)))
|
||||
&& !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__)))
|
||||
if ((!isset($parsed['path']) ||!isset($parsed_host['path'])) || (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false))) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__)))
|
||||
return false;
|
||||
if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER'])))
|
||||
{
|
||||
$source->http_referer = substr(strval($_SERVER['HTTP_REFERER']), 0, ConnectionsSource::$uri_max_size);
|
||||
$source->keywords = trim(SearchEngine::getKeywords(strval($_SERVER['HTTP_REFERER'])));
|
||||
if (!Validate::isMessage($source->keywords))
|
||||
return false;
|
||||
}
|
||||
|
||||
$source->http_referer = substr($_SERVER['HTTP_REFERER'], 0, ConnectionsSource::$uri_max_size);
|
||||
$source->keywords = substr(trim(SearchEngine::getKeywords($_SERVER['HTTP_REFERER'])), 0, ConnectionsSource::$uri_max_size);
|
||||
}
|
||||
|
||||
$source->id_connections = (int)$cookie->id_connections;
|
||||
$source->request_uri = Tools::getHttpHost(false, false);
|
||||
if (isset($_SERVER['REDIRECT_URL']))
|
||||
$source->request_uri .= strval($_SERVER['REDIRECT_URL']);
|
||||
elseif (isset($_SERVER['REQUEST_URI']))
|
||||
$source->request_uri .= strval($_SERVER['REQUEST_URI']);
|
||||
|
||||
if (isset($_SERVER['REQUEST_URI']))
|
||||
$source->request_uri .= $_SERVER['REQUEST_URI'];
|
||||
elseif (isset($_SERVER['REDIRECT_URL']))
|
||||
$source->request_uri .= $_SERVER['REDIRECT_URL'];
|
||||
|
||||
if (!Validate::isUrl($source->request_uri))
|
||||
$source->request_uri = '';
|
||||
$source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
|
||||
@@ -104,4 +109,4 @@ class ConnectionsSourceCore extends ObjectModel
|
||||
WHERE id_order = '.(int)($id_order).'
|
||||
ORDER BY cos.date_add DESC');
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
-17
@@ -44,15 +44,13 @@ class CookieCore
|
||||
/** @var array cipher tool instance */
|
||||
protected $_cipherTool;
|
||||
|
||||
/** @var array cipher tool initialization key */
|
||||
protected $_key;
|
||||
|
||||
/** @var array cipher tool initilization vector */
|
||||
protected $_iv;
|
||||
|
||||
protected $_modified = false;
|
||||
|
||||
protected $_allow_writing;
|
||||
|
||||
protected $_salt;
|
||||
|
||||
protected $_standalone;
|
||||
|
||||
/**
|
||||
* Get data if the cookie exists and else initialize an new one
|
||||
@@ -60,24 +58,26 @@ class CookieCore
|
||||
* @param $name Cookie name before encrypting
|
||||
* @param $path
|
||||
*/
|
||||
public function __construct($name, $path = '', $expire = null, $shared_urls = null)
|
||||
public function __construct($name, $path = '', $expire = null, $shared_urls = null, $standalone = false)
|
||||
{
|
||||
$this->_content = array();
|
||||
$this->_standalone = $standalone;
|
||||
$this->_expire = is_null($expire) ? time() + 1728000 : (int)$expire;
|
||||
$this->_name = md5(_PS_VERSION_.$name);
|
||||
$this->_path = trim(Context::getContext()->shop->physical_uri.$path, '/\\').'/';
|
||||
$this->_name = md5(($this->_standalone ? '' : _PS_VERSION_).$name);
|
||||
$this->_path = trim(($this->_standalone ? '' : Context::getContext()->shop->physical_uri).$path, '/\\').'/';
|
||||
if ($this->_path{0} != '/') $this->_path = '/'.$this->_path;
|
||||
$this->_path = rawurlencode($this->_path);
|
||||
$this->_path = str_replace('%2F', '/', $this->_path);
|
||||
$this->_path = str_replace('%7E', '~', $this->_path);
|
||||
$this->_key = _COOKIE_KEY_;
|
||||
$this->_iv = _COOKIE_IV_;
|
||||
$this->_domain = $this->getDomain($shared_urls);
|
||||
$this->_allow_writing = true;
|
||||
if (Configuration::get('PS_CIPHER_ALGORITHM'))
|
||||
$this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
|
||||
$this->_salt = $this->_standalone ? str_pad('', 8, md5('ps'.__FILE__)) : _COOKIE_IV_;
|
||||
if ($this->_standalone)
|
||||
$this->_cipherTool = new Blowfish(str_pad('', 56, md5('ps'.__FILE__)), str_pad('', 56, md5('iv'.__FILE__)));
|
||||
elseif (!Configuration::get('PS_CIPHER_ALGORITHM'))
|
||||
$this->_cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
|
||||
else
|
||||
$this->_cipherTool = new Blowfish($this->_key, $this->_iv);
|
||||
$this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
|
||||
$this->update();
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ class CookieCore
|
||||
//printf("\$content = %s<br />", $content);
|
||||
|
||||
/* Get cookie checksum */
|
||||
$checksum = crc32($this->_iv.substr($content, 0, strrpos($content, '¤') + 2));
|
||||
$checksum = crc32($this->_salt.substr($content, 0, strrpos($content, '¤') + 2));
|
||||
//printf("\$checksum = %s<br />", $checksum);
|
||||
|
||||
/* Unserialize cookie content */
|
||||
@@ -297,7 +297,7 @@ class CookieCore
|
||||
$this->_content['date_add'] = date('Y-m-d H:i:s');
|
||||
|
||||
//checks if the language exists, if not choose the default language
|
||||
if (!Language::getLanguage((int)$this->id_lang))
|
||||
if (!$this->_standalone && !Language::getLanguage((int)$this->id_lang))
|
||||
$this->id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
}
|
||||
@@ -344,7 +344,7 @@ class CookieCore
|
||||
$cookie .= $key.'|'.$value.'¤';
|
||||
|
||||
/* Add checksum to cookie */
|
||||
$cookie .= 'checksum|'.crc32($this->_iv.$cookie);
|
||||
$cookie .= 'checksum|'.crc32($this->_salt.$cookie);
|
||||
$this->_modified = false;
|
||||
/* Cookies are encrypted for evident security reasons */
|
||||
return $this->_setcookie($cookie);
|
||||
|
||||
@@ -104,6 +104,11 @@ class CustomerMessageCore extends ObjectModel
|
||||
WHERE '.$where
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!empty($this->file_name))
|
||||
@unlink(_PS_UPLOAD_DIR_.$this->file_name);
|
||||
return parent::delete();
|
||||
}
|
||||
}
|
||||
@@ -97,11 +97,27 @@ class CustomerThreadCore extends ObjectModel
|
||||
{
|
||||
if (!Validate::isUnsignedId($this->id))
|
||||
return false;
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'customer_message`
|
||||
|
||||
$return = true;
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT `id_customer_message`
|
||||
FROM `'._DB_PREFIX_.'customer_message`
|
||||
WHERE `id_customer_thread` = '.(int)$this->id
|
||||
);
|
||||
return (parent::delete());
|
||||
|
||||
if( count($result))
|
||||
{
|
||||
foreach ($result AS $res)
|
||||
{
|
||||
$message = new CustomerMessage((int)$res['id_customer_message']);
|
||||
if (!Validate::isLoadedObject($message))
|
||||
$return = false;
|
||||
else
|
||||
$return &= $message->delete();
|
||||
}
|
||||
}
|
||||
$return &= parent::delete();
|
||||
return $return;
|
||||
}
|
||||
|
||||
public static function getCustomerMessages($id_customer, $read = null)
|
||||
@@ -204,5 +220,4 @@ class CustomerThreadCore extends ObjectModel
|
||||
' ORDER BY ct.date_upd ASC
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -647,7 +647,9 @@ class DispatcherCore
|
||||
* @return string
|
||||
*/
|
||||
public function getController()
|
||||
{
|
||||
{
|
||||
if (defined('_PS_ADMIN_DIR_'))
|
||||
$_GET['controllerUri'] = Tools::getvalue('controller');
|
||||
if ($this->controller)
|
||||
{
|
||||
$_GET['controller'] = $this->controller;
|
||||
@@ -669,7 +671,7 @@ class DispatcherCore
|
||||
$controller = false;
|
||||
|
||||
// Use routes ? (for url rewriting)
|
||||
if ($this->use_routes && !$controller)
|
||||
if ($this->use_routes && !$controller && !defined('_PS_ADMIN_DIR_'))
|
||||
{
|
||||
if (!$this->request_uri)
|
||||
return strtolower($this->controller_not_found);
|
||||
@@ -709,7 +711,8 @@ class DispatcherCore
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($controller == 'index' || $this->request_uri == '/index.php')
|
||||
|
||||
if ($controller == 'index' || $this->request_uri == '/index.php')
|
||||
$controller = $this->default_controller;
|
||||
$this->controller = $controller;
|
||||
}
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ class FeatureCore extends ObjectModel
|
||||
public static function getFeatures($id_lang, $with_shop = true)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
SELECT DISTINCT f.id_feature, f.*, fl.*
|
||||
FROM `'._DB_PREFIX_.'feature` f
|
||||
'.($with_shop ? Shop::addSqlAssociation('feature', 'f') : '').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)$id_lang.')
|
||||
|
||||
@@ -466,7 +466,7 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!$this->hasMultishopEntries())
|
||||
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
{
|
||||
if (empty($this->iso_code))
|
||||
$this->iso_code = Language::getIsoById($this->id);
|
||||
@@ -514,7 +514,7 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
if (!parent::delete())
|
||||
return false;
|
||||
if (!$this->hasMultishopEntries())
|
||||
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
{
|
||||
// delete images
|
||||
$files_copy = array(
|
||||
@@ -580,7 +580,7 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
public static function getLanguage($id_lang)
|
||||
{
|
||||
if (!array_key_exists((int)($id_lang), self::$_LANGUAGES))
|
||||
if (!array_key_exists((int)$id_lang, self::$_LANGUAGES))
|
||||
return false;
|
||||
return self::$_LANGUAGES[(int)($id_lang)];
|
||||
}
|
||||
@@ -788,11 +788,11 @@ class LanguageCore extends ObjectModel
|
||||
$lang_pack_ok = false;
|
||||
$errors = array();
|
||||
$file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip';
|
||||
if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$version.'&iso_lang='.$iso))
|
||||
if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$version.'&iso_lang='.Tools::strtolower($iso)))
|
||||
$errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
||||
elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link))
|
||||
$errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
|
||||
elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$lang_pack->iso_code.'.gzip'))
|
||||
elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.Tools::strtolower($lang_pack->iso_code.'.gzip')))
|
||||
if (!@file_put_contents($file, $content))
|
||||
$errors[] = Tools::displayError('Server does not have permissions for writing.');
|
||||
if (file_exists($file))
|
||||
@@ -831,4 +831,4 @@ class LanguageCore extends ObjectModel
|
||||
{
|
||||
return (Language::countActiveLanguages() > 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -294,7 +294,7 @@ class LocalizationPackCore
|
||||
// if we are not in an installation context or if the pack is not available in the local directory
|
||||
if (Language::getIdByIso($attributes['iso_code']) && !$install_mode)
|
||||
continue;
|
||||
$errors = Language::downloadAndInstallLanguagePack($attributes['iso_code'], $attributes['version']);
|
||||
$errors = Language::downloadAndInstallLanguagePack($attributes['iso_code'], $attributes['version'], $attributes);
|
||||
if ($errors !== true && is_array($errors))
|
||||
$this->_errors = array_merge($this->_errors, $errors);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ class MailCore
|
||||
'PS_SHOP_NAME',
|
||||
'PS_MAIL_SMTP_ENCRYPTION',
|
||||
'PS_MAIL_SMTP_PORT',
|
||||
'PS_MAIL_METHOD',
|
||||
'PS_MAIL_TYPE'
|
||||
), null, null, $id_shop);
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ class ManufacturerCore extends ObjectModel
|
||||
|
||||
for ($i = 0; $i < $total_manufacturers; $i++)
|
||||
if ($rewrite_settings)
|
||||
$manufacturers[$i]['link_rewrite'] = Tools::link_rewrite($manufacturers[$i]['name'], false);
|
||||
$manufacturers[$i]['link_rewrite'] = Tools::link_rewrite($manufacturers[$i]['name']);
|
||||
else
|
||||
$manufacturers[$i]['link_rewrite'] = 0;
|
||||
|
||||
@@ -258,7 +258,7 @@ class ManufacturerCore extends ObjectModel
|
||||
|
||||
public function getLink()
|
||||
{
|
||||
return Tools::link_rewrite($this->name, false);
|
||||
return Tools::link_rewrite($this->name);
|
||||
}
|
||||
|
||||
public static function getProducts($id_manufacturer, $id_lang, $p, $n, $order_by = null, $order_way = null,
|
||||
@@ -339,7 +339,7 @@ class ManufacturerCore extends ObjectModel
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
|
||||
ON (p.`id_product` = pa.`id_product`)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa', false).'
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ class MetaCore extends ObjectModel
|
||||
$result = $result && $this->delete();
|
||||
}
|
||||
|
||||
return Tools::generateHtaccess();
|
||||
return $result && Tools::generateHtaccess();
|
||||
}
|
||||
|
||||
public static function getEquivalentUrlRewrite($new_id_lang, $id_lang, $url_rewrite)
|
||||
|
||||
@@ -633,7 +633,7 @@ abstract class ObjectModelCore
|
||||
$shop_exists = ObjectModel::$db->getValue('SELECT '.$this->def['primary'].' FROM '._DB_PREFIX_.$this->def['table'].'_shop WHERE '.$where);
|
||||
if ($shop_exists)
|
||||
$result &= ObjectModel::$db->update($this->def['table'].'_shop', $fields, $where, 0, $null_values);
|
||||
else if (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||
elseif (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||
$result &= ObjectModel::$db->insert($this->def['table'].'_shop', $all_fields, $null_values);
|
||||
}
|
||||
}
|
||||
@@ -1277,6 +1277,11 @@ abstract class ObjectModelCore
|
||||
{
|
||||
return Shop::isTableAssociated($this->def['table']) || !empty($this->def['multilang_shop']);
|
||||
}
|
||||
|
||||
public function isMultiShopField($field)
|
||||
{
|
||||
return (isset($this->def['fields'][$field]) && isset($this->def['fields'][$field]['shop']) && $this->def['fields'][$field]['shop']);
|
||||
}
|
||||
|
||||
public function isLangMultishop()
|
||||
{
|
||||
|
||||
@@ -595,7 +595,7 @@ abstract class PaymentModuleCore extends Module
|
||||
'{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile,
|
||||
'{invoice_other}' => $invoice->other,
|
||||
'{order_name}' => $order->getUniqReference(),
|
||||
'{date}' => Tools::displayDate(date('Y-m-d H:i:s'), (int)$order->id_lang, 1),
|
||||
'{date}' => Tools::displayDate(date('Y-m-d H:i:s'),null , 1),
|
||||
'{carrier}' => $virtual_product ? Tools::displayError('No carrier') : $carrier->name,
|
||||
'{payment}' => Tools::substr($order->payment, 0, 32),
|
||||
'{products}' => $this->formatProductAndVoucherForEmail($products_list),
|
||||
|
||||
+86
-19
@@ -394,6 +394,7 @@ class ProductCore extends ObjectModel
|
||||
'resource' => 'product_feature',
|
||||
'fields' => array(
|
||||
'id' => array('required' => true),
|
||||
'custom' => array('required' => false),
|
||||
'id_feature_value' => array(
|
||||
'required' => true,
|
||||
'xlink_resource' => 'product_feature_values'
|
||||
@@ -1448,6 +1449,7 @@ class ProductCore extends ObjectModel
|
||||
$id_shop_list_array = Product::getShopsByProduct($this->id);
|
||||
foreach ($id_shop_list_array as $array_shop)
|
||||
$id_shop_list[] = $array_shop['id_shop'];
|
||||
$id_shop_list = array_unique($id_shop_list);
|
||||
}
|
||||
|
||||
if (count($id_shop_list))
|
||||
@@ -3213,8 +3215,9 @@ class ProductCore extends ObjectModel
|
||||
return array();
|
||||
if (!array_key_exists($id_product, self::$_cacheFeatures))
|
||||
self::$_cacheFeatures[$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT id_feature, id_product, id_feature_value
|
||||
FROM `'._DB_PREFIX_.'feature_product`
|
||||
SELECT fp.id_feature, fp.id_product, fp.id_feature_value, custom
|
||||
FROM `'._DB_PREFIX_.'feature_product` fp
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_value` fv ON (fp.id_feature_value = fv.id_feature_value)
|
||||
WHERE `id_product` = '.(int)$id_product
|
||||
);
|
||||
return self::$_cacheFeatures[$id_product];
|
||||
@@ -3262,6 +3265,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature)
|
||||
'.Shop::addSqlAssociation('feature', 'f').'
|
||||
WHERE `id_product` IN ('.implode($product_implode, ',').')
|
||||
ORDER BY f.position ASC');
|
||||
|
||||
@@ -3346,33 +3350,57 @@ class ProductCore extends ObjectModel
|
||||
WHERE pa.`id_product` = '.(int)$id_product_old
|
||||
);
|
||||
|
||||
$combinations = array();
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$id_product_attribute_old = (int)$row['id_product_attribute'];
|
||||
$result2 = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||
WHERE `id_product_attribute` = '.$id_product_attribute_old
|
||||
);
|
||||
if (!isset($combinations[$id_product_attribute_old]))
|
||||
{
|
||||
$id_combination = null;
|
||||
$id_shop = null;
|
||||
$result2 = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||
WHERE `id_product_attribute` = '.$id_product_attribute_old
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$id_combination = (int)$combinations[$id_product_attribute_old];
|
||||
$id_shop = (int)$row['id_shop'];
|
||||
$context_old = Shop::getContext();
|
||||
$context_shop_id_old = Shop::getContextShopID();
|
||||
Shop::setContext(Shop::CONTEXT_SHOP, $id_shop);
|
||||
|
||||
}
|
||||
|
||||
$row['id_product'] = $id_product_new;
|
||||
unset($row['id_product_attribute']);
|
||||
$combination = new Combination();
|
||||
|
||||
$combination = new Combination($id_combination, null, $id_shop);
|
||||
foreach ($row as $k => $v)
|
||||
$combination->$k = $v;
|
||||
$return &= $combination->add();
|
||||
$return &= $combination->save();
|
||||
|
||||
$id_product_attribute_new = (int)$combination->id;
|
||||
|
||||
if ($result_images = Product::_getAttributeImageAssociations($id_product_attribute_old))
|
||||
{
|
||||
$combination_images['old'][$id_product_attribute_old] = $result_images;
|
||||
$combination_images['new'][$id_product_attribute_new] = $result_images;
|
||||
}
|
||||
foreach ($result2 as $row2)
|
||||
|
||||
if (!isset($combinations[$id_product_attribute_old]))
|
||||
{
|
||||
$row2['id_product_attribute'] = $id_product_attribute_new;
|
||||
$return &= Db::getInstance()->insert('product_attribute_combination', $row2);
|
||||
$combinations[$id_product_attribute_old] = (int)$id_product_attribute_new;
|
||||
foreach ($result2 as $row2)
|
||||
{
|
||||
$row2['id_product_attribute'] = $id_product_attribute_new;
|
||||
$return &= Db::getInstance()->insert('product_attribute_combination', $row2);
|
||||
}
|
||||
}
|
||||
else
|
||||
Shop::setContext($context_old, $context_shop_id_old);
|
||||
}
|
||||
return !$return ? false : $combination_images;
|
||||
}
|
||||
@@ -3848,6 +3876,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
|
||||
LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
|
||||
'.Shop::addSqlAssociation('feature', 'f').'
|
||||
WHERE pf.id_product = '.(int)$id_product.'
|
||||
ORDER BY f.position ASC'
|
||||
);
|
||||
@@ -4400,12 +4429,51 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function setWsProductFeatures($product_features)
|
||||
{
|
||||
$this->deleteProductFeatures();
|
||||
foreach ($product_features as $product_feature)
|
||||
$this->addFeaturesToDB($product_feature['id'], $product_feature['id_feature_value']);
|
||||
return true;
|
||||
}
|
||||
|
||||
$db_features = Db::getInstance()->executeS('
|
||||
SELECT p.*, f.`custom`
|
||||
FROM `'._DB_PREFIX_.'feature_product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_value` f ON (f.`id_feature_value` = p.`id_feature_value`)
|
||||
WHERE `id_product` = '.(int)$this->id
|
||||
);
|
||||
|
||||
|
||||
$pfa = array();
|
||||
foreach ($product_features as $product_feature)
|
||||
$pfa[$product_feature['id']] = 1;
|
||||
|
||||
foreach ($db_features as $db_feature)
|
||||
{
|
||||
// test if feature should stay in db (if it is part of updated product)
|
||||
if (!isset($pfa[$db_feature['id_feature']]))
|
||||
{
|
||||
// delete only custom features
|
||||
if ($db_feature['custom'])
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'feature_value_lang`
|
||||
WHERE `id_feature_value` = '.(int)$db_feature['id_feature_value']
|
||||
);
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'feature_value`
|
||||
WHERE `id_feature_value` = '.(int)$db_feature['id_feature_value']
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'feature_product`
|
||||
WHERE `id_product` = '.(int)$this->id
|
||||
);
|
||||
|
||||
foreach ($product_features as $product_feature)
|
||||
$this->addFeaturesToDB($product_feature['id'], $product_feature['id_feature_value'], $product_feature['custom']);
|
||||
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
/**
|
||||
* Webservice getter : get virtual field default combination
|
||||
*
|
||||
@@ -5275,5 +5343,4 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
return Db::getInstance()->executeS('SELECT id_product_item as id, quantity FROM '._DB_PREFIX_.'pack where id_product_pack = '.(int)$this->id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -60,6 +60,8 @@ class SearchEngineCore extends ObjectModel
|
||||
if (empty($array[0]))
|
||||
return false;
|
||||
$str = urldecode(str_replace('+', ' ', ltrim(substr(rtrim($array[0], '&'), strlen($varname) + 1), '=')));
|
||||
if (!Validate::isMessage($str))
|
||||
return false;
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ class SupplierCore extends ObjectModel
|
||||
|
||||
public function getLink()
|
||||
{
|
||||
return Tools::link_rewrite($this->name, false);
|
||||
return Tools::link_rewrite($this->name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +156,7 @@ class SupplierCore extends ObjectModel
|
||||
$rewrite_settings = (int)Configuration::get('PS_REWRITING_SETTINGS');
|
||||
for ($i = 0; $i < $nb_suppliers; $i++)
|
||||
if ($rewrite_settings)
|
||||
$suppliers[$i]['link_rewrite'] = Tools::link_rewrite($suppliers[$i]['name'], false);
|
||||
$suppliers[$i]['link_rewrite'] = Tools::link_rewrite($suppliers[$i]['name']);
|
||||
else
|
||||
$suppliers[$i]['link_rewrite'] = 0;
|
||||
return $suppliers;
|
||||
|
||||
@@ -140,7 +140,11 @@ class TabCore extends ObjectModel
|
||||
public function delete()
|
||||
{
|
||||
if (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'access WHERE `id_tab` = '.(int)$this->id) && parent::delete())
|
||||
{
|
||||
if (is_array(self::$_getIdFromClassName) && isset(self::$_getIdFromClassName[strtolower($this->class_name)]))
|
||||
unset(self::$_getIdFromClassName[strtolower($this->class_name)]);
|
||||
return $this->cleanPositions($this->id_parent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+45
-11
@@ -267,6 +267,9 @@ class ToolsCore
|
||||
// $_SERVER['SSL'] exists only in some specific configuration
|
||||
if (isset($_SERVER['SSL']))
|
||||
return ($_SERVER['SSL'] == 1 || strtolower($_SERVER['SSL']) == 'on');
|
||||
// $_SERVER['REDIRECT_HTTPS'] exists only in some specific configuration
|
||||
if (isset($_SERVER['REDIRECT_HTTPS']))
|
||||
return ($_SERVER['REDIRECT_HTTPS'] == 1 || strtolower($_SERVER['REDIRECT_HTTPS']) == 'on');
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -598,20 +601,25 @@ class ToolsCore
|
||||
*/
|
||||
public static function dateFormat($params, &$smarty)
|
||||
{
|
||||
return Tools::displayDate($params['date'], Context::getContext()->language->id, (isset($params['full']) ? $params['full'] : false));
|
||||
return Tools::displayDate($params['date'], null, (isset($params['full']) ? $params['full'] : false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display date regarding to language preferences
|
||||
*
|
||||
* @param string $date Date to display format UNIX
|
||||
* @param integer $id_lang Language id
|
||||
* @param integer $id_lang Language id DEPRECATED
|
||||
* @param boolean $full With time or not (optional)
|
||||
* @param string $separator DEPRECATED
|
||||
* @return string Date
|
||||
*/
|
||||
public static function displayDate($date, $id_lang, $full = false, $separator = '-')
|
||||
public static function displayDate($date, $id_lang = null, $full = false, $separator = null)
|
||||
{
|
||||
if ($id_lang !== null)
|
||||
Tools::displayParameterAsDeprecated('id_lang');
|
||||
if ($separator !== null)
|
||||
Tools::displayParameterAsDeprecated('separator');
|
||||
|
||||
if (!$date || !($time = strtotime($date)))
|
||||
return $date;
|
||||
|
||||
@@ -958,11 +966,13 @@ class ToolsCore
|
||||
* Return the friendly url from the provided string
|
||||
*
|
||||
* @param string $str
|
||||
* @param bool $utf8_decode => needs to be marked as deprecated
|
||||
* @param bool $utf8_decode (deprecated)
|
||||
* @return string
|
||||
*/
|
||||
public static function link_rewrite($str, $utf8_decode = false)
|
||||
public static function link_rewrite($str, $utf8_decode = null)
|
||||
{
|
||||
if ($utf8_decode !== null)
|
||||
Tools::displayParameterAsDeprecated('utf8_decode');
|
||||
return Tools::str2url($str);
|
||||
}
|
||||
|
||||
@@ -1019,11 +1029,12 @@ class ToolsCore
|
||||
'/[\x{010F}]/u',
|
||||
'/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}]/u',
|
||||
'/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u',
|
||||
'/[\x{011F}]/u',
|
||||
'/[\x{0142}\x{013E}\x{013A}]/u',
|
||||
'/[\x{00F1}\x{0148}]/u',
|
||||
'/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}]/u',
|
||||
'/[\x{0159}\x{0155}]/u',
|
||||
'/[\x{015B}\x{0161}]/u',
|
||||
'/[\x{015B}\x{0161}\x{015F}]/u',
|
||||
'/[\x{00DF}]/u',
|
||||
'/[\x{0165}]/u',
|
||||
'/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/u',
|
||||
@@ -1037,11 +1048,12 @@ class ToolsCore
|
||||
'/[\x{00C7}\x{010C}\x{0106}]/u',
|
||||
'/[\x{010E}]/u',
|
||||
'/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{011A}\x{0118}]/u',
|
||||
'/[\x{011E}]/u',
|
||||
'/[\x{0141}\x{013D}\x{0139}]/u',
|
||||
'/[\x{00D1}\x{0147}]/u',
|
||||
'/[\x{00D3}]/u',
|
||||
'/[\x{0158}\x{0154}]/u',
|
||||
'/[\x{015A}\x{0160}]/u',
|
||||
'/[\x{015A}\x{0160}\x{015E}]/u',
|
||||
'/[\x{0164}]/u',
|
||||
'/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{016E}]/u',
|
||||
'/[\x{017B}\x{0179}\x{017D}]/u',
|
||||
@@ -1049,8 +1061,8 @@ class ToolsCore
|
||||
'/[\x{0152}]/u');
|
||||
|
||||
$replacements = array(
|
||||
'a', 'c', 'd', 'e', 'i', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe',
|
||||
'A', 'C', 'D', 'E', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
|
||||
'a', 'c', 'd', 'e', 'i', 'g', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe',
|
||||
'A', 'C', 'D', 'E', 'G', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
|
||||
);
|
||||
|
||||
return preg_replace($patterns, $replacements, $str);
|
||||
@@ -1511,7 +1523,7 @@ class ToolsCore
|
||||
|
||||
if (self::$_cache_nb_media_servers && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1)))
|
||||
return constant('_MEDIA_SERVER_'.$id_media_server.'_');
|
||||
return Tools::getHttpHost();
|
||||
return Tools::getShopDomain();
|
||||
}
|
||||
|
||||
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false, $disable_modsec = null)
|
||||
@@ -1843,7 +1855,7 @@ exit;
|
||||
{
|
||||
$backtrace = debug_backtrace();
|
||||
$callee = next($backtrace);
|
||||
$error = 'Parameter <b>'.$parameter.'</b> in function <b>'.$callee['function'].'()</b> is deprecated in <b>'.$callee['file'].'</b> on line <b>'.$callee['Line'].'</b><br />';
|
||||
$error = 'Parameter <b>'.$parameter.'</b> in function <b>'.(isset($callee['function']) ? $callee['function'] : '').'()</b> is deprecated in <b>'.$callee['file'].'</b> on line <b>'.(isset($callee['Line']) ? $callee['Line'] : '').'</b><br />';
|
||||
$message = 'The parameter '.$parameter.' in function '.$callee['function'].' (Line '.$callee['Line'].') is deprecated and will be removed in the next major version.';
|
||||
$class = isset($callee['class']) ? $callee['class'] : null;
|
||||
|
||||
@@ -2196,6 +2208,28 @@ exit;
|
||||
return (PHP_INT_MAX == '9223372036854775807');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool true if php-cli is used
|
||||
*/
|
||||
public static function isPHPCLI()
|
||||
{
|
||||
return (defined('STDIN') || (Tools::strtolower(php_sapi_name()) == 'cli' && (!isset($_SERVER['REMOTE_ADDR']) || empty($_SERVER['REMOTE_ADDR']))));
|
||||
}
|
||||
|
||||
public static function argvToGET($argc, $argv)
|
||||
{
|
||||
if ($argc <= 1)
|
||||
return;
|
||||
|
||||
// get the first argument and parse it like a query string
|
||||
parse_str($argv[1], $args);
|
||||
if (!is_array($args) || !count($args))
|
||||
return;
|
||||
$_GET = array_merge($args, $_GET);
|
||||
$_SERVER['QUERY_STRING'] = $argv[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get max file upload size considering server settings and optional max value
|
||||
*
|
||||
|
||||
@@ -229,7 +229,7 @@ class ValidateCore
|
||||
*/
|
||||
public static function isPrice($price)
|
||||
{
|
||||
return preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/', $price);
|
||||
return preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/', sprintf('%f', $price));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,7 +240,7 @@ class ValidateCore
|
||||
*/
|
||||
public static function isNegativePrice($price)
|
||||
{
|
||||
return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,9})?$/', $price);
|
||||
return preg_match('/^[-]?[0-9]{1,10}(\.[0-9]{1,9})?$/', sprintf('%f', $price));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -724,7 +724,7 @@ class ValidateCore
|
||||
*/
|
||||
public static function isTrackingNumber($tracking_number)
|
||||
{
|
||||
return preg_match('/^[~:#,%&_=\(\)\.\? \+\-@\/a-zA-Z0-9]+$/', $tracking_number);
|
||||
return preg_match('/^[~:#,%&_=\(\)\[\]\.\? \+\-@\/a-zA-Z0-9]+$/', $tracking_number);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -747,7 +747,7 @@ class ValidateCore
|
||||
public static function isAbsoluteUrl($url)
|
||||
{
|
||||
if (!empty($url))
|
||||
return preg_match('/^https?:\/\/[,:#%&_=\(\)\.\? \+\-@\/a-zA-Z0-9]+$/', $url);
|
||||
return preg_match('/^https?:\/\/[~:#,%&_=\(\)\[\]\.\? \+\-@\/a-zA-Z0-9]+$/', $url);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -513,37 +513,42 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
if ($this->ajax)
|
||||
{
|
||||
// from ajax-tab.php
|
||||
$action = Tools::getValue('action');
|
||||
// no need to use displayConf() here
|
||||
if (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action)))
|
||||
return $this->{'ajaxProcess'.Tools::toCamelCase($action)}();
|
||||
elseif (method_exists($this, 'ajaxProcess'))
|
||||
return $this->ajaxProcess();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Process list filtering
|
||||
if ($this->filter)
|
||||
$this->processFilter();
|
||||
|
||||
// If the method named after the action exists, call "before" hooks, then call action method, then call "after" hooks
|
||||
if (!empty($this->action) && method_exists($this, 'process'.ucfirst(Tools::toCamelCase($this->action))))
|
||||
try {
|
||||
if ($this->ajax)
|
||||
{
|
||||
// Hook before action
|
||||
Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this));
|
||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
|
||||
// Call process
|
||||
$return = $this->{'process'.Tools::toCamelCase($this->action)}();
|
||||
// Hook After Action
|
||||
Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
|
||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
|
||||
|
||||
return $return;
|
||||
// from ajax-tab.php
|
||||
$action = Tools::getValue('action');
|
||||
// no need to use displayConf() here
|
||||
if (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action)))
|
||||
return $this->{'ajaxProcess'.Tools::toCamelCase($action)}();
|
||||
elseif (method_exists($this, 'ajaxProcess'))
|
||||
return $this->ajaxProcess();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Process list filtering
|
||||
if ($this->filter)
|
||||
$this->processFilter();
|
||||
|
||||
// If the method named after the action exists, call "before" hooks, then call action method, then call "after" hooks
|
||||
if (!empty($this->action) && method_exists($this, 'process'.ucfirst(Tools::toCamelCase($this->action))))
|
||||
{
|
||||
// Hook before action
|
||||
Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this));
|
||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
|
||||
// Call process
|
||||
$return = $this->{'process'.Tools::toCamelCase($this->action)}();
|
||||
// Hook After Action
|
||||
Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
|
||||
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
} catch (PrestaShopException $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -583,16 +588,27 @@ class AdminControllerCore extends Controller
|
||||
$headers = array();
|
||||
foreach ($this->fields_list as $datas)
|
||||
$headers[] = Tools::htmlentitiesDecodeUTF8($datas['title']);
|
||||
|
||||
$content = array();
|
||||
foreach ($this->_list as $i => $row)
|
||||
{
|
||||
$content[$i] = array();
|
||||
foreach ($this->fields_list as $key => $value)
|
||||
if (isset($row[$key]))
|
||||
$content[$i][] = Tools::htmlentitiesDecodeUTF8($row[$key]);
|
||||
|
||||
$path_to_image = false;
|
||||
foreach ($this->fields_list as $key => $params)
|
||||
{
|
||||
$field_value = isset($row[$key]) ? Tools::htmlentitiesDecodeUTF8($row[$key]) : '';
|
||||
if ($key == 'image')
|
||||
{
|
||||
if ($params['image'] != 'p' || Configuration::get('PS_LEGACY_IMAGES'))
|
||||
$path_to_image = Tools::getShopDomain(true)._PS_IMG_.$params['image'].'/'.$row['id_'.$this->table].(isset($row['id_image']) ? '-'.(int)$row['id_image'] : '').'.'.$this->imageType;
|
||||
else
|
||||
$path_to_image = Tools::getShopDomain(true)._PS_IMG_.$params['image'].'/'.Image::getImgFolderStatic($row['id_image']).(int)$row['id_image'].'.'.$this->imageType;
|
||||
if ($path_to_image)
|
||||
$field_value = $path_to_image;
|
||||
}
|
||||
$content[$i][] = $field_value;
|
||||
}
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'export_precontent' => "\xEF\xBB\xBF",
|
||||
'export_headers' => $headers,
|
||||
@@ -1100,7 +1116,7 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors[] = Tools::displayError('The object cannot be loaded (ithe dentifier is missing or invalid)');
|
||||
$this->errors[] = Tools::displayError('The object cannot be loaded (the dentifier is missing or invalid)');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1161,6 +1177,7 @@ class AdminControllerCore extends Controller
|
||||
header('Location: '.$this->redirect_after);
|
||||
exit;
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
$this->context->smarty->assign(array(
|
||||
|
||||
@@ -108,7 +108,7 @@ class FrontControllerCore extends Controller
|
||||
|
||||
// If current URL use SSL, set it true (used a lot for module redirect)
|
||||
if (Tools::usingSecureMode())
|
||||
$useSSL = $this->ssl = true;
|
||||
$useSSL = true;
|
||||
|
||||
// For compatibility with globals, DEPRECATED as of version 1.5
|
||||
$css_files = $this->css_files;
|
||||
|
||||
+16
-2
@@ -209,13 +209,27 @@ class DbPDOCore extends Db
|
||||
|
||||
if (strtolower($engine) == 'innodb')
|
||||
{
|
||||
$value = 0;
|
||||
|
||||
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
|
||||
$result = $link->query($sql);
|
||||
if (!$result)
|
||||
return 4;
|
||||
$value = 4;
|
||||
$row = $result->fetch();
|
||||
if (!$row || strtolower($row['Value']) != 'yes')
|
||||
return 4;
|
||||
$value = 4;
|
||||
|
||||
/* MySQL >= 5.6 */
|
||||
$sql = 'SHOW ENGINES';
|
||||
$result = $link->query($sql);
|
||||
while ($row = $result->fetch())
|
||||
if ($row['Engine'] == 'InnoDB')
|
||||
{
|
||||
if (in_array($row['Support'], array('DEFAULT', 'YES')))
|
||||
$value = 0;
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
unset($link);
|
||||
return 0;
|
||||
|
||||
+16
-2
@@ -168,13 +168,27 @@ class MySQLCore extends Db
|
||||
|
||||
if (strtolower($engine) == 'innodb')
|
||||
{
|
||||
$value = 0;
|
||||
|
||||
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
|
||||
$result = mysql_query($sql);
|
||||
if (!$result)
|
||||
return 4;
|
||||
$value = 4;
|
||||
$row = mysql_fetch_assoc($result);
|
||||
if (!$row || strtolower($row['Value']) != 'yes')
|
||||
return 4;
|
||||
$value = 4;
|
||||
|
||||
/* MySQL >= 5.6 */
|
||||
$sql = 'SHOW ENGINES';
|
||||
$result = mysql_query($sql);
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
if ($row['Engine'] == 'InnoDB')
|
||||
{
|
||||
if (in_array($row['Support'], array('DEFAULT', 'YES')))
|
||||
$value = 0;
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
@mysql_close($link);
|
||||
return 0;
|
||||
|
||||
@@ -282,9 +282,9 @@ class HelperListCore extends Helper
|
||||
$this->_list[$index][$key] = Tools::displayPrice($tr[$key], $currency, false);
|
||||
}
|
||||
elseif (isset($params['type']) && $params['type'] == 'date')
|
||||
$this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id);
|
||||
$this->_list[$index][$key] = Tools::displayDate($tr[$key]);
|
||||
elseif (isset($params['type']) && $params['type'] == 'datetime')
|
||||
$this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id, true);
|
||||
$this->_list[$index][$key] = Tools::displayDate($tr[$key],null , true);
|
||||
elseif (isset($tr[$key]))
|
||||
{
|
||||
$echo = $tr[$key];
|
||||
|
||||
@@ -215,7 +215,7 @@ abstract class ModuleCore
|
||||
}
|
||||
|
||||
// Check if module is installed
|
||||
$result = Db::getInstance()->getRow('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($this->name).'\'');
|
||||
$result = Module::isInstalled($this->name);
|
||||
if ($result)
|
||||
{
|
||||
$this->_errors[] = $this->l('This module has already been installed.');
|
||||
@@ -311,6 +311,12 @@ abstract class ModuleCore
|
||||
*/
|
||||
public static function initUpgradeModule($module)
|
||||
{
|
||||
if (((int)$module->installed == 1) & (empty($module->database_version) === true))
|
||||
{
|
||||
Module::upgradeModuleVersion($module->name, $module->version);
|
||||
$module->database_version = $module->version;
|
||||
}
|
||||
|
||||
// Init cache upgrade details
|
||||
self::$modules_cache[$module->name]['upgrade'] = array(
|
||||
'success' => false, // bool to know if upgrade succeed or not
|
||||
@@ -1543,7 +1549,7 @@ abstract class ModuleCore
|
||||
{
|
||||
if (!Cache::isStored('Module::isInstalled'.$module_name))
|
||||
{
|
||||
$id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($module_name).'\'');
|
||||
$id_module = Module::getModuleIdByName($module_name);
|
||||
Cache::store('Module::isInstalled'.$module_name, (bool)$id_module);
|
||||
}
|
||||
return Cache::retrieve('Module::isInstalled'.$module_name);
|
||||
@@ -1554,7 +1560,7 @@ abstract class ModuleCore
|
||||
if (!Cache::isStored('Module::isEnabled'.$module_name))
|
||||
{
|
||||
$active = false;
|
||||
$id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($module_name).'\'');
|
||||
$id_module = Module::getModuleIdByName($module_name);
|
||||
if (Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module_shop` WHERE `id_module` = '.(int)$id_module.' AND `id_shop` = '.(int)Context::getContext()->shop->id))
|
||||
$active = true;
|
||||
Cache::store('Module::isEnabled'.$module_name, (bool)$active);
|
||||
|
||||
@@ -240,6 +240,8 @@ class OrderCore extends ObjectModel
|
||||
'product_quantity' => array('required' => true),
|
||||
'product_name' => array('setter' => false),
|
||||
'product_price' => array('setter' => false),
|
||||
'unit_price_tax_incl' => array('setter' => false),
|
||||
'unit_price_tax_excl' => array('setter' => false),
|
||||
)),
|
||||
),
|
||||
|
||||
@@ -1287,7 +1289,7 @@ class OrderCore extends ObjectModel
|
||||
|
||||
public function getWsOrderRows()
|
||||
{
|
||||
$query = 'SELECT id_order_detail as `id`, `product_id`, `product_price`, `id_order`, `product_attribute_id`, `product_quantity`, `product_name`
|
||||
$query = 'SELECT id_order_detail as `id`, `product_id`, `product_price`, `id_order`, `product_attribute_id`, `product_quantity`, `product_name`, `unit_price_tax_incl`, `unit_price_tax_excl`
|
||||
FROM `'._DB_PREFIX_.'order_detail`
|
||||
WHERE id_order = '.(int)$this->id;
|
||||
$result = Db::getInstance()->executeS($query);
|
||||
@@ -1627,7 +1629,7 @@ class OrderCore extends ObjectModel
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT SUM(total_paid_tax_incl)
|
||||
FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE `reference` = '.(int)$this->reference.'
|
||||
WHERE `reference` = \''.pSQL($this->reference).'\'
|
||||
AND `id_cart` = '.(int)$this->id_cart
|
||||
);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class OrderHistoryCore extends ObjectModel
|
||||
|
||||
|
||||
// executes hook
|
||||
if ($new_os->id == Configuration::get('PS_OS_PAYMENT'))
|
||||
if (in_array($new_os->id, array(Configuration::get('PS_OS_PAYMENT'), Configuration::get('PS_OS_WS_PAYMENT'))))
|
||||
Hook::exec('actionPaymentConfirmation', array('id_order' => (int)$order->id));
|
||||
|
||||
// executes hook
|
||||
@@ -123,7 +123,7 @@ class OrderHistoryCore extends ObjectModel
|
||||
.'&secure_key='.$order->secure_key;
|
||||
$assign[$key]['link'] = $dl_link;
|
||||
if (isset($virtual_product['date_expiration']) && $virtual_product['date_expiration'] != '0000-00-00 00:00:00')
|
||||
$assign[$key]['deadline'] = Tools::displayDate($virtual_product['date_expiration '], $order->id_lang);
|
||||
$assign[$key]['deadline'] = Tools::displayDate($virtual_product['date_expiration ']);
|
||||
if ($product_download->nb_downloadable != 0)
|
||||
$assign[$key]['downloadable'] = (int)$product_download->nb_downloadable;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class HTMLTemplateDeliverySlipCore extends HTMLTemplate
|
||||
$this->smarty = $smarty;
|
||||
|
||||
// header informations
|
||||
$this->date = Tools::displayDate($this->order->invoice_date, (int)$this->order->id_lang);
|
||||
$this->date = Tools::displayDate($this->order->invoice_date);
|
||||
$this->title = HTMLTemplateDeliverySlip::l('Delivery').' #'.Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id).sprintf('%06d', $this->order_invoice->delivery_number);
|
||||
|
||||
// footer informations
|
||||
|
||||
@@ -39,7 +39,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$this->smarty = $smarty;
|
||||
|
||||
// header informations
|
||||
$this->date = Tools::displayDate($order_invoice->date_add, (int)$this->order->id_lang);
|
||||
$this->date = Tools::displayDate($order_invoice->date_add);
|
||||
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
$this->title = HTMLTemplateInvoice::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', $id_lang, null, (int)$this->order->id_shop).sprintf('%06d', $order_invoice->number);
|
||||
|
||||
@@ -39,7 +39,7 @@ class HTMLTemplateOrderReturnCore extends HTMLTemplate
|
||||
$this->order = new Order($order_return->id_order);
|
||||
|
||||
// header informations
|
||||
$this->date = Tools::displayDate($this->order->invoice_date, (int)$this->order->id_lang);
|
||||
$this->date = Tools::displayDate($this->order->invoice_date);
|
||||
$this->title = HTMLTemplateOrderReturn::l('Order Return ').sprintf('%06d', $this->order_return->id);
|
||||
|
||||
// footer informations
|
||||
|
||||
@@ -211,6 +211,8 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
|
||||
if ($ecotax)
|
||||
foreach ($tmp_tax_infos as $rate => &$row)
|
||||
{
|
||||
if (!isset($ecotax[$rate]))
|
||||
continue;
|
||||
$row['total_price_tax_excl'] -= $ecotax[$rate]['ecotax_tax_excl'];
|
||||
$row['total_amount'] -= ($ecotax[$rate]['ecotax_tax_incl'] - $ecotax[$rate]['ecotax_tax_excl']);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ class PDFGeneratorCore extends TCPDF
|
||||
'uk' => 'freeserif',
|
||||
'mk' => 'freeserif',
|
||||
'el' => 'freeserif',
|
||||
'en' => 'dejavusans',
|
||||
'vn' => 'dejavusans',
|
||||
'pl' => 'dejavusans',
|
||||
'ar' => 'dejavusans',
|
||||
|
||||
+17
-2
@@ -349,12 +349,27 @@ class ShopCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
if (!$id_shop && defined('_PS_ADMIN_DIR_'))
|
||||
if ((!$id_shop && defined('_PS_ADMIN_DIR_')) || Tools::isPHPCLI())
|
||||
{
|
||||
// If in admin, we can access to the shop without right URL
|
||||
$shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
if ((!$id_shop && Tools::isPHPCLI()) || defined('_PS_ADMIN_DIR_'))
|
||||
$id_shop = (int)Configuration::get('PS_SHOP_DEFAULT');
|
||||
|
||||
$shop = new Shop((int)$id_shop);
|
||||
if (!Validate::isLoadedObject($shop))
|
||||
$shop = new Shop((int)Configuration::get('PS_SHOP_DEFAULT'));
|
||||
|
||||
$shop->physical_uri = preg_replace('#/+#', '/', str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_NAME']))).'/');
|
||||
$shop->virtual_uri = '';
|
||||
|
||||
// Define some $_SERVER variables like HTTP_HOST if PHP is launched with php-cli
|
||||
if (Tools::isPHPCLI())
|
||||
{
|
||||
if(!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST']))
|
||||
$_SERVER['HTTP_HOST'] = $shop->domain;
|
||||
if(!isset($_SERVER['SERVER_NAME']) || empty($_SERVER['SERVER_NAME']))
|
||||
$_SERVER['SERVER_NAME'] = $shop->domain;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -479,13 +479,13 @@ class StockManagerCore implements StockManagerInterface
|
||||
$query->where('o.valid = 1 OR (os.id_order_state != '.(int)Configuration::get('PS_OS_ERROR').'
|
||||
AND os.id_order_state != '.(int)Configuration::get('PS_OS_CANCELED').')');
|
||||
$query->groupBy('od.id_order_detail');
|
||||
//if (count($ids_warehouse))
|
||||
//$query->where('od.id_warehouse IN('.implode(', ', $ids_warehouse).')');
|
||||
if (count($ids_warehouse))
|
||||
$query->where('od.id_warehouse IN('.implode(', ', $ids_warehouse).')');
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||
$client_orders_qty = 0;
|
||||
if (count($res))
|
||||
foreach ($res as $row)
|
||||
$client_orders_qty += $row['product_quantity'] + $row['product_quantity_refunded'];
|
||||
$client_orders_qty += ($row['product_quantity'] - $row['product_quantity_refunded']);
|
||||
|
||||
// Gets supply_orders_qty
|
||||
$query = new DbQuery();
|
||||
@@ -658,4 +658,4 @@ class StockManagerCore implements StockManagerInterface
|
||||
return $stocks;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1184,7 +1184,14 @@ class WebserviceRequestCore
|
||||
$sql_sort .= 'main_i18n.`'.pSQL($this->resourceConfiguration['fields'][$fieldName]['sqlId']).'` '.$direction.', ';// ORDER BY main_i18n.`field` ASC|DESC
|
||||
}
|
||||
else
|
||||
$sql_sort .= (isset($this->resourceConfiguration['retrieveData']['tableAlias']) ? $this->resourceConfiguration['retrieveData']['tableAlias'].'.' : '').'`'.pSQL($this->resourceConfiguration['fields'][$fieldName]['sqlId']).'` '.$direction.', ';// ORDER BY `field` ASC|DESC
|
||||
{
|
||||
$object = new $this->resourceConfiguration['retrieveData']['className']();
|
||||
if ($object->isMultiShopField($this->resourceConfiguration['fields'][$fieldName]['sqlId']))
|
||||
$table_alias = 'multi_shop_'.$this->resourceConfiguration['retrieveData']['table'];
|
||||
else
|
||||
$table_alias = '';
|
||||
$sql_sort .= (isset($this->resourceConfiguration['retrieveData']['tableAlias']) ? '`'.bqSQL($this->resourceConfiguration['retrieveData']['tableAlias']).'`.' : '`'.bqSQL($table_alias).'`.').'`'.pSQL($this->resourceConfiguration['fields'][$fieldName]['sqlId']).'` '.$direction.', ';// ORDER BY `field` ASC|DESC
|
||||
}
|
||||
}
|
||||
$sql_sort = rtrim($sql_sort, ', ')."\n";
|
||||
}
|
||||
@@ -1218,6 +1225,11 @@ class WebserviceRequestCore
|
||||
{
|
||||
$objects = array();
|
||||
$filters = $this->manageFilters();
|
||||
|
||||
/* If we only need to display the synopsis, analyzing the first row is sufficient */
|
||||
if (isset($this->urlFragments['schema']) && $this->urlFragments['schema'] == 'synopsis')
|
||||
$filters = array('sql_join' => '', 'sql_filter' => '', 'sql_sort' => '', 'sql_limit' => ' LIMIT 1');
|
||||
|
||||
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_join'];
|
||||
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_filter'];
|
||||
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_sort'];
|
||||
|
||||
@@ -62,6 +62,9 @@ if (_PS_DEBUG_PROFILING_)
|
||||
include_once(_PS_TOOL_DIR_.'profiling/Tools.php');
|
||||
}
|
||||
|
||||
if (Tools::isPHPCLI())
|
||||
Tools::argvToGET($argc, $argv);
|
||||
|
||||
/* Redefine REQUEST_URI if empty (on some webservers...) */
|
||||
if (!isset($_SERVER['REQUEST_URI']) || empty($_SERVER['REQUEST_URI']))
|
||||
{
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
define('_PS_MODE_DEV_', true);
|
||||
if (_PS_MODE_DEV_)
|
||||
{
|
||||
@ini_set('display_errors', 'on');
|
||||
@ini_set('display_errors', 'on');
|
||||
@error_reporting(E_ALL | E_STRICT);
|
||||
define('_PS_DEBUG_SQL_', true);
|
||||
/* Compatibility warning */
|
||||
define('_PS_DISPLAY_COMPATIBILITY_WARNING_', true);
|
||||
|
||||
@@ -57,7 +57,14 @@ function smartyTranslate($params, &$smarty)
|
||||
// If the tpl is used by a Controller
|
||||
else
|
||||
{
|
||||
// Split by \ and / to get the folder tree for the file
|
||||
if (isset(Context::getContext()->controller))
|
||||
{
|
||||
$class_name = get_class(Context::getContext()->controller);
|
||||
$class = substr($class_name, 0, strpos(Tools::strtolower($class_name), 'controller'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Split by \ and / to get the folder tree for the file
|
||||
$folder_tree = preg_split('#[/\\\]#', $filename);
|
||||
$key = array_search('controllers', $folder_tree);
|
||||
|
||||
@@ -69,8 +76,8 @@ function smartyTranslate($params, &$smarty)
|
||||
$class = 'Admin'.Tools::toCamelCase($folder_tree[0], true);
|
||||
else
|
||||
$class = null;
|
||||
}
|
||||
}
|
||||
|
||||
return Translate::getAdminTranslation($params['s'], $class, $addslashes, $htmlentities, $sprintf);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -153,35 +153,32 @@ class AdminAccessControllerCore extends AdminController
|
||||
$join = 'LEFT JOIN `'._DB_PREFIX_.'tab` t ON (t.`id_tab` = a.`id_tab`)';
|
||||
}
|
||||
|
||||
if ($id_tab == -1 && $perm == 'all' && $enabled == 0)
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a
|
||||
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
||||
WHERE `id_profile` = '.(int)$id_profile.' AND `id_tab` != '.(int)$this->id_tab_access;
|
||||
else if ($id_tab == -1 && $perm == 'all')
|
||||
$sql = '
|
||||
if ($id_tab == -1)
|
||||
{
|
||||
if ($perm == 'all')
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a
|
||||
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
||||
WHERE `id_profile` = '.(int)$id_profile;
|
||||
else if ($id_tab == -1)
|
||||
$sql = '
|
||||
else
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a
|
||||
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
|
||||
WHERE `id_profile` = '.(int)$id_profile;
|
||||
else if ($perm == 'all')
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a
|
||||
'.$join.'
|
||||
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
||||
WHERE '.$where.' = '.(int)$id_tab.'
|
||||
AND `id_profile` = '.(int)$id_profile;
|
||||
}
|
||||
else
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a
|
||||
'.$join.'
|
||||
{
|
||||
if ($perm == 'all')
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a '.$join.'
|
||||
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
||||
WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile;
|
||||
else
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'access` a '.$join.'
|
||||
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
|
||||
WHERE '.$where.' = '.(int)$id_tab.'
|
||||
AND `id_profile` = '.(int)$id_profile;
|
||||
WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile;
|
||||
}
|
||||
|
||||
$res = Db::getInstance()->execute($sql) ? 'ok' : 'error';
|
||||
|
||||
|
||||
@@ -444,4 +444,41 @@ class AdminAddressesControllerCore extends AdminController
|
||||
}
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object Delete
|
||||
*/
|
||||
public function processDelete()
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
if (!$object->isUsed())
|
||||
$this->deleted = false;
|
||||
|
||||
return parent::processDelete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete multiple items
|
||||
*
|
||||
* @return boolean true if succcess
|
||||
*/
|
||||
protected function processBulkDelete()
|
||||
{
|
||||
if (is_array($this->boxes) && !empty($this->boxes))
|
||||
{
|
||||
$deleted = false;
|
||||
foreach ($this->boxes as $id)
|
||||
{
|
||||
$to_delete = new Address((int)$id);
|
||||
if ($to_delete->isUsed())
|
||||
{
|
||||
$deleted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->deleted = $deleted;
|
||||
}
|
||||
|
||||
return parent::processBulkDelete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -686,7 +686,11 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
{
|
||||
foreach ($this->_list as &$list)
|
||||
if (file_exists(_PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.(int)$list['id_attribute'].'.jpg'))
|
||||
{
|
||||
if (!isset($list['color']) || !is_array($list['color']))
|
||||
$list['color'] = array();
|
||||
$list['color']['texture'] = '../img/'.$this->fieldImageSettings['dir'].'/'.(int)$list['id_attribute'].'.jpg';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -208,8 +208,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
$alias = 'sa';
|
||||
parent::getList($id_lang, $alias.'.position', $order_way, $start, $limit, Context::getContext()->shop->id);
|
||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, Context::getContext()->shop->id);
|
||||
// Check each row to see if there are combinations and get the correct action in consequence
|
||||
|
||||
$nb_items = count($this->_list);
|
||||
@@ -415,6 +414,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Description:'),
|
||||
'name' => 'description',
|
||||
'autoload_rte' => true,
|
||||
'lang' => true,
|
||||
'rows' => 10,
|
||||
'cols' => 100,
|
||||
|
||||
@@ -251,6 +251,26 @@ class AdminCountriesControllerCore extends AdminController
|
||||
'encoding_default_layout' => urlencode($default_layout),
|
||||
'display_valid_fields' => $this->displayValidFields()
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Address Standardization:'),
|
||||
'name' => 'standardization',
|
||||
'required' => false,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'standardization_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'id' => 'standardization_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Active:'),
|
||||
@@ -271,7 +291,7 @@ class AdminCountriesControllerCore extends AdminController
|
||||
)
|
||||
),
|
||||
'desc' => $this->l('Display this country to your customers (the selected country will always be displayed in the Back Office)')
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Contains following states:'),
|
||||
@@ -330,6 +350,7 @@ class AdminCountriesControllerCore extends AdminController
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
@@ -345,7 +366,10 @@ class AdminCountriesControllerCore extends AdminController
|
||||
'title' => $this->l('Save '),
|
||||
'class' => 'button'
|
||||
);
|
||||
|
||||
|
||||
if ($this->object->iso_code == 'US')
|
||||
$this->object->standardization = Configuration::get('PS_TAASC');
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
@@ -362,6 +386,9 @@ class AdminCountriesControllerCore extends AdminController
|
||||
if (!is_null($id_country) && $id_country != Tools::getValue('id_'.$this->table))
|
||||
$this->errors[] = Tools::displayError('This ISO code already exists.You cannot create two countries with the same ISO code.');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('standardization'))
|
||||
Configuration::updateValue('PS_TAASC', (bool)Tools::getValue('standardization', false));
|
||||
|
||||
if (!count($this->errors))
|
||||
$res = parent::postProcess();
|
||||
|
||||
@@ -72,6 +72,14 @@ class AdminCustomerPreferencesControllerCore extends AdminController
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool'
|
||||
),
|
||||
'PS_CUSTOMER_CREATION_EMAIL' => array(
|
||||
'title' => $this->l('Send an email after registration'),
|
||||
'desc' => $this->l('Send an email with summary account (email, password) after registration.'),
|
||||
'validation' => 'isUnsignedInt',
|
||||
'validation' => 'isBool',
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool'
|
||||
),
|
||||
'PS_PASSWD_TIME_FRONT' => array(
|
||||
'title' => $this->l('Regenerate password'),
|
||||
'desc' => $this->l('Minimum time required to regenerate a password.'),
|
||||
|
||||
@@ -557,7 +557,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
$products = $customer->getBoughtProducts();
|
||||
if ($products && count($products))
|
||||
foreach ($products as $key => $product)
|
||||
$products[$key]['date_add'] = Tools::displayDate($product['date_add'], $this->context->language->id, true);
|
||||
$products[$key]['date_add'] = Tools::displayDate($product['date_add'],null , true);
|
||||
}
|
||||
|
||||
foreach ($messages as $key => $message)
|
||||
@@ -595,7 +595,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
if (!empty($message['id_product']) && empty($message['employee_name']))
|
||||
$id_order_product = Order::getIdOrderProduct((int)$message['id_customer'], (int)$message['id_product']);
|
||||
}
|
||||
$message['date_add'] = Tools::displayDate($message['date_add'], $this->context->language->id, true);
|
||||
$message['date_add'] = Tools::displayDate($message['date_add'],null , true);
|
||||
$message['user_agent'] = strip_tags($message['user_agent']);
|
||||
$message['message'] = preg_replace(
|
||||
'/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui',
|
||||
|
||||
@@ -555,7 +555,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$total_orders = count($orders);
|
||||
for ($i = 0; $i < $total_orders; $i++)
|
||||
{
|
||||
$orders[$i]['date_add'] = Tools::displayDate($orders[$i]['date_add'], $this->context->language->id);
|
||||
$orders[$i]['date_add'] = Tools::displayDate($orders[$i]['date_add']);
|
||||
$orders[$i]['total_paid_real_not_formated'] = $orders[$i]['total_paid_real'];
|
||||
$orders[$i]['total_paid_real'] = Tools::displayPrice($orders[$i]['total_paid_real'], new Currency((int)$orders[$i]['id_currency']));
|
||||
}
|
||||
@@ -565,7 +565,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
for ($i = 0; $i < $total_messages; $i++)
|
||||
{
|
||||
$messages[$i]['message'] = substr(strip_tags(html_entity_decode($messages[$i]['message'], ENT_NOQUOTES, 'UTF-8')), 0, 75);
|
||||
$messages[$i]['date_add'] = Tools::displayDate($messages[$i]['date_add'], $this->context->language->id, true);
|
||||
$messages[$i]['date_add'] = Tools::displayDate($messages[$i]['date_add'], null, true);
|
||||
}
|
||||
|
||||
$groups = $customer->getGroups();
|
||||
@@ -598,7 +598,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$products = $customer->getBoughtProducts();
|
||||
$total_products = count($products);
|
||||
for ($i = 0; $i < $total_products; $i++)
|
||||
$products[$i]['date_add'] = Tools::displayDate($products[$i]['date_add'], $this->default_form_language, true);
|
||||
$products[$i]['date_add'] = Tools::displayDate($products[$i]['date_add'], null, true);
|
||||
|
||||
$carts = Cart::getCustomerCarts($customer->id);
|
||||
$total_carts = count($carts);
|
||||
@@ -610,7 +610,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$currency = new Currency((int)$carts[$i]['id_currency']);
|
||||
$carrier = new Carrier((int)$carts[$i]['id_carrier']);
|
||||
$carts[$i]['id_cart'] = sprintf('%06d', $carts[$i]['id_cart']);
|
||||
$carts[$i]['date_add'] = Tools::displayDate($carts[$i]['date_add'], $this->default_form_language, true);
|
||||
$carts[$i]['date_add'] = Tools::displayDate($carts[$i]['date_add'], null, true);
|
||||
$carts[$i]['total_price'] = Tools::displayPrice($summary['total_price'], $currency);
|
||||
$carts[$i]['name'] = $carrier->name;
|
||||
}
|
||||
@@ -646,7 +646,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$total_connections = count($connections);
|
||||
for ($i = 0; $i < $total_connections; $i++)
|
||||
{
|
||||
$connections[$i]['date_add'] = Tools::displayDate($connections[$i]['date_add'], $this->default_form_language, true);
|
||||
$connections[$i]['date_add'] = Tools::displayDate($connections[$i]['date_add'],null , true);
|
||||
$connections[$i]['http_referer'] = $connections[$i]['http_referer'] ?
|
||||
preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) :
|
||||
$this->l('Direct link');
|
||||
@@ -655,7 +655,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$referrers = Referrer::getReferrers($customer->id);
|
||||
$total_referrers = count($referrers);
|
||||
for ($i = 0; $i < $total_referrers; $i++)
|
||||
$referrers[$i]['date_add'] = Tools::displayDate($referrers[$i]['date_add'], $this->default_form_language, true);
|
||||
$referrers[$i]['date_add'] = Tools::displayDate($referrers[$i]['date_add'],null , true);
|
||||
|
||||
$shop = new Shop($customer->id_shop);
|
||||
$this->tpl_view_vars = array(
|
||||
@@ -663,14 +663,14 @@ class AdminCustomersControllerCore extends AdminController
|
||||
'gender_image' => $gender_image,
|
||||
|
||||
// General information of the customer
|
||||
'registration_date' => Tools::displayDate($customer->date_add, $this->default_form_language, true),
|
||||
'registration_date' => Tools::displayDate($customer->date_add,null , true),
|
||||
'customer_stats' => $customer_stats,
|
||||
'last_visit' => Tools::displayDate($customer_stats['last_visit'], $this->default_form_language, true),
|
||||
'last_visit' => Tools::displayDate($customer_stats['last_visit'],null , true),
|
||||
'count_better_customers' => $count_better_customers,
|
||||
'shop_is_feature_active' => Shop::isFeatureActive(),
|
||||
'name_shop' => $shop->name,
|
||||
'customer_birthday' => Tools::displayDate($customer->birthday, $this->default_form_language),
|
||||
'last_update' => Tools::displayDate($customer->date_upd, $this->default_form_language, true),
|
||||
'customer_birthday' => Tools::displayDate($customer->birthday),
|
||||
'last_update' => Tools::displayDate($customer->date_upd,null , true),
|
||||
'customer_exists' => Customer::customerExists($customer->email),
|
||||
'id_lang' => $customer->id_lang,
|
||||
'customerLanguage' => (new Language($customer->id_lang)),
|
||||
|
||||
@@ -165,6 +165,15 @@ class AdminEmailsControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
public function updateOptionPsMailPasswd($value)
|
||||
{
|
||||
if (Tools::getValue('PS_MAIL_PASSWD') == '' && Configuration::get('PS_MAIL_PASSWD'))
|
||||
return true;
|
||||
else
|
||||
Configuration::updateValue('PS_MAIL_PASSWD', Tools::getValue('PS_MAIL_PASSWD'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AdminController::initContent() override
|
||||
* @see AdminController::initContent()
|
||||
|
||||
@@ -297,7 +297,7 @@ class AdminEmployeesControllerCore extends AdminController
|
||||
}
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Profile:'),
|
||||
'label' => $this->l('Profile Permission:'),
|
||||
'name' => 'id_profile',
|
||||
'required' => true,
|
||||
'options' => array(
|
||||
|
||||
@@ -312,36 +312,32 @@ class AdminGroupsControllerCore extends AdminController
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
protected function formatCategoryDiscountList($id)
|
||||
protected function formatCategoryDiscountList($id_group)
|
||||
{
|
||||
$category = GroupReduction::getGroupReductions((int)$id, $this->context->language->id);
|
||||
$group_reductions = GroupReduction::getGroupReductions((int)$id_group, $this->context->language->id);
|
||||
$category_reductions = array();
|
||||
$category_reduction = Tools::getValue('category_reduction');
|
||||
|
||||
foreach ($category as $category)
|
||||
foreach ($group_reductions as $category)
|
||||
{
|
||||
if (is_array($category_reduction) && array_key_exists($category['id_category'], $category_reduction))
|
||||
$category['reduction'] = $category_reduction[$category['id_category']];
|
||||
|
||||
$tmp = array();
|
||||
$tmp['path'] = getPath(self::$currentIndex.'?tab=AdminCategories', (int)$category['id_category']);
|
||||
$tmp['reduction'] = (float)$category['reduction'] * 100;
|
||||
$tmp['id_category'] = (int)$category['id_category'];
|
||||
$category_reductions[(int)$category['id_category']] = $tmp;
|
||||
$category_reductions[(int)$category['id_category']] = array(
|
||||
'path' => getPath(self::$currentIndex.'?tab=AdminCategories', (int)$category['id_category']),
|
||||
'reduction' => (float)$category['reduction'] * 100,
|
||||
'id_category' => (int)$category['id_category']
|
||||
);
|
||||
}
|
||||
|
||||
if (is_array($category_reduction))
|
||||
foreach ($category_reduction as $key => $val)
|
||||
{
|
||||
if (!array_key_exists($key, $category_reductions))
|
||||
{
|
||||
$tmp = array();
|
||||
$tmp['path'] = getPath(self::$currentIndex.'?tab=AdminCategories', $key);
|
||||
$tmp['reduction'] = (float)$val * 100;
|
||||
$tmp['id_category'] = (int)$key;
|
||||
$category_reductions[(int)$category['id_category']] = $tmp;
|
||||
}
|
||||
}
|
||||
$category_reductions[(int)$key] = array(
|
||||
'path' => getPath(self::$currentIndex.'?tab=AdminCategories', $key),
|
||||
'reduction' => (float)$val * 100,
|
||||
'id_category' => (int)$key
|
||||
);
|
||||
|
||||
return $category_reductions;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class AdminHomeControllerCore extends AdminController
|
||||
$indexRebuiltAfterUpdate = 2;
|
||||
|
||||
$smartyOptimized = 0;
|
||||
if (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_NO_COMPILE_)
|
||||
if (in_array(Configuration::get('PS_SMARTY_FORCE_COMPILE'), array(_PS_SMARTY_CHECK_COMPILE_, _PS_SMARTY_NO_COMPILE_)))
|
||||
++$smartyOptimized;
|
||||
if (Configuration::get('PS_SMARTY_CACHE'))
|
||||
++$smartyOptimized;
|
||||
|
||||
@@ -53,7 +53,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
);
|
||||
|
||||
// No need to display the old image system if the install has been made later than 2013-03-26
|
||||
$this->display_move = (defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true;
|
||||
$this->display_move = (!Configuration::get('PS_LEGACY_IMAGES') && defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true;
|
||||
|
||||
$this->fields_options = array(
|
||||
'images' => array(
|
||||
@@ -62,7 +62,7 @@ class AdminImagesControllerCore extends AdminController
|
||||
'top' => '',
|
||||
'bottom' => '',
|
||||
'description' => $this->l('JPEG images have a small file size and standard quality. PNG images have a larger file size, a higher quality and support transparency. Note that in all cases the image files will have the .jpg extension.').'
|
||||
<br /><br />'.$this->l('WARNING: This feature may not be compatible with your theme, or with some of your modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issues, turn it off by selecting "Use JPEG".'),
|
||||
<br /><br />'.$this->l('WARNING: This feature may not be compatible with your theme, or with some of your modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issues, turn it off by selecting "Use JPEG".'),
|
||||
'fields' => array(
|
||||
'PS_IMAGE_QUALITY' => array(
|
||||
'title' => $this->l('Image quality'),
|
||||
|
||||
@@ -489,7 +489,7 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// Get all iso code available
|
||||
if ($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.Tools::getValue('ps_version').'&iso_lang='.Tools::getValue('iso_lang')))
|
||||
if ($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.Tools::getValue('ps_version').'&iso_lang='.Tools::strtolower(Tools::getValue('iso_lang'))))
|
||||
{
|
||||
$result = Tools::jsonDecode($lang_packs);
|
||||
if ($lang_packs !== '' && $result && !isset($result->error))
|
||||
|
||||
@@ -440,6 +440,7 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Zip Code/Postal Code'),
|
||||
'name' => 'postcode',
|
||||
'required' => true,
|
||||
'size' => 33,
|
||||
'required' => false,
|
||||
);
|
||||
|
||||
@@ -529,6 +529,7 @@ class AdminMetaControllerCore extends AdminController
|
||||
{
|
||||
$this->url->domain = $value;
|
||||
$this->url->update();
|
||||
Configuration::updateGlobalValue('PS_SHOP_DOMAIN', $value);
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('This domain is not valid.');
|
||||
@@ -546,6 +547,7 @@ class AdminMetaControllerCore extends AdminController
|
||||
{
|
||||
$this->url->domain_ssl = $value;
|
||||
$this->url->update();
|
||||
Configuration::updateGlobalValue('PS_SHOP_DOMAIN_SSL', $value);
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('The SSL domain is not valid.');
|
||||
|
||||
@@ -39,8 +39,7 @@ class AdminNotFoundControllerCore extends AdminController
|
||||
public function initContent()
|
||||
{
|
||||
$this->errors[] = Tools::displayError('Controller not found');
|
||||
$tpl_vars['controller'] = Tools::getvalue('controller');
|
||||
|
||||
$tpl_vars['controller'] = Tools::getvalue('controllerUri', Tools::getvalue('controller'));
|
||||
$this->context->smarty->assign($tpl_vars);
|
||||
parent::initContent();
|
||||
}
|
||||
|
||||
@@ -266,10 +266,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order = new Order(Tools::getValue('id_order'));
|
||||
if (!Validate::isLoadedObject($order))
|
||||
throw new PrestaShopException('Can\'t load Order object');
|
||||
ShopUrl::cacheMainDomainForShop((int)$order->id_shop);
|
||||
}
|
||||
|
||||
ShopUrl::cacheMainDomainForShop((int)$order->id_shop);
|
||||
|
||||
/* Update shipping number */
|
||||
if (Tools::isSubmit('submitShippingNumber') && isset($order))
|
||||
{
|
||||
@@ -1971,8 +1970,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
{
|
||||
$res = true;
|
||||
|
||||
$order_detail = new OrderDetail(Tools::getValue('id_order_detail'));
|
||||
$order = new Order(Tools::getValue('id_order'));
|
||||
$order_detail = new OrderDetail((int)Tools::getValue('id_order_detail'));
|
||||
$order = new Order((int)Tools::getValue('id_order'));
|
||||
|
||||
$this->doDeleteProductLineValidation($order_detail, $order);
|
||||
|
||||
@@ -1995,6 +1994,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order->total_products_wt -= $order_detail->total_price_tax_incl;
|
||||
|
||||
$res &= $order->update();
|
||||
|
||||
// Reinject quantity in stock
|
||||
$this->reinjectQuantity($order_detail, $order_detail->product_quantity);
|
||||
|
||||
// Delete OrderDetail
|
||||
$res &= $order_detail->delete();
|
||||
|
||||
@@ -373,7 +373,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$default_product = new Product((int)$this->object->id, false, null, (int)$this->object->id_shop_default);
|
||||
$def = ObjectModel::getDefinition($this->object);
|
||||
foreach ($def['fields'] as $field_name => $row)
|
||||
$this->object->$field_name = $default_product->$field_name;
|
||||
$this->object->$field_name = ObjectModel::formatValue($default_product->$field_name, $def['fields'][$field_name]['type']);
|
||||
}
|
||||
$this->object->loadStockData();
|
||||
}
|
||||
@@ -914,7 +914,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
$tos = Tools::getValue('spm_to');
|
||||
|
||||
foreach ($id_specific_prices as $key => $id_specific_price)
|
||||
if ($this->_validateSpecificPrice($id_shops[$key], $id_currencies[$key], $id_countries[$key], $id_groups[$key], $id_customers[$key], $prices[$key], $from_quantities[$key], $reductions[$key], $reduction_types[$key], $froms[$key], $tos[$key], $id_combinations[$key]))
|
||||
if ($reduction_types[$key] == 'percentage' && ((float)$reductions[$key] <= 0 || (float)$reductions[$key] > 100))
|
||||
$this->errors[] = Tools::displayError('Submitted reduction value (0-100) is out-of-range');
|
||||
elseif ($this->_validateSpecificPrice($id_shops[$key], $id_currencies[$key], $id_countries[$key], $id_groups[$key], $id_customers[$key], $prices[$key], $from_quantities[$key], $reductions[$key], $reduction_types[$key], $froms[$key], $tos[$key], $id_combinations[$key]))
|
||||
{
|
||||
$specific_price = new SpecificPrice((int)($id_specific_price));
|
||||
$specific_price->id_shop = (int)$id_shops[$key];
|
||||
@@ -930,7 +932,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$specific_price->from = !$froms[$key] ? '0000-00-00 00:00:00' : $froms[$key];
|
||||
$specific_price->to = !$tos[$key] ? '0000-00-00 00:00:00' : $tos[$key];
|
||||
if (!$specific_price->update())
|
||||
$this->errors = Tools::displayError('An error occurred while updating the specific price.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating the specific price.');
|
||||
}
|
||||
if (!count($this->errors))
|
||||
$this->redirect_after = self::$currentIndex.'&id_product='.(int)(Tools::getValue('id_product')).(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&update'.$this->table.'&action=Prices&token='.$this->token;
|
||||
@@ -960,7 +962,10 @@ class AdminProductsControllerCore extends AdminController
|
||||
$to = Tools::getValue('sp_to');
|
||||
if (!$to)
|
||||
$to = '0000-00-00 00:00:00';
|
||||
if ($this->_validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $id_customer, $price, $from_quantity, $reduction, $reduction_type, $from, $to, $id_product_attribute))
|
||||
|
||||
if ($reduction_type == 'percentage' && ((float)$reduction <= 0 || (float)$reduction > 100))
|
||||
$this->errors[] = Tools::displayError('Submitted reduction value (0-100) is out-of-range');
|
||||
elseif ($this->_validateSpecificPrice($id_shop, $id_currency, $id_country, $id_group, $id_customer, $price, $from_quantity, $reduction, $reduction_type, $from, $to, $id_product_attribute))
|
||||
{
|
||||
$specificPrice = new SpecificPrice();
|
||||
$specificPrice->id_product = (int)$id_product;
|
||||
@@ -977,7 +982,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$specificPrice->from = $from;
|
||||
$specificPrice->to = $to;
|
||||
if (!$specificPrice->add())
|
||||
$this->errors = Tools::displayError('An error occurred while updating the specific price.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating the specific price.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1797,6 +1802,29 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP)
|
||||
$object->setFieldsToUpdate((array)Tools::getValue('multishop_check'));
|
||||
|
||||
// Duplicate combinations if not associated to shop
|
||||
if ($this->context->shop->getContext() == Shop::CONTEXT_SHOP && !$object->isAssociatedToShop())
|
||||
{
|
||||
$is_associated_to_shop = false;
|
||||
$combinations = Product::getProductAttributesIds($object->id);
|
||||
if ($combinations)
|
||||
{
|
||||
foreach ($combinations as $id_combination)
|
||||
{
|
||||
$combination = new Combination((int)$id_combination['id_product_attribute']);
|
||||
$default_combination = new Combination((int)$id_combination['id_product_attribute'], null, (int)$this->object->id_shop_default);
|
||||
|
||||
$def = ObjectModel::getDefinition($default_combination);
|
||||
foreach ($def['fields'] as $field_name => $row)
|
||||
$combination->$field_name = ObjectModel::formatValue($default_combination->$field_name, $def['fields'][$field_name]['type']);
|
||||
|
||||
$combination->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
$is_associated_to_shop = true;
|
||||
|
||||
if ($object->update())
|
||||
{
|
||||
if (in_array($this->context->shop->getContext(), array(Shop::CONTEXT_SHOP, Shop::CONTEXT_ALL)))
|
||||
@@ -1887,7 +1915,15 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->display = 'edit';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$is_associated_to_shop && $combinations)
|
||||
foreach ($combinations as $id_combination)
|
||||
{
|
||||
$combination = new Combination((int)$id_combination['id_product_attribute']);
|
||||
$combination->delete();
|
||||
}
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating an object.').' <b>'.$this->table.'</b> ('.Db::getInstance()->getMsgError().')';
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating an object.').' <b>'.$this->table.'</b> ('.Tools::displayError('The object cannot be loaded. ').')';
|
||||
|
||||
@@ -136,7 +136,7 @@ class AdminReturnControllerCore extends AdminController
|
||||
$this->tpl_form_vars = array(
|
||||
'customer' => new Customer($this->object->id_customer),
|
||||
'url_customer' => 'index.php?tab=AdminCustomers&id_customer='.(int)$this->object->id_customer.'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id),
|
||||
'text_order' => sprintf($this->l('Order #%1$d from %2$s'), $order->id, Tools::displayDate($order->date_upd, $order->id_lang)),
|
||||
'text_order' => sprintf($this->l('Order #%1$d from %2$s'), $order->id, Tools::displayDate($order->date_upd)),
|
||||
'url_order' => 'index.php?tab=AdminOrders&id_order='.(int)$order->id.'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)Tab::getIdFromClassName('AdminOrders').(int)$this->context->employee->id),
|
||||
'picture_folder' => _THEME_PROD_PIC_DIR_,
|
||||
'type_file' => Product::CUSTOMIZE_FILE,
|
||||
|
||||
@@ -1877,9 +1877,9 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
'supply_order_warehouse' => (Validate::isLoadedObject($warehouse) ? $warehouse->name : ''),
|
||||
'supply_order_reference' => $supply_order->reference,
|
||||
'supply_order_supplier_name' => $supply_order->supplier_name,
|
||||
'supply_order_creation_date' => Tools::displayDate($supply_order->date_add, $lang_id, false),
|
||||
'supply_order_last_update' => Tools::displayDate($supply_order->date_upd, $lang_id, false),
|
||||
'supply_order_expected' => Tools::displayDate($supply_order->date_delivery_expected, $lang_id, false),
|
||||
'supply_order_creation_date' => Tools::displayDate($supply_order->date_add,null , false),
|
||||
'supply_order_last_update' => Tools::displayDate($supply_order->date_upd,null , false),
|
||||
'supply_order_expected' => Tools::displayDate($supply_order->date_delivery_expected,null , false),
|
||||
'supply_order_discount_rate' => Tools::ps_round($supply_order->discount_rate, 2),
|
||||
'supply_order_total_te' => Tools::displayPrice($supply_order->total_te, $currency),
|
||||
'supply_order_discount_value_te' => Tools::displayPrice($supply_order->discount_value_te, $currency),
|
||||
|
||||
@@ -52,6 +52,9 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
if ($id_category = Tools::getValue('id_category') && Tools::getIsset('viewcategory'))
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminProducts').'&id_category='.(int)$id_category.'&viewcategory');
|
||||
|
||||
$this->_helper_list = new HelperList();
|
||||
|
||||
if (!Configuration::get('PS_STOCK_MANAGEMENT'))
|
||||
@@ -151,8 +154,6 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
$this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes but without available quantities for sale:'));
|
||||
|
||||
|
||||
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
|
||||
@@ -720,7 +720,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if (Validate::isLangIsoCode($arr_import_lang[0]))
|
||||
{
|
||||
if ($content = Tools::file_get_contents(
|
||||
'http://www.prestashop.com/download/lang_packs/gzip/'.$arr_import_lang[1].'/'.$arr_import_lang[0].'.gzip', false,
|
||||
'http://www.prestashop.com/download/lang_packs/gzip/'.$arr_import_lang[1].'/'.Tools::strtolower($arr_import_lang[0]).'.gzip', false,
|
||||
@stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
|
||||
{
|
||||
$file = _PS_TRANSLATIONS_DIR_.$arr_import_lang[0].'.gzip';
|
||||
@@ -815,7 +815,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
|
||||
|
||||
// Parse this content
|
||||
$matches = $this->userParseFile($content, $this->type_selected, $type_file);
|
||||
$matches = $this->userParseFile($content, $this->type_selected, $type_file, $module_name);
|
||||
|
||||
// Write each translation on its module file
|
||||
$template_name = substr(basename($file), 0, -4);
|
||||
@@ -858,7 +858,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
public function clearModuleFiles($files, $type_clear = 'file', $path = '')
|
||||
{
|
||||
// List of directory which not must be parsed
|
||||
$arr_exclude = array('img', 'js', 'mails');
|
||||
$arr_exclude = array('img', 'js', 'mails','override');
|
||||
|
||||
// List of good extention files
|
||||
$arr_good_ext = array('.tpl', '.php');
|
||||
@@ -914,7 +914,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
|
||||
|
||||
// Parse this content
|
||||
$matches = $this->userParseFile($content, $this->type_selected, $type_file);
|
||||
$matches = $this->userParseFile($content, $this->type_selected, $type_file, $module_name);
|
||||
|
||||
// Write each translation on its module file
|
||||
$template_name = substr(basename($file), 0, -4);
|
||||
@@ -1057,9 +1057,10 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
* @param $content
|
||||
* @param $type_translation : front, back, errors, modules...
|
||||
* @param string|bool $type_file : (tpl|php)
|
||||
* @param string $module_name : name of the module
|
||||
* @return return $matches
|
||||
*/
|
||||
protected function userParseFile($content, $type_translation, $type_file = false)
|
||||
protected function userParseFile($content, $type_translation, $type_file = false, $module_name = '')
|
||||
{
|
||||
switch ($type_translation)
|
||||
{
|
||||
@@ -1088,7 +1089,8 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
if ($type_file == 'php')
|
||||
$regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
|
||||
else
|
||||
$regex = '/\{l\s*s=[\'\"]'._PS_TRANS_PATTERN_.'[\'\"](\s*sprintf=.*)?(\s*mod=\'.+\')?(\s*js=1)?\s*\}/U';
|
||||
// In tpl file look for something that should contain mod='module_name' according to the documentation
|
||||
$regex = '/\{l\s*s=[\'\"]'._PS_TRANS_PATTERN_.'[\'\"].*\s+mod=\''.$module_name.'\'.*\}/U';
|
||||
break;
|
||||
|
||||
case 'pdf':
|
||||
|
||||
@@ -424,7 +424,7 @@ class AdminWarehousesControllerCore extends AdminController
|
||||
$address = new Address($object->id_address);
|
||||
if (Validate::isLoadedObject($address))
|
||||
{
|
||||
$address->id_warehouse = $object->id_address;
|
||||
$address->id_warehouse = (int)$object->id;
|
||||
$address->save();
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ class AddressControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('This country requires you to chose a State.');
|
||||
|
||||
// US customer: normalize the address
|
||||
if ($address->id_country == Country::getByIso('US'))
|
||||
if ($address->id_country == Country::getByIso('US') && Configuration::get('PS_TAASC'))
|
||||
{
|
||||
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
|
||||
$normalize = new AddressStandardizationSolution;
|
||||
|
||||
@@ -32,6 +32,9 @@ class AttachmentControllerCore extends FrontController
|
||||
if (!$a->id)
|
||||
Tools::redirect('index.php');
|
||||
|
||||
if (ob_get_level())
|
||||
ob_end_clean();
|
||||
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Content-Type: '.$a->mime);
|
||||
header('Content-Length: '.filesize(_PS_DOWNLOAD_DIR_.$a->file));
|
||||
|
||||
@@ -139,6 +139,9 @@ class AuthControllerCore extends FrontController
|
||||
'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')
|
||||
));
|
||||
|
||||
// Just set $this->template value here in case it's used by Ajax
|
||||
$this->setTemplate(_PS_THEME_DIR_.'authentication.tpl');
|
||||
|
||||
if ($this->ajax)
|
||||
{
|
||||
// Call a hook to display more information on form
|
||||
@@ -150,12 +153,11 @@ class AuthControllerCore extends FrontController
|
||||
$return = array(
|
||||
'hasError' => !empty($this->errors),
|
||||
'errors' => $this->errors,
|
||||
'page' => $this->context->smarty->fetch(_PS_THEME_DIR_.'authentication.tpl'),
|
||||
'page' => $this->context->smarty->fetch($this->template),
|
||||
'token' => Tools::getToken(false)
|
||||
);
|
||||
die(Tools::jsonEncode($return));
|
||||
}
|
||||
$this->setTemplate(_PS_THEME_DIR_.'authentication.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -472,7 +474,7 @@ class AuthControllerCore extends FrontController
|
||||
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your account..');
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,7 +489,7 @@ class AuthControllerCore extends FrontController
|
||||
$this->errors = array_unique(array_merge($this->errors, $address->validateController()));
|
||||
|
||||
// US customer: normalize the address
|
||||
if ($address->id_country == Country::getByIso('US'))
|
||||
if ($address->id_country == Country::getByIso('US') && Configuration::get('PS_TAASC'))
|
||||
{
|
||||
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
|
||||
$normalize = new AddressStandardizationSolution;
|
||||
@@ -545,7 +547,7 @@ class AuthControllerCore extends FrontController
|
||||
else
|
||||
$customer->is_guest = 0;
|
||||
if (!$customer->add())
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your account..');
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
|
||||
else
|
||||
{
|
||||
$address->id_customer = (int)$customer->id;
|
||||
@@ -688,6 +690,9 @@ class AuthControllerCore extends FrontController
|
||||
*/
|
||||
protected function sendConfirmationMail(Customer $customer)
|
||||
{
|
||||
if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL'))
|
||||
return true;
|
||||
|
||||
return Mail::Send(
|
||||
$this->context->language->id,
|
||||
'account',
|
||||
|
||||
@@ -335,7 +335,8 @@ class CartControllerCore extends FrontController
|
||||
if ($result['customizedDatas'])
|
||||
Product::addCustomizationPrice($result['summary']['products'], $result['customizedDatas']);
|
||||
|
||||
die(Tools::jsonEncode($result));
|
||||
Hook::exec('actionCartListOverride', array('summary' => $result, 'json' => &$json));
|
||||
die(Tools::jsonEncode(array_merge($result, (array)Tools::jsonDecode($json, true))));
|
||||
}
|
||||
// @todo create a hook
|
||||
elseif (file_exists(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php'))
|
||||
|
||||
@@ -281,7 +281,7 @@ class ContactControllerCore extends FrontController
|
||||
$tmp = $order->getProducts();
|
||||
foreach ($tmp as $key => $val)
|
||||
$products[$row['id_order']][$val['product_id']] = array('value' => $val['product_id'], 'label' => $val['product_name']);
|
||||
$orders[] = array('value' => $order->id, 'label' => $order->getUniqReference().' - '.Tools::displayDate($date[0], $this->context->language->id), 'selected' => (int)Tools::getValue('id_order') == $order->id);
|
||||
$orders[] = array('value' => $order->id, 'label' => $order->getUniqReference().' - '.Tools::displayDate($date[0],null) , 'selected' => (int)Tools::getValue('id_order') == $order->id);
|
||||
}
|
||||
|
||||
$this->context->smarty->assign('orderList', $orders);
|
||||
|
||||
@@ -270,12 +270,14 @@ class GetFileControllerCore extends FrontController
|
||||
$mimeType = 'application/octet-stream';
|
||||
}
|
||||
|
||||
if (ob_get_level())
|
||||
ob_end_clean();
|
||||
|
||||
/* Set headers for download */
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Content-Type: '.$mimeType);
|
||||
header('Content-Length: '.filesize($file));
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
ob_end_flush();
|
||||
$fp = fopen($file, 'rb');
|
||||
while (!feof($fp))
|
||||
echo fgets($fp, 16384);
|
||||
|
||||
@@ -47,6 +47,13 @@ class NewProductsControllerCore extends FrontController
|
||||
|
||||
$this->productSort();
|
||||
|
||||
// Override default configuration values: cause the new products page must display latest products first.
|
||||
if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby'))
|
||||
{
|
||||
$this->orderBy = 'date_add';
|
||||
$this->orderWay = 'DESC';
|
||||
}
|
||||
|
||||
$nbProducts = (int)Product::getNewProducts(
|
||||
$this->context->language->id,
|
||||
(isset($this->p) ? (int)($this->p) - 1 : null),
|
||||
|
||||
@@ -399,10 +399,11 @@ class ParentOrderControllerCore extends FrontController
|
||||
|
||||
// Getting a list of formated address fields with associated values
|
||||
$formatedAddressFieldsValuesList = array();
|
||||
foreach ($customerAddresses as $address)
|
||||
foreach ($customerAddresses as $i => $address)
|
||||
{
|
||||
if (!Address::isCountryActiveById((int)($address['id_address'])))
|
||||
unset($customerAddresses[$i]);
|
||||
$tmpAddress = new Address($address['id_address']);
|
||||
|
||||
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
|
||||
$formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues(
|
||||
$tmpAddress,
|
||||
@@ -459,6 +460,8 @@ class ParentOrderControllerCore extends FrontController
|
||||
{
|
||||
$address = new Address($this->context->cart->id_address_delivery);
|
||||
$id_zone = Address::getZoneById($address->id);
|
||||
if (!Address::isCountryActiveById((int)($this->context->cart->id_address_delivery)) || !Address::isCountryActiveById((int)($this->context->cart->id_address_invoice)))
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
$carriers = $this->context->cart->simulateCarriersOutput();
|
||||
$checked = $this->context->cart->simulateCarrierSelectedOutput();
|
||||
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
|
||||
|
||||
@@ -54,17 +54,17 @@ class StatisticsControllerCore extends FrontController
|
||||
if (sha1($id_guest._COOKIE_KEY_) != $this->param_token)
|
||||
die;
|
||||
|
||||
$guest = new Guest($id_guest);
|
||||
$guest = new Guest((int)substr($_POST['id_guest'],0,10));
|
||||
$guest->javascript = true;
|
||||
$guest->screen_resolution_x = (int)Tools::getValue('screen_resolution_x');
|
||||
$guest->screen_resolution_y = (int)Tools::getValue('screen_resolution_y');
|
||||
$guest->screen_color = (int)Tools::getValue('screen_color');
|
||||
$guest->sun_java = (int)Tools::getValue('sun_java');
|
||||
$guest->adobe_flash = (int)Tools::getValue('adobe_flash');
|
||||
$guest->adobe_director = (int)Tools::getValue('adobe_director');
|
||||
$guest->apple_quicktime = (int)Tools::getValue('apple_quicktime');
|
||||
$guest->real_player = (int)Tools::getValue('real_player');
|
||||
$guest->windows_media = (int)Tools::getValue('windows_media');
|
||||
$guest->screen_resolution_x = (int)substr($_POST['screen_resolution_x'],0,5);
|
||||
$guest->screen_resolution_y = (int)substr($_POST['screen_resolution_y'],0,5);
|
||||
$guest->screen_color = (int)substr($_POST['screen_color'],0,3);
|
||||
$guest->sun_java = (int)substr($_POST['sun_java'],0,1);
|
||||
$guest->adobe_flash = (int)substr($_POST['adobe_flash'],0,1);
|
||||
$guest->adobe_director = (int)substr($_POST['adobe_director'],0,1);
|
||||
$guest->apple_quicktime = (int)substr($_POST['apple_quicktime'],0,1);
|
||||
$guest->real_player = (int)substr($_POST['real_player'],0,1);
|
||||
$guest->windows_media = (int)substr($_POST['windows_media'],0,1);
|
||||
$guest->update();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -509,7 +509,7 @@ select optgroup option {
|
||||
background: #DFF2BF url(../img/admin/icon-valid.png) no-repeat scroll 6px 6px;
|
||||
border: 1px solid #4F8A10;
|
||||
color:#4F8A10;
|
||||
padding:20px;
|
||||
padding:20px 40px;
|
||||
position:fixed;
|
||||
bottom:0;
|
||||
width:100%;
|
||||
|
||||
@@ -29,7 +29,7 @@ abstract class InstallControllerHttp
|
||||
/**
|
||||
* @var array List of installer steps
|
||||
*/
|
||||
protected static $steps = array('welcome', 'license', 'system', 'database', 'configure', 'process');
|
||||
protected static $steps = array('welcome', 'license', 'system', 'configure', 'database', 'process');
|
||||
|
||||
protected static $instances = array();
|
||||
|
||||
|
||||
@@ -133,6 +133,11 @@ class Datas
|
||||
'default' => 1,
|
||||
'help' => 'get news from PrestaShop',
|
||||
),
|
||||
'send_email' => array(
|
||||
'name' => 'send_email',
|
||||
'default' => 1,
|
||||
'help' => 'send an email to the administrator after installation',
|
||||
),
|
||||
);
|
||||
|
||||
protected $datas = array();
|
||||
@@ -200,4 +205,4 @@ class Datas
|
||||
|
||||
return count($errors) ? $errors : true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,8 @@
|
||||
class InstallSession
|
||||
{
|
||||
protected static $_instance;
|
||||
protected static $_cookie_mode = false;
|
||||
protected static $_cookie = false;
|
||||
|
||||
public static function getInstance()
|
||||
{
|
||||
@@ -41,39 +43,71 @@ class InstallSession
|
||||
public function __construct()
|
||||
{
|
||||
session_name('install_'.md5(__PS_BASE_URI__));
|
||||
session_start();
|
||||
if (!session_start() || (!isset($_SESSION['session_mode']) && (count($_POST) || count($_GET))))
|
||||
{
|
||||
InstallSession::$_cookie_mode = true;
|
||||
InstallSession::$_cookie = new Cookie('ps_install', null, time() + 7200, null, true);
|
||||
}
|
||||
$_SESSION['session_mode'] = 'session';
|
||||
}
|
||||
|
||||
public function clean()
|
||||
{
|
||||
foreach ($_SESSION as $k => $v)
|
||||
unset($_SESSION[$k]);
|
||||
if (InstallSession::$_cookie_mode)
|
||||
InstallSession::$_cookie->logout();
|
||||
else
|
||||
foreach ($_SESSION as $k => $v)
|
||||
unset($_SESSION[$k]);
|
||||
}
|
||||
|
||||
public function &__get($varname)
|
||||
{
|
||||
if (isset($_SESSION[$varname]))
|
||||
$ref = &$_SESSION[$varname];
|
||||
if (InstallSession::$_cookie_mode)
|
||||
{
|
||||
$ref = InstallSession::$_cookie->{$varname};
|
||||
if (0 === strncmp($ref, 'serialized_array:', strlen('serialized_array:')))
|
||||
$ref = unserialize(substr($ref, strlen('serialized_array:')));
|
||||
}
|
||||
else
|
||||
{
|
||||
$null = null;
|
||||
$ref = &$null;
|
||||
if (isset($_SESSION[$varname]))
|
||||
$ref = &$_SESSION[$varname];
|
||||
else
|
||||
{
|
||||
$null = null;
|
||||
$ref = &$null;
|
||||
}
|
||||
}
|
||||
return $ref;
|
||||
}
|
||||
|
||||
public function __set($varname, $value)
|
||||
{
|
||||
$_SESSION[$varname] = $value;
|
||||
if (InstallSession::$_cookie_mode)
|
||||
{
|
||||
if ($varname == 'xml_loader_ids')
|
||||
return;
|
||||
if (is_array($value))
|
||||
$value = 'serialized_array:'.serialize($value);
|
||||
InstallSession::$_cookie->{$varname} = $value;
|
||||
}
|
||||
else
|
||||
$_SESSION[$varname] = $value;
|
||||
}
|
||||
|
||||
public function __isset($varname)
|
||||
{
|
||||
return isset($_SESSION[$varname]);
|
||||
if (InstallSession::$_cookie_mode)
|
||||
return isset(InstallSession::$_cookie->{$varname});
|
||||
else
|
||||
return isset($_SESSION[$varname]);
|
||||
}
|
||||
|
||||
public function __unset($varname)
|
||||
{
|
||||
unset($_SESSION[$varname]);
|
||||
if (InstallSession::$_cookie_mode)
|
||||
unset(InstallSession::$_cookie->{$varname});
|
||||
else
|
||||
unset($_SESSION[$varname]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,10 +224,13 @@ class InstallXmlLoader
|
||||
return;
|
||||
}
|
||||
|
||||
if (substr($entity, 0, 1) == '.' || substr($entity, 0, 1) == '_')
|
||||
return;
|
||||
|
||||
$xml = $this->loadEntity($entity);
|
||||
|
||||
// Read list of fields
|
||||
if (!$xml->fields)
|
||||
if (!is_object($xml) || !$xml->fields)
|
||||
throw new PrestashopInstallerException('List of fields not found for entity '.$entity);
|
||||
|
||||
if ($this->isMultilang($entity))
|
||||
|
||||
@@ -110,8 +110,9 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
|
||||
$this->printErrors();
|
||||
if (!$this->processInstallTheme())
|
||||
$this->printErrors();
|
||||
if (!$this->processSendEmail())
|
||||
$this->printErrors();
|
||||
if ($this->datas->send_email)
|
||||
if (!$this->processSendEmail())
|
||||
$this->printErrors();
|
||||
|
||||
if ($this->datas->newsletter)
|
||||
{
|
||||
@@ -287,5 +288,4 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
|
||||
{
|
||||
return $this->model_install->installModulesAddons();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user