mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Fix for cloning invoices from API
This commit is contained in:
parent
afae9e8289
commit
7cac31e7a6
@ -1,6 +1,7 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use Guzzle\Tests\Common\Cache\NullCacheAdapterTest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Utils;
|
||||
@ -357,7 +358,16 @@ class InvoiceApiController extends BaseAPIController
|
||||
|
||||
return $this->response($data);
|
||||
}
|
||||
else if ($request->action == ACTION_CLONE) {
|
||||
|
||||
$invoice = Invoice::scope($publicId)->firstOrFail();
|
||||
$clonedInvoice = $this->invoiceRepo->cloneInvoice($invoice, null);
|
||||
|
||||
$transformer = new InvoiceTransformer(\Auth::user()->account, Input::get('serializer'));
|
||||
$data = $this->createItem($clonedInvoice, $transformer, 'invoice');
|
||||
|
||||
return $this->response($data);
|
||||
}
|
||||
$data = $request->input();
|
||||
$data['public_id'] = $publicId;
|
||||
$this->invoiceService->save($data);
|
||||
|
@ -380,6 +380,7 @@ if (!defined('CONTACT_EMAIL')) {
|
||||
|
||||
define('ACTION_RESTORE', 'restore');
|
||||
define('ACTION_ARCHIVE', 'archive');
|
||||
define('ACTION_CLONE', 'clone');
|
||||
define('ACTION_CONVERT', 'convert');
|
||||
define('ACTION_DELETE', 'delete');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user