[-] BO : #PSTEST-219 : fix small bugs and translations

This commit is contained in:
lLefevre
2012-01-03 13:05:36 +00:00
parent b089352236
commit f6fd1d3b7c
5 changed files with 262 additions and 266 deletions
@@ -40,7 +40,7 @@
<label class="t" for="apply_discount_percent"> <img src="../img/admin/enabled.gif" alt="{l s='Enabled'}" title="{l s='Enabled'}" style="cursor:pointer" /> {l s='Percent (%)'}</label>
&nbsp;&nbsp;
<input type="radio" name="apply_discount" id="apply_discount_amount" value="amount" {if $currentTab->getFieldValue($currentObject, 'reduction_amount')|intval}checked="checked"{/if} />
<label class="t" for="apply_discount_amount"> <img src="../img/admin/enabled.gif" alt="{l s='Enabled'}" title="{l s='Enabled'}" style="cursor:pointer" /> {l s='Amount (¤)'}</label>
<label class="t" for="apply_discount_amount"> <img src="../img/admin/enabled.gif" alt="{l s='Enabled'}" title="{l s='Enabled'}" style="cursor:pointer" /> {l s='Amount'}</label>
&nbsp;&nbsp;
<input type="radio" name="apply_discount" id="apply_discount_off" value="off" {if !$currentTab->getFieldValue($currentObject, 'reduction_amount')|intval && !$currentTab->getFieldValue($currentObject, 'reduction_percent')|intval}checked="checked"{/if} />
<label class="t" for="apply_discount_off"> <img src="../img/admin/disabled.gif" alt="{l s='Disabled'}" title="{l s='Disabled'}" style="cursor:pointer" /> {l s='None'}</label>
@@ -53,7 +53,7 @@
</div>
</div>
<div id="apply_discount_amount_div">
<label>{l s='Value (¤)'}</label>
<label>{l s='Value'}</label>
<div class="margin-form">
<input type="text" id="reduction_amount" name="reduction_amount" value="{$currentTab->getFieldValue($currentObject, 'reduction_amount')|floatval}" />
<select name="reduction_currency">
@@ -83,117 +83,6 @@
var currentToken = '{$currentToken}';
var currentFormTab = '{if isset($smarty.post.currentFormTab)}{$smarty.post.currentFormTab|escape}{else}informations{/if}';
$('.cart_rule_tab').hide();
$('.tab-page').removeClass('selected');
$('#cart_rule_' + currentFormTab).show();
$('#cart_rule_link_' + currentFormTab).addClass('selected');
$('#giftProductFilter')
.autocomplete(
'ajax-tab.php', {
minChars: 2,
max: 50,
width: 500,
selectFirst: false,
scroll: false,
dataType: 'json',
formatItem: function(data, i, max, value, term) {
return value;
},
parse: function(data) {
var mytab = new Array();
for (var i = 0; i < data.length; i++)
mytab[mytab.length] = { data: data[i], value: (data[i].reference + ' ' + data[i].name).trim() };
return mytab;
},
extraParams: {
controller: 'AdminCartRules',
token: currentToken,
giftProductFilter: 1
}
}
)
.result(function(event, data, formatted) {
$('#gift_product').val(data.id_product);
$('#giftProductFilter').val((data.reference + ' ' + data.name).trim());
});
$('#reductionProductFilter')
.autocomplete(
'ajax-tab.php', {
minChars: 2,
max: 50,
width: 500,
selectFirst: false,
scroll: false,
dataType: 'json',
formatItem: function(data, i, max, value, term) {
return value;
},
parse: function(data) {
var mytab = new Array();
for (var i = 0; i < data.length; i++)
mytab[mytab.length] = { data: data[i], value: (data[i].reference + ' ' + data[i].name).trim() };
return mytab;
},
extraParams: {
controller: 'AdminCartRules',
token: currentToken,
reductionProductFilter: 1
}
}
)
.result(function(event, data, formatted) {
$('#reduction_product').val(data.id_product);
$('#reductionProductFilter').val((data.reference + ' ' + data.name).trim());
});
$('#customerFilter')
.autocomplete(
'ajax-tab.php', {
minChars: 2,
max: 50,
width: 500,
selectFirst: false,
scroll: false,
dataType: 'json',
formatItem: function(data, i, max, value, term) {
return value;
},
parse: function(data) {
var mytab = new Array();
for (var i = 0; i < data.length; i++)
mytab[mytab.length] = { data: data[i], value: data[i].cname + ' (' + data[i].email + ')' };
return mytab;
},
extraParams: {
controller: 'AdminCartRules',
token: currentToken,
customerFilter: 1
}
}
)
.result(function(event, data, formatted) {
$('#id_customer').val(data.id_customer);
$('#customerFilter').val(data.cname + ' (' + data.email + ')');
});
var date = new Date();
var hours = date.getHours();
if (hours < 10)
hours = "0" + hours;
var mins = date.getMinutes();
if (mins < 10)
mins = "0" + mins;
var secs = date.getSeconds();
if (secs < 10)
secs = "0" + secs;
$('.datepicker').datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd ' + hours + ':' + mins + ':' + secs
});
var languages = new Array();
{foreach from=$languages item=language key=k}
languages[{$k}] = {
@@ -204,3 +93,5 @@
{/foreach}
displayFlags(languages, {$defaultLanguage});
</script>
<script src="../js/admin_cart_rules.js" type="text/javascript"></script>
@@ -343,12 +343,6 @@ class AdminCartRulesControllerCore extends AdminController
return parent::renderForm();
}
public function setMedia()
{
parent::setMedia();
$this->addJS(_PS_JS_DIR_.'admin_cart_rules.js');
}
public function displayAjaxSearchCartRuleVouchers()
{
$found = false;
+256 -145
View File
@@ -1,219 +1,330 @@
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7040 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7040 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
function addProductRule()
{
product_rules_counter += 1;
if ($('#product_rule_type').val() != 0)
$.get(
'ajax-tab.php',
{controller:'AdminCartRules',token:currentToken,newProductRule:1,product_rule_type:$('#product_rule_type').val(),product_rule_id:product_rules_counter},
function(content) {
if (content != "")
$('#product_rule_table').append(content);
}
);
product_rules_counter += 1;
if ($('#product_rule_type').val() != 0)
$.get(
'ajax-tab.php',
{controller:'AdminCartRules',token:currentToken,newProductRule:1,product_rule_type:$('#product_rule_type').val(),product_rule_id:product_rules_counter},
function(content) {
if (content != "")
$('#product_rule_table').append(content);
}
);
}
function removeProductRule(id)
{
$('#product_rule_' + id + '_tr').remove();
$('#product_rule_' + id + '_tr').remove();
}
function toggleCartRuleFilter(id)
{
if ($(id).attr('checked'))
$('#' + $(id).attr('id') + '_div').show(400);
else
$('#' + $(id).attr('id') + '_div').hide(200);
if ($(id).attr('checked'))
$('#' + $(id).attr('id') + '_div').show(400);
else
$('#' + $(id).attr('id') + '_div').hide(200);
}
function removeCartRuleOption(item)
{
var id = $(item).attr('id').replace('_remove', '');
$('#' + id + '_2 option:selected').remove().appendTo('#' + id + '_1');
var id = $(item).attr('id').replace('_remove', '');
$('#' + id + '_2 option:selected').remove().appendTo('#' + id + '_1');
}
function addCartRuleOption(item)
{
var id = $(item).attr('id').replace('_add', '');
$('#' + id + '_1 option:selected').remove().appendTo('#' + id + '_2');
var id = $(item).attr('id').replace('_add', '');
$('#' + id + '_1 option:selected').remove().appendTo('#' + id + '_2');
}
function updateProductRuleShortDescription(item)
{
var id1 = $(item).attr('id').replace('_add', '').replace('_remove', '');
var id2 = id1.replace('_select', '');
var length = $('#' + id1 + '_2 option').length;
if (length == 1)
$('#' + id2 + '_match').val($('#' + id1 + '_2 option').first().text().trim());
else
$('#' + id2 + '_match').val(length);
var id1 = $(item).attr('id').replace('_add', '').replace('_remove', '');
var id2 = id1.replace('_select', '');
var length = $('#' + id1 + '_2 option').length;
if (length == 1)
$('#' + id2 + '_match').val($('#' + id1 + '_2 option').first().text().trim());
else
$('#' + id2 + '_match').val(length);
}
var restrictions = new Array('country', 'carrier', 'group', 'cart_rule');
for (i in restrictions)
{
toggleCartRuleFilter($('#' + restrictions[i] + '_restriction'));
$('#' + restrictions[i] + '_restriction').click(function() {toggleCartRuleFilter(this);});
$('#' + restrictions[i] + '_select_remove').click(function() {removeCartRuleOption(this);});
$('#' + restrictions[i] + '_select_add').click(function() {addCartRuleOption(this);});
toggleCartRuleFilter($('#' + restrictions[i] + '_restriction'));
$('#' + restrictions[i] + '_restriction').click(function() {toggleCartRuleFilter(this);});
$('#' + restrictions[i] + '_select_remove').click(function() {removeCartRuleOption(this);});
$('#' + restrictions[i] + '_select_add').click(function() {addCartRuleOption(this);});
}
toggleCartRuleFilter($('#product_restriction'));
$('#product_restriction').click(function() {toggleCartRuleFilter(this);});
function toggleApplyDiscount(percent, amount, apply_to)
{
if (percent)
{
$('#apply_discount_percent_div').show(400);
if ($('#apply_discount_to_product').attr('checked'))
toggleApplyDiscountTo();
$('#apply_discount_to_cheapest').removeAttr('disabled');
$('#apply_discount_to_cheapest').removeAttr('checked');
}
else
{
$('#apply_discount_percent_div').hide(200);
$('#reduction_percent').val('0');
$('#apply_discount_to_cheapest').attr('disabled', 'disabled');
}
if (amount)
{
$('#apply_discount_amount_div').show(400);
if ($('#apply_discount_to_product').attr('checked'))
toggleApplyDiscountTo();
$('#apply_discount_to_cheapest').attr('disabled', 'disabled');
$('#apply_discount_to_cheapest').removeAttr('checked');
}
else
{
$('#apply_discount_amount_div').hide(200);
$('#reduction_amount').val('0');
$('#apply_discount_to_cheapest').removeAttr('disabled');
}
if (apply_to)
$('#apply_discount_to_div').show(400);
else
{
toggleApplyDiscountTo();
$('#apply_discount_to_div').hide(200);
}
if (percent)
{
$('#apply_discount_percent_div').show(400);
if ($('#apply_discount_to_product').attr('checked'))
toggleApplyDiscountTo();
$('#apply_discount_to_cheapest').removeAttr('disabled');
$('#apply_discount_to_cheapest').removeAttr('checked');
}
else
{
$('#apply_discount_percent_div').hide(200);
$('#reduction_percent').val('0');
$('#apply_discount_to_cheapest').attr('disabled', 'disabled');
}
if (amount)
{
$('#apply_discount_amount_div').show(400);
if ($('#apply_discount_to_product').attr('checked'))
toggleApplyDiscountTo();
$('#apply_discount_to_cheapest').attr('disabled', 'disabled');
$('#apply_discount_to_cheapest').removeAttr('checked');
}
else
{
$('#apply_discount_amount_div').hide(200);
$('#reduction_amount').val('0');
$('#apply_discount_to_cheapest').removeAttr('disabled');
}
if (apply_to)
$('#apply_discount_to_div').show(400);
else
{
toggleApplyDiscountTo();
$('#apply_discount_to_div').hide(200);
}
}
function toggleApplyDiscountTo()
{
if ($('#apply_discount_to_product').attr('checked'))
$('#apply_discount_to_product_div').show(400);
else
{
$('#apply_discount_to_product_div').hide(200);
$('#reductionProductFilter').val('');
if ($('#apply_discount_to_order').attr('checked'))
$('#reduction_product').val('0');
if ($('#apply_discount_to_cheapest').attr('checked'))
$('#reduction_product').val('-1');
if ($('#apply_discount_to_selection').attr('checked'))
$('#reduction_product').val('-2');
}
if ($('#apply_discount_to_product').attr('checked'))
$('#apply_discount_to_product_div').show(400);
else
{
$('#apply_discount_to_product_div').hide(200);
$('#reductionProductFilter').val('');
if ($('#apply_discount_to_order').attr('checked'))
$('#reduction_product').val('0');
if ($('#apply_discount_to_cheapest').attr('checked'))
$('#reduction_product').val('-1');
if ($('#apply_discount_to_selection').attr('checked'))
$('#reduction_product').val('-2');
}
}
function toggleGiftProduct()
{
if ($('#free_gift_on').attr('checked'))
$('#free_gift_div').show(400);
else
{
$('#gift_product').val('0');
$('#giftProductFilter').val('');
$('#free_gift_div').hide(200);
}
if ($('#free_gift_on').attr('checked'))
$('#free_gift_div').show(400);
else
{
$('#gift_product').val('0');
$('#giftProductFilter').val('');
$('#free_gift_div').hide(200);
}
}
$('#apply_discount_percent').click(function() {toggleApplyDiscount(true, false, true);});
if ($('#apply_discount_percent').attr('checked'))
toggleApplyDiscount(true, false, true);
toggleApplyDiscount(true, false, true);
$('#apply_discount_amount').click(function() {toggleApplyDiscount(false, true, true);});
if ($('#apply_discount_amount').attr('checked'))
toggleApplyDiscount(false, true, true);
toggleApplyDiscount(false, true, true);
$('#apply_discount_off').click(function() {toggleApplyDiscount(false, false, false);});
if ($('#apply_discount_off').attr('checked'))
toggleApplyDiscount(false, false, false);
toggleApplyDiscount(false, false, false);
$('#apply_discount_to_order').click(function() {toggleApplyDiscountTo();});
if ($('#apply_discount_to_order').attr('checked'))
toggleApplyDiscountTo();
toggleApplyDiscountTo();
$('#apply_discount_to_product').click(function() {toggleApplyDiscountTo();});
if ($('#apply_discount_to_product').attr('checked'))
toggleApplyDiscountTo();
toggleApplyDiscountTo();
$('#apply_discount_to_cheapest').click(function() {toggleApplyDiscountTo();});
if ($('#apply_discount_to_cheapest').attr('checked'))
toggleApplyDiscountTo();
toggleApplyDiscountTo();
$('#apply_discount_to_selection').click(function() {toggleApplyDiscountTo();});
if ($('#apply_discount_to_selection').attr('checked'))
toggleApplyDiscountTo();
toggleApplyDiscountTo();
$('#free_gift_on').click(function() {toggleGiftProduct();});
$('#free_gift_off').click(function() {toggleGiftProduct();});
toggleGiftProduct();
// Main form submit
$('#cart_rule_form').submit(function() {
if ($('#customerFilter').val() == '')
$('#id_customer').val('0');
if ($('#customerFilter').val() == '')
$('#id_customer').val('0');
for (i in restrictions)
{
if ($('#' + restrictions[i] + '_select_1 option').length == 0)
$('#' + restrictions[i] + '_restriction').removeAttr('checked');
else
{
$('#' + restrictions[i] + '_select_2 option').each(function(i) {
$(this).attr('selected', 'selected');
});
}
}
$('.product_rule_toselect option').each(function(i) {
$(this).attr('selected', 'selected');
});
for (i in restrictions)
{
if ($('#' + restrictions[i] + '_select_1 option').length == 0)
$('#' + restrictions[i] + '_restriction').removeAttr('checked');
else
{
$('#' + restrictions[i] + '_select_2 option').each(function(i) {
$(this).attr('selected', 'selected');
});
}
}
$('.product_rule_toselect option').each(function(i) {
$(this).attr('selected', 'selected');
});
});
$('#giftProductFilter')
.autocomplete(
'ajax-tab.php', {
minChars: 2,
max: 50,
width: 500,
selectFirst: false,
scroll: false,
dataType: 'json',
formatItem: function(data, i, max, value, term) {
return value;
},
parse: function(data) {
var mytab = new Array();
for (var i = 0; i < data.length; i++)
mytab[mytab.length] = { data: data[i], value: (data[i].reference + ' ' + data[i].name).trim() };
return mytab;
},
extraParams: {
controller: 'AdminCartRules',
token: currentToken,
giftProductFilter: 1
}
}
)
.result(function(event, data, formatted) {
$('#gift_product').val(data.id_product);
$('#giftProductFilter').val((data.reference + ' ' + data.name).trim());
});
$('#reductionProductFilter')
.autocomplete(
'ajax-tab.php', {
minChars: 2,
max: 50,
width: 500,
selectFirst: false,
scroll: false,
dataType: 'json',
formatItem: function(data, i, max, value, term) {
return value;
},
parse: function(data) {
var mytab = new Array();
for (var i = 0; i < data.length; i++)
mytab[mytab.length] = { data: data[i], value: (data[i].reference + ' ' + data[i].name).trim() };
return mytab;
},
extraParams: {
controller: 'AdminCartRules',
token: currentToken,
reductionProductFilter: 1
}
}
)
.result(function(event, data, formatted) {
$('#reduction_product').val(data.id_product);
$('#reductionProductFilter').val((data.reference + ' ' + data.name).trim());
});
$('#customerFilter')
.autocomplete(
'ajax-tab.php', {
minChars: 2,
max: 50,
width: 500,
selectFirst: false,
scroll: false,
dataType: 'json',
formatItem: function(data, i, max, value, term) {
return value;
},
parse: function(data) {
var mytab = new Array();
for (var i = 0; i < data.length; i++)
mytab[mytab.length] = { data: data[i], value: data[i].cname + ' (' + data[i].email + ')' };
return mytab;
},
extraParams: {
controller: 'AdminCartRules',
token: currentToken,
customerFilter: 1
}
}
)
.result(function(event, data, formatted) {
$('#id_customer').val(data.id_customer);
$('#customerFilter').val(data.cname + ' (' + data.email + ')');
});
function displayCartRuleTab(tab)
{
$('.cart_rule_tab').hide();
$('.tab-page').removeClass('selected');
$('#cart_rule_' + tab).show();
$('#cart_rule_link_' + tab).addClass('selected');
$('#currentFormTab').val(tab);
$('.cart_rule_tab').hide();
$('.tab-page').removeClass('selected');
$('#cart_rule_' + tab).show();
$('#cart_rule_link_' + tab).addClass('selected');
$('#currentFormTab').val(tab);
}
$('.cart_rule_tab').hide();
$('.tab-page').removeClass('selected');
$('#cart_rule_' + currentFormTab).show();
$('#cart_rule_link_' + currentFormTab).addClass('selected');
var date = new Date();
var hours = date.getHours();
if (hours < 10)
hours = "0" + hours;
var mins = date.getMinutes();
if (mins < 10)
mins = "0" + mins;
var secs = date.getSeconds();
if (secs < 10)
secs = "0" + secs;
$('.datepicker').datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd ' + hours + ':' + mins + ':' + secs
});
+2 -2
View File
@@ -2676,11 +2676,11 @@ $_LANGADM['AdminCartRules00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
$_LANGADM['AdminCartRulesb9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
$_LANGADM['AdminCartRulesfc6341fa76fe93b837d748563e0a60c1'] = 'Appliquer une réduction';
$_LANGADM['AdminCartRulesda73ea07f51049046d527dabd85170e1'] = 'En pourcent (%)';
$_LANGADM['AdminCartRules96d60bee29d908c1cb0fb4fd3f28ed42'] = 'En devise (¤)';
$_LANGADM['AdminCartRulesb2f40690858b404ed10e62bdf422c704'] = 'Montant';
$_LANGADM['AdminCartRules6adf97f83acf6453d4a6a4b1070f3754'] = 'Aucune';
$_LANGADM['AdminCartRules407d3e36cf562094fc5802889c592fa6'] = 'Valeur (en %)';
$_LANGADM['AdminCartRulesde11e2e4296bb20487b6430508866e06'] = 'Ne s\'applique pas aux frais de ports';
$_LANGADM['AdminCartRules717a25e452275655de73204c68072f0f'] = 'Valeur (en ¤)';
$_LANGADM['AdminCartRules689202409e48743b914713f96d93947c'] = 'Valeur';
$_LANGADM['AdminCartRulesbefcac0f9644a7abee43e69f49252ac4'] = 'HT';
$_LANGADM['AdminCartRulesf4a0d7cb0cd45214c8ca5912c970de13'] = 'TTC';
$_LANGADM['AdminCartRules4ec534e482b91898178fa7c6b2235459'] = 'Appliquer la réduction à';