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) + "]",