1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Merge pull request #659 from turbo124/master

Added ability to convert a quote to an invoice through the API
This commit is contained in:
David Bomba 2016-01-27 12:57:28 +11:00
commit 910e9db7a0
2 changed files with 10 additions and 0 deletions

View File

@ -303,6 +303,15 @@ class InvoiceApiController extends BaseAPIController
return $this->response($data);
}
else if ($request->action == ACTION_CONVERT) {
$quote = Invoice::scope($publicId)->firstOrFail();
$invoice = $this->invoiceRepo->cloneInvoice($quote, $quote->id);
$transformer = new InvoiceTransformer(\Auth::user()->account, Input::get('serializer'));
$data = $this->createItem($invoice, $transformer, 'invoice');
return $this->response($data);
}
$data = $request->input();
$data['public_id'] = $publicId;

View File

@ -333,6 +333,7 @@ if (!defined('CONTACT_EMAIL')) {
define('ACTION_RESTORE', 'restore');
define('ACTION_ARCHIVE', 'archive');
define('ACTION_CONVERT', 'convert');
define('ACTION_DELETE', 'delete');
define('ACTIVITY_TYPE_CREATE_CLIENT', 1);