/** * Delete recurence form an invoice */ function stop_recurrent() { $do_api_invoice = new Invoice(); $do_api_rec_invoice = new RecurrentInvoice(); if (!$do_api_invoice->isInvoiceOwner($this->idinvoice, $this->iduser)) { $this->setMessage("711", "Invoice does not belong to you"); return false; } elseif ($do_api_rec_invoice->checkIfInvoiceIsInRecurrent($this->idinvoice)) { if ($do_api_rec_invoice->deleteRecurrentInvoice($this->idinvoice)) { $this->setMessage("750", "Recurence for invoice " . $this->idinvoice . " as been removed", "ok"); return True; } else { $this->setMessage("733", "Invoice:" . $this->idinvoice . " Doesn't has any recurrence", "fail"); return false; } } else { $this->setMessage("733", "Invoice:" . $this->idinvoice . " Doesn't has any recurrence", "fail"); return false; } }