/** * Remove existing payment * * @param void * @return null */ function delete() { if ($this->active_invoice->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if ($this->active_invoice_payment->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_invoice_payment->canDelete($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->request->isSubmitted()) { $delete = $this->active_invoice_payment->delete(); if ($delete && !is_error($delete)) { flash_success('Payment has been successfully deleted'); } else { flash_error('Failed to delete selected payment'); } // if $this->redirectToUrl($this->active_invoice->getViewUrl()); } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if }