Fix error when upgrading account
This commit is contained in:
parent
9b3a26c19a
commit
3c05e14e4d
1 changed files with 5 additions and 7 deletions
|
@ -28,18 +28,12 @@ class BillingController extends Zend_Controller_Action {
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$form = new Application_Form_BillingUpgradeDowngrade();
|
$form = new Application_Form_BillingUpgradeDowngrade();
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: determine if VAT shoould be charged on the invoice or not.
|
|
||||||
* We'll need to check if a VAT number was supplied in the form and if so,
|
|
||||||
* validate it somehow. We'll also need to make sure the country given is
|
|
||||||
* in the EU
|
|
||||||
*/
|
|
||||||
|
|
||||||
$formData = $request->getPost();
|
$formData = $request->getPost();
|
||||||
if ($form->isValid($formData)) {
|
if ($form->isValid($formData)) {
|
||||||
$credentials = self::getAPICredentials();
|
$credentials = self::getAPICredentials();
|
||||||
|
|
||||||
|
//Check if VAT should be applied or not to this invoice.
|
||||||
if (in_array("7", $formData["customfields"])) {
|
if (in_array("7", $formData["customfields"])) {
|
||||||
$apply_vat = BillingController::checkIfVatShouldBeApplied($formData["customfields"]["7"], $formData["country"]);
|
$apply_vat = BillingController::checkIfVatShouldBeApplied($formData["customfields"]["7"], $formData["country"]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,6 +88,10 @@ class BillingController extends Zend_Controller_Action {
|
||||||
$this->setErrorMessage();
|
$this->setErrorMessage();
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
} else {
|
} else {
|
||||||
|
// Disable the view and the layout here, squashes an error.
|
||||||
|
$this->view->layout()->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
if ($apply_vat) {
|
if ($apply_vat) {
|
||||||
$this->addVatToInvoice($result["invoiceid"]);
|
$this->addVatToInvoice($result["invoiceid"]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue