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

Conflicts:
	admin-dev/themes/default/css/admin.css
	admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl
	admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form_ranges.tpl
	admin-dev/themes/default/template/controllers/categories/helpers/form/form.tpl
	admin-dev/themes/default/template/controllers/home/content.tpl
	admin-dev/themes/default/template/controllers/localization/content.tpl
	admin-dev/themes/default/template/controllers/orders/_customized_data.tpl
	admin-dev/themes/default/template/controllers/orders/_new_product.tpl
	admin-dev/themes/default/template/controllers/orders/_product_line.tpl
	admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl
	admin-dev/themes/default/template/controllers/tax_rules/helpers/list/list_header.tpl
	admin-dev/themes/default/template/footer.tpl
	controllers/admin/AdminCarrierWizardController.php
	controllers/admin/AdminCarriersController.php
	controllers/admin/AdminCmsController.php
	controllers/admin/AdminLocalizationController.php
	controllers/admin/AdminManufacturersController.php
	controllers/admin/AdminSuppliersController.php
	css/admin.css
	js/admin-products.js
	js/admin_carrier_wizard.js
	translations/fr.gzip
This commit is contained in:
Kevin Granger
2013-09-13 11:41:14 +02:00
247 changed files with 7965 additions and 4936 deletions
+140 -80
View File
@@ -1,80 +1,140 @@
- (d)oekia
- Alexander Otchenashev
- Benjamin PONGY
- Burhan
- Caleydon Media
- Damien Metzger
- DamienMetzger
- Damon Skelhorn
- Daniel
- David Gasperoni
- DrySs
- DrÿSs'
- François Gaillard
- Gabriel Schwardy
- Gregory Roussac
- Ha!*!*y
- Jonathan Danse
- Krystian Podemski
- Marco Cervellin
- Michel Courtade
- Milow
- Patanock
- Pierre
- PrestaEdit
- Raphaël Malié
- Rémi Gaillard
- Samy Rabih
- Sarah Lorenzini
- Shagshag
- Vincent Augagneur
- Xavier POITAU
- aFolletete
- aKorczak
- aNiassy
- adonis karavokyros
- anat
- bLeveque
- bMancone
- bumbu
- cmouleyre
- dMetzger
- dSevere
- djfm
- fBrignoli
- fSerny
- fram
- gBrunier
- gCharmes
- gPoulain
- gRoussac
- hAitmansour
- ivancasasempere
- jBreux
- jObregon
- jessylenne
- jmCollin
- kpodemski
- lBrieu
- lCherifi
- lLefevre
- mBertholino
- mDeflotte
- mMarinetti
- marcinsz101
- montes
- nPellicari
- nezenmoins
- oleacorner
- rGaillard
- rMalie
- rMontagne
- root
- sLorenzini
- sThiebaut
- tDidierjean
- vAugagneur
- vChabot
- vKham
- vSchoener
- adonis karavokyros
- aFolletete
- Agence CINS
- aKorczak
- Alexander Otchenashev
- anat
- Andrew
- aNiassy
- antoniofr
- AntonLejon
- Arnaud Lemercier
- Axome
- Benjamin PONGY
- BigZ
- bLeveque
- bMancone
- bumbu
- Burhan
- Cédric Mouleyre
- Caleydon Media
- cam.lafit
- Captain FLAM
- Captain-FLAM
- ccauw
- ChristopheBoucaut
- cippest
- cmouleyre
- Corentin Delcourt
- Cosmin Hutanu
- Damien Metzger
- DamienMetzger
- Damon Skelhorn
- Daniel
- David Gasperoni
- Davy Rolink
- djfm
- dMetzger
- (d)oekia
- Dragan Skrbic
- DrÿSs'
- dreammeup
- DrySs
- dSevere
- Edouard Gaulué
- emily-d
- Fabio Chelly
- fBrignoli
- fram
- François Gaillard
- fSerny
- Gabriel Schwardy
- gBrunier
- gCharmes
- gPoulain
- Grégoire Bélorgey
- Gregory Roussac
- gRoussac
- Guillaume DELOINCE
- hAitmansour
- Ha!*!*y
- indesign47
- inem0o
- ivancasasempere
- Jérôme Nadaud
- jBreux
- jeromenadaud
- Jerome Nadaud
- jessylenne
- jmCollin
- jObregon
- Jonathan Danse
- joseantgv
- Kevin Granger
- kpodemski
- Krystian Podemski
- lBrieu
- lCherifi
- ldecoker
- lLefevre
- marcinsz101
- Marco Cervellin
- Mats Rynge
- MatthieuB
- Maxence
- mBertholino
- mDeflotte
- Michel Courtade
- Milow
- minic studio
- misthero
- mMarinetti
- montes
- nezenmoins
- Nicolas Sorosac
- Nils-Helge Garli Hegvik
- nPellicari
- nturato
- oleacorner
- Otto Nascarella
- Patanock
- PhpMadman
- Pierre
- Piotr Kaczor
- Piotr Moćko
- PrestaEdit
- prestarocket
- pxls
- Rémi Gaillard
- Raphaël Malié
- raulgundin
- rGaillard
- Rimas Kudelis
- rMalie
- rMontagne
- root
- runningz
- Sébastien
- Sébastien Bocahu
- Samy Rabih
- Sarah Lorenzini
- Seb
- Seynaeve
- Shagshag
- sLorenzini
- soware
- Staging
- sThiebaut
- Sylvain WITMEYER
- tDidierjean
- vAugagneur
- vChabot
- Vincent Augagneur
- Vincent Schoener
- Vincent Terenti
- vinvin27
- vKham
- vSchoener
- Xavier
- Xavier POITAU
- Yoozio
+21 -20
View File
@@ -2,47 +2,48 @@ README
======
![PrestaShop](http://www.prestashop.com/images/banners/general/prestashop_728x90.png "PrestaShop")
PREPARATION
ABOUT
--------
To install PrestaShop, you need a remote web server or on your computer (MAMP), with access to a database like MySQL.
You'll need access to phpMyAdmin to create a database and to indicate the information in the database in the installer.
PrestaShop is a free and open-source e-commerce web application, committed to providing the best shopping cart experience for both merchants and consumers.
SERVER CONFIGURATION
--------
To install PrestaShop, you need a web server running PHP5 and any flavor of MySQL5 (MySQL, MariaDB, Percona Server...).
You will also need a database administration tool, such as phpMyAdmin, in order to create a database for PrestaShop.
We recommend the Apache or Nginx web servers.
If your host does not offer PHP5 by default, here are a few [explanations][2] about PHP5 or the .htaccess file for certain hosting services (1&1, Free, Lycos, OVH, Infomaniak, Amen, GoDaddy, etc).
If you want your online store ready to go, visit [http://www.prestabox.com][1]: it lets you create your online store in less than 10 minutes without any technical knowledge.
If you do not host and unable to create your store, we offer a turnkey store, which lets you create your online store in less than 10 minutes without any technical knowledge.
We invite you to visit: [http://www.prestabox.com][1]
INSTALLATION
--------
Simply go to your PrestaShop web directory and use installer :-)
With your web browser, go to the root of your PrestaShop directory, and the installer will start. Follow the instructions until PrestaShop is installed.
If you have any PHP error, perhaps you don't have PHP5 or you need to activate it on your web host.
Please go to our forum to find pre-installation settings (PHP 5, htaccess) for certain hosting services (1&1, Free, Lycos, OVH, Infomaniak, Amen, GoDaddy, etc).
If you have any PHP error, perhaps you don't have PHP5 or you need to activate it on your web host. See the page linked above.
If you don't find any solution to start the installer, please post on [the PrestaShop forums][3].
English webhost [specifics settings][2]
If you don't find any solution to launch installer, please post on [our forum][3]
There are always solutions for your issues ;-)
DOCUMENTATION
--------
For any extra documentation (how-to), please read our [Online documentation][4]
The official PrestaShop documentation is available online [on its own website][4].
FORUMS
--------
You can also discuss, help and contribute with PrestaShop community on [our forums][5]
You can discuss, help and contribute with PrestaShop community on [the PrestaShop forums][5].
Thanks for downloading and using PrestaShop e-commerce Open-source solution!
Thank you for downloading and using PrestaShop e-commerce Open-source solution!
[1]: http://www.prestabox.com
[2]: http://www.prestashop.com/forums/topic/2946-pre-installation-settings-php-5-htaccess-for-certain-hosting-services/
[3]: http://www.prestashop.com/forums/forum/7-installing-prestashop/
[4]: http://doc.prestashop.com
[5]: http://www.prestashop.com/forums/
[5]: http://www.prestashop.com/forums/
+1 -83
View File
@@ -26,45 +26,12 @@
define('_PS_ADMIN_DIR_', getcwd());
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
/* Getting cookie or logout */
require_once(_PS_ADMIN_DIR_.'/init.php');
$context = Context::getContext();
if (Tools::isSubmit('changeParentUrl'))
echo '<script type="text/javascript">parent.parent.document.location.href = "'.addslashes(urldecode(Tools::getValue('changeParentUrl'))).'";</script>';
if (Tools::isSubmit('installBoughtModule'))
{
$file = false;
while ($file === false OR file_exists(_PS_MODULE_DIR_.$file))
$file = uniqid();
$file = _PS_MODULE_DIR_.$file.'.zip';
$sourceFile = 'http://addons.prestashop.com/iframe/getboughtfile.php?id_order_detail='.Tools::getValue('id_order_detail').'&token='.Tools::getValue('token');
if (!copy($sourceFile, $file))
{
if (!($content = file_get_contents($sourceFile)))
die(displayJavascriptAlert('Access denied: Please download your module directly from PrestaShop Addons website'));
elseif (!file_put_contents($file, $content))
die(displayJavascriptAlert('Local error: your module directory is not writable'));
}
$first6 = fread($fd = fopen($file, 'r'), 6);
if (!strncmp($first6, 'Error:', 6))
{
$displayJavascriptAlert = displayJavascriptAlert(fread($fd, 1024));
fclose($fd);
unlink($file);
die($displayJavascriptAlert);
}
fclose($fd);
if (!Tools::ZipExtract($file, _PS_MODULE_DIR_))
{
unlink($file);
die(displayJavascriptAlert('Cannot unzip file'));
}
unlink($file);
die(displayJavascriptAlert('Module copied to disk'));
}
if (Tools::isSubmit('ajaxReferrers'))
{
require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
@@ -101,39 +68,6 @@ if (Tools::isSubmit('ajaxProductPackItems'))
die('['.implode(',', $jsonArray).']');
}
if (Tools::isSubmit('ajaxStates') AND Tools::isSubmit('id_country'))
{
$states = Db::getInstance()->executeS('
SELECT s.id_state, s.name
FROM '._DB_PREFIX_.'state s
LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`)
WHERE s.id_country = '.(int)(Tools::getValue('id_country')).' AND s.active = 1 AND c.`contains_states` = 1
ORDER BY s.`name` ASC');
if (is_array($states) AND !empty($states))
{
$list = '';
if (Tools::getValue('no_empty') != true)
{
$empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------';
$list = '<option value="0">'.Tools::htmlentitiesUTF8($empty_value).'</option>'."\n";
}
foreach ($states AS $state)
$list .= '<option value="'.(int)($state['id_state']).'"'.((isset($_GET['id_state']) AND $_GET['id_state'] == $state['id_state']) ? ' selected="selected"' : '').'>'.$state['name'].'</option>'."\n";
}
else
$list = 'false';
die($list);
}
if (Tools::getValue('form_language_id'))
{
if (!($context->cookie->employee_form_lang = (int)(Tools::getValue('form_language_id'))))
die ('Error while updating cookie.');
die ('Form language updated.');
}
if (Tools::isSubmit('submitTrackClickOnHelp'))
{
@@ -191,17 +125,6 @@ if (Tools::isSubmit('getParentCategoriesId') && $id_category = Tools::getValue('
die(Tools::jsonEncode($output));
}
/* Update attribute */
if (Tools::isSubmit('ajaxUpdateTaxRule'))
{
$id_tax_rule = Tools::getValue('id_tax_rule');
$tax_rules = new TaxRule((int)$id_tax_rule);
$output = array();
foreach ($tax_rules as $key => $result)
$output[$key] = $result;
die(Tools::jsonEncode($output));
}
if (Tools::isSubmit('getZones'))
{
$zones = Zone::getZones();
@@ -214,8 +137,3 @@ if (Tools::isSubmit('getZones'))
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
die(Tools::jsonEncode($html));
}
function displayJavascriptAlert($s)
{
echo '<script type="text/javascript">alert(\''.addslashes($s).'\');</script>';
}
File diff suppressed because it is too large Load Diff
@@ -32,7 +32,7 @@
{if $input.name == 'zones'}
<div class="ranges_not_follow warn" style="display:none">
<label>{l s="Ranges are not correctly ordered:"}</label>
<a href="#" class="btn btn-default" style="text-decoration:none">{l s="Reordering"}</a>
<a href="#" onclick="checkRangeContinuity(true); return false;" class="btn btn-default">{l s="Reordering"}</a>
</div>
{include file='controllers/carrier_wizard/helpers/form/form_ranges.tpl'}
@@ -49,7 +49,9 @@
<td class="border_top border_bottom border_bold">
<span class="fees_all" {if $ranges|count == 0}style="display:none" {/if}>All</span>
</td>
<td></td>
<td>
<input type="checkbox" onclick="checkAllZones(this);" >
</td>
{foreach from=$ranges key=r item=range}
<td class="border_top border_bottom {if $range.id_range != 0} validated {/if}" >
<div class="input-group">
@@ -41,6 +41,7 @@
var PS_WEIGHT_UNIT = '{$PS_WEIGHT_UNIT}';
var invalid_range = '{l s='This range is not valid' js=1}';
var range_is_overlapping = '{l s='Ranges are overlapping' js=1}';
var multistore_enable = '{$multistore_enable}';
</script>
<div class="row">
@@ -25,14 +25,12 @@
<script type="text/javascript">
var summary_translation_undefined = '{l s='[undefined]' js=1}';
var summary_translation_meta_informations = '{l s='This carrier is @s1 and the displayed delivery time is: @s2.' js=1}';
var summary_translation_meta_informations = '{l s='This carrier is @s1 and the delivery announced is: @s2.' js=1}';
var summary_translation_free = '<strong>{l s='free' js=1}</strong>';
var summary_translation_paid = '<strong>{l s='paid' js=1}</strong>';
var summary_translation_range = '{l s='This carrier can deliver orders from @s1 to @s2. If the order is out of range, the behavior is to @s3.' js=1}';
var summary_translation_shipping_cost = '{l s='The shipping cost is calculated @s1 and the tax rule @s2 is applied.' js=1}';
var summary_translation_paid = '<strong>{l s='not free' js=1}</strong>';
var summary_translation_range = '<span class="is_free">{l s='This carrier can deliver orders from @s1 to @s2.' js=1}</span>';
var summary_translation_range_limit = '{l s='If the order is out of range, the behavior is to @s3.' js=1}';
var summary_translation_shipping_cost = '{l s='The shipping cost is calculated @s1 and the tax rule @s2 will be applied.' js=1}';
var summary_translation_price = '<strong>{l s='according to the price' js=1}</strong>';
var summary_translation_weight = '<strong>{l s='according to the weight' js=1}</strong>';
</script>
@@ -44,16 +42,16 @@
<div id="summary_shipping_cost"></div>
<div id="summary_range"></div>
<div>
{l s='It will be displayed only for the following zones:'}
{l s='This carrier will be proposed for those delivery zones:'}
<ul id="summary_zones"></ul>
</div>
<div>
{l s='It will be displayed only for the following groups:'}
{l s='And it will be proposed for those client groups:'}
<ul id="summary_groups"></ul>
</div>
{if $is_multishop}
<div>
{l s='It will be displayed only for the following shops:'}
{l s='Finally, this carrier will be proposed in those shops:'}
<ul id="summary_shops"></ul>
</div>
{/if}
@@ -56,11 +56,11 @@
{hook h="displayAdminHomeQuickLinks"}
</ul>
<div id="partner_preactivation">
<p class="center"><img src="../img/loader.gif" alt="" /></p>
<p class="center"><img src="../img/loader.gif" alt="" /> {l s='Loading...'}</p>
</div>
<div class="separation"></div>
{$tips_optimization}
<div id="discover_prestashop"><p class="center"><img src="../img/loader.gif" alt="" />{l s='Loading...'}</p></div>
<div id="discover_prestashop"><p class="center"><img src="../img/loader.gif" alt="" />&nbsp;{l s='Loading...'}</p></div>
{hook h="displayAdminHomeInfos"}
{hook h="displayBackOfficeHome"} {*old name of the hook*}
</div>
@@ -153,11 +153,36 @@ $(document).ready(function() {
{
// don't show/hide screencast if it's deactivated
{if $employee->bo_show_screencast}
$('#adminpresentation').fadeOut('slow');
$('#adminpresentation').fadeOut('slow');
{/if}
$('#partner_preactivation').fadeOut('slow');
$('#discover_prestashop').fadeOut('slow');
}
});
<<<<<<< HEAD
=======
$('#screencast_fancybox').bind('click', function(event)
{
$.fancybox(
this.href,
{
'width' : 920,
'height' : 384,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
'scrolling' : 'no',
'onComplete' : function()
{
// Rewrite some css properties of Fancybox
$('#fancybox-wrap').css('width', '');
$('#fancybox-content').css('background-color', '');
$('#fancybox-content').css( 'border', '');
}
});
event.preventDefault();
});
>>>>>>> db4b69d10c20e6fe6bbdfe5f08556cb57eeb2415
});
</script>
@@ -26,6 +26,10 @@
{include file="page_header_toolbar.tpl" toolbar_btn=$page_header_toolbar_btn title=$page_header_toolbar_title}
{/if}
{$localization_form}
{$localization_options}
<div class="width4">
{if isset($localization_form)}{$localization_form}{/if}
</div>
<br />
<div class="width4">
{if isset($localization_options)}{$localization_options}{/if}
</div>
@@ -23,134 +23,128 @@
* International Registered Trademark & Property of PrestaShop SA
*}
{if $product['customizedDatas']}
<tr class="customized customized-{$product['id_order_detail']|intval}">
<td align="center">
<tr class="customized customized-{$product['id_order_detail']|intval}">
<td align="center">
<input type="hidden" class="edit_product_id_order_detail" value="{$product['id_order_detail']|intval}" />
{if isset($product['image']) && $product['image']->id|intval}{$product['image_tag']}{else}--{/if}</td>
<td>
<a href="index.php?controller=adminproducts&id_product={$product['product_id']|intval}&updateproduct&token={getAdminToken tab='AdminProducts'}">
<span class="productName">{$product['product_name']} - {l s='Customized'}</span><br />
{if ($product['product_reference'])}{l s='Ref:'} {$product['product_reference']}<br />{/if}
{if ($product['product_supplier_reference'])}{l s='Ref Supplier:'} {$product['product_supplier_reference']}{/if}
</a>
</td>
<td align="center">
<span class="product_price_show">{displayPrice price=$product['product_price_wt'] currency=$currency->id|intval}</span>
{if $can_edit}
<span class="product_price_edit" style="display:none;">
<input type="hidden" name="product_id_order_detail" class="edit_product_id_order_detail" value="{$product['id_order_detail']|intval}" />
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="product_price_tax_excl" class="edit_product_price_tax_excl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_excl'], 2)}" size="5" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax excl.'}<br />
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="product_price_tax_incl" class="edit_product_price_tax_incl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_incl'], 2)}" size="5" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax incl.'}
</span>
{/if}
</td>
<td align="center" class="productQuantity">{$product['customizationQuantityTotal']}</td>
{if $display_warehouse}<td style="" align="center">&nbsp;</td>{/if}
{if ($order->hasBeenPaid())}<td align="center" class="productQuantity">{$product['customizationQuantityRefunded']}</td>{/if}
{if ($order->hasBeenDelivered() || $order->hasProductReturned())}<td align="center" class="productQuantity">{$product['customizationQuantityReturned']}</td>{/if}
{if $stock_management}<td align="center" class=""> - </td>{/if}
<td align="center" class="total_product">
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{displayPrice price=Tools::ps_round($product['product_price'] * $product['customizationQuantityTotal'], 2) currency=$currency->id|intval}
{else}
{displayPrice price=Tools::ps_round($product['product_price_wt'] * $product['customizationQuantityTotal'], 2) currency=$currency->id|intval}
{/if}
</td>
<td class="cancelQuantity standard_refund_fields current-edit" style="display:none" colspan="2">
&nbsp;
</td>
<td class="edit_product_fields" colspan="2" style="display:none">&nbsp;</td>
<td class="partial_refund_fields current-edit" style="text-align:left;display:none"></td>
{if ($can_edit && !$order->hasBeenDelivered())}
<td class="product_action" style="text-align:right">
<a href="#" class="edit_product_change_link"><img src="../img/admin/edit.gif" alt="{l s='Edit'}" /></a>
<input type="submit" class="button" name="submitProductChange" value="{l s='Update'}" style="display: none;" />
<a href="#" class="cancel_product_change_link" style="display: none;"><img src="../img/admin/disabled.gif" alt="{l s='Cancel'}" /></a>
<a href="#" class="delete_product_line"><img src="../img/admin/delete.gif" alt="{l s='Delete'}" /></a>
</td>
{/if}
</tr>
{foreach $product['customizedDatas'] as $customizationPerAddress}
{foreach $customizationPerAddress as $customizationId => $customization}
<tr class="customized customized-{$product['id_order_detail']|intval}">
<td colspan="2">
<input type="hidden" class="edit_product_id_order_detail" value="{$product['id_order_detail']|intval}" />
{if isset($product['image']) && $product['image']->id|intval}{$product['image_tag']}{else}--{/if}</td>
<td>
<a href="index.php?controller=adminproducts&id_product={$product['product_id']|intval}&updateproduct&token={getAdminToken tab='AdminProducts'}">
<span class="productName">{$product['product_name']} - {l s='Customized'}</span><br />
{if ($product['product_reference'])}{l s='Ref:'} {$product['product_reference']}<br />{/if}
{if ($product['product_supplier_reference'])}{l s='Ref Supplier:'} {$product['product_supplier_reference']}{/if}
</a>
</td>
<td align="center">
<span class="product_price_show">{displayPrice price=$product['product_price_wt'] currency=$currency->id|intval}</span>
{if $can_edit}
<span class="product_price_edit" style="display:none;">
<input type="hidden" name="product_id_order_detail" class="edit_product_id_order_detail" value="{$product['id_order_detail']|intval}" />
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="product_price_tax_excl" class="edit_product_price_tax_excl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_excl'], 2)}" size="5" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax excl.'}<br />
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="product_price_tax_incl" class="edit_product_price_tax_incl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_incl'], 2)}" size="5" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax incl.'}
</span>
{foreach $customization.datas as $type => $datas}
{if ($type == Product::CUSTOMIZE_FILE)}
<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">
{foreach from=$datas item=data}
<li style="margin: 2px;">
<span>{if $data['name']}{$data['name']}{else}{l s='Picture #'}{$data@iteration}{/if}{l s=':'}</span>&nbsp;
<a href="displayImage.php?img={$data['value']}&name={$order->id|intval}-file{$data@iteration}" target="_blank"><img src="{$smarty.const._THEME_PROD_PIC_DIR_}{$data['value']}_small" alt="" /></a>
</li>
{/foreach}
</ul>
{elseif ($type == Product::CUSTOMIZE_TEXTFIELD)}
<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">
{foreach from=$datas item=data}
<li>{if $data['name']}{l s='%s:' sprintf=$data['name']}{else}{l s='Text #%s:' sprintf=$data@iteration}{/if} {$data['value']}</li>
{/foreach}
</ul>
{/if}
</td>
<td align="center" class="productQuantity">{$product['customizationQuantityTotal']}</td>
{if ($order->hasBeenPaid())}<td align="center" class="productQuantity">{$product['customizationQuantityRefunded']}</td>{/if}
{if ($order->hasBeenDelivered() || $order->hasProductReturned())}<td align="center" class="productQuantity">{$product['customizationQuantityReturned']}</td>{/if}
{if $stock_management}<td align="center" class=""> - </td>{/if}
<td class="total_product text-right">
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{displayPrice price=Tools::ps_round($product['product_price'] * $product['customizationQuantityTotal'], 2) currency=$currency->id|intval}
{else}
{displayPrice price=Tools::ps_round($product['product_price_wt'] * $product['customizationQuantityTotal'], 2) currency=$currency->id|intval}
{/if}
</td>
<td class="cancelQuantity standard_refund_fields current-edit" style="display:none" colspan="2">
&nbsp;
</td>
<td class="edit_product_fields" colspan="2" style="display:none">&nbsp;</td>
<td class="partial_refund_fields current-edit" style="text-align:left;display:none"></td>
{if ($can_edit && !$order->hasBeenDelivered())}
<td class="product_action" style="text-align:right">
<a href="#" class="edit_product_change_link"><img src="../img/admin/edit.gif" alt="{l s='Edit'}" /></a>
<input type="submit" class="button" name="submitProductChange" value="{l s='Update'}" style="display: none;" />
<a href="#" class="cancel_product_change_link" style="display: none;"><img src="../img/admin/disabled.gif" alt="{l s='Cancel'}" /></a>
<a href="#" class="delete_product_line"><img src="../img/admin/delete.gif" alt="{l s='Delete'}" /></a>
</td>
{/if}
</tr>
{foreach $product['customizedDatas'] as $customizationPerAddress}
{foreach $customizationPerAddress as $customizationId => $customization}
<tr class="customized customized-{$product['id_order_detail']|intval}">
<td colspan="2">
<input type="hidden" class="edit_product_id_order_detail" value="{$product['id_order_detail']|intval}" />
{foreach $customization.datas as $type => $datas}
{if ($type == Product::CUSTOMIZE_FILE)}
<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">
{foreach from=$datas item=data}
<li style="margin: 2px;">
<span>{if $data['name']}{$data['name']}{else}{l s='Picture #'}{$data@iteration}{/if}{l s=':'}</span>&nbsp;
<a href="displayImage.php?img={$data['value']}&name={$order->id|intval}-file{$data@iteration}" target="_blank"><img src="{$smarty.const._THEME_PROD_PIC_DIR_}{$data['value']}_small" alt="" /></a>
</li>
{/foreach}
</ul>
{elseif ($type == Product::CUSTOMIZE_TEXTFIELD)}
<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">
{foreach from=$datas item=data}
<li>{if $data['name']}{l s='%s:' sprintf=$data['name']}{else}{l s='Text #%s:' sprintf=$data@iteration}{/if} {$data['value']}</li>
{/foreach}
</ul>
{/if}
{/foreach}
</td>
<td align="center">-
</td>
<td align="center" class="productQuantity">
<span class="product_quantity_show{if (int)$customization['quantity'] > 1} red bold{/if}">{$customization['quantity']}</span>
{if $can_edit}
<span class="product_quantity_edit" style="display:none;">
<input type="text" name="product_quantity[{$customizationId|intval}]" class="edit_product_quantity" value="{$customization['quantity']|htmlentities}" size="2" />
</span>
{/if}
</td>
{if ($order->hasBeenPaid())}<td align="center">{$customization['quantity_refunded']}</td>{/if}
{if ($order->hasBeenDelivered())}<td align="center">{$customization['quantity_returned']}</td>{/if}
<td align="center">
-
</td>
<td class="total_product text-right">
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{displayPrice price=Tools::ps_round($product['product_price'] * $customization['quantity'], 2) currency=$currency->id|intval}
{else}
{displayPrice price=Tools::ps_round($product['product_price_wt'] * $customization['quantity'], 2) currency=$currency->id|intval}
{/if}
</td>
<td align="center" class="cancelCheck standard_refund_fields current-edit" style="display:none">
<input type="hidden" name="totalQtyReturn" id="totalQtyReturn" value="{$customization['quantity_returned']|intval}" />
<input type="hidden" name="totalQty" id="totalQty" value="{$customization['quantity']|intval}" />
<input type="hidden" name="productName" id="productName" value="{$product['product_name']}" />
{if ((!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN')) AND (int)($customization['quantity_returned']) < (int)($customization['quantity']))}
<input type="checkbox" name="id_customization[{$customizationId|intval}]" id="id_customization[{$customizationId|intval}]" value="{$product['id_order_detail']|intval}" onchange="setCancelQuantity(this, {$customizationId|intval}, {$customization['quantity'] - $product['customizationQuantityTotal'] - $product['product_quantity_reinjected']})" {if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}disabled="disabled" {/if}/>
{else}
--
{/if}
</td>
<td class="cancelQuantity standard_refund_fields current-edit" style="display:none">
{if ($customization['quantity_returned'] + $customization['quantity_refunded'] >= $customization['quantity'])}
<input type="hidden" name="cancelCustomizationQuantity[{$customizationId|intval}]" value="0" />
{elseif (!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN'))}
<input type="text" id="cancelQuantity_{$customizationId|intval}" name="cancelCustomizationQuantity[{$customizationId|intval}]" size="2" onclick="selectCheckbox(this);" value="" />0/{$customization['quantity']-$customization['quantity_refunded']}
{/if}
</td>
<td class="partial_refund_fields current-edit" style="display:none">
<label class="text-center">
{l s='Quantity:'}
<input type="text" size="3" name="partialRefundProductQuantity[{$product['id_order_detail']|intval}]" value="0" />
0/{$customization['quantity']-$customization['quantity_refunded']}
</label>
<label class="text-center">
{l s='Amount:'}
{$currency->prefix}
<input type="text" size="3" name="partialRefundProduct[{$product['id_order_detail']|intval}]" />{$currency->suffix}
</label>
</td>
{if ($can_edit && !$order->hasBeenDelivered())}
<td class="edit_product_fields" colspan="2" style="display:none"></td>
<td class="product_action" class="text-right"></td>
{/if}
</tr>
{/foreach}
</td>
<td align="center">-
</td>
<td align="center" class="productQuantity">
<span class="product_quantity_show{if (int)$customization['quantity'] > 1} red bold{/if}">{$customization['quantity']}</span>
{if $can_edit}
<span class="product_quantity_edit" style="display:none;">
<input type="text" name="product_quantity[{$customizationId|intval}]" class="edit_product_quantity" value="{$customization['quantity']|htmlentities}" size="2" />
</span>
{/if}
</td>
{if $display_warehouse}<td style="" align="center">&nbsp;</td>{/if}
{if ($order->hasBeenPaid())}<td align="center">{$customization['quantity_refunded']}</td>{/if}
{if ($order->hasBeenDelivered())}<td align="center">{$customization['quantity_returned']}</td>{/if}
<td align="center">
-
</td>
<td align="center" class="total_product">
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{displayPrice price=Tools::ps_round($product['product_price'] * $customization['quantity'], 2) currency=$currency->id|intval}
{else}
{displayPrice price=Tools::ps_round($product['product_price_wt'] * $customization['quantity'], 2) currency=$currency->id|intval}
{/if}
</td>
<td align="center" class="cancelCheck standard_refund_fields current-edit" style="display:none">
<input type="hidden" name="totalQtyReturn" id="totalQtyReturn" value="{$customization['quantity_returned']|intval}" />
<input type="hidden" name="totalQty" id="totalQty" value="{$customization['quantity']|intval}" />
<input type="hidden" name="productName" id="productName" value="{$product['product_name']}" />
{if ((!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN')) AND (int)($customization['quantity_returned']) < (int)($customization['quantity']))}
<input type="checkbox" name="id_customization[{$customizationId|intval}]" id="id_customization[{$customizationId|intval}]" value="{$product['id_order_detail']|intval}" onchange="setCancelQuantity(this, {$customizationId|intval}, {$customization['quantity'] - $product['customizationQuantityTotal'] - $product['product_quantity_reinjected']})" {if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}disabled="disabled" {/if}/>
{else}
--
{/if}
</td>
<td class="cancelQuantity standard_refund_fields current-edit" style="display:none">
{if ($customization['quantity_returned'] + $customization['quantity_refunded'] >= $customization['quantity'])}
<input type="hidden" name="cancelCustomizationQuantity[{$customizationId|intval}]" value="0" />
{elseif (!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN'))}
<input type="text" id="cancelQuantity_{$customizationId|intval}" name="cancelCustomizationQuantity[{$customizationId|intval}]" size="2" onclick="selectCheckbox(this);" value="" />0/{$customization['quantity']-$customization['quantity_refunded']}
{/if}
</td>
<td class="partial_refund_fields current-edit" style="text-align:left;display:none">
<div style="width:40%;margin-top:5px;float:left">{l s='Quantity:'}</div> <div style="width:60%;margin-top:2px;float:left"><input type="text" size="3" name="partialRefundProductQuantity[{$product['id_order_detail']|intval}]" value="0" />
0/{$customization['quantity']-$customization['quantity_refunded']}
</div>
<div style="width:40%;margin-top:5px;float:left">{l s='Amount:'}</div> <div style="width:60%;margin-top:2px;float:left">{$currency->prefix}<input type="text" size="3" name="partialRefundProduct[{$product['id_order_detail']|intval}]" />{$currency->suffix}</div>
</td>
{if ($can_edit && !$order->hasBeenDelivered())}
<td class="edit_product_fields" colspan="2" style="display:none"></td>
<td class="product_action" style="text-align:right"></td>
{/if}
</tr>
{/foreach}
{/foreach}
{/if}
@@ -22,75 +22,57 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<tr id="new_product" style="display:none;">
<td colspan="2">
<input type="hidden" id="add_product_product_id" name="add_product[product_id]" value="0" />
<label class="control-label col-lg-8">
{l s='Product:'}
<input type="text" id="add_product_product_name" value="" />
</label>
<div id="add_product_product_attribute_area" style="display:none;">
<label class="control-label col-lg-8">
{l s='Combinations'}
<select name="add_product[product_attribute_id]" id="add_product_product_attribute_id"></select>
</label>
</div>
<div id="add_product_product_warehouse_area" style="display:none;">
<label class="control-label col-lg-8">
{l s='Warehouse'}
<select id="add_product_warehouse" name="add_product_warehouse"></select>
</label>
</div>
</td>
<td>
{if $currency->sign % 2}<span class="col-lg-2">{$currency->sign}</span>{/if}
<input class="col-lg-5" type="text" name="add_product[product_price_tax_excl]" id="add_product_product_price_tax_excl" value="" size="4" disabled="disabled" />
{if !($currency->sign % 2)}<span class="col-lg-2">{$currency->sign}</span>{/if}
<span>{l s='tax excl.'}</span>
<span class="col-lg-12"></span>
{if $currency->sign % 2}<span class="col-lg-2">{$currency->sign}</span>{/if}
<input class="col-lg-5" type="text" name="add_product[product_price_tax_incl]" id="add_product_product_price_tax_incl" value="" size="4" disabled="disabled" />
{if !($currency->sign % 2)}<span class="col-lg-2">{$currency->sign}</span>{/if}
<span>{l s='tax incl.'}</span>
</td>
<td class="text-center" class="productQuantity">
<input type="text" name="add_product[product_quantity]" id="add_product_product_quantity" value="1" size="3" disabled="disabled" />
</td>
{if ($order->hasBeenPaid())}<td align="center" class="productQuantity">&nbsp;</td>{/if}
{if ($order->hasBeenDelivered())}<td align="center" class="productQuantity">&nbsp;</td>{/if}
<td class="text-center" class="productQuantity" id="add_product_product_stock">0</td>
<td class="text-right" id="add_product_product_total">{displayPrice price=0 currency=$currency->id}</td>
<td class="text-center" colspan="2">
{if sizeof($invoices_collection)}
<select name="add_product[invoice]" id="add_product_product_invoice" disabled="disabled">
<optgroup class="existing" label="{l s='Existing'}">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}">{$invoice->getInvoiceNumberFormatted($current_id_lang)}</option>
{/foreach}
</optgroup>
<optgroup label="{l s='New'}">
<option value="0">{l s='Create a new invoice'}</option>
</optgroup>
<tr id="new_product" height="52" style="display:none;background-color:#e9f1f6">
<td style="display:none;" colspan="2">
<input type="hidden" id="add_product_product_id" name="add_product[product_id]" value="0" />
{l s='Product:'} <input type="text" id="add_product_product_name" value="" size="42" />
<div id="add_product_product_attribute_area" style="margin-top: 5px;display: none;">
{l s='Combinations'} <select name="add_product[product_attribute_id]" id="add_product_product_attribute_id"></select>
</div>
<div id="add_product_product_warehouse_area" style="margin-top: 5px; display: none;">
{l s='Warehouse'} <select id="add_product_warehouse" name="add_product_warehouse">
</select>
{/if}
</td>
<td>
<input type="button" class="btn btn-default" id="submitAddProduct" value="{l s='Add product'}" disabled="disabled" />
</td>
</tr>
<tr id="new_invoice" style="display:none;background-color:#e9f1f6;">
<td colspan="10">
<h3>{l s='New invoice information'}</h3>
<label>{l s='Carrier'}</label>
<div class="margin-form">
{$carrier->name}
</div>
<div class="margin-form">
<input type="checkbox" name="add_invoice[free_shipping]" value="1" />
<label class="t">{l s='Free shipping'}</label>
<p>{l s='If you don\'t select "Free shipping," the normal shipping cost will be applied.'}</p>
</div>
</td>
</tr>
</div>
</td>
<td style="display:none;">
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="add_product[product_price_tax_excl]" id="add_product_product_price_tax_excl" value="" size="4" disabled="disabled" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax excl.'}<br />
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="add_product[product_price_tax_incl]" id="add_product_product_price_tax_incl" value="" size="4" disabled="disabled" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax incl.'}<br />
</td>
<td style="display:none;" align="center" class="productQuantity"><input type="text" name="add_product[product_quantity]" id="add_product_product_quantity" value="1" size="3" disabled="disabled" /></td>
{if ($order->hasBeenPaid())}<td style="display:none;" align="center" class="productQuantity">&nbsp;</td>{/if}
{if $display_warehouse}<td style="" align="center">&nbsp;</td>{/if}
{if ($order->hasBeenDelivered())}<td style="display:none;" align="center" class="productQuantity">&nbsp;</td>{/if}
<td style="display:none;" align="center" class="productQuantity" id="add_product_product_stock">0</td>
<td style="display:none;" align="center" id="add_product_product_total">{displayPrice price=0 currency=$currency->id}</td>
<td style="display:none;" align="center" colspan="2">
{if sizeof($invoices_collection)}
<select name="add_product[invoice]" id="add_product_product_invoice" disabled="disabled">
<optgroup class="existing" label="{l s='Existing'}">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}">{$invoice->getInvoiceNumberFormatted($current_id_lang)}</option>
{/foreach}
</optgroup>
<optgroup label="{l s='New'}">
<option value="0">{l s='Create a new invoice'}</option>
</optgroup>
</select>
{/if}
</td>
<td style="display:none;">
<input type="button" class="button" id="submitAddProduct" value="{l s='Add product'}" disabled="disabled" />
</td>
</tr>
<tr id="new_invoice" style="display:none;background-color:#e9f1f6;">
<td colspan="10">
<h3>{l s='New invoice information'}</h3>
<label>{l s='Carrier'}</label>
<div class="margin-form">
{$carrier->name}
</div>
<div class="margin-form">
<input type="checkbox" name="add_invoice[free_shipping]" value="1" />
<label class="t">{l s='Free shipping'}</label>
<p>{l s='If you don\'t select "Free shipping," the normal shipping cost will be applied.'}</p>
</div>
</td>
</tr>
@@ -31,157 +31,124 @@
{/if}
{if ($product['product_quantity'] > $product['customizationQuantityTotal'])}
<tr{if isset($product.image) && $product.image->id && isset($product.image_size)} height="{$product['image_size'][1] + 7}"{/if}>
<td align="center">{if isset($product.image) && $product.image->id}{$product.image_tag}{/if}</td>
<td>
<a href="index.php?controller=adminproducts&id_product={$product['product_id']}&updateproduct&token={getAdminToken tab='AdminProducts'}">
<span class="productName">{$product['product_name']}</span><br />
{if $product.product_reference}{l s='Ref:'} {$product.product_reference}<br />{/if}
{if $product.product_supplier_reference}{l s='Ref Supplier:'} {$product.product_supplier_reference}{/if}
</a>
</td>
<td>
<span class="product_price_show">{displayPrice price=$product_price currency=$currency->id}</span>
{if $can_edit}
<span class="product_price_edit" style="display:none;">
<input type="hidden" name="product_id_order_detail" class="edit_product_id_order_detail" value="{$product['id_order_detail']}" />
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="product_price_tax_excl" class="edit_product_price_tax_excl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_excl'], 2)}" size="5" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax excl.'}<br />
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="product_price_tax_incl" class="edit_product_price_tax_incl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_incl'], 2)}" size="5" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax incl.'}
<tr{if isset($product.image) && $product.image->id && isset($product.image_size)} height="{$product['image_size'][1] + 7}"{/if}>
<td align="center">{if isset($product.image) && $product.image->id}{$product.image_tag}{/if}</td>
<td><a href="index.php?controller=adminproducts&id_product={$product['product_id']}&updateproduct&token={getAdminToken tab='AdminProducts'}">
<span class="productName">{$product['product_name']}</span><br />
{if $product.product_reference}{l s='Ref:'} {$product.product_reference}<br />{/if}
{if $product.product_supplier_reference}{l s='Ref Supplier:'} {$product.product_supplier_reference}{/if}
</a></td>
<td align="center">
<span class="product_price_show">{displayPrice price=$product_price currency=$currency->id}</span>
{if $can_edit}
<span class="product_price_edit" style="display:none;">
<input type="hidden" name="product_id_order_detail" class="edit_product_id_order_detail" value="{$product['id_order_detail']}" />
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="product_price_tax_excl" class="edit_product_price_tax_excl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_excl'], 2)}" size="5" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax excl.'}<br />
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="product_price_tax_incl" class="edit_product_price_tax_incl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_incl'], 2)}" size="5" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax incl.'}
</span>
{/if}
</td>
<td align="center" class="productQuantity">
<span class="product_quantity_show{if (int)$product['product_quantity'] > 1} red bold{/if}">{$product['product_quantity']}</span>
{if $can_edit}
<span class="product_quantity_edit" style="display:none;">
<input type="text" name="product_quantity" class="edit_product_quantity" value="{$product['product_quantity']|htmlentities}" size="2" />
</span>
{/if}
</td>
{if $display_warehouse}<td>{$product.warehouse_name|escape:'htmlall':'UTF-8'}</td>{/if}
{if ($order->hasBeenPaid())}
<td align="center" class="productQuantity">
{$product['product_quantity_refunded']}
{if count($product['refund_history'])}
<span class="tooltip">
<span class="tooltip_label tooltip_button">+</span>
<div class="tooltip_content">
<span class="title">{l s='Refund history'}</span>
{foreach $product['refund_history'] as $refund}
{l s='%1s - %2s' sprintf=[{dateFormat date=$refund.date_add}, {displayPrice price=$refund.amount_tax_incl}]}<br />
{/foreach}
</div>
</span>
{/if}
</td>
<td class="text-center" class="productQuantity">
<span class="product_quantity_show{if (int)$product['product_quantity'] > 1} red bold{/if}">{$product['product_quantity']}</span>
{if $can_edit}
<span class="product_quantity_edit" style="display:none;">
<input type="text" name="product_quantity" class="edit_product_quantity" value="{$product['product_quantity']|htmlentities}" size="2" />
</span>
{/if}
{if $order->hasBeenDelivered() || $order->hasProductReturned()}
<td align="center" class="productQuantity">
{$product['product_quantity_return']}
{if count($product['return_history'])}
<span class="tooltip">
<span class="tooltip_label tooltip_button">+</span>
<div class="tooltip_content">
<span class="title">{l s='Return history'}</span>
{foreach $product['return_history'] as $return}
{l s='%1s - %2s - %3s' sprintf=[{dateFormat date=$return.date_add}, $return.product_quantity, $return.state]}<br />
{/foreach}
</div>
</span>
{/if}
</td>
{if ($order->hasBeenPaid())}
<td class="text-center" class="productQuantity">
{$product['product_quantity_refunded']}
{if count($product['refund_history'])}
<label class="control-label">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Refund history:'} {foreach $product['refund_history'] as $refund}{l s='%1s - %2s' sprintf=[{dateFormat date=$refund.date_add}, {displayPrice price=$refund.amount_tax_incl}]}{/foreach}">
+
</span>
</label>
{/if}
</td>
{/if}
{if $order->hasBeenDelivered() || $order->hasProductReturned()}
<td class="text-center" class="productQuantity">
{$product['product_quantity_return']}
{if count($product['return_history'])}
<span class="tooltip">
<span class="tooltip_label tooltip_button">+</span>
<div class="tooltip_content">
<span class="title">{l s='Return history'}</span>
{foreach $product['return_history'] as $return}
{l s='%1s - %2s - %3s' sprintf=[{dateFormat date=$return.date_add}, $return.product_quantity, $return.state]}<br />
{/foreach}
</div>
</span>
{/if}
</td>
{/if}
{if $stock_management}<td class="text-center" class="productQuantity product_stock">{$product['current_stock']}</td>{/if}
<td class="total_product text-right">
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
</td>
<td colspan="2" style="display: none;" class="add_product_fields">&nbsp;</td>
<td class="text-center" class="cancelCheck standard_refund_fields current-edit" style="display:none">
<input type="hidden" name="totalQtyReturn" id="totalQtyReturn" value="{$product['product_quantity_return']}" />
<input type="hidden" name="totalQty" id="totalQty" value="{$product['product_quantity']}" />
<input type="hidden" name="productName" id="productName" value="{$product['product_name']}" />
{if ((!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN')) AND (int)($product['product_quantity_return']) < (int)($product['product_quantity']))}
<input type="checkbox" name="id_order_detail[{$product['id_order_detail']}]" id="id_order_detail[{$product['id_order_detail']}]" value="{$product['id_order_detail']}" onchange="setCancelQuantity(this, {$product['id_order_detail']}, {$product['product_quantity'] - $product['customizationQuantityTotal'] - $product['product_quantity_return']})" {if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}disabled="disabled" {/if}/>
{else}
--
{/if}
</td>
<td class="cancelQuantity standard_refund_fields current-edit" style="display:none">
{if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}
<input type="hidden" name="cancelQuantity[{$product['id_order_detail']}]" value="0" />
{elseif (!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN'))}
<input type="text" id="cancelQuantity_{$product['id_order_detail']}" name="cancelQuantity[{$product['id_order_detail']}]" size="2" onclick="selectCheckbox(this);" value="" />
{/if}
{/if}
{if $stock_management}<td align="center" class="productQuantity product_stock">{$product['current_stock']}</td>{/if}
<td align="center" class="total_product">
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
</td>
<td colspan="2" style="display: none;" class="add_product_fields">&nbsp;</td>
<td align="center" class="cancelCheck standard_refund_fields current-edit" style="display:none">
<input type="hidden" name="totalQtyReturn" id="totalQtyReturn" value="{$product['product_quantity_return']}" />
<input type="hidden" name="totalQty" id="totalQty" value="{$product['product_quantity']}" />
<input type="hidden" name="productName" id="productName" value="{$product['product_name']}" />
{if ((!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN')) AND (int)($product['product_quantity_return']) < (int)($product['product_quantity']))}
<input type="checkbox" name="id_order_detail[{$product['id_order_detail']}]" id="id_order_detail[{$product['id_order_detail']}]" value="{$product['id_order_detail']}" onchange="setCancelQuantity(this, {$product['id_order_detail']}, {$product['product_quantity'] - $product['customizationQuantityTotal'] - $product['product_quantity_return']})" {if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}disabled="disabled" {/if}/>
{else}
--
{/if}
</td>
<td class="cancelQuantity standard_refund_fields current-edit" style="display:none">
{if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}
<input type="hidden" name="cancelQuantity[{$product['id_order_detail']}]" value="0" />
{elseif (!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN'))}
<input type="text" id="cancelQuantity_{$product['id_order_detail']}" name="cancelQuantity[{$product['id_order_detail']}]" size="2" onclick="selectCheckbox(this);" value="" />
{/if}
{if $product['customizationQuantityTotal']}
{assign var=productQuantity value=($product['product_quantity']-$product['customizationQuantityTotal'])}
{else}
{assign var=productQuantity value=$product['product_quantity']}
{/if}
{if $product['customizationQuantityTotal']}
{assign var=productQuantity value=($product['product_quantity']-$product['customizationQuantityTotal'])}
{else}
{assign var=productQuantity value=$product['product_quantity']}
{/if}
{if ($order->hasBeenDelivered())}
{$product['product_quantity_refunded']}/{$productQuantity-$product['product_quantity_refunded']}
{elseif ($order->hasBeenPaid())}
{$product['product_quantity_return']}/{$productQuantity}
{if ($order->hasBeenDelivered())}
{$product['product_quantity_refunded']}/{$productQuantity-$product['product_quantity_refunded']}
{elseif ($order->hasBeenPaid())}
{$product['product_quantity_return']}/{$productQuantity}
{else}
0/{$productQuantity}
{/if}
</td>
<td class="partial_refund_fields current-edit" style="text-align:left;display:none">
<div style="width:40%;margin-top:5px;float:left">{l s='Quantity:'}</div> <div style="width:60%;margin-top:2px;float:left"><input onchange="checkPartialRefundProductQuantity(this)" type="text" size="3" name="partialRefundProductQuantity[{{$product['id_order_detail']}}]" value="0" /> 0/{$productQuantity-$product['product_quantity_refunded']}</div>
<div style="width:40%;margin-top:5px;float:left">{l s='Amount:'}</div> <div style="width:60%;margin-top:2px;float:left">{$currency->prefix}<input onchange="checkPartialRefundProductAmount(this)" type="text" size="3" name="partialRefundProduct[{$product['id_order_detail']}]" /> {$currency->suffix}</div> {if !empty($product['amount_refund']) && $product['amount_refund'] > 0}({l s='%s refund' sprintf=$product['amount_refund']}){/if}
<input type="hidden" value="{$product['quantity_refundable']}" class="partialRefundProductQuantity" />
<input type="hidden" value="{$product['amount_refundable']}" class="partialRefundProductAmount" />
</td>
{if ($can_edit && !$order->hasBeenDelivered())}
<td class="product_invoice" colspan="2" style="display: none;text-align:center;">
{if sizeof($invoices_collection)}
<select name="product_invoice" class="edit_product_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" {if $invoice->id == $product['id_order_invoice']}selected="selected"{/if}>#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang, null, $order->id_shop)}{'%06d'|sprintf:$invoice->number}</option>
{/foreach}
</select>
{else}
0/{$productQuantity}
&nbsp;
{/if}
</td>
<td class="partial_refund_fields current-edit" style="display:none">
<label class="text-center">
{l s='Quantity:'}
<input onchange="checkPartialRefundProductQuantity(this)" type="text" size="3" name="partialRefundProductQuantity[{{$product['id_order_detail']}}]" value="0" />
0/{$productQuantity-$product['product_quantity_refunded']}
</label>
<label class="text-center">
{l s='Amount:'}
{$currency->prefix}<input onchange="checkPartialRefundProductAmount(this)" type="text" size="3" name="partialRefundProduct[{$product['id_order_detail']}]" />
{$currency->suffix}
{if !empty($product['amount_refund']) && $product['amount_refund'] > 0}({l s='%s refund' sprintf=$product['amount_refund']}){/if}
<input type="hidden" value="{$product['quantity_refundable']}" class="partialRefundProductQuantity" />
<input type="hidden" value="{$product['amount_refundable']}" class="partialRefundProductAmount" />
</label>
</td>
{if ($can_edit && !$order->hasBeenDelivered())}
<td class="product_invoice" colspan="2" style="display: none;text-align:center;">
{if sizeof($invoices_collection)}
<select name="product_invoice" class="edit_product_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" {if $invoice->id == $product['id_order_invoice']}selected="selected"{/if}>#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang, null, $order->id_shop)}{'%06d'|sprintf:$invoice->number}</option>
{/foreach}
</select>
{else}
&nbsp;
{/if}
</td>
<td class="product_action">
<div class="btn-group btn-group-action">
<span class="btn btn-default btn-small">{l s='Choose an action'}</span>
<button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>&nbsp;
</button>
<ul class="dropdown-menu">
<li>
<a href="#" class="edit_product_change_link">
<i class="icon-pencil"></i>
{l s='Edit'}
</a>
</li>
<li>
<input type="submit" class="btn btn-default" name="submitProductChange" value="{l s='Update'}" style="display: none;" />
</li>
<li>
<a href="#" class="cancel_product_change_link" style="display: none;">
<i class="icon-remove"></i>
{l s='Cancel'}
</a>
</li>
<li>
<a href="#" class="delete_product_line">
<i class="icon-trash"></i>
{l s='Delete'}
</a>
</li>
</ul>
</div>
</td>
{/if}
</tr>
</td>
<td class="product_action" style="text-align:right">
<a href="#" class="edit_product_change_link"><img src="../img/admin/edit.gif" alt="{l s='Edit'}" /></a>
<input type="submit" class="button" name="submitProductChange" value="{l s='Update'}" style="display: none;" />
<a href="#" class="cancel_product_change_link" style="display: none;"><img src="../img/admin/disabled.gif" alt="{l s='Cancel'}" /></a>
<a href="#" class="delete_product_line"><img src="../img/admin/delete.gif" alt="{l s='Delete'}" /></a>
</td>
{/if}
</tr>
{/if}
@@ -117,7 +117,7 @@
$('#vouchers_err').hide();
var mytab = new Array();
for (var i = 0; i < data.vouchers.length; i++)
mytab[mytab.length] = { data: data.vouchers[i], value: data.vouchers[i].name+' - '+data.vouchers[i].description };
mytab[mytab.length] = { data: data.vouchers[i], value: data.vouchers[i].name + (data.vouchers[i].code.length > 0 ? ' - ' + data.vouchers[i].code : '')};
return mytab;
},
extraParams: {
@@ -694,17 +694,15 @@
function updateCartVouchers(vouchers)
{
var vouchers_html = '';
if (vouchers.length > 0)
{
$.each(vouchers, function() {
if (typeof(vouchers) == 'object')
$.each(vouchers, function(){
vouchers_html += '<tr><td>'+this.name+'</td><td>'+this.description+'</td><td>'+this.value_real+'</td><td><a href="#" class="delete_discount" rel="'+this.id_discount+'"><img src="../img/admin/delete.gif" /></a></td></tr>';
});
$('#voucher_list').show();
}
else
$('#voucher_list tbody').html($.trim(vouchers_html));
if ($('#voucher_list tbody').html().length == 0)
$('#voucher_list').hide();
$('#voucher_list tbody').html(vouchers_html);
else
$('#voucher_list').show();
}
function updateCartPaymentList(payment_list)
File diff suppressed because it is too large Load Diff
@@ -31,6 +31,14 @@
{if isset($modules_list)}
{$modules_list}
{/if}
<div class="space info">
{l s='This is where you decide what payment modules are available for different variations like your customers\' currency, group, and country.'}
<br />
{l s='A check mark indicates you want the payment module available.'}
{l s='If it is not checked then this means that the Payment module is disabled.'}
<br />
{l s='Please make sure to click Save for each section.'}
</div>
{if $display_restrictions}
{foreach $lists as $list}
{include file='controllers/payment/restrictions.tpl'}
@@ -39,4 +47,4 @@
<div class="alert alert-warning">{l s='No payment module installed'}</div>
{/if}
{/if}
{/block}
{/block}
@@ -40,6 +40,9 @@
</div>
{/if}
{$smarty.block.parent}
{if $input.type == 'radio' && $input.name == 'smarty_cache'}
<a href="{$current}&token={$token}&empty_smarty_cache=1" class="clear button" href="">{l s='Clear Smarty cache & Autoload cache'}</a>
{/if}
{/block}
{block name="description"}
@@ -161,6 +161,13 @@ function add_condition(id_condition_group, type, value)
function delete_condition(condition)
{
delete conditions[condition];
to_delete = $('#'+condition).prev();
if ($(to_delete).children().hasClass('btn_delete_condition'))
$(to_delete).remove();
else
$('#'+condition).next().remove();
$('#'+condition).remove();
return false;
}
@@ -178,7 +185,7 @@ function new_condition_group()
function appendConditionToGroup(html)
{
if ($('#condition_group_'+current_id_condition_group+' table tbody tr').length > 0)
$('#condition_group_'+current_id_condition_group+' table tbody').append('<tr><td align="center" colspan="3"><b>{l s='AND' js=1}</b></td></tr>');
$('#condition_group_'+current_id_condition_group+' table tbody').append('<tr><td align="center" class="btn_delete_condition" colspan="3"><b>{l s='AND' js=1}</b></td></tr>');
$('#condition_group_'+current_id_condition_group+' table tbody').append(html);
}
@@ -30,9 +30,9 @@
function ajaxStoreStates(id_state_selected)
{
$.ajax({
url: "ajax.php",
url: "index.php",
cache: false,
data: "ajaxStates=1&id_country="+$('#PS_SHOP_COUNTRY_ID').val() + "&id_state=" + $('#PS_SHOP_STATE_ID').val(),
data: "ajax=1&tab=AdminStates&token={getAdminToken tab='AdminStates'}&action=states&id_country="+$('#PS_SHOP_COUNTRY_ID').val() + "&id_state=" + $('#PS_SHOP_STATE_ID').val(),
success: function(html)
{
if (html == 'false')
@@ -60,9 +60,9 @@
$("#states-label").hide();
} else {
$.ajax({
url: "ajax.php",
url: "index.php",
cache: false,
data: "ajaxStates=1&id_country="+id_country+"&id_state="+id_state+"&empty_value={l s='All'}",
data: "ajax=1&tab=AdminStates&token={getAdminToken tab='AdminStates'}&action=states&id_country="+id_country+"&id_state="+id_state+"&empty_value={l s='All'}",
success: function(html){
if (html == "false")
{
@@ -88,10 +88,10 @@
{
$.ajax({
type: 'POST',
url: 'ajax.php',
url: 'index.php',
async: true,
dataType: 'json',
data: 'ajaxStates=1&ajaxUpdateTaxRule=1&id_tax_rule='+id_tax_rule,
data: 'ajax=1&tab=AdminTaxRulesGroup&token={getAdminToken tab='AdminTaxRulesGroup'}&ajaxStates=1&action=updateTaxRule&id_tax_rule='+id_tax_rule,
success: function(data){
$('#tax_rule_form').show();
$('#id_tax_rule').val(data.id);
@@ -33,46 +33,81 @@
{/if}
<form method="post" action="{$currentIndex}&{$identifier}&token={$token}&id_tax_rules_group={$id_tax_rules_group}&updatetax_rules_group#{$table}" class="form">
<fieldset>
<input type="hidden" id="submitFilter{$table}" name="submitFilter{$table}" value="0"/>
<table {if $table_id} id={$table_id}{/if} class="table {if $table_dnd}tableDnD{/if} {$table}">
<col width="10" />
{foreach $fields_display AS $key => $params}
<col {if isset($params.width) && $params.width != 'auto'}width="{$params.width}px"{/if}/>
{/foreach}
{if $shop_link_type}
<col width="80" />
{/if}
{if $has_actions}
<col width="52" />
{/if}
<thead>
<tr>
<th>
{if $has_bulk_actions}
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$table}Box[]', this.checked)" />
{/if}
</th>
<input type="hidden" id="submitFilter{$list_id}" name="submitFilter{$list_id}" value="0"/>
<table class="table_grid">
<tr>
<td style="vertical-align: bottom;">
<span style="float: left;">
{if $page > 1}
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$list_id}').value=1"/>&nbsp;
<input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$list_id}').value={$page - 1}"/>
{/if}
{l s='Page'} <b>{$page}</b> / {$total_pages}
{if $page < $total_pages}
<input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$list_id}').value={$page + 1};"/>&nbsp;
<input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$list_id}').value={$total_pages}"/>
{/if}
| {l s='Display'}
<select name="{$list_id}_pagination" onchange="submit()">
{* Choose number of results per page *}
{foreach $pagination AS $value}
<option value="{$value|intval}"{if $selected_pagination == $value} selected="selected" {elseif $selected_pagination == NULL && $value == $pagination[1]} selected="selected2"{/if}>{$value|intval}</option>
{/foreach}
</select>
/ {$list_total} {l s='result(s)'}
</span>
<span style="float: right;">
<input type="submit" name="submitReset{$list_id}" value="{l s='Reset'}" class="button" />
</span>
<span class="clear"></span>
</td>
</tr>
<tr>
<td>
<table
{if $table_id} id={$table_id}{/if}
class="table {if $table_dnd}tableDnD{/if} {$list_id}"
cellpadding="0" cellspacing="0"
style="width: 100%; margin-bottom:10px;"
>
<col width="10px" />
{foreach $fields_display AS $key => $params}
<th {if isset($params.align)} class="{$params.align}"{/if}>
{if isset($params.hint)}<span class="alert alert-info" name="help_box">{$params.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
<span class="title_box">
{$params.title}
</span>
</th>
<col {if isset($params.width) && $params.width != 'auto'}width="{$params.width}px"{/if}/>
{/foreach}
{if $shop_link_type}
<th>
{if $shop_link_type == 'shop'}
{l s='Shop'}
{else}
{l s='Group shop'}
{/if}
</th>
<col width="80px" />
{/if}
{if $has_actions}
<th>{l s='Actions'}<br />&nbsp;</th>
<col width="52px" />
{/if}
</tr>
</thead>
<thead>
<tr class="nodrag nodrop">
<th class="center">
{if $has_bulk_actions}
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$list_id}Box[]', this.checked)" />
{/if}
</th>
{foreach $fields_display AS $key => $params}
<th {if isset($params.align)} class="{$params.align}"{/if}>
{if isset($params.hint)}<span class="hint" name="help_box">{$params.hint}<span class="hint-pointer">&nbsp;</span></span>{/if}
<span class="title_box">
{$params.title}
</span>
<br />&nbsp;
</th>
{/foreach}
{if $shop_link_type}
<th>
{if $shop_link_type == 'shop'}
{l s='Shop'}
{else}
{l s='Group shop'}
{/if}
<br />&nbsp;
</th>
{/if}
{if $has_actions}
<th class="center">{l s='Actions'}<br />&nbsp;</th>
{/if}
</tr>
</thead>
+5 -4
View File
@@ -48,12 +48,13 @@
</div>
<div class="col-sm-7">
<a href="http://www.prestashop.com/en/contact_us/" target="_blank" class="footer_link">{l s='Contact'}</a>
|&nbsp;<a href="http://forge.prestashop.com" target="_blank" class="footer_link">{l s='Bug Tracker'}</a>
|&nbsp;<a href="http://www.prestashop.com/forums/" target="_blank" class="footer_link">{l s='Forum'}</a>
<a href="http://www.prestashop.com/en/contact_us?utm_source=backoffice_footer" target="_blank" class="footer_link">{l s='Contact'}</a>
|&nbsp;<a href="http://forge.prestashop.com/?utm_source=backoffice_footer" target="_blank" class="footer_link">{l s='Bug Tracker'}</a>
|&nbsp;<a href="http://www.prestashop.com/forums/?utm_source=backoffice_footer" target="_blank" class="footer_link">{l s='Forum'}</a>
|&nbsp;<a href="http://addons.prestashop.com/?utm_source=backoffice_footer" target="_blank" class="footer_link">{l s='Addons'}</a>
{if $iso_is_fr}
<p>Questions / Renseignements / Formations :
<strong>+33 (0)1.40.18.30.04</strong> de 09h &agrave; 18h
<strong>+33 (0)1.40.18.30.04</strong>
<p>
{/if}
</div>
@@ -600,7 +600,8 @@
};
{/foreach}
// we need allowEmployeeFormLang var in ajax request
allowEmployeeFormLang = {$allowEmployeeFormLang};
allowEmployeeFormLang = {$allowEmployeeFormLang|intval};
employee_token = '{getAdminToken tab='AdminEmployees'}';
displayFlags(languages, id_language, allowEmployeeFormLang);
$(document).ready(function() {
@@ -624,6 +625,7 @@
$(".textarea-autosize").autosize();
{/if}
});
state_token = '{getAdminToken tab='AdminStates'}';
{block name="script"}{/block}
</script>
{/if}
+1 -1
View File
@@ -1303,7 +1303,7 @@ abstract class AdminTabCore
}
$asso = Shop::getAssoTable($this->table);
if ($asso !== false && $assos['type'] == 'shop')
if ($asso !== false && $asso['type'] == 'shop')
{
$filterKey = $asso['type'];
$idenfierShop = Shop::getContextListShopID();
+8 -5
View File
@@ -142,12 +142,15 @@ class AttributeGroupCore extends ObjectModel
if (!AttributeGroup::cleanDeadCombinations())
return false;
/* Also delete related attributes */
if (Db::getInstance()->execute('
if (count($to_remove))
if (!Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'attribute_lang`
WHERE `id_attribute`
IN (SELECT id_attribute FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id.')') === false ||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id) === false)
return false;
WHERE `id_attribute` IN ('.implode(',', $to_remove).')') ||
!Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'attribute_shop`
WHERE `id_attribute` IN ('.implode(',', $to_remove).')') ||
!Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id))
return false;
$this->cleanPositions();
}
$return = parent::delete();
+7 -13
View File
@@ -80,9 +80,8 @@ class Autoload
if (strpos(strtolower($classname), 'smarty_') === 0)
return;
// regenerate the class index if the requested class is not found in the index or if the requested file doesn't exists
if (!isset($this->index[$classname])
|| ($this->index[$classname] && !is_file($this->root_dir.$this->index[$classname]))
// regenerate the class index if the requested file doesn't exists
if ((isset($this->index[$classname]) && $this->index[$classname] && !is_file($this->root_dir.$this->index[$classname]))
|| (isset($this->index[$classname.'Core']) && $this->index[$classname.'Core'] && !is_file($this->root_dir.$this->index[$classname.'Core'])))
$this->generateIndex();
@@ -138,18 +137,14 @@ class Autoload
{
$filename_tmp = tempnam(dirname($filename), basename($filename.'.'));
if($filename_tmp !== FALSE and file_put_contents($filename_tmp, $content, LOCK_EX) !== FALSE)
{
rename($filename_tmp, $filename);
@chmod($filename, 0664);
{
@rename($filename_tmp, $filename);
@chmod($filename, 0666);
}
else
{
// $filename_tmp couldn't be written. $filename should be there anyway (even if outdated),
// no need to die.
else
// $filename_tmp couldn't be written. $filename should be there anyway (even if outdated), no need to die.
error_log('Cannot write temporary file '.$filename_tmp);
}
}
$this->index = $classes;
}
@@ -192,4 +187,3 @@ class Autoload
return isset($this->index[$classname]) ? $this->index[$classname] : null;
}
}
+5 -5
View File
@@ -775,11 +775,11 @@ class CarrierCore extends ObjectModel
if ($delete)
Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'delivery`
WHERE id_shop = '.(int)$values['id_shop'].'
AND id_shop_group='.(int)$values['id_shop_group'].'
WHERE '.(is_null($values['id_shop']) ? 'ISNULL(`id_shop`) ' : 'id_shop = '.(int)$values['id_shop']).'
AND '.(is_null($values['id_shop_group']) ? 'ISNULL(`id_shop`) ' : 'id_shop_group='.(int)$values['id_shop_group']).'
AND id_carrier='.(int)$values['id_carrier'].
($values['id_range_price'] !== null ? ' AND id_range_price='.(int)$values['id_range_price'] : '').
($values['id_range_weight'] !== null ? ' AND id_range_weight='.(int)$values['id_range_weight'] : '').'
($values['id_range_price'] !== null ? ' AND id_range_price='.(int)$values['id_range_price'] : ' AND (ISNULL(`id_range_price`) OR `id_range_price` = 0)').
($values['id_range_weight'] !== null ? ' AND id_range_weight='.(int)$values['id_range_weight'] : ' AND (ISNULL(`id_range_weight`) OR `id_range_weight` = 0)').'
AND id_zone='.(int)$values['id_zone']
);
@@ -1291,7 +1291,7 @@ class CarrierCore extends ObjectModel
{
if ($delete)
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier = '.(int)$this->id);
if (!count($groups))
if (!is_array($groups) || !count($groups))
return true;
$sql = 'INSERT INTO '._DB_PREFIX_.'carrier_group (id_carrier, id_group) VALUES ';
foreach ($groups as $id_group)
+16 -6
View File
@@ -762,10 +762,11 @@ class CartCore extends ObjectModel
{
// You can't add a cart rule that does not exist
$cartRule = new CartRule($id_cart_rule, Context::getContext()->language->id);
if (!Validate::isLoadedObject($cartRule))
return false;
if (Db::getInstance()->getValue('SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$this->id))
if (Db::getInstance()->getValue('SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart_rule = '.(int)$id_cart_rule.' AND id_cart = '.(int)$this->id))
return false;
// Add the cart rule to the cart
@@ -3415,6 +3416,7 @@ class CartCore extends ObjectModel
*/
public function setNoMultishipping()
{
$emptyCache = $result = false;
if (Configuration::get('PS_ALLOW_MULTISHIPPING'))
{
// Upgrading quantities
@@ -3433,7 +3435,9 @@ class CartCore extends ObjectModel
AND `id_shop` = '.(int)$this->id_shop.'
AND id_product = '.$product['id_product'].'
AND id_product_attribute = '.$product['id_product_attribute'];
Db::getInstance()->execute($sql);
$result = Db::getInstance()->execute($sql);
if ($result)
$emptyCache = true;
}
// Merging multiple lines
@@ -3451,15 +3455,18 @@ class CartCore extends ObjectModel
}
// Update delivery address for each product line
Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'cart_product`
$sql = 'UPDATE `'._DB_PREFIX_.'cart_product`
SET `id_address_delivery` = (
SELECT `id_address_delivery` FROM `'._DB_PREFIX_.'cart`
WHERE `id_cart` = '.(int)$this->id.' AND `id_shop` = '.(int)$this->id_shop.'
)
WHERE `id_cart` = '.(int)$this->id.'
'.(Configuration::get('PS_ALLOW_MULTISHIPPING') ? ' AND `id_shop` = '.(int)$this->id_shop : ''));
'.(Configuration::get('PS_ALLOW_MULTISHIPPING') ? ' AND `id_shop` = '.(int)$this->id_shop : '');
$result = Db::getInstance()->execute($sql);
if ($result)
$emptyCache = true;
if (Customization::isFeatureActive())
Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'customization`
@@ -3468,6 +3475,9 @@ class CartCore extends ObjectModel
WHERE `id_cart` = '.(int)$this->id.'
)
WHERE `id_cart` = '.(int)$this->id);
if ($emptyCache)
$this->_products = null;
}
/**
+8 -3
View File
@@ -464,7 +464,7 @@ class CartRuleCore extends ObjectModel
// Check if the products chosen by the customer are usable with the cart rule
if ($this->product_restriction)
{
$r = $this->checkProductRestrictions($context, false, $display_error);
$r = $this->checkProductRestrictions($context, false, $display_error, $alreadyInCart);
if ($r !== false && $display_error)
return $r;
elseif (!$r && !$display_error)
@@ -523,6 +523,7 @@ class CartRuleCore extends ObjectModel
return (!$display_error) ? false : Tools::displayError('This voucher is already in your cart');
if ($otherCartRule['gift_product'])
--$nb_products;
if ($this->cart_rule_restriction && $otherCartRule['cart_rule_restriction'] && $otherCartRule['id_cart_rule'] != $this->id)
{
$combinable = Db::getInstance()->getValue('
@@ -550,7 +551,7 @@ class CartRuleCore extends ObjectModel
return true;
}
protected function checkProductRestrictions(Context $context, $return_products = false, $display_error = true)
protected function checkProductRestrictions(Context $context, $return_products = false, $display_error = true, $alreadyInCart = false)
{
$selectedProducts = array();
@@ -585,6 +586,8 @@ class CartRuleCore extends ObjectModel
if (in_array($cartAttribute['id_attribute'], $productRule['values']))
{
$countMatchingProducts += $cartAttribute['quantity'];
if ($alreadyInCart && $this->gift_product == $cartProduct['id_product']&& $this->gift_product_attribute == $cartProduct['id_product_attribute'])
--$countMatchingProducts;
$matchingProductsList[] = $cartAttribute['id_product'].'-'.$cartAttribute['id_product_attribute'];
}
if ($countMatchingProducts < $productRuleGroup['quantity'])
@@ -603,6 +606,8 @@ class CartRuleCore extends ObjectModel
if (in_array($cartProduct['id_product'], $productRule['values']))
{
$countMatchingProducts += $cartProduct['quantity'];
if ($alreadyInCart && $this->gift_product == $cartProduct['id_product'])
--$countMatchingProducts;
$matchingProductsList[] = $cartProduct['id_product'].'-0';
}
if ($countMatchingProducts < $productRuleGroup['quantity'])
@@ -1185,7 +1190,7 @@ class CartRuleCore extends ObjectModel
SELECT cr.*, crl.*
FROM '._DB_PREFIX_.'cart_rule cr
LEFT JOIN '._DB_PREFIX_.'cart_rule_lang crl ON (cr.id_cart_rule = crl.id_cart_rule AND crl.id_lang = '.(int)$id_lang.')
WHERE code LIKE \'%'.pSQL($name).'%\'
WHERE code LIKE \'%'.pSQL($name).'%\' OR name LIKE \'%'.pSQL($name).'%\'
');
}
}
+1
View File
@@ -135,6 +135,7 @@ class CombinationCore extends ObjectModel
{
$result = Db::getInstance()->delete('product_attribute_combination', '`id_product_attribute` = '.(int)$this->id);
$result &= Db::getInstance()->delete('cart_product', '`id_product_attribute` = '.(int)$this->id);
$result &= Db::getInstance()->delete('product_attribute_image', '`id_product_attribute` = '.(int)$this->id);
return $result;
}
+1 -1
View File
@@ -97,7 +97,7 @@ class ConnectionCore extends ObjectModel
'id_connections' => (int)$cookie->id_connections,
'id_page' => (int)$id_page,
'time_start' => $time_start
));
), false, true, Db::INSERT_IGNORE);
// This array is serialized and used by the ajax request to identify the page
return array(
+7 -4
View File
@@ -369,7 +369,7 @@ class DispatcherCore
// If there are several languages, get language from uri
if ($this->use_routes && Language::isMultiLanguageActivated())
if (preg_match('#^/([a-z]{2})/#', $this->request_uri, $m))
if (preg_match('#^/([a-z]{2})/?#', $this->request_uri, $m))
{
$_GET['isolang'] = $m[1];
$this->request_uri = substr($this->request_uri, 3);
@@ -549,6 +549,9 @@ class DispatcherCore
if ($id_shop === null)
$id_shop = (int)Context::getContext()->shop->id;
if (!isset($this->routes[$id_shop]))
$this->loadRoutes($id_shop);
if (!isset($this->routes[$id_shop]) || !isset($this->routes[$id_shop][$id_lang]) || !isset($this->routes[$id_shop][$id_lang][$route_id]))
return false;
@@ -591,14 +594,14 @@ class DispatcherCore
if ($id_shop === null)
$id_shop = (int)Context::getContext()->shop->id;
if ($this->use_routes && !isset($this->routes[$id_shop]))
if (!isset($this->routes[$id_shop]))
$this->loadRoutes($id_shop);
if (!isset($this->routes[$id_shop][$id_lang][$route_id]))
{
$query = http_build_query($params, '', '&');
$index_link = $this->use_routes ? '' : 'index.php';
return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : 'index.php?controller='.$route_id.(($query) ? '&'.$query : '').$anchor;
return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((trim($route_id) == '') ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor;
}
$route = $this->routes[$id_shop][$id_lang][$route_id];
// Check required fields
+5 -2
View File
@@ -251,8 +251,8 @@ class EmployeeCore extends ObjectModel
{
/* Employee is valid only if it can be load and if cookie password is the same as database one */
Cache::store('isLoggedBack'.$this->id, (
$this->id && Validate::isUnsignedId($this->id) && Employee::checkPassword($this->id, $this->passwd)
&& (!isset($this->remote_addr) || $this->remote_addr == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))
$this->id && Validate::isUnsignedId($this->id) && Employee::checkPassword($this->id, Context::getContext()->cookie->passwd)
&& (!isset(Context::getContext()->cookie->remote_addr) || Context::getContext()->cookie->remote_addr == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))
));
}
return Cache::retrieve('isLoggedBack'.$this->id);
@@ -264,7 +264,10 @@ class EmployeeCore extends ObjectModel
public function logout()
{
if (isset(Context::getContext()->cookie))
{
Context::getContext()->cookie->logout();
Context::getContext()->cookie->write();
}
$this->id = null;
}
+2 -3
View File
@@ -110,6 +110,7 @@ class HookCore extends ObjectModel
*/
public static function getIdByName($hook_name)
{
$hook_name = strtolower($hook_name);
if (!Validate::isHookName($hook_name))
return false;
@@ -126,9 +127,7 @@ class HookCore extends ObjectModel
FROM `'._DB_PREFIX_.'hook_alias` ha
INNER JOIN `'._DB_PREFIX_.'hook` h ON ha.name = h.name');
foreach ($result as $row)
{
$hook_ids[$row['name']] = $row['id_hook'];
}
$hook_ids[strtolower($row['name'])] = $row['id_hook'];
Cache::store($cache_id, $hook_ids);
}
else
+14 -8
View File
@@ -120,16 +120,22 @@ class ImageCore extends ObjectModel
*
* @param integer $id_lang Language ID
* @param integer $id_product Product ID
* @param integer $id_product_attribute Product Attribute ID
* @return array Images
*/
public static function getImages($id_lang, $id_product)
public static function getImages($id_lang, $id_product, $id_product_attribute = NULL)
{
return Db::getInstance()->executeS('
SELECT *
FROM `'._DB_PREFIX_.'image` i
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)
WHERE i.`id_product` = '.(int)$id_product.' AND il.`id_lang` = '.(int)$id_lang.'
ORDER BY i.`position` ASC');
$attribute_filter = ($id_product_attribute ? ' AND ai.`id_product_attribute` = '.(int)$id_product_attribute : '');
$sql = 'SELECT *
FROM `'._DB_PREFIX_.'image` i
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)';
if ($id_product_attribute)
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` ai ON (i.`id_image` = ai.`id_image`)';
$sql .= ' WHERE i.`id_product` = '.(int)$id_product.' AND il.`id_lang` = '.(int)$id_lang . $attribute_filter.'
ORDER BY i.`position` ASC';
return Db::getInstance()->executeS($sql);
}
/**
@@ -644,7 +650,7 @@ class ImageCore extends ObjectModel
*/
public static function testFileSystem()
{
$safe_mode = ini_get('safe_mode');
$safe_mode = Tools::getSafeModeStatus();
if ($safe_mode)
return false;
$folder1 = _PS_PROD_IMG_DIR_.'testfilesystem/';
+31 -14
View File
@@ -70,7 +70,7 @@ class LanguageCore extends ObjectModel
/** @var array Languages cache */
protected static $_checkedLangs;
protected static $_LANGUAGES;
protected static $countActiveLanguages;
protected static $countActiveLanguages = array();
protected $webserviceParameters = array(
'objectNodeName' => 'language',
@@ -111,18 +111,22 @@ class LanguageCore extends ObjectModel
$iso_code = $newIso ? $newIso : $this->iso_code;
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code))
mkdir(_PS_TRANSLATIONS_DIR_.$iso_code);
{
if (@mkdir(_PS_TRANSLATIONS_DIR_.$iso_code))
@chmod(_PS_TRANSLATIONS_DIR_.$iso_code, 0777);
}
foreach ($this->translationsFilesAndVars as $file => $var)
{
$path_file = _PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php';
if (!file_exists($path_file))
if ($file != 'tabs')
file_put_contents($path_file, '<?php
@file_put_contents($path_file, '<?php
global $'.$var.';
$'.$var.' = array();
?>');
else
file_put_contents($path_file, '<?php
@file_put_contents($path_file, '<?php
$'.$var.' = array();
return $'.$var.';
?>');
@@ -460,7 +464,8 @@ class LanguageCore extends ObjectModel
}
closedir($handle);
}
rmdir($dir);
if (is_writable($dir))
rmdir($dir);
}
public function delete()
@@ -519,7 +524,7 @@ class LanguageCore extends ObjectModel
'-default-'.ImageType::getFormatedName('medium').'.jpg',
'-default-'.ImageType::getFormatedName('small').'.jpg'
);
$image_directories = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
$images_directories = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
foreach ($images_directories as $image_directory)
foreach ($images as $image)
{
@@ -756,15 +761,18 @@ class LanguageCore extends ObjectModel
return (isset(self::$_cache_language_installation[$iso_code]) ? self::$_cache_language_installation[$iso_code] : false);
}
public static function countActiveLanguages()
public static function countActiveLanguages($id_shop = null)
{
if (!self::$countActiveLanguages)
self::$countActiveLanguages = Db::getInstance()->getValue('
if ($id_shop === null)
$id_shop = (int)Context::getContext()->shop->id;
if (!isset(self::$countActiveLanguages[$id_shop]))
self::$countActiveLanguages[$id_shop] = Db::getInstance()->getValue('
SELECT COUNT(DISTINCT l.id_lang) FROM `'._DB_PREFIX_.'lang` l
'.Shop::addSqlAssociation('lang', 'l').'
JOIN '._DB_PREFIX_.'lang_shop lang_shop ON (lang_shop.id_lang = l.id_lang AND lang_shop.id_shop = '.(int)$id_shop.')
WHERE l.`active` = 1
');
return self::$countActiveLanguages;
return self::$countActiveLanguages[$id_shop];
}
public static function downloadAndInstallLanguagePack($iso, $version = null, $params = null)
@@ -780,13 +788,22 @@ class LanguageCore extends ObjectModel
$lang_pack_ok = false;
$errors = array();
$file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip';
if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$version.'&iso_lang='.Tools::strtolower($iso)))
$errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link))
$errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.Tools::strtolower($lang_pack->iso_code.'.gzip')))
if (!@file_put_contents($file, $content))
$errors[] = Tools::displayError('Server does not have permissions for writing.');
{
if (is_writable(dirname($file)))
{
@unlink($file);
@file_put_contents($file, $content);
}
elseif (!is_writable($file))
$errors[] = Tools::displayError('Server does not have permissions for writing.').' ('.$file.')';
}
if (file_exists($file))
{
$gz = new Archive_Tar($file, true);
@@ -819,8 +836,8 @@ class LanguageCore extends ObjectModel
* @since 1.5.0
* @return bool
*/
public static function isMultiLanguageActivated()
public static function isMultiLanguageActivated($id_shop = null)
{
return (Language::countActiveLanguages() > 1);
return (Language::countActiveLanguages($id_shop) > 1);
}
}
+33 -21
View File
@@ -96,14 +96,14 @@ class LinkCore
else
$shop = Context::getContext()->shop;
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
if (!is_object($product))
{
if (is_array($product) && isset($product['id_product']))
$product = new Product($product['id_product'], false, $id_lang);
$product = new Product($product['id_product'], false, $id_lang, $id_shop);
elseif ((int)$product)
$product = new Product((int)$product, false, $id_lang);
$product = new Product((int)$product, false, $id_lang, $id_shop);
else
throw new PrestaShopException('Invalid product vars');
}
@@ -167,7 +167,7 @@ class LinkCore
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
if (!is_object($category))
$category = new Category($category, $id_lang);
@@ -210,7 +210,7 @@ class LinkCore
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance();
if (!is_object($cms_category))
@@ -241,8 +241,6 @@ class LinkCore
*/
public function getCMSLink($cms, $alias = null, $ssl = false, $id_lang = null, $id_shop = null)
{
$base = (($ssl && $this->ssl_enable) ? 'https://' : 'http://');
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
@@ -250,7 +248,9 @@ class LinkCore
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = $base.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
$base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain);
$url = $base.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance();
@@ -294,7 +294,7 @@ class LinkCore
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance();
if (!is_object($supplier))
@@ -331,7 +331,7 @@ class LinkCore
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance();
if (!is_object($manufacturer))
@@ -362,8 +362,6 @@ class LinkCore
*/
public function getModuleLink($module, $controller = 'default', array $params = array(), $ssl = false, $id_lang = null, $id_shop = null)
{
$base = (($ssl && $this->ssl_enable) ? 'https://' : 'http://');
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
@@ -371,17 +369,20 @@ class LinkCore
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = $base.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
// Set available keywords
$params['module'] = $module;
$params['controller'] = $controller ? $controller : 'default';
$base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain);
$url = $base.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
// If the module has its own route ... just use it !
if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang, $id_shop))
return $this->getPageLink('module-'.$module.'-'.$controller, $ssl, $id_lang, $params);
else
{
// Set available keywords
$params['module'] = $module;
$params['controller'] = $controller ? $controller : 'default';
return $url.Dispatcher::getInstance()->createUrl('module', $id_lang, $params, $this->allow, '', $id_shop);
}
}
/**
@@ -474,8 +475,9 @@ class LinkCore
$shop = new Shop($id_shop);
$uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request, false, '', $id_shop);
$url = ($ssl && $this->ssl_enable) ? 'https://' : 'http://';
$url .= $shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang).ltrim($uri_path, '/');
$url = ($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain;
$url .= $shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop).ltrim($uri_path, '/');
return $url;
}
@@ -509,6 +511,7 @@ class LinkCore
unset($params['id_lang']);
$controller = Dispatcher::getInstance()->getController();
if (!empty(Context::getContext()->controller->php_self))
$controller = Context::getContext()->controller->php_self;
@@ -524,6 +527,15 @@ class LinkCore
return $this->getCMSLink((int)$params['id_cms'], null, false, (int)$id_lang);
elseif ($controller == 'cms' && isset($params['id_cms_category']))
return $this->getCMSCategoryLink((int)$params['id_cms_category'], null, (int)$id_lang);
elseif (isset($params['fc']) && $params['fc'] == 'module')
{
$module = Validate::isModuleName(Tools::getValue('module')) ? Tools::getValue('module') : '';
if (!empty($module))
{
unset($params['fc'], $params['module']);
return $this->getModuleLink($module, $controller, $params, false, (int)$id_lang);
}
}
return $this->getPageLink($controller, false, $id_lang, $params);
}
@@ -618,12 +630,12 @@ class LinkCore
return $url.(!strstr($url, '?') ? '?' : '&').'orderby='.urlencode($orderby).'&orderway='.urlencode($orderway);
}
protected function getLangLink($id_lang = null, Context $context = null)
protected function getLangLink($id_lang = null, Context $context = null, $id_shop = null)
{
if (!$context)
$context = Context::getContext();
if (!$this->allow || !Language::isMultiLanguageActivated())
if ((!$this->allow && in_array($id_shop, array($context->shop->id, null))) || !Language::isMultiLanguageActivated($id_shop) || !(int)Configuration::get('PS_REWRITING_SETTINGS', null, null, $id_shop))
return '';
if (!$id_lang)
+5
View File
@@ -149,6 +149,11 @@ class LoggerCore extends ObjectModel
return $this->hash;
}
public static function eraseAllLogs()
{
return Db::getInstance()->execute('TRUNCATE TABLE '._DB_PREFIX_.'log');
}
/**
* check if this log message already exists in database.
+74 -6
View File
@@ -50,10 +50,11 @@ class MailCore
* @param bool $modeSMTP
* @param string $template_path
* @param bool $die
* @param string $bcc Bcc recipient
*/
public static function Send($id_lang, $template, $subject, $template_vars, $to,
$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null,
$template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null)
$template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null)
{
$configuration = Configuration::getMultiple(array(
'PS_SHOP_EMAIL',
@@ -127,9 +128,9 @@ class MailCore
}
/* Construct multiple recipients list if needed */
$to_list = new Swift_RecipientList();
if (is_array($to) && isset($to))
{
$to_list = new Swift_RecipientList();
foreach ($to as $key => $addr)
{
$to_name = null;
@@ -150,20 +151,23 @@ class MailCore
if (function_exists('mb_encode_mimeheader'))
$to_list->addTo($addr, mb_encode_mimeheader($to_name, 'utf-8'));
else
$to_list->addTo($addr, '=?UTF-8?B?'.base64_encode($to_name).'?=');
$to_list->addTo($addr, self::mimeEncode($to_name));
}
$to_plugin = $to[0];
$to = $to_list;
} else {
/* Simple recipient, one address */
$to_plugin = $to;
if ($to_name == null)
$to_name = $to;
if (function_exists('mb_encode_mimeheader'))
$to = new Swift_Address($to, mb_encode_mimeheader($to_name, 'utf-8'));
$to_list->addTo($to, mb_encode_mimeheader($to_name, 'utf-8'));
else
$to = new Swift_Address($to, '=?UTF-8?B?'.base64_encode($to_name).'?=');
$to_list->addTo($to, self::mimeEncode($to_name));
}
if(isset($bcc)) {
$to_list->addBcc($bcc);
}
$to = $to_list;
try {
/* Connect with the appropriate configuration */
if ($configuration['PS_MAIL_METHOD'] == 2)
@@ -381,4 +385,68 @@ class MailCore
return vsprintf("<%s.%d.%s@%s>", $midparams);
}
public static function isMultibyte($data)
{
$length = strlen($data);
for ($i = 0; $i < $length; $i++)
{
$result = ord(($data[$i]));
if ($result > 128)
{
return true;
}
}
return false;
}
public static function mimeEncode($string, $charset = 'UTF-8', $newline = "\r\n")
{
if (!self::isMultibyte($string) && strlen($string) < 75)
{
return $string;
}
$charset = strtoupper($charset);
$start = '=?' . $charset . '?B?';
$end = '?=';
$sep = $end . $newline . ' ' . $start;
$length = 75 - strlen($start) - strlen($end);
$length = $length - ($length % 4);
if ($charset === 'UTF-8')
{
$parts = array();
$maxchars = floor(($length * 3) / 4);
$stringLength = strlen($string);
while ($stringLength > $maxchars)
{
$i = (int)$maxchars;
$result = ord($string[$i]);
while ($result >= 128 && $result <= 191)
{
$i--;
$result = ord($string[$i]);
}
$parts[] = base64_encode(substr($string, 0, $i));
$string = substr($string, $i);
$stringLength = strlen($string);
}
$parts[] = base64_encode($string);
$string = implode($sep, $parts);
}
else
{
$string = chunk_split(base64_encode($string), $length, $sep);
$string = preg_replace('/' . preg_quote($sep) . '$/', '', $string);
}
return $start . $string . $end;
}
}
+1 -1
View File
@@ -79,7 +79,7 @@ class ManufacturerCore extends ObjectModel
// Lang fields
'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
'short_description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 254),
'short_description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
+6 -2
View File
@@ -111,7 +111,8 @@ class MediaCore
// In this case, we don't compress the content
if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR)
{
error_log('ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML');
if (_PS_MODE_DEV_)
error_log('ERROR: PREG_BACKTRACK_LIMIT_ERROR in function packJSinHTML');
return $html_content_copy;
}
return $html_content;
@@ -200,7 +201,7 @@ class MediaCore
if (!preg_match('/^http(s?):\/\//i', $file_uri) && !@filemtime($file_uri))
return false;
if (Context::getContext()->controller->controller_type == 'admin')
if (Context::getContext()->controller->controller_type == 'admin' && !array_key_exists('host', $url_data))
{
$js_uri = preg_replace('/^'.preg_quote(__PS_BASE_URI__, '/').'/', '/', $js_uri);
$js_uri = dirname(preg_replace('/\?.+$/', '', $_SERVER['REQUEST_URI']).'a').'/..'.$js_uri;
@@ -271,6 +272,9 @@ class MediaCore
if ($add_no_conflict)
$return[] = Media::getJSPath(_PS_JS_DIR_.'jquery/jquery.noConflict.php?version='.$version);
//added query migrate for compatibility with new version of jquery will be removed in ps 1.6
$return[] = Media::getJSPath(_PS_JS_DIR_.'jquery/jquery-migrate-1.2.1.js');
return $return;
}
+5 -2
View File
@@ -68,8 +68,11 @@ class MetaCore extends ObjectModel
{
if ($file != 'index.php' && !in_array(strtolower(str_replace('Controller.php', '', $file)), $exlude_pages))
{
$reflection = new ReflectionClass(str_replace('.php', '', $file));
$properties = $reflection->getDefaultProperties();
$class_name = str_replace('.php', '', $file);
if (class_exists($class_name))
$reflection = new ReflectionClass(str_replace('.php', '', $file));
if (isset($reflection) && $reflection)
$properties = $reflection->getDefaultProperties();
if (isset($properties['php_self']))
$selected_pages[$properties['php_self']] = $properties['php_self'];
else if (preg_match('/^[a-z0-9_.-]*\.php$/i', $file))
+4 -4
View File
@@ -347,7 +347,7 @@ class ProductCore extends ObjectModel
),
'id_tax_rules_group' => array(
'xlink_resource' => array(
'resourceName' => 'tax_rules_group'
'resourceName' => 'tax_rule_groups'
)
),
'position_in_category' => array(
@@ -1354,7 +1354,7 @@ class ProductCore extends ObjectModel
$supplier_reference = '';
//Try to set the default supplier reference
if (($id_supplier > 0) && ($id_product > 0))
if (($id_supplier > 0) && ($this->id > 0))
{
$id_product_supplier = (int)ProductSupplier::getIdByProductAndSupplier($this->id, $id_product_attribute, $id_supplier);
@@ -2914,7 +2914,7 @@ class ProductCore extends ObjectModel
* @param Shop $shop
* @return string
*/
public static function sqlStock($product_alias, $product_attribute = 0, $inner_join = false, Shop $shop = null)
public static function sqlStock($product_alias, $product_attribute = null, $inner_join = false, Shop $shop = null)
{
$id_shop = ($shop !== null ? (int)$shop->id : null);
$sql = (($inner_join) ? ' INNER ' : ' LEFT ').'
@@ -4493,7 +4493,7 @@ class ProductCore extends ObjectModel
return true;
}
/*
/**
* Webservice getter : get virtual field default combination
*
+4 -1
View File
@@ -66,7 +66,10 @@ class ProductSaleCore
if ($page_number < 0) $page_number = 0;
if ($nb_products < 1) $nb_products = 10;
$final_order_by = $order_by;
$order_table = '';
if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales';
if ($order_by == 'date_add' || $order_by == 'date_upd')
$order_table = 'product_shop';
if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC';
$groups = FrontController::getCurrentCustomerGroups();
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
@@ -108,7 +111,7 @@ class ProductSaleCore
WHERE cg.`id_group` '.$sql_groups.'
)
GROUP BY product_shop.id_product
ORDER BY '.$prefix.'`'.pSQL($order_by).'` '.pSQL($order_way).'
ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).'
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
+31 -8
View File
@@ -93,8 +93,12 @@ define('PREG_CLASS_CJK', '\x{3041}-\x{30ff}\x{31f0}-\x{31ff}\x{3400}-\x{4db5}\x{
class SearchCore
{
public static function sanitize($string, $id_lang, $indexation = false)
public static function sanitize($string, $id_lang, $indexation = false, $iso_code = false)
{
$string = trim($string);
if (empty($string))
return '';
$string = Tools::strtolower(strip_tags($string));
$string = html_entity_decode($string, ENT_NOQUOTES, 'utf-8');
@@ -136,7 +140,24 @@ class SearchCore
$string = implode(' ', $processed_words);
}
if ($indexation)
// If the language is constituted with symbol and there is no "words", then split every chars
if (in_array($iso_code, array('zh', 'tw', 'ja')) && function_exists('mb_strlen'))
{
// Cut symbols from letters
$symbols = '';
$letters = '';
foreach (explode(' ', $string) as $mb_word)
if (strlen(Tools::replaceAccentedChars($mb_word)) == mb_strlen(Tools::replaceAccentedChars($mb_word)))
$letters .= $mb_word.' ';
else
$symbols .= $mb_word.' ';
if (preg_match_all('/./u', $symbols, $matches))
$symbols = implode(' ', $matches[0]);
$string = $letters.$symbols;
}
elseif ($indexation)
{
$minWordLen = (int)Configuration::get('PS_SEARCH_MINWORDLEN');
if ($minWordLen > 1)
@@ -175,7 +196,7 @@ class SearchCore
$intersect_array = array();
$score_array = array();
$words = explode(' ', Search::sanitize($expr, $id_lang));
$words = explode(' ', Search::sanitize($expr, $id_lang, false, $context->language->iso_code));
foreach ($words as $key => $word)
if (!empty($word) && strlen($word) >= (int)Configuration::get('PS_SEARCH_MINWORDLEN'))
@@ -383,7 +404,7 @@ class SearchCore
return Db::getInstance()->executeS('
SELECT p.id_product, pl.id_lang, pl.id_shop, pl.name pname, p.reference, p.ean13, p.upc,
pl.description_short, pl.description, cl.name cname, m.name mname
pl.description_short, pl.description, cl.name cname, m.name mname, l.iso_code
FROM '._DB_PREFIX_.'product p
LEFT JOIN '._DB_PREFIX_.'product_lang pl
ON p.id_product = pl.id_product
@@ -392,6 +413,8 @@ class SearchCore
ON (cl.id_category = product_shop.id_category_default AND pl.id_lang = cl.id_lang AND cl.id_shop = product_shop.id_shop)
LEFT JOIN '._DB_PREFIX_.'manufacturer m
ON m.id_manufacturer = p.id_manufacturer
LEFT JOIN '._DB_PREFIX_.'lang l
ON l.id_lang = pl.id_lang
WHERE product_shop.indexed = 0
AND product_shop.visibility IN ("both", "search")
'.($id_product ? 'AND p.id_product = '.(int)$id_product : '').'
@@ -452,7 +475,6 @@ class SearchCore
// Those are kind of global variables required to save the processed data in the database every X occurrences, in order to avoid overloading MySQL
$count_words = 0;
$query_array3 = array();
$products_array = array();
// Every indexed words are cached into a PHP array
$word_ids = $db->executeS('
@@ -472,6 +494,7 @@ class SearchCore
// Products are processed 50 by 50 in order to avoid overloading MySQL
while (($products = Search::getProductsToIndex($total_languages, $id_product, 50)) && (count($products) > 0))
{
$products_array = array();
// Now each non-indexed product is processed one by one, langage by langage
foreach ($products as $product)
{
@@ -482,9 +505,9 @@ class SearchCore
// Data must be cleaned of html, bad characters, spaces and anything, then if the resulting words are long enough, they're added to the array
$product_array = array();
foreach ($product as $key => $value)
if (strncmp($key, 'id_', 3))
if (strncmp($key, 'id_', 3) && isset($weight_array[$key]))
{
$words = explode(' ', Search::sanitize($value, (int)$product['id_lang'], true));
$words = explode(' ', Search::sanitize($value, (int)$product['id_lang'], true, $product['iso_code']));
foreach ($words as $word)
if (!empty($word))
{
@@ -676,4 +699,4 @@ class SearchCore
return Product::getProductsProperties((int)$id_lang, $result);
}
}
}
+1 -1
View File
@@ -72,7 +72,7 @@ class SupplierCore extends ObjectModel
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields
'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+60 -67
View File
@@ -705,6 +705,18 @@ class ToolsCore
}
return false;
}
/**
* Clear smarty cache folders
*/
public static function clearSmartyCache()
{
foreach (array(_PS_CACHE_DIR_.'smarty/cache', _PS_CACHE_DIR_.'smarty/compile') as $dir)
if (file_exists($dir))
foreach (scandir($dir) as $file)
if ($file[0] != '.' && $file != 'index.php')
self::deleteDirectory($dir.DIRECTORY_SEPARATOR.$file);
}
/**
* Display an error according to an error code
@@ -1585,7 +1597,8 @@ class ToolsCore
if (self::$_cache_nb_media_servers && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1)))
return constant('_MEDIA_SERVER_'.$id_media_server.'_');
return Tools::getShopDomain();
return Tools::usingSecureMode() ? Tools::getShopDomainSSL() : Tools::getShopDomain();
}
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false, $disable_modsec = null)
@@ -1670,6 +1683,9 @@ class ToolsCore
// RewriteEngine
fwrite($write_fd, "<IfModule mod_rewrite.c>\n");
// Ensure HTTP_MOD_REWRITE variable is set in environment
fwrite($write_fd, "SetEnv HTTP_MOD_REWRITE On\n");
// Disable multiviews ?
if ($disable_multiviews)
fwrite($write_fd, "\n# Disable Multiviews\nOptions -Multiviews\n\n");
@@ -2472,89 +2488,66 @@ exit;
return preg_replace('/\\\[px]\{[a-z]\}{1,2}|(\/[a-z]*)u([a-z]*)$/i', "$1$2", $pattern);
}
protected static $is_addons_up = true;
public static function addonsRequest($request, $params = array())
{
$addons_url = 'api.addons.prestashop.com';
$postData = '';
$postDataArray = array(
if (!self::$is_addons_up)
return false;
$postData = http_build_query(array(
'version' => isset($params['version']) ? $params['version'] : _PS_VERSION_,
'iso_lang' => Tools::strtolower(isset($params['iso_lang']) ? $params['iso_lang'] : Context::getContext()->language->iso_code),
'iso_code' => Tools::strtolower(isset($params['iso_country']) ? $params['iso_country'] : Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))),
'shop_url' => urlencode(isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain()),
'mail' => urlencode(isset($params['email']) ? $params['email'] : Configuration::get('email'))
);
foreach ($postDataArray as $postDataKey => $postDataValue)
$postData .= '&'.$postDataKey.'='.$postDataValue;
$postData = ltrim($postData, '&');
'shop_url' => isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain(),
'mail' => isset($params['email']) ? $params['email'] : Configuration::get('email')
));
// Config for each request
if ($request == 'native')
$protocols = array('https');
switch ($request)
{
// Define protocol accepted and post data values for this request
$protocolsList = array('https://' => 443, 'http://' => 80);
$postData .= '&method=listing&action=native';
}
if ($request == 'must-have')
{
// Define protocol accepted and post data values for this request
$protocolsList = array('https://' => 443, 'http://' => 80);
$postData .= '&method=listing&action=must-have';
}
if ($request == 'customer')
{
// Define protocol accepted and post data values for this request
$protocolsList = array('https://' => 443);
$postData .= '&method=listing&action=customer&username='.urlencode(trim(Context::getContext()->cookie->username_addons)).'&password='.urlencode(trim(Context::getContext()->cookie->password_addons));
}
if ($request == 'check_customer')
{
// Define protocol accepted and post data values for this request
$protocolsList = array('https://' => 443);
$postData .= '&method=check_customer&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
}
if ($request == 'module')
{
// Define protocol accepted and post data values for this request
if (isset($params['username_addons']) && isset($params['password_addons']))
{
$protocolsList = array('https://' => 443);
$postData .= '&method=module&id_module='.urlencode($params['id_module']).'&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
}
else
{
$protocolsList = array('https://' => 443, 'http://' => 80);
case 'native':
$protocols[] = 'http';
$postData .= '&method=listing&action=native';
break;
case 'must-have':
$protocols[] = 'http';
$postData .= '&method=listing&action=must-have';
break;
case 'customer':
$postData .= '&method=listing&action=customer&username='.urlencode(trim(Context::getContext()->cookie->username_addons)).'&password='.urlencode(trim(Context::getContext()->cookie->password_addons));
break;
case 'check_customer':
$postData .= '&method=check_customer&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
break;
case 'module':
$postData .= '&method=module&id_module='.urlencode($params['id_module']);
}
}
if ($request == 'install-modules')
{
// Define protocol accepted and post data values for this request
$protocolsList = array('https://' => 443, 'http://' => 80);
$postData .= '&method=listing&action=install-modules';
if (isset($params['username_addons']) && isset($params['password_addons']))
$postData .= '&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
else
$protocols[] = 'http';
break;
case 'install-modules':
$protocols[] = 'http';
$postData .= '&method=listing&action=install-modules';
break;
default:
return false;
}
// Make the request
$opts = array(
'http'=>array(
$context = stream_context_create(array(
'http' => array(
'method'=> 'POST',
'content' => $postData,
'header' => 'Content-type: application/x-www-form-urlencoded',
'timeout' => 5,
)
);
$context = stream_context_create($opts);
foreach ($protocolsList as $protocol => $port)
{
$content = Tools::file_get_contents($protocol.$addons_url, false, $context);
// If content returned, we cache it
if ($content)
));
foreach ($protocols as $protocol)
if ($content = Tools::file_get_contents($protocol.'://api.addons.prestashop.com', false, $context))
return $content;
}
// No content, return false
self::$is_addons_up = false;
return false;
}
+2 -2
View File
@@ -399,10 +399,10 @@ class ValidateCore
$events .= '|onoffline|ononline|onpaste|onpropertychange|onreadystatechange|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onsearch|onselectionchange';
$events .= '|onselectstart|onstart|onstop';
if (preg_match('/<[ \t\n]*script/ims', $html) || preg_match('/('.$events.')[ \t\n]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
if (preg_match('/<[\s]*script/ims', $html) || preg_match('/('.$events.')[\s]*=/ims', $html) || preg_match('/.*script\:/ims', $html))
return false;
if (!$allow_iframe && preg_match('/<[ \t\n]*(i?frame|form|input|embed|object)/ims', $html))
if (!$allow_iframe && preg_match('/<[\s]*(i?frame|form|input|embed|object)/ims', $html))
return false;
return true;
+5 -2
View File
@@ -34,9 +34,12 @@ class CacheApcCore extends Cache
public function __construct()
{
$this->keys = array();
$cache_info = apc_cache_info('user');
$cache_info = apc_cache_info((extension_loaded('apcu') === true )? '' : 'user' );
foreach ($cache_info['cache_list'] as $entry)
$this->keys[$entry['info']] = $entry['ttl'];
if ( extension_loaded('apcu') === true )
$this->keys[$entry['key']] = $entry['ttl'];
else
$this->keys[$entry['info']] = $entry['ttl'];
}
/**
+16 -7
View File
@@ -44,11 +44,19 @@ class CacheMemcacheCore extends Cache
{
$this->connect();
// Get keys (this code comes from Doctrine 2 project)
$this->keys = array();
$servers = self::getMemcachedServers();
if(is_array($servers) && count($servers) > 0 && method_exists('Memcache', 'getStats'))
if(is_array($servers) && count($servers) > 0)
{
$this->keys = @$this->memcache->get(_COOKIE_IV_);
if (!is_array($this->keys))
$this->keys = array();
}
/*
// Get keys (this code comes from Doctrine 2 project)
if(is_array($servers) && count($servers) > 0 && method_exists('Memcache', 'getStats'))
$all_slabs = $this->memcache->getStats('slabs');
if(isset($all_slabs) && is_array($all_slabs))
@@ -56,11 +64,11 @@ class CacheMemcacheCore extends Cache
{
if (is_array($slabs))
{
foreach (array_keys($slabs) as $slab_id)
foreach (array_keys($slabs) as $i => $slab_id) // $slab_id is not an int but a string, using the key instead ?
{
if(is_int($slab_id))
{
$dump = $this->memcache->getStats('cachedump', (int)$slab_id);
if(is_int($i))
{
$dump = $this->memcache->getStats('cachedump', (int)$i);
if ($dump)
{
foreach ($dump as $entries)
@@ -73,7 +81,7 @@ class CacheMemcacheCore extends Cache
}
}
}
}
}*/
}
public function __destruct()
@@ -145,6 +153,7 @@ class CacheMemcacheCore extends Cache
*/
protected function _writeKeys()
{
$this->memcache->set(_COOKIE_IV_, $this->keys);
}
/**
+39 -17
View File
@@ -401,13 +401,13 @@ class AdminControllerCore extends Controller
if (isset($t['type']) && $t['type'] == 'bool')
$filter .= ((bool)$val) ? $this->l('yes') : $this->l('no');
elseif(is_string($val))
$filter .= $val;
$filter .= htmlspecialchars($val, ENT_QUOTES, 'UTF-8');
elseif(is_array($val))
{
$tmp = '';
foreach($val as $v)
if(is_string($v) && !empty($v))
$tmp .= ' - '.$v;
$tmp .= ' - '.htmlspecialchars($v, ENT_QUOTES, 'UTF-8');
if(Tools::strlen($tmp))
{
$tmp = ltrim($tmp, ' - ');
@@ -732,6 +732,8 @@ class AdminControllerCore extends Controller
*/
public function processAdd()
{
if (!isset($this->className) || empty($this->className))
return false;
/* Checking fields validity */
$this->validateRules();
if (count($this->errors) <= 0)
@@ -1163,6 +1165,8 @@ class AdminControllerCore extends Controller
*/
protected function loadObject($opt = false)
{
if (!isset($this->className) || empty($this->className))
return true;
$id = (int)Tools::getValue($this->identifier);
if ($id && Validate::isUnsignedId($id))
{
@@ -1213,6 +1217,9 @@ class AdminControllerCore extends Controller
protected function filterToField($key, $filter)
{
if (!isset($this->fields_list))
return false;
foreach ($this->fields_list as $field)
if (array_key_exists('filter_key', $field) && $field['filter_key'] == $key)
return $field;
@@ -1555,11 +1562,23 @@ class AdminControllerCore extends Controller
protected function addToolBarModulesListButton()
{
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 86400))
file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'));
$country_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST);
if (!empty($country_module_list) && $country_module_list_xml = simplexml_load_string($country_module_list))
{
$country_module_list_array = array();
foreach ($country_module_list_xml->module as $k => $m)
$country_module_list_array[] = (string)$m->name;
$this->tab_modules_list['slider_list'] = array_intersect($this->tab_modules_list['slider_list'], $country_module_list_array);
}
if (is_array($this->tab_modules_list['slider_list']) && count($this->tab_modules_list['slider_list']))
$this->toolbar_btn['modules-list'] = array(
'href' => '#',
'desc' => $this->l('Modules List')
);
'href' => '#',
'desc' => $this->l('Modules List')
);
}
/**
@@ -1851,7 +1870,11 @@ class AdminControllerCore extends Controller
$this->context->employee->logout();
if ($this->controller_name != 'AdminLogin' && (!isset($this->context->employee) || !$this->context->employee->isLoggedBack()))
{
if (isset($this->context->employee))
$this->context->employee->logout();
Tools::redirectAdmin($this->context->link->getAdminLink('AdminLogin').((!isset($_GET['logout']) && $this->controller_name != 'AdminNotFound') ? '&redirect='.$this->controller_name : ''));
}
// Set current index
$current_index = 'index.php'.(($controller = Tools::getValue('controller')) ? '?controller='.$controller : '');
@@ -2174,8 +2197,11 @@ class AdminControllerCore extends Controller
|| !Validate::isUnsignedId($id_lang))
throw new PrestaShopException('get list params is not valid');
if (isset($this->fields_list[$order_by]) && isset($this->fields_list[$order_by]['filter_key']))
$order_by = $this->fields_list[$order_by]['filter_key'];
if (!isset($this->fields_list[$order_by]['order_key']) && isset($this->fields_list[$order_by]['filter_key']))
$this->fields_list[$order_by]['order_key'] = $this->fields_list[$order_by]['filter_key'];
if (isset($this->fields_list[$order_by]) && isset($this->fields_list[$order_by]['order_key']))
$order_by = $this->fields_list[$order_by]['order_key'];
/* Determine offset from current page */
if ((isset($_POST['submitFilter'.$this->list_id]) ||
@@ -2421,7 +2447,7 @@ class AdminControllerCore extends Controller
public function getFieldValue($obj, $key, $id_lang = null)
{
if ($id_lang)
$default_value = ($obj->id && isset($obj->{$key}[$id_lang])) ? $obj->{$key}[$id_lang] : false;
$default_value = (isset($obj->id) && $obj->id && isset($obj->{$key}[$id_lang])) ? $obj->{$key}[$id_lang] : false;
else
$default_value = isset($obj->{$key}) ? $obj->{$key} : false;
@@ -2960,21 +2986,17 @@ class AdminControllerCore extends Controller
public function isFresh($file, $timeout = 604800000)
{
if (file_exists(_PS_ROOT_DIR_.$file))
{
if (filesize(_PS_ROOT_DIR_.$file) < 1)
return false;
if (file_exists(_PS_ROOT_DIR_.$file) && filesize(_PS_ROOT_DIR_.$file) > 0)
return ((time() - filemtime(_PS_ROOT_DIR_.$file)) < $timeout);
}
else
return false;
return false;
}
protected static $is_prestashop_up = true;
public function refresh($file_to_refresh, $external_file)
{
$content = Tools::file_get_contents($external_file);
if ($content)
if (self::$is_prestashop_up && $content = Tools::file_get_contents($external_file))
return (bool)file_put_contents(_PS_ROOT_DIR_.$file_to_refresh, $content);
self::$is_prestashop_up = false;
return false;
}
+9 -8
View File
@@ -116,16 +116,16 @@ class FrontControllerCore extends Controller
// If we call a SSL controller without SSL or a non SSL controller with SSL, we redirect with the right protocol
if (Configuration::get('PS_SSL_ENABLED') && ($_SERVER['REQUEST_METHOD'] != 'POST') && $this->ssl != Tools::usingSecureMode())
{
{
header('HTTP/1.1 301 Moved Permanently');
header('Cache-Control: no-cache');
if ($this->ssl)
if ($this->ssl)
header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
else
else
header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']);
exit();
}
if ($this->ajax)
{
$this->display_header = false;
@@ -333,7 +333,8 @@ class FrontControllerCore extends Controller
'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'),
'PS_CATALOG_MODE' => (bool)Configuration::get('PS_CATALOG_MODE') || !(bool)Group::getCurrent()->show_prices,
'b2b_enable' => (bool)Configuration::get('PS_B2B_ENABLE'),
'request' => $link->getPaginationLink(false, false, false, true)
'request' => $link->getPaginationLink(false, false, false, true),
'PS_STOCK_MANAGEMENT' => Configuration::get('PS_STOCK_MANAGEMENT')
));
// Add the tpl files directory for mobile
@@ -511,7 +512,7 @@ class FrontControllerCore extends Controller
if (Configuration::get('PS_CSS_THEME_CACHE'))
$this->css_files = Media::cccCSS($this->css_files);
//JS compressor management
if (Configuration::get('PS_JS_THEME_CACHE'))
if (Configuration::get('PS_JS_THEME_CACHE') && !$this->context->getMobileDevice())
$this->js_files = Media::cccJs($this->js_files);
}
@@ -593,7 +594,7 @@ class FrontControllerCore extends Controller
protected function canonicalRedirection($canonical_url = '')
{
if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET')
if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || Tools::getValue('live_edit'))
return;
$match_url = (($this->ssl && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
@@ -1137,4 +1138,4 @@ class FrontControllerCore extends Controller
'logo_url' => $logo
);
}
}
}
+1 -1
View File
@@ -259,7 +259,7 @@ class HelperListCore extends Helper
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$item_id.(isset($tr['id_image']) ? '-'.(int)$tr['id_image'] : '').'.'.$this->imageType;
else
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.Image::getImgFolderStatic($tr['id_image']).(int)$tr['id_image'].'.'.$this->imageType;
$this->_list[$index][$key] = ImageManager::thumbnail($path_to_image, $this->table.'_mini_'.$item_id.'.'.$this->imageType, 45, $this->imageType);
$this->_list[$index][$key] = ImageManager::thumbnail($path_to_image, $this->table.'_mini_'.$item_id.'_'.$this->context->shop->id.'.'.$this->imageType, 45, $this->imageType);
}
elseif (isset($params['icon']) && isset($tr[$key]) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default'])))
{
+99 -62
View File
@@ -118,6 +118,9 @@ abstract class ModuleCore
/** @var Smarty_Data */
protected $smarty;
/** @var currentSmartySubTemplate */
protected $current_subtemplate = null;
/** @var allow push */
public $allow_push;
@@ -297,15 +300,17 @@ abstract class ModuleCore
else
{
if (!$upgrade_detail['number_upgraded'])
$this->_errors[] = $this->l('None upgrades have been applied');
$this->_errors[] = $this->l('No upgrade has been applied');
else
{
$this->_errors[] = $this->l('Upgraded from: ').$upgrade_detail['upgraded_from'].$this->l(' to ').
$upgrade_detail['upgraded_to'];
$this->_errors[] = sprintf($this->l('Upgraded from: %S to %s'), $upgrade_detail['upgraded_from'], $upgrade_detail['upgraded_to']);
$this->_errors[] = $upgrade_detail['number_upgrade_left'].' '.$this->l('upgrade left');
}
$this->_errors[] = $this->l('To prevent any problem, this module has been turned off');
if (isset($upgrade_detail['duplicate']) && $upgrade_detail['duplicate'])
$this->_errors[] = sprintf(Tools::displayError('Module %s cannot be upgraded this time: please refresh this page to update it.'), $this->name);
else
$this->_errors[] = $this->l('To prevent any problem, this module has been turned off');
}
}
}
@@ -353,19 +358,21 @@ abstract class ModuleCore
$upgrade = &self::$modules_cache[$this->name]['upgrade'];
foreach ($upgrade['upgrade_file_left'] as $num => $file_detail)
{
// Default variable required in the included upgrade file need to be set by default there:
// upgrade_version, success_upgrade
$upgrade_result = false;
if (function_exists($file_detail['upgrade_function']))
{
$upgrade['success'] = false;
$upgrade['duplicate'] = true;
break;
}
include($file_detail['file']);
// Call the upgrade function if defined
$upgrade['success'] = false;
if (function_exists($file_detail['upgrade_function']))
$upgrade_result = $file_detail['upgrade_function']($this);
$upgrade['success'] = $upgrade_result;
$upgrade['success'] = $file_detail['upgrade_function']($this);
// Set detail when an upgrade succeed or failed
if ($upgrade_result)
if ($upgrade['success'])
{
$upgrade['number_upgraded'] += 1;
$upgrade['upgraded_to'] = $file_detail['version'];
@@ -383,6 +390,7 @@ abstract class ModuleCore
}
$upgrade['number_upgrade_left'] = count($upgrade['upgrade_file_left']);
// Update module version in DB with the last succeed upgrade
if ($upgrade['upgraded_to'])
Module::upgradeModuleVersion($this->name, $upgrade['upgraded_to']);
@@ -401,9 +409,9 @@ abstract class ModuleCore
public static function upgradeModuleVersion($name, $version)
{
return Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'module` m
SET m.version = \''.bqSQL($version).'\'
WHERE m.name = \''.bqSQL($name).'\'');
UPDATE `'._DB_PREFIX_.'module` m
SET m.version = \''.bqSQL($version).'\'
WHERE m.name = \''.bqSQL($name).'\'');
}
/**
@@ -1654,20 +1662,35 @@ abstract class ModuleCore
if ($cacheId !== null)
Tools::enableCache();
$smarty_subtemplate = $this->context->smarty->createTemplate(
$this->getTemplatePath($template),
$cacheId,
$compileId,
$this->smarty
);
$result = $smarty_subtemplate->fetch();
$result = $this->getCurrentSubTemplate($template, $cacheId, $compileId)->fetch();
if ($cacheId !== null)
Tools::restoreCacheSettings();
$this->resetCurrentSubTemplate($template, $cacheId, $compileId);
return $result;
}
}
protected function getCurrentSubTemplate($template, $cache_id = null, $compile_id = null)
{
if (!isset($this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id]))
{
$this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id] = $this->context->smarty->createTemplate(
$this->getTemplatePath($template),
$cache_id,
$compile_id,
$this->smarty
);
}
return $this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id];
}
protected function resetCurrentSubTemplate($template, $cache_id, $compile_id)
{
$this->current_subtemplate[$template.'_'.$cache_id.'_'.$compile_id] = null;
}
/**
* Get realpath of a template of current module (check if template is overriden too)
@@ -1697,10 +1720,8 @@ abstract class ModuleCore
public function isCached($template, $cacheId = null, $compileId = null)
{
$context = Context::getContext();
Tools::enableCache();
$is_cached = $context->smarty->isCached($this->getTemplatePath($template), $cacheId, $compileId);
$is_cached = $this->getCurrentSubTemplate($this->getTemplatePath($template), $cacheId, $compileId)->isCached($this->getTemplatePath($template), $cacheId, $compileId);
Tools::restoreCacheSettings();
return $is_cached;
@@ -1727,7 +1748,15 @@ abstract class ModuleCore
<need_instance>'.(int)$this->need_instance.'</need_instance>'.(isset($this->limited_countries) ? "\n\t".'<limited_countries>'.(count($this->limited_countries) == 1 ? $this->limited_countries[0] : '').'</limited_countries>' : '').'
</module>';
if (is_writable(_PS_MODULE_DIR_.$this->name.'/'))
file_put_contents(_PS_MODULE_DIR_.$this->name.'/config.xml', $xml);
{
$file = _PS_MODULE_DIR_.$this->name.'/config.xml';
if (!@file_put_contents($file, $xml))
if (!is_writable($file))
{
@unlink($file);
@file_put_contents($file, $xml);
}
}
}
/**
@@ -1952,7 +1981,43 @@ abstract class ModuleCore
$path = Autoload::getInstance()->getClassPath($classname.'Core');
// Check if there is already an override file, if not, we just need to copy the file
if (!($classpath = Autoload::getInstance()->getClassPath($classname)))
if (Autoload::getInstance()->getClassPath($classname))
{
// Check if override file is writable
$override_path = _PS_ROOT_DIR_.'/'.Autoload::getInstance()->getClassPath($classname);
if ((!file_exists($override_path) && !is_writable(dirname($override_path))) || (file_exists($override_path) && !is_writable($override_path)))
throw new Exception(sprintf(Tools::displayError('file (%s) not writable'), $override_path));
// Get a uniq id for the class, because you can override a class (or remove the override) twice in the same session and we need to avoid redeclaration
do $uniq = uniqid();
while (class_exists($classname.'OverrideOriginal_remove', false));
// Make a reflection of the override class and the module override class
$override_file = file($override_path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal'.$uniq), implode('', $override_file)));
$override_class = new ReflectionClass($classname.'OverrideOriginal'.$uniq);
$module_file = file($this->getLocalPath().'override'.DIRECTORY_SEPARATOR.$path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override'.$uniq), implode('', $module_file)));
$module_class = new ReflectionClass($classname.'Override'.$uniq);
// Check if none of the methods already exists in the override class
foreach ($module_class->getMethods() as $method)
if ($override_class->hasMethod($method->getName()))
throw new Exception(sprintf(Tools::displayError('The method %1$s in the class %2$s is already overriden.'), $method->getName(), $classname));
// Check if none of the properties already exists in the override class
foreach ($module_class->getProperties() as $property)
if ($override_class->hasProperty($property->getName()))
throw new Exception(sprintf(Tools::displayError('The property %1$s in the class %2$s is already defined.'), $property->getName(), $classname));
// Insert the methods from module override in override
$copy_from = array_slice($module_file, $module_class->getStartLine() + 1, $module_class->getEndLine() - $module_class->getStartLine() - 2);
array_splice($override_file, $override_class->getEndLine() - 1, 0, $copy_from);
$code = implode('', $override_file);
file_put_contents($override_path, $code);
}
else
{
$override_src = $this->getLocalPath().'override'.DIRECTORY_SEPARATOR.$path;
$override_dest = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'override'.DIRECTORY_SEPARATOR.$path;
@@ -1961,39 +2026,7 @@ abstract class ModuleCore
copy($override_src, $override_dest);
// Re-generate the class index
Autoload::getInstance()->generateIndex();
return true;
}
// Check if override file is writable
$override_path = _PS_ROOT_DIR_.'/'.Autoload::getInstance()->getClassPath($classname);
if ((!file_exists($override_path) && !is_writable(dirname($override_path))) || (file_exists($override_path) && !is_writable($override_path)))
throw new Exception(sprintf(Tools::displayError('file (%s) not writable'), $override_path));
// Make a reflection of the override class and the module override class
$override_file = file($override_path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal'), implode('', $override_file)));
$override_class = new ReflectionClass($classname.'OverrideOriginal');
$module_file = file($this->getLocalPath().'override'.DIRECTORY_SEPARATOR.$path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override'), implode('', $module_file)));
$module_class = new ReflectionClass($classname.'Override');
// Check if none of the methods already exists in the override class
foreach ($module_class->getMethods() as $method)
if ($override_class->hasMethod($method->getName()))
throw new Exception(sprintf(Tools::displayError('The method %1$s in the class %2$s is already overriden.'), $method->getName(), $classname));
// Check if none of the properties already exists in the override class
foreach ($module_class->getProperties() as $property)
if ($override_class->hasProperty($property->getName()))
throw new Exception(sprintf(Tools::displayError('The property %1$s in the class %2$s is already defined.'), $property->getName(), $classname));
// Insert the methods from module override in override
$copy_from = array_slice($module_file, $module_class->getStartLine() + 1, $module_class->getEndLine() - $module_class->getStartLine() - 2);
array_splice($override_file, $override_class->getEndLine() - 1, 0, $copy_from);
$code = implode('', $override_file);
file_put_contents($override_path, $code);
return true;
}
@@ -2015,14 +2048,18 @@ abstract class ModuleCore
if (!is_writable($override_path))
return false;
// Get a uniq id for the class, because you can override a class (or remove the override) twice in the same session and we need to avoid redeclaration
do $uniq = uniqid();
while (class_exists($classname.'OverrideOriginal_remove', false));
// Make a reflection of the override class and the module override class
$override_file = file($override_path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal_remove'), implode('', $override_file)));
$override_class = new ReflectionClass($classname.'OverrideOriginal_remove');
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?#i'), array('', 'class '.$classname.'OverrideOriginal_remove'.$uniq), implode('', $override_file)));
$override_class = new ReflectionClass($classname.'OverrideOriginal_remove'.$uniq);
$module_file = file($this->getLocalPath().'override/'.$path);
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override_remove'), implode('', $module_file)));
$module_class = new ReflectionClass($classname.'Override_remove');
eval(preg_replace(array('#^\s*<\?php#', '#class\s+'.$classname.'(\s+extends\s+([a-z0-9_]+)(\s+implements\s+([a-z0-9_]+))?)?#i'), array('', 'class '.$classname.'Override_remove'.$uniq), implode('', $module_file)));
$module_class = new ReflectionClass($classname.'Override_remove'.$uniq);
// Remove methods from override file
$override_file = file($override_path);
+1 -2
View File
@@ -712,11 +712,10 @@ class OrderCore extends ObjectModel
}
public function getCartRules()
{
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT *
FROM `'._DB_PREFIX_.'order_cart_rule` ocr
LEFT JOIN `'._DB_PREFIX_.'cart_rule` cr ON cr.`id_cart_rule` = ocr.`id_cart_rule`
WHERE ocr.`id_order` = '.(int)$this->id);
}
+5 -1
View File
@@ -46,6 +46,9 @@ class OrderCartRuleCore extends ObjectModel
/** @var float value (tax excl.) of voucher */
public $value_tax_excl;
/** @var boolean value : voucher gives free shipping or not */
public $free_shipping;
/**
* @see ObjectModel::$definition
@@ -59,7 +62,8 @@ class OrderCartRuleCore extends ObjectModel
'id_order_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true),
'value' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
'value_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true)
'value_tax_excl' => array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true),
'free_shipping' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool')
)
);
+3 -3
View File
@@ -125,8 +125,8 @@ class OrderHistoryCore extends ObjectModel
.'&id_order='.(int)$order->id
.'&secure_key='.$order->secure_key;
$assign[$key]['link'] = $dl_link;
if (isset($virtual_product['date_expiration']) && $virtual_product['date_expiration'] != '0000-00-00 00:00:00')
$assign[$key]['deadline'] = Tools::displayDate($virtual_product['date_expiration ']);
if (isset($virtual_product['download_deadline']) && $virtual_product['download_deadline'] != '0000-00-00 00:00:00')
$assign[$key]['deadline'] = Tools::displayDate($virtual_product['download_deadline']);
if ($product_download->nb_downloadable != 0)
$assign[$key]['downloadable'] = (int)$product_download->nb_downloadable;
}
@@ -485,4 +485,4 @@ class OrderHistoryCore extends ObjectModel
else
return $this->add();
}
}
}
-13
View File
@@ -129,19 +129,6 @@ class OrderSlipCore extends ObjectModel
{
$products[$key] = $product;
$products[$key]['product_quantity'] = $slip_quantity[$product['id_order_detail']];
if (count($cart_rules))
{
$order->setProductPrices($product);
$realProductPrice = $products[$key]['product_price'];
// Todo : must be updated to use the cart rules
foreach ($cart_rules as $cart_rule)
{
if ($cart_rule['reduction_percent'])
$products[$key]['product_price'] -= $realProductPrice * ($cart_rule['reduction_percent'] / 100);
elseif ($cart_rule['reduction_amount'])
$products[$key]['product_price'] -= (($cart_rule['reduction_amount'] * ($product['product_price_wt'] / $order->total_products_wt)) / (1.00 + ($product['tax_rate'] / 100)));
}
}
}
return $order->getProducts($products);
}
+1 -1
View File
@@ -40,7 +40,7 @@ class HTMLTemplateOrderReturnCore extends HTMLTemplate
// header informations
$this->date = Tools::displayDate($this->order->invoice_date);
$this->title = HTMLTemplateOrderReturn::l('Order Return ').sprintf('%06d', $this->order_return->id);
$this->title = sprintf(HTMLTemplateOrderReturn::l('Order Return %s'), sprintf('%06d', $this->order_return->id));
// footer informations
$this->shop = new Shop((int)$this->order->id_shop);
+1 -1
View File
@@ -45,7 +45,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
$this->smarty = $smarty;
// header informations
$this->date = Tools::displayDate($this->order->invoice_date, (int)$this->order->id_lang);
$this->date = Tools::displayDate($this->order_slip->date_add);
$this->title = HTMLTemplateOrderSlip::l('Slip #').Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id).sprintf('%06d', (int)$this->order_slip->id);
// footer informations
+1 -1
View File
@@ -45,7 +45,7 @@ class HTMLTemplateSupplyOrderFormCore extends HTMLTemplate
$this->address_supplier = new Address(Address::getAddressIdBySupplierId((int)$supply_order->id_supplier));
// header informations
$this->date = Tools::displayDate($supply_order->date_add, (int)$this->supply_order->id_lang);
$this->date = Tools::displayDate($supply_order->date_add);
$this->title = HTMLTemplateSupplyOrderForm::l('Supply order form');
}
+4 -2
View File
@@ -363,10 +363,12 @@ class ShopCore extends ObjectModel
// 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']))
if (!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST']))
$_SERVER['HTTP_HOST'] = $shop->domain;
if(!isset($_SERVER['SERVER_NAME']) || empty($_SERVER['SERVER_NAME']))
if (!isset($_SERVER['SERVER_NAME']) || empty($_SERVER['SERVER_NAME']))
$_SERVER['SERVER_NAME'] = $shop->domain;
if (!isset($_SERVER['REMOTE_ADDR']) || empty($_SERVER['REMOTE_ADDR']))
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
}
}
else
-4
View File
@@ -305,11 +305,7 @@ class StockAvailableCore extends ObjectModel
if (!Validate::isUnsignedId($id_product))
return false;
if ($id_shop === null)
$id_shop = Context::getContext()->shop->id;
$existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, (int)$id_shop);
if ($existing_id > 0)
{
Db::getInstance()->update(
+4 -11
View File
@@ -53,22 +53,15 @@ class TaxRulesGroupCore extends ObjectModel
protected static $_taxes = array();
public static function getTaxRulesGroups($only_active = true, $multiShop = false)
public static function getTaxRulesGroups($only_active = true)
{
if ((bool)$multiShop) {
return Db::getInstance()->executeS('
SELECT *
return Db::getInstance()->executeS('
SELECT DISTINCT g.id_tax_rules_group, g.name, g.active
FROM `'._DB_PREFIX_.'tax_rules_group` g'
.Shop::addSqlAssociation('tax_rules_group', 'g')
.($only_active ? ' WHERE g.`active` = 1' : '').'
ORDER BY name ASC');
} else {
return Db::getInstance()->executeS('
SELECT *
FROM `'._DB_PREFIX_.'tax_rules_group` g'
.($only_active ? ' WHERE g.`active` = 1' : '').'
ORDER BY name ASC');
}
}
/**
+1 -1
View File
@@ -80,7 +80,7 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface
if (!empty($this->address->postcode))
$postcode = $this->address->postcode;
if (!isset(self::$cache_tax_calculator[$postcode.'-'.$this->type]))
if (!isset(self::$cache_tax_calculator[(int)$this->address->id_country.'-'.$postcode.'-'.$this->type]))
{
$rows = Db::getInstance()->executeS('
SELECT *
+26 -19
View File
@@ -1260,32 +1260,39 @@ class WebserviceRequestCore
if (!isset($this->urlFragments['display']))
$this->fieldsToDisplay = 'full';
// Check if Object is accessible for this/those id_shop
$assoc = Shop::getAssoTable($this->resourceConfiguration['retrieveData']['table']);
if ($assoc !== false)
{
$sql = 'SELECT 1
FROM `'.bqSQL(_DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table']);
if ($assoc['type'] != 'fk_shop')
$sql .= '_'.$assoc['type'];
$sql .= '`';
foreach (self::$shopIDs as $id_shop)
$OR[] = ' id_shop = '.(int)$id_shop.' ';
$check = ' WHERE ('.implode('OR', $OR).') AND `'.bqSQL($this->resourceConfiguration['fields']['id']['sqlId']).'` = '.(int)$this->urlSegment[1];
if (!Db::getInstance()->getValue($sql.$check))
$this->setError(403, 'Bad id_shop : You are not allowed to access this '.$this->resourceConfiguration['retrieveData']['className'].' ('.(int)$this->urlSegment[1].')', 131);
}
//get entity details
$object = new $this->resourceConfiguration['retrieveData']['className']((int)$this->urlSegment[1]);
if ($object->id)
{
$objects[] = $object;
// Check if Object is accessible for this/those id_shop
$assoc = Shop::getAssoTable($this->resourceConfiguration['retrieveData']['table']);
if ($assoc !== false)
{
$check_shop_group = false;
$sql = 'SELECT 1
FROM `'.bqSQL(_DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table']);
if ($assoc['type'] != 'fk_shop')
$sql .= '_'.$assoc['type'];
else
{
$def = ObjectModel::getDefinition($this->resourceConfiguration['retrieveData']['className']);
if (isset($def['fields']) && isset($def['fields']['id_shop_group']))
$check_shop_group = true;
}
$sql .= '`';
foreach (self::$shopIDs as $id_shop)
$OR[] = ' (id_shop = '.(int)$id_shop.($check_shop_group ? ' OR (id_shop = 0 AND id_shop_group='.(int)Shop::getGroupFromShop((int)$id_shop).')' : '').') ';
$check = ' WHERE ('.implode('OR', $OR).') AND `'.bqSQL($this->resourceConfiguration['fields']['id']['sqlId']).'` = '.(int)$this->urlSegment[1];
if (!Db::getInstance()->getValue($sql.$check))
$this->setError(404, 'This '.$this->resourceConfiguration['retrieveData']['className'].' ('.(int)$this->urlSegment[1].') does not exists on this shop', 131);
}
return $objects;
}
elseif (!count($this->errors))
if (!count($this->errors))
{
$this->objOutput->setStatus(404);
$this->_outputEnabled = false;
+4 -2
View File
@@ -62,8 +62,10 @@ function smartyTranslate($params, &$smarty)
else
$msg = $params['s'];
if ($msg != $params['s'])
$msg = $params['js'] ? addslashes($msg) : stripslashes($msg);
if ($msg != $params['s'] && !$params['js'])
$msg = stripslashes($msg);
elseif ($params['js'])
$msg = addslashes($msg);
if ($params['sprintf'] !== null)
$msg = Translate::checkAndReplaceArgs($msg, $params['sprintf']);
@@ -27,7 +27,7 @@
class AdminCarrierWizardControllerCore extends AdminController
{
protected $wizard_access;
public function __construct()
{
$this->bootstrap = true;
@@ -39,13 +39,16 @@ class AdminCarrierWizardControllerCore extends AdminController
$this->deleted = true;
$this->step_number = 0;
$this->multishop_context = Shop::CONTEXT_ALL;
$this->context = Context::getContext();
$this->fieldImageSettings = array(
'name' => 'logo',
'dir' => 's'
);
parent::__construct();
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, Tab::getIdFromClassName('AdminCarriers'));
}
@@ -69,7 +72,7 @@ class AdminCarrierWizardControllerCore extends AdminController
'title' => $this->l('Shipping locations and costs'),
),
array(
'title' => $this->l('Size, weight, and group access'),
'title' => $this->l('Size, weight, and group access'),
),
array(
'title' => $this->l('Summary'),
@@ -82,7 +85,6 @@ class AdminCarrierWizardControllerCore extends AdminController
$multistore_step = array(
array(
'title' => $this->l('MultiStore'),
'desc' => $this->l('MultiStore'),
)
);
array_splice($this->wizard_steps['steps'], 1, 0, $multistore_step);
@@ -97,7 +99,7 @@ class AdminCarrierWizardControllerCore extends AdminController
$carrier = $this->loadObject();
elseif ($this->tabAccess['add'])
$carrier = new Carrier();
if ((!$this->tabAccess['edit'] && Tools::getValue('id_carrier')) || (!$this->tabAccess['add'] && !Tools::getValue('id_carrier')))
{
$this->errors[] = Tools::displayError('You do not have permission to use this wizard.');
@@ -111,6 +113,7 @@ class AdminCarrierWizardControllerCore extends AdminController
'wizard_steps' => $this->wizard_steps,
'validate_url' => $this->context->link->getAdminLink('AdminCarrierWizard'),
'carrierlist_url' => $this->context->link->getAdminLink('AdminCarriers').'&conf='.((int)Validate::isLoadedObject($carrier) ? 4 : 3),
'multistore_enable' => Shop::isFeatureActive(),
'wizard_contents' => array(
'contents' => array(
0 => $this->renderStepOne($carrier),
@@ -120,14 +123,14 @@ class AdminCarrierWizardControllerCore extends AdminController
)),
'labels' => array('next' => $this->l('Next'), 'previous' => $this->l('Previous'), 'finish' => $this->l('Finish'))
);
if (Shop::isFeatureActive())
array_splice($this->tpl_view_vars['wizard_contents']['contents'], 1, 0, array(0 => $this->renderStepTwo($carrier)));
$this->context->smarty->assign(array(
'carrier_logo' => (Validate::isLoadedObject($carrier) && file_exists(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg') ? _THEME_SHIP_DIR_.$carrier->id.'.jpg' : false)
));
'carrier_logo' => (Validate::isLoadedObject($carrier) && file_exists(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg') ? _THEME_SHIP_DIR_.$carrier->id.'.jpg' : false)
));
$this->content .= $this->createTemplate('logo.tpl')->fetch();
$this->addjQueryPlugin(array('ajaxfileupload'));
@@ -137,7 +140,7 @@ class AdminCarrierWizardControllerCore extends AdminController
public function initToolbarTitle()
{
$bread_extended = array_unique($this->breadcrumbs);
if (Tools::getValue('id_carrier'))
$bread_extended[1] = $this->l('Edit');
else
@@ -145,13 +148,13 @@ class AdminCarrierWizardControllerCore extends AdminController
$this->toolbar_title = $bread_extended;
}
public function initToolbar()
{
parent::initToolbar();
$this->toolbar_btn['back']['href'] = $this->context->link->getAdminLink('AdminCarriers');
}
public function renderStepOne($carrier)
{
$this->fields_form = array(
@@ -199,7 +202,7 @@ class AdminCarrierWizardControllerCore extends AdminController
),
)),
);
$tpl_vars = array('max_image_size' => (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE') / 1024 / 1024);
$fields_value = $this->getStepOneFieldsValues($carrier);
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value, $tpl_vars);
@@ -327,19 +330,18 @@ class AdminCarrierWizardControllerCore extends AdminController
'type' => 'zone',
'name' => 'zones'
)
),
));
),
));
$tpl_vars = array();
$tpl_vars['PS_WEIGHT_UNIT'] = Configuration::get('PS_WEIGHT_UNIT');
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$tpl_vars['currency_sign'] = $currency->sign;
$fields_value = $this->getStepThreeFieldsValues($carrier);
$this->getTplRangesVarsAndValues($carrier, $tpl_vars, $fields_value);
$this->getTplRangesVarsAndValues($carrier, $tpl_vars, $fields_value);
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value, $tpl_vars);
}
@@ -351,31 +353,28 @@ class AdminCarrierWizardControllerCore extends AdminController
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Maximum package height ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
'label' => sprintf($this->l('Maximum package height (%s):'), Configuration::get('PS_DIMENSION_UNIT')),
'name' => 'max_height',
'required' => false,
'hint' => $this->l('Maximum height managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
.')
'hint' => $this->l('Maximum height managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer.')
),
array(
'type' => 'text',
'label' => $this->l('Maximum package width ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
'label' => sprintf($this->l('Maximum package width (%s):'), Configuration::get('PS_DIMENSION_UNIT')),
'name' => 'max_width',
'required' => false,
'hint' => $this->l('Maximum width managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
.')
'hint' => $this->l('Maximum width managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer.')
),
array(
'type' => 'text',
'label' => $this->l('Maximum package depth ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
'label' => sprintf($this->l('Maximum package depth (%s):'), Configuration::get('PS_DIMENSION_UNIT')),
'name' => 'max_depth',
'required' => false,
'hint' => $this->l('Maximum depth managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
.')
'hint' => $this->l('Maximum depth managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer.')
),
array(
'type' => 'text',
'label' => $this->l('Maximum package weight ('.Configuration::get('PS_WEIGHT_UNIT').'):'),
'label' => sprintf($this->l('Maximum package weight (%s):'), Configuration::get('PS_WEIGHT_UNIT')),
'name' => 'max_weight',
'required' => false,
'hint' => $this->l('Maximum weight managed by this carrier. Set the value to "0", or leave this field blank to ignore.')
@@ -389,7 +388,7 @@ class AdminCarrierWizardControllerCore extends AdminController
)
)
));
$fields_value = $this->getStepFourFieldsValues($carrier);
// Added values of object Group
@@ -399,14 +398,14 @@ class AdminCarrierWizardControllerCore extends AdminController
foreach ($carrier_groups as $carrier_group)
$carrier_groups_ids[] = $carrier_group['id_group'];
$groups = Group::getGroups($this->context->language->id);
$groups = Group::getGroups($this->context->language->id);
foreach ($groups as $group)
$fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $carrier_groups_ids) || empty($carrier_groups_ids) && !$carrier->id));
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value);
}
public function renderStepFive($carrier)
{
$this->fields_form = array(
@@ -436,20 +435,20 @@ class AdminCarrierWizardControllerCore extends AdminController
)
)
));
$template = $this->createTemplate('controllers/carrier_wizard/summary.tpl');
$fields_value = $this->getStepFiveFieldsValues($carrier);
$active_form = $this->renderGenericForm(array('form' => $this->fields_form), $fields_value);
$active_form = str_replace(array('<fieldset id="fieldset_form">', '</fieldset>'), '', $active_form);
$template->assign('active_form', $active_form);
return $template->fetch('controllers/carrier_wizard/summary.tpl');
}
protected function getTplRangesVarsAndValues($carrier, &$tpl_vars, &$fields_value)
{
$tpl_vars['zones'] = Zone::getZones(false);
@@ -459,13 +458,13 @@ class AdminCarrierWizardControllerCore extends AdminController
foreach ($carrier_zones as $carrier_zone)
$carrier_zones_ids[] = $carrier_zone['id_zone'];
$range_table = $carrier->getRangeTable();
$range_table = $carrier->getRangeTable();
$shipping_method = $carrier->getShippingMethod();
$zones = Zone::getZones(false);
foreach ($zones as $zone)
$fields_value['zones'][$zone['id_zone']] = Tools::getValue('zone_'.$zone['id_zone'], (in_array($zone['id_zone'], $carrier_zones_ids)));
if ($shipping_method == Carrier::SHIPPING_METHOD_FREE)
{
$range_obj = $carrier->getRangeObject($carrier->shipping_method);
@@ -506,10 +505,10 @@ class AdminCarrierWizardControllerCore extends AdminController
$helper->id = (int)Tools::getValue('id_carrier');
$helper->identifier = $this->identifier;
$helper->tpl_vars = array_merge(array(
'fields_value' => $fields_value,
'languages' => $this->getLanguages(),
'id_language' => $this->context->language->id
), $tpl_vars);
'fields_value' => $fields_value,
'languages' => $this->getLanguages(),
'id_language' => $this->context->language->id
), $tpl_vars);
$helper->override_folder = 'carrier_wizard/';
return $helper->generateForm($fields_form);
@@ -535,9 +534,9 @@ class AdminCarrierWizardControllerCore extends AdminController
public function getStepThreeFieldsValues($carrier)
{
$id_tax_rules_group = (is_object($this->object) && !$this->object->id) ? Carrier::getIdTaxRulesGroupMostUsed() : $this->getFieldValue($carrier, 'id_tax_rules_group');
$shipping_handling = (is_object($this->object) && !$this->object->id) ? 0 : $this->getFieldValue($carrier, 'shipping_handling');
return array(
'is_free' => $this->getFieldValue($carrier, 'is_free'),
'id_tax_rules_group' => (int)$id_tax_rules_group,
@@ -556,15 +555,15 @@ class AdminCarrierWizardControllerCore extends AdminController
'max_width' => $this->getFieldValue($carrier, 'max_width'),
'max_depth' => $this->getFieldValue($carrier, 'max_depth'),
'max_weight' => $this->getFieldValue($carrier, 'max_weight'),
'group' => $this->getFieldValue($carrier, 'group'),
'group' => $this->getFieldValue($carrier, 'group'),
);
}
public function getStepFiveFieldsValues($carrier)
{
return array('active' => $this->getFieldValue($carrier, 'active'));
}
public function ajaxProcessChangeRanges()
{
if ((Validate::isLoadedObject($this->object) && !$this->tabAccess['edit']) || !$this->tabAccess['add'])
@@ -584,17 +583,17 @@ class AdminCarrierWizardControllerCore extends AdminController
$template = $this->createTemplate('controllers/carrier_wizard/helpers/form/form_ranges.tpl');
$template->assign($tpl_vars);
$template->assign('change_ranges', 1);
$template->assign('fields_value', $fields_value);
$template->assign('input', array('type' => 'zone', 'name' => 'zones' ));
$template->assign('input', array('type' => 'zone', 'name' => 'zones' ));
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$template->assign('currency_sign', $currency->sign);
$template->assign('PS_WEIGHT_UNIT', Configuration::get('PS_WEIGHT_UNIT'));
die($template->fetch());
}
public function ajaxProcessValidateStep()
{
$step_number = (int)Tools::getValue('step_number');
@@ -623,7 +622,7 @@ class AdminCarrierWizardControllerCore extends AdminController
}
die(Tools::jsonEncode($return));
}
public function processRanges($id_carrier)
{
if (!$this->tabAccess['edit'] || !$this->tabAccess['add'])
@@ -635,13 +634,13 @@ class AdminCarrierWizardControllerCore extends AdminController
$carrier = new Carrier((int)$id_carrier);
if (!Validate::isLoadedObject($carrier))
return false;
$range_inf = Tools::getValue('range_inf');
$range_sup = Tools::getValue('range_sup');
$range_type = Tools::getValue('shipping_method');
$fees = Tools::getValue('fees');
$carrier->deleteDeliveryPrice($carrier->getRangeTable());
if ($range_type != Carrier::SHIPPING_METHOD_FREE)
{
@@ -657,10 +656,10 @@ class AdminCarrierWizardControllerCore extends AdminController
else
{
$range = new RangeWeight((int)$key);
$add_range = false;
$add_range = false;
}
}
if ($range_type == Carrier::SHIPPING_METHOD_PRICE)
{
if (!RangePrice::rangeExist((int)$carrier->id, (float)$delimiter1, (float)$range_sup[$key]))
@@ -678,7 +677,7 @@ class AdminCarrierWizardControllerCore extends AdminController
$range->delimiter2 = (float)$range_sup[$key];
$range->save();
}
if (!Validate::isLoadedObject($range))
return false;
$price_list = array();
@@ -700,19 +699,20 @@ class AdminCarrierWizardControllerCore extends AdminController
}
return true;
}
public function ajaxProcessUploadLogo()
{
if (!$this->tabAccess['edit'])
die('<return result="error" message="'.Tools::displayError('You do not have permission to use this wizard.').'" />');
$allowedExtensions = array('jpeg', 'gif', 'png', 'jpg');
$logo = (isset($_FILES['carrier_logo_input']) ? $_FILES['carrier_logo_input'] : false);
if ($logo && !empty($logo['tmp_name']) && $logo['tmp_name'] != 'none'
&& (!isset($logo['error']) || !$logo['error'])
&& preg_match('/\.(jpe?g|gif|png)$/', $logo['name'])
&& is_uploaded_file($logo['tmp_name']))
&& is_uploaded_file($logo['tmp_name'])
&& ImageManager::isRealImage($logo['tmp_name'], $logo['type']))
{
$file = $logo['tmp_name'];
do $tmp_name = uniqid().'.jpg';
@@ -725,18 +725,18 @@ class AdminCarrierWizardControllerCore extends AdminController
else
die('<return result="error" message="Cannot upload file" />');
}
public function ajaxProcessFinishStep()
{
$return = array('has_error' => false);
if (!$this->tabAccess['edit'])
$return = array(
'has_error' => true,
$return['errors'][] = Tools::displayError('You do not have permission to use this wizard.')
);
else
{
{
if ($id_carrier = Tools::getValue('id_carrier'))
{
$current_carrier = new Carrier((int)$id_carrier);
@@ -758,9 +758,9 @@ class AdminCarrierWizardControllerCore extends AdminController
$this->changeGroups((int)$new_carrier->id);
// Call of hooks
Hook::exec('actionCarrierUpdate', array(
'id_carrier' => (int)$current_carrier->id,
'carrier' => $new_carrier
));
'id_carrier' => (int)$current_carrier->id,
'carrier' => $new_carrier
));
$this->postImage($new_carrier->id);
$this->changeZones($new_carrier->id);
$new_carrier->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'));
@@ -777,14 +777,14 @@ class AdminCarrierWizardControllerCore extends AdminController
$return['errors'][] = $this->l('An error occurred while saving this carrier.');
}
}
if ($carrier->is_free)
{
//if carrier is free delete shipping cost
$carrier->deleteDeliveryPrice('range_weight');
$carrier->deleteDeliveryPrice('range_price');
}
if (Validate::isLoadedObject($carrier))
{
if (!$this->changeGroups((int)$carrier->id))
@@ -798,7 +798,7 @@ class AdminCarrierWizardControllerCore extends AdminController
$return['has_error'] = true;
$return['errors'][] = $this->l('An error occurred while saving carrier zones.');
}
if (!$carrier->is_free)
if (!$this->processRanges((int)$carrier->id))
{
@@ -837,7 +837,7 @@ class AdminCarrierWizardControllerCore extends AdminController
}
die(Tools::jsonEncode($return));
}
protected function changeGroups($id_carrier, $delete = true)
{
$carrier = new Carrier((int)$id_carrier);
@@ -860,34 +860,31 @@ class AdminCarrierWizardControllerCore extends AdminController
if (!isset($_POST['zone_'.$zone['id_zone']]) || !$_POST['zone_'.$zone['id_zone']])
$return &= $carrier->deleteZone((int)$zone['id_zone']);
}
else
if (isset($_POST['zone_'.$zone['id_zone']]) && $_POST['zone_'.$zone['id_zone']])
$return &= $carrier->addZone((int)$zone['id_zone']);
else
if (isset($_POST['zone_'.$zone['id_zone']]) && $_POST['zone_'.$zone['id_zone']])
$return &= $carrier->addZone((int)$zone['id_zone']);
return $return;
return $return;
}
public static function getValidationRules()
{
$step_number = Tools::getValue('step_number');
if ($step_number == 4 && !Shop::isFeatureActive() || $step_number == 5 && Shop::isFeatureActive())
return array();
$step_fields = array(
1 => array('name', 'delay', 'grade', 'url'),
2 => array('is_free', 'id_tax_rules_group', 'shipping_handling', 'shipping_method', 'range_behavior'),
3 => array('range_behavior', 'max_height', 'max_width', 'max_depth', 'max_weight'),
4 => array(),
);
if (Shop::isFeatureActive())
{
$multistore_field = array(array('shop'));
$tmp = $step_fields;
$step_fields = array(1 => $tmp[1]) + $multistore_field;
array_shift($tmp);
foreach ($tmp as $row)
$step_field[] = $row;
array_splice($step_fields, 1, 0, $multistore_field);
}
$rules = Carrier::getValidationRules('Carrier');
@@ -899,18 +896,18 @@ class AdminCarrierWizardControllerCore extends AdminController
{
if(!in_array($field, $step_fields[$step_number]))
unset($rules[$key_r][$key_f]);
}
}
else if(!in_array($key_f, $step_fields[$step_number]))
unset($rules[$key_r][$key_f]);
unset($rules[$key_r][$key_f]);
}
return $rules;
}
public static function displayFieldName($field)
{
return $field;
}
public function duplicateLogo($new_id, $old_id)
{
$old_logo = _PS_SHIP_IMG_DIR_.'/'.(int)$old_id.'.jpg';
+7 -52
View File
@@ -94,55 +94,6 @@ class AdminCarriersControllerCore extends AdminController
'position' => 'position'
)
);
$carrier_default_sort = array(
array('value' => Carrier::SORT_BY_PRICE, 'name' => $this->l('Price')),
array('value' => Carrier::SORT_BY_POSITION, 'name' => $this->l('Position'))
);
$carrier_default_order = array(
array('value' => Carrier::SORT_BY_ASC, 'name' => $this->l('Ascending')),
array('value' => Carrier::SORT_BY_DESC, 'name' => $this->l('Descending'))
);
$this->fields_options = array(
'general' => array(
'title' => $this->l('Carrier options'),
'fields' => array(
'PS_CARRIER_DEFAULT' => array(
'title' => $this->l('Default carrier:'),
'hint' => $this->l('Your shop\'s default carrier'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id_carrier',
'list' => array_merge(
array(
-1 => array('id_carrier' => -1, 'name' => $this->l('Best price')),
-2 => array('id_carrier' => -2, 'name' => $this->l('Best grade'))
),
Carrier::getCarriers((int)Configuration::get('PS_LANG_DEFAULT'), true, false, false, null, Carrier::ALL_CARRIERS))
),
'PS_CARRIER_DEFAULT_SORT' => array(
'title' => $this->l('Sort by:'),
'hint' => $this->l('This will only be visible in the Front Office'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'value',
'list' => $carrier_default_sort
),
'PS_CARRIER_DEFAULT_ORDER' => array(
'title' => $this->l('Order by:'),
'hint' => $this->l('This will only be visible in the Front Office'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'value',
'list' => $carrier_default_order
),
),
'submit' => array()
)
);
parent::__construct();
}
@@ -504,7 +455,8 @@ class AdminCarriersControllerCore extends AdminController
}
parent::postProcess();
}
else if ((isset($_GET['status'.$this->table]) || isset($_GET['status'])) && Tools::getValue($this->identifier))
/*
else if ((isset($_GET['status'.$this->table]) || isset($_GET['status'])) && Tools::getValue($this->identifier))
{
if ($this->tabAccess['edit'] === '1')
{
@@ -516,17 +468,20 @@ class AdminCarriersControllerCore extends AdminController
else
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
*/
else if (isset($_GET['isFree'.$this->table]))
{
$this->processIsFree();
}
else
{
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
/*
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
|| (isset($_GET['delete'.$this->table]) && Tools::getValue('id_carrier') == Configuration::get('PS_CARRIER_DEFAULT')))
$this->errors[] = $this->l('Please set another carrier as default before deleting this one.');
else
{
*/
// if deletion : removes the carrier from the warehouse/carrier association
if (Tools::isSubmit('delete'.$this->table))
{
@@ -548,7 +503,7 @@ class AdminCarriersControllerCore extends AdminController
}
parent::postProcess();
Carrier::cleanPositions();
}
//}
}
}
@@ -248,7 +248,7 @@ class AdminCategoriesControllerCore extends AdminController
{
if (empty($this->display))
{
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops()) > 1)
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE'))
$this->toolbar_btn['new-url'] = array(
'href' => self::$currentIndex.'&amp;add'.$this->table.'root&amp;token='.$this->token,
'desc' => $this->l('Add new root category')
@@ -460,7 +460,8 @@ class AdminCategoriesControllerCore extends AdminController
$this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int)Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
// Display this field only if multistore option is enabled
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE'))
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && Tools::isSubmit('add'.$this->table.'root'))
{
$this->fields_form['input'][] = array(
'type' => 'switch',
'label' => $this->l('Root Category:'),
@@ -480,6 +481,8 @@ class AdminCategoriesControllerCore extends AdminController
)
)
);
unset($this->fields_form['input'][2],$this->fields_form['input'][3]);
}
// Display this field only if multistore option is enabled AND there are several stores configured
if (Shop::isFeatureActive())
$this->fields_form['input'][] = array(
@@ -494,9 +497,6 @@ class AdminCategoriesControllerCore extends AdminController
if (in_array($input['name'], array('id_parent', 'is_root_category')))
unset($this->fields_form['input'][$k]);
if (Tools::isSubmit('add'.$this->table.'root'))
unset($this->fields_form['input'][2],$this->fields_form['input'][3]);
if (!($obj = $this->loadObject(true)))
return;
@@ -520,6 +520,8 @@ class AdminCategoriesControllerCore extends AdminController
foreach ($groups as $group)
$this->fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $category_groups_ids)));
$this->fields_value['is_root_category'] = (bool)Tools::isSubmit('add'.$this->table.'root');
return parent::renderForm();
}
@@ -550,7 +552,7 @@ class AdminCategoriesControllerCore extends AdminController
$id_parent = (int)Tools::getValue('id_parent');
// if true, we are in a root category creation
if (!$id_parent && !Tools::isSubmit('is_root_category'))
if (!$id_parent)
{
$_POST['is_root_category'] = $_POST['level_depth'] = 1;
$_POST['id_parent'] = $id_parent = (int)Configuration::get('PS_ROOT_CATEGORY');
+2 -1
View File
@@ -111,9 +111,10 @@ class AdminCmsControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Meta title:'),
'name' => 'meta_title',
'id' => 'name', // for copy2friendlyUrl compatibility
'id' => 'name', // for copyMeta2friendlyURL compatibility
'lang' => true,
'required' => true,
'class' => 'copyMeta2friendlyURL',
'hint' => $this->l('Invalid characters:').' &lt;&gt;;=#{}'
),
array(
@@ -367,7 +367,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
$cm->id_employee = (int)$this->context->employee->id;
$cm->id_customer_thread = $ct->id;
$cm->message = Tools::htmlentitiesutf8(Tools::getValue('reply_message'));
$cm->message = Tools::getValue('reply_message');
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
if (isset($_FILES) && !empty($_FILES['joinFile']['name']) && $_FILES['joinFile']['error'] != 0)
$this->errors[] = Tools::displayError('An error occurred during the file upload process.');
@@ -768,7 +768,8 @@ class AdminCustomersControllerCore extends AdminController
if ($customer_email != $this->object->email)
{
$customer = new Customer();
$customer->getByEmail($customer_email);
if (Validate::isEmail($customer_email))
$customer->getByEmail($customer_email);
if ($customer->id)
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
}
@@ -454,6 +454,24 @@ class AdminEmployeesControllerCore extends AdminController
return parent::initContent();
}
protected function afterUpdate($object)
{
$res = parent::afterUpdate($object);
// Update cookie if needed
if (Tools::getValue('id_employee') == $this->context->employee->id && Tools::getValue('passwd') && $object->passwd != $this->context->employee->passwd)
$this->context->cookie->passwd = $this->context->employee->passwd = $object->passwd;
return $res;
}
protected function ajaxProcessFormLanguage()
{
$this->context->cookie->employee_form_lang = (int)Tools::getValue('form_language_id');
if (!$this->context->cookie->write())
die ('Error while updating cookie.');
die ('Form language updated.');
}
public function ajaxProcessGetTabByIdProfile()
{
$id_profile = Tools::getValue('id_profile');
+12 -3
View File
@@ -53,8 +53,17 @@ class AdminImagesControllerCore extends AdminController
'stores' => array('title' => $this->l('Stores'), 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false)
);
// No need to display the old image system if the install has been made later than 2013-03-26
$this->display_move = (!Configuration::get('PS_LEGACY_IMAGES') && defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true;
// No need to display the old image system migration tool except if product images are in _PS_PROD_IMG_DIR_
$this->display_move = false;
$dir = _PS_PROD_IMG_DIR_;
if (is_dir($dir))
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false && $this->display_move == false)
if (!is_dir($dir.DIRECTORY_SEPARATOR.$file) && $file[0] != '.' && is_numeric($file[0]))
$this->display_move = true;
closedir($dh);
}
$this->fields_options = array(
'images' => array(
@@ -636,7 +645,7 @@ class AdminImagesControllerCore extends AdminController
public function initMoveImages()
{
$this->context->smarty->assign(array(
'safe_mode' => ini_get('safe_mode'),
'safe_mode' => Tools::getSafeModeStatus(),
'link_ppreferences' => 'index.php?tab=AdminPPreferences&token='.Tools::getAdminTokenLite('AdminPPreferences').'#PS_LEGACY_IMAGES_on',
));
}
+17 -10
View File
@@ -2436,17 +2436,12 @@ class AdminImportControllerCore extends AdminController
$discount_rate = (float)$info['discount_rate'];
$tax_rate = (float)$info['tax_rate'];
// checks if one product is there only once
if (isset($product['id_product']))
{
if ($product['id_product'] == $id_product_attribute)
$this->errors[] = sprintf($this->l('Product (%d/%D) cannot be added twice (at line %d).'), $id_product,
$id_product_attribute, $current_line + 1);
else
$product['id_product'] = $id_product_attribute;
}
// checks if one product/attribute is there only once
if (isset($products[$id_product][$id_product_attribute]))
$this->errors[] = sprintf($this->l('Product/Attribute (%d/%d) cannot be added twice (at line %d).'), $id_product,
$id_product_attribute, $current_line + 1);
else
$product['id_product'] = 0;
$products[$id_product][$id_product_attribute] = $quantity_expected;
// checks parameters
if (false === ($supplier_reference = ProductSupplier::getProductSupplierReference($id_product, $id_product_attribute, $supply_order->id_supplier)))
@@ -2659,6 +2654,13 @@ class AdminImportControllerCore extends AdminController
Image::clearTmpDir();
return true;
}
public function clearSmartyCache()
{
Tools::enableCache();
Tools::clearCache($this->context->smarty);
Tools::restoreCacheSettings();
}
public function postProcess()
{
@@ -2716,10 +2718,12 @@ class AdminImportControllerCore extends AdminController
{
case $this->entities[$import_type = $this->l('Categories')]:
$this->categoryImport();
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Products')]:
$import_type = $this->l('Categories');
$this->productImport();
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Customers')]:
$this->customerImport();
@@ -2729,12 +2733,15 @@ class AdminImportControllerCore extends AdminController
break;
case $this->entities[$import_type = $this->l('Combinations')]:
$this->attributeImport();
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Manufacturers')]:
$this->manufacturerImport();
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Suppliers')]:
$this->supplierImport();
$this->clearSmartyCache();
break;
// @since 1.5.0
case $this->entities[$import_type = $this->l('Supply Orders')]:
@@ -113,7 +113,8 @@ class AdminLanguagesControllerCore extends AdminController
$this->addRowAction('delete');
$this->displayWarning($this->l('When you delete a language, all related translations in the database will be deleted.'));
$this->displayInformation($this->l('Your .htaccess file must be writable.'));
if (!is_writable(_PS_ROOT_DIR_.'/.htaccess') && Configuration::get('PS_REWRITING_SETTINGS'))
$this->displayInformation($this->l('Your .htaccess file must be writable.'));
return parent::renderList();
}
@@ -384,12 +385,11 @@ class AdminLanguagesControllerCore extends AdminController
if ($_FILES['no-picture']['error'] == UPLOAD_ERR_OK)
$this->copyNoPictureImage(strtolower(Tools::getValue('iso_code')));
unset($_FILES['no-picture']);
return parent::processAdd();
}
else
$this->errors[] = Tools::displayError('Flag and "No picture" image fields are required.');
return false;
return parent::processAdd();
}
public function processUpdate()
@@ -29,9 +29,6 @@ class AdminLocalizationControllerCore extends AdminController
public function __construct()
{
$this->bootstrap = true;
$this->className = 'Configuration';
$this->table = 'configuration';
parent::__construct();
$this->fields_options = array(
+10 -3
View File
@@ -34,9 +34,6 @@ class AdminLogsControllerCore extends AdminController
$this->lang = false;
$this->noLink = true;
$this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->fields_list = array(
'id_log' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'employee' => array('title' => $this->l('Employee'), 'align' => 'center', 'width' => 100),
@@ -67,10 +64,20 @@ class AdminLogsControllerCore extends AdminController
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'employee e ON (a.id_employee = e.id_employee)';
parent::__construct();
}
public function processDelete()
{
return Logger::eraseAllLogs();
}
public function initToolbar()
{
parent::initToolbar();
$this->toolbar_btn['delete'] = array(
'short' => 'Erase',
'desc' => $this->l('Erase all'),
'js' => 'if (confirm(\''.$this->l('Are you sure?').'\')) document.location = \''.$this->context->link->getAdminLink('AdminLogs').'&amp;token='.$this->token.'&deletelog=1\';'
);
unset($this->toolbar_btn['new']);
}
@@ -259,27 +259,27 @@ class AdminManufacturersControllerCore extends AdminController
'label' => $this->l('Name:'),
'name' => 'name',
'required' => true,
'hint' => $this->l('Invalid characters:').' <>;=#{}'
'hint' => $this->l('Invalid characters:').' &lt;&gt;;=#{}'
),
array(
'type' => 'textarea',
'label' => $this->l('Short description:'),
'name' => 'short_description',
'lang' => true,
'class' => 'rte',
'hint' => $this->l('Invalid characters:').' <>;=#{}',
'rows' => 2,
'cols' => 10
'cols' => 60,
'rows' => 10,
'autoload_rte' => 'rte', //Enable TinyMCE editor for short description
'hint' => $this->l('Invalid characters:').' &lt;&gt;;=#{}'
),
array(
'type' => 'textarea',
'label' => $this->l('Description:'),
'name' => 'description',
'lang' => true,
'class' => 'rte',
'hint' => $this->l('Invalid characters:').' <>;=#{}',
'rows' => 2,
'cols' => 10
'cols' => 60,
'rows' => 10,
'autoload_rte' => 'rte', //Enable TinyMCE editor for description
'hint' => $this->l('Invalid characters:').' &lt;&gt;;=#{}'
),
array(
'type' => 'file',
@@ -293,14 +293,14 @@ class AdminManufacturersControllerCore extends AdminController
'label' => $this->l('Meta title:'),
'name' => 'meta_title',
'lang' => true,
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
'hint' => $this->l('Forbidden characters:').' &lt;&gt;;=#{}'
),
array(
'type' => 'text',
'label' => $this->l('Meta description:'),
'name' => 'meta_description',
'lang' => true,
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
'hint' => $this->l('Forbidden characters:').' &lt;&gt;;=#{}'
),
array(
'type' => 'tags',
@@ -308,7 +308,7 @@ class AdminManufacturersControllerCore extends AdminController
'name' => 'meta_keywords',
'lang' => true,
'hint' => array(
$this->l('Forbidden characters:').' <>;=#{}',
$this->l('Forbidden characters:').' &lt;&gt;;=#{}',
$this->l('To add "tags," click inside the field, write something, and then press "Enter."')
)
),
@@ -435,14 +435,14 @@ class AdminManufacturersControllerCore extends AdminController
'label' => $this->l('Last name:'),
'name' => 'lastname',
'required' => true,
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"{}_$%:'
'hint' => $this->l('Invalid characters:').' 0-9!&lt;&gt;,;?=+()@#"{}_$%:'
);
$form['input'][] = array(
'type' => 'text',
'label' => $this->l('First name:'),
'name' => 'firstname',
'required' => true,
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"{}_$%:'
'hint' => $this->l('Invalid characters:').' 0-9!&lt;&gt;,;?=+()@#"{}_$%:'
);
$form['input'][] = array(
'type' => 'text',
@@ -509,7 +509,7 @@ class AdminManufacturersControllerCore extends AdminController
'label' => $this->l('Other:'),
'name' => 'other',
'required' => false,
'hint' => $this->l('Forbidden characters:').' <>;=#{}',
'hint' => $this->l('Forbidden characters:').' &lt;&gt;;=#{}',
'rows' => 2,
'cols' => 10
);
+4 -2
View File
@@ -140,7 +140,7 @@ class AdminMetaControllerCore extends AdminController
$this->url = ShopUrl::getShopUrls($this->context->shop->id)->where('main', '=', 1)->getFirst();
if ($this->url)
{
$shop_url_options['description'] = $this->l('Here you can set the URL for your shop. If you migrate your shop to a new URL, remember to change the values bellow.');
$shop_url_options['description'] = $this->l('Here you can set the URL for your shop. If you migrate your shop to a new URL, remember to change the values below.');
$shop_url_options['fields'] = array(
'domain' => array(
'title' => $this->l('Shop domain'),
@@ -366,6 +366,9 @@ class AdminMetaControllerCore extends AdminController
else if (Tools::isSubmit('submitRobots'))
$this->generateRobotsFile();
if (Tools::isSubmit('PS_ROUTE_product_rule'))
Tools::clearCache($this->context->smarty);
return parent::postProcess();
}
@@ -470,7 +473,6 @@ class AdminMetaControllerCore extends AdminController
else
Configuration::updateValue('PS_ROUTE_'.$route_id, $rule);
}
}
/**
+17 -11
View File
@@ -99,6 +99,8 @@ class AdminModulesControllerCore extends AdminController
$this->list_modules_categories['others']['name'] = $this->l('Other Modules');
$this->list_modules_categories['mobile']['name'] = $this->l('Mobile');
uasort($this->list_modules_categories, array($this, 'checkCategoriesNames'));
// Set Id Employee, Iso Default Country and Filter Configuration
$this->id_employee = (int)$this->context->employee->id;
$this->iso_default_country = $this->context->country->iso_code;
@@ -130,6 +132,14 @@ class AdminModulesControllerCore extends AdminController
$this->logged_on_addons = true;
}
public function checkCategoriesNames($a, $b)
{
if ($a['name'] === $this->l('Other Modules'))
return true;
return (bool)($a['name'] > $b['name']);
}
public function setMedia()
{
parent::setMedia();
@@ -631,9 +641,8 @@ class AdminModulesControllerCore extends AdminController
if (!$download_ok)
$this->errors[] = $this->l('Error on downloading the lastest version');
else
if(!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
elseif (!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
}
}
}
@@ -675,18 +684,18 @@ class AdminModulesControllerCore extends AdminController
// Get the return value of current method
$echo = $module->{$method}();
// After a successful install of a single module that has a configuration method, to the configuration page
if ($key == 'install' && $echo === true && strpos(Tools::getValue('install'), '|') === false && method_exists($module, 'getContent'))
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&configure='.$module->name.'&conf=12');
}
// If the method called is "configure" (getContent method), we show the html code of configure page
if ($key == 'configure' && Module::isInstalled($module->name))
{
if (isset($module->multishop_context))
$this->multishop_context = $module->multishop_context;
$backlink = self::$currentIndex.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name;
$hooklink = 'index.php?tab=AdminModulesPositions&token='.Tools::getAdminTokenLite('AdminModulesPositions').'&show_modules='.(int)$module->id;
$tradlink = 'index.php?tab=AdminTranslations&token='.Tools::getAdminTokenLite('AdminTranslations').'&type=modules&lang=';
@@ -768,10 +777,8 @@ class AdminModulesControllerCore extends AdminController
Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
}
if(isset($_GET['update']))
{
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
}
if (isset($_GET['update']))
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : ''));
}
public function postProcess()
@@ -779,7 +786,6 @@ class AdminModulesControllerCore extends AdminController
// Parent Post Process
parent::postProcess();
// Get the list of installed module ans prepare it for ajax call.
if (($list = Tools::getValue('installed_modules')))
Context::getContext()->smarty->assign('installed_modules', Tools::jsonEncode(explode('|', $list)));
@@ -276,12 +276,13 @@ class AdminModulesPositionsControllerCore extends AdminController
'href' => self::$currentIndex.'&addToHook'.($this->display_key ? '&show_modules='.$this->display_key : '').'&token='.$this->token,
'desc' => $this->l('Transplant a module')
);
$live_edit_params = array(
'live_edit' => true,
'ad' => $admin_dir,
'liveToken' => $this->token,
'id_employee' => (int)$this->context->employee->id
'id_employee' => (int)$this->context->employee->id,
'id_shop' => (int)$this->context->shop->id
);
$this->context->smarty->assign(array(
@@ -308,10 +309,12 @@ class AdminModulesPositionsControllerCore extends AdminController
public function getLiveEditUrl($live_edit_params)
{
$lang = '';
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$dir = str_replace($admin_dir, '', dirname($_SERVER['SCRIPT_NAME']));
if (Configuration::get('PS_REWRITING_SETTINGS') && count(Language::getLanguages(true)) > 1)
$lang = Language::getIsoById($this->context->employee->id_lang).'/';
$url = $this->context->shop->getBaseURL().$lang.Dispatcher::getInstance()->createUrl('index', (int)$this->context->language->id, $live_edit_params);
$url = Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().$dir.$lang.Dispatcher::getInstance()->createUrl('index', (int)$this->context->language->id, $live_edit_params);
return $url;
}
+32 -6
View File
@@ -105,7 +105,8 @@ class AdminOrdersControllerCore extends AdminController
'type' => 'select',
'list' => $statuses_array,
'filter_key' => 'os!id_order_state',
'filter_type' => 'int'
'filter_type' => 'int',
'order_key' => 'osname'
),
'date_add' => array(
'title' => $this->l('Date'),
@@ -511,7 +512,7 @@ class AdminOrdersControllerCore extends AdminController
if (Tools::isSubmit('generateDiscountRefund') && !count($this->errors))
{
$cart_rule = new CartRule();
$cart_rule->description = sprintf($this->l('Credit card slip for order #%d'), $order->id);
$cart_rule->description = sprintf($this->l('Credit slip for order #%d'), $order->id);
$languages = Language::getLanguages(false);
foreach ($languages as $language)
// Define a temporary name
@@ -866,7 +867,7 @@ class AdminOrdersControllerCore extends AdminController
$payment_module->validateOrder(
(int)$cart->id, (int)$id_order_state,
$cart->getOrderTotal(true, Cart::BOTH), $payment_module->displayName, $this->l('Manual order -- Employee:').
Tools::safeOutput(substr($employee->firstname, 0, 1).'. '.$employee->lastname), array(), null, false, $cart->secure_key
substr($employee->firstname, 0, 1).'. '.$employee->lastname, array(), null, false, $cart->secure_key
);
if ($payment_module->currentOrder)
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$payment_module->currentOrder.'&vieworder'.'&token='.$this->token);
@@ -1337,6 +1338,13 @@ class AdminOrdersControllerCore extends AdminController
// if the current stock requires a warning
if ($product['current_stock'] == 0 && $display_out_of_stock_warning)
$this->displayWarning($this->l('This product is out of stock: ').' '.$product['product_name']);
if ($product['id_warehouse'] != 0)
{
$warehouse = new Warehouse((int)$product['id_warehouse']);
$product['warehouse_name'] = $warehouse->name;
}
else
$product['warehouse_name'] = '--';
}
// Smarty assign
@@ -1379,7 +1387,8 @@ class AdminOrdersControllerCore extends AdminController
'invoices_collection' => $order->getInvoicesCollection(),
'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(),
'payment_methods' => $payment_methods,
'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop)
'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop),
'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
);
return parent::renderView();
@@ -1742,6 +1751,13 @@ class AdminOrdersControllerCore extends AdminController
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']);
$product['return_history'] = OrderReturn::getProductReturnDetail((int)$product['id_order_detail']);
$product['refund_history'] = OrderSlip::getProductSlipDetail((int)$product['id_order_detail']);
if ($product['id_warehouse'] != 0)
{
$warehouse = new Warehouse((int)$product['id_warehouse']);
$product['warehouse_name'] = $warehouse->name;
}
else
$product['warehouse_name'] = '--';
// Get invoices collection
$invoice_collection = $order->getInvoicesCollection();
@@ -1762,7 +1778,8 @@ class AdminOrdersControllerCore extends AdminController
'invoices_collection' => $invoice_collection,
'current_id_lang' => Context::getContext()->language->id,
'link' => Context::getContext()->link,
'current_index' => self::$currentIndex
'current_index' => self::$currentIndex,
'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
));
$this->sendChangedNotification($order);
@@ -1957,6 +1974,14 @@ class AdminOrdersControllerCore extends AdminController
$product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']);
$product['refund_history'] = OrderSlip::getProductSlipDetail($order_detail->id);
if ($product['id_warehouse'] != 0)
{
$warehouse = new Warehouse((int)$product['id_warehouse']);
$product['warehouse_name'] = $warehouse->name;
}
else
$product['warehouse_name'] = '--';
// Get invoices collection
$invoice_collection = $order->getInvoicesCollection();
@@ -1976,7 +2001,8 @@ class AdminOrdersControllerCore extends AdminController
'invoices_collection' => $invoice_collection,
'current_id_lang' => Context::getContext()->language->id,
'link' => Context::getContext()->link,
'current_index' => self::$currentIndex
'current_index' => self::$currentIndex,
'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
));
if (!$res)
+2 -1
View File
@@ -176,7 +176,7 @@ class AdminPaymentControllerCore extends AdminController
),
array('items' => Group::getGroups($this->context->language->id),
'title' => $this->l('Group restrictions'),
'desc' => $this->l('Please mark each checkbox for the currency, or currencies, in which you want the payment module(s) to be available.'),
'desc' => $this->l('Please mark each checkbox for the customer group(s), in which you want the payment module(s) to be available.'),
'name_id' => 'group',
'identifier' => 'id_group',
'icon' => 'icon-group',
@@ -214,6 +214,7 @@ class AdminPaymentControllerCore extends AdminController
if ($name_id == 'country'
&& isset($module->limited_countries)
&& !empty($module->limited_countries)
&& is_array($module->limited_countries)
&& !(in_array(strtoupper($item['iso_code']), array_map('strtoupper', $module->limited_countries))))
$list['items'][$key_item]['check_list'][$key_module] = null;
}
@@ -767,6 +767,14 @@ class AdminPerformanceControllerCore extends AdminController
else
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
}
if ((bool)Tools::getValue('empty_smarty_cache'))
{
$redirectAdmin = true;
Tools::clearSmartyCache();
Autoload::getInstance()->generateIndex();
}
if ($redirectAdmin && (!isset($this->errors) || !count($this->errors)))
{
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => ''));
+32 -79
View File
@@ -357,18 +357,17 @@ class AdminProductsControllerCore extends AdminController
$result = parent::loadObject($opt);
if ($result && Validate::isLoadedObject($this->object))
{
if (Shop::getContext() == Shop::CONTEXT_SHOP && !$this->object->isAssociatedToShop())
if (Shop::getContext() == Shop::CONTEXT_SHOP && Shop::isFeatureActive() && !$this->object->isAssociatedToShop())
{
$default_product = new Product((int)$this->object->id, false, null, (int)$this->object->id_shop_default);
$def = ObjectModel::getDefinition($this->object);
foreach ($def['fields'] as $field_name => $row)
{
$fields_array = array();
if(is_array($default_product->$field_name))
foreach ($fields_array as $key => $fields_name)
$this->object->$field_name[$key] = ObjectModel::formatValue($fields_name, $def['fields'][$field_name]['type']);
if (is_array($default_product->$field_name))
foreach ($default_product->$field_name as $key => $value)
$this->object->{$field_name}[$key] = ObjectModel::formatValue($value, $def['fields'][$field_name]['type']);
else
$this->object->$field_name = ObjectModel::formatValue($this->object->$field_name, $def['fields'][$field_name]['type']);
$this->object->$field_name = ObjectModel::formatValue($default_product->$field_name, $def['fields'][$field_name]['type']);
}
}
$this->object->loadStockData();
@@ -629,6 +628,7 @@ class AdminProductsControllerCore extends AdminController
{
$id_category = (int)Tools::getValue('id_category');
$category_url = empty($id_category) ? '' : '&id_category='.(int)$id_category;
Logger::addLog(sprintf($this->l('%s deletion'), $this->className), 1, null, $this->className, (int)$object->id, true, (int)$this->context->employee->id);
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token.$category_url;
}
else
@@ -667,7 +667,7 @@ class AdminProductsControllerCore extends AdminController
{
$productId = (int)Tools::getValue('id_product');
@unlink(_PS_TMP_IMG_DIR_.'product_'.$productId.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$productId.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$productId.'_'.$this->context->shop->id.'.jpg');
$this->redirect_after = self::$currentIndex.'&id_product='.$image->id_product.'&id_category='.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&action=Images&addproduct'.'&token='.$this->token;
}
}
@@ -861,6 +861,12 @@ class AdminProductsControllerCore extends AdminController
{
$combination = new Combination((int)$id_product_attribute);
$combination->setAttributes(Tools::getValue('attribute_combination_list'));
// images could be deleted before
$id_images = Tools::getValue('id_image_attr');
if (!empty($id_images))
$combination->setImages($id_images);
$product->checkDefaultAttributes();
if (Tools::getValue('attribute_default'))
{
@@ -1346,7 +1352,7 @@ class AdminProductsControllerCore extends AdminController
'shops' => $json_shops,
);
@unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$obj->id_product.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$obj->id_product.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$obj->id_product.'_'.$this->context->shop->id.'.jpg');
die(Tools::jsonEncode($json));
}
else
@@ -1518,7 +1524,7 @@ class AdminProductsControllerCore extends AdminController
$img->cover = 1;
@unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$img->id_product.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$img->id_product.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$img->id_product.'_'.$this->context->shop->id.'.jpg');
if ($img->update())
$this->jsonConfirmation($this->_conf[26]);
@@ -1554,8 +1560,8 @@ class AdminProductsControllerCore extends AdminController
if (file_exists(_PS_TMP_IMG_DIR_.'product_'.$image->id_product.'.jpg'))
$res &= @unlink(_PS_TMP_IMG_DIR_.'product_'.$image->id_product.'.jpg');
if (file_exists(_PS_TMP_IMG_DIR_.'product_mini_'.$image->id_product.'.jpg'))
$res &= @unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$image->id_product.'.jpg');
if (file_exists(_PS_TMP_IMG_DIR_.'product_mini_'.$image->id_product.'_'.$this->context->shop->id.'.jpg'))
$res &= @unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$image->id_product.'_'.$this->context->shop->id.'.jpg');
if ($res)
$this->jsonConfirmation($this->_conf[7]);
@@ -1644,7 +1650,7 @@ class AdminProductsControllerCore extends AdminController
if (count($this->errors))
return false;
@unlink(_PS_TMP_IMG_DIR_.'product_'.$product->id.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$product->id.'.jpg');
@unlink(_PS_TMP_IMG_DIR_.'product_mini_'.$product->id.'_'.$this->context->shop->id.'.jpg');
return ((isset($id_image) && is_int($id_image) && $id_image) ? $id_image : false);
}
/**
@@ -1728,27 +1734,7 @@ class AdminProductsControllerCore extends AdminController
// Save and preview
if (Tools::isSubmit('submitAddProductAndPreview'))
{
$preview_url = $this->context->link->getProductLink(
$this->getFieldValue($this->object, 'id'),
$this->getFieldValue($this->object, 'link_rewrite', $this->context->language->id),
Category::getLinkRewrite($this->getFieldValue($this->object, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
0,
(bool)Configuration::get('PS_REWRITING_SETTINGS')
);
if (!$this->object->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$preview_url .= '&adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
}
$this->redirect_after = $preview_url;
}
$this->redirect_after = $this->getPreviewUrl($this->object);
// Save and stay on same form
if ($this->display == 'edit')
@@ -1893,30 +1879,7 @@ class AdminProductsControllerCore extends AdminController
// Save and preview
if (Tools::isSubmit('submitAddProductAndPreview'))
{
$preview_url = $this->context->link->getProductLink(
$this->getFieldValue($object, 'id'),
$this->getFieldValue($object, 'link_rewrite', $this->context->language->id),
Category::getLinkRewrite($this->getFieldValue($object, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
0,
(bool)Configuration::get('PS_REWRITING_SETTINGS')
);
if (!$object->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
if (strpos($preview_url, '?') === false)
$preview_url .= '?';
else
$preview_url .= '&';
$preview_url .= 'adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
}
$this->redirect_after = $preview_url;
}
$this->redirect_after = $this->getPreviewUrl($object);
else
{
// Save and stay on same form
@@ -2621,40 +2584,30 @@ class AdminProductsControllerCore extends AdminController
public function getPreviewUrl(Product $product)
{
$id_lang = Configuration::get('PS_LANG_DEFAULT', null, null, Context::getContext()->shop->id);
if (!ShopUrl::getMainShopDomain())
return false;
$is_rewrite_active = (bool)Configuration::get('PS_REWRITING_SETTINGS');
$preview_url = $this->context->link->getProductLink(
$product,
$this->getFieldValue($product, 'link_rewrite', $this->context->language->id),
Category::getLinkRewrite($product->id_category_default, $this->context->language->id),
Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
$id_lang,
(int)Context::getContext()->shop->id,
0,
$is_rewrite_active
);
if (!$product->active)
{
$preview_url = $this->context->link->getProductLink(
$product,
$this->getFieldValue($product, 'link_rewrite', $this->default_form_language),
Category::getLinkRewrite($this->getFieldValue($product, 'id_category_default'), $this->context->language->id),
null,
null,
Context::getContext()->shop->id,
0,
$is_rewrite_active
);
if (!$product->active)
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$preview_url .= $product->active ? '' : '&adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
}
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$preview_url .= ((strpos($preview_url, '?') === false) ? '?' : '&').'adtoken='.$this->token.'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
}
return $preview_url;
}
@@ -3012,7 +2965,7 @@ class AdminProductsControllerCore extends AdminController
$data->assign(array(
'link' => $this->context->link,
'currency' => $currency = $this->context->currency,
'tax_rules_groups' => TaxRulesGroup::getTaxRulesGroups(true, true),
'tax_rules_groups' => TaxRulesGroup::getTaxRulesGroups(true),
'taxesRatesByGroup' => TaxRulesGroup::getAssociatedTaxRatesByIdCountry($this->context->country->id),
'ecotaxTaxRate' => Tax::getProductEcotaxRate(),
'tax_exclude_taxe_option' => Tax::excludeTaxeOption(),
+46 -3
View File
@@ -38,7 +38,17 @@ class AdminShippingControllerCore extends AdminController
foreach ($carriers as $key => $carrier)
if ($carrier['is_free'])
unset($carriers[$key]);
$carrier_default_sort = array(
array('value' => Carrier::SORT_BY_PRICE, 'name' => $this->l('Price')),
array('value' => Carrier::SORT_BY_POSITION, 'name' => $this->l('Position'))
);
$carrier_default_order = array(
array('value' => Carrier::SORT_BY_ASC, 'name' => $this->l('Ascending')),
array('value' => Carrier::SORT_BY_DESC, 'name' => $this->l('Descending'))
);
$this->fields_options = array(
'handling' => array(
'title' => $this->l('Handling'),
@@ -69,12 +79,45 @@ class AdminShippingControllerCore extends AdminController
<li>'.$this->l('Coupons are not taken into account when calculating free shipping').'</li>
</ul>',
'submit' => array()
),
'general' => array(
'title' => $this->l('Carrier options'),
'fields' => array(
'PS_CARRIER_DEFAULT' => array(
'title' => $this->l('Default carrier:'),
'desc' => $this->l('Your shop\'s default carrier'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id_carrier',
'list' => array_merge(
array(
-1 => array('id_carrier' => -1, 'name' => $this->l('Best price')),
-2 => array('id_carrier' => -2, 'name' => $this->l('Best grade'))
),
Carrier::getCarriers((int)Configuration::get('PS_LANG_DEFAULT'), true, false, false, null, Carrier::ALL_CARRIERS))
),
'PS_CARRIER_DEFAULT_SORT' => array(
'title' => $this->l('Sort by:'),
'desc' => $this->l('This will only be visible in the Front Office'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'value',
'list' => $carrier_default_sort
),
'PS_CARRIER_DEFAULT_ORDER' => array(
'title' => $this->l('Order by:'),
'desc' => $this->l('This will only be visible in the Front Office'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'value',
'list' => $carrier_default_order
),
),
'submit' => array()
)
);
);
}
public function postProcess()
{
/* Shipping fees */
+1 -1
View File
@@ -386,7 +386,7 @@ class AdminShopControllerCore extends AdminController
$this->fields_form['input'][] = array(
'type' => 'select',
'label' => $this->l('Category root:'),
'desc' => $this->l('This is the root category of the store that you\'ve created. To define a new root category for your store,').'&nbsp;<a href="'.$this->context->link->getAdminLink('AdminCategories').'&addcategoryroot">'.$this->l('Please click here').'</a>',
'desc' => $this->l('This is the root category of the store that you\'ve created. To define a new root category for your store,').'&nbsp;<a href="'.$this->context->link->getAdminLink('AdminCategories').'&addcategoryroot" target="_blank">'.$this->l('Please click here').'</a>',
'name' => 'id_category',
'options' => array(
'query' => $categories,
+30 -2
View File
@@ -242,6 +242,34 @@ class AdminStatesControllerCore extends AdminController
else
parent::postProcess();
}
protected function displayAjaxStates()
{
if ($this->tabAccess['view'] === '1')
{
$states = Db::getInstance()->executeS('
SELECT s.id_state, s.name
FROM '._DB_PREFIX_.'state s
LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`)
WHERE s.id_country = '.(int)(Tools::getValue('id_country')).' AND s.active = 1 AND c.`contains_states` = 1
ORDER BY s.`name` ASC');
if (is_array($states) AND !empty($states))
{
$list = '';
if (Tools::getValue('no_empty') != true)
{
$empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------';
$list = '<option value="0">'.Tools::htmlentitiesUTF8($empty_value).'</option>'."\n";
}
foreach ($states AS $state)
$list .= '<option value="'.(int)($state['id_state']).'"'.((isset($_GET['id_state']) AND $_GET['id_state'] == $state['id_state']) ? ' selected="selected"' : '').'>'.$state['name'].'</option>'."\n";
}
else
$list = 'false';
die($list);
}
}
}
+11 -1
View File
@@ -138,8 +138,13 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
$modules = $this->getModules();
$module_instance = array();
foreach ($modules as $module)
foreach ($modules as $m => $module)
{
$module_instance[$module['name']] = Module::getInstanceByName($module['name']);
$modules[$m]['displayName'] = $module_instance[$module['name']]->displayName;
}
uasort($modules, array($this, 'checkModulesNames'));
$tpl->assign(array(
'current' => self::$currentIndex,
@@ -150,6 +155,11 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
return $tpl->fetch();
}
public function checkModulesNames($a, $b)
{
return (bool)($a['displayName'] > $b['displayName']);
}
protected function getModules()
{
@@ -103,7 +103,7 @@ class AdminSuppliersControllerCore extends AdminController
'label' => $this->l('Name'),
'name' => 'name',
'required' => true,
'hint' => $this->l('Invalid characters:').' <>;=#{}',
'hint' => $this->l('Invalid characters:').' &lt;&gt;;=#{}',
),
array(
'type' => 'textarea',
@@ -111,9 +111,10 @@ class AdminSuppliersControllerCore extends AdminController
'name' => 'description',
'lang' => true,
'hint' => array(
$this->l('Invalid characters:').' <>;=#{}',
$this->l('Invalid characters:').' &lt;&gt;;=#{}',
$this->l('Will appear in the supplier list')
)
),
'autoload_rte' => 'rte' //Enable TinyMCE editor for short description
),
array(
'type' => 'text',
@@ -183,14 +184,14 @@ class AdminSuppliersControllerCore extends AdminController
'label' => $this->l('Meta title:'),
'name' => 'meta_title',
'lang' => true,
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
'hint' => $this->l('Forbidden characters:').' &lt;&gt;;=#{}'
),
array(
'type' => 'text',
'label' => $this->l('Meta description:'),
'name' => 'meta_description',
'lang' => true,
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
'hint' => $this->l('Forbidden characters:').' &lt;&gt;;=#{}'
),
array(
'type' => 'tags',
@@ -199,7 +200,7 @@ class AdminSuppliersControllerCore extends AdminController
'lang' => true,
'hint' => array(
$this->l('To add "tags" click in the field, write something and then press "Enter"'),
$this->l('Forbidden characters:').' <>;=#{}'
$this->l('Forbidden characters:').' &lt;&gt;;=#{}'
)
),
array(
@@ -759,7 +759,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
'orderby' => false,
'filter' => false,
'search' => false,
'hint' => 'Note that you can see details on the receptions - per products',
'hint' => $this->l('Note that you can see details on the receptions - per products'),
),
'quantity_expected' => array(
'title' => $this->l('Quantity expected'),
@@ -1197,7 +1197,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
}
// updates receipt
if (Tools::isSubmit('submitFiltersupply_order_detail') && Tools::isSubmit('submitBulkUpdatesupply_order_detail') && Tools::isSubmit('id_supply_order'))
if (Tools::isSubmit('submitBulkUpdatesupply_order_detail') && Tools::isSubmit('id_supply_order'))
$this->postProcessUpdateReceipt();
// use template to create a supply order
@@ -1342,6 +1342,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
$this->errors[] = sprintf(Tools::displayError($this->l('Quantity (%d) for product #%d is not valid')), (int)$quantity, (int)$id_supply_order_detail);
else // everything is valid : updates
{
// creates the history
$supplier_receipt_history = new SupplyOrderReceiptHistory();
$supplier_receipt_history->id_supply_order_detail = (int)$id_supply_order_detail;
@@ -181,6 +181,15 @@ class AdminTaxRulesGroupControllerCore extends AdminController
'stay' => true
)
);
if (Shop::isFeatureActive())
{
$this->fields_form['input'][] = array(
'type' => 'shop',
'label' => $this->l('Shop association:'),
'name' => 'checkBoxShopAsso',
);
}
if (!($obj = $this->loadObject(true)))
return;
@@ -501,5 +510,18 @@ class AdminTaxRulesGroupControllerCore extends AdminController
// TODO: check if the rule already exists
return $tr->validateController();
}
protected function displayAjaxUpdateTaxRule()
{
if ($this->tabAccess['view'] === '1')
{
$id_tax_rule = Tools::getValue('id_tax_rule');
$tax_rules = new TaxRule((int)$id_tax_rule);
$output = array();
foreach ($tax_rules as $key => $result)
$output[$key] = $result;
die(Tools::jsonEncode($output));
}
}
}
@@ -461,7 +461,9 @@ class AdminTranslationsControllerCore extends AdminController
if (!$default_language || !Validate::isLanguageIsoCode($default_language))
return false;
// 1 - Scan mails files
$mails = scandir(_PS_MAIL_DIR_.$default_language.'/');
$mails = array();
if (Tools::file_exists_cache(_PS_MAIL_DIR_.$default_language.'/'))
$mails = scandir(_PS_MAIL_DIR_.$default_language.'/');
$mails_new_lang = array();
@@ -580,7 +582,9 @@ class AdminTranslationsControllerCore extends AdminController
if (preg_match('#^translations\/'.$iso_code.'\/tabs.php#Ui', $file['filename'], $matches) && Validate::isLanguageIsoCode($iso_code))
{
// Include array width new translations tabs
$tabs = include _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename'];
$tabs = array();
if (Tools::file_exists_cache(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename']))
$tabs = include_once(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename']);
foreach ($tabs as $class_name => $translations)
{
@@ -1066,7 +1070,7 @@ class AdminTranslationsControllerCore extends AdminController
{
case 'front':
// Parsing file in Front office
$regex = '/\{l\s*s=(?:\''._PS_TRANS_PATTERN_.'\'|\"'._PS_TRANS_PATTERN_.'\")(\s*sprintf=.*)?(\s*js=1)?\s*\}/U';
$regex = '/\{l\s*s=(?|\'('._PS_TRANS_PATTERN_.')\'|"('._PS_TRANS_PATTERN_.')")(\s*sprintf=.*)?(\s*js=1)?\s*\}/U';
break;
case 'back':
@@ -1076,7 +1080,7 @@ class AdminTranslationsControllerCore extends AdminController
else if ($type_file == 'specific')
$regex = '/Translate::getAdminTranslation\(\''._PS_TRANS_PATTERN_.'\'\)/U';
else
$regex = '/\{l\s*s\s*=(?:\''._PS_TRANS_PATTERN_.'\'|\"'._PS_TRANS_PATTERN_.'\")(\s*sprintf=.*)?(\s*js=1)?(\s*slashes=1)?\s*\}/U';
$regex = '/\{l\s*s\s*=(?|\''._PS_TRANS_PATTERN_.'\'|"'._PS_TRANS_PATTERN_.'")(\s*sprintf=.*)?(\s*js=1)?(\s*slashes=1)?\s*\}/U';
break;
case 'errors':
@@ -1090,7 +1094,7 @@ class AdminTranslationsControllerCore extends AdminController
$regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
else
// In tpl file look for something that should contain mod='module_name' according to the documentation
$regex = '/\{l\s*s=(?:\''._PS_TRANS_PATTERN_.'\'|\"'._PS_TRANS_PATTERN_.'\").*\s+mod=\''.$module_name.'\'.*\}/U';
$regex = '/\{l\s*s=(?|\''._PS_TRANS_PATTERN_.'\'|"'._PS_TRANS_PATTERN_.'").*\s+mod=\''.$module_name.'\'.*\}/U';
break;
case 'pdf':
@@ -1098,7 +1102,7 @@ class AdminTranslationsControllerCore extends AdminController
if ($type_file == 'php')
$regex = '/HTMLTemplate.*::l\(\''._PS_TRANS_PATTERN_.'\'[\)|\,]/U';
else
$regex = '/\{l\s*s=(?:\''._PS_TRANS_PATTERN_.'\'|\"'._PS_TRANS_PATTERN_.'\")(\s*sprintf=.*)?(\s*js=1)?(\s*pdf=\'true\')?\s*\}/U';
$regex = '/\{l\s*s=(?|\''._PS_TRANS_PATTERN_.'\'|"'._PS_TRANS_PATTERN_.'")(\s*sprintf=.*)?(\s*js=1)?(\s*pdf=\'true\')?\s*\}/U';
break;
}
+4 -4
View File
@@ -43,7 +43,7 @@ class AuthControllerCore extends FrontController
parent::init();
if (!Tools::getIsset('step') && $this->context->customer->isLogged() && !$this->ajax)
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
if (Tools::getValue('create_account'))
$this->create_account = true;
@@ -329,7 +329,7 @@ class AuthControllerCore extends FrontController
{
if ($back = Tools::getValue('back'))
Tools::redirect(html_entity_decode($back));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
}
}
}
@@ -469,7 +469,7 @@ class AuthControllerCore extends FrontController
Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
// else : redirection to the account
else
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
}
else
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
@@ -608,7 +608,7 @@ class AuthControllerCore extends FrontController
Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
// else : redirection to the account
else
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? url_encode($this->authRedirection) : 'my-account'));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
}
}
}
+29 -10
View File
@@ -33,7 +33,6 @@ class CartControllerCore extends FrontController
protected $id_address_delivery;
protected $customization_id;
protected $qty;
public $ssl = true;
protected $ajax_refresh = false;
@@ -68,13 +67,13 @@ class CartControllerCore extends FrontController
{
if (Tools::getIsset('add') || Tools::getIsset('update'))
$this->processChangeProductInCart();
else if (Tools::getIsset('delete'))
elseif (Tools::getIsset('delete'))
$this->processDeleteProductInCart();
else if (Tools::getIsset('changeAddressDelivery'))
elseif (Tools::getIsset('changeAddressDelivery'))
$this->processChangeProductAddressDelivery();
else if (Tools::getIsset('allowSeperatedPackage'))
elseif (Tools::getIsset('allowSeperatedPackage'))
$this->processAllowSeperatedPackage();
else if (Tools::getIsset('duplicate'))
elseif (Tools::getIsset('duplicate'))
$this->processDuplicateProduct();
// Make redirection
if (!$this->errors && !$this->ajax)
@@ -180,7 +179,7 @@ class CartControllerCore extends FrontController
if ($this->qty == 0)
$this->errors[] = Tools::displayError('Null quantity.');
else if (!$this->id_product)
elseif (!$this->id_product)
$this->errors[] = Tools::displayError('Product not found');
$product = new Product($this->id_product, true, $this->context->language->id);
@@ -190,23 +189,43 @@ class CartControllerCore extends FrontController
return;
}
$qty_to_check = $this->qty;
$cart_products = $this->context->cart->getProducts();
if (is_array($cart_products))
foreach ($cart_products as $cart_product)
{
if ((!isset($this->id_product_attribute) || $cart_product['id_product_attribute'] == $this->id_product_attribute) &&
(isset($this->id_product) && $cart_product['id_product'] == $this->id_product))
{
$qty_to_check = $cart_product['cart_quantity'];
if (Tools::getValue('op', 'up') == 'down')
$qty_to_check -= $this->qty;
else
$qty_to_check += $this->qty;
break;
}
}
// Check product quantity availability
if ($this->id_product_attribute)
{
if (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $this->qty))
if (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $qty_to_check))
$this->errors[] = Tools::displayError('There isn\'t enough product in stock.');
}
else if ($product->hasAttributes())
elseif ($product->hasAttributes())
{
$minimumQuantity = ($product->out_of_stock == 2) ? !Configuration::get('PS_ORDER_OUT_OF_STOCK') : !$product->out_of_stock;
$this->id_product_attribute = Product::getDefaultAttribute($product->id, $minimumQuantity);
// @todo do something better than a redirect admin !!
if (!$this->id_product_attribute)
Tools::redirectAdmin($this->context->link->getProductLink($product));
else if (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $this->qty))
elseif (!Product::isAvailableWhenOutOfStock($product->out_of_stock) && !Attribute::checkAttributeQty($this->id_product_attribute, $qty_to_check))
$this->errors[] = Tools::displayError('There isn\'t enough product in stock.');
}
else if (!$product->checkQty($this->qty))
elseif (!$product->checkQty($qty_to_check))
$this->errors[] = Tools::displayError('There isn\'t enough product in stock.');
// If no errors, process product addition
+2
View File
@@ -53,6 +53,8 @@ class CategoryControllerCore extends FrontController
public function canonicalRedirection($canonicalURL = '')
{
if (Tools::getValue('live_edit'))
return ;
if (!Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop())
{
$this->redirect_after = '404';
+2
View File
@@ -33,6 +33,8 @@ class CmsControllerCore extends FrontController
public function canonicalRedirection($canonicalURL = '')
{
if (Tools::getValue('live_edit'))
return ;
if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms)))
parent::canonicalRedirection($canonicalURL);
else if (Validate::isLoadedObject($this->cms_category) && ($canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category)))
+1 -1
View File
@@ -144,7 +144,7 @@ class ContactControllerCore extends FrontController
{
$cm = new CustomerMessage();
$cm->id_customer_thread = $ct->id;
$cm->message = Tools::htmlentitiesUTF8($message);
$cm->message = $message;
if (isset($fileAttachment['rename']) && !empty($fileAttachment['rename']) && rename($fileAttachment['tmp_name'], _PS_MODULE_DIR_.'../upload/'.basename($fileAttachment['rename'])))
$cm->file_name = $fileAttachment['rename'];
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);

Some files were not shown because too many files have changed in this diff Show More