1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 14:12:44 +01:00

Fix for gateway fees

This commit is contained in:
Hillel Coren 2017-03-17 16:41:19 +02:00
parent b2e8457c3a
commit 0f63ea782f

View File

@ -320,7 +320,7 @@ class InvoiceRepository extends BaseRepository
public function save(array $data, Invoice $invoice = null) public function save(array $data, Invoice $invoice = null)
{ {
/** @var Account $account */ /** @var Account $account */
$account = \Auth::user()->account; $account = $invoice ? $invoice->account : \Auth::user()->account;
$publicId = isset($data['public_id']) ? $data['public_id'] : false; $publicId = isset($data['public_id']) ? $data['public_id'] : false;
$isNew = ! $publicId || $publicId == '-1'; $isNew = ! $publicId || $publicId == '-1';
@ -623,7 +623,7 @@ class InvoiceRepository extends BaseRepository
} }
if ($productKey = trim($item['product_key'])) { if ($productKey = trim($item['product_key'])) {
if (\Auth::user()->account->update_products if ($account->update_products
&& ! $invoice->has_tasks && ! $invoice->has_tasks
&& ! $invoice->has_expenses && ! $invoice->has_expenses
&& $productKey != trans('texts.surcharge') && $productKey != trans('texts.surcharge')