mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
|
use Guzzle\Tests\Common\Cache\NullCacheAdapterTest;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Request;
|
use Illuminate\Support\Facades\Request;
|
||||||
use Utils;
|
use Utils;
|
||||||
@ -357,7 +358,16 @@ class InvoiceApiController extends BaseAPIController
|
|||||||
|
|
||||||
return $this->response($data);
|
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 = $request->input();
|
||||||
$data['public_id'] = $publicId;
|
$data['public_id'] = $publicId;
|
||||||
$this->invoiceService->save($data);
|
$this->invoiceService->save($data);
|
||||||
|
@ -380,6 +380,7 @@ if (!defined('CONTACT_EMAIL')) {
|
|||||||
|
|
||||||
define('ACTION_RESTORE', 'restore');
|
define('ACTION_RESTORE', 'restore');
|
||||||
define('ACTION_ARCHIVE', 'archive');
|
define('ACTION_ARCHIVE', 'archive');
|
||||||
|
define('ACTION_CLONE', 'clone');
|
||||||
define('ACTION_CONVERT', 'convert');
|
define('ACTION_CONVERT', 'convert');
|
||||||
define('ACTION_DELETE', 'delete');
|
define('ACTION_DELETE', 'delete');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user