From 236709e3f48990ef1fbebc55ecf5dd4d10e2007a Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Thu, 31 Jan 2019 12:41:22 +0100 Subject: [PATCH] REFACTOR, TERMINOLOGY: It's not Attest costs in English, it's Approve --- Common/Enums/FinancialValidationType.cs | 12 +- Logic/Communications/OutboundComm.cs | 2 +- .../Payload/NotificationPayload.cs | 10 +- Logic/DashboardTasks/TaskGroup.cs | 2 +- Logic/Financial/CashAdvance.cs | 26 +-- Logic/Financial/ExpenseClaim.cs | 38 ++--- Logic/Financial/FinancialAccount.cs | 2 +- Logic/Financial/IApprovable.cs | 13 ++ Logic/Financial/IAttestable.cs | 13 -- Logic/Financial/IPayable.cs | 2 +- Logic/Financial/IValidatable.cs | 2 +- Logic/Financial/InboundInvoice.cs | 24 +-- Logic/Financial/Salary.cs | 22 +-- Logic/Logic.csproj | 2 +- ...ansmission.NotificationPayload.Designer.cs | 152 +++++++++--------- ...ions.Transmission.NotificationPayload.resx | 86 +++++----- ...ransmission.NotificationPayload.sv-SE.resx | 6 +- .../Logic.Swarm.DashboardTodos.Designer.cs | 8 +- .../Resources/Logic.Swarm.DashboardTodos.resx | 8 +- Logic/Swarm/Parley.cs | 26 +-- Logic/Swarm/Parleys.cs | 2 +- Site/App_GlobalResources/Menu5.designer.cs | 2 +- Site/App_GlobalResources/Menu5.resx | 3 +- .../Pages.Financial.designer.cs | 52 +++--- Site/App_GlobalResources/Pages.Financial.resx | 66 ++++---- .../fr-FR/Pages.Financial.fr-FR.resx | 2 +- .../{AttestCosts.aspx => ApproveCosts.aspx} | 47 +++--- ...testCosts.aspx.cs => ApproveCosts.aspx.cs} | 34 ++-- ...igner.cs => ApproveCosts.aspx.designer.cs} | 0 Site/Pages/v5/Financial/Donate.aspx.cs | 2 +- .../v5/Financial/FileExpenseClaim.aspx.cs | 2 +- ...leCosts.aspx => Json-ApprovableCosts.aspx} | 2 +- ...s.aspx.cs => Json-ApprovableCosts.aspx.cs} | 101 ++++++------ ... => Json-ApprovableCosts.aspx.designer.cs} | 2 +- .../v5/Financial/ListInvoicesInbound.aspx | 4 +- .../v5/Financial/ListInvoicesInbound.aspx.cs | 28 ++-- .../v5/Financial/ListInvoicesOutbound.aspx | 2 +- .../v5/Financial/RequestCashAdvance.aspx.cs | 2 +- Site/Pages/v5/Financial/ValidateReceipts.aspx | 83 ++++++---- .../v5/Financial/ValidateReceipts.aspx.cs | 53 +++--- Site/Pages/v5/Ledgers/InspectLedgers.aspx.cs | 2 +- Site/Scripts/Swarmops-v5.js | 12 ++ Site/Site.csproj | 20 +-- Utility/BotCode/EventProcessor.cs | 8 +- 44 files changed, 514 insertions(+), 473 deletions(-) create mode 100644 Logic/Financial/IApprovable.cs delete mode 100644 Logic/Financial/IAttestable.cs rename Site/Pages/v5/Financial/{AttestCosts.aspx => ApproveCosts.aspx} (94%) rename Site/Pages/v5/Financial/{AttestCosts.aspx.cs => ApproveCosts.aspx.cs} (96%) rename Site/Pages/v5/Financial/{AttestCosts.aspx.designer.cs => ApproveCosts.aspx.designer.cs} (100%) rename Site/Pages/v5/Financial/{Json-AttestableCosts.aspx => Json-ApprovableCosts.aspx} (55%) rename Site/Pages/v5/Financial/{Json-AttestableCosts.aspx.cs => Json-ApprovableCosts.aspx.cs} (74%) rename Site/Pages/v5/Financial/{Json-AttestableCosts.aspx.designer.cs => Json-ApprovableCosts.aspx.designer.cs} (85%) diff --git a/Common/Enums/FinancialValidationType.cs b/Common/Enums/FinancialValidationType.cs index 6f99f0da..4951bb4a 100644 --- a/Common/Enums/FinancialValidationType.cs +++ b/Common/Enums/FinancialValidationType.cs @@ -8,14 +8,14 @@ namespace Swarmops.Common.Enums Unknown = 0, /// - /// An attestation of an expenditure from a budget. + /// An approval of an expenditure from a budget. /// - Attestation, + Approval, /// - /// Removal of attested status. + /// Removal of approved status. /// - Deattestation, + UndoApproval, /// /// Validation of expenditure documents. @@ -23,9 +23,9 @@ namespace Swarmops.Common.Enums Validation, /// - /// Devalidation - removal of validated status. + /// Removal of validated status. /// - Devalidation, + UndoValidation, /// /// Kill: close this financial doc as not valid. diff --git a/Logic/Communications/OutboundComm.cs b/Logic/Communications/OutboundComm.cs index 99f34315..8c26b6ae 100644 --- a/Logic/Communications/OutboundComm.cs +++ b/Logic/Communications/OutboundComm.cs @@ -280,7 +280,7 @@ namespace Swarmops.Logic.Communications - public static OutboundComm CreateNotificationAttestationNeeded (FinancialAccount budget, Person concernedPerson, + public static OutboundComm CreateNotificationApprovalNeeded (FinancialAccount budget, Person concernedPerson, string supplier, double amountRequested, string purpose, NotificationResource notification) { NotificationPayload payload = new NotificationPayload (notification.ToString()); diff --git a/Logic/Communications/Payload/NotificationPayload.cs b/Logic/Communications/Payload/NotificationPayload.cs index b97bfb7e..934eb446 100644 --- a/Logic/Communications/Payload/NotificationPayload.cs +++ b/Logic/Communications/Payload/NotificationPayload.cs @@ -153,17 +153,17 @@ namespace Swarmops.Logic.Communications.Payload System_PublicRootReset, System_UnrecognizedPayload, CashAdvance_Requested, - CashAdvance_Attested, - CashAdvance_Deattested, + CashAdvance_Approved, + CashAdvance_ApprovalRetracted, CashAdvance_Denied, CashAdvance_Adjusted, CashAdvance_Rebudgeted, CashAdvance_PaidOut, ExpenseClaim_Created, - ExpenseClaim_Attested, - ExpenseClaim_Deattested, + ExpenseClaim_Approved, + ExpenseClaim_ApprovalRetracted, ExpenseClaim_Validated, - ExpenseClaim_Devalidated, + ExpenseClaim_ValidationRetracted, ExpenseClaim_Denied, ExpenseClaim_Adjusted, ExpenseClaim_Rebudgeted, diff --git a/Logic/DashboardTasks/TaskGroup.cs b/Logic/DashboardTasks/TaskGroup.cs index 44672e11..d61aaad9 100644 --- a/Logic/DashboardTasks/TaskGroup.cs +++ b/Logic/DashboardTasks/TaskGroup.cs @@ -75,7 +75,7 @@ namespace Swarmops.Logic.DashboardTasks lookupNavigateUrl[TaskGroupType.AttestationWarning] = "/Pages/v4/Financial/ViewInboundInvoices.aspx"; lookupIconUrl[TaskGroupType.AttestationWarning] = "/Images/Public/Fugue/icons-shadowless/receipt-invoice.png"; - lookupDescriptionSingle[TaskGroupType.AttestationWarning] = "Attestation for invoice {0} is running late"; + lookupDescriptionSingle[TaskGroupType.AttestationWarning] = "Approval for invoice {0} is running late"; lookupDescriptionMany[TaskGroupType.AttestationWarning] = "Attestations for invoices {0} are running late"; } diff --git a/Logic/Financial/CashAdvance.cs b/Logic/Financial/CashAdvance.cs index 0841e4b0..30d256d1 100644 --- a/Logic/Financial/CashAdvance.cs +++ b/Logic/Financial/CashAdvance.cs @@ -45,7 +45,7 @@ namespace Swarmops.Logic.Financial budget.Identity, amountCents, description)); - OutboundComm.CreateNotificationAttestationNeeded (budget, forPerson, string.Empty, amountCents/100.0, + OutboundComm.CreateNotificationApprovalNeeded (budget, forPerson, string.Empty, amountCents/100.0, description, NotificationResource.CashAdvance_Requested); // Slightly misplaced logic, but failsafer here SwarmopsLogEntry.Create (forPerson, @@ -53,36 +53,36 @@ namespace Swarmops.Logic.Financial newAdvance); // Clear a cache - FinancialAccount.ClearAttestationAdjustmentsCache (organization); + FinancialAccount.ClearApprovalAdjustmentsCache (organization); return newAdvance; } #endregion - #region Implementation of IAttestable + #region Implementation of IApprovable - public void Attest (Person attester) + public void Approve (Person approvingPerson) { - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Attestation, - FinancialDependencyType.CashAdvance, Identity, DateTime.UtcNow, attester.Identity, AmountCents/100.0); - SwarmDb.GetDatabaseForWriting().SetCashAdvanceAttested (Identity, true, attester.Identity); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Approval, + FinancialDependencyType.CashAdvance, Identity, DateTime.UtcNow, approvingPerson.Identity, AmountCents/100.0); + SwarmDb.GetDatabaseForWriting().SetCashAdvanceAttested (Identity, true, approvingPerson.Identity); OutboundComm.CreateNotificationOfFinancialValidation (Budget, Person, AmountCents/100.0, Description, - NotificationResource.CashAdvance_Attested); + NotificationResource.CashAdvance_Approved); } - public void Deattest (Person deattester) + public void RetractApproval (Person retractingPerson) { - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Deattestation, - FinancialDependencyType.CashAdvance, Identity, DateTime.UtcNow, deattester.Identity, AmountCents/100.0); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.UndoApproval, + FinancialDependencyType.CashAdvance, Identity, DateTime.UtcNow, retractingPerson.Identity, AmountCents/100.0); SwarmDb.GetDatabaseForWriting().SetCashAdvanceAttested (Identity, false, Person.NobodyId); OutboundComm.CreateNotificationOfFinancialValidation (Budget, Person, AmountCents/100.0, Description, - NotificationResource.CashAdvance_Deattested); + NotificationResource.CashAdvance_ApprovalRetracted); } - public void DenyAttestation (Person denyingPerson, string reason) + public void DenyApproval (Person denyingPerson, string reason) { SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Kill, FinancialDependencyType.CashAdvance, Identity, DateTime.UtcNow, denyingPerson.Identity, AmountCents / 100.0); diff --git a/Logic/Financial/ExpenseClaim.cs b/Logic/Financial/ExpenseClaim.cs index b8726433..6056e8fc 100644 --- a/Logic/Financial/ExpenseClaim.cs +++ b/Logic/Financial/ExpenseClaim.cs @@ -13,7 +13,7 @@ using Swarmops.Logic.Swarm; namespace Swarmops.Logic.Financial { - public class ExpenseClaim : BasicExpenseClaim, IValidatable, IAttestable, IPayable + public class ExpenseClaim : BasicExpenseClaim, IValidatable, IApprovable, IPayable { #region Construction and Creation @@ -101,7 +101,7 @@ namespace Swarmops.Logic.Financial // Create notifications - OutboundComm.CreateNotificationAttestationNeeded(budget, claimer, string.Empty, + OutboundComm.CreateNotificationApprovalNeeded(budget, claimer, string.Empty, newClaim.BudgetAmountCents/100.0, description, NotificationResource.ExpenseClaim_Created); // Slightly misplaced logic, but failsafer here @@ -113,7 +113,7 @@ namespace Swarmops.Logic.Financial vatCents/100.0, budget, description), newClaim); // Clear a cache - FinancialAccount.ClearAttestationAdjustmentsCache(organization); + FinancialAccount.ClearApprovalAdjustmentsCache(organization); } return newClaim; @@ -395,47 +395,47 @@ namespace Swarmops.Logic.Financial NotificationResource.ExpenseClaim_Validated); } - public void Devalidate (Person devalidator) + public void RetractValidation (Person retractor) { SwarmDb.GetDatabaseForWriting().SetExpenseClaimValidated (Identity, false); - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Devalidation, + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.UndoValidation, FinancialDependencyType.ExpenseClaim, Identity, - DateTime.UtcNow, devalidator.Identity, (double) Amount); + DateTime.UtcNow, retractor.Identity, (double) Amount); base.Validated = false; OutboundComm.CreateNotificationOfFinancialValidation (Budget, Claimer, AmountCents/100.0, Description, - NotificationResource.ExpenseClaim_Devalidated); + NotificationResource.ExpenseClaim_ValidationRetracted); } #endregion - #region IAttestable Members + #region IApprovable Members - public void Attest (Person attester) + public void Approve (Person approvingPerson) { Attested = true; - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Approval, FinancialDependencyType.ExpenseClaim, Identity, - DateTime.UtcNow, attester.Identity, (double) Amount); + DateTime.UtcNow, approvingPerson.Identity, (double) Amount); OutboundComm.CreateNotificationOfFinancialValidation (Budget, Claimer, AmountCents/100.0, Description, - NotificationResource.ExpenseClaim_Attested); + NotificationResource.ExpenseClaim_Approved); - UpdateFinancialTransaction(attester); // will re-enable tx if it was zeroed out earlier + UpdateFinancialTransaction(approvingPerson); // will re-enable tx if it was zeroed out earlier } - public void Deattest (Person deattester) + public void RetractApproval (Person retractingPerson) { Attested = false; - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Deattestation, + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.UndoApproval, FinancialDependencyType.ExpenseClaim, Identity, - DateTime.UtcNow, deattester.Identity, (double) Amount); + DateTime.UtcNow, retractingPerson.Identity, (double) Amount); OutboundComm.CreateNotificationOfFinancialValidation (Budget, Claimer, AmountCents/100.0, Description, - NotificationResource.ExpenseClaim_Deattested); + NotificationResource.ExpenseClaim_ApprovalRetracted); } - public void DenyAttestation (Person denyingPerson, string reason) + public void DenyApproval (Person denyingPerson, string reason) { Attested = false; Open = false; @@ -493,7 +493,7 @@ namespace Swarmops.Logic.Financial if (Validated) { // Reset validation, since amount was changed - Devalidate (settingPerson); + RetractValidation (settingPerson); } } diff --git a/Logic/Financial/FinancialAccount.cs b/Logic/Financial/FinancialAccount.cs index b4e445da..67c1e228 100644 --- a/Logic/Financial/FinancialAccount.cs +++ b/Logic/Financial/FinancialAccount.cs @@ -812,7 +812,7 @@ namespace Swarmops.Logic.Financial return result; } - public static void ClearAttestationAdjustmentsCache (Organization organization) + public static void ClearApprovalAdjustmentsCache (Organization organization) { if (_organizationBudgetAttestationSpaceLookup.ContainsKey (organization.Identity)) { diff --git a/Logic/Financial/IApprovable.cs b/Logic/Financial/IApprovable.cs new file mode 100644 index 00000000..78f19702 --- /dev/null +++ b/Logic/Financial/IApprovable.cs @@ -0,0 +1,13 @@ +using Swarmops.Logic.Swarm; + +namespace Swarmops.Logic.Financial +{ + public interface IApprovable + { + FinancialAccount Budget { get; } + void Approve (Person approvingPerson); + void RetractApproval (Person retractingPerson); + + void DenyApproval(Person denyingPerson, string reason); + } +} \ No newline at end of file diff --git a/Logic/Financial/IAttestable.cs b/Logic/Financial/IAttestable.cs deleted file mode 100644 index 56e33bc3..00000000 --- a/Logic/Financial/IAttestable.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Swarmops.Logic.Swarm; - -namespace Swarmops.Logic.Financial -{ - public interface IAttestable - { - FinancialAccount Budget { get; } - void Attest (Person attester); - void Deattest (Person deattester); - - void DenyAttestation(Person denyingPerson, string reason); - } -} \ No newline at end of file diff --git a/Logic/Financial/IPayable.cs b/Logic/Financial/IPayable.cs index 51929075..ec46d7f3 100644 --- a/Logic/Financial/IPayable.cs +++ b/Logic/Financial/IPayable.cs @@ -8,7 +8,7 @@ using Swarmops.Logic.Swarm; namespace Swarmops.Logic.Financial { - public interface IPayable: IAttestable, IHasIdentity + public interface IPayable: IApprovable, IHasIdentity { new FinancialAccount Budget { get; } void SetBudget (FinancialAccount newBudget, Person settingPerson); diff --git a/Logic/Financial/IValidatable.cs b/Logic/Financial/IValidatable.cs index bd7d1a91..5ad9625d 100644 --- a/Logic/Financial/IValidatable.cs +++ b/Logic/Financial/IValidatable.cs @@ -5,6 +5,6 @@ namespace Swarmops.Logic.Financial public interface IValidatable { void Validate (Person validator); - void Devalidate (Person devalidator); + void RetractValidation (Person retractor); } } \ No newline at end of file diff --git a/Logic/Financial/InboundInvoice.cs b/Logic/Financial/InboundInvoice.cs index 7ece6d91..dc17f4f4 100644 --- a/Logic/Financial/InboundInvoice.cs +++ b/Logic/Financial/InboundInvoice.cs @@ -14,7 +14,7 @@ using Swarmops.Logic.Swarm; namespace Swarmops.Logic.Financial { - public class InboundInvoice : BasicInboundInvoice, IAttestable, IPayable + public class InboundInvoice : BasicInboundInvoice, IApprovable, IPayable { private InboundInvoice (BasicInboundInvoice basicInstance) : base (basicInstance) @@ -143,29 +143,29 @@ namespace Swarmops.Logic.Financial } - #region IAttestable Members + #region IApprovable Members - public void Attest (Person attester) + public void Approve (Person approvingPerson) { SwarmDb.GetDatabaseForWriting().SetInboundInvoiceAttested (Identity, true); - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Attestation, + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Approval, FinancialDependencyType.InboundInvoice, Identity, - DateTime.UtcNow, attester.Identity, BudgetAmountCents); + DateTime.UtcNow, approvingPerson.Identity, BudgetAmountCents); base.Attested = true; - UpdateTransaction(attester); // will re-enable the tx if denied and reopened earlier + UpdateTransaction(approvingPerson); // will re-enable the tx if denied and reopened earlier } - public void Deattest (Person deattester) + public void RetractApproval (Person retractingPerson) { SwarmDb.GetDatabaseForWriting().SetInboundInvoiceAttested (Identity, false); - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Deattestation, + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.UndoApproval, FinancialDependencyType.InboundInvoice, Identity, - DateTime.UtcNow, deattester.Identity, BudgetAmountCents); + DateTime.UtcNow, retractingPerson.Identity, BudgetAmountCents); base.Attested = false; } - public void DenyAttestation (Person denyingPerson, string reason) + public void DenyApproval (Person denyingPerson, string reason) { SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Kill, FinancialDependencyType.InboundInvoice, Identity, @@ -232,7 +232,7 @@ namespace Swarmops.Logic.Financial // Create notification (slightly misplaced logic, but this is failsafest place) - OutboundComm.CreateNotificationAttestationNeeded (budget, creatingPerson, supplier, (amountCents-vatCents)/100.0, + OutboundComm.CreateNotificationApprovalNeeded (budget, creatingPerson, supplier, (amountCents-vatCents)/100.0, description, NotificationResource.InboundInvoice_Created); // Slightly misplaced logic, but failsafer here SwarmopsLogEntry.Create (creatingPerson, @@ -240,7 +240,7 @@ namespace Swarmops.Logic.Financial newInvoice); // Clear a cache - FinancialAccount.ClearAttestationAdjustmentsCache(organization); + FinancialAccount.ClearApprovalAdjustmentsCache(organization); return newInvoice; } diff --git a/Logic/Financial/Salary.cs b/Logic/Financial/Salary.cs index a10433bf..f8bbc0b9 100644 --- a/Logic/Financial/Salary.cs +++ b/Logic/Financial/Salary.cs @@ -12,7 +12,7 @@ using Swarmops.Logic.Swarm; namespace Swarmops.Logic.Financial { - public class Salary : BasicSalary, IAttestable + public class Salary : BasicSalary, IApprovable { internal Salary (BasicSalary basic) : base (basic) { @@ -154,23 +154,23 @@ namespace Swarmops.Logic.Financial } - #region IAttestable Members + #region IApprovable Members - public void Attest (Person attester) + public void Approve (Person approvingPerson) { - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Attestation, - FinancialDependencyType.Salary, Identity, DateTime.Now, attester.Identity, CostTotalCents/100.0); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Approval, + FinancialDependencyType.Salary, Identity, DateTime.Now, approvingPerson.Identity, CostTotalCents/100.0); this.Attested = true; } - public void Deattest (Person deattester) + public void RetractApproval (Person retractingPerson) { - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Deattestation, - FinancialDependencyType.Salary, Identity, DateTime.Now, deattester.Identity, CostTotalCents/100.0); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.UndoApproval, + FinancialDependencyType.Salary, Identity, DateTime.Now, retractingPerson.Identity, CostTotalCents/100.0); this.Attested = false; } - public void DenyAttestation (Person denyingPerson, string reason) + public void DenyApproval (Person denyingPerson, string reason) { this.Attested = false; this.Open = false; @@ -188,7 +188,7 @@ namespace Swarmops.Logic.Financial #endregion - public FinancialAccount Budget // needed for IAttestable + public FinancialAccount Budget // needed for IApprovable { get { return PayrollItem.Budget; } } @@ -328,7 +328,7 @@ namespace Swarmops.Logic.Financial } // Clear a cache - FinancialAccount.ClearAttestationAdjustmentsCache(payrollItem.Organization); + FinancialAccount.ClearApprovalAdjustmentsCache(payrollItem.Organization); diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index d934f7ca..baddf9c9 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -304,7 +304,7 @@ - + diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs index 6352b2b7..fc0ed0f1 100644 --- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs +++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs @@ -259,40 +259,40 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to Your requested cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been attested by the budget owner. It will now proceed to payout to you.. - /// - internal static string CashAdvance_Attested_Body { - get { - return ResourceManager.GetString("CashAdvance_Attested_Body", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to [[OrganizationName]] Cash Advance Attested: [CurrencyCode] [BudgetAmountFloat]. - /// - internal static string CashAdvance_Attested_Subject { - get { - return ResourceManager.GetString("CashAdvance_Attested_Subject", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Your requested cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been DE-attested by the budget owner. This usually indicates some sort of problem with your request. + /// Looks up a localized string similar to Your previously approved cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has had its approval RETRACTED by the budget owner. This cash advance is no longer approved. This usually indicates some sort of problem with your request. /// ///Expect more communication from the budget owner to follow on the matter.. /// - internal static string CashAdvance_Deattested_Body { + internal static string CashAdvance_ApprovalRetracted_Body { get { - return ResourceManager.GetString("CashAdvance_Deattested_Body", resourceCulture); + return ResourceManager.GetString("CashAdvance_ApprovalRetracted_Body", resourceCulture); } } /// - /// Looks up a localized string similar to [[OrganizationName]] Cash Advance DE-attested: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Approval for Cash Advance RETRACTED: [CurrencyCode] [BudgetAmountFloat]. /// - internal static string CashAdvance_Deattested_Subject { + internal static string CashAdvance_ApprovalRetracted_Subject { get { - return ResourceManager.GetString("CashAdvance_Deattested_Subject", resourceCulture); + return ResourceManager.GetString("CashAdvance_ApprovalRetracted_Subject", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your requested cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been attested by the budget owner. It will now proceed to payout to you.. + /// + internal static string CashAdvance_Approved_Body { + get { + return ResourceManager.GetString("CashAdvance_Approved_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [[OrganizationName]] Cash Advance Approveed: [CurrencyCode] [BudgetAmountFloat]. + /// + internal static string CashAdvance_Approved_Subject { + get { + return ResourceManager.GetString("CashAdvance_Approved_Subject", resourceCulture); } } @@ -340,7 +340,7 @@ namespace Swarmops.Logic.Resources { /// /// Looks up a localized string similar to [ConcernedPersonName] has requested a cash advance of [CurrencyCode] [BudgetAmountFloat] for the purpose of [RequestPurpose]. This money is part of your budget, [BudgetName]. /// - ///Please log on to [InstallationName] at [ExternalUrl]Financial/AttestCosts to attest or deny.. + ///Please log on to [InstallationName] at [ExternalUrl]Financial/ApproveCosts to attest or deny.. /// internal static string CashAdvance_Requested_Body { get { @@ -349,7 +349,7 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to [[OrganizationName] - ACTION ITEM] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed. + /// Looks up a localized string similar to [[OrganizationName] - ACTION ITEM] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Approveation Needed. /// internal static string CashAdvance_Requested_Subject { get { @@ -358,27 +358,47 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been attested by the budget owner. It will be paid out to you when the receipts are confirmed valid.. + /// Looks up a localized string similar to Your previously approved expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has had its approval RETRACTED by the budget owner. This expense claim is no longer approved. This usually indicates some sort of problem with your expense claim. + /// + ///Expect more communication from the budget owner to follow on the matter.. /// - internal static string ExpenseClaim_Attested_Body { + internal static string ExpenseClaim_ApprovalRetracted_Body { get { - return ResourceManager.GetString("ExpenseClaim_Attested_Body", resourceCulture); + return ResourceManager.GetString("ExpenseClaim_ApprovalRetracted_Body", resourceCulture); } } /// - /// Looks up a localized string similar to [[OrganizationName]] Expense Claim Attested: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Approval for Expense Claim RETRACTED: [CurrencyCode] [BudgetAmountFloat]. /// - internal static string ExpenseClaim_Attested_Subject { + internal static string ExpenseClaim_ApprovalRetracted_Subject { get { - return ResourceManager.GetString("ExpenseClaim_Attested_Subject", resourceCulture); + return ResourceManager.GetString("ExpenseClaim_ApprovalRetracted_Subject", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been attested by the budget owner. It will be paid out to you when the receipts are confirmed valid.. + /// + internal static string ExpenseClaim_Approved_Body { + get { + return ResourceManager.GetString("ExpenseClaim_Approved_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [[OrganizationName]] Expense Claim Approveed: [CurrencyCode] [BudgetAmountFloat]. + /// + internal static string ExpenseClaim_Approved_Subject { + get { + return ResourceManager.GetString("ExpenseClaim_Approved_Subject", resourceCulture); } } /// /// Looks up a localized string similar to [ConcernedPersonName] has created an expense claim against the budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. The claim concerns [RequestPurpose]. You will need to attest this expense claim. /// - ///Please log on to [InstallationName] at [ExternalUrl]Financial/AttestCosts to attest or deny.. + ///Please log on to [InstallationName] at [ExternalUrl]Financial/ApproveCosts to attest or deny.. /// internal static string ExpenseClaim_Created_Body { get { @@ -387,7 +407,7 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to [[OrganizationName] - ACTION ITEM] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed. + /// Looks up a localized string similar to [[OrganizationName] - ACTION ITEM] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Approveation Needed. /// internal static string ExpenseClaim_Created_Subject { get { @@ -395,26 +415,6 @@ namespace Swarmops.Logic.Resources { } } - /// - /// Looks up a localized string similar to Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been DE-attested by the budget owner. This usually indicates some sort of problem with your expense claim. - /// - ///Expect more communication from the budget owner to follow on the matter.. - /// - internal static string ExpenseClaim_Deattested_Body { - get { - return ResourceManager.GetString("ExpenseClaim_Deattested_Body", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to [[OrganizationName]] Expense Claim DE-attested: [CurrencyCode] [BudgetAmountFloat]. - /// - internal static string ExpenseClaim_Deattested_Subject { - get { - return ResourceManager.GetString("ExpenseClaim_Deattested_Subject", resourceCulture); - } - } - /// /// Looks up a localized string similar to Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat] concerning [RequestPurpose] has been denied. The text below was given as reason for denying it: /// @@ -436,26 +436,6 @@ namespace Swarmops.Logic.Resources { } } - /// - /// Looks up a localized string similar to The receipts for your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], have been DE-validated by the financial record keepers of the organization. This usually indicates some sort of problem with the documentation of your expense claim. - /// - ///Expect more communication to follow on the matter. If you don't hear from record keepers in short time on this matter, do follow up with them.. - /// - internal static string ExpenseClaim_Devalidated_Body { - get { - return ResourceManager.GetString("ExpenseClaim_Devalidated_Body", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to [[OrganizationName]] Expense Claim Receipts DE-validated: [CurrencyCode] [BudgetAmountFloat]. - /// - internal static string ExpenseClaim_Devalidated_Subject { - get { - return ResourceManager.GetString("ExpenseClaim_Devalidated_Subject", resourceCulture); - } - } - /// /// Looks up a localized string similar to Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been marked as paid out by the organization's accountants. /// @@ -496,10 +476,30 @@ namespace Swarmops.Logic.Resources { } } + /// + /// Looks up a localized string similar to The validation of receipts for your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been RETRACTED by the financial record keepers of the organization. The receipts are no longer considered valid. This usually indicates some sort of problem with the documentation of your expense claim. + /// + ///Expect more communication to follow on the matter. If you don't hear from record keepers in short time on this matter, do follow up with them.. + /// + internal static string ExpenseClaim_ValidationRetracted_Body { + get { + return ResourceManager.GetString("ExpenseClaim_ValidationRetracted_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [[OrganizationName]] Validation for Expense Claim Receipts RETRACTED: [CurrencyCode] [BudgetAmountFloat]. + /// + internal static string ExpenseClaim_ValidationRetracted_Subject { + get { + return ResourceManager.GetString("ExpenseClaim_ValidationRetracted_Subject", resourceCulture); + } + } + /// /// Looks up a localized string similar to An invoice from [Supplier], concerning [Description], has been filed against your budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. You must attest this invoice before it proceeds to payout. /// - ///Please log on to [InstallationName] at [ExternalUrl]Financial/AttestCosts to attest or deny.. + ///Please log on to [InstallationName] at [ExternalUrl]Financial/ApproveCosts to attest or deny.. /// internal static string InboundInvoice_Created_Body { get { @@ -508,7 +508,7 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to [[OrganizationName] - ACTION ITEM] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed. + /// Looks up a localized string similar to [[OrganizationName] - ACTION ITEM] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Approveation Needed. /// internal static string InboundInvoice_Created_Subject { get { diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx index 9c4c7cb7..48ab166f 100644 --- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx +++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx @@ -195,19 +195,19 @@ Swarmops will keep trying and will keep sending these notifications as long as i [[OrganizationName] - ACTION ITEM] Bitcoin Cash hotwallet insufficient for payments - top up immediately - - Your requested cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been attested by the budget owner. It will now proceed to payout to you. - - - [[OrganizationName]] Cash Advance Attested: [CurrencyCode] [BudgetAmountFloat] - - - Your requested cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been DE-attested by the budget owner. This usually indicates some sort of problem with your request. + + Your previously approved cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has had its approval RETRACTED by the budget owner. This cash advance is no longer approved. This usually indicates some sort of problem with your request. Expect more communication from the budget owner to follow on the matter. - - [[OrganizationName]] Cash Advance DE-attested: [CurrencyCode] [BudgetAmountFloat] + + [[OrganizationName]] Approval for Cash Advance RETRACTED: [CurrencyCode] [BudgetAmountFloat] + + + Your requested cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been attested by the budget owner. It will now proceed to payout to you. + + + [[OrganizationName]] Cash Advance Approveed: [CurrencyCode] [BudgetAmountFloat] Your cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat] concerning [RequestPurpose] has been denied. The text below was given as reason for denying it: @@ -229,38 +229,38 @@ This means you should see the amount on your account shortly. [ConcernedPersonName] has requested a cash advance of [CurrencyCode] [BudgetAmountFloat] for the purpose of [RequestPurpose]. This money is part of your budget, [BudgetName]. -Please log on to [InstallationName] at [ExternalUrl]Financial/AttestCosts to attest or deny. +Please log on to [InstallationName] at [ExternalUrl]Financial/ApproveCosts to attest or deny. This is sent to the budget owner(s) only. - [[OrganizationName] - ACTION ITEM] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed + [[OrganizationName] - ACTION ITEM] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Approveation Needed ACTION ITEM should be translated. - - Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been attested by the budget owner. It will be paid out to you when the receipts are confirmed valid. - This is sent to the claimer. - - - [[OrganizationName]] Expense Claim Attested: [CurrencyCode] [BudgetAmountFloat] - - - [ConcernedPersonName] has created an expense claim against the budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. The claim concerns [RequestPurpose]. You will need to attest this expense claim. - -Please log on to [InstallationName] at [ExternalUrl]Financial/AttestCosts to attest or deny. - This is sent to the budget owner(s)only. - - - [[OrganizationName] - ACTION ITEM] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed - ACTION ITEM should be translated. - - - Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been DE-attested by the budget owner. This usually indicates some sort of problem with your expense claim. + + Your previously approved expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has had its approval RETRACTED by the budget owner. This expense claim is no longer approved. This usually indicates some sort of problem with your expense claim. Expect more communication from the budget owner to follow on the matter. This is sent to the claimer. - - [[OrganizationName]] Expense Claim DE-attested: [CurrencyCode] [BudgetAmountFloat] + + [[OrganizationName]] Approval for Expense Claim RETRACTED: [CurrencyCode] [BudgetAmountFloat] + + + Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been attested by the budget owner. It will be paid out to you when the receipts are confirmed valid. + This is sent to the claimer. + + + [[OrganizationName]] Expense Claim Approveed: [CurrencyCode] [BudgetAmountFloat] + + + [ConcernedPersonName] has created an expense claim against the budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. The claim concerns [RequestPurpose]. You will need to attest this expense claim. + +Please log on to [InstallationName] at [ExternalUrl]Financial/ApproveCosts to attest or deny. + This is sent to the budget owner(s)only. + + + [[OrganizationName] - ACTION ITEM] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Approveation Needed + ACTION ITEM should be translated. Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat] concerning [RequestPurpose] has been denied. The text below was given as reason for denying it: @@ -272,14 +272,6 @@ Expect more communication from the budget owner to follow on the matter. [[OrganizationName]] Expense Claim DENIED: [CurrencyCode] [BudgetAmountFloat] - - The receipts for your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], have been DE-validated by the financial record keepers of the organization. This usually indicates some sort of problem with the documentation of your expense claim. - -Expect more communication to follow on the matter. If you don't hear from record keepers in short time on this matter, do follow up with them. - - - [[OrganizationName]] Expense Claim Receipts DE-validated: [CurrencyCode] [BudgetAmountFloat] - Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been marked as paid out by the organization's accountants. @@ -297,13 +289,21 @@ The claim will be paid out to you when the amount has also been attested by the [[OrganizationName]] Expense Claim Receipts Validated: [CurrencyCode] [BudgetAmountFloat] + + The validation of receipts for your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been RETRACTED by the financial record keepers of the organization. The receipts are no longer considered valid. This usually indicates some sort of problem with the documentation of your expense claim. + +Expect more communication to follow on the matter. If you don't hear from record keepers in short time on this matter, do follow up with them. + + + [[OrganizationName]] Validation for Expense Claim Receipts RETRACTED: [CurrencyCode] [BudgetAmountFloat] + An invoice from [Supplier], concerning [Description], has been filed against your budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. You must attest this invoice before it proceeds to payout. -Please log on to [InstallationName] at [ExternalUrl]Financial/AttestCosts to attest or deny. +Please log on to [InstallationName] at [ExternalUrl]Financial/ApproveCosts to attest or deny. - [[OrganizationName] - ACTION ITEM] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed + [[OrganizationName] - ACTION ITEM] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Approveation Needed ACTION ITEM should be translated. diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.sv-SE.resx b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.sv-SE.resx index 8ead9cb4..774a047e 100644 --- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.sv-SE.resx +++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.sv-SE.resx @@ -181,7 +181,7 @@ Det betyder att du borde se beloppet på ditt konto inom kort. [ConcernedPersonName] har begärt ett kontantförskott på [CurrencyCode] [BudgetAmountFloat] för [RequestPurpose]. Dessa pengar är en del av din budget, [BudgetName]. -Vänligen logga in på [InstallationName] på [ExternalUrl]Financial/AttestCosts att attestera eller neka. +Vänligen logga in på [InstallationName] på [ExternalUrl]Financial/ApproveCosts att attestera eller neka. This is sent to the budget owner(s) only. @@ -198,7 +198,7 @@ Vänligen logga in på [InstallationName] på [ExternalUrl]Financial/AttestCosts [ConcernedPersonName] har lagt ett utläggsanspråk mot budgeten [BudgetName] på [CurrencyCode] [BudgetAmountFloat]. Anspråket gäller [RequestPurpose]. Det betalas bara ut om du attesterar kostnaden. -Logga in på [InstallationName] på [ExternalUrl]Financial/AttestCosts för att attestera eller neka anspråket. +Logga in på [InstallationName] på [ExternalUrl]Financial/ApproveCosts för att attestera eller neka anspråket. This is sent to the budget owner(s)only. @@ -252,7 +252,7 @@ Utläggsanspråket kommer att betalas ut till dig när beloppet också är attes En faktura från [Supplier] gällande [Description] har inkommit mot din budget [BudgetName]. Fakturan är på [CurrencyCode] [BudgetAmountFloat]. Du måste attestera fakturan innan den går till betalning. -Logga in på [InstallationName] på [ExternalUrl]Financial/AttestCosts för att attestera eller neka fakturan. +Logga in på [InstallationName] på [ExternalUrl]Financial/ApproveCosts för att attestera eller neka fakturan. [[OrganizationName] - ÅTGÄRD KRÄVS] Faktura mottagen: [CurrencyCode] [BudgetAmountFloat] - attest behövs diff --git a/Logic/Resources/Logic.Swarm.DashboardTodos.Designer.cs b/Logic/Resources/Logic.Swarm.DashboardTodos.Designer.cs index 3e9e28e7..1aea36fd 100644 --- a/Logic/Resources/Logic.Swarm.DashboardTodos.Designer.cs +++ b/Logic/Resources/Logic.Swarm.DashboardTodos.Designer.cs @@ -61,7 +61,7 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to Attest cash advances {0}. + /// Looks up a localized string similar to Approve cash advances {0}. /// internal static string Attest_CashAdvance_Many { get { @@ -70,7 +70,7 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to Attest cash advance #{0}. + /// Looks up a localized string similar to Approve cash advance #{0}. /// internal static string Attest_CashAdvance_One { get { @@ -79,7 +79,7 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to Attest expense claims {0}. + /// Looks up a localized string similar to Approve expense claims {0}. /// internal static string Attest_ExpenseClaim_Many { get { @@ -88,7 +88,7 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to Attest expense claim #{0}. + /// Looks up a localized string similar to Approve expense claim #{0}. /// internal static string Attest_ExpenseClaim_One { get { diff --git a/Logic/Resources/Logic.Swarm.DashboardTodos.resx b/Logic/Resources/Logic.Swarm.DashboardTodos.resx index 905de795..cb8f253c 100644 --- a/Logic/Resources/Logic.Swarm.DashboardTodos.resx +++ b/Logic/Resources/Logic.Swarm.DashboardTodos.resx @@ -118,16 +118,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Attest cash advances {0} + Approve cash advances {0} - Attest cash advance #{0} + Approve cash advance #{0} - Attest expense claims {0} + Approve expense claims {0} - Attest expense claim #{0} + Approve expense claim #{0} Set Bitcoin Cash payout address diff --git a/Logic/Swarm/Parley.cs b/Logic/Swarm/Parley.cs index 2f249d6b..88e45583 100644 --- a/Logic/Swarm/Parley.cs +++ b/Logic/Swarm/Parley.cs @@ -9,7 +9,7 @@ using Swarmops.Logic.Support; namespace Swarmops.Logic.Swarm { - public class Parley : BasicParley, IAttestable + public class Parley : BasicParley, IApprovable { private Parley (BasicParley basic) : base (basic) { @@ -87,7 +87,7 @@ namespace Swarmops.Logic.Swarm foreach (BasicFinancialValidation validation in validations) { - if (validation.ValidationType == FinancialValidationType.Attestation) + if (validation.ValidationType == FinancialValidationType.Approval) { return true; } @@ -97,7 +97,7 @@ namespace Swarmops.Logic.Swarm } } - #region Implementation of IAttestable + #region Implementation of IApprovable public FinancialAccount ParentBudget { @@ -113,7 +113,7 @@ namespace Swarmops.Logic.Swarm } } - public void Attest (Person attester) + public void Approve (Person approvingPerson) { if (Attested) { @@ -163,37 +163,37 @@ namespace Swarmops.Logic.Swarm FinancialTransaction guaranteeFundsTx = FinancialTransaction.Create (OrganizationId, DateTime.Now, "Conference #" + Identity + " Guarantee"); - guaranteeFundsTx.AddRow (Budget, -GuaranteeCents, attester); - guaranteeFundsTx.AddRow (Budget.Parent, GuaranteeCents, attester); + guaranteeFundsTx.AddRow (Budget, -GuaranteeCents, approvingPerson); + guaranteeFundsTx.AddRow (Budget.Parent, GuaranteeCents, approvingPerson); // Finally, set as attested PWEvents.CreateEvent ( - EventSource.PirateWeb, EventType.ParleyAttested, attester.Identity, + EventSource.PirateWeb, EventType.ParleyAttested, approvingPerson.Identity, OrganizationId, 0, 0, Identity, string.Empty); base.Attested = true; SwarmDb.GetDatabaseForWriting().SetParleyAttested (Identity, true); - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Attestation, + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation (FinancialValidationType.Approval, FinancialDependencyType.Parley, Identity, - DateTime.Now, attester.Identity, (double) (GuaranteeDecimal)); + DateTime.Now, approvingPerson.Identity, (double) (GuaranteeDecimal)); } - public void Deattest (Person deattester) + public void RetractApproval (Person retractingPerson) { throw new NotImplementedException(); /* base.Attested = false; - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Deattestation, + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.RetractApproval, FinancialDependencyType.Parley, this.Identity, - DateTime.Now, deattester.Identity, (double)(this.GuaranteeDecimal+this.BudgetDecimal));*/ + DateTime.Now, retractingPerson.Identity, (double)(this.GuaranteeDecimal+this.BudgetDecimal));*/ // TODO: Remove budget, remove financial account, set unattested // this.BudgetId = this.Budget.ParentIdentity; } - public void DenyAttestation (Person denyingPerson, string denyReason) + public void DenyApproval (Person denyingPerson, string denyReason) { // Re-implement if and when parleys are resurrected diff --git a/Logic/Swarm/Parleys.cs b/Logic/Swarm/Parleys.cs index 7ac6cacb..3416ea8c 100644 --- a/Logic/Swarm/Parleys.cs +++ b/Logic/Swarm/Parleys.cs @@ -8,7 +8,7 @@ namespace Swarmops.Logic.Swarm { public class Parleys : PluralBase { - public Parleys WhereUnattested + public Parleys WhereNotApproved { get { diff --git a/Site/App_GlobalResources/Menu5.designer.cs b/Site/App_GlobalResources/Menu5.designer.cs index 4eaa0d6b..30f46965 100644 --- a/Site/App_GlobalResources/Menu5.designer.cs +++ b/Site/App_GlobalResources/Menu5.designer.cs @@ -340,7 +340,7 @@ namespace Resources { } /// - /// Looks up a localized string similar to Attest Costs. + /// Looks up a localized string similar to Approve Costs. /// internal static string Menu5_Financial_AttestCosts { get { diff --git a/Site/App_GlobalResources/Menu5.resx b/Site/App_GlobalResources/Menu5.resx index 8d5f55ba..863410c2 100644 --- a/Site/App_GlobalResources/Menu5.resx +++ b/Site/App_GlobalResources/Menu5.resx @@ -181,7 +181,8 @@ Financial - Attest Costs + Approve Costs + This approves costs for payout from the organization Claim Refund for Expense diff --git a/Site/App_GlobalResources/Pages.Financial.designer.cs b/Site/App_GlobalResources/Pages.Financial.designer.cs index 3bc9c2a4..60c03f92 100644 --- a/Site/App_GlobalResources/Pages.Financial.designer.cs +++ b/Site/App_GlobalResources/Pages.Financial.designer.cs @@ -61,7 +61,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Cash Advance #{0:N0} for {1} has been attested for {3:N2}.. + /// Looks up a localized string similar to Cash Advance #{0:N0} for {1} has been approved for {3:N2}.. /// internal static string AttestCosts_AdvanceAttested { get { @@ -70,7 +70,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Cash Advance #{0:N0} for {1} was UN-attested. It will not be paid out unless attested again.. + /// Looks up a localized string similar to The approval for Cash Advance #{0:N0} for {1} was RETRACTED. It will not be paid out unless approved again.. /// internal static string AttestCosts_AdvanceDeattested { get { @@ -79,7 +79,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to You cannot attest this amount. The budget is empty for the year {0}.. + /// Looks up a localized string similar to You cannot approve this amount. The budget is empty for the year {0}.. /// internal static string AttestCosts_BudgetIsEmpty { get { @@ -88,7 +88,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to You cannot attest a negative amount.. + /// Looks up a localized string similar to You cannot approve a negative amount.. /// internal static string AttestCosts_CannotAttestNegative { get { @@ -97,7 +97,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to You cannot attest a zero amount.. + /// Looks up a localized string similar to You cannot approve a zero amount.. /// internal static string AttestCosts_CannotAttestZero { get { @@ -133,7 +133,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Expense Claim #{0:N0} from {1} for {2} {3:N2} has been attested.. + /// Looks up a localized string similar to Expense Claim #{0:N0} from {1} for {2} {3:N2} has been approved.. /// internal static string AttestCosts_ExpenseAttested { get { @@ -142,7 +142,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Expense Claim #{0:N0} from {1} was DE-attested. It will not be paid out unless attested again.. + /// Looks up a localized string similar to Approval for Expense Claim #{0:N0} from {1} was RETRACTED. It will not be paid unless approved again.. /// internal static string AttestCosts_ExpenseDeattested { get { @@ -214,7 +214,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Costs waiting for your attestation. + /// Looks up a localized string similar to Costs waiting for your approval. /// internal static string AttestCosts_Header_CostsAwaitingAttestation { get { @@ -223,7 +223,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to This is where you attest costs that other people are requesting from your budgets. Nothing is paid before you have attested it.. + /// Looks up a localized string similar to This is where you approve costs that other people are requesting from your budgets. Nothing is paid before you have approved it.. /// internal static string AttestCosts_Info { get { @@ -232,7 +232,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Invoice #{0:N0} from {1} for {2} {3:N2} has been attested.. + /// Looks up a localized string similar to Invoice #{0:N0} from {1} for {2} {3:N2} has been approved.. /// internal static string AttestCosts_InvoiceAttested { get { @@ -241,7 +241,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Invoice #{0:N0} from {1} was UN-attested. It will not be paid unless attested again.. + /// Looks up a localized string similar to Approval for Invoice #{0:N0} from {1} was RETRACTED. It will not be paid unless approved again.. /// internal static string AttestCosts_InvoiceDeattested { get { @@ -250,7 +250,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Attest. + /// Looks up a localized string similar to Approve. /// internal static string AttestCosts_Modal_ButtonAmount { get { @@ -259,7 +259,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Attest. + /// Looks up a localized string similar to Approve. /// internal static string AttestCosts_Modal_ButtonCorrect { get { @@ -340,7 +340,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Fix problems or deny attestation. + /// Looks up a localized string similar to Fix problems or deny approval. /// internal static string AttestCosts_Modal_Header { get { @@ -349,7 +349,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to I will attest this, but for a different amount.. + /// Looks up a localized string similar to I will approve this, but for a different amount.. /// internal static string AttestCosts_Modal_RadioOptionAmount { get { @@ -358,7 +358,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to The amount is wrong. I will attest it with the correct amount.. + /// Looks up a localized string similar to The amount is wrong. I will approve it for the correct amount.. /// internal static string AttestCosts_Modal_RadioOptionCorrect { get { @@ -367,7 +367,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to I will not attest this record. It is scratched.. + /// Looks up a localized string similar to I will not approve this record. It is scratched.. /// internal static string AttestCosts_Modal_RadioOptionDeny { get { @@ -394,7 +394,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to There are not enough funds remaining in the budget to attest this cost.. + /// Looks up a localized string similar to There are not enough funds remaining in the budget to approve this cost.. /// internal static string AttestCosts_OutOfBudget { get { @@ -403,7 +403,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to There are not enough funds to attest this. You can attest up to {0} {1:N2} more in this budget for the year {2}.. + /// Looks up a localized string similar to There are not enough funds to approve this. You can attest up to {0} {1:N2} more in this budget for the year {2}.. /// internal static string AttestCosts_OutOfBudgetPrecise { get { @@ -412,7 +412,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to <strong>OVERDRAFT BUDGET?</strong><br/><br/>There are not enough funds remaining in the budget to attest this expense. Normally, it would be blocked from attestation. However, you may override this limitation and attest anyway, thereby causing the account to overdraft its budget.<br/><br/>Do you want to attest the expense, thereby forcing an overdraft, or do you want to cancel attestation, staying on budget instead?<br/><br/>. + /// Looks up a localized string similar to <strong>OVERDRAFT BUDGET?</strong><br/><br/>There are not enough funds remaining in the budget to approve this expense. Normally, it would be blocked from approval. However, you may override this limitation and attest anyway, thereby causing the account to overdraft its budget.<br/><br/>Do you want to approve the expense, thereby forcing an overdraft, or do you want to cancel, staying on budget instead?<br/><br/>. /// internal static string AttestCosts_OverdraftConfirm { get { @@ -448,7 +448,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Attest Costs. + /// Looks up a localized string similar to Approve Costs. /// internal static string AttestCosts_PageTitle { get { @@ -457,7 +457,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Conference #{0:N0}, arranged by {1}, has been attested for {3:N2}.. + /// Looks up a localized string similar to Conference #{0:N0}, arranged by {1}, has been approved for {3:N2}.. /// internal static string AttestCosts_ParleyAttested { get { @@ -466,7 +466,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Conference #{0:N0} by {1} was UN-attested. It will not be greenlighted unless attested again.. + /// Looks up a localized string similar to Approval for Conference #{0:N0} by {1} was RETRACTED. It will not be greenlighted unless approved again.. /// internal static string AttestCosts_ParleyDeattested { get { @@ -484,7 +484,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Salary #{0:N0} for {1} was DE-attested. It will not be paid out unless attested again.. + /// Looks up a localized string similar to Approval for Salary #{0:N0} for {1} was RETRACTED. It will not be paid out unless approved again.. /// internal static string AttestCosts_SalaryDeattested { get { @@ -493,7 +493,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to <strong>WARNING: UNINITIALIZED BUDGET</strong><br/><br/>The cost you're approving belongs to an uninitialized budget -- an account in the ledger that lacks owner and doesn't have a set budget allowance for the year. Consider visiting the Account Plan and allocating budgets for the expected revenue and expenses.<br/><br/>This message will only display once per visit to Attestations.<br/>. + /// Looks up a localized string similar to <strong>WARNING: BUDGET NOT SET</strong><br/><br/>The cost you're approving belongs to an account in the ledger that lacks owner and doesn't have a defined budget allowance for the year. Consider visiting the Chart of Accounts and allocating budgets for the expected revenue and expenses.<br/><br/>This message will only display once per visit to Cost Approvals.<br/>. /// internal static string AttestCosts_Warn_UninitializedBudget { get { @@ -1699,7 +1699,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to The receipts for Expense Claim #{0:N0} for {1} {2:N2} have been DE-validated. The expense claim will not proceed to payout unless re-validated.. + /// Looks up a localized string similar to Validation for receipts for Expense Claim #{0:N0} for {1} {2:N2} was RETRACTED. The expense claim will not proceed to payout unless re-validated.. /// internal static string ValidateReceipts_ReceiptsDevalidated { get { diff --git a/Site/App_GlobalResources/Pages.Financial.resx b/Site/App_GlobalResources/Pages.Financial.resx index f6f44fb6..4d7c3255 100644 --- a/Site/App_GlobalResources/Pages.Financial.resx +++ b/Site/App_GlobalResources/Pages.Financial.resx @@ -118,21 +118,21 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Cash Advance #{0:N0} for {1} has been attested for {3:N2}. + Cash Advance #{0:N0} for {1} has been approved for {3:N2}. Status message. - Cash Advance #{0:N0} for {1} was UN-attested. It will not be paid out unless attested again. - When somebody undoes a previous attestation. + The approval for Cash Advance #{0:N0} for {1} was RETRACTED. It will not be paid out unless approved again. + When somebody undoes a previous approval. - You cannot attest this amount. The budget is empty for the year {0}. + You cannot approve this amount. The budget is empty for the year {0}. - You cannot attest a negative amount. + You cannot approve a negative amount. - You cannot attest a zero amount. + You cannot approve a zero amount. Sorry, you cannot rebudget a salary payout. @@ -144,13 +144,9 @@ Please select a budget to retarget the charge for. - Expense Claim #{0:N0} from {1} for {2} {3:N2} has been attested. + Expense Claim #{0:N0} from {1} for {2} {3:N2} has been approved. {2} is the currency. - - Expense Claim #{0:N0} from {1} was DE-attested. It will not be paid out unless attested again. - When somebody undoes a previous attestation. - Action Yes / No buttons. Keep short! @@ -178,25 +174,25 @@ Header for the requested amount. - Costs waiting for your attestation + Costs waiting for your approval - This is where you attest costs that other people are requesting from your budgets. Nothing is paid before you have attested it. + This is where you approve costs that other people are requesting from your budgets. Nothing is paid before you have approved it. - Invoice #{0:N0} from {1} for {2} {3:N2} has been attested. + Invoice #{0:N0} from {1} for {2} {3:N2} has been approved. {2} is the currency. - Invoice #{0:N0} from {1} was UN-attested. It will not be paid unless attested again. - When somebody undoes a previous attestation. + Approval for Invoice #{0:N0} from {1} was RETRACTED. It will not be paid unless approved again. + When somebody undoes a previous approval. - Attest + Approve keep short - Attest + Approve Deny @@ -224,16 +220,16 @@ Move the charge to this budget instead: - Fix problems or deny attestation + Fix problems or deny approval - I will attest this, but for a different amount. + I will approve this, but for a different amount. - The amount is wrong. I will attest it with the correct amount. + The amount is wrong. I will approve it for the correct amount. - I will not attest this record. It is scratched. + I will not approve this record. It is scratched. This is a Monty Python reference. When translating, translate to "Deny attestation of this record altogether." @@ -243,14 +239,14 @@ What seems to be the problem with this record? - There are not enough funds remaining in the budget to attest this cost. + There are not enough funds remaining in the budget to approve this cost. - There are not enough funds to attest this. You can attest up to {0} {1:N2} more in this budget for the year {2}. + There are not enough funds to approve this. You can attest up to {0} {1:N2} more in this budget for the year {2}. The {0} is the currency and the {1} is the remaining budget. The {2} is the current year. - <strong>OVERDRAFT BUDGET?</strong><br/><br/>There are not enough funds remaining in the budget to attest this expense. Normally, it would be blocked from attestation. However, you may override this limitation and attest anyway, thereby causing the account to overdraft its budget.<br/><br/>Do you want to attest the expense, thereby forcing an overdraft, or do you want to cancel attestation, staying on budget instead?<br/><br/> + <strong>OVERDRAFT BUDGET?</strong><br/><br/>There are not enough funds remaining in the budget to approve this expense. Normally, it would be blocked from approval. However, you may override this limitation and attest anyway, thereby causing the account to overdraft its budget.<br/><br/>Do you want to approve the expense, thereby forcing an overdraft, or do you want to cancel, staying on budget instead?<br/><br/> Stay on Budget @@ -263,24 +259,24 @@ The UPPERCASE is intentional. - Attest Costs + Approve Costs - Conference #{0:N0}, arranged by {1}, has been attested for {3:N2}. + Conference #{0:N0}, arranged by {1}, has been approved for {3:N2}. - Conference #{0:N0} by {1} was UN-attested. It will not be greenlighted unless attested again. - When somebody undoes a previous attestation. + Approval for Conference #{0:N0} by {1} was RETRACTED. It will not be greenlighted unless approved again. + When somebody undoes a previous approval. Salary #{0:N0} for {1} was attested for {3:N2}. - Salary #{0:N0} for {1} was DE-attested. It will not be paid out unless attested again. - When somebody undoes a previous attestation. + Approval for Salary #{0:N0} for {1} was RETRACTED. It will not be paid out unless approved again. + When somebody undoes a previous approval. - <strong>WARNING: UNINITIALIZED BUDGET</strong><br/><br/>The cost you're approving belongs to an uninitialized budget -- an account in the ledger that lacks owner and doesn't have a set budget allowance for the year. Consider visiting the Account Plan and allocating budgets for the expected revenue and expenses.<br/><br/>This message will only display once per visit to Attestations.<br/> + <strong>WARNING: BUDGET NOT SET</strong><br/><br/>The cost you're approving belongs to an account in the ledger that lacks owner and doesn't have a defined budget allowance for the year. Consider visiting the Chart of Accounts and allocating budgets for the expected revenue and expenses.<br/><br/>This message will only display once per visit to Cost Approvals.<br/> Invoice amount total (in {0}) @@ -580,7 +576,7 @@ Validate Receipts - The receipts for Expense Claim #{0:N0} for {1} {2:N2} have been DE-validated. The expense claim will not proceed to payout unless re-validated. + Validation for receipts for Expense Claim #{0:N0} for {1} {2:N2} was RETRACTED. The expense claim will not proceed to payout unless re-validated. The receipts for Expense Claim #{0:N0} for {1} {2:N2} have been validated. @@ -731,4 +727,8 @@ Successfully filed {0} claims. + + Approval for Expense Claim #{0:N0} from {1} was RETRACTED. It will not be paid unless approved again. + When somebody undoes a previous attestation. + \ No newline at end of file diff --git a/Site/App_GlobalResources/fr-FR/Pages.Financial.fr-FR.resx b/Site/App_GlobalResources/fr-FR/Pages.Financial.fr-FR.resx index ae4398f8..b7cdeeff 100644 --- a/Site/App_GlobalResources/fr-FR/Pages.Financial.fr-FR.resx +++ b/Site/App_GlobalResources/fr-FR/Pages.Financial.fr-FR.resx @@ -280,7 +280,7 @@ When somebody undoes a previous attestation. - <strong>AVERTISSEMENT: BUDGET NON INITIALISÉ</strong><br/><br/>Le coût que vous approuvez appartient à un budget non initialisé -- un compte dans le grand livre qui manque de propriétaire et qui ne dispose pas d'une allocation budgétaire définie pour l'année. Envisagez de consulter le plan du compte et d’allouer des budgets aux revenus et aux dépenses prévues.<br/><br/> Ce message ne s'affiche qu'une fois par visite dans Attestations.<br/> + <strong>AVERTISSEMENT: BUDGET NON INITIALISÉ</strong><br/><br/>Le coût que vous approuvez appartient à un budget non initialisé -- un compte dans le grand livre qui manque de propriétaire et qui ne dispose pas d'une allocation budgétaire définie pour l'année. Envisagez de consulter le plan du compte et d’allouer des budgets aux revenus et aux dépenses prévues.<br/><br/> Ce message ne s'affiche qu'une fois par visite dans Approvals.<br/> Montant total de la facture (en {0}) diff --git a/Site/Pages/v5/Financial/AttestCosts.aspx b/Site/Pages/v5/Financial/ApproveCosts.aspx similarity index 94% rename from Site/Pages/v5/Financial/AttestCosts.aspx rename to Site/Pages/v5/Financial/ApproveCosts.aspx index be4b93e0..c42c7d17 100644 --- a/Site/Pages/v5/Financial/AttestCosts.aspx +++ b/Site/Pages/v5/Financial/ApproveCosts.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.v5.Financial.AttestCosts" Codebehind="AttestCosts.aspx.cs" %> +<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.v5.Financial.AttestCosts" Codebehind="ApproveCosts.aspx.cs" %> <%@ Register src="~/Controls/v5/Base/ModalDialog.ascx" tagname="ModalDialog" tagprefix="Swarmops5" %> <%@ Register src="~/Controls/v5/Financial/ComboBudgets.ascx" tagname="ComboBudgets" tagprefix="Swarmops5" %> <%@ Register src="~/Controls/v5/Financial/CurrencyTextBox.ascx" tagname="CurrencyTextBox" tagprefix="Swarmops5" %> @@ -35,13 +35,13 @@ loadUninitializedBudgets(); // no need to wait for doc.ready to load operating params - SwarmopsJS.ajaxCall("/Pages/v5/Financial/AttestCosts.aspx/GetRemainingBudgets", {}, function(data) { + SwarmopsJS.ajaxCall("/Pages/v5/Financial/ApproveCosts.aspx/GetRemainingBudgets", {}, function(data) { data.forEach(function(accountData, dummy1, dummy2) { budgetRemainingLookup[accountData.AccountId] = accountData.Remaining; }); if (budgetRemainingLookup.rowsLoaded == true) { - setAttestability(); + setApprovability(); } budgetRemainingLookup.budgetsLoaded = true; @@ -50,7 +50,7 @@ // Doc.ready: $(document).ready(function () { - $('#TableAttestableCosts').datagrid( + $('#tableApprovableCosts').datagrid( { rowStyler: function (index, rowData) { if (rowData.approved != null) { @@ -72,7 +72,7 @@ $(".LocalIconDenied").attr("src", "/Images/Icons/iconshock-red-cross-circled-128x96px.png").hide(); $(".LocalIconUndo").attr("src", "/Images/Icons/iconshock-balloon-undo-128x96px.png"); $(".LocalIconWait").attr("src", "/Images/Abstract/ajaxloader-48x36px.gif"); // initializes as wait cursor here until budgets loaded - $(".LocalIconApproval.LocalNew, .LocalIconApproved.LocalNew, .LocalIconUndo.LocalNew, .LocalIconDenied.LocalNew, .LocalIconApproval.LocalPreviouslyAttested, .LocalIconWait.LocalPreviouslyAttested, .LocalIconDenial.LocalPreviouslyAttested, .LocalIconDenied.LocalPreviouslyAttested").hide(); + $(".LocalIconApproval.LocalNew, .LocalIconApproved.LocalNew, .LocalIconUndo.LocalNew, .LocalIconDenied.LocalNew, .LocalIconApproval.LocalApproved, .LocalIconWait.LocalApproved, .LocalIconDenial.LocalApproved, .LocalIconDenied.LocalApproved").hide(); $(".LocalIconDenial").attr("src", "/Images/Icons/iconshock-balloon-no-128x96px.png"); @@ -136,11 +136,11 @@ var accountId = $("#IconApproval" + baseid).attr("accountid"); var funds = parseFloat($("#IconApproval" + baseid).attr("amount")); budgetRemainingLookup[accountId] -= funds; - setAttestability(); + setApprovability(); $.ajax({ type: "POST", - url: "/Pages/v5/Financial/AttestCosts.aspx/Deattest", + url: "/Pages/v5/Financial/ApproveCosts.aspx/RetractApproval", data: "{'identifier': '" + escape($(this).attr("baseid")) + "'}", contentType: "application/json; charset=utf-8", dataType: "json", @@ -199,7 +199,7 @@ // Check if budgets have been fetched, and if so, initialize attestability if (budgetRemainingLookup.budgetsLoaded == true) { - setAttestability(); + setApprovability(); } budgetRemainingLookup.rowsLoaded = true; @@ -238,7 +238,7 @@ var accountId = $("#IconApproval" + baseid).attr("accountid"); var funds = parseFloat($("#IconApproval" + baseid).attr("amount")); budgetRemainingLookup[accountId] += funds; - setAttestability(); + setApprovability(); if (budgetUninitializedLookup[accountId] == true && uninitializedPopupDisplayed == false) { @@ -248,7 +248,6 @@ } }); - alertify.alert(SwarmopsJS.unescape('<%=this.Localized_WarnUninitializedBudget%>')); uninitializedPopupDisplayed = true; } @@ -256,7 +255,7 @@ $.ajax({ type: "POST", - url: "/Pages/v5/Financial/AttestCosts.aspx/Attest", + url: "/Pages/v5/Financial/ApproveCosts.aspx/ApproveItem", data: "{'identifier': '" + escape($(approvalIcon).attr("baseid")) + "'}", contentType: "application/json; charset=utf-8", dataType: "json", @@ -293,18 +292,18 @@ function recheckBudgets() { - SwarmopsJS.ajaxCall("/Pages/v5/Financial/AttestCosts.aspx/GetRemainingBudgets", {}, function(data) { + SwarmopsJS.ajaxCall("/Pages/v5/Financial/ApproveCosts.aspx/GetRemainingBudgets", {}, function(data) { data.forEach(function(accountData, dummy1, dummy2) { budgetRemainingLookup[accountData.AccountId] = accountData.Remaining; // console.log("Rechecking budget " + accountData.AccountId + ": remaining is " + accountData.Remaining); }); - setAttestability(); + setApprovability(); }); } function loadUninitializedBudgets() { - SwarmopsJS.ajaxCall("/Pages/v5/Financial/AttestCosts.aspx/GetUninitializedBudgets", {}, function(data) { + SwarmopsJS.ajaxCall("/Pages/v5/Financial/ApproveCosts.aspx/GetUninitializedBudgets", {}, function(data) { console.log(data); data.forEach(function(accountData, dummy1, dummy2) { budgetUninitializedLookup[accountData] = true; @@ -314,7 +313,7 @@ } - function setAttestability() { + function setApprovability() { $('.LocalIconApproval').each(function() { var accountId = $(this).attr('accountid'); @@ -361,7 +360,7 @@ <%= this.DialogDeny.ClientID %>_close(); SwarmopsJS.ajaxCall( - "/Pages/v5/Financial/AttestCosts.aspx/DenyItem", + "/Pages/v5/Financial/ApproveCosts.aspx/DenyItem", { recordId: recordId, reason: reason }, $.proxy(function(result) { if (result.Success) { @@ -372,7 +371,7 @@ // entire grid to cover our bases alertify.error(result.DisplayMessage); recheckBudgets(); - $('#TableAttestableCosts').datagrid('reload'); + $('#tableApprovableCosts').datagrid('reload'); } }, $('#IconDenied' + recordId))); } @@ -396,11 +395,11 @@ <%= this.DialogDeny.ClientID %>_close(); SwarmopsJS.ajaxCall( - "/Pages/v5/Financial/AttestCosts.aspx/RebudgetItem", + "/Pages/v5/Financial/ApproveCosts.aspx/RebudgetItem", { recordId: recordId, newAccountId: newAccountId }, function(data) { // this is when the change is completed - $('#TableAttestableCosts').datagrid('reload'); + $('#tableApprovableCosts').datagrid('reload'); }); } @@ -411,7 +410,7 @@ } SwarmopsJS.ajaxCall( - "/Pages/v5/Financial/AttestCosts.aspx/AttestCorrectedItem", + "/Pages/v5/Financial/ApproveCosts.aspx/ApproveCorrectedItem", { recordId: recordId, amountString: <%=this.TextCorrectAmount.ClientID%>_val() }, function(result) { console.log(result); @@ -420,7 +419,7 @@ } else { // Succeeded, attested for new amount. Since amount was changed, reload grid and budgets recheckBudgets(); - $('#TableAttestableCosts').datagrid('reload'); + $('#tableApprovableCosts').datagrid('reload'); <%= this.DialogDeny.ClientID %>_close(); } }); @@ -469,8 +468,8 @@ -

