// missing init selected_states
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8694 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -29,6 +29,7 @@ class AdminTaxRulesGroup extends AdminTab
|
|||||||
{
|
{
|
||||||
public $tax_rule;
|
public $tax_rule;
|
||||||
public $selected_countries = array();
|
public $selected_countries = array();
|
||||||
|
public $selected_states = array();
|
||||||
public $_errors_tax_rule;
|
public $_errors_tax_rule;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -84,10 +85,10 @@ class AdminTaxRulesGroup extends AdminTab
|
|||||||
{
|
{
|
||||||
$zipcode = Tools::getValue('zipcode');
|
$zipcode = Tools::getValue('zipcode');
|
||||||
$id_rule = (int)Tools::getValue('id_tax_rule');
|
$id_rule = (int)Tools::getValue('id_tax_rule');
|
||||||
|
|
||||||
$this->selected_countries = Tools::getValue('country');
|
$this->selected_countries = Tools::getValue('country');
|
||||||
$this->selected_states = Tools::getValue('states');
|
$this->selected_states = Tools::getValue('states');
|
||||||
|
|
||||||
if (empty($this->selected_states) || sizeof($this->selected_states) == 0)
|
if (empty($this->selected_states) || sizeof($this->selected_states) == 0)
|
||||||
$this->selected_states = array(0);
|
$this->selected_states = array(0);
|
||||||
|
|
||||||
@@ -96,11 +97,11 @@ class AdminTaxRulesGroup extends AdminTab
|
|||||||
foreach ($this->selected_states as $id_state)
|
foreach ($this->selected_states as $id_state)
|
||||||
{
|
{
|
||||||
$tr = new TaxRule();
|
$tr = new TaxRule();
|
||||||
|
|
||||||
// update or creation?
|
// update or creation?
|
||||||
if (isset($id_rule))
|
if (isset($id_rule))
|
||||||
$tr->id = $id_rule;
|
$tr->id = $id_rule;
|
||||||
|
|
||||||
$tr->id_tax = (int)Tools::getValue('tax');
|
$tr->id_tax = (int)Tools::getValue('tax');
|
||||||
$tr->id_tax_rules_group = (int)Tools::getValue('id_tax_rules_group');
|
$tr->id_tax_rules_group = (int)Tools::getValue('id_tax_rules_group');
|
||||||
$tr->id_country = (int)$id_country;
|
$tr->id_country = (int)$id_country;
|
||||||
@@ -108,21 +109,21 @@ class AdminTaxRulesGroup extends AdminTab
|
|||||||
list($tr->zipcode_from, $tr->zipcode_to) = $tr->breakDownZipCode($zipcode);
|
list($tr->zipcode_from, $tr->zipcode_to) = $tr->breakDownZipCode($zipcode);
|
||||||
$tr->behavior = (int)Tools::getValue('behavior');
|
$tr->behavior = (int)Tools::getValue('behavior');
|
||||||
$tr->description = Tools::getValue('description');
|
$tr->description = Tools::getValue('description');
|
||||||
|
|
||||||
$this->tax_rule = $tr;
|
$this->tax_rule = $tr;
|
||||||
$this->_errors_tax_rule = $this->validateTaxRule($tr);
|
$this->_errors_tax_rule = $this->validateTaxRule($tr);
|
||||||
if (sizeof($this->_errors_tax_rule) == 0)
|
if (sizeof($this->_errors_tax_rule) == 0)
|
||||||
{
|
{
|
||||||
if (!$tr->save())
|
if (!$tr->save())
|
||||||
die(Tools::displayError('An error has occured: Can\'t save the current tax rule'));
|
die(Tools::displayError('An error has occured: Can\'t save the current tax rule'));
|
||||||
} else
|
} else
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizeof($this->_errors_tax_rule) == 0)
|
if (sizeof($this->_errors_tax_rule) == 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
|
} else
|
||||||
parent::postProcess();
|
parent::postProcess();
|
||||||
}
|
}
|
||||||
@@ -148,11 +149,11 @@ class AdminTaxRulesGroup extends AdminTab
|
|||||||
{
|
{
|
||||||
if ($("#country option:selected").size() > 1)
|
if ($("#country option:selected").size() > 1)
|
||||||
{
|
{
|
||||||
$("#zipcode-label").hide();
|
$("#zipcode-label").hide();
|
||||||
$("#zipcode").hide();
|
$("#zipcode").hide();
|
||||||
|
|
||||||
$("#state-select").hide();
|
$("#state-select").hide();
|
||||||
$("#state-label").hide();
|
$("#state-label").hide();
|
||||||
} else {
|
} else {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "ajax.php",
|
url: "ajax.php",
|
||||||
@@ -171,11 +172,11 @@ class AdminTaxRulesGroup extends AdminTab
|
|||||||
$("#states").html(html);
|
$("#states").html(html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#zipcode-label").show();
|
$("#zipcode-label").show();
|
||||||
$("#zipcode").show();
|
$("#zipcode").show();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,8 +336,8 @@ EOT;
|
|||||||
|
|
||||||
$country_select = Helper::selectInput(Country::getCountries((int)$cookie->id_lang),
|
$country_select = Helper::selectInput(Country::getCountries((int)$cookie->id_lang),
|
||||||
array('id' => 'country', 'name' => 'country[]', 'onclick' => 'populateStates($(this).val(), \'\')', 'multiple' => 'multiple'),
|
array('id' => 'country', 'name' => 'country[]', 'onclick' => 'populateStates($(this).val(), \'\')', 'multiple' => 'multiple'),
|
||||||
array('key' => 'id_country',
|
array('key' => 'id_country',
|
||||||
'value' => 'name',
|
'value' => 'name',
|
||||||
'selected' => $this->selected_countries,
|
'selected' => $this->selected_countries,
|
||||||
'empty' => $this->l('All')));
|
'empty' => $this->l('All')));
|
||||||
|
|
||||||
@@ -516,3 +517,4 @@ EOT;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user