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:
commit
910e9db7a0
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user