mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Fixed issue with invoice history
This commit is contained in:
parent
786b6567b6
commit
7317bfc8c9
@ -556,9 +556,9 @@ class InvoiceController extends BaseController
|
||||
return self::edit($request, $publicId, true);
|
||||
}
|
||||
|
||||
public function invoiceHistory($publicId)
|
||||
public function invoiceHistory(InvoiceRequest $request)
|
||||
{
|
||||
$invoice = Invoice::withTrashed()->scope($publicId)->firstOrFail();
|
||||
$invoice = $request->entity();
|
||||
$invoice->load('user', 'invoice_items', 'documents', 'expenses', 'expenses.documents', 'account.country', 'client.contacts', 'client.country');
|
||||
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
|
||||
$invoice->due_date = Utils::fromSqlDate($invoice->due_date);
|
||||
@ -584,7 +584,7 @@ class InvoiceController extends BaseController
|
||||
$backup = json_decode($activity->json_backup);
|
||||
$backup->invoice_date = Utils::fromSqlDate($backup->invoice_date);
|
||||
$backup->due_date = Utils::fromSqlDate($backup->due_date);
|
||||
$invoice->features = [
|
||||
$backup->features = [
|
||||
'customize_invoice_design' => Auth::user()->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN),
|
||||
'remove_created_by' => Auth::user()->hasFeature(FEATURE_REMOVE_CREATED_BY),
|
||||
'invoice_settings' => Auth::user()->hasFeature(FEATURE_INVOICE_SETTINGS),
|
||||
|
@ -15,9 +15,17 @@ class EntityRequest extends Request {
|
||||
return $this->entity;
|
||||
}
|
||||
|
||||
$paramName = $this->entityType . 's';
|
||||
$publicId = $this->$paramName ?: (Input::get('public_id') ?: Input::get('id'));
|
||||
|
||||
// The entity id can appear as invoices, invoice_id, public_id or id
|
||||
$publicId = false;
|
||||
foreach (['_id', 's'] as $suffix) {
|
||||
$field = $this->entityType . $suffix;
|
||||
if ($this->$field) {
|
||||
$publicId= $this->$field;
|
||||
}
|
||||
}
|
||||
if ( ! $publicId) {
|
||||
$publicId = Input::get('public_id') ?: Input::get('id');
|
||||
}
|
||||
if ( ! $publicId) {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user