diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 14676624c2..b81fb92e35 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -203,7 +203,10 @@ class InvoiceController extends BaseController public function edit($publicId, $clone = false) { $account = Auth::user()->account; - $invoice = Invoice::scope($publicId)->withTrashed()->with('invitations', 'account.country', 'client.contacts', 'client.country', 'invoice_items')->firstOrFail(); + $invoice = Invoice::scope($publicId) + ->with('invitations', 'account.country', 'client.contacts', 'client.country', 'invoice_items') + ->withTrashed() + ->firstOrFail(); $entityType = $invoice->getEntityType(); $contactIds = DB::table('invitations') @@ -270,6 +273,7 @@ class InvoiceController extends BaseController $lastSent = ($invoice->is_recurring && $invoice->last_sent_date) ? $invoice->recurring_invoices->last() : null; $data = array( + 'clients' => Client::scope()->withTrashed()->with('contacts', 'country')->whereId($invoice->id)->get(), 'entityType' => $entityType, 'showBreadcrumbs' => $clone, 'invoice' => $invoice, @@ -282,7 +286,7 @@ class InvoiceController extends BaseController 'actions' => $actions, 'lastSent' => $lastSent); $data = array_merge($data, self::getViewModel()); - + if ($clone) { $data['formIsChanged'] = true; } @@ -327,6 +331,7 @@ class InvoiceController extends BaseController $invoice->public_id = 0; $data = [ + 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'entityType' => $invoice->getEntityType(), 'invoice' => $invoice, 'method' => 'POST', @@ -361,7 +366,6 @@ class InvoiceController extends BaseController 'account' => Auth::user()->account->load('country'), 'products' => Product::scope()->with('default_tax_rate')->orderBy('id')->get(), 'countries' => Cache::get('countries'), - 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), 'taxRates' => TaxRate::scope()->orderBy('name')->get(), 'currencies' => Cache::get('currencies'), 'languages' => Cache::get('languages'), diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 121bc5914b..08e74055c3 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -207,12 +207,12 @@ class Utils $data = [ 'context' => $context, 'user_id' => Auth::check() ? Auth::user()->id : 0, + 'account_id' => Auth::check() ? Auth::user()->account_id : 0, 'user_name' => Auth::check() ? Auth::user()->getDisplayName() : '', 'url' => Input::get('url', Request::url()), 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '', 'ip' => Request::getClientIp(), 'count' => Session::get('error_count', 0), - //'input' => Input::all() ]; Log::error($error."\n", $data); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index eab4e221a4..7922889f53 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -919,4 +919,7 @@ return array( 'include' => 'Include', 'logo_too_large' => 'Your logo is :size, for better performance we suggest uploading an image file less than 200KB', + 'can_not_email_inactive_client' => 'Emails can not be sent to inactive clients', + 'can_not_email_inactive_invoice' => 'Emails can not be sent to inactive invoices', + );