/** * Add Price */ protected function addPrice() { if ($this->post['type'] == "Onetime" && $this->post['termlength'] != 0) { throw new SWUserException("[TERMLENGTH_FOR_ONETIME_MUST_BE_ZERO]"); } if ($this->post['type'] == "Recurring" && $this->post['termlength'] == 0) { throw new SWUserException("[TERMLENGTH_FOR_RECURRING_MUST_NOT_BE_ZERO]"); } $priceDBO = new HostingServicePriceDBO(); $priceDBO->setServiceID($this->get['hservice']->getID()); $priceDBO->setType($this->post['type']); $priceDBO->setTermLength($this->post['termlength']); $priceDBO->setPrice($this->post['price']); $priceDBO->setTaxable($this->post['taxable']); try { $this->get['hservice']->addPrice($priceDBO); add_HostingServicePriceDBO($priceDBO); $this->setMessage(array("type" => "[PRICE_ADDED]")); } catch (DuplicatePriceException $e) { update_HostingServicePriceDBO($priceDBO); $this->setMessage(array("type" => "[PRICE_UPDATED]")); } $this->reload("&sstab=pricing"); }