Do not set exchange rate if already set

This commit is contained in:
David Bomba 2022-02-08 20:36:07 +11:00
parent 08802963cb
commit 8fbab48019
4 changed files with 12 additions and 0 deletions

View File

@ -202,6 +202,9 @@ class PaymentMigrationRepository extends BaseRepository
*/ */
private function processExchangeRates($data, $payment) private function processExchangeRates($data, $payment)
{ {
if($payment->exchange_rate != 1)
return $payment;
$client = Client::where('id', $data['client_id'])->withTrashed()->first(); $client = Client::where('id', $data['client_id'])->withTrashed()->first();
$client_currency = $client->getSetting('currency_id'); $client_currency = $client->getSetting('currency_id');

View File

@ -111,6 +111,9 @@ class ApplyPaymentAmount extends AbstractService
private function setExchangeRate(Payment $payment) private function setExchangeRate(Payment $payment)
{ {
if($payment->exchange_rate != 1)
return;
$client_currency = $payment->client->getSetting('currency_id'); $client_currency = $payment->client->getSetting('currency_id');
$company_currency = $payment->client->company->settings->currency_id; $company_currency = $payment->client->company->settings->currency_id;

View File

@ -79,6 +79,9 @@ class InvoiceService
public function setExchangeRate() public function setExchangeRate()
{ {
if($this->invoice->exchange_rate != 0)
return $this;
$client_currency = $this->invoice->client->getSetting('currency_id'); $client_currency = $this->invoice->client->getSetting('currency_id');
$company_currency = $this->invoice->company->settings->currency_id; $company_currency = $this->invoice->company->settings->currency_id;

View File

@ -116,6 +116,9 @@ class MarkPaid extends AbstractService
private function setExchangeRate(Payment $payment) private function setExchangeRate(Payment $payment)
{ {
if($payment->exchange_rate != 1)
return;
$client_currency = $payment->client->getSetting('currency_id'); $client_currency = $payment->client->getSetting('currency_id');
$company_currency = $payment->client->company->settings->currency_id; $company_currency = $payment->client->company->settings->currency_id;