[-] BO : Bug Fixed #PSTEST-546 - Tax Rules Creation
This commit is contained in:
@@ -51,7 +51,9 @@
|
|||||||
populateStates($(this).val(), '');
|
populateStates($(this).val(), '');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#tax_rule_form').hide();
|
{if !isset($smarty.get.create_rule)}
|
||||||
|
$('#tax_rule_form').hide();
|
||||||
|
{/if}
|
||||||
$('#desc-tax_rules_group-new').click(function() {
|
$('#desc-tax_rules_group-new').click(function() {
|
||||||
initForm();
|
initForm();
|
||||||
$('#tax_rule_form').slideToggle();
|
$('#tax_rule_form').slideToggle();
|
||||||
|
|||||||
@@ -345,17 +345,34 @@ class AdminTaxRulesGroupControllerCore extends AdminController
|
|||||||
return $helper->generateForm($this->fields_form);
|
return $helper->generateForm($this->fields_form);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postProcess()
|
|
||||||
{
|
public function initProcess()
|
||||||
if (Tools::isSubmit('deletetax_rule'))
|
{
|
||||||
$this->processDeleteTaxRule();
|
if (Tools::isSubmit('deletetax_rule'))
|
||||||
|
{
|
||||||
|
if ($this->tabAccess['delete'] === '1')
|
||||||
|
$this->action = 'delete_tax_rule';
|
||||||
|
else
|
||||||
|
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||||
|
}
|
||||||
else if (Tools::isSubmit('submitBulkdelete_tax_rule'))
|
else if (Tools::isSubmit('submitBulkdelete_tax_rule'))
|
||||||
$this->processBulkDeleteTaxRules();
|
{
|
||||||
else if (Tools::getValue('action') == 'create_rule')
|
if ($this->tabAccess['delete'] === '1')
|
||||||
$this->processCreateRule();
|
$this->action = 'bulk_delete_tax_rule';
|
||||||
else
|
else
|
||||||
parent::postProcess();
|
$this->errors[] = Tools::displayError('You do not have permission to delete here.');
|
||||||
}
|
}
|
||||||
|
else if (Tools::getValue('action') == 'create_rule')
|
||||||
|
{
|
||||||
|
if ($this->tabAccess['add'] === '1')
|
||||||
|
$this->action = 'create_rule';
|
||||||
|
else
|
||||||
|
$this->errors[] = Tools::displayError('You do not have permission to add here.');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
parent::initProcess();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected function processCreateRule()
|
protected function processCreateRule()
|
||||||
{
|
{
|
||||||
@@ -387,8 +404,9 @@ class AdminTaxRulesGroupControllerCore extends AdminController
|
|||||||
$tr->description = Tools::getValue('description');
|
$tr->description = Tools::getValue('description');
|
||||||
$this->tax_rule = $tr;
|
$this->tax_rule = $tr;
|
||||||
$_POST['id_state'] = $tr->id_state;
|
$_POST['id_state'] = $tr->id_state;
|
||||||
$this->_errors_tax_rule = $this->validateTaxRule($tr);
|
$this->errors = $this->validateTaxRule($tr);
|
||||||
if (count($this->_errors_tax_rule) == 0)
|
|
||||||
|
if (count($this->errors) == 0)
|
||||||
if (!$tr->save())
|
if (!$tr->save())
|
||||||
$this->errors[] = Tools::displayError('An error has occured: Can\'t save the current tax rule');
|
$this->errors[] = Tools::displayError('An error has occured: Can\'t save the current tax rule');
|
||||||
else
|
else
|
||||||
@@ -396,8 +414,10 @@ class AdminTaxRulesGroupControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->_errors_tax_rule) == 0)
|
if (count($this->errors) == 0)
|
||||||
Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$tr->id_tax_rules_group.'&conf=4&update'.$this->table.'&token='.$this->token);
|
Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$tr->id_tax_rules_group.'&conf=4&update'.$this->table.'&token='.$this->token);
|
||||||
|
else
|
||||||
|
$this->display = 'edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function processBulkDeleteTaxRules()
|
protected function processBulkDeleteTaxRules()
|
||||||
|
|||||||
Reference in New Issue
Block a user