Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
commit
3a5a9dea14
300 files changed
+1680
-990
No files matched your search
+1
-1
@@ -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)
|
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
|
[1]: https://help.github.com/articles/using-pull-requests
|
||||||
[2]: http://docs.prestashop.com/display/PS15/Coding+Standard
|
[2]: http://docs.prestashop.com/display/PS15/Coding+Standards
|
||||||
[3]: http://docs.prestashop.com/display/PS15/How+to+write+a+commit+message
|
[3]: http://docs.prestashop.com/display/PS15/How+to+write+a+commit+message
|
||||||
@@ -25,5 +25,5 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
define('_PS_ADMIN_DIR_', getcwd());
|
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();
|
Controller::getController('GetFileController')->run();
|
||||||
@@ -49,10 +49,12 @@
|
|||||||
|
|
||||||
if (perm == 'all' && $(this).parent().parent().hasClass('parent'))
|
if (perm == 'all' && $(this).parent().parent().hasClass('parent'))
|
||||||
{
|
{
|
||||||
checked = enabled ? 'checked': '';
|
if (enabled)
|
||||||
$(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').attr('checked', checked);
|
$(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({
|
$.ajax({
|
||||||
url: "{$link->getAdminLink('AdminAccess')}",
|
url: "{$link->getAdminLink('AdminAccess')|addslashes}",
|
||||||
cache: false,
|
cache: false,
|
||||||
data : {
|
data : {
|
||||||
ajaxMode : '1',
|
ajaxMode : '1',
|
||||||
@@ -68,15 +70,12 @@
|
|||||||
},
|
},
|
||||||
success : function(res,textStatus,jqXHR)
|
success : function(res,textStatus,jqXHR)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
if (res == 'ok')
|
if (res == 'ok')
|
||||||
showSuccessMessage("{l s='Update successful'}");
|
showSuccessMessage("{l s='Update successful'}");
|
||||||
else
|
else
|
||||||
showErrorMessage("{l s='Update error'}");
|
showErrorMessage("{l s='Update error'}");
|
||||||
}
|
} catch(e) {
|
||||||
catch(e)
|
|
||||||
{
|
|
||||||
jAlert('Technical error');
|
jAlert('Technical error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +84,7 @@
|
|||||||
perfect_access_js_gestion(this, perm, id_tab, tabsize, tabnumber, table);
|
perfect_access_js_gestion(this, perm, id_tab, tabsize, tabnumber, table);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{$link->getAdminLink('AdminAccess')}",
|
url: "{$link->getAdminLink('AdminAccess')|addslashes}",
|
||||||
cache: false,
|
cache: false,
|
||||||
data : {
|
data : {
|
||||||
ajaxMode : '1',
|
ajaxMode : '1',
|
||||||
@@ -134,7 +133,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{$link->getAdminLink('AdminAccess')}",
|
url: "{$link->getAdminLink('AdminAccess')|addslashes}",
|
||||||
cache: false,
|
cache: false,
|
||||||
data : {
|
data : {
|
||||||
ajaxMode: '1',
|
ajaxMode: '1',
|
||||||
|
|||||||
@@ -50,6 +50,21 @@
|
|||||||
{$smarty.block.parent}
|
{$smarty.block.parent}
|
||||||
{/if}
|
{/if}
|
||||||
{/block}
|
{/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}
|
||||||
|
|
||||||
{block name=script}
|
{block name=script}
|
||||||
|
|
||||||
@@ -86,6 +101,10 @@
|
|||||||
disableZipFormat();
|
disableZipFormat();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#iso_code').change(function() {
|
||||||
|
disableTAASC();
|
||||||
|
});
|
||||||
|
disableTAASC();
|
||||||
});
|
});
|
||||||
|
|
||||||
function switchExplanationText(text) {
|
function switchExplanationText(text) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
ifSuperAdmin($(this));
|
ifSuperAdmin($(this));
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{$link->getAdminLink('AdminEmployees')}",
|
url: "{$link->getAdminLink('AdminEmployees')|addslashes}",
|
||||||
cache: false,
|
cache: false,
|
||||||
data : {
|
data : {
|
||||||
ajax : '1',
|
ajax : '1',
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: '{$link->getAdminLink('AdminInformation')}',
|
url: '{$link->getAdminLink('AdminInformation')|addslashes}',
|
||||||
data: {
|
data: {
|
||||||
'action': 'checkFiles',
|
'action': 'checkFiles',
|
||||||
'ajax': 1
|
'ajax': 1
|
||||||
|
|||||||
@@ -22,7 +22,9 @@
|
|||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* 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>
|
<h1>{l s='The controller %s is missing or invalid.' sprintf=$controller}</h1>
|
||||||
|
{/if}
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="index.php">{l s='Go to the dashboard.'}</a></li>
|
<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>
|
<li><a href="#" onclick="window.history.back();">{l s='Back to the previous page.'}</a></li>
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<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}
|
{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'}">
|
<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;">
|
<span class="shipping_number_edit" style="display:none;">
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
var changed_shipping_price = false;
|
var changed_shipping_price = false;
|
||||||
var shipping_price_selected_carrier = '';
|
var shipping_price_selected_carrier = '';
|
||||||
var current_index = '{$current}&token={$token}';
|
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 cart_quantity = new Array();
|
||||||
var currencies = new Array();
|
var currencies = new Array();
|
||||||
var id_currency = '';
|
var id_currency = '';
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
$('#show_old_carts').click();
|
$('#show_old_carts').click();
|
||||||
$('#payment_module_name').change();
|
$('#payment_module_name').change();
|
||||||
$.ajaxSetup({ type:"post" });
|
$.ajaxSetup({ type:"post" });
|
||||||
$("#voucher").autocomplete('{$link->getAdminLink('AdminCartRules')}', {
|
$("#voucher").autocomplete('{$link->getAdminLink('AdminCartRules')|escape:'html'}', {
|
||||||
minChars: 3,
|
minChars: 3,
|
||||||
max: 15,
|
max: 15,
|
||||||
width: 250,
|
width: 250,
|
||||||
@@ -157,7 +157,7 @@
|
|||||||
free_shipping = 1;
|
free_shipping = 1;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -217,7 +217,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -254,7 +254,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -288,7 +288,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -324,7 +324,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -351,7 +351,7 @@
|
|||||||
$('#id_cart').val(id_cart);
|
$('#id_cart').val(id_cart);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: false,
|
async: false,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -378,7 +378,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -401,7 +401,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -426,7 +426,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url : "{$link->getAdminLink('AdminOrders')}",
|
url : "{$link->getAdminLink('AdminOrders')|escape:'html'}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -468,7 +468,7 @@
|
|||||||
$('#new_address').attr('href', address_link.replace(/id_customer=[0-9]+/, 'id_customer='+id_customer));
|
$('#new_address').attr('href', address_link.replace(/id_customer=[0-9]+/, 'id_customer='+id_customer));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url : "{$link->getAdminLink('AdminCarts')}",
|
url : "{$link->getAdminLink('AdminCarts')|escape:'html'}",
|
||||||
async: false,
|
async: false,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -534,7 +534,7 @@
|
|||||||
$('#products_part').show();
|
$('#products_part').show();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminOrders')}",
|
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -766,7 +766,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -822,7 +822,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -845,7 +845,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -868,7 +868,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -899,7 +899,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminOrders')}",
|
url: "{$link->getAdminLink('AdminOrders')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
@@ -957,7 +957,7 @@
|
|||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url: "{$link->getAdminLink('AdminCarts')}",
|
url: "{$link->getAdminLink('AdminCarts')|addslashes}",
|
||||||
async: true,
|
async: true,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data : {
|
data : {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
{block name="override_tpl"}
|
{block name="override_tpl"}
|
||||||
<script type="text/javascript">
|
<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_order = {$order->id};
|
||||||
var id_lang = {$current_id_lang};
|
var id_lang = {$current_id_lang};
|
||||||
var id_currency = {$order->id_currency};
|
var id_currency = {$order->id_currency};
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
{assign var="hook_invoice" value={hook h="displayInvoice" id_order=$order->id}}
|
{assign var="hook_invoice" value={hook h="displayInvoice" id_order=$order->id}}
|
||||||
{if ($hook_invoice)}
|
{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}
|
{/if}
|
||||||
|
|
||||||
<div class="bloc-command">
|
<div class="bloc-command">
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
$('document').ready( function() {
|
$('document').ready( function() {
|
||||||
$(".check_product_name")
|
$(".check_product_name")
|
||||||
.autocomplete(
|
.autocomplete(
|
||||||
'{$link->getAdminLink('AdminProducts', true)}', {
|
'{$link->getAdminLink('AdminProducts', true)|escape:'html'}', {
|
||||||
minChars: 3,
|
minChars: 3,
|
||||||
max: 10,
|
max: 10,
|
||||||
width: $(".check_product_name").width(),
|
width: $(".check_product_name").width(),
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var Customer = new Object();
|
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});
|
var ecotax_tax_excl = parseFloat({$ecotax_tax_excl});
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
Customer = {
|
Customer = {
|
||||||
@@ -56,7 +56,7 @@ $(document).ready(function () {
|
|||||||
Customer.showLoader();
|
Customer.showLoader();
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
"type": "POST",
|
"type": "POST",
|
||||||
"url": "{$link->getAdminLink('AdminCustomers')}",
|
"url": "{$link->getAdminLink('AdminCustomers')|addslashes}",
|
||||||
"async": true,
|
"async": true,
|
||||||
"dataType": "json",
|
"dataType": "json",
|
||||||
"data": {
|
"data": {
|
||||||
|
|||||||
@@ -159,7 +159,10 @@
|
|||||||
<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="{$up_filename}" />
|
<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="{$up_filename}" />
|
||||||
{/if}
|
{/if}
|
||||||
<div class="conf">
|
<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'}"/>
|
<img src="../img/admin/delete.gif" alt="{l s='Delete this file'}"/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -173,7 +176,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="col-right">
|
<td class="col-right">
|
||||||
{$product->productDownload->getHtmlLink(false, true)}
|
{$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'}"/>
|
<img src="../img/admin/delete.gif" alt="{l s='Delete this file'}"/>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ $("#multishop-tree").jstree({
|
|||||||
'plugins': ["themes","json_data","cookies","contextmenu"],
|
'plugins': ["themes","json_data","cookies","contextmenu"],
|
||||||
'json_data': {
|
'json_data': {
|
||||||
'ajax': {
|
'ajax': {
|
||||||
'url': "{$link->getAdminLink('AdminShop')}",
|
'url': "{$link->getAdminLink('AdminShop')|addslashes}",
|
||||||
'data': function(n)
|
'data': function(n)
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
|
|||||||
+6
-1
@@ -222,7 +222,7 @@ class AddressCore extends ObjectModel
|
|||||||
public function validateController($htmlentities = true)
|
public function validateController($htmlentities = true)
|
||||||
{
|
{
|
||||||
$errors = parent::validateController($htmlentities);
|
$errors = parent::validateController($htmlentities);
|
||||||
if (!Configuration::get('VATNUMBER_CHECKING'))
|
if (!Configuration::get('VATNUMBER_MANAGEMENT') || !Configuration::get('VATNUMBER_CHECKING'))
|
||||||
return $errors;
|
return $errors;
|
||||||
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
|
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
|
||||||
if (class_exists('VatNumber', false))
|
if (class_exists('VatNumber', false))
|
||||||
@@ -237,6 +237,8 @@ class AddressCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getZoneById($id_address)
|
public static function getZoneById($id_address)
|
||||||
{
|
{
|
||||||
|
if(!isset($id_address) || empty($id_address))
|
||||||
|
return false;
|
||||||
if (isset(self::$_idZones[$id_address]))
|
if (isset(self::$_idZones[$id_address]))
|
||||||
return self::$_idZones[$id_address];
|
return self::$_idZones[$id_address];
|
||||||
|
|
||||||
@@ -259,6 +261,9 @@ class AddressCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function isCountryActiveById($id_address)
|
public static function isCountryActiveById($id_address)
|
||||||
{
|
{
|
||||||
|
if(!isset($id_address) || empty($id_address))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||||
SELECT c.`active`
|
SELECT c.`active`
|
||||||
FROM `'._DB_PREFIX_.'address` a
|
FROM `'._DB_PREFIX_.'address` a
|
||||||
|
|||||||
@@ -1676,9 +1676,9 @@ abstract class AdminTabCore
|
|||||||
elseif (isset($params['float']))
|
elseif (isset($params['float']))
|
||||||
echo rtrim(rtrim($tr[$key], '0'), '.');
|
echo rtrim(rtrim($tr[$key], '0'), '.');
|
||||||
elseif (isset($params['type']) && $params['type'] == 'date')
|
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')
|
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]))
|
elseif (isset($tr[$key]))
|
||||||
{
|
{
|
||||||
if ($key == 'price')
|
if ($key == 'price')
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class AttributeCore extends ObjectModel
|
|||||||
|
|
||||||
public function delete()
|
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);
|
$result = Db::getInstance()->executeS('SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute_combination WHERE id_attribute = '.(int)$this->id);
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
|
|
||||||
public function add($autodate = true, $nullValues = false)
|
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)
|
if ($this->position <= 0)
|
||||||
$this->position = AttributeGroup::getHigherPosition() + 1;
|
$this->position = AttributeGroup::getHigherPosition() + 1;
|
||||||
|
|
||||||
@@ -80,6 +85,11 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
|
|
||||||
public function update($nullValues = false)
|
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);
|
$return = parent::update($nullValues);
|
||||||
Hook::exec('actionAttributeGroupSave', array('id_attribute_group' => $this->id));
|
Hook::exec('actionAttributeGroupSave', array('id_attribute_group' => $this->id));
|
||||||
return $return;
|
return $return;
|
||||||
@@ -109,7 +119,7 @@ class AttributeGroupCore extends ObjectModel
|
|||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
if (!$this->hasMultishopEntries())
|
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
|
||||||
{
|
{
|
||||||
/* Select children in order to find linked combinations */
|
/* Select children in order to find linked combinations */
|
||||||
$attribute_ids = Db::getInstance()->executeS('
|
$attribute_ids = Db::getInstance()->executeS('
|
||||||
|
|||||||
+3
-1
@@ -467,7 +467,9 @@ class CarrierCore extends ObjectModel
|
|||||||
ORDER BY s.`name` ASC');
|
ORDER BY s.`name` ASC');
|
||||||
|
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$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.')
|
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 '.
|
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) ' : ') ').'
|
($active_carriers ? 'AND cr.active = 1) ' : ') ').'
|
||||||
|
|||||||
+4
-8
@@ -631,8 +631,8 @@ class CartCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$row2 = Db::getInstance()->getRow('
|
$row2 = Db::getInstance()->getRow('
|
||||||
SELECT image_shop.`id_image` id_image, il.`legend`
|
SELECT image_shop.`id_image` id_image, il.`legend`
|
||||||
FROM `'._DB_PREFIX_.'image` i'.
|
FROM `'._DB_PREFIX_.'image` i
|
||||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
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.')
|
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'
|
WHERE i.`id_product` = '.(int)$row['id_product'].' AND image_shop.`cover` = 1'
|
||||||
);
|
);
|
||||||
@@ -2958,12 +2958,8 @@ class CartCore extends ObjectModel
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach ($this->getProducts() as $product)
|
foreach ($this->getProducts() as $product)
|
||||||
|
if (!$product['active'] || !$product['available_for_order']
|
||||||
if (!$product['active']
|
|| (!$product['allow_oosp'] && $product['stock_quantity'] < $product['cart_quantity']))
|
||||||
|| (
|
|
||||||
!$product['allow_oosp'] && $product['stock_quantity'] < $product['cart_quantity']
|
|
||||||
)
|
|
||||||
|| !$product['available_for_order'])
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+16
-8
@@ -333,11 +333,8 @@ class CartRuleCore extends ObjectModel
|
|||||||
return array();
|
return array();
|
||||||
|
|
||||||
$productRuleGroups = array();
|
$productRuleGroups = array();
|
||||||
$results = Db::getInstance()->executeS('
|
$result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'cart_rule_product_rule_group WHERE id_cart_rule = '.(int)$this->id);
|
||||||
SELECT *
|
foreach ($result as $row)
|
||||||
FROM '._DB_PREFIX_.'cart_rule_product_rule_group prg
|
|
||||||
WHERE prg.id_cart_rule = '.(int)$this->id, false);
|
|
||||||
foreach ($results as $row)
|
|
||||||
{
|
{
|
||||||
if (!isset($productRuleGroups[$row['id_product_rule_group']]))
|
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']);
|
$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');
|
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
|
/* This loop checks:
|
||||||
// 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
|
- 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();
|
$otherCartRules = $context->cart->getCartRules();
|
||||||
if (count($otherCartRules))
|
if (count($otherCartRules))
|
||||||
foreach ($otherCartRules as $otherCartRule)
|
foreach ($otherCartRules as $otherCartRule)
|
||||||
{
|
{
|
||||||
if ($otherCartRule['id_cart_rule'] == $this->id && !$alreadyInCart)
|
if ($otherCartRule['id_cart_rule'] == $this->id && !$alreadyInCart)
|
||||||
return (!$display_error) ? false : Tools::displayError('This voucher is already in your cart');
|
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)
|
if ($this->cart_rule_restriction && $otherCartRule['cart_rule_restriction'] && $otherCartRule['id_cart_rule'] != $this->id)
|
||||||
{
|
{
|
||||||
$combinable = Db::getInstance()->getValue('
|
$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)
|
if (!$display_error)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -630,7 +637,8 @@ class CartRuleCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'cart_product` cp
|
FROM `'._DB_PREFIX_.'cart_product` cp
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_product` catp ON cp.id_product = catp.id_product
|
LEFT JOIN `'._DB_PREFIX_.'category_product` catp ON cp.id_product = catp.id_product
|
||||||
WHERE cp.`id_cart` = '.(int)$context->cart->id.'
|
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;
|
$countMatchingProducts = 0;
|
||||||
$matchingProductsList = array();
|
$matchingProductsList = array();
|
||||||
foreach ($cartCategories as $cartCategory)
|
foreach ($cartCategories as $cartCategory)
|
||||||
|
|||||||
@@ -510,7 +510,7 @@ class CategoryCore extends ObjectModel
|
|||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
$groups = FrontController::getCurrentCustomerGroups();
|
$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('
|
$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
|
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
|
else
|
||||||
return new Category($shop->getCategory(), $id_lang);
|
return new Category($shop->getCategory(), $id_lang);
|
||||||
$is_more_than_one_root_category = count(Category::getCategoriesWithoutParent()) > 1;
|
$is_more_than_one_root_category = count(Category::getCategoriesWithoutParent()) > 1;
|
||||||
if ((!Shop::isFeatureActive() && $is_more_than_one_root_category) ||
|
if (Shop::isFeatureActive() && $is_more_than_one_root_category && Shop::getContext() != Shop::CONTEXT_SHOP)
|
||||||
Shop::isFeatureActive() && $is_more_than_one_root_category && Shop::getContext() != Shop::CONTEXT_SHOP)
|
|
||||||
$category = Category::getTopCategory($id_lang);
|
$category = Category::getTopCategory($id_lang);
|
||||||
else
|
else
|
||||||
$category = new Category($shop->getCategory(), $id_lang);
|
$category = new Category($shop->getCategory(), $id_lang);
|
||||||
|
|||||||
@@ -61,32 +61,37 @@ class ConnectionsSourceCore extends ObjectModel
|
|||||||
$cookie = Context::getContext()->cookie;
|
$cookie = Context::getContext()->cookie;
|
||||||
if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections))
|
if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections))
|
||||||
return false;
|
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'))
|
if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$source = new ConnectionsSource();
|
$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 = parse_url($_SERVER['HTTP_REFERER']);
|
||||||
$parsed_host = parse_url(Tools::getProtocol().Tools::getHttpHost(false, false).__PS_BASE_URI__);
|
$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)))
|
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__)))
|
||||||
&& !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__)))
|
|
||||||
return false;
|
return false;
|
||||||
if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER'])))
|
|
||||||
{
|
$source->http_referer = substr($_SERVER['HTTP_REFERER'], 0, ConnectionsSource::$uri_max_size);
|
||||||
$source->http_referer = substr(strval($_SERVER['HTTP_REFERER']), 0, ConnectionsSource::$uri_max_size);
|
$source->keywords = substr(trim(SearchEngine::getKeywords($_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->id_connections = (int)$cookie->id_connections;
|
$source->id_connections = (int)$cookie->id_connections;
|
||||||
$source->request_uri = Tools::getHttpHost(false, false);
|
$source->request_uri = Tools::getHttpHost(false, false);
|
||||||
if (isset($_SERVER['REDIRECT_URL']))
|
|
||||||
$source->request_uri .= strval($_SERVER['REDIRECT_URL']);
|
if (isset($_SERVER['REQUEST_URI']))
|
||||||
elseif (isset($_SERVER['REQUEST_URI']))
|
$source->request_uri .= $_SERVER['REQUEST_URI'];
|
||||||
$source->request_uri .= strval($_SERVER['REQUEST_URI']);
|
elseif (isset($_SERVER['REDIRECT_URL']))
|
||||||
|
$source->request_uri .= $_SERVER['REDIRECT_URL'];
|
||||||
|
|
||||||
if (!Validate::isUrl($source->request_uri))
|
if (!Validate::isUrl($source->request_uri))
|
||||||
$source->request_uri = '';
|
$source->request_uri = '';
|
||||||
$source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
|
$source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
|
||||||
|
|||||||
+17
-17
@@ -44,40 +44,40 @@ class CookieCore
|
|||||||
/** @var array cipher tool instance */
|
/** @var array cipher tool instance */
|
||||||
protected $_cipherTool;
|
protected $_cipherTool;
|
||||||
|
|
||||||
/** @var array cipher tool initialization key */
|
|
||||||
protected $_key;
|
|
||||||
|
|
||||||
/** @var array cipher tool initilization vector */
|
|
||||||
protected $_iv;
|
|
||||||
|
|
||||||
protected $_modified = false;
|
protected $_modified = false;
|
||||||
|
|
||||||
protected $_allow_writing;
|
protected $_allow_writing;
|
||||||
|
|
||||||
|
protected $_salt;
|
||||||
|
|
||||||
|
protected $_standalone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get data if the cookie exists and else initialize an new one
|
* Get data if the cookie exists and else initialize an new one
|
||||||
*
|
*
|
||||||
* @param $name Cookie name before encrypting
|
* @param $name Cookie name before encrypting
|
||||||
* @param $path
|
* @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->_content = array();
|
||||||
|
$this->_standalone = $standalone;
|
||||||
$this->_expire = is_null($expire) ? time() + 1728000 : (int)$expire;
|
$this->_expire = is_null($expire) ? time() + 1728000 : (int)$expire;
|
||||||
$this->_name = md5(_PS_VERSION_.$name);
|
$this->_name = md5(($this->_standalone ? '' : _PS_VERSION_).$name);
|
||||||
$this->_path = trim(Context::getContext()->shop->physical_uri.$path, '/\\').'/';
|
$this->_path = trim(($this->_standalone ? '' : Context::getContext()->shop->physical_uri).$path, '/\\').'/';
|
||||||
if ($this->_path{0} != '/') $this->_path = '/'.$this->_path;
|
if ($this->_path{0} != '/') $this->_path = '/'.$this->_path;
|
||||||
$this->_path = rawurlencode($this->_path);
|
$this->_path = rawurlencode($this->_path);
|
||||||
$this->_path = str_replace('%2F', '/', $this->_path);
|
$this->_path = str_replace('%2F', '/', $this->_path);
|
||||||
$this->_path = str_replace('%7E', '~', $this->_path);
|
$this->_path = str_replace('%7E', '~', $this->_path);
|
||||||
$this->_key = _COOKIE_KEY_;
|
|
||||||
$this->_iv = _COOKIE_IV_;
|
|
||||||
$this->_domain = $this->getDomain($shared_urls);
|
$this->_domain = $this->getDomain($shared_urls);
|
||||||
$this->_allow_writing = true;
|
$this->_allow_writing = true;
|
||||||
if (Configuration::get('PS_CIPHER_ALGORITHM'))
|
$this->_salt = $this->_standalone ? str_pad('', 8, md5('ps'.__FILE__)) : _COOKIE_IV_;
|
||||||
$this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_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
|
else
|
||||||
$this->_cipherTool = new Blowfish($this->_key, $this->_iv);
|
$this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
|
||||||
$this->update();
|
$this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ class CookieCore
|
|||||||
//printf("\$content = %s<br />", $content);
|
//printf("\$content = %s<br />", $content);
|
||||||
|
|
||||||
/* Get cookie checksum */
|
/* 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);
|
//printf("\$checksum = %s<br />", $checksum);
|
||||||
|
|
||||||
/* Unserialize cookie content */
|
/* Unserialize cookie content */
|
||||||
@@ -297,7 +297,7 @@ class CookieCore
|
|||||||
$this->_content['date_add'] = date('Y-m-d H:i:s');
|
$this->_content['date_add'] = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
//checks if the language exists, if not choose the default language
|
//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');
|
$this->id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -344,7 +344,7 @@ class CookieCore
|
|||||||
$cookie .= $key.'|'.$value.'¤';
|
$cookie .= $key.'|'.$value.'¤';
|
||||||
|
|
||||||
/* Add checksum to cookie */
|
/* Add checksum to cookie */
|
||||||
$cookie .= 'checksum|'.crc32($this->_iv.$cookie);
|
$cookie .= 'checksum|'.crc32($this->_salt.$cookie);
|
||||||
$this->_modified = false;
|
$this->_modified = false;
|
||||||
/* Cookies are encrypted for evident security reasons */
|
/* Cookies are encrypted for evident security reasons */
|
||||||
return $this->_setcookie($cookie);
|
return $this->_setcookie($cookie);
|
||||||
|
|||||||
@@ -105,5 +105,10 @@ class CustomerMessageCore extends ObjectModel
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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))
|
if (!Validate::isUnsignedId($this->id))
|
||||||
return false;
|
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
|
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)
|
public static function getCustomerMessages($id_customer, $read = null)
|
||||||
@@ -205,4 +221,3 @@ class CustomerThreadCore extends ObjectModel
|
|||||||
');
|
');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -648,6 +648,8 @@ class DispatcherCore
|
|||||||
*/
|
*/
|
||||||
public function getController()
|
public function getController()
|
||||||
{
|
{
|
||||||
|
if (defined('_PS_ADMIN_DIR_'))
|
||||||
|
$_GET['controllerUri'] = Tools::getvalue('controller');
|
||||||
if ($this->controller)
|
if ($this->controller)
|
||||||
{
|
{
|
||||||
$_GET['controller'] = $this->controller;
|
$_GET['controller'] = $this->controller;
|
||||||
@@ -669,7 +671,7 @@ class DispatcherCore
|
|||||||
$controller = false;
|
$controller = false;
|
||||||
|
|
||||||
// Use routes ? (for url rewriting)
|
// Use routes ? (for url rewriting)
|
||||||
if ($this->use_routes && !$controller)
|
if ($this->use_routes && !$controller && !defined('_PS_ADMIN_DIR_'))
|
||||||
{
|
{
|
||||||
if (!$this->request_uri)
|
if (!$this->request_uri)
|
||||||
return strtolower($this->controller_not_found);
|
return strtolower($this->controller_not_found);
|
||||||
@@ -709,6 +711,7 @@ class DispatcherCore
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($controller == 'index' || $this->request_uri == '/index.php')
|
if ($controller == 'index' || $this->request_uri == '/index.php')
|
||||||
$controller = $this->default_controller;
|
$controller = $this->default_controller;
|
||||||
$this->controller = $controller;
|
$this->controller = $controller;
|
||||||
|
|||||||
+1
-1
@@ -81,7 +81,7 @@ class FeatureCore extends ObjectModel
|
|||||||
public static function getFeatures($id_lang, $with_shop = true)
|
public static function getFeatures($id_lang, $with_shop = true)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->executeS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT DISTINCT f.id_feature, f.*, fl.*
|
||||||
FROM `'._DB_PREFIX_.'feature` f
|
FROM `'._DB_PREFIX_.'feature` f
|
||||||
'.($with_shop ? Shop::addSqlAssociation('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.')
|
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()
|
public function delete()
|
||||||
{
|
{
|
||||||
if (!$this->hasMultishopEntries())
|
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
|
||||||
{
|
{
|
||||||
if (empty($this->iso_code))
|
if (empty($this->iso_code))
|
||||||
$this->iso_code = Language::getIsoById($this->id);
|
$this->iso_code = Language::getIsoById($this->id);
|
||||||
@@ -514,7 +514,7 @@ class LanguageCore extends ObjectModel
|
|||||||
|
|
||||||
if (!parent::delete())
|
if (!parent::delete())
|
||||||
return false;
|
return false;
|
||||||
if (!$this->hasMultishopEntries())
|
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
|
||||||
{
|
{
|
||||||
// delete images
|
// delete images
|
||||||
$files_copy = array(
|
$files_copy = array(
|
||||||
@@ -580,7 +580,7 @@ class LanguageCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getLanguage($id_lang)
|
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 false;
|
||||||
return self::$_LANGUAGES[(int)($id_lang)];
|
return self::$_LANGUAGES[(int)($id_lang)];
|
||||||
}
|
}
|
||||||
@@ -788,11 +788,11 @@ class LanguageCore extends ObjectModel
|
|||||||
$lang_pack_ok = false;
|
$lang_pack_ok = false;
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip';
|
$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.');
|
$errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
||||||
elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link))
|
elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link))
|
||||||
$errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
|
$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))
|
if (!@file_put_contents($file, $content))
|
||||||
$errors[] = Tools::displayError('Server does not have permissions for writing.');
|
$errors[] = Tools::displayError('Server does not have permissions for writing.');
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
|
|||||||
@@ -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 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)
|
if (Language::getIdByIso($attributes['iso_code']) && !$install_mode)
|
||||||
continue;
|
continue;
|
||||||
$errors = Language::downloadAndInstallLanguagePack($attributes['iso_code'], $attributes['version']);
|
$errors = Language::downloadAndInstallLanguagePack($attributes['iso_code'], $attributes['version'], $attributes);
|
||||||
if ($errors !== true && is_array($errors))
|
if ($errors !== true && is_array($errors))
|
||||||
$this->_errors = array_merge($this->_errors, $errors);
|
$this->_errors = array_merge($this->_errors, $errors);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ class MailCore
|
|||||||
'PS_SHOP_NAME',
|
'PS_SHOP_NAME',
|
||||||
'PS_MAIL_SMTP_ENCRYPTION',
|
'PS_MAIL_SMTP_ENCRYPTION',
|
||||||
'PS_MAIL_SMTP_PORT',
|
'PS_MAIL_SMTP_PORT',
|
||||||
'PS_MAIL_METHOD',
|
|
||||||
'PS_MAIL_TYPE'
|
'PS_MAIL_TYPE'
|
||||||
), null, null, $id_shop);
|
), null, null, $id_shop);
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ class ManufacturerCore extends ObjectModel
|
|||||||
|
|
||||||
for ($i = 0; $i < $total_manufacturers; $i++)
|
for ($i = 0; $i < $total_manufacturers; $i++)
|
||||||
if ($rewrite_settings)
|
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
|
else
|
||||||
$manufacturers[$i]['link_rewrite'] = 0;
|
$manufacturers[$i]['link_rewrite'] = 0;
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ class ManufacturerCore extends ObjectModel
|
|||||||
|
|
||||||
public function getLink()
|
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,
|
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').'
|
'.Shop::addSqlAssociation('product', 'p').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
|
||||||
ON (p.`id_product` = pa.`id_product`)
|
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
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||||
ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i
|
LEFT JOIN `'._DB_PREFIX_.'image` i
|
||||||
|
|||||||
+1
-1
@@ -168,7 +168,7 @@ class MetaCore extends ObjectModel
|
|||||||
$result = $result && $this->delete();
|
$result = $result && $this->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Tools::generateHtaccess();
|
return $result && Tools::generateHtaccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getEquivalentUrlRewrite($new_id_lang, $id_lang, $url_rewrite)
|
public static function getEquivalentUrlRewrite($new_id_lang, $id_lang, $url_rewrite)
|
||||||
|
|||||||
@@ -1278,6 +1278,11 @@ abstract class ObjectModelCore
|
|||||||
return Shop::isTableAssociated($this->def['table']) || !empty($this->def['multilang_shop']);
|
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()
|
public function isLangMultishop()
|
||||||
{
|
{
|
||||||
return !empty($this->def['multilang']) && !empty($this->def['multilang_shop']);
|
return !empty($this->def['multilang']) && !empty($this->def['multilang_shop']);
|
||||||
|
|||||||
@@ -595,7 +595,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
'{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile,
|
'{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile,
|
||||||
'{invoice_other}' => $invoice->other,
|
'{invoice_other}' => $invoice->other,
|
||||||
'{order_name}' => $order->getUniqReference(),
|
'{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,
|
'{carrier}' => $virtual_product ? Tools::displayError('No carrier') : $carrier->name,
|
||||||
'{payment}' => Tools::substr($order->payment, 0, 32),
|
'{payment}' => Tools::substr($order->payment, 0, 32),
|
||||||
'{products}' => $this->formatProductAndVoucherForEmail($products_list),
|
'{products}' => $this->formatProductAndVoucherForEmail($products_list),
|
||||||
|
|||||||
+75
-8
@@ -394,6 +394,7 @@ class ProductCore extends ObjectModel
|
|||||||
'resource' => 'product_feature',
|
'resource' => 'product_feature',
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'id' => array('required' => true),
|
'id' => array('required' => true),
|
||||||
|
'custom' => array('required' => false),
|
||||||
'id_feature_value' => array(
|
'id_feature_value' => array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'xlink_resource' => 'product_feature_values'
|
'xlink_resource' => 'product_feature_values'
|
||||||
@@ -1448,6 +1449,7 @@ class ProductCore extends ObjectModel
|
|||||||
$id_shop_list_array = Product::getShopsByProduct($this->id);
|
$id_shop_list_array = Product::getShopsByProduct($this->id);
|
||||||
foreach ($id_shop_list_array as $array_shop)
|
foreach ($id_shop_list_array as $array_shop)
|
||||||
$id_shop_list[] = $array_shop['id_shop'];
|
$id_shop_list[] = $array_shop['id_shop'];
|
||||||
|
$id_shop_list = array_unique($id_shop_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($id_shop_list))
|
if (count($id_shop_list))
|
||||||
@@ -3213,8 +3215,9 @@ class ProductCore extends ObjectModel
|
|||||||
return array();
|
return array();
|
||||||
if (!array_key_exists($id_product, self::$_cacheFeatures))
|
if (!array_key_exists($id_product, self::$_cacheFeatures))
|
||||||
self::$_cacheFeatures[$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
self::$_cacheFeatures[$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT id_feature, id_product, id_feature_value
|
SELECT fp.id_feature, fp.id_product, fp.id_feature_value, custom
|
||||||
FROM `'._DB_PREFIX_.'feature_product`
|
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
|
WHERE `id_product` = '.(int)$id_product
|
||||||
);
|
);
|
||||||
return self::$_cacheFeatures[$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_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_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)
|
LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature)
|
||||||
|
'.Shop::addSqlAssociation('feature', 'f').'
|
||||||
WHERE `id_product` IN ('.implode($product_implode, ',').')
|
WHERE `id_product` IN ('.implode($product_implode, ',').')
|
||||||
ORDER BY f.position ASC');
|
ORDER BY f.position ASC');
|
||||||
|
|
||||||
@@ -3346,34 +3350,58 @@ class ProductCore extends ObjectModel
|
|||||||
WHERE pa.`id_product` = '.(int)$id_product_old
|
WHERE pa.`id_product` = '.(int)$id_product_old
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$combinations = array();
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
{
|
{
|
||||||
$id_product_attribute_old = (int)$row['id_product_attribute'];
|
$id_product_attribute_old = (int)$row['id_product_attribute'];
|
||||||
|
if (!isset($combinations[$id_product_attribute_old]))
|
||||||
|
{
|
||||||
|
$id_combination = null;
|
||||||
|
$id_shop = null;
|
||||||
$result2 = Db::getInstance()->executeS('
|
$result2 = Db::getInstance()->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'product_attribute_combination`
|
FROM `'._DB_PREFIX_.'product_attribute_combination`
|
||||||
WHERE `id_product_attribute` = '.$id_product_attribute_old
|
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;
|
$row['id_product'] = $id_product_new;
|
||||||
unset($row['id_product_attribute']);
|
unset($row['id_product_attribute']);
|
||||||
$combination = new Combination();
|
|
||||||
|
$combination = new Combination($id_combination, null, $id_shop);
|
||||||
foreach ($row as $k => $v)
|
foreach ($row as $k => $v)
|
||||||
$combination->$k = $v;
|
$combination->$k = $v;
|
||||||
$return &= $combination->add();
|
$return &= $combination->save();
|
||||||
|
|
||||||
$id_product_attribute_new = (int)$combination->id;
|
$id_product_attribute_new = (int)$combination->id;
|
||||||
|
|
||||||
if ($result_images = Product::_getAttributeImageAssociations($id_product_attribute_old))
|
if ($result_images = Product::_getAttributeImageAssociations($id_product_attribute_old))
|
||||||
{
|
{
|
||||||
$combination_images['old'][$id_product_attribute_old] = $result_images;
|
$combination_images['old'][$id_product_attribute_old] = $result_images;
|
||||||
$combination_images['new'][$id_product_attribute_new] = $result_images;
|
$combination_images['new'][$id_product_attribute_new] = $result_images;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($combinations[$id_product_attribute_old]))
|
||||||
|
{
|
||||||
|
$combinations[$id_product_attribute_old] = (int)$id_product_attribute_new;
|
||||||
foreach ($result2 as $row2)
|
foreach ($result2 as $row2)
|
||||||
{
|
{
|
||||||
$row2['id_product_attribute'] = $id_product_attribute_new;
|
$row2['id_product_attribute'] = $id_product_attribute_new;
|
||||||
$return &= Db::getInstance()->insert('product_attribute_combination', $row2);
|
$return &= Db::getInstance()->insert('product_attribute_combination', $row2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
Shop::setContext($context_old, $context_shop_id_old);
|
||||||
|
}
|
||||||
return !$return ? false : $combination_images;
|
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_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_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.')
|
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.'
|
WHERE pf.id_product = '.(int)$id_product.'
|
||||||
ORDER BY f.position ASC'
|
ORDER BY f.position ASC'
|
||||||
);
|
);
|
||||||
@@ -4400,12 +4429,51 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function setWsProductFeatures($product_features)
|
public function setWsProductFeatures($product_features)
|
||||||
{
|
{
|
||||||
$this->deleteProductFeatures();
|
|
||||||
|
$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)
|
foreach ($product_features as $product_feature)
|
||||||
$this->addFeaturesToDB($product_feature['id'], $product_feature['id_feature_value']);
|
$pfa[$product_feature['id']] = 1;
|
||||||
return true;
|
|
||||||
|
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
|
* Webservice getter : get virtual field default combination
|
||||||
*
|
*
|
||||||
@@ -5276,4 +5344,3 @@ 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);
|
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]))
|
if (empty($array[0]))
|
||||||
return false;
|
return false;
|
||||||
$str = urldecode(str_replace('+', ' ', ltrim(substr(rtrim($array[0], '&'), strlen($varname) + 1), '=')));
|
$str = urldecode(str_replace('+', ' ', ltrim(substr(rtrim($array[0], '&'), strlen($varname) + 1), '=')));
|
||||||
|
if (!Validate::isMessage($str))
|
||||||
|
return false;
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class SupplierCore extends ObjectModel
|
|||||||
|
|
||||||
public function getLink()
|
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');
|
$rewrite_settings = (int)Configuration::get('PS_REWRITING_SETTINGS');
|
||||||
for ($i = 0; $i < $nb_suppliers; $i++)
|
for ($i = 0; $i < $nb_suppliers; $i++)
|
||||||
if ($rewrite_settings)
|
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
|
else
|
||||||
$suppliers[$i]['link_rewrite'] = 0;
|
$suppliers[$i]['link_rewrite'] = 0;
|
||||||
return $suppliers;
|
return $suppliers;
|
||||||
|
|||||||
@@ -140,7 +140,11 @@ class TabCore extends ObjectModel
|
|||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
if (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'access WHERE `id_tab` = '.(int)$this->id) && parent::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 $this->cleanPositions($this->id_parent);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+45
-11
@@ -267,6 +267,9 @@ class ToolsCore
|
|||||||
// $_SERVER['SSL'] exists only in some specific configuration
|
// $_SERVER['SSL'] exists only in some specific configuration
|
||||||
if (isset($_SERVER['SSL']))
|
if (isset($_SERVER['SSL']))
|
||||||
return ($_SERVER['SSL'] == 1 || strtolower($_SERVER['SSL']) == 'on');
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -598,20 +601,25 @@ class ToolsCore
|
|||||||
*/
|
*/
|
||||||
public static function dateFormat($params, &$smarty)
|
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
|
* Display date regarding to language preferences
|
||||||
*
|
*
|
||||||
* @param string $date Date to display format UNIX
|
* @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 boolean $full With time or not (optional)
|
||||||
* @param string $separator DEPRECATED
|
* @param string $separator DEPRECATED
|
||||||
* @return string Date
|
* @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)))
|
if (!$date || !($time = strtotime($date)))
|
||||||
return $date;
|
return $date;
|
||||||
|
|
||||||
@@ -958,11 +966,13 @@ class ToolsCore
|
|||||||
* Return the friendly url from the provided string
|
* Return the friendly url from the provided string
|
||||||
*
|
*
|
||||||
* @param string $str
|
* @param string $str
|
||||||
* @param bool $utf8_decode => needs to be marked as deprecated
|
* @param bool $utf8_decode (deprecated)
|
||||||
* @return string
|
* @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);
|
return Tools::str2url($str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1019,11 +1029,12 @@ class ToolsCore
|
|||||||
'/[\x{010F}]/u',
|
'/[\x{010F}]/u',
|
||||||
'/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}]/u',
|
'/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}]/u',
|
||||||
'/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u',
|
'/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u',
|
||||||
|
'/[\x{011F}]/u',
|
||||||
'/[\x{0142}\x{013E}\x{013A}]/u',
|
'/[\x{0142}\x{013E}\x{013A}]/u',
|
||||||
'/[\x{00F1}\x{0148}]/u',
|
'/[\x{00F1}\x{0148}]/u',
|
||||||
'/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}]/u',
|
'/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}]/u',
|
||||||
'/[\x{0159}\x{0155}]/u',
|
'/[\x{0159}\x{0155}]/u',
|
||||||
'/[\x{015B}\x{0161}]/u',
|
'/[\x{015B}\x{0161}\x{015F}]/u',
|
||||||
'/[\x{00DF}]/u',
|
'/[\x{00DF}]/u',
|
||||||
'/[\x{0165}]/u',
|
'/[\x{0165}]/u',
|
||||||
'/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/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{00C7}\x{010C}\x{0106}]/u',
|
||||||
'/[\x{010E}]/u',
|
'/[\x{010E}]/u',
|
||||||
'/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{011A}\x{0118}]/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{0141}\x{013D}\x{0139}]/u',
|
||||||
'/[\x{00D1}\x{0147}]/u',
|
'/[\x{00D1}\x{0147}]/u',
|
||||||
'/[\x{00D3}]/u',
|
'/[\x{00D3}]/u',
|
||||||
'/[\x{0158}\x{0154}]/u',
|
'/[\x{0158}\x{0154}]/u',
|
||||||
'/[\x{015A}\x{0160}]/u',
|
'/[\x{015A}\x{0160}\x{015E}]/u',
|
||||||
'/[\x{0164}]/u',
|
'/[\x{0164}]/u',
|
||||||
'/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{016E}]/u',
|
'/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{016E}]/u',
|
||||||
'/[\x{017B}\x{0179}\x{017D}]/u',
|
'/[\x{017B}\x{0179}\x{017D}]/u',
|
||||||
@@ -1049,8 +1061,8 @@ class ToolsCore
|
|||||||
'/[\x{0152}]/u');
|
'/[\x{0152}]/u');
|
||||||
|
|
||||||
$replacements = array(
|
$replacements = array(
|
||||||
'a', 'c', 'd', 'e', 'i', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', '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', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
|
'A', 'C', 'D', 'E', 'G', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
|
||||||
);
|
);
|
||||||
|
|
||||||
return preg_replace($patterns, $replacements, $str);
|
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)))
|
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 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)
|
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();
|
$backtrace = debug_backtrace();
|
||||||
$callee = next($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.';
|
$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;
|
$class = isset($callee['class']) ? $callee['class'] : null;
|
||||||
|
|
||||||
@@ -2196,6 +2208,28 @@ exit;
|
|||||||
return (PHP_INT_MAX == '9223372036854775807');
|
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
|
* Get max file upload size considering server settings and optional max value
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ class ValidateCore
|
|||||||
*/
|
*/
|
||||||
public static function isPrice($price)
|
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)
|
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)
|
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)
|
public static function isAbsoluteUrl($url)
|
||||||
{
|
{
|
||||||
if (!empty($url))
|
if (!empty($url))
|
||||||
return preg_match('/^https?:\/\/[,:#%&_=\(\)\.\? \+\-@\/a-zA-Z0-9]+$/', $url);
|
return preg_match('/^https?:\/\/[~:#,%&_=\(\)\[\]\.\? \+\-@\/a-zA-Z0-9]+$/', $url);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -513,6 +513,7 @@ class AdminControllerCore extends Controller
|
|||||||
*/
|
*/
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
if ($this->ajax)
|
if ($this->ajax)
|
||||||
{
|
{
|
||||||
// from ajax-tab.php
|
// from ajax-tab.php
|
||||||
@@ -544,6 +545,10 @@ class AdminControllerCore extends Controller
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (PrestaShopException $e) {
|
||||||
|
$this->errors[] = $e->getMessage();
|
||||||
|
};
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -583,16 +588,27 @@ class AdminControllerCore extends Controller
|
|||||||
$headers = array();
|
$headers = array();
|
||||||
foreach ($this->fields_list as $datas)
|
foreach ($this->fields_list as $datas)
|
||||||
$headers[] = Tools::htmlentitiesDecodeUTF8($datas['title']);
|
$headers[] = Tools::htmlentitiesDecodeUTF8($datas['title']);
|
||||||
|
|
||||||
$content = array();
|
$content = array();
|
||||||
foreach ($this->_list as $i => $row)
|
foreach ($this->_list as $i => $row)
|
||||||
{
|
{
|
||||||
$content[$i] = array();
|
$content[$i] = array();
|
||||||
foreach ($this->fields_list as $key => $value)
|
$path_to_image = false;
|
||||||
if (isset($row[$key]))
|
foreach ($this->fields_list as $key => $params)
|
||||||
$content[$i][] = Tools::htmlentitiesDecodeUTF8($row[$key]);
|
{
|
||||||
|
$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(
|
$this->context->smarty->assign(array(
|
||||||
'export_precontent' => "\xEF\xBB\xBF",
|
'export_precontent' => "\xEF\xBB\xBF",
|
||||||
'export_headers' => $headers,
|
'export_headers' => $headers,
|
||||||
@@ -1100,7 +1116,7 @@ class AdminControllerCore extends Controller
|
|||||||
}
|
}
|
||||||
else
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1161,6 +1177,7 @@ class AdminControllerCore extends Controller
|
|||||||
header('Location: '.$this->redirect_after);
|
header('Location: '.$this->redirect_after);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display()
|
public function display()
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign(array(
|
$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 current URL use SSL, set it true (used a lot for module redirect)
|
||||||
if (Tools::usingSecureMode())
|
if (Tools::usingSecureMode())
|
||||||
$useSSL = $this->ssl = true;
|
$useSSL = true;
|
||||||
|
|
||||||
// For compatibility with globals, DEPRECATED as of version 1.5
|
// For compatibility with globals, DEPRECATED as of version 1.5
|
||||||
$css_files = $this->css_files;
|
$css_files = $this->css_files;
|
||||||
|
|||||||
+16
-2
@@ -209,13 +209,27 @@ class DbPDOCore extends Db
|
|||||||
|
|
||||||
if (strtolower($engine) == 'innodb')
|
if (strtolower($engine) == 'innodb')
|
||||||
{
|
{
|
||||||
|
$value = 0;
|
||||||
|
|
||||||
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
|
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
|
||||||
$result = $link->query($sql);
|
$result = $link->query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
return 4;
|
$value = 4;
|
||||||
$row = $result->fetch();
|
$row = $result->fetch();
|
||||||
if (!$row || strtolower($row['Value']) != 'yes')
|
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);
|
unset($link);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+16
-2
@@ -168,13 +168,27 @@ class MySQLCore extends Db
|
|||||||
|
|
||||||
if (strtolower($engine) == 'innodb')
|
if (strtolower($engine) == 'innodb')
|
||||||
{
|
{
|
||||||
|
$value = 0;
|
||||||
|
|
||||||
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
|
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
|
||||||
$result = mysql_query($sql);
|
$result = mysql_query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
return 4;
|
$value = 4;
|
||||||
$row = mysql_fetch_assoc($result);
|
$row = mysql_fetch_assoc($result);
|
||||||
if (!$row || strtolower($row['Value']) != 'yes')
|
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);
|
@mysql_close($link);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -282,9 +282,9 @@ class HelperListCore extends Helper
|
|||||||
$this->_list[$index][$key] = Tools::displayPrice($tr[$key], $currency, false);
|
$this->_list[$index][$key] = Tools::displayPrice($tr[$key], $currency, false);
|
||||||
}
|
}
|
||||||
elseif (isset($params['type']) && $params['type'] == 'date')
|
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')
|
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]))
|
elseif (isset($tr[$key]))
|
||||||
{
|
{
|
||||||
$echo = $tr[$key];
|
$echo = $tr[$key];
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ abstract class ModuleCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if module is installed
|
// 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)
|
if ($result)
|
||||||
{
|
{
|
||||||
$this->_errors[] = $this->l('This module has already been installed.');
|
$this->_errors[] = $this->l('This module has already been installed.');
|
||||||
@@ -311,6 +311,12 @@ abstract class ModuleCore
|
|||||||
*/
|
*/
|
||||||
public static function initUpgradeModule($module)
|
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
|
// Init cache upgrade details
|
||||||
self::$modules_cache[$module->name]['upgrade'] = array(
|
self::$modules_cache[$module->name]['upgrade'] = array(
|
||||||
'success' => false, // bool to know if upgrade succeed or not
|
'success' => false, // bool to know if upgrade succeed or not
|
||||||
@@ -1543,7 +1549,7 @@ abstract class ModuleCore
|
|||||||
{
|
{
|
||||||
if (!Cache::isStored('Module::isInstalled'.$module_name))
|
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);
|
Cache::store('Module::isInstalled'.$module_name, (bool)$id_module);
|
||||||
}
|
}
|
||||||
return Cache::retrieve('Module::isInstalled'.$module_name);
|
return Cache::retrieve('Module::isInstalled'.$module_name);
|
||||||
@@ -1554,7 +1560,7 @@ abstract class ModuleCore
|
|||||||
if (!Cache::isStored('Module::isEnabled'.$module_name))
|
if (!Cache::isStored('Module::isEnabled'.$module_name))
|
||||||
{
|
{
|
||||||
$active = false;
|
$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))
|
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;
|
$active = true;
|
||||||
Cache::store('Module::isEnabled'.$module_name, (bool)$active);
|
Cache::store('Module::isEnabled'.$module_name, (bool)$active);
|
||||||
|
|||||||
@@ -240,6 +240,8 @@ class OrderCore extends ObjectModel
|
|||||||
'product_quantity' => array('required' => true),
|
'product_quantity' => array('required' => true),
|
||||||
'product_name' => array('setter' => false),
|
'product_name' => array('setter' => false),
|
||||||
'product_price' => 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()
|
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`
|
FROM `'._DB_PREFIX_.'order_detail`
|
||||||
WHERE id_order = '.(int)$this->id;
|
WHERE id_order = '.(int)$this->id;
|
||||||
$result = Db::getInstance()->executeS($query);
|
$result = Db::getInstance()->executeS($query);
|
||||||
@@ -1627,7 +1629,7 @@ class OrderCore extends ObjectModel
|
|||||||
return Db::getInstance()->getValue('
|
return Db::getInstance()->getValue('
|
||||||
SELECT SUM(total_paid_tax_incl)
|
SELECT SUM(total_paid_tax_incl)
|
||||||
FROM `'._DB_PREFIX_.'orders`
|
FROM `'._DB_PREFIX_.'orders`
|
||||||
WHERE `reference` = '.(int)$this->reference.'
|
WHERE `reference` = \''.pSQL($this->reference).'\'
|
||||||
AND `id_cart` = '.(int)$this->id_cart
|
AND `id_cart` = '.(int)$this->id_cart
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class OrderHistoryCore extends ObjectModel
|
|||||||
|
|
||||||
|
|
||||||
// executes hook
|
// 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));
|
Hook::exec('actionPaymentConfirmation', array('id_order' => (int)$order->id));
|
||||||
|
|
||||||
// executes hook
|
// executes hook
|
||||||
@@ -123,7 +123,7 @@ class OrderHistoryCore extends ObjectModel
|
|||||||
.'&secure_key='.$order->secure_key;
|
.'&secure_key='.$order->secure_key;
|
||||||
$assign[$key]['link'] = $dl_link;
|
$assign[$key]['link'] = $dl_link;
|
||||||
if (isset($virtual_product['date_expiration']) && $virtual_product['date_expiration'] != '0000-00-00 00:00:00')
|
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)
|
if ($product_download->nb_downloadable != 0)
|
||||||
$assign[$key]['downloadable'] = (int)$product_download->nb_downloadable;
|
$assign[$key]['downloadable'] = (int)$product_download->nb_downloadable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class HTMLTemplateDeliverySlipCore extends HTMLTemplate
|
|||||||
$this->smarty = $smarty;
|
$this->smarty = $smarty;
|
||||||
|
|
||||||
// header informations
|
// 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);
|
$this->title = HTMLTemplateDeliverySlip::l('Delivery').' #'.Configuration::get('PS_DELIVERY_PREFIX', Context::getContext()->language->id).sprintf('%06d', $this->order_invoice->delivery_number);
|
||||||
|
|
||||||
// footer informations
|
// footer informations
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
|||||||
$this->smarty = $smarty;
|
$this->smarty = $smarty;
|
||||||
|
|
||||||
// header informations
|
// 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;
|
$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);
|
$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);
|
$this->order = new Order($order_return->id_order);
|
||||||
|
|
||||||
// header informations
|
// 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);
|
$this->title = HTMLTemplateOrderReturn::l('Order Return ').sprintf('%06d', $this->order_return->id);
|
||||||
|
|
||||||
// footer informations
|
// footer informations
|
||||||
|
|||||||
@@ -211,6 +211,8 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
|
|||||||
if ($ecotax)
|
if ($ecotax)
|
||||||
foreach ($tmp_tax_infos as $rate => &$row)
|
foreach ($tmp_tax_infos as $rate => &$row)
|
||||||
{
|
{
|
||||||
|
if (!isset($ecotax[$rate]))
|
||||||
|
continue;
|
||||||
$row['total_price_tax_excl'] -= $ecotax[$rate]['ecotax_tax_excl'];
|
$row['total_price_tax_excl'] -= $ecotax[$rate]['ecotax_tax_excl'];
|
||||||
$row['total_amount'] -= ($ecotax[$rate]['ecotax_tax_incl'] - $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',
|
'uk' => 'freeserif',
|
||||||
'mk' => 'freeserif',
|
'mk' => 'freeserif',
|
||||||
'el' => 'freeserif',
|
'el' => 'freeserif',
|
||||||
|
'en' => 'dejavusans',
|
||||||
'vn' => 'dejavusans',
|
'vn' => 'dejavusans',
|
||||||
'pl' => 'dejavusans',
|
'pl' => 'dejavusans',
|
||||||
'ar' => '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
|
// 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->physical_uri = preg_replace('#/+#', '/', str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_NAME']))).'/');
|
||||||
$shop->virtual_uri = '';
|
$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
|
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').'
|
$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').')');
|
AND os.id_order_state != '.(int)Configuration::get('PS_OS_CANCELED').')');
|
||||||
$query->groupBy('od.id_order_detail');
|
$query->groupBy('od.id_order_detail');
|
||||||
//if (count($ids_warehouse))
|
if (count($ids_warehouse))
|
||||||
//$query->where('od.id_warehouse IN('.implode(', ', $ids_warehouse).')');
|
$query->where('od.id_warehouse IN('.implode(', ', $ids_warehouse).')');
|
||||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||||
$client_orders_qty = 0;
|
$client_orders_qty = 0;
|
||||||
if (count($res))
|
if (count($res))
|
||||||
foreach ($res as $row)
|
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
|
// Gets supply_orders_qty
|
||||||
$query = new DbQuery();
|
$query = new DbQuery();
|
||||||
|
|||||||
@@ -1184,7 +1184,14 @@ class WebserviceRequestCore
|
|||||||
$sql_sort .= 'main_i18n.`'.pSQL($this->resourceConfiguration['fields'][$fieldName]['sqlId']).'` '.$direction.', ';// ORDER BY main_i18n.`field` ASC|DESC
|
$sql_sort .= 'main_i18n.`'.pSQL($this->resourceConfiguration['fields'][$fieldName]['sqlId']).'` '.$direction.', ';// ORDER BY main_i18n.`field` ASC|DESC
|
||||||
}
|
}
|
||||||
else
|
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";
|
$sql_sort = rtrim($sql_sort, ', ')."\n";
|
||||||
}
|
}
|
||||||
@@ -1218,6 +1225,11 @@ class WebserviceRequestCore
|
|||||||
{
|
{
|
||||||
$objects = array();
|
$objects = array();
|
||||||
$filters = $this->manageFilters();
|
$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_join'];
|
||||||
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_filter'];
|
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_filter'];
|
||||||
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_sort'];
|
$this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_sort'];
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ if (_PS_DEBUG_PROFILING_)
|
|||||||
include_once(_PS_TOOL_DIR_.'profiling/Tools.php');
|
include_once(_PS_TOOL_DIR_.'profiling/Tools.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Tools::isPHPCLI())
|
||||||
|
Tools::argvToGET($argc, $argv);
|
||||||
|
|
||||||
/* Redefine REQUEST_URI if empty (on some webservers...) */
|
/* Redefine REQUEST_URI if empty (on some webservers...) */
|
||||||
if (!isset($_SERVER['REQUEST_URI']) || empty($_SERVER['REQUEST_URI']))
|
if (!isset($_SERVER['REQUEST_URI']) || empty($_SERVER['REQUEST_URI']))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ define('_PS_MODE_DEV_', true);
|
|||||||
if (_PS_MODE_DEV_)
|
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);
|
define('_PS_DEBUG_SQL_', true);
|
||||||
/* Compatibility warning */
|
/* Compatibility warning */
|
||||||
define('_PS_DISPLAY_COMPATIBILITY_WARNING_', true);
|
define('_PS_DISPLAY_COMPATIBILITY_WARNING_', true);
|
||||||
|
|||||||
@@ -56,6 +56,13 @@ function smartyTranslate($params, &$smarty)
|
|||||||
$class = 'Helper';
|
$class = 'Helper';
|
||||||
// If the tpl is used by a Controller
|
// If the tpl is used by a Controller
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
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
|
// Split by \ and / to get the folder tree for the file
|
||||||
$folder_tree = preg_split('#[/\\\]#', $filename);
|
$folder_tree = preg_split('#[/\\\]#', $filename);
|
||||||
@@ -70,7 +77,7 @@ function smartyTranslate($params, &$smarty)
|
|||||||
else
|
else
|
||||||
$class = null;
|
$class = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Translate::getAdminTranslation($params['s'], $class, $addslashes, $htmlentities, $sprintf);
|
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`)';
|
$join = 'LEFT JOIN `'._DB_PREFIX_.'tab` t ON (t.`id_tab` = a.`id_tab`)';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id_tab == -1 && $perm == 'all' && $enabled == 0)
|
if ($id_tab == -1)
|
||||||
$sql = '
|
{
|
||||||
UPDATE `'._DB_PREFIX_.'access` a
|
if ($perm == 'all')
|
||||||
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 = '
|
$sql = '
|
||||||
UPDATE `'._DB_PREFIX_.'access` a
|
UPDATE `'._DB_PREFIX_.'access` a
|
||||||
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
||||||
WHERE `id_profile` = '.(int)$id_profile;
|
WHERE `id_profile` = '.(int)$id_profile;
|
||||||
else if ($id_tab == -1)
|
|
||||||
$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
|
else
|
||||||
$sql = '
|
$sql = '
|
||||||
UPDATE `'._DB_PREFIX_.'access` a
|
UPDATE `'._DB_PREFIX_.'access` a
|
||||||
'.$join.'
|
|
||||||
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
|
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
|
||||||
WHERE '.$where.' = '.(int)$id_tab.'
|
WHERE `id_profile` = '.(int)$id_profile;
|
||||||
AND `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.'
|
||||||
|
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
|
||||||
|
WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile;
|
||||||
|
}
|
||||||
|
|
||||||
$res = Db::getInstance()->execute($sql) ? 'ok' : 'error';
|
$res = Db::getInstance()->execute($sql) ? 'ok' : 'error';
|
||||||
|
|
||||||
|
|||||||
@@ -444,4 +444,41 @@ class AdminAddressesControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
die;
|
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,8 +686,12 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
foreach ($this->_list as &$list)
|
foreach ($this->_list as &$list)
|
||||||
if (file_exists(_PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.(int)$list['id_attribute'].'.jpg'))
|
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';
|
$list['color']['texture'] = '../img/'.$this->fieldImageSettings['dir'].'/'.(int)$list['id_attribute'].'.jpg';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$nb_items = count($this->_list);
|
$nb_items = count($this->_list);
|
||||||
|
|||||||
@@ -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)
|
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, $order_by, $order_way, $start, $limit, Context::getContext()->shop->id);
|
||||||
parent::getList($id_lang, $alias.'.position', $order_way, $start, $limit, Context::getContext()->shop->id);
|
|
||||||
// Check each row to see if there are combinations and get the correct action in consequence
|
// Check each row to see if there are combinations and get the correct action in consequence
|
||||||
|
|
||||||
$nb_items = count($this->_list);
|
$nb_items = count($this->_list);
|
||||||
@@ -415,6 +414,7 @@ class AdminCategoriesControllerCore extends AdminController
|
|||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'label' => $this->l('Description:'),
|
'label' => $this->l('Description:'),
|
||||||
'name' => 'description',
|
'name' => 'description',
|
||||||
|
'autoload_rte' => true,
|
||||||
'lang' => true,
|
'lang' => true,
|
||||||
'rows' => 10,
|
'rows' => 10,
|
||||||
'cols' => 100,
|
'cols' => 100,
|
||||||
|
|||||||
@@ -251,6 +251,26 @@ class AdminCountriesControllerCore extends AdminController
|
|||||||
'encoding_default_layout' => urlencode($default_layout),
|
'encoding_default_layout' => urlencode($default_layout),
|
||||||
'display_valid_fields' => $this->displayValidFields()
|
'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(
|
array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'label' => $this->l('Active:'),
|
'label' => $this->l('Active:'),
|
||||||
@@ -330,6 +350,7 @@ class AdminCountriesControllerCore extends AdminController
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Shop::isFeatureActive())
|
if (Shop::isFeatureActive())
|
||||||
@@ -346,6 +367,9 @@ class AdminCountriesControllerCore extends AdminController
|
|||||||
'class' => 'button'
|
'class' => 'button'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->object->iso_code == 'US')
|
||||||
|
$this->object->standardization = Configuration::get('PS_TAASC');
|
||||||
|
|
||||||
return parent::renderForm();
|
return parent::renderForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,6 +387,9 @@ class AdminCountriesControllerCore extends AdminController
|
|||||||
$this->errors[] = Tools::displayError('This ISO code already exists.You cannot create two countries with the same ISO code.');
|
$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))
|
if (!count($this->errors))
|
||||||
$res = parent::postProcess();
|
$res = parent::postProcess();
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -72,6 +72,14 @@ class AdminCustomerPreferencesControllerCore extends AdminController
|
|||||||
'cast' => 'intval',
|
'cast' => 'intval',
|
||||||
'type' => 'bool'
|
'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(
|
'PS_PASSWD_TIME_FRONT' => array(
|
||||||
'title' => $this->l('Regenerate password'),
|
'title' => $this->l('Regenerate password'),
|
||||||
'desc' => $this->l('Minimum time required to regenerate a password.'),
|
'desc' => $this->l('Minimum time required to regenerate a password.'),
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
|||||||
$products = $customer->getBoughtProducts();
|
$products = $customer->getBoughtProducts();
|
||||||
if ($products && count($products))
|
if ($products && count($products))
|
||||||
foreach ($products as $key => $product)
|
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)
|
foreach ($messages as $key => $message)
|
||||||
@@ -595,7 +595,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
|||||||
if (!empty($message['id_product']) && empty($message['employee_name']))
|
if (!empty($message['id_product']) && empty($message['employee_name']))
|
||||||
$id_order_product = Order::getIdOrderProduct((int)$message['id_customer'], (int)$message['id_product']);
|
$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['user_agent'] = strip_tags($message['user_agent']);
|
||||||
$message['message'] = preg_replace(
|
$message['message'] = preg_replace(
|
||||||
'/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui',
|
'/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui',
|
||||||
|
|||||||
@@ -555,7 +555,7 @@ class AdminCustomersControllerCore extends AdminController
|
|||||||
$total_orders = count($orders);
|
$total_orders = count($orders);
|
||||||
for ($i = 0; $i < $total_orders; $i++)
|
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_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']));
|
$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++)
|
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]['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();
|
$groups = $customer->getGroups();
|
||||||
@@ -598,7 +598,7 @@ class AdminCustomersControllerCore extends AdminController
|
|||||||
$products = $customer->getBoughtProducts();
|
$products = $customer->getBoughtProducts();
|
||||||
$total_products = count($products);
|
$total_products = count($products);
|
||||||
for ($i = 0; $i < $total_products; $i++)
|
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);
|
$carts = Cart::getCustomerCarts($customer->id);
|
||||||
$total_carts = count($carts);
|
$total_carts = count($carts);
|
||||||
@@ -610,7 +610,7 @@ class AdminCustomersControllerCore extends AdminController
|
|||||||
$currency = new Currency((int)$carts[$i]['id_currency']);
|
$currency = new Currency((int)$carts[$i]['id_currency']);
|
||||||
$carrier = new Carrier((int)$carts[$i]['id_carrier']);
|
$carrier = new Carrier((int)$carts[$i]['id_carrier']);
|
||||||
$carts[$i]['id_cart'] = sprintf('%06d', $carts[$i]['id_cart']);
|
$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]['total_price'] = Tools::displayPrice($summary['total_price'], $currency);
|
||||||
$carts[$i]['name'] = $carrier->name;
|
$carts[$i]['name'] = $carrier->name;
|
||||||
}
|
}
|
||||||
@@ -646,7 +646,7 @@ class AdminCustomersControllerCore extends AdminController
|
|||||||
$total_connections = count($connections);
|
$total_connections = count($connections);
|
||||||
for ($i = 0; $i < $total_connections; $i++)
|
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'] ?
|
$connections[$i]['http_referer'] = $connections[$i]['http_referer'] ?
|
||||||
preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) :
|
preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) :
|
||||||
$this->l('Direct link');
|
$this->l('Direct link');
|
||||||
@@ -655,7 +655,7 @@ class AdminCustomersControllerCore extends AdminController
|
|||||||
$referrers = Referrer::getReferrers($customer->id);
|
$referrers = Referrer::getReferrers($customer->id);
|
||||||
$total_referrers = count($referrers);
|
$total_referrers = count($referrers);
|
||||||
for ($i = 0; $i < $total_referrers; $i++)
|
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);
|
$shop = new Shop($customer->id_shop);
|
||||||
$this->tpl_view_vars = array(
|
$this->tpl_view_vars = array(
|
||||||
@@ -663,14 +663,14 @@ class AdminCustomersControllerCore extends AdminController
|
|||||||
'gender_image' => $gender_image,
|
'gender_image' => $gender_image,
|
||||||
|
|
||||||
// General information of the customer
|
// 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,
|
'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,
|
'count_better_customers' => $count_better_customers,
|
||||||
'shop_is_feature_active' => Shop::isFeatureActive(),
|
'shop_is_feature_active' => Shop::isFeatureActive(),
|
||||||
'name_shop' => $shop->name,
|
'name_shop' => $shop->name,
|
||||||
'customer_birthday' => Tools::displayDate($customer->birthday, $this->default_form_language),
|
'customer_birthday' => Tools::displayDate($customer->birthday),
|
||||||
'last_update' => Tools::displayDate($customer->date_upd, $this->default_form_language, true),
|
'last_update' => Tools::displayDate($customer->date_upd,null , true),
|
||||||
'customer_exists' => Customer::customerExists($customer->email),
|
'customer_exists' => Customer::customerExists($customer->email),
|
||||||
'id_lang' => $customer->id_lang,
|
'id_lang' => $customer->id_lang,
|
||||||
'customerLanguage' => (new Language($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
|
* AdminController::initContent() override
|
||||||
* @see AdminController::initContent()
|
* @see AdminController::initContent()
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ class AdminEmployeesControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
$this->fields_form['input'][] = array(
|
$this->fields_form['input'][] = array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => $this->l('Profile:'),
|
'label' => $this->l('Profile Permission:'),
|
||||||
'name' => 'id_profile',
|
'name' => 'id_profile',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'options' => array(
|
'options' => array(
|
||||||
|
|||||||
@@ -312,36 +312,32 @@ class AdminGroupsControllerCore extends AdminController
|
|||||||
return parent::renderForm();
|
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_reductions = array();
|
||||||
$category_reduction = Tools::getValue('category_reduction');
|
$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))
|
if (is_array($category_reduction) && array_key_exists($category['id_category'], $category_reduction))
|
||||||
$category['reduction'] = $category_reduction[$category['id_category']];
|
$category['reduction'] = $category_reduction[$category['id_category']];
|
||||||
|
|
||||||
$tmp = array();
|
$category_reductions[(int)$category['id_category']] = array(
|
||||||
$tmp['path'] = getPath(self::$currentIndex.'?tab=AdminCategories', (int)$category['id_category']);
|
'path' => getPath(self::$currentIndex.'?tab=AdminCategories', (int)$category['id_category']),
|
||||||
$tmp['reduction'] = (float)$category['reduction'] * 100;
|
'reduction' => (float)$category['reduction'] * 100,
|
||||||
$tmp['id_category'] = (int)$category['id_category'];
|
'id_category' => (int)$category['id_category']
|
||||||
$category_reductions[(int)$category['id_category']] = $tmp;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($category_reduction))
|
if (is_array($category_reduction))
|
||||||
foreach ($category_reduction as $key => $val)
|
foreach ($category_reduction as $key => $val)
|
||||||
{
|
|
||||||
if (!array_key_exists($key, $category_reductions))
|
if (!array_key_exists($key, $category_reductions))
|
||||||
{
|
$category_reductions[(int)$key] = array(
|
||||||
$tmp = array();
|
'path' => getPath(self::$currentIndex.'?tab=AdminCategories', $key),
|
||||||
$tmp['path'] = getPath(self::$currentIndex.'?tab=AdminCategories', $key);
|
'reduction' => (float)$val * 100,
|
||||||
$tmp['reduction'] = (float)$val * 100;
|
'id_category' => (int)$key
|
||||||
$tmp['id_category'] = (int)$key;
|
);
|
||||||
$category_reductions[(int)$category['id_category']] = $tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $category_reductions;
|
return $category_reductions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class AdminHomeControllerCore extends AdminController
|
|||||||
$indexRebuiltAfterUpdate = 2;
|
$indexRebuiltAfterUpdate = 2;
|
||||||
|
|
||||||
$smartyOptimized = 0;
|
$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;
|
++$smartyOptimized;
|
||||||
if (Configuration::get('PS_SMARTY_CACHE'))
|
if (Configuration::get('PS_SMARTY_CACHE'))
|
||||||
++$smartyOptimized;
|
++$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
|
// 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(
|
$this->fields_options = array(
|
||||||
'images' => array(
|
'images' => array(
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ class AdminLanguagesControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get all iso code available
|
// 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);
|
$result = Tools::jsonDecode($lang_packs);
|
||||||
if ($lang_packs !== '' && $result && !isset($result->error))
|
if ($lang_packs !== '' && $result && !isset($result->error))
|
||||||
|
|||||||
@@ -440,6 +440,7 @@ class AdminManufacturersControllerCore extends AdminController
|
|||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'label' => $this->l('Zip Code/Postal Code'),
|
'label' => $this->l('Zip Code/Postal Code'),
|
||||||
'name' => 'postcode',
|
'name' => 'postcode',
|
||||||
|
'required' => true,
|
||||||
'size' => 33,
|
'size' => 33,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -529,6 +529,7 @@ class AdminMetaControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
$this->url->domain = $value;
|
$this->url->domain = $value;
|
||||||
$this->url->update();
|
$this->url->update();
|
||||||
|
Configuration::updateGlobalValue('PS_SHOP_DOMAIN', $value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->errors[] = Tools::displayError('This domain is not valid.');
|
$this->errors[] = Tools::displayError('This domain is not valid.');
|
||||||
@@ -546,6 +547,7 @@ class AdminMetaControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
$this->url->domain_ssl = $value;
|
$this->url->domain_ssl = $value;
|
||||||
$this->url->update();
|
$this->url->update();
|
||||||
|
Configuration::updateGlobalValue('PS_SHOP_DOMAIN_SSL', $value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->errors[] = Tools::displayError('The SSL domain is not valid.');
|
$this->errors[] = Tools::displayError('The SSL domain is not valid.');
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ class AdminNotFoundControllerCore extends AdminController
|
|||||||
public function initContent()
|
public function initContent()
|
||||||
{
|
{
|
||||||
$this->errors[] = Tools::displayError('Controller not found');
|
$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);
|
$this->context->smarty->assign($tpl_vars);
|
||||||
parent::initContent();
|
parent::initContent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,9 +266,8 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$order = new Order(Tools::getValue('id_order'));
|
$order = new Order(Tools::getValue('id_order'));
|
||||||
if (!Validate::isLoadedObject($order))
|
if (!Validate::isLoadedObject($order))
|
||||||
throw new PrestaShopException('Can\'t load Order object');
|
throw new PrestaShopException('Can\'t load Order object');
|
||||||
}
|
|
||||||
|
|
||||||
ShopUrl::cacheMainDomainForShop((int)$order->id_shop);
|
ShopUrl::cacheMainDomainForShop((int)$order->id_shop);
|
||||||
|
}
|
||||||
|
|
||||||
/* Update shipping number */
|
/* Update shipping number */
|
||||||
if (Tools::isSubmit('submitShippingNumber') && isset($order))
|
if (Tools::isSubmit('submitShippingNumber') && isset($order))
|
||||||
@@ -1971,8 +1970,8 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
$res = true;
|
$res = true;
|
||||||
|
|
||||||
$order_detail = new OrderDetail(Tools::getValue('id_order_detail'));
|
$order_detail = new OrderDetail((int)Tools::getValue('id_order_detail'));
|
||||||
$order = new Order(Tools::getValue('id_order'));
|
$order = new Order((int)Tools::getValue('id_order'));
|
||||||
|
|
||||||
$this->doDeleteProductLineValidation($order_detail, $order);
|
$this->doDeleteProductLineValidation($order_detail, $order);
|
||||||
|
|
||||||
@@ -1996,6 +1995,9 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
|
|
||||||
$res &= $order->update();
|
$res &= $order->update();
|
||||||
|
|
||||||
|
// Reinject quantity in stock
|
||||||
|
$this->reinjectQuantity($order_detail, $order_detail->product_quantity);
|
||||||
|
|
||||||
// Delete OrderDetail
|
// Delete OrderDetail
|
||||||
$res &= $order_detail->delete();
|
$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);
|
$default_product = new Product((int)$this->object->id, false, null, (int)$this->object->id_shop_default);
|
||||||
$def = ObjectModel::getDefinition($this->object);
|
$def = ObjectModel::getDefinition($this->object);
|
||||||
foreach ($def['fields'] as $field_name => $row)
|
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();
|
$this->object->loadStockData();
|
||||||
}
|
}
|
||||||
@@ -914,7 +914,9 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$tos = Tools::getValue('spm_to');
|
$tos = Tools::getValue('spm_to');
|
||||||
|
|
||||||
foreach ($id_specific_prices as $key => $id_specific_price)
|
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 = new SpecificPrice((int)($id_specific_price));
|
||||||
$specific_price->id_shop = (int)$id_shops[$key];
|
$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->from = !$froms[$key] ? '0000-00-00 00:00:00' : $froms[$key];
|
||||||
$specific_price->to = !$tos[$key] ? '0000-00-00 00:00:00' : $tos[$key];
|
$specific_price->to = !$tos[$key] ? '0000-00-00 00:00:00' : $tos[$key];
|
||||||
if (!$specific_price->update())
|
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))
|
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;
|
$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');
|
$to = Tools::getValue('sp_to');
|
||||||
if (!$to)
|
if (!$to)
|
||||||
$to = '0000-00-00 00:00:00';
|
$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 = new SpecificPrice();
|
||||||
$specificPrice->id_product = (int)$id_product;
|
$specificPrice->id_product = (int)$id_product;
|
||||||
@@ -977,7 +982,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$specificPrice->from = $from;
|
$specificPrice->from = $from;
|
||||||
$specificPrice->to = $to;
|
$specificPrice->to = $to;
|
||||||
if (!$specificPrice->add())
|
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)
|
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP)
|
||||||
$object->setFieldsToUpdate((array)Tools::getValue('multishop_check'));
|
$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 ($object->update())
|
||||||
{
|
{
|
||||||
if (in_array($this->context->shop->getContext(), array(Shop::CONTEXT_SHOP, Shop::CONTEXT_ALL)))
|
if (in_array($this->context->shop->getContext(), array(Shop::CONTEXT_SHOP, Shop::CONTEXT_ALL)))
|
||||||
@@ -1887,8 +1915,16 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$this->display = 'edit';
|
$this->display = 'edit';
|
||||||
}
|
}
|
||||||
else
|
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().')';
|
$this->errors[] = Tools::displayError('An error occurred while updating an object.').' <b>'.$this->table.'</b> ('.Db::getInstance()->getMsgError().')';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$this->errors[] = Tools::displayError('An error occurred while updating an object.').' <b>'.$this->table.'</b> ('.Tools::displayError('The object cannot be loaded. ').')';
|
$this->errors[] = Tools::displayError('An error occurred while updating an object.').' <b>'.$this->table.'</b> ('.Tools::displayError('The object cannot be loaded. ').')';
|
||||||
return $object;
|
return $object;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ class AdminReturnControllerCore extends AdminController
|
|||||||
$this->tpl_form_vars = array(
|
$this->tpl_form_vars = array(
|
||||||
'customer' => new Customer($this->object->id_customer),
|
'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),
|
'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),
|
'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_,
|
'picture_folder' => _THEME_PROD_PIC_DIR_,
|
||||||
'type_file' => Product::CUSTOMIZE_FILE,
|
'type_file' => Product::CUSTOMIZE_FILE,
|
||||||
|
|||||||
@@ -1877,9 +1877,9 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
|||||||
'supply_order_warehouse' => (Validate::isLoadedObject($warehouse) ? $warehouse->name : ''),
|
'supply_order_warehouse' => (Validate::isLoadedObject($warehouse) ? $warehouse->name : ''),
|
||||||
'supply_order_reference' => $supply_order->reference,
|
'supply_order_reference' => $supply_order->reference,
|
||||||
'supply_order_supplier_name' => $supply_order->supplier_name,
|
'supply_order_supplier_name' => $supply_order->supplier_name,
|
||||||
'supply_order_creation_date' => Tools::displayDate($supply_order->date_add, $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, $lang_id, false),
|
'supply_order_last_update' => Tools::displayDate($supply_order->date_upd,null , false),
|
||||||
'supply_order_expected' => Tools::displayDate($supply_order->date_delivery_expected, $lang_id, 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_discount_rate' => Tools::ps_round($supply_order->discount_rate, 2),
|
||||||
'supply_order_total_te' => Tools::displayPrice($supply_order->total_te, $currency),
|
'supply_order_total_te' => Tools::displayPrice($supply_order->total_te, $currency),
|
||||||
'supply_order_discount_value_te' => Tools::displayPrice($supply_order->discount_value_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()
|
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();
|
$this->_helper_list = new HelperList();
|
||||||
|
|
||||||
if (!Configuration::get('PS_STOCK_MANAGEMENT'))
|
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:'));
|
$this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes but without available quantities for sale:'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this->renderList();
|
return $this->renderList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -720,7 +720,7 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
if (Validate::isLangIsoCode($arr_import_lang[0]))
|
if (Validate::isLangIsoCode($arr_import_lang[0]))
|
||||||
{
|
{
|
||||||
if ($content = Tools::file_get_contents(
|
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)))))
|
@stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
|
||||||
{
|
{
|
||||||
$file = _PS_TRANSLATIONS_DIR_.$arr_import_lang[0].'.gzip';
|
$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';
|
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
|
||||||
|
|
||||||
// Parse this content
|
// 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
|
// Write each translation on its module file
|
||||||
$template_name = substr(basename($file), 0, -4);
|
$template_name = substr(basename($file), 0, -4);
|
||||||
@@ -858,7 +858,7 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
public function clearModuleFiles($files, $type_clear = 'file', $path = '')
|
public function clearModuleFiles($files, $type_clear = 'file', $path = '')
|
||||||
{
|
{
|
||||||
// List of directory which not must be parsed
|
// 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
|
// List of good extention files
|
||||||
$arr_good_ext = array('.tpl', '.php');
|
$arr_good_ext = array('.tpl', '.php');
|
||||||
@@ -914,7 +914,7 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
|
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
|
||||||
|
|
||||||
// Parse this content
|
// 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
|
// Write each translation on its module file
|
||||||
$template_name = substr(basename($file), 0, -4);
|
$template_name = substr(basename($file), 0, -4);
|
||||||
@@ -1057,9 +1057,10 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
* @param $content
|
* @param $content
|
||||||
* @param $type_translation : front, back, errors, modules...
|
* @param $type_translation : front, back, errors, modules...
|
||||||
* @param string|bool $type_file : (tpl|php)
|
* @param string|bool $type_file : (tpl|php)
|
||||||
|
* @param string $module_name : name of the module
|
||||||
* @return return $matches
|
* @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)
|
switch ($type_translation)
|
||||||
{
|
{
|
||||||
@@ -1088,7 +1089,8 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
if ($type_file == 'php')
|
if ($type_file == 'php')
|
||||||
$regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
|
$regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
|
||||||
else
|
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;
|
break;
|
||||||
|
|
||||||
case 'pdf':
|
case 'pdf':
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
$address = new Address($object->id_address);
|
$address = new Address($object->id_address);
|
||||||
if (Validate::isLoadedObject($address))
|
if (Validate::isLoadedObject($address))
|
||||||
{
|
{
|
||||||
$address->id_warehouse = $object->id_address;
|
$address->id_warehouse = (int)$object->id;
|
||||||
$address->save();
|
$address->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class AddressControllerCore extends FrontController
|
|||||||
$this->errors[] = Tools::displayError('This country requires you to chose a State.');
|
$this->errors[] = Tools::displayError('This country requires you to chose a State.');
|
||||||
|
|
||||||
// US customer: normalize the address
|
// 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');
|
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
|
||||||
$normalize = new AddressStandardizationSolution;
|
$normalize = new AddressStandardizationSolution;
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ class AttachmentControllerCore extends FrontController
|
|||||||
if (!$a->id)
|
if (!$a->id)
|
||||||
Tools::redirect('index.php');
|
Tools::redirect('index.php');
|
||||||
|
|
||||||
|
if (ob_get_level())
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
header('Content-Transfer-Encoding: binary');
|
header('Content-Transfer-Encoding: binary');
|
||||||
header('Content-Type: '.$a->mime);
|
header('Content-Type: '.$a->mime);
|
||||||
header('Content-Length: '.filesize(_PS_DOWNLOAD_DIR_.$a->file));
|
header('Content-Length: '.filesize(_PS_DOWNLOAD_DIR_.$a->file));
|
||||||
|
|||||||
@@ -139,6 +139,9 @@ class AuthControllerCore extends FrontController
|
|||||||
'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')
|
'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)
|
if ($this->ajax)
|
||||||
{
|
{
|
||||||
// Call a hook to display more information on form
|
// Call a hook to display more information on form
|
||||||
@@ -150,12 +153,11 @@ class AuthControllerCore extends FrontController
|
|||||||
$return = array(
|
$return = array(
|
||||||
'hasError' => !empty($this->errors),
|
'hasError' => !empty($this->errors),
|
||||||
'errors' => $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)
|
'token' => Tools::getToken(false)
|
||||||
);
|
);
|
||||||
die(Tools::jsonEncode($return));
|
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'));
|
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
|
||||||
}
|
}
|
||||||
else
|
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()));
|
$this->errors = array_unique(array_merge($this->errors, $address->validateController()));
|
||||||
|
|
||||||
// US customer: normalize the address
|
// 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');
|
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
|
||||||
$normalize = new AddressStandardizationSolution;
|
$normalize = new AddressStandardizationSolution;
|
||||||
@@ -545,7 +547,7 @@ class AuthControllerCore extends FrontController
|
|||||||
else
|
else
|
||||||
$customer->is_guest = 0;
|
$customer->is_guest = 0;
|
||||||
if (!$customer->add())
|
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
|
else
|
||||||
{
|
{
|
||||||
$address->id_customer = (int)$customer->id;
|
$address->id_customer = (int)$customer->id;
|
||||||
@@ -688,6 +690,9 @@ class AuthControllerCore extends FrontController
|
|||||||
*/
|
*/
|
||||||
protected function sendConfirmationMail(Customer $customer)
|
protected function sendConfirmationMail(Customer $customer)
|
||||||
{
|
{
|
||||||
|
if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL'))
|
||||||
|
return true;
|
||||||
|
|
||||||
return Mail::Send(
|
return Mail::Send(
|
||||||
$this->context->language->id,
|
$this->context->language->id,
|
||||||
'account',
|
'account',
|
||||||
|
|||||||
@@ -335,7 +335,8 @@ class CartControllerCore extends FrontController
|
|||||||
if ($result['customizedDatas'])
|
if ($result['customizedDatas'])
|
||||||
Product::addCustomizationPrice($result['summary']['products'], $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
|
// @todo create a hook
|
||||||
elseif (file_exists(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php'))
|
elseif (file_exists(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php'))
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ class ContactControllerCore extends FrontController
|
|||||||
$tmp = $order->getProducts();
|
$tmp = $order->getProducts();
|
||||||
foreach ($tmp as $key => $val)
|
foreach ($tmp as $key => $val)
|
||||||
$products[$row['id_order']][$val['product_id']] = array('value' => $val['product_id'], 'label' => $val['product_name']);
|
$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);
|
$this->context->smarty->assign('orderList', $orders);
|
||||||
|
|||||||
@@ -270,12 +270,14 @@ class GetFileControllerCore extends FrontController
|
|||||||
$mimeType = 'application/octet-stream';
|
$mimeType = 'application/octet-stream';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ob_get_level())
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
/* Set headers for download */
|
/* Set headers for download */
|
||||||
header('Content-Transfer-Encoding: binary');
|
header('Content-Transfer-Encoding: binary');
|
||||||
header('Content-Type: '.$mimeType);
|
header('Content-Type: '.$mimeType);
|
||||||
header('Content-Length: '.filesize($file));
|
header('Content-Length: '.filesize($file));
|
||||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||||
ob_end_flush();
|
|
||||||
$fp = fopen($file, 'rb');
|
$fp = fopen($file, 'rb');
|
||||||
while (!feof($fp))
|
while (!feof($fp))
|
||||||
echo fgets($fp, 16384);
|
echo fgets($fp, 16384);
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ class NewProductsControllerCore extends FrontController
|
|||||||
|
|
||||||
$this->productSort();
|
$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(
|
$nbProducts = (int)Product::getNewProducts(
|
||||||
$this->context->language->id,
|
$this->context->language->id,
|
||||||
(isset($this->p) ? (int)($this->p) - 1 : null),
|
(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
|
// Getting a list of formated address fields with associated values
|
||||||
$formatedAddressFieldsValuesList = array();
|
$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']);
|
$tmpAddress = new Address($address['id_address']);
|
||||||
|
|
||||||
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
|
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
|
||||||
$formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues(
|
$formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues(
|
||||||
$tmpAddress,
|
$tmpAddress,
|
||||||
@@ -459,6 +460,8 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
$address = new Address($this->context->cart->id_address_delivery);
|
$address = new Address($this->context->cart->id_address_delivery);
|
||||||
$id_zone = Address::getZoneById($address->id);
|
$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();
|
$carriers = $this->context->cart->simulateCarriersOutput();
|
||||||
$checked = $this->context->cart->simulateCarrierSelectedOutput();
|
$checked = $this->context->cart->simulateCarrierSelectedOutput();
|
||||||
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
|
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
|
||||||
|
|||||||
@@ -54,17 +54,17 @@ class StatisticsControllerCore extends FrontController
|
|||||||
if (sha1($id_guest._COOKIE_KEY_) != $this->param_token)
|
if (sha1($id_guest._COOKIE_KEY_) != $this->param_token)
|
||||||
die;
|
die;
|
||||||
|
|
||||||
$guest = new Guest($id_guest);
|
$guest = new Guest((int)substr($_POST['id_guest'],0,10));
|
||||||
$guest->javascript = true;
|
$guest->javascript = true;
|
||||||
$guest->screen_resolution_x = (int)Tools::getValue('screen_resolution_x');
|
$guest->screen_resolution_x = (int)substr($_POST['screen_resolution_x'],0,5);
|
||||||
$guest->screen_resolution_y = (int)Tools::getValue('screen_resolution_y');
|
$guest->screen_resolution_y = (int)substr($_POST['screen_resolution_y'],0,5);
|
||||||
$guest->screen_color = (int)Tools::getValue('screen_color');
|
$guest->screen_color = (int)substr($_POST['screen_color'],0,3);
|
||||||
$guest->sun_java = (int)Tools::getValue('sun_java');
|
$guest->sun_java = (int)substr($_POST['sun_java'],0,1);
|
||||||
$guest->adobe_flash = (int)Tools::getValue('adobe_flash');
|
$guest->adobe_flash = (int)substr($_POST['adobe_flash'],0,1);
|
||||||
$guest->adobe_director = (int)Tools::getValue('adobe_director');
|
$guest->adobe_director = (int)substr($_POST['adobe_director'],0,1);
|
||||||
$guest->apple_quicktime = (int)Tools::getValue('apple_quicktime');
|
$guest->apple_quicktime = (int)substr($_POST['apple_quicktime'],0,1);
|
||||||
$guest->real_player = (int)Tools::getValue('real_player');
|
$guest->real_player = (int)substr($_POST['real_player'],0,1);
|
||||||
$guest->windows_media = (int)Tools::getValue('windows_media');
|
$guest->windows_media = (int)substr($_POST['windows_media'],0,1);
|
||||||
$guest->update();
|
$guest->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -509,7 +509,7 @@ select optgroup option {
|
|||||||
background: #DFF2BF url(../img/admin/icon-valid.png) no-repeat scroll 6px 6px;
|
background: #DFF2BF url(../img/admin/icon-valid.png) no-repeat scroll 6px 6px;
|
||||||
border: 1px solid #4F8A10;
|
border: 1px solid #4F8A10;
|
||||||
color:#4F8A10;
|
color:#4F8A10;
|
||||||
padding:20px;
|
padding:20px 40px;
|
||||||
position:fixed;
|
position:fixed;
|
||||||
bottom:0;
|
bottom:0;
|
||||||
width:100%;
|
width:100%;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ abstract class InstallControllerHttp
|
|||||||
/**
|
/**
|
||||||
* @var array List of installer steps
|
* @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();
|
protected static $instances = array();
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,11 @@ class Datas
|
|||||||
'default' => 1,
|
'default' => 1,
|
||||||
'help' => 'get news from PrestaShop',
|
'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();
|
protected $datas = array();
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
class InstallSession
|
class InstallSession
|
||||||
{
|
{
|
||||||
protected static $_instance;
|
protected static $_instance;
|
||||||
|
protected static $_cookie_mode = false;
|
||||||
|
protected static $_cookie = false;
|
||||||
|
|
||||||
public static function getInstance()
|
public static function getInstance()
|
||||||
{
|
{
|
||||||
@@ -41,16 +43,32 @@ class InstallSession
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
session_name('install_'.md5(__PS_BASE_URI__));
|
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()
|
public function clean()
|
||||||
{
|
{
|
||||||
|
if (InstallSession::$_cookie_mode)
|
||||||
|
InstallSession::$_cookie->logout();
|
||||||
|
else
|
||||||
foreach ($_SESSION as $k => $v)
|
foreach ($_SESSION as $k => $v)
|
||||||
unset($_SESSION[$k]);
|
unset($_SESSION[$k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function &__get($varname)
|
public function &__get($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
|
||||||
{
|
{
|
||||||
if (isset($_SESSION[$varname]))
|
if (isset($_SESSION[$varname]))
|
||||||
$ref = &$_SESSION[$varname];
|
$ref = &$_SESSION[$varname];
|
||||||
@@ -59,21 +77,37 @@ class InstallSession
|
|||||||
$null = null;
|
$null = null;
|
||||||
$ref = &$null;
|
$ref = &$null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $ref;
|
return $ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __set($varname, $value)
|
public function __set($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;
|
$_SESSION[$varname] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __isset($varname)
|
public function __isset($varname)
|
||||||
{
|
{
|
||||||
|
if (InstallSession::$_cookie_mode)
|
||||||
|
return isset(InstallSession::$_cookie->{$varname});
|
||||||
|
else
|
||||||
return isset($_SESSION[$varname]);
|
return isset($_SESSION[$varname]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __unset($varname)
|
public function __unset($varname)
|
||||||
{
|
{
|
||||||
|
if (InstallSession::$_cookie_mode)
|
||||||
|
unset(InstallSession::$_cookie->{$varname});
|
||||||
|
else
|
||||||
unset($_SESSION[$varname]);
|
unset($_SESSION[$varname]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,10 +224,13 @@ class InstallXmlLoader
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (substr($entity, 0, 1) == '.' || substr($entity, 0, 1) == '_')
|
||||||
|
return;
|
||||||
|
|
||||||
$xml = $this->loadEntity($entity);
|
$xml = $this->loadEntity($entity);
|
||||||
|
|
||||||
// Read list of fields
|
// Read list of fields
|
||||||
if (!$xml->fields)
|
if (!is_object($xml) || !$xml->fields)
|
||||||
throw new PrestashopInstallerException('List of fields not found for entity '.$entity);
|
throw new PrestashopInstallerException('List of fields not found for entity '.$entity);
|
||||||
|
|
||||||
if ($this->isMultilang($entity))
|
if ($this->isMultilang($entity))
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
|
|||||||
$this->printErrors();
|
$this->printErrors();
|
||||||
if (!$this->processInstallTheme())
|
if (!$this->processInstallTheme())
|
||||||
$this->printErrors();
|
$this->printErrors();
|
||||||
|
if ($this->datas->send_email)
|
||||||
if (!$this->processSendEmail())
|
if (!$this->processSendEmail())
|
||||||
$this->printErrors();
|
$this->printErrors();
|
||||||
|
|
||||||
@@ -288,4 +289,3 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
|
|||||||
return $this->model_install->installModulesAddons();
|
return $this->model_install->installModulesAddons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ class InstallControllerHttpProcess extends InstallControllerHttp
|
|||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
if (file_exists(_PS_ROOT_DIR_.'/'.self::SETTINGS_FILE))
|
if (file_exists(_PS_ROOT_DIR_.'/'.self::SETTINGS_FILE))
|
||||||
@require_once _PS_ROOT_DIR_.'/'.self::SETTINGS_FILE;
|
require_once _PS_ROOT_DIR_.'/'.self::SETTINGS_FILE;
|
||||||
|
|
||||||
if (!$this->session->process_validated)
|
if (!$this->session->process_validated)
|
||||||
$this->session->process_validated = array();
|
$this->session->process_validated = array();
|
||||||
@@ -241,7 +241,7 @@ class InstallControllerHttpProcess extends InstallControllerHttp
|
|||||||
public function processInstallAddonsModules()
|
public function processInstallAddonsModules()
|
||||||
{
|
{
|
||||||
$this->initializeContext();
|
$this->initializeContext();
|
||||||
if ($module = Tools::getValue('module') && $id_module = Tools::getValue('id_module'))
|
if (($module = Tools::getValue('module')) && $id_module = Tools::getValue('id_module'))
|
||||||
$result = $this->model_install->installModulesAddons(array('name' => $module, 'id_module' => $id_module));
|
$result = $this->model_install->installModulesAddons(array('name' => $module, 'id_module' => $id_module));
|
||||||
else
|
else
|
||||||
$result = $this->model_install->installModulesAddons();
|
$result = $this->model_install->installModulesAddons();
|
||||||
|
|||||||
Loaded 100 of 300 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user