diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index ffaabac3a10d..dc251a4ca3e7 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -13,6 +13,7 @@ namespace App\Utils; use App\Libraries\MultiDB; use App\Mail\TestMailServer; +use App\Models\Company; use Exception; use Illuminate\Support\Arr; use Illuminate\Support\Facades\DB; @@ -82,9 +83,34 @@ class SystemHealth 'queue' => (string) config('queue.default'), 'trailing_slash' => (bool) self::checkUrlState(), 'file_permissions' => (string) self::checkFileSystem(), + 'exchange_rate_api_not_configured' => (bool)self::checkCurrencySanity(), ]; } + private static function checkCurrencySanity() + { + + if(strlen(config('ninja.currency_converter_api_key')) == 0){ + + $cs = DB::table('clients') + ->select('settings->currency_id as id') + ->get(); + + + $currency_count = $cs->unique('id')->filter(function ($value){ + return !is_null($value->id); + })->count(); + + + if($currency_count > 1) + return true; + + } + + return false; + + } + private static function checkQueueSize() { $count = 0;