//fix correction norm and language in AdminGroups

This commit is contained in:
lLefevre
2011-09-28 09:47:33 +00:00
parent 821404ed2f
commit c0cbd0bf57
3 changed files with 26 additions and 22 deletions
+21 -17
View File
@@ -101,7 +101,7 @@ class AdminGroups extends AdminTab
<th>'.$this->l('Value').'</th>
<th>'.$this->l('Action').'</th>
</tr>';
foreach ($groupReductions AS $groupReduction)
foreach ($groupReductions as $groupReduction)
echo '
<tr>
<td>'.Tools::htmlentitiesUTF8($groupReduction['category_name']).'</td>
@@ -143,11 +143,11 @@ class AdminGroups extends AdminTab
<form action="'.self::$currentIndex.'&update'.$this->table.'&id_group='.$obj->id.'&token='.$this->token.'" method="post" class="width3">
<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />
<fieldset><legend><img src="../img/admin/tab-groups.gif" />'.$this->l('New group discount').'</legend>
<div class="hintGroup">'.$this->l('Beware the reduction applied to a category does not stack with the overall reduction but replaces. The group is automatically added to the category.').'</div>
<div class="hintGroup">'.$this->l('Beware the reduction applied to a category does not stack with the overall reduction but replaces it. The group is automatically added to the category.').'</div>
<label>'.$this->l('Category:').' </label>
<div class="margin-form">
<select name="id_category">';
foreach ($categories AS $category)
foreach ($categories as $category)
echo ' <option value="'.(int)($category['id_category']).'">'.Tools::htmlentitiesUTF8($category['name']).'</option>';
echo ' </select><sup>*</sup>
<p>'.$this->l('Only products that have this category as default category will be affected').'.</p>
@@ -215,21 +215,21 @@ class AdminGroups extends AdminTab
if ($customerPageIndex > 1)
{
echo '&nbsp<input type="image" onclick="document.getElementById(\'customerPageIndex\').value=1" src="../img/admin/list-prev2.gif">&nbsp';
echo '&nbsp<input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.($customerPageIndex-1).'" src="../img/admin/list-prev.gif">&nbsp';
echo '&nbsp<input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.($customerPageIndex - 1).'" src="../img/admin/list-prev.gif">&nbsp';
}
echo 'Page <b><select onChange="submit()" name="customerPageIndex" id="customerPageIndex">';
for ($i=1; $i <= $totalPages; $i++)
echo 'Page <b><select onChange="submit()" name="customerPageIndex" id="customerPageIndex">';
for ($i = 1; $i <= $totalPages; $i++)
echo '<option value="'.$i.'"'.((int)$customerPageIndex === $i ? 'selected="selected"' : '').'>'.$i.'</option>';
echo '</select></b> / '.$totalPages;
echo '</select></b> / '.$totalPages;
if ($customerPageIndex < $totalPages)
{
echo '&nbsp<input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.((int)$customerPageIndex+1).'" src="../img/admin/list-next.gif">';
echo '&nbsp<input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.((int)$customerPageIndex + 1).'" src="../img/admin/list-next.gif">';
echo '&nbsp<input type="image" onclick="document.getElementById(\'customerPageIndex\').value='.$totalPages.'" src="../img/admin/list-next2.gif">';
}
echo ' | Display
echo ' | Display
<select onchange="document.getElementById(\'customerPageIndex\').value=1; submit();" name="customerPerPage">';
foreach ($perPageOptions as $option)
echo '<option value="'.$option.'"'.((int)$customersPerPage == $option ? 'selected="selected"' : '').'>'.$option.'</option>';
@@ -243,13 +243,13 @@ class AdminGroups extends AdminTab
echo '<table cellspacing="0" cellpadding="0" class="table widthfull">
<tr>';
foreach ($this->fieldsDisplay AS $field)
foreach ($this->fieldsDisplay as $field)
echo '<th'.(isset($field['width']) ? 'style="width: '.$field['width'].'"' : '').'>'.$field['title'].'</th>';
echo '
</tr>';
$irow = 0;
foreach ($customers AS $k => $customer)
foreach ($customers as $k => $customer)
{
echo '
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
@@ -316,8 +316,12 @@ class AdminGroups extends AdminTab
$this->_errors[] = Tools::displayError('A reduction already exists for this category.');
else
{
$category = new Category((int)$id_category);
$reduction = Tools::getValue('reductionByCategory');
$id_category = Tools::getValue('id_category');
$category = new Category((int)($id_category));
$category->addGroupsIfNoExist(Tools::getValue('id_group'));
$groupReduction->id_category = (int)($id_category);
$groupReduction->id_group = (int)($obj->id);
$groupReduction->reduction = (float)($reduction) / 100;
@@ -334,7 +338,7 @@ class AdminGroups extends AdminTab
{
if ($this->tabAccess['add'] === '1')
{
if (Tools::getValue('reduction') > 100 OR Tools::getValue('reduction') < 0)
if (Tools::getValue('reduction') > 100 || Tools::getValue('reduction') < 0)
$this->_errors[] = Tools::displayError('Reduction value is incorrect');
else
{
@@ -342,10 +346,10 @@ class AdminGroups extends AdminTab
$reductions = Tools::getValue('gr_reduction');
if ($id_group_reductions)
{
foreach ($id_group_reductions AS $key => $id_group_reduction)
if (!Validate::isUnsignedId($id_group_reductions[$key]) OR !Validate::isPrice($reductions[$key]))
foreach ($id_group_reductions as $key => $id_group_reduction)
if (!Validate::isUnsignedId($id_group_reductions[$key]) || !Validate::isPrice($reductions[$key]))
$this->_errors[] = Tools::displayError('Invalid reduction (must be a percentage)');
elseif ($reductions[$key] > 100 OR $reductions[$key] < 0)
else if ($reductions[$key] > 100 || $reductions[$key] < 0)
$this->_errors[] = Tools::displayError('Reduction value is incorrect');
else
{
@@ -362,7 +366,7 @@ class AdminGroups extends AdminTab
else
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
}
elseif (isset($_GET['delete'.$this->table]))
else if (isset($_GET['delete'.$this->table]))
{
if ($this->tabAccess['delete'] === '1')
{
+4 -4
View File
@@ -885,12 +885,12 @@ class CategoryCore extends ObjectModel
public function addGroupsIfNoExist($id_group)
{
$groups = $this->getGroups();
p($groups);
foreach($groups as $group){
if($group != $id_group)
foreach ($groups as $group)
{
if ($group == $id_group)
return false;
else
$this->addGroups(array((int)($id_group)));
return $this->addGroups(array((int)($id_group)));
}
}
+1 -1
View File
@@ -1061,7 +1061,7 @@ $_LANGADM['AdminGroups817b35caca2afa11b6c1efc428315470'] = 'Groupe de boutiques
$_LANGADM['AdminGroups38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
$_LANGADM['AdminGroups19f823c6453c2b1ffd09cb715214813d'] = 'Champs requis';
$_LANGADM['AdminGroupsc53a3dc4f27d93e065c2c5be5a78b74f'] = 'Nouvelle réduction de groupe';
$_LANGADM['AdminGroupsf3301519f560b65be8d8e67336df5b07'] = 'Attention, la réduction appliqué à une catégorie ne se cumule pas avec la réduction global mais la remplace. Le groupe est automatiquement ajoutée à la catégorie.';
$_LANGADM['AdminGroups8135a36c44911a6537e22be046849764'] = 'Attention, la réduction appliqué à une catégorie ne se cumule pas avec la réduction global mais la remplace. Le groupe est automatiquement ajoutée à la catégorie.';
$_LANGADM['AdminGroups56a8a9eb05f9014da51a4f9b57322ac7'] = 'Catégorie :';
$_LANGADM['AdminGroups60c4a9a7f56f6b9669f84977ebd0f93d'] = 'Seuls les produits qui ont cette catégorie par défaut seront ajoutés';
$_LANGADM['AdminGroups567183b8b1122180690be51cc6df2b74'] = 'Réduction (en %) :';