Ejemplo n.º 1
0
    /**
     * Saves a new vat dataset.
     * 
     * @access	public
     * @return	bool	Returns true if no error occured.
     * @throws   ilShopException
     */
    public function save()
    {
        if (!(int) $this->id) {
            if (ilShopVatsList::_isVATAlreadyCreated($this->rate)) {
                throw new ilShopException($this->lng->txt('payment_vat_already_created'));
            }
            $next_id = $this->db->nextId('payment_vats');
            $this->db->manipulateF('
				INSERT INTO payment_vats
				(vat_id, vat_title, vat_rate)
				VALUES (%s,%s,%s)', array('integer', 'text', 'float'), array($next_id, $this->getTitle(), $this->getRate()));
            return true;
        }
        throw new ilShopException($this->lng->txt('payment_cannot_save_existing_vat'));
    }