From 6f957159175f6ae15176ddf39fa33b8b30df9e9a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 18 Jan 2021 10:01:37 +1100 Subject: [PATCH] Update model exchange rate if client currency differs from company --- app/Repositories/BaseRepository.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index ad6d5df21a3f..6fce805e8390 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -202,6 +202,11 @@ class BaseRepository /* Model now persisted, now lets do some child tasks */ + /* If client currency differs from the company default currency, then insert the client exchange rate on the model.*/ + if($client->currency()->id != (int) $model->company->settings->currency_id) + $model->exchange_rate = $client->currency()->exchange_rate; + + /* Save any documents */ if (array_key_exists('documents', $data)) $this->saveDocuments($data['documents'], $model);