diff --git a/Logic/Financial/FinancialTransactionRow.cs b/Logic/Financial/FinancialTransactionRow.cs index d6a97c79..f58100ca 100644 --- a/Logic/Financial/FinancialTransactionRow.cs +++ b/Logic/Financial/FinancialTransactionRow.cs @@ -1,6 +1,7 @@ using System; using Swarmops.Basic.Types.Financial; using Swarmops.Database; +using Swarmops.Logic.Swarm; namespace Swarmops.Logic.Financial { @@ -45,6 +46,19 @@ namespace Swarmops.Logic.Financial get { return Account.Name; } } + public Person CreatedByPerson + { + get + { + if (base.CreatedByPersonId > 0) + { + return Person.FromIdentity (base.CreatedByPersonId); + } + + return null; + } + } + [Obsolete ("Do not use. Use Int64 AmountCents.", true)] public decimal Amount { diff --git a/Logic/Security/Accesses.cs b/Logic/Security/Accesses.cs index 03dec507..b23d17bc 100644 --- a/Logic/Security/Accesses.cs +++ b/Logic/Security/Accesses.cs @@ -37,10 +37,20 @@ namespace Swarmops.Logic.Security Unknown = 0, /// - /// Access to underlying ledgers + /// Basic access to underlying ledgers /// Bookkeeping, + /// + /// Detailed access to underlying ledgers (documents, descriptions) + /// + BookkeepingDetails, + + /// + /// Access to auditing working material (redflagged transactions, etc) + /// + Auditing, + /// /// Access to regular accounting /// @@ -54,7 +64,7 @@ namespace Swarmops.Logic.Security /// /// Access to personal details about people in an organization /// - PersonData, + PersonalData, /// /// Access to change organization's fundamental operating parameters diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs index 510a931c..84f69454 100644 --- a/Logic/Structure/Organization.cs +++ b/Logic/Structure/Organization.cs @@ -939,6 +939,26 @@ namespace Swarmops.Logic.Structure return new DateTime (year, 12, 31, 23, 59, 59, 999); } + public DateTime GetStartOfFiscalYear (int year) + { + // Returns the first millisecond of the fiscal year. For now, this is limited to calendar years; the function + // exists for future expandability. + + return new DateTime (year, 1, 1, 0, 0, 0, 0); + } + + + public string VanityDomain + { + get { return OptionalData.GetOptionalDataString(ObjectOptionalDataType.OrgVanityDomain); } + set { OptionalData.SetOptionalDataString(ObjectOptionalDataType.OrgVanityDomain, value); } + } + + public string OpenLedgersDomain + { + get { return OptionalData.GetOptionalDataString(ObjectOptionalDataType.OrgOpenLedgersDomain); } + set { OptionalData.SetOptionalDataString(ObjectOptionalDataType.OrgOpenLedgersDomain, value); } + } } } \ No newline at end of file diff --git a/Site5/App_GlobalResources/Global.resx b/Site5/App_GlobalResources/Global.resx index affaceb6..3ec892d5 100644 --- a/Site5/App_GlobalResources/Global.resx +++ b/Site5/App_GlobalResources/Global.resx @@ -576,4 +576,8 @@ (vacant) For unassigned positions + + define to enable + shown as watermark on some edit boxes + \ No newline at end of file diff --git a/Site5/App_GlobalResources/Pages.Admin.resx b/Site5/App_GlobalResources/Pages.Admin.resx index 7ff32f53..29030d42 100644 --- a/Site5/App_GlobalResources/Pages.Admin.resx +++ b/Site5/App_GlobalResources/Pages.Admin.resx @@ -157,6 +157,9 @@ {0} numbering The {0} is the membership, ambassadorship, etc. + + Open Ledgers Domain + Edit Organization @@ -194,6 +197,9 @@ Renewal cost (in {0}) The {0} is the operating currency (USD etc). + + Vanity Domain + Admin Notifications From Address diff --git a/Site5/App_GlobalResources/Pages.Ledgers.resx b/Site5/App_GlobalResources/Pages.Ledgers.resx index fdd9c578..8d2bf339 100644 --- a/Site5/App_GlobalResources/Pages.Ledgers.resx +++ b/Site5/App_GlobalResources/Pages.Ledgers.resx @@ -609,4 +609,22 @@ Inspecting Transaction #<span id="spanModalTransactionId">12345</span> The transaction id is replaced client-side on display + + Account name + + + Balance is correct: + + + (No transaction data) + + + Initials + + + Logged + + + Transaction is <span class="spanAnnoyingBlink">UNBALANCED</span>: + \ No newline at end of file diff --git a/Site5/App_GlobalResources/Pages.Swarm.resx b/Site5/App_GlobalResources/Pages.Swarm.resx index 441be6ac..c893a041 100644 --- a/Site5/App_GlobalResources/Pages.Swarm.resx +++ b/Site5/App_GlobalResources/Pages.Swarm.resx @@ -176,4 +176,10 @@ The result set contains over a thousand people (display limited to a thousand). Please refine your search? + + Assign person... + + + Create new position... + \ No newline at end of file diff --git a/Site5/Automation/Json-PositionsTree.aspx.cs b/Site5/Automation/Json-PositionsTree.aspx.cs index 39886aee..bb000dac 100644 --- a/Site5/Automation/Json-PositionsTree.aspx.cs +++ b/Site5/Automation/Json-PositionsTree.aspx.cs @@ -41,20 +41,16 @@ namespace Swarmops.Frontend.Automation string localizedPositionName = position.Localized (positionNode.Data.MaxCount != 1); PositionAssignments assignments = position.Assignments; - string parentName = string.Empty; - if (positionNode.Parent != null) - { - parentName = positionNode.Parent.Data.Localized(); - } + string expires = string.Empty; - string assignedName = Resources.Global.Swarm_Vacant; + string assignedName = Resources.Global.Swarm_Vacant + "Testing line 2Testing line 3"; if (assignments.Count > 0) { assignedName = assignments[0].Person.Canonical; } - string element = string.Format("\"id\":\"{0}\",\"positionTitle\":\"{1}\",\"assignedName\":\"{2}\",\"reportsTo\":\"{3}\"", - position.Identity, JsonSanitize (localizedPositionName), JsonSanitize (assignedName), JsonSanitize (parentName)); + string element = string.Format("\"id\":\"{0}\",\"positionTitle\":\"{1}\",\"assignedName\":\"{2}\",\"expires\":\"{3}\"", + position.Identity, JsonSanitize (localizedPositionName), JsonSanitize (assignedName), JsonSanitize (expires)); // TODO: Add all assignments after the first one right here diff --git a/Site5/Pages/v5/Admin/OrgSettings.aspx b/Site5/Pages/v5/Admin/OrgSettings.aspx index 06921168..7fcdda79 100644 --- a/Site5/Pages/v5/Admin/OrgSettings.aspx +++ b/Site5/Pages/v5/Admin/OrgSettings.aspx @@ -2,6 +2,7 @@ <%@ Import Namespace="Resources" %> <%@ Register tagPrefix="Swarmops5" tagName="FileUpload" src="~/Controls/v5/Base/FileUpload.ascx" %> <%@ Register tagPrefix="Swarmops5" tagName="DropDown" src="~/Controls/v5/Base/DropDown.ascx" %> +<%@ Register tagPrefix="Swarmops5" tagName="AjaxTextBox" src="~/Controls/v5/Base/AjaxTextBox.ascx" %> @@ -190,6 +191,18 @@ SMTP server (default if blank) + + Premium Features + + + + + + + + + + diff --git a/Site5/Pages/v5/Admin/OrgSettings.aspx.cs b/Site5/Pages/v5/Admin/OrgSettings.aspx.cs index 58fc790c..1c1cd3d1 100644 --- a/Site5/Pages/v5/Admin/OrgSettings.aspx.cs +++ b/Site5/Pages/v5/Admin/OrgSettings.aspx.cs @@ -1,10 +1,15 @@ using System; +using System.Runtime.Versioning; +using System.Text.RegularExpressions; using System.Web.Services; using System.Web.UI.WebControls; using Swarmops.Common.Enums; +using Swarmops.Frontend.Controls.v5.Base; +using Swarmops.Logic.Communications; using Swarmops.Logic.Financial; using Swarmops.Logic.Security; using Swarmops.Logic.Structure; +using Swarmops.Logic.Support; using Swarmops.Logic.Swarm; namespace Swarmops.Frontend.Pages.v5.Admin @@ -53,6 +58,13 @@ namespace Swarmops.Frontend.Pages.v5.Admin this.LabelMemberNumber.Text = String.Format (Resources.Pages.Admin.EditOrganization_MemberNumberStyle, participantship); + // Premium features + + this.LabelVanityDomain.Text = Resources.Pages.Admin.EditOrganization_VanityDomain; + this.LabelOpenLedgersDomain.Text = Resources.Pages.Admin.EditOrganization_OpenLedgersDomain; + this.TextVanityDomain.Placeholder = Resources.Global.Global_DefineToEnable; + this.TextOpenLedgersDomain.Placeholder = Resources.Global.Global_DefineToEnable; + this.DropMembersWhen.Items.Clear(); this.DropMembersWhen.Items.Add (new ListItem ("Application submitted", "Application")); this.DropMembersWhen.Items.Add (new ListItem ("Application approved", "ApplicationApproval")); @@ -368,6 +380,40 @@ namespace Swarmops.Frontend.Pages.v5.Admin } + [WebMethod] + static public AjaxTextBox.CallbackResult StoreCallback(string newValue, string cookie) + { + AjaxTextBox.CallbackResult result = new AjaxTextBox.CallbackResult(); + AuthenticationData authenticationData = GetAuthenticationDataAndCulture(); + + if (!authenticationData.CurrentUser.HasAccess (new Access (authenticationData.CurrentOrganization, AccessAspect.Administration, AccessType.Write))) + { + result.ResultCode = AjaxTextBox.CodeNoPermission; + return result; + } + + switch (cookie) + { + case "VanityDomain": + result.NewData = newValue.Trim(); + result.ResultCode = AjaxTextBox.CodeSuccess; + authenticationData.CurrentOrganization.VanityDomain = result.NewData; + break; + + case "OpenLedgersDomain": + result.NewData = newValue.Trim(); + result.ResultCode = AjaxTextBox.CodeSuccess; + authenticationData.CurrentOrganization.OpenLedgersDomain = result.NewData; + break; + + default: + throw new NotImplementedException("Unknown cookie in StoreCallback"); + } + + return result; + } + + public class CallResult { public bool Success { get; set; } diff --git a/Site5/Pages/v5/Admin/SystemSettings.aspx.cs b/Site5/Pages/v5/Admin/SystemSettings.aspx.cs index e646b36a..936c6693 100644 --- a/Site5/Pages/v5/Admin/SystemSettings.aspx.cs +++ b/Site5/Pages/v5/Admin/SystemSettings.aspx.cs @@ -138,6 +138,13 @@ namespace Swarmops.Frontend.Pages.v5.Admin static public AjaxTextBox.CallbackResult StoreCallback(string newValue, string cookie) { AjaxTextBox.CallbackResult result = new AjaxTextBox.CallbackResult(); + AuthenticationData authData = GetAuthenticationDataAndCulture(); + + if (!authData.CurrentUser.HasAccess (new Access (AccessAspect.System, AccessType.Write))) + { + result.ResultCode = AjaxTextBox.CodeNoPermission; + return result; // fail silently + } switch (cookie) { diff --git a/Site5/Pages/v5/Ledgers/AccountPlan.aspx b/Site5/Pages/v5/Ledgers/AccountPlan.aspx index 7a67b5f4..06ff563b 100644 --- a/Site5/Pages/v5/Ledgers/AccountPlan.aspx +++ b/Site5/Pages/v5/Ledgers/AccountPlan.aspx @@ -603,7 +603,7 @@ - + diff --git a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx index 9f29a3ec..83e794e2 100644 --- a/Site5/Pages/v5/Ledgers/InspectLedgers.aspx +++ b/Site5/Pages/v5/Ledgers/InspectLedgers.aspx @@ -4,46 +4,50 @@