diff --git a/app/Import/Transformers/BaseTransformer.php b/app/Import/Transformers/BaseTransformer.php index aab84fb8e935..1429b3e02444 100644 --- a/app/Import/Transformers/BaseTransformer.php +++ b/app/Import/Transformers/BaseTransformer.php @@ -60,7 +60,7 @@ class BaseTransformer if ($code) { $currency = $this->maps['currencies']->where('code', $code)->first(); - if ($currency_id) { + if ($currency) { return $currency->id; } } diff --git a/app/Services/Invoice/AddGatewayFee.php b/app/Services/Invoice/AddGatewayFee.php index 834dc4fc2b5b..4cadb94bd498 100644 --- a/app/Services/Invoice/AddGatewayFee.php +++ b/app/Services/Invoice/AddGatewayFee.php @@ -43,16 +43,17 @@ class AddGatewayFee extends AbstractService { $gateway_fee = round($this->company_gateway->calcGatewayFee($this->amount, $this->gateway_type_id, $this->invoice->uses_inclusive_taxes), $this->invoice->client->currency()->precision); - if ((int)$gateway_fee == 0) { + if ((int)$gateway_fee == 0) return $this->invoice; - } + // Removes existing stale gateway fees $this->cleanPendingGatewayFees(); - if ($gateway_fee > 0) { + // If a gateway fee is > 0 insert the line item + if ($gateway_fee > 0) return $this->processGatewayFee($gateway_fee); - } - + + // If we have reached this far, then we are apply a gateway discount return $this->processGatewayDiscount($gateway_fee); } diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index b0111f634ac1..603bb30dc269 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -376,6 +376,10 @@ class InvoiceService $this->invoice->terms = $settings->invoice_terms; } + if(!isset($this->invoice->public_notes)) { + $this->invoice->public_notes = $settings->public_notes; + } + return $this; }