/** * Add Tax Rule */ function addTaxRule() { if ($this->post['allstates'] == "true") { $this->post['state'] = null; } else { if (!isset($this->post['state'])) { // A specific state was not provided throw new FieldMissingException("state"); } } // Create a new Tax Rule DBO $taxrule_dbo = new TaxRuleDBO(); $taxrule_dbo->setCountry($this->post['country']); $taxrule_dbo->setState($this->post['state']); $taxrule_dbo->setRate($this->post['rate']); $taxrule_dbo->setAllStates($this->post['allstates'] == "true" ? "Yes" : "Specific"); $taxrule_dbo->setDescription($this->post['description']); // Insert Tax Rule into database add_TaxRuleDBO($taxrule_dbo); // Success $this->setMessage(array("type" => "[TAX_RULE_CREATED]")); $this->post['success'] = "true"; }