- +
@@ -488,7 +487,7 @@ -

+

diff --git a/Site/Pages/v5/Financial/AttestCosts.aspx.cs b/Site/Pages/v5/Financial/ApproveCosts.aspx.cs similarity index 96% rename from Site/Pages/v5/Financial/AttestCosts.aspx.cs rename to Site/Pages/v5/Financial/ApproveCosts.aspx.cs index d0627af0..0260f778 100644 --- a/Site/Pages/v5/Financial/AttestCosts.aspx.cs +++ b/Site/Pages/v5/Financial/ApproveCosts.aspx.cs @@ -156,7 +156,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial } - static protected IAttestable AttestableFromRecordId(string recordId) + static protected IApprovable AttestableFromRecordId(string recordId) { char recordType = recordId[0]; int itemId = Int32.Parse(recordId.Substring(1)); @@ -181,8 +181,8 @@ namespace Swarmops.Frontend.Pages.v5.Financial public static AjaxCallResult DenyItem (string recordId, string reason) { AuthenticationData authData = GetAuthenticationDataAndCulture(); - IAttestable attestable = AttestableFromRecordId (recordId); - FinancialAccount budget = attestable.Budget; + IApprovable approvable = AttestableFromRecordId (recordId); + FinancialAccount budget = approvable.Budget; if (budget.OrganizationId != authData.CurrentOrganization.Identity || (budget.OwnerPersonId != authData.CurrentUser.Identity && @@ -196,7 +196,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial reason = Resources.Global.Global_NoReasonGiven; } - attestable.DenyAttestation (authData.CurrentUser, reason); + approvable.DenyApproval (authData.CurrentUser, reason); return new AjaxCallResult { Success = true }; } @@ -293,7 +293,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial } payable.SetAmountCents (amountCents, authData.CurrentUser); - payable.Attest (authData.CurrentUser); + payable.Approve (authData.CurrentUser); return new AjaxCallResult { @@ -359,7 +359,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial { AuthenticationData authData = GetAuthenticationDataAndCulture(); - IAttestable attestableItem; + IApprovable approvableItem; string attestedTemplate; string deattestedTemplate; @@ -385,7 +385,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new SecurityException ("Called without attestation privileges"); } - attestableItem = advance; + approvableItem = advance; attestedTemplate = Resources.Pages.Financial.AttestCosts_AdvanceAttested; deattestedTemplate = Resources.Pages.Financial.AttestCosts_AdvanceDeattested; beneficiary = advance.Person.Name; @@ -404,7 +404,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new SecurityException ("Called without attestation privileges"); } - attestableItem = expense; + approvableItem = expense; attestedTemplate = Resources.Pages.Financial.AttestCosts_ExpenseAttested; deattestedTemplate = Resources.Pages.Financial.AttestCosts_ExpenseDeattested; beneficiary = expense.Claimer.Name; @@ -423,7 +423,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new SecurityException ("Called without attestation privileges"); } - attestableItem = invoice; + approvableItem = invoice; attestedTemplate = Resources.Pages.Financial.AttestCosts_InvoiceAttested; deattestedTemplate = Resources.Pages.Financial.AttestCosts_InvoiceDeattested; beneficiary = invoice.Supplier; @@ -442,7 +442,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new SecurityException ("Called without attestation privileges"); } - attestableItem = salary; + approvableItem = salary; attestedTemplate = Resources.Pages.Financial.AttestCosts_SalaryAttested; deattestedTemplate = Resources.Pages.Financial.AttestCosts_SalaryDeattested; beneficiary = salary.PayrollItem.PersonCanonical; @@ -461,7 +461,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new SecurityException ("Called without attestation privileges"); } - attestableItem = parley; + approvableItem = parley; attestedTemplate = Resources.Pages.Financial.AttestCosts_ParleyAttested; deattestedTemplate = Resources.Pages.Financial.AttestCosts_ParleyDeattested; beneficiary = parley.Person.Name; @@ -477,7 +477,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial if (mode == AttestationMode.Attestation) { - Int64 budgetRemaining = attestableItem.Budget.GetBudgetCentsRemaining(); + Int64 budgetRemaining = approvableItem.Budget.GetBudgetCentsRemaining(); result = string.Empty; @@ -491,7 +491,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial // Unless budget was nonzero and allocated, set protest message - if (attestableItem.Budget.Owner != null || attestableItem.Budget.GetBudgetCents() != 0) + if (approvableItem.Budget.Owner != null || approvableItem.Budget.GetBudgetCents() != 0) result = Resources.Pages.Financial.AttestCosts_Overdrafted + " "; } @@ -507,24 +507,24 @@ namespace Swarmops.Frontend.Pages.v5.Financial } } - attestableItem.Attest (authData.CurrentUser); + approvableItem.Approve (authData.CurrentUser); result += string.Format (attestedTemplate, itemId, beneficiary, authData.CurrentOrganization.Currency.Code, amountCents/100.0); } else if (mode == AttestationMode.Deattestation) { - attestableItem.Deattest (authData.CurrentUser); + approvableItem.RetractApproval (authData.CurrentUser); result = string.Format (deattestedTemplate, itemId, beneficiary, authData.CurrentOrganization.Currency.Code, amountCents/100.0); } else { - throw new InvalidOperationException ("Unknown Attestation Mode: " + mode); + throw new InvalidOperationException ("Unknown Approval Mode: " + mode); } - FinancialAccount.ClearAttestationAdjustmentsCache (authData.CurrentOrganization); + FinancialAccount.ClearApprovalAdjustmentsCache (authData.CurrentOrganization); return new AjaxCallResult {DisplayMessage = CommonV5.JavascriptEscape(result), Success = true}; } diff --git a/Site/Pages/v5/Financial/AttestCosts.aspx.designer.cs b/Site/Pages/v5/Financial/ApproveCosts.aspx.designer.cs similarity index 100% rename from Site/Pages/v5/Financial/AttestCosts.aspx.designer.cs rename to Site/Pages/v5/Financial/ApproveCosts.aspx.designer.cs diff --git a/Site/Pages/v5/Financial/Donate.aspx.cs b/Site/Pages/v5/Financial/Donate.aspx.cs index 7d3a80d2..043c1ab7 100644 --- a/Site/Pages/v5/Financial/Donate.aspx.cs +++ b/Site/Pages/v5/Financial/Donate.aspx.cs @@ -36,7 +36,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial { if (salary.PayrollItem.Person.BitcoinPayoutAddress.Length > 0 && salary.Attested == false) { - salary.Attest (salary.PayrollItem.Person); // null for system apparently isn't allowed here + salary.Approve (salary.PayrollItem.Person); // null for system apparently isn't allowed here } }*/ diff --git a/Site/Pages/v5/Financial/FileExpenseClaim.aspx.cs b/Site/Pages/v5/Financial/FileExpenseClaim.aspx.cs index 7b57da70..c86e4ca4 100644 --- a/Site/Pages/v5/Financial/FileExpenseClaim.aspx.cs +++ b/Site/Pages/v5/Financial/FileExpenseClaim.aspx.cs @@ -1020,7 +1020,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial successMessage += "

" + Resources.Pages.Financial.FileExpenseClaim_SuccessMessagePartTwoOwnBudget + "
"; - claim.Attest (CurrentUser); + claim.Approve (CurrentUser); } DashboardMessage.Set (successMessage); diff --git a/Site/Pages/v5/Financial/Json-AttestableCosts.aspx b/Site/Pages/v5/Financial/Json-ApprovableCosts.aspx similarity index 55% rename from Site/Pages/v5/Financial/Json-AttestableCosts.aspx rename to Site/Pages/v5/Financial/Json-ApprovableCosts.aspx index bf167fe9..2fba78c2 100644 --- a/Site/Pages/v5/Financial/Json-AttestableCosts.aspx +++ b/Site/Pages/v5/Financial/Json-ApprovableCosts.aspx @@ -1 +1 @@ -<%@ Page Language="C#" AutoEventWireup="true" Inherits="Pages_v5_Finance_Json_AttestableCosts" Codebehind="Json-AttestableCosts.aspx.cs" %> +<%@ Page Language="C#" AutoEventWireup="true" Inherits="Pages_v5_Finance_Json_ApprovableCosts" Codebehind="Json-ApprovableCosts.aspx.cs" %> diff --git a/Site/Pages/v5/Financial/Json-AttestableCosts.aspx.cs b/Site/Pages/v5/Financial/Json-ApprovableCosts.aspx.cs similarity index 74% rename from Site/Pages/v5/Financial/Json-AttestableCosts.aspx.cs rename to Site/Pages/v5/Financial/Json-ApprovableCosts.aspx.cs index 42060791..0857d6c9 100644 --- a/Site/Pages/v5/Financial/Json-AttestableCosts.aspx.cs +++ b/Site/Pages/v5/Financial/Json-ApprovableCosts.aspx.cs @@ -9,19 +9,19 @@ using Swarmops.Logic.Financial; using Swarmops.Logic.Support; using Swarmops.Logic.Swarm; -public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base +public partial class Pages_v5_Finance_Json_ApprovableCosts : DataV5Base { - private Dictionary _attestationRights; - private AttestableItems _items; - private AttestableItems _attestedItems; + private Dictionary _approvalRights; + private ApprovableCosts _approvableCosts; + private ApprovableCosts _approvedCosts; protected void Page_Load (object sender, EventArgs e) { // Get all attestable items - this._attestationRights = GetAttestationRights(); - this._items = new AttestableItems(); - this._attestedItems = new AttestableItems(); + this._approvalRights = GetApprovalRights(); + this._approvableCosts = new ApprovableCosts(); + this._approvedCosts = new ApprovableCosts(); PopulateCashAdvances(); PopulateExpenses(); @@ -46,12 +46,12 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base result.Append ("{\"rows\":["); - foreach (AttestableItem item in this._items) + foreach (ApprovableCost cost in this._approvableCosts) { result.Append("{"); result.AppendFormat( "\"item\":\"{0}\",\"beneficiary\":\"{1}\",\"description\":\"{2}\",\"budgetName\":\"{3}\",\"amountRequested\":\"{4:N2}\",\"itemId\":\"{5}\"," + - "\"dox\":\"" + (item.HasDox ? hasDoxString : " ") + "\"," + + "\"dox\":\"" + (cost.HasDox ? hasDoxString : " ") + "\"," + "\"actions\":\"" + "" + "" + @@ -60,31 +60,32 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base "" + "" + "\"", - JsonSanitize(GetGlobalResourceObject("Global", item.IdentityDisplay).ToString()), - JsonSanitize(item.Beneficiary), JsonSanitize(TryLocalize(item.Description)), - JsonSanitize(item.BudgetName), - item.AmountRequestedCents / 100.0, item.Identity, item.Budget.Identity); + JsonSanitize(GetGlobalResourceObject("Global", cost.IdentityDisplay).ToString()), + JsonSanitize(cost.Beneficiary), JsonSanitize(TryLocalize(cost.Description)), + JsonSanitize(cost.BudgetName), + cost.AmountRequestedCents / 100.0, cost.Identity, cost.Budget.Identity); + result.Append("},"); } - foreach (AttestableItem item in this._attestedItems) + foreach (ApprovableCost cost in this._approvedCosts) { result.Append("{"); result.AppendFormat( "\"item\":\"{0}\",\"beneficiary\":\"{1}\",\"description\":\"{2}\",\"budgetName\":\"{3}\",\"approved\":\"yes\",\"amountRequested\":\"{4:N2}\",\"itemId\":\"{5}\"," + - "\"dox\":\"" + (item.HasDox ? hasDoxString : " ") + "\"," + + "\"dox\":\"" + (cost.HasDox ? hasDoxString : " ") + "\"," + "\"actions\":\"" + - "" + - "" + - "" + - "" + - "" + - "" + + "" + + "" + + "" + + "" + + "" + + "" + "\"", - JsonSanitize(GetGlobalResourceObject("Global", item.IdentityDisplay).ToString()), - JsonSanitize(item.Beneficiary), JsonSanitize(TryLocalize(item.Description)), - JsonSanitize(item.BudgetName), - item.AmountRequestedCents / 100.0, item.Identity, item.Budget.Identity); + JsonSanitize(GetGlobalResourceObject("Global", cost.IdentityDisplay).ToString()), + JsonSanitize(cost.Beneficiary), JsonSanitize(TryLocalize(cost.Description)), + JsonSanitize(cost.BudgetName), + cost.AmountRequestedCents / 100.0, cost.Identity, cost.Budget.Identity); result.Append("},"); } @@ -96,10 +97,10 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base } - private Dictionary GetAttestationRights() + private Dictionary GetApprovalRights() { // Right now, this function is quite primitive. At some point in the future, it needs to take into - // account that a budget may have several attesters. Right now, it just loops over all accounts and + // account that a budget may have several approvers. Right now, it just loops over all accounts and // checks the owner. Dictionary result = new Dictionary(); @@ -130,21 +131,21 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base foreach (CashAdvance advance in advances) { - if (this._attestationRights.ContainsKey (advance.BudgetId) || + if (this._approvalRights.ContainsKey (advance.BudgetId) || advance.Budget.OwnerPersonId == Person.NobodyId) { - AttestableItem item = new AttestableItem ( + ApprovableCost cost = new ApprovableCost ( "A" + advance.Identity.ToString (CultureInfo.InvariantCulture), advance.Person.Name, advance.AmountCents, advance.Budget, advance.Description, "Financial_CashAdvance", false, advance); if (!advance.Attested) // if not attested { - this._items.Add (item); + this._approvableCosts.Add (cost); } else if (!advance.PaidOut) // if attested, but still reversible { - this._attestedItems.Add (item); + this._approvedCosts.Add (cost); } } } @@ -158,24 +159,24 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base foreach (ExpenseClaim expenseClaim in expenses) { - if (this._attestationRights.ContainsKey (expenseClaim.BudgetId) || + if (this._approvalRights.ContainsKey (expenseClaim.BudgetId) || expenseClaim.Budget.OwnerPersonId == Person.NobodyId) { Documents dox = expenseClaim.Documents; bool hasDox = (dox.Count > 0 ? true : false); - AttestableItem item = null; + ApprovableCost cost = null; if (vatEnabled) { - item = new AttestableItem( + cost = new ApprovableCost( "E" + expenseClaim.Identity.ToString(CultureInfo.InvariantCulture), expenseClaim.ClaimerCanonical, expenseClaim.AmountCents - expenseClaim.VatCents, expenseClaim.Budget, expenseClaim.Description, "Financial_ExpenseClaim", hasDox, expenseClaim); } else { - item = new AttestableItem( + cost = new ApprovableCost( "E" + expenseClaim.Identity.ToString(CultureInfo.InvariantCulture), expenseClaim.ClaimerCanonical, expenseClaim.AmountCents, expenseClaim.Budget, expenseClaim.Description, "Financial_ExpenseClaim", hasDox, expenseClaim); @@ -183,11 +184,11 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base if (expenseClaim.Attested) { - this._attestedItems.Add (item); + this._approvedCosts.Add (cost); } else { - this._items.Add (item); + this._approvableCosts.Add (cost); } } } @@ -203,20 +204,20 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base Documents dox = invoice.Documents; bool hasDox = (dox.Count > 0 ? true : false); - if (this._attestationRights.ContainsKey (invoice.BudgetId) || + if (this._approvalRights.ContainsKey (invoice.BudgetId) || invoice.Budget.OwnerPersonId == Person.NobodyId) { - AttestableItem item = new AttestableItem ("I" + invoice.Identity.ToString (CultureInfo.InvariantCulture), + ApprovableCost cost = new ApprovableCost ("I" + invoice.Identity.ToString (CultureInfo.InvariantCulture), invoice.Supplier, invoice.BudgetAmountCents, invoice.Budget, invoice.Description, "Financial_InvoiceInbound", hasDox, invoice); if (invoice.Attested) { - this._attestedItems.Add (item); + this._approvedCosts.Add (cost); } else { - this._items.Add (item); + this._approvableCosts.Add (cost); } } } @@ -231,19 +232,19 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base foreach (Salary salary in salaries) { - if (this._attestationRights.ContainsKey (salary.PayrollItem.BudgetId) || + if (this._approvalRights.ContainsKey (salary.PayrollItem.BudgetId) || salary.PayrollItem.Budget.OwnerPersonId == Person.NobodyId) { if (!salary.Attested) { - this._items.Add(new AttestableItem("S" + salary.Identity.ToString(CultureInfo.InvariantCulture), + this._approvableCosts.Add(new ApprovableCost("S" + salary.Identity.ToString(CultureInfo.InvariantCulture), salary.PayrollItem.PersonCanonical, salary.CostTotalCents, salary.PayrollItem.Budget, "[Loc]Financial_SalarySpecification|[Date]" + salary.PayoutDate.ToString(CultureInfo.InvariantCulture), "Financial_Salary", false, salary)); } else { - this._attestedItems.Add(new AttestableItem("S" + salary.Identity.ToString(CultureInfo.InvariantCulture), + this._approvedCosts.Add(new ApprovableCost("S" + salary.Identity.ToString(CultureInfo.InvariantCulture), salary.PayrollItem.PersonCanonical, salary.CostTotalCents, salary.PayrollItem.Budget, "[Loc]Financial_SalarySpecification|[Date]" + salary.PayoutDate.ToString(CultureInfo.InvariantCulture), "Financial_Salary", false, salary)); @@ -255,13 +256,13 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base private void PopulateParleys() { - Parleys parleys = Parleys.ForOrganization (CurrentOrganization).WhereUnattested; + Parleys parleys = Parleys.ForOrganization (CurrentOrganization).WhereNotApproved; foreach (Parley parley in parleys) { - if (this._attestationRights.ContainsKey (parley.BudgetId) || parley.Budget.OwnerPersonId == Person.NobodyId) + if (this._approvalRights.ContainsKey (parley.BudgetId) || parley.Budget.OwnerPersonId == Person.NobodyId) { - this._items.Add (new AttestableItem ("P" + parley.Identity.ToString (CultureInfo.InvariantCulture), + this._approvableCosts.Add (new ApprovableCost ("P" + parley.Identity.ToString (CultureInfo.InvariantCulture), parley.Person.Canonical, parley.BudgetCents, parley.ParentBudget, parley.Name, "Financial_Parley", false, parley)); } @@ -269,9 +270,9 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base } - protected class AttestableItem + protected class ApprovableCost { - public AttestableItem (string identity, string beneficiary, Int64 amountCents, FinancialAccount account, + public ApprovableCost (string identity, string beneficiary, Int64 amountCents, FinancialAccount account, string description, string identityDisplay, bool hasDox, IHasIdentity item) { IdentityDisplay = identityDisplay; @@ -300,7 +301,7 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : DataV5Base public bool HasDox { get; private set; } } - protected class AttestableItems : List + protected class ApprovableCosts : List { // empty class, we just want the name definition } diff --git a/Site/Pages/v5/Financial/Json-AttestableCosts.aspx.designer.cs b/Site/Pages/v5/Financial/Json-ApprovableCosts.aspx.designer.cs similarity index 85% rename from Site/Pages/v5/Financial/Json-AttestableCosts.aspx.designer.cs rename to Site/Pages/v5/Financial/Json-ApprovableCosts.aspx.designer.cs index ba23865e..1efc884d 100644 --- a/Site/Pages/v5/Financial/Json-AttestableCosts.aspx.designer.cs +++ b/Site/Pages/v5/Financial/Json-ApprovableCosts.aspx.designer.cs @@ -9,5 +9,5 @@ -public partial class Pages_v5_Finance_Json_AttestableCosts { +public partial class Pages_v5_Finance_Json_ApprovableCosts { } diff --git a/Site/Pages/v5/Financial/ListInvoicesInbound.aspx b/Site/Pages/v5/Financial/ListInvoicesInbound.aspx index ee8672c6..fb6ac165 100644 --- a/Site/Pages/v5/Financial/ListInvoicesInbound.aspx +++ b/Site/Pages/v5/Financial/ListInvoicesInbound.aspx @@ -41,7 +41,7 @@ }); if (budgetRemainingLookup.rowsLoaded == true) { - setAttestability(); + setApprovability(); } budgetRemainingLookup.budgetsLoaded = true; @@ -83,7 +83,7 @@ - function setAttestability() { + function setApprovability() { $('.LocalIconApproval').each(function() { var accountId = $(this).attr('accountid'); diff --git a/Site/Pages/v5/Financial/ListInvoicesInbound.aspx.cs b/Site/Pages/v5/Financial/ListInvoicesInbound.aspx.cs index 7303a213..93091b66 100644 --- a/Site/Pages/v5/Financial/ListInvoicesInbound.aspx.cs +++ b/Site/Pages/v5/Financial/ListInvoicesInbound.aspx.cs @@ -189,7 +189,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial reason = Resources.Global.Global_NoReasonGiven; } - payable.DenyAttestation (authData.CurrentUser, reason); + payable.DenyApproval (authData.CurrentUser, reason); return new AjaxCallResult { Success = true }; } @@ -286,7 +286,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial } payable.SetAmountCents (amountCents, authData.CurrentUser); - payable.Attest (authData.CurrentUser); + payable.Approve (authData.CurrentUser); return new AjaxCallResult { @@ -352,7 +352,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial { AuthenticationData authData = GetAuthenticationDataAndCulture(); - IAttestable attestableItem; + IApprovable approvableItem; string attestedTemplate; string deattestedTemplate; @@ -378,7 +378,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new SecurityException ("Called without attestation privileges"); } - attestableItem = advance; + approvableItem = advance; attestedTemplate = Resources.Pages.Financial.AttestCosts_AdvanceAttested; deattestedTemplate = Resources.Pages.Financial.AttestCosts_AdvanceDeattested; beneficiary = advance.Person.Name; @@ -397,7 +397,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new SecurityException ("Called without attestation privileges"); } - attestableItem = expense; + approvableItem = expense; attestedTemplate = Resources.Pages.Financial.AttestCosts_ExpenseAttested; deattestedTemplate = Resources.Pages.Financial.AttestCosts_ExpenseDeattested; beneficiary = expense.Claimer.Name; @@ -416,7 +416,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new SecurityException ("Called without attestation privileges"); } - attestableItem = invoice; + approvableItem = invoice; attestedTemplate = Resources.Pages.Financial.AttestCosts_InvoiceAttested; deattestedTemplate = Resources.Pages.Financial.AttestCosts_InvoiceDeattested; beneficiary = invoice.Supplier; @@ -435,7 +435,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new SecurityException ("Called without attestation privileges"); } - attestableItem = salary; + approvableItem = salary; attestedTemplate = Resources.Pages.Financial.AttestCosts_SalaryAttested; deattestedTemplate = Resources.Pages.Financial.AttestCosts_SalaryDeattested; beneficiary = salary.PayrollItem.PersonCanonical; @@ -454,7 +454,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new SecurityException ("Called without attestation privileges"); } - attestableItem = parley; + approvableItem = parley; attestedTemplate = Resources.Pages.Financial.AttestCosts_ParleyAttested; deattestedTemplate = Resources.Pages.Financial.AttestCosts_ParleyDeattested; beneficiary = parley.Person.Name; @@ -470,7 +470,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial if (mode == AttestationMode.Attestation) { - Int64 budgetRemaining = attestableItem.Budget.GetBudgetCentsRemaining(); + Int64 budgetRemaining = approvableItem.Budget.GetBudgetCentsRemaining(); result = string.Empty; @@ -484,7 +484,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial // Unless budget was nonzero and allocated, set protest message - if (attestableItem.Budget.Owner != null || attestableItem.Budget.GetBudgetCents() != 0) + if (approvableItem.Budget.Owner != null || approvableItem.Budget.GetBudgetCents() != 0) result = Resources.Pages.Financial.AttestCosts_Overdrafted + " "; } @@ -500,24 +500,24 @@ namespace Swarmops.Frontend.Pages.v5.Financial } } - attestableItem.Attest (authData.CurrentUser); + approvableItem.Approve (authData.CurrentUser); result += string.Format (attestedTemplate, itemId, beneficiary, authData.CurrentOrganization.Currency.Code, amountCents/100.0); } else if (mode == AttestationMode.Deattestation) { - attestableItem.Deattest (authData.CurrentUser); + approvableItem.RetractApproval (authData.CurrentUser); result = string.Format (deattestedTemplate, itemId, beneficiary, authData.CurrentOrganization.Currency.Code, amountCents/100.0); } else { - throw new InvalidOperationException ("Unknown Attestation Mode: " + mode); + throw new InvalidOperationException ("Unknown Approval Mode: " + mode); } - FinancialAccount.ClearAttestationAdjustmentsCache (authData.CurrentOrganization); + FinancialAccount.ClearApprovalAdjustmentsCache (authData.CurrentOrganization); return new AjaxCallResult {DisplayMessage = result, Success = true}; } diff --git a/Site/Pages/v5/Financial/ListInvoicesOutbound.aspx b/Site/Pages/v5/Financial/ListInvoicesOutbound.aspx index c676c20a..642746e8 100644 --- a/Site/Pages/v5/Financial/ListInvoicesOutbound.aspx +++ b/Site/Pages/v5/Financial/ListInvoicesOutbound.aspx @@ -30,7 +30,7 @@ }); if (budgetRemainingLookup.rowsLoaded == true) { - setAttestability(); + setApprovability(); } budgetRemainingLookup.budgetsLoaded = true; diff --git a/Site/Pages/v5/Financial/RequestCashAdvance.aspx.cs b/Site/Pages/v5/Financial/RequestCashAdvance.aspx.cs index 86b4096e..78618c7c 100644 --- a/Site/Pages/v5/Financial/RequestCashAdvance.aspx.cs +++ b/Site/Pages/v5/Financial/RequestCashAdvance.aspx.cs @@ -96,7 +96,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial successMessage += "

" + Resources.Pages.Financial.RequestCashAdvance_SuccessMessagePartTwoOwnBudget + "
"; - cashAdvance.Attest (CurrentUser); + cashAdvance.Approve (CurrentUser); } DashboardMessage.Set (successMessage); diff --git a/Site/Pages/v5/Financial/ValidateReceipts.aspx b/Site/Pages/v5/Financial/ValidateReceipts.aspx index 1f501714..7e540d2d 100644 --- a/Site/Pages/v5/Financial/ValidateReceipts.aspx +++ b/Site/Pages/v5/Financial/ValidateReceipts.aspx @@ -53,26 +53,33 @@ $(".LocalIconApproval").click(function () { + var itemId = $(this).attr("baseid"); $(this).hide(); - $("#IconWait" + $(this).attr("baseid")).show(); - $("#IconDenial" + $(this).attr("baseid")).fadeTo(1000, 0.01); - var thisIcon = this; - $.ajax({ - type: "POST", - url: "/Pages/v5/Financial/ValidateReceipts.aspx/Validate", - data: "{'identifier': '" + escape($(this).attr("baseid")) + "'}", - contentType: "application/json; charset=utf-8", - dataType: "json", - success: function (msg) { - var baseId = $(thisIcon).attr("baseid"); - $('.row' + baseId).addClass("action-list-item-approved"); - $("#IconWait" + baseId).hide(); - $("#IconDenial" + baseId).hide(); - $("#IconApproved" + baseId).fadeTo(200, 0.5); // half opacity is intentional - $("#IconUndo" + baseId).fadeTo(1000, 1); // the longer delay is intentional - alertify.success(unescape(msg.d)); + $("#IconWait" + itemId).show(); + $("#IconDenial" + itemId).fadeTo(1000, 0.01); + + SwarmopsJS.proxiedAjaxCall( + "/Pages/v5/Financial/ValidateReceipts.aspx/Validate", + { identifier: itemId }, + function (result) { + if (result.Success) { + var itemId = $(this).attr("baseid"); + $('.row' + itemId).addClass("action-list-item-approved"); + $("#IconWait" + itemId).hide(); + $("#IconDenial" + itemId).hide(); + $("#IconApproved" + itemId).fadeTo(200, 0.5); // half opacity is intentional + $("#IconUndo" + itemId).fadeTo(1000, 1); // the longer delay is intentional + alertify.success(result.DisplayMessage); + } else { + // There's probably a concurrency error. + // The socket handler will take care of updating the UI on + // receiving the cause of the concurrency error. + + alertify.log(result.DisplayMessage); + + } } - }); + ); }); $(".LocalIconUndo").click(function () { @@ -80,22 +87,30 @@ $(this).hide(); $("#IconApproved" + $(this).attr("baseid")).fadeTo(1000, 0.01); $("#IconWait" + $(this).attr("baseid")).show(); - $.ajax({ - type: "POST", - url: "/Pages/v5/Financial/ValidateReceipts.aspx/Devalidate", - data: "{'identifier': '" + escape($(this).attr("baseid")) + "'}", - contentType: "application/json; charset=utf-8", - dataType: "json", - success: function (msg) { - var baseId = $(thisIcon).attr("baseid"); - $('.row' + baseId).removeClass("action-list-item-approved"); - $("#IconWait" + baseId).hide(); - $("#IconApproved" + baseId).hide(); - $("#IconApproval" + baseId).fadeTo(200, 1); - $("#IconDenial" + baseId).fadeTo(200, 1); - alertify.log(unescape(msg.d).replace('+', ' ')); + + SwarmopsJS.proxiedAjaxCall( + "/Pages/v5/Financial/ValidateReceipts.aspx/RetractValidation", + { identifier: $(this).attr("baseid") }, + function(result) { + if (result.Success) { + var itemId = $(this).attr("baseid"); + $('.row' + itemId).removeClass("action-list-item-approved"); + $("#IconWait" + itemId).hide(); + $("#IconApproved" + itemId).hide(); + $("#IconApproval" + itemId).fadeTo(200, 1); + $("#IconDenial" + itemId,Id).fadeTo(200, 1); + alertify.log(result.DisplayMessage); + + } else { + // There's probably a concurrency error. + // The socket handler will take care of updating the UI on + // receiving the cause of the concurrency error. + + alertify.log(result.DisplayMessage); + } } - }); + ); + }); @@ -128,7 +143,7 @@ -

+

diff --git a/Site/Pages/v5/Financial/ValidateReceipts.aspx.cs b/Site/Pages/v5/Financial/ValidateReceipts.aspx.cs index 415cb59e..17ad2369 100644 --- a/Site/Pages/v5/Financial/ValidateReceipts.aspx.cs +++ b/Site/Pages/v5/Financial/ValidateReceipts.aspx.cs @@ -5,6 +5,7 @@ using System.Text; using System.Web; using System.Web.Services; using Resources; +using Swarmops.Common.Exceptions; using Swarmops.Logic.Financial; using Swarmops.Logic.Security; using Swarmops.Logic.Support; @@ -50,7 +51,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial Resources.Pages.Financial.ValidateReceipts_Header_ReceiptsAwaitingValidation; this.LabelGridHeaderAction.Text = Global.Global_Action; this.LabelGridHeaderBudget.Text = Resources.Pages.Financial.AttestCosts_GridHeader_Budget; - // Reuse some strings from Attest Costs + // Reuse some strings from Approve Costs this.LabelGridHeaderDescription.Text = Resources.Pages.Financial.AttestCosts_GridHeader_Description; this.LabelGridHeaderDocs.Text = Resources.Pages.Financial.AttestCosts_GridHeader_Docs; this.LabelGridHeaderRequested.Text = Resources.Pages.Financial.AttestCosts_GridHeader_Requested; @@ -87,33 +88,45 @@ namespace Swarmops.Frontend.Pages.v5.Financial } [WebMethod] - public new static string Validate (string identifier) + public new static AjaxCallResult Validate (string identifier) { identifier = HttpUtility.UrlDecode (identifier); - string result = HandleValidationDevalidation (identifier, AttestationMode.Attestation); - - return HttpUtility.UrlEncode (result).Replace ("+", "%20"); + try + { + string resultMessage = HandleValidationDevalidation(identifier, ApprovalMode.Approval); + return new AjaxCallResult { Success = true, DisplayMessage = resultMessage }; + } + catch (ConcurrencyException) + { + return new AjaxCallResult {Success = false, DisplayMessage = Resources.Global.Error_DatabaseConcurrency}; + } } [WebMethod] - public static string Devalidate (string identifier) + public static AjaxCallResult RetractValidation (string identifier) { identifier = HttpUtility.UrlDecode (identifier); - string result = HandleValidationDevalidation (identifier, AttestationMode.Deattestation); - - return HttpUtility.UrlEncode (result).Replace ("+", "%20"); + try + { + string resultMessage = HandleValidationDevalidation(identifier, ApprovalMode.Retraction); + return new AjaxCallResult { Success = true, DisplayMessage = resultMessage }; + } + catch (ConcurrencyException) + { + return new AjaxCallResult { Success = false, DisplayMessage = Resources.Global.Error_DatabaseConcurrency }; + } } - private static string HandleValidationDevalidation (string identifier, AttestationMode mode) + private static string HandleValidationDevalidation (string identifier, ApprovalMode mode) { AuthenticationData authData = GetAuthenticationDataAndCulture(); IValidatable validatableItem = null; string validatedTemplate = string.Empty; - string devalidatedTemplate = string.Empty; + string retractedTemplate = string.Empty; char costType = identifier[0]; int itemId = Int32.Parse (identifier.Substring (1)); @@ -140,7 +153,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial validatableItem = expense; validatedTemplate = Resources.Pages.Financial.ValidateReceipts_ReceiptsValidated; - devalidatedTemplate = Resources.Pages.Financial.ValidateReceipts_ReceiptsDevalidated; + retractedTemplate = Resources.Pages.Financial.ValidateReceipts_ReceiptsDevalidated; amountCents = expense.AmountCents; break; @@ -151,21 +164,21 @@ namespace Swarmops.Frontend.Pages.v5.Financial // Finally, attest or deattest - if (mode == AttestationMode.Attestation) + if (mode == ApprovalMode.Approval) { validatableItem.Validate (authData.CurrentUser); result = string.Format (validatedTemplate, itemId, authData.CurrentOrganization.Currency.Code, amountCents/100.0); } - else if (mode == AttestationMode.Deattestation) + else if (mode == ApprovalMode.Retraction) { - validatableItem.Devalidate (authData.CurrentUser); - result = string.Format (devalidatedTemplate, itemId, authData.CurrentOrganization.Currency.Code, + validatableItem.RetractValidation (authData.CurrentUser); + result = string.Format (retractedTemplate, itemId, authData.CurrentOrganization.Currency.Code, amountCents/100.0); } else { - throw new InvalidOperationException ("Unknown Attestation Mode: " + mode); + throw new InvalidOperationException ("Unknown Approval Mode: " + mode); } return result; @@ -204,11 +217,11 @@ namespace Swarmops.Frontend.Pages.v5.Financial } } - private enum AttestationMode + private enum ApprovalMode { Unknown = 0, - Attestation, - Deattestation + Approval, + Retraction }; public class RepeatedDocument diff --git a/Site/Pages/v5/Ledgers/InspectLedgers.aspx.cs b/Site/Pages/v5/Ledgers/InspectLedgers.aspx.cs index 40c1dbb1..ca4deecd 100644 --- a/Site/Pages/v5/Ledgers/InspectLedgers.aspx.cs +++ b/Site/Pages/v5/Ledgers/InspectLedgers.aspx.cs @@ -385,7 +385,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers foreach (FinancialValidation validation in validations) { - if (validation.ValidationType == FinancialValidationType.Attestation) + if (validation.ValidationType == FinancialValidationType.Approval) { result += String.Format (Resources.Pages.Ledgers.InspectLedgers_TxDetail_AttestedByX + ". ", validation.Person.Canonical, diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index ac87dbbd..c23680f3 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -448,6 +448,18 @@ var SwarmopsJS = (function () { } + // Preserves the "this" object into success and error functions + publicSymbols.proxiedAjaxCall = proxiedAjaxCall; + function proxiedAjaxCall(url, params, successFunction, errorFunction) { + ajaxCall( + url, + params, + $.proxy(successFunction, this), + errorFunction !== undefined? $.proxy(errorFunction, this) : undefined + ); + } + + publicSymbols.fancyBoxInit = fancyBoxInit; function fancyBoxInit(selector) { diff --git a/Site/Site.csproj b/Site/Site.csproj index a3b4ee7a..0a1d2131 100644 --- a/Site/Site.csproj +++ b/Site/Site.csproj @@ -1021,12 +1021,12 @@ ListInvoicesInbound.aspx - - AttestCosts.aspx + + ApproveCosts.aspx ASPXCodeBehind - - AttestCosts.aspx + + ApproveCosts.aspx BitcoinHotwalletNotEnabled.aspx @@ -1070,12 +1070,12 @@ FileExpenseClaim.aspx - - Json-AttestableCosts.aspx + + Json-ApprovableCosts.aspx ASPXCodeBehind - - Json-AttestableCosts.aspx + + Json-ApprovableCosts.aspx Json-PayableCosts.aspx @@ -1941,14 +1941,14 @@ - + - + diff --git a/Utility/BotCode/EventProcessor.cs b/Utility/BotCode/EventProcessor.cs index 0b3a89ec..9d4ffb39 100644 --- a/Utility/BotCode/EventProcessor.cs +++ b/Utility/BotCode/EventProcessor.cs @@ -910,7 +910,7 @@ namespace Swarmops.Utility.BotCode "Description: " + expenseClaim.Description + "\r\n" + "Amount: " + expenseClaim.Amount.ToString("N2", CultureInfo.InvariantCulture) + "\r\n" + "Budget: " + expenseClaim.Budget.Name + "\r\n\r\n" + - "Attestation mechanisms are available on PirateWeb. The claimer will not be refunded until " + + "Approval mechanisms are available on PirateWeb. The claimer will not be refunded until " + "YOU, as the budget owner, have attested that this claim should be drawn from your budget. " + "Go to this link and attest the claim, if it is correct:\r\n" + "https://pirateweb.net/Pages/v4/Financial/AttestCosts.aspx\r\n\r\n"; @@ -920,7 +920,7 @@ namespace Swarmops.Utility.BotCode concernedPeople = People.FromSingle(budgetOwner); new MailTransmitter(Strings.MailSenderNameFinancial, Strings.MailSenderAddress, - "Attestation Required [" + expenseClaim.Identity + "]: [" + expenser.Name + + "Approval Required [" + expenseClaim.Identity + "]: [" + expenser.Name + "], [" + organization.NameShort + "], [" + expenseClaim.Budget.Name + "], [" + expenseClaim.Amount.ToString("N2", CultureInfo.InvariantCulture) + "]", @@ -951,7 +951,7 @@ namespace Swarmops.Utility.BotCode "Due Date: " + invoice.DueDate.ToLongDateString() + "\r\n" + "Amount: " + invoice.Amount.ToString("N2", CultureInfo.InvariantCulture) + "\r\n" + "Budget: " + invoice.Budget.Name + "\r\n\r\n" + - "Attestation mechanisms are available on PirateWeb. The invoice will not be available for payment until " + + "Approval mechanisms are available on PirateWeb. The invoice will not be available for payment until " + "YOU, as the budget owner, have attested that this invoice should be drawn from your budget. " + "Go to this link and attest the invoice, if it is correct; you can also see the invoice scan here:\r\n" + "https://pirateweb.net/Pages/v4/Financial/AttestCosts.aspx\r\n\r\n"; @@ -961,7 +961,7 @@ namespace Swarmops.Utility.BotCode People concernedPeople = People.FromSingle(budgetOwner); new MailTransmitter(Strings.MailSenderNameFinancial, Strings.MailSenderAddress, - "Attestation Required [" + invoice.Identity + "]: [" + invoice.Supplier + + "Approval Required [" + invoice.Identity + "]: [" + invoice.Supplier + "], [" + organization.NameShort + "], [" + invoice.Budget.Name + "], [" + invoice.Amount.ToString("N2", CultureInfo.InvariantCulture) + "]",