From 3be35e6c0248e3ca4c407c8eee0dad9f797e2f30 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Wed, 25 Apr 2018 08:08:36 +0200 Subject: [PATCH] Removed hardcoding of bank profile --- Logic/Financial/FinancialAccount.cs | 17 ++++++++++++++++- Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs | 9 +++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Logic/Financial/FinancialAccount.cs b/Logic/Financial/FinancialAccount.cs index 9694ba06..1929f8b3 100644 --- a/Logic/Financial/FinancialAccount.cs +++ b/Logic/Financial/FinancialAccount.cs @@ -187,8 +187,23 @@ namespace Swarmops.Logic.Financial } } - public ExternalBankDataProfile ExternalBankDataProfile + { + get + { + ExternalBankDataProfile oldProfile = ExternalBankDataProfileOldHack; + ExternalBankDataProfile newProfile = AutomationProfile.BankDataProfile; + + if (oldProfile != null && newProfile != oldProfile) + { + throw new InvalidOperationException("Defensive programming for crucial part"); + } + + return newProfile; + } + } + + private ExternalBankDataProfile ExternalBankDataProfileOldHack { get { diff --git a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs index bf986a07..f98d7bd5 100644 --- a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs +++ b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs @@ -263,6 +263,15 @@ namespace Swarmops.Site.Pages.Ledgers }; } + if (profile.Currency == null) // uses presentation currency + { + return new AjaxCallResult + { + Success = true, + DisplayMessage = profile.Name + }; + } + return new AjaxCallResult { Success = true,