diff --git a/Logic/Financial/FinancialAccountAutomationProfile.cs b/Logic/Financial/FinancialAccountAutomationProfile.cs index 83c6f5ab..081db0e1 100644 --- a/Logic/Financial/FinancialAccountAutomationProfile.cs +++ b/Logic/Financial/FinancialAccountAutomationProfile.cs @@ -51,12 +51,13 @@ namespace Swarmops.Logic.Financial public enum FinancialAccountAutomationProfileHardIds { Unknown = 0, - BitcoinHotwallet = 1, - BitcoinCashArmory = 2, - BitcoinCoreArmory = 3, - BankPaypal = 4, - BankSwedenSeb = 5, - BankGermanyPostbank = 6, - BankCzechFio = 7 + Custom = 1, + BitcoinHotwallet = 2, + BitcoinCashArmory = 3, + BitcoinCoreArmory = 4, + BankPaypal = 5, + BankSwedenSeb = 6, + BankGermanyPostbank = 7, + BankCzechFio = 8 } } diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs index 05c15db1..fd171477 100644 --- a/Logic/Structure/Organization.cs +++ b/Logic/Structure/Organization.cs @@ -210,9 +210,24 @@ namespace Swarmops.Logic.Structure { get { + FinancialAccounts result = new FinancialAccounts(); + + FinancialAccounts allAssets = Logic.Financial.FinancialAccounts.ForOrganization(this, FinancialAccountType.Asset); + + foreach (FinancialAccount account in allAssets) + { + if (account.AutomationProfileId != 0) + { + result.Add(account); + } + } + + return result; + // HACK: MUST FETCH THIS FROM ACTUAL ACCOUNTS // HACK HACK HACK HACK HACK HACK + /* if (PilotInstallationIds.IsPilot (PilotInstallationIds.PiratePartySE) && OrganizationId == 1) { FinancialAccounts result = new FinancialAccounts(); @@ -236,7 +251,7 @@ namespace Swarmops.Logic.Structure return result; } - throw new NotImplementedException(); + throw new NotImplementedException();*/ } } diff --git a/Site/App_GlobalResources/Pages.Ledgers.designer.cs b/Site/App_GlobalResources/Pages.Ledgers.designer.cs index 87373d60..7e19eb6c 100644 --- a/Site/App_GlobalResources/Pages.Ledgers.designer.cs +++ b/Site/App_GlobalResources/Pages.Ledgers.designer.cs @@ -1698,6 +1698,15 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to Automation Profile. + /// + internal static string UploadBankFiles_AccountAutomationProfile { + get { + return ResourceManager.GetString("UploadBankFiles_AccountAutomationProfile", resourceCulture); + } + } + /// /// Looks up a localized string similar to Account Statement. /// @@ -1806,6 +1815,15 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to There are no asset accounts set up for automation, so no accounts support data upload at this time. Returning to Dashboard.. + /// + internal static string UploadBankFiles_Error_NoAutomationProfiles { + get { + return ResourceManager.GetString("UploadBankFiles_Error_NoAutomationProfiles", resourceCulture); + } + } + /// /// Looks up a localized string similar to Expected File. /// @@ -1842,6 +1860,15 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to As this was the first upload to this automated account, the initial balance of {0} {1:N2} going into the year {2} has been detected and set.. + /// + internal static string UploadBankFiles_FirstUploadBalanceSet { + get { + return ResourceManager.GetString("UploadBankFiles_FirstUploadBalanceSet", resourceCulture); + } + } + /// /// Looks up a localized string similar to Error on importing file. /// diff --git a/Site/App_GlobalResources/Pages.Ledgers.resx b/Site/App_GlobalResources/Pages.Ledgers.resx index acc278b7..b2c70048 100644 --- a/Site/App_GlobalResources/Pages.Ledgers.resx +++ b/Site/App_GlobalResources/Pages.Ledgers.resx @@ -976,4 +976,15 @@ This transaction pays Inbound Invoice #{0:N0} from {1}. + + Automation Profile + This is where the bank name, country, and currency appears. + + + There are no asset accounts set up for automation, so no accounts support data upload at this time. Returning to Dashboard. + + + As this was the first upload to this automated account, the initial balance of {0} {1:N2} going into the year {2} has been detected and set. + {0} is currency, {1} is amount, {2} is the first accounting year + \ No newline at end of file diff --git a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx index d5de2e01..b57149df 100644 --- a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx +++ b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx @@ -178,12 +178,12 @@
-  
+

-
+
diff --git a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs index 8bbac41e..a9e2fc58 100644 --- a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs +++ b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs @@ -46,42 +46,13 @@ namespace Swarmops.Site.Pages.Ledgers PageIcon = "iconshock-bank"; PageAccessRequired = new Access (CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write); - // HACK HACK: If not a supported hardcoded org, bail out like a chicken - - // UGLY UGLY UGLY - - bool supportedHardcode = false; - - if (PilotInstallationIds.IsPilot (PilotInstallationIds.PiratePartySE) && CurrentOrganization.Identity == 1) - // PPSE - { - supportedHardcode = true; - } - if (PilotInstallationIds.IsPilot(PilotInstallationIds.SwarmopsLive) && CurrentOrganization.Identity == 7) - // EPA - { - supportedHardcode = true; - } - if (PilotInstallationIds.IsPilot(PilotInstallationIds.SwarmopsLive) && CurrentOrganization.Identity == 8) - // RFF - { - supportedHardcode = true; - } - - if (!supportedHardcode) - { - DashboardMessage.Set ("There are no asset accounts set up for automation, so no accounts support data upload at this time. Returning to Dashboard."); - Response.Redirect ("/", true); - } - - if (!IsPostBack) { // Localize InfoBoxLiteral = Resources.Pages.Ledgers.UploadBankFiles_Info; this.LabelBankAccount.Text = Resources.Pages.Ledgers.UploadBankFiles_BankAccount; - this.LabelInstructions.Text = Resources.Pages.Ledgers.UploadBankFiles_Instructions; + this.LabelProfile.Text = Resources.Pages.Ledgers.UploadBankFiles_AccountAutomationProfile; this.LabelProcessing.Text = Resources.Pages.Ledgers.UploadBankFiles_Processing; this.LabelProcessingComplete.Text = Resources.Pages.Ledgers.UploadBankFiles_ProcessingComplete; this.LabelUploadBankFile.Text = Resources.Pages.Ledgers.UploadBankFiles_UploadBankFile; @@ -91,6 +62,12 @@ namespace Swarmops.Site.Pages.Ledgers // Populate the asset account dropdown, if needed for file type PopulateAccountDropDown(); + + if (this.DropAccounts.Items.Count < 2) + { + DashboardMessage.Set(CommonV5.JavascriptEscape(Resources.Pages.Ledgers.UploadBankFiles_Error_NoAutomationProfiles)); + Response.Redirect("/", true); + } } if (!IsPostBack) diff --git a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.designer.cs b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.designer.cs index 98cd79ef..6ab6f223 100644 --- a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.designer.cs +++ b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.designer.cs @@ -67,13 +67,13 @@ namespace Swarmops.Site.Pages.Ledgers { protected global::System.Web.UI.WebControls.Label LabelBankAccount; /// - /// LabelInstructions control. + /// LabelProfile control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Label LabelInstructions; + protected global::System.Web.UI.WebControls.Label LabelProfile; /// /// LabelUploadBankFile control.