diff --git a/Logic/Financial/FinancialAccount.cs b/Logic/Financial/FinancialAccount.cs index a4cfc9a3..839383a3 100644 --- a/Logic/Financial/FinancialAccount.cs +++ b/Logic/Financial/FinancialAccount.cs @@ -192,7 +192,7 @@ namespace Swarmops.Logic.Financial get { ExternalBankDataProfile oldProfile = ExternalBankDataProfileOldHack; - ExternalBankDataProfile newProfile = AutomationProfile.BankDataProfile; + ExternalBankDataProfile newProfile = ExternalBankDataProfile.FromIdentity(AutomationProfile.BankDataProfileId); if (oldProfile != null && (newProfile.Identity != oldProfile.Identity || newProfile.Name != oldProfile.Name)) { diff --git a/Logic/Financial/FinancialAccountAutomationProfile.cs b/Logic/Financial/FinancialAccountAutomationProfile.cs index acabbac8..ada0dd75 100644 --- a/Logic/Financial/FinancialAccountAutomationProfile.cs +++ b/Logic/Financial/FinancialAccountAutomationProfile.cs @@ -39,9 +39,9 @@ namespace Swarmops.Logic.Financial CanManualUpload = true, CanAutoRetrieve = false, Name = "Paypal CSV", - Country = null, // global - Currency = null, // whatever the presentation currency is - BankDataProfile = ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.PaypalId) + CountryId = 0, // global + CurrencyId = 0, // whatever the presentation currency is + BankDataProfileId = ExternalBankDataProfile.PaypalId }; case FinancialAccountAutomationProfileHardIds.BankSwedenSeb: @@ -50,9 +50,9 @@ namespace Swarmops.Logic.Financial CanManualUpload = true, CanAutoRetrieve = false, Name = "Swedish SEB CSV", - Country = Structure.Country.FromCode("SE"), - Currency = Financial.Currency.FromCode("SEK"), - BankDataProfile = ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.SESebId) + CountryId = Structure.Country.FromCode("SE").Identity, + CurrencyId = Financial.Currency.FromCode("SEK").Identity, + BankDataProfileId = ExternalBankDataProfile.SESebId }; case FinancialAccountAutomationProfileHardIds.BankGermanyPostbank: @@ -61,9 +61,9 @@ namespace Swarmops.Logic.Financial CanManualUpload = true, CanAutoRetrieve = false, Name = "Deutsche Postbank CSV", - Country = Structure.Country.FromCode("DE"), - Currency = Financial.Currency.FromCode("EUR"), - BankDataProfile = ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.DEPostbankId) + CountryId = Structure.Country.FromCode("DE").Identity, + CurrencyId = Financial.Currency.FromCode("EUR").Identity, + BankDataProfileId = ExternalBankDataProfile.DEPostbankId }; case FinancialAccountAutomationProfileHardIds.BankCzechFio: @@ -72,9 +72,9 @@ namespace Swarmops.Logic.Financial CanManualUpload = true, CanAutoRetrieve = false, Name = "Ceská Fio CSV", - Country = Structure.Country.FromCode("CZ"), - Currency = Financial.Currency.FromCode("CZK"), - BankDataProfile = ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.CZFioId) + CountryId = Structure.Country.FromCode("CZ").Identity, + CurrencyId = Financial.Currency.FromCode("CZK").Identity, + BankDataProfileId = ExternalBankDataProfile.CZFioId }; default: @@ -96,6 +96,7 @@ namespace Swarmops.Logic.Financial public bool CanAutoRetrieve { get; set; } public bool CanManualUpload { get; set; } + /* [XmlIgnore] [JsonIgnore] public Country Country @@ -118,11 +119,11 @@ namespace Swarmops.Logic.Financial { get { return BankDataProfileId != 0 ? ExternalBankDataProfile.FromIdentity(BankDataProfileId): null; } set { this.BankDataProfileId = (value == null ? 0 : value.Identity); } - } + }*/ - protected int BankDataProfileId { get; set; } - protected int CountryId { get; set; } - protected int CurrencyId { get; set; } + public int BankDataProfileId { get; set; } + public int CountryId { get; set; } + public int CurrencyId { get; set; } [XmlIgnore] [JsonIgnore] diff --git a/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs b/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs index 3b09a940..52792a2a 100644 --- a/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs +++ b/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs @@ -494,7 +494,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers result.Success = true; result.Data = GetAccountAutomationData(profileId); result.Data.NonPresentationCurrency = - (result.Data.Profile.Currency.Identity != authData.CurrentOrganization.Currency.Identity); + (result.Data.Profile.CurrencyId != authData.CurrentOrganization.Currency.Identity); return result; } @@ -512,7 +512,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers if (result.AutomationEnabled) { result.Profile = FinancialAccountAutomationProfile.FromIdentity(profileId); - // result.AutomationCurrencyCode = result.Profile.Currency.Code; + result.AutomationCurrencyCode = Currency.FromIdentity(result.Profile.CurrencyId).Code; // the "NonpresentationCurrency" field can't be set here, because we don't know the presentation currency } diff --git a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs index 4171bd66..2d2385dd 100644 --- a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs +++ b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs @@ -262,7 +262,7 @@ namespace Swarmops.Site.Pages.Ledgers }; } - if (profile.Currency == null || profile.Currency.Identity == authData.CurrentOrganization.Currency.Identity) // uses presentation currency + if (profile.CurrencyId == 0 || profile.CurrencyId == authData.CurrentOrganization.Currency.Identity) // uses presentation currency { return new AjaxCallResult { @@ -274,7 +274,7 @@ namespace Swarmops.Site.Pages.Ledgers return new AjaxCallResult { Success = true, - DisplayMessage = profile.Name + " (" + profile.Currency.DisplayCode + ")" + DisplayMessage = profile.Name + " (" + Currency.FromIdentity(profile.CurrencyId).DisplayCode + ")" }; }