Fix for import

This commit is contained in:
David Bomba 2021-01-17 20:35:01 +11:00
parent 7e908ef776
commit af86d1e69f
3 changed files with 11 additions and 6 deletions

View File

@ -60,7 +60,7 @@ class BaseTransformer
if ($code) { if ($code) {
$currency = $this->maps['currencies']->where('code', $code)->first(); $currency = $this->maps['currencies']->where('code', $code)->first();
if ($currency_id) { if ($currency) {
return $currency->id; return $currency->id;
} }
} }

View File

@ -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); $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; return $this->invoice;
}
// Removes existing stale gateway fees
$this->cleanPendingGatewayFees(); $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); return $this->processGatewayFee($gateway_fee);
}
// If we have reached this far, then we are apply a gateway discount
return $this->processGatewayDiscount($gateway_fee); return $this->processGatewayDiscount($gateway_fee);
} }

View File

@ -376,6 +376,10 @@ class InvoiceService
$this->invoice->terms = $settings->invoice_terms; $this->invoice->terms = $settings->invoice_terms;
} }
if(!isset($this->invoice->public_notes)) {
$this->invoice->public_notes = $settings->public_notes;
}
return $this; return $this;
} }