From 03ae091b4bd61b965b2226a7c2fa37451955fd64 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Tue, 17 Apr 2018 23:06:58 +0200 Subject: [PATCH] Committing work to transfer to mobile (this will break the build) --- Site/Pages/v5/Ledgers/AccountPlan.aspx | 1 - Site/Pages/v5/Ledgers/AccountPlan.aspx.cs | 55 +++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/Site/Pages/v5/Ledgers/AccountPlan.aspx b/Site/Pages/v5/Ledgers/AccountPlan.aspx index 6da47fc4..877f1ff1 100644 --- a/Site/Pages/v5/Ledgers/AccountPlan.aspx +++ b/Site/Pages/v5/Ledgers/AccountPlan.aspx @@ -530,7 +530,6 @@ } } - var currentYear = <%=DateTime.Today.Year %>; var firstFiscalYear = <%=CurrentOrganization.FirstFiscalYear %>; var ledgersClosedUntil = <%=CurrentOrganization.Parameters.FiscalBooksClosedUntilYear %>; diff --git a/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs b/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs index 22b6cbed..0d3c8d76 100644 --- a/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs +++ b/Site/Pages/v5/Ledgers/AccountPlan.aspx.cs @@ -6,6 +6,7 @@ using System.Web; using System.Web.Services; using System.Web.UI.WebControls; using Resources; +using Swarmops.Basic.Types.Structure; using Swarmops.Common.Enums; using Swarmops.Logic.Financial; using Swarmops.Logic.Security; @@ -529,6 +530,41 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers } + [WebMethod] + public static AjaxCallAutomationDataResult SetAccountAutomationProfile(int accountId, int profileId) + { + AuthenticationData authData = GetAuthenticationDataAndCulture(); + FinancialAccount account = FinancialAccount.FromIdentity(accountId); + + + if (account.OrganizationId != authData.CurrentOrganization.Identity) + { + throw new UnauthorizedAccessException("A million nopes"); + } + + if ( + !authData.Authority.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.BookkeepingDetails, + AccessType.Write))) + { + throw new UnauthorizedAccessException("No"); + } + + account.AutomationProfileId = profileId; + + AjaxCallAutomationDataResult result = new AjaxCallAutomationDataResult(); + result.Success = true; + result.Data = GetAccountAutomationData(profileId); + + return result; + } + + + private static AutomationData GetAccountAutomationData(int profileId) + { + + } + + [WebMethod] public static bool SetAccountSwitch (int accountId, string switchName, bool switchValue) { @@ -596,6 +632,25 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers public bool Open { get; set; } public int ParentAccountId { get; set; } public string ParentAccountName { get; set; } + public AutomationData AutomationData { get; set; } + } + + + [Serializable] + public class AutomationData + { + public bool AutomationEnabled { get; set; } + public int AutomationProfileId { get; set; } + public string AutomationCurrencyCode { get; set; } + public bool NonPresentationCurrency { get; set; } + public bool AutomaticRetrievalPossible { get; set; } // always false for now + public string AutomationProfileCustomXml { get; set; } // always empty for now + } + + [Serializable] + public class AjaxCallAutomationDataResult : AjaxCallResult + { + public AutomationData Data { get; set; } } } } \ No newline at end of file