From d26a24ca5c38fed5c030e5c89e5f97461194d5d7 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 11 Feb 2013 07:12:20 +0000 Subject: [PATCH] Added ability to attest all cost types (deattesting Parleys remain, viewing docs remain, denying attestations remain). --- Basic/Types/Financial/BasicCashAdvance.cs | 6 +- Logic/Financial/CashAdvance.cs | 4 +- Logic/Financial/ExpenseClaim.cs | 1 + Logic/Financial/ExpenseClaims.cs | 48 ++------ Logic/Financial/InboundInvoices.cs | 26 +++++ Logic/Financial/Salaries.cs | 64 +++++------ Logic/Financial/Salary.cs | 4 +- Logic/Swarm/Parley.cs | 105 ++++++++++++++---- Logic/Swarm/Parleys.cs | 17 +++ Site5/App_GlobalResources/Global.resx | 15 +++ Site5/Pages/v5/Financial/AttestCosts.aspx.cs | 74 +++++++++++- .../v5/Financial/Json-AttestableCosts.aspx.cs | 72 +++++++++++- 12 files changed, 332 insertions(+), 104 deletions(-) diff --git a/Basic/Types/Financial/BasicCashAdvance.cs b/Basic/Types/Financial/BasicCashAdvance.cs index 25f53497..c71f4d6a 100644 --- a/Basic/Types/Financial/BasicCashAdvance.cs +++ b/Basic/Types/Financial/BasicCashAdvance.cs @@ -15,7 +15,7 @@ namespace Swarmops.Basic.Types.Financial this.PersonId = personId; this.CreatedDateTime = createdDateTime; this.CreatedByPersonId = createdByPersonId; - this.FinancialAccountId = financialAccountId; + this.BudgetId = financialAccountId; this.AmountCents = amountCents; this.Description = description; this.Open = open; @@ -27,7 +27,7 @@ namespace Swarmops.Basic.Types.Financial public BasicCashAdvance (BasicCashAdvance original): this(original.CashAdvanceId, original.OrganizationId, original.PersonId, original.CreatedDateTime, original.CreatedByPersonId, - original.FinancialAccountId, original.AmountCents,original.Description, original.Open, original.Attested, + original.BudgetId, original.AmountCents,original.Description, original.Open, original.Attested, original.PaidOut, original.AttestedByPersonId, original.AttestedDateTime) { // copy ctor - no action other than copying original object @@ -44,7 +44,7 @@ namespace Swarmops.Basic.Types.Financial public int PersonId { get; protected set; } public DateTime CreatedDateTime { get; protected set; } public int CreatedByPersonId { get; protected set; } - public int FinancialAccountId { get; protected set; } + public int BudgetId { get; protected set; } public Int64 AmountCents { get; protected set; } public string Description { get; protected set; } public bool Open { get; protected set; } diff --git a/Logic/Financial/CashAdvance.cs b/Logic/Financial/CashAdvance.cs index 761b1952..4f38889e 100644 --- a/Logic/Financial/CashAdvance.cs +++ b/Logic/Financial/CashAdvance.cs @@ -73,9 +73,9 @@ namespace Swarmops.Logic.Financial get { return Person.FromIdentity(this.PersonId); } } - public FinancialAccount FinancialAccount + public FinancialAccount Budget { - get { return FinancialAccount.FromIdentity(this.FinancialAccountId); } + get { return FinancialAccount.FromIdentity(this.BudgetId); } } } } diff --git a/Logic/Financial/ExpenseClaim.cs b/Logic/Financial/ExpenseClaim.cs index a9e46c85..0f3d85b4 100644 --- a/Logic/Financial/ExpenseClaim.cs +++ b/Logic/Financial/ExpenseClaim.cs @@ -66,6 +66,7 @@ namespace Swarmops.Logic.Financial get { return Person.FromIdentity (base.ClaimingPersonId); } } + [Obsolete("Obsolete", true)] public void CreateEvent (ExpenseEventType eventType, Person person) { // OBSOLETE diff --git a/Logic/Financial/ExpenseClaims.cs b/Logic/Financial/ExpenseClaims.cs index a9ce9746..d1920394 100644 --- a/Logic/Financial/ExpenseClaims.cs +++ b/Logic/Financial/ExpenseClaims.cs @@ -16,13 +16,7 @@ namespace Swarmops.Logic.Financial get { var result = new ExpenseClaims(); - foreach (ExpenseClaim expense in this) - { - if (expense.Open) - { - result.Add (expense); - } - } + result.AddRange(this.Where(expense => expense.Open)); return result; } @@ -33,13 +27,7 @@ namespace Swarmops.Logic.Financial get { var result = new ExpenseClaims(); - foreach (ExpenseClaim expense in this) - { - if (expense.Approved) - { - result.Add (expense); - } - } + result.AddRange(this.Where(expense => expense.Approved)); return result; } @@ -50,13 +38,7 @@ namespace Swarmops.Logic.Financial get { var result = new ExpenseClaims(); - foreach (ExpenseClaim expense in this) - { - if (!expense.Approved) - { - result.Add (expense); - } - } + result.AddRange(this.Where(expense => !expense.Approved)); return result; } @@ -68,7 +50,7 @@ namespace Swarmops.Logic.Financial get { ExpenseClaims result = new ExpenseClaims(); - result.AddRange(this.Where(expenseClaim => expenseClaim.Attested == false)); + result.AddRange(this.Where(expenseClaim => !expenseClaim.Attested)); return result; } @@ -118,29 +100,15 @@ namespace Swarmops.Logic.Financial { get { - decimal result = 0.0m; - - foreach (ExpenseClaim claim in this) - { - result += claim.Amount; - } - - return result; + return this.Sum(claim => claim.Amount); } } public Int64 TotalAmountCents { - get - { - Int64 result = 0; - - foreach (ExpenseClaim claim in this) - { - result += claim.AmountCents; - } - - return result; + get + { + return this.Sum(claim => claim.AmountCents); } } } diff --git a/Logic/Financial/InboundInvoices.cs b/Logic/Financial/InboundInvoices.cs index dd39f3aa..42934a10 100644 --- a/Logic/Financial/InboundInvoices.cs +++ b/Logic/Financial/InboundInvoices.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text; using Swarmops.Basic.Types; using Swarmops.Database; @@ -10,6 +11,31 @@ namespace Swarmops.Logic.Financial { public class InboundInvoices: PluralBase { + + public InboundInvoices WhereAttested + { + get + { + InboundInvoices result = new InboundInvoices(); + result.AddRange(this.Where(invoice => invoice.Attested == true)); + + return result; + } + } + + + public InboundInvoices WhereUnattested + { + get + { + InboundInvoices result = new InboundInvoices(); + result.AddRange(this.Where(invoice => invoice.Attested == false)); + + return result; + } + } + + /// /// Gets all open inbound invoices for a particular organization. /// diff --git a/Logic/Financial/Salaries.cs b/Logic/Financial/Salaries.cs index b78270bb..b340d635 100644 --- a/Logic/Financial/Salaries.cs +++ b/Logic/Financial/Salaries.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text; using Swarmops.Basic.Types; using Swarmops.Database; @@ -22,18 +23,38 @@ namespace Swarmops.Logic.Financial } + + public Salaries WhereAttested + { + get + { + Salaries result = new Salaries(); + result.AddRange(this.Where(salary => salary.Attested)); + + return result; + } + } + + + + public Salaries WhereUnattested + { + get + { + Salaries result = new Salaries(); + result.AddRange(this.Where(salary => !salary.Attested)); + + return result; + } + } + + + public double TotalAmountNet { get { - double result = 0.0; - - foreach (Salary salary in this) - { - result += salary.NetSalaryCents / 100.0; - } - - return result; + return this.Sum(salary => salary.NetSalaryCents/100.0); } } @@ -41,14 +62,7 @@ namespace Swarmops.Logic.Financial { get { - double result = 0.0; - - foreach (Salary salary in this) - { - result += salary.TaxTotalCents / 100.0; - } - - return result; + return this.Sum(salary => salary.TaxTotalCents/100.0); } } @@ -56,14 +70,7 @@ namespace Swarmops.Logic.Financial { get { - Int64 result = 0; - - foreach (Salary salary in this) - { - result += salary.NetSalaryCents; - } - - return result; + return this.Sum(salary => salary.NetSalaryCents); } } @@ -71,14 +78,7 @@ namespace Swarmops.Logic.Financial { get { - Int64 result = 0; - - foreach (Salary salary in this) - { - result += salary.TaxTotalCents; - } - - return result; + return this.Sum(salary => salary.TaxTotalCents); } } diff --git a/Logic/Financial/Salary.cs b/Logic/Financial/Salary.cs index d428742c..dd616542 100644 --- a/Logic/Financial/Salary.cs +++ b/Logic/Financial/Salary.cs @@ -294,7 +294,9 @@ namespace Swarmops.Logic.Financial public void Deattest(Person deattester) { - throw new NotImplementedException(); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, + FinancialDependencyType.Salary, this.Identity, DateTime.Now, deattester.Identity, this.NetSalaryCents / 100.0); + SwarmDb.GetDatabaseForWriting().SetSalaryAttested(this.Identity, false); } #endregion diff --git a/Logic/Swarm/Parley.cs b/Logic/Swarm/Parley.cs index 63e769a1..48ded44c 100644 --- a/Logic/Swarm/Parley.cs +++ b/Logic/Swarm/Parley.cs @@ -132,32 +132,43 @@ namespace Swarmops.Logic.Swarm return; } - base.Attested = true; - SwarmDb.GetDatabaseForWriting().SetParleyAttested(this.Identity, true); - SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, - FinancialDependencyType.Parley, this.Identity, - DateTime.Now, attester.Identity, (double)(this.GuaranteeDecimal)); - // If needed, create new account for parley - if (base.BudgetId < 0) + FinancialAccount ourBudget; + FinancialAccount parentBudget; + int year = DateTime.Today.Year; + + if (base.BudgetId < 0) // no account created yet { - FinancialAccount newBudget = FinancialAccount.Create(this.Budget.OrganizationId, - "Conf: " + this.Name, - FinancialAccountType.Cost, - this.BudgetId); + ourBudget = FinancialAccount.Create(this.Budget.OrganizationId, + "Conf: " + this.Name, + FinancialAccountType.Cost, + this.BudgetId); - int year = DateTime.Today.Year; - FinancialAccount parentBudget = this.Budget; + parentBudget = this.Budget; - base.BudgetId = newBudget.Identity; - newBudget.Owner = this.Person; - newBudget.SetBudget(DateTime.Today.Year, (double) -this.BudgetDecimal); - parentBudget.SetBudget(DateTime.Today.Year, - (double) parentBudget.GetBudget(year) + (double) this.BudgetDecimal); // cost budgets are negative - - SwarmDb.GetDatabaseForWriting().SetParleyBudget(this.Identity, newBudget.Identity); + base.BudgetId = ourBudget.Identity; + ourBudget.Owner = this.Person; + SwarmDb.GetDatabaseForWriting().SetParleyBudget(this.Identity, ourBudget.Identity); } + else + { + // The budget has been created already - we should already be initialized. Verify this + // by checking that we were already attested once. + + if (!this.AttestedOnce) + { + throw new InvalidOperationException( + "Budget exists despite parley not having been attested. This should not be possible."); + } + + ourBudget = this.Budget; + parentBudget = this.ParentBudget; + } + + ourBudget.SetBudgetCents(DateTime.Today.Year, -this.BudgetCents); + parentBudget.SetBudgetCents(DateTime.Today.Year, + parentBudget.GetBudgetCents(year) + this.BudgetCents); // cost budgets are negative // Reserve the guarantee money @@ -167,9 +178,19 @@ namespace Swarmops.Logic.Swarm guaranteeFundsTx.AddRow(this.Budget, -this.GuaranteeCents, attester); guaranteeFundsTx.AddRow(this.Budget.Parent, this.GuaranteeCents, attester); + // Finally, set as attested + PWEvents.CreateEvent( EventSource.PirateWeb, EventType.ParleyAttested, attester.Identity, this.OrganizationId, 0, 0, this.Identity, string.Empty); + + base.Attested = true; + SwarmDb.GetDatabaseForWriting().SetParleyAttested(this.Identity, true); + SwarmDb.GetDatabaseForWriting().CreateFinancialValidation(FinancialValidationType.Attestation, + FinancialDependencyType.Parley, this.Identity, + DateTime.Now, attester.Identity, (double)(this.GuaranteeDecimal)); + + } public void Deattest(Person deattester) @@ -188,6 +209,24 @@ namespace Swarmops.Logic.Swarm } + public FinancialAccount ParentBudget + { + get + { + // If the financial account for this parley is uninitialized, the BudgetId of base is negative to indicate that. + + if (base.BudgetId < 0) + { + return FinancialAccount.FromIdentity(-base.BudgetId); + } + else + { + return Budget.Parent; + } + } + } + + #endregion public void CloseBudget(Person closingPerson) @@ -209,9 +248,29 @@ namespace Swarmops.Logic.Swarm if (this.BudgetId > 0) // Budget attested and allocated { - this.Budget.Parent.SetBudget(year, - (double)this.Budget.Parent.GetBudget(year) - (double)this.BudgetDecimal); // cost budgets are negative - this.Budget.SetBudget(year, 0.0); + this.Budget.Parent.SetBudgetCents(year, + this.Budget.Parent.GetBudgetCents(year) - this.BudgetCents); // cost budgets are negative + this.Budget.SetBudgetCents(year, 0); + } + } + + private bool AttestedOnce + { + get + { + BasicFinancialValidation[] validations = + SwarmDb.GetDatabaseForReading().GetFinancialValidations(FinancialDependencyType.Parley, + this.Identity); + + foreach (BasicFinancialValidation validation in validations) + { + if (validation.ValidationType == FinancialValidationType.Attestation) + { + return true; + } + } + + return false; } } } diff --git a/Logic/Swarm/Parleys.cs b/Logic/Swarm/Parleys.cs index c93b2b56..1342a1a5 100644 --- a/Logic/Swarm/Parleys.cs +++ b/Logic/Swarm/Parleys.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text; using Swarmops.Basic.Types; using Swarmops.Database; +using Swarmops.Logic.Financial; using Swarmops.Logic.Structure; using Swarmops.Logic.Support; @@ -43,5 +45,20 @@ namespace Swarmops.Logic.Swarm return FromArray(SwarmDb.GetDatabaseForReading().GetParleys(person, DatabaseCondition.OpenTrue)); } } + + public Parleys WhereUnattested + { + get + { + Parleys result = new Parleys(); + result.AddRange(this.Where(parley => !parley.Attested)); + + return result; + } + } + + + + } } diff --git a/Site5/App_GlobalResources/Global.resx b/Site5/App_GlobalResources/Global.resx index c4cb090f..09a1e472 100644 --- a/Site5/App_GlobalResources/Global.resx +++ b/Site5/App_GlobalResources/Global.resx @@ -162,6 +162,21 @@ Advance + + Expense + + + Invoice + + + Invoice + + + Conference + + + Salary + Yearly result diff --git a/Site5/Pages/v5/Financial/AttestCosts.aspx.cs b/Site5/Pages/v5/Financial/AttestCosts.aspx.cs index 2b065627..4c1293e5 100644 --- a/Site5/Pages/v5/Financial/AttestCosts.aspx.cs +++ b/Site5/Pages/v5/Financial/AttestCosts.aspx.cs @@ -110,7 +110,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial { throw new InvalidOperationException("Called to attest out-of-org line item"); } - if (advance.FinancialAccount.OwnerPersonId != currentUserId && advance.FinancialAccount.OwnerPersonId != Person.NobodyId) + if (advance.Budget.OwnerPersonId != currentUserId && advance.Budget.OwnerPersonId != Person.NobodyId) { throw new SecurityAccessDeniedException("Called without attestation privileges"); } @@ -121,6 +121,78 @@ namespace Swarmops.Frontend.Pages.v5.Financial beneficiary = advance.Person.Name; amountCents = advance.AmountCents; + break; + case 'E': // Expense claim + ExpenseClaim expense = ExpenseClaim.FromIdentity(itemId); + if (expense.OrganizationId != currentOrganizationId) + { + throw new InvalidOperationException("Called to attest out-of-org line item"); + } + if (expense.Budget.OwnerPersonId != currentUserId && expense.Budget.OwnerPersonId != Person.NobodyId) + { + throw new SecurityAccessDeniedException("Called without attestation privileges"); + } + + attestableItem = expense; + attestedTemplate = Resources.Pages.Financial.AttestCosts_ExpenseAttested; + deattestedTemplate = Resources.Pages.Financial.AttestCosts_ExpenseDeattested; + beneficiary = expense.Claimer.Name; + amountCents = expense.AmountCents; + + break; + case 'I': // Inbound invoice + InboundInvoice invoice = InboundInvoice.FromIdentity(itemId); + if (invoice.OrganizationId != currentOrganizationId) + { + throw new InvalidOperationException("Called to attest out-of-org line item"); + } + if (invoice.Budget.OwnerPersonId != currentUserId && invoice.Budget.OwnerPersonId != Person.NobodyId) + { + throw new SecurityAccessDeniedException("Called without attestation privileges"); + } + + attestableItem = invoice; + attestedTemplate = Resources.Pages.Financial.AttestCosts_InvoiceAttested; + deattestedTemplate = Resources.Pages.Financial.AttestCosts_InvoiceDeattested; + beneficiary = invoice.Supplier; + amountCents = invoice.AmountCents; + + break; + case 'S': // Salary payout + Salary salary = Salary.FromIdentity(itemId); + if (salary.PayrollItem.OrganizationId != currentOrganizationId) + { + throw new InvalidOperationException("Called to attest out-of-org line item"); + } + if (salary.PayrollItem.Budget.OwnerPersonId != currentUserId && salary.PayrollItem.Budget.OwnerPersonId != Person.NobodyId) + { + throw new SecurityAccessDeniedException("Called without attestation privileges"); + } + + attestableItem = salary; + attestedTemplate = Resources.Pages.Financial.AttestCosts_SalaryAttested; + deattestedTemplate = Resources.Pages.Financial.AttestCosts_SalaryDeattested; + beneficiary = salary.PayrollItem.PersonCanonical; + amountCents = salary.GrossSalaryCents; + + break; + case 'P': // Parley, aka Conference + Parley parley = Parley.FromIdentity(itemId); + if (parley.OrganizationId != currentOrganizationId) + { + throw new InvalidOperationException("Called to attest out-of-org line item"); + } + if (parley.Budget.OwnerPersonId != currentUserId && parley.Budget.OwnerPersonId != Person.NobodyId) + { + throw new SecurityAccessDeniedException("Called without attestation privileges"); + } + + attestableItem = parley; + attestedTemplate = Resources.Pages.Financial.AttestCosts_ParleyAttested; + deattestedTemplate = Resources.Pages.Financial.AttestCosts_ParleyDeattested; + beneficiary = parley.Person.Name; + amountCents = parley.BudgetCents; + break; default: throw new InvalidOperationException("Unknown Cost Type in HandleAttestationDeattestation: \"" + identifier + "\""); diff --git a/Site5/Pages/v5/Financial/Json-AttestableCosts.aspx.cs b/Site5/Pages/v5/Financial/Json-AttestableCosts.aspx.cs index 71760f65..d77c616f 100644 --- a/Site5/Pages/v5/Financial/Json-AttestableCosts.aspx.cs +++ b/Site5/Pages/v5/Financial/Json-AttestableCosts.aspx.cs @@ -10,6 +10,7 @@ using Swarmops.Basic.Interfaces; using Swarmops.Logic.Financial; using Swarmops.Logic.Security; using Swarmops.Logic.Structure; +using Swarmops.Logic.Support; using Swarmops.Logic.Swarm; public partial class Pages_v5_Finance_Json_AttestableCosts : System.Web.UI.Page @@ -42,6 +43,10 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : System.Web.UI.Page _items = new AttestableItems(); PopulateCashAdvances(); + PopulateExpenses(); + PopulateInboundInvoices(); + PopulateSalaries(); + PopulateParleys(); // Format as JSON and return @@ -86,7 +91,7 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : System.Web.UI.Page protected class AttestableItem { - public AttestableItem(string identity, string beneficiary, Int64 amountCents, FinancialAccount account, string description, string identityDisplay, IHasIdentity item) + public AttestableItem(string identity, string beneficiary, Int64 amountCents, FinancialAccount account, string description, string identityDisplay, bool hasDox, IHasIdentity item) { this.IdentityDisplay = identityDisplay; this.Identity = identity; @@ -94,6 +99,7 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : System.Web.UI.Page this.AmountRequestedCents = amountCents; this.Budget = account; this.Description = description; + this.HasDox = hasDox; this.Item = item; } @@ -105,6 +111,7 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : System.Web.UI.Page public string Description { get; private set; } public string IdentityDisplay { get; private set; } public IHasIdentity Item { get; private set; } + public bool HasDox { get; private set; } } protected class AttestableItems : List @@ -141,7 +148,12 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : System.Web.UI.Page foreach (CashAdvance advance in advances) { - _items.Add(new AttestableItem("A" + advance.Identity.ToString(CultureInfo.InvariantCulture), advance.Person.Name, advance.AmountCents, advance.FinancialAccount, advance.Description, "Financial_CashAdvance", advance)); + if (_attestationRights.ContainsKey(advance.BudgetId) || advance.Budget.OwnerPersonId == Person.NobodyId) + { + _items.Add(new AttestableItem("A" + advance.Identity.ToString(CultureInfo.InvariantCulture), + advance.Person.Name, advance.AmountCents, advance.Budget, + advance.Description, "Financial_CashAdvance", false, advance)); + } } } @@ -149,6 +161,62 @@ public partial class Pages_v5_Finance_Json_AttestableCosts : System.Web.UI.Page private void PopulateExpenses() { ExpenseClaims expenses = ExpenseClaims.ForOrganization(_currentOrganization).WhereUnattested; + + foreach (var expenseClaim in expenses) + { + if (_attestationRights.ContainsKey(expenseClaim.BudgetId) || expenseClaim.Budget.OwnerPersonId == Person.NobodyId) + { + Documents dox = expenseClaim.Documents; + bool hasDox = (dox.Count > 0 ? true : false); + + _items.Add(new AttestableItem("E" + expenseClaim.Identity.ToString(CultureInfo.InvariantCulture), expenseClaim.ClaimerCanonical, expenseClaim.AmountCents, expenseClaim.Budget, expenseClaim.Description, "Financial_ExpenseClaim", hasDox, expenseClaim)); + } + } + } + + + private void PopulateInboundInvoices() + { + InboundInvoices invoices = InboundInvoices.ForOrganization(_currentOrganization).WhereUnattested; + + foreach (InboundInvoice invoice in invoices) + { + Documents dox = invoice.Documents; + bool hasDox = (dox.Count > 0 ? true : false); + + if (_attestationRights.ContainsKey(invoice.BudgetId) || invoice.Budget.OwnerPersonId == Person.NobodyId) + { + _items.Add(new AttestableItem("I" + invoice.Identity.ToString(CultureInfo.InvariantCulture), invoice.Supplier, invoice.AmountCents, invoice.Budget, invoice.InvoiceReference, "Financial_InvoiceInbound", hasDox, invoice)); + } + } + } + + + private void PopulateSalaries() + { + Salaries salaries = Salaries.ForOrganization(_currentOrganization).WhereUnattested; + + foreach (Salary salary in salaries) + { + if (_attestationRights.ContainsKey(salary.PayrollItem.BudgetId) || salary.PayrollItem.Budget.OwnerPersonId == Person.NobodyId) + { + _items.Add(new AttestableItem("S" + salary.Identity.ToString(CultureInfo.InvariantCulture), salary.PayrollItem.PersonCanonical, salary.CostTotalCents, salary.PayrollItem.Budget, string.Format("Salary for {0:yyyy-MMM}", salary.PayoutDate), "Financial_Salary", false, salary)); + } + } + } + + + private void PopulateParleys() + { + Parleys parleys = Parleys.ForOrganization(_currentOrganization).WhereUnattested; + + foreach (Parley parley in parleys) + { + if (_attestationRights.ContainsKey(parley.BudgetId) || parley.Budget.OwnerPersonId == Person.NobodyId) + { + _items.Add(new AttestableItem("P" + parley.Identity.ToString(CultureInfo.InvariantCulture), parley.Person.Canonical, parley.BudgetCents, parley.ParentBudget, parley.Name, "Financial_Parley", false, parley)); + } + } } } \ No newline at end of file