Added ability to convert a quote to an invoice through the API
This commit is contained in:
parent
71b2970279
commit
4799b2e86c
2 changed files with 10 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -329,6 +329,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…
Add table
Reference in a new issue