diff --git a/Basic/Enums/ObjectOptionalDataType.cs b/Basic/Enums/ObjectOptionalDataType.cs
index 256ee32a..36cae4fa 100644
--- a/Basic/Enums/ObjectOptionalDataType.cs
+++ b/Basic/Enums/ObjectOptionalDataType.cs
@@ -7,7 +7,8 @@ namespace Swarmops.Basic.Enums
Person,
FinancialAccount,
Organization,
- OutboundInvoice
+ OutboundInvoice,
+ InboundInvoice
}
public enum ObjectOptionalDataType
@@ -204,8 +205,11 @@ namespace Swarmops.Basic.Enums
///
/// Temporary mechanism for the Swarmops Red release: a coarse access list (read-only access)
///
- OrgTemporaryAccessListRead
-
+ OrgTemporaryAccessListRead,
+ ///
+ /// Free-text description of an inbound invoice (what's it for?)
+ ///
+ InboundInvoiceDescription
}
}
diff --git a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs
index b89c5583..a16d5d7c 100644
--- a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs
+++ b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.1008
+// Runtime Version:4.0.30319.1022
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -111,7 +111,7 @@ namespace Swarmops.Logic.App_GlobalResources {
}
///
- /// Looks up a localized string similar to [OrganizationName] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed.
+ /// Looks up a localized string similar to (ACTION ITEM) [OrganizationName] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed.
///
internal static string CashAdvance_Requested_Subject {
get {
@@ -149,7 +149,7 @@ namespace Swarmops.Logic.App_GlobalResources {
}
///
- /// Looks up a localized string similar to [OrganizationName] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed.
+ /// Looks up a localized string similar to (ACTION ITEM) [OrganizationName] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed.
///
internal static string ExpenseClaim_Created_Subject {
get {
@@ -235,6 +235,46 @@ namespace Swarmops.Logic.App_GlobalResources {
}
}
+ ///
+ /// 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 Swarmops at [SystemUrl] to attest or deny..
+ ///
+ internal static string InboundInvoice_Created_Body {
+ get {
+ return ResourceManager.GetString("InboundInvoice_Created_Body", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to (ACTION ITEM) [OrganizationName] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed.
+ ///
+ internal static string InboundInvoice_Created_Subject {
+ get {
+ return ResourceManager.GetString("InboundInvoice_Created_Subject", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Receipts have been filed that need validation for their financial processes to continue.
+ ///
+ ///Please log on to Swarmops at [SystemUrl] to confirm or reject them..
+ ///
+ internal static string Receipts_Filed_Body {
+ get {
+ return ResourceManager.GetString("Receipts_Filed_Body", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to (ACTION ITEM) [OrganizationName] Receipts Filed - Validation Needed.
+ ///
+ internal static string Receipts_Filed_Subject {
+ get {
+ return ResourceManager.GetString("Receipts_Filed_Subject", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to An unhandled exception was thrown in Swarmops:
///
diff --git a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx
index 0eefc753..2f4d1123 100644
--- a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx
+++ b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx
@@ -138,7 +138,7 @@ Please log on to Swarmops at [SystemUrl] to attest or deny.
This is sent to the budget owner(s) only.
- [OrganizationName] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed
+ (ACTION ITEM) [OrganizationName] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed
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.
@@ -154,7 +154,8 @@ Please log on to Swarmops at [SystemUrl] to attest or deny.
This is sent to the budget owner(s)only.
- [OrganizationName] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed
+ (ACTION ITEM) [OrganizationName] 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.
@@ -189,6 +190,22 @@ The claim will be paid out to you when the amount has also been attested by the
[OrganizationName] Expense Claim Receipts Validated: [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 Swarmops at [SystemUrl] to attest or deny.
+
+
+ (ACTION ITEM) [OrganizationName] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed
+
+
+ Receipts have been filed that need validation for their financial processes to continue.
+
+Please log on to Swarmops at [SystemUrl] to confirm or reject them.
+
+
+ (ACTION ITEM) [OrganizationName] Receipts Filed - Validation Needed
+
An unhandled exception was thrown in Swarmops:
diff --git a/Logic/Communications/OutboundComm.cs b/Logic/Communications/OutboundComm.cs
index 4cbdd990..a8fe7478 100644
--- a/Logic/Communications/OutboundComm.cs
+++ b/Logic/Communications/OutboundComm.cs
@@ -95,13 +95,15 @@ namespace Swarmops.Logic.Communications
}
- public static OutboundComm CreateNotificationForAttest(FinancialAccount budget, Person concernedPerson, double amountRequested, string purpose, NotificationResource notification)
+ public static OutboundComm CreateNotificationAttestationNeeded(FinancialAccount budget, Person concernedPerson, string supplier, double amountRequested, string purpose, NotificationResource notification)
{
NotificationPayload payload = new NotificationPayload(notification.ToString());
payload.Strings[NotificationString.CurrencyCode] = budget.Organization.Currency.Code;
payload.Strings[NotificationString.OrganizationName] = budget.Organization.Name;
payload.Strings[NotificationString.BudgetAmountFloat] = amountRequested.ToString(CultureInfo.InvariantCulture);
payload.Strings[NotificationString.RequestPurpose] = purpose;
+ payload.Strings[NotificationString.Description] = purpose;
+ payload.Strings[NotificationString.Supplier] = supplier;
payload.Strings[NotificationString.BudgetName] = budget.Name;
payload.Strings[NotificationString.ConcernedPersonName] = concernedPerson.Canonical;
@@ -126,6 +128,32 @@ namespace Swarmops.Logic.Communications
}
+ public static OutboundComm CreateNotificationFinancialValidationNeeded (Organization organization, double amountRequested, NotificationResource notification)
+ {
+ NotificationPayload payload = new NotificationPayload(notification.ToString());
+ payload.Strings[NotificationString.CurrencyCode] = organization.Currency.Code;
+ payload.Strings[NotificationString.OrganizationName] = organization.Name;
+ payload.Strings[NotificationString.BudgetAmountFloat] = amountRequested.ToString(CultureInfo.InvariantCulture);
+
+ OutboundComm comm = OutboundComm.Create(null, null, organization, CommResolverClass.Unknown, null,
+ CommTransmitterClass.CommsTransmitterMail,
+ new PayloadEnvelope(payload).ToXml(),
+ OutboundCommPriority.Low);
+
+ People validators = organization.ValidatingPeople;
+
+ foreach (Person validator in validators)
+ {
+ comm.AddRecipient(validator);
+ }
+
+ comm.Resolved = true;
+
+ return comm;
+
+ }
+
+
public static OutboundComm CreateNotificationOfFinancialValidation(FinancialAccount budget, Person concernedPerson, double amountRequested, string purpose, NotificationResource notification)
{
NotificationPayload payload = new NotificationPayload(notification.ToString());
diff --git a/Logic/Communications/Transmission/NotificationPayload.cs b/Logic/Communications/Transmission/NotificationPayload.cs
index 628aeb29..9d482602 100644
--- a/Logic/Communications/Transmission/NotificationPayload.cs
+++ b/Logic/Communications/Transmission/NotificationPayload.cs
@@ -103,7 +103,9 @@ namespace Swarmops.Logic.Communications.Transmission
ExpenseClaim_Denied,
ExpenseClaim_Adjusted,
ExpenseClaim_Rebudgeted,
- Payout_Settled
+ Payout_Settled,
+ InboundInvoice_Created,
+ Receipts_Filed
}
// ReSharper restore InconsistentNaming
@@ -123,7 +125,9 @@ namespace Swarmops.Logic.Communications.Transmission
EmbeddedPreformattedText,
RequestPurpose,
HostName,
- SwarmopsVersion
+ SwarmopsVersion,
+ Supplier,
+ Description
}
[Serializable]
diff --git a/Logic/Financial/CashAdvance.cs b/Logic/Financial/CashAdvance.cs
index 5e7b15dc..1cdddecd 100644
--- a/Logic/Financial/CashAdvance.cs
+++ b/Logic/Financial/CashAdvance.cs
@@ -47,7 +47,7 @@ namespace Swarmops.Logic.Financial
budget.Identity, amountCents,
description));
- OutboundComm.CreateNotificationForAttest(budget, forPerson, (double) amountCents/100.0, description, NotificationResource.CashAdvance_Requested); // Slightly misplaced logic, but failsafer here
+ OutboundComm.CreateNotificationAttestationNeeded(budget, forPerson, string.Empty, (double) amountCents/100.0, description, NotificationResource.CashAdvance_Requested); // Slightly misplaced logic, but failsafer here
SwarmopsLogEntry.Create(forPerson,
new CashAdvanceRequestedLogEntry(createdByPerson, forPerson, (double) amountCents/100.0, budget, description),
newAdvance);
diff --git a/Logic/Financial/ExpenseClaim.cs b/Logic/Financial/ExpenseClaim.cs
index 53f06859..4749010f 100644
--- a/Logic/Financial/ExpenseClaim.cs
+++ b/Logic/Financial/ExpenseClaim.cs
@@ -64,9 +64,11 @@ namespace Swarmops.Logic.Financial
transaction.Dependency = newClaim;
- // Create notification
+ // Create notifications
- OutboundComm.CreateNotificationForAttest(budget, claimer, (double)amountCents / 100.0, description, NotificationResource.ExpenseClaim_Created); // Slightly misplaced logic, but failsafer here
+ OutboundComm.CreateNotificationAttestationNeeded(budget, claimer, string.Empty, (double)amountCents / 100.0, description, NotificationResource.ExpenseClaim_Created); // Slightly misplaced logic, but failsafer here
+ OutboundComm.CreateNotificationFinancialValidationNeeded(organization, (double) amountCents/100.0,
+ NotificationResource.Receipts_Filed);
SwarmopsLogEntry.Create(claimer,
new ExpenseClaimFiledLogEntry(claimer /*filing person*/, claimer /*beneficiary*/, (double) amountCents/100.0, budget, description), newClaim);
diff --git a/Logic/Financial/InboundInvoice.cs b/Logic/Financial/InboundInvoice.cs
index 60615149..ee5007ef 100644
--- a/Logic/Financial/InboundInvoice.cs
+++ b/Logic/Financial/InboundInvoice.cs
@@ -4,6 +4,9 @@ using System.Text;
using Swarmops.Basic.Enums;
using Swarmops.Basic.Types;
using Swarmops.Database;
+using Swarmops.Logic.Communications;
+using Swarmops.Logic.Communications.Transmission;
+using Swarmops.Logic.Support.LogEntries;
using Swarmops.Logic.Swarm;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Support;
@@ -13,7 +16,7 @@ namespace Swarmops.Logic.Financial
public class InboundInvoice: BasicInboundInvoice, IAttestable
{
public static InboundInvoice Create (Organization organization, DateTime dueDate, Int64 amountCents,
- FinancialAccount budget, string supplier, string payToAccount, string ocr,
+ FinancialAccount budget, string supplier, string description, string payToAccount, string ocr,
string invoiceReference, Person creatingPerson)
{
InboundInvoice newInvoice = FromIdentity(SwarmDb.GetDatabaseForWriting().
@@ -21,6 +24,8 @@ namespace Swarmops.Logic.Financial
supplier, payToAccount, ocr,
invoiceReference, amountCents, creatingPerson.Identity));
+ newInvoice.Description = description; // Not in original schema; not cause for schema update
+
// Create a corresponding financial transaction with rows
FinancialTransaction transaction =
@@ -33,6 +38,13 @@ namespace Swarmops.Logic.Financial
// Make the transaction dependent on the inbound invoice
transaction.Dependency = newInvoice;
+
+ // Create notification (slightly misplaced logic, but this is failsafest place)
+
+ OutboundComm.CreateNotificationAttestationNeeded(budget, creatingPerson, supplier, (double)amountCents / 100.0, description, NotificationResource.InboundInvoice_Created); // Slightly misplaced logic, but failsafer here
+ SwarmopsLogEntry.Create(creatingPerson,
+ new InboundInvoiceCreatedLogEntry(creatingPerson, supplier, description, (double)amountCents / 100.0, budget), newInvoice);
+
return newInvoice;
}
@@ -176,6 +188,21 @@ namespace Swarmops.Logic.Financial
}
+ public string Description
+ {
+ get
+ {
+ return
+ ObjectOptionalData.ForObject(this).GetOptionalDataString(
+ ObjectOptionalDataType.InboundInvoiceDescription);
+ }
+
+ set
+ {
+ ObjectOptionalData.ForObject(this).SetOptionalDataString(ObjectOptionalDataType.InboundInvoiceDescription, value);
+ }
+ }
+
#region IAttestable Members
diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj
index 840151da..72acdf8b 100644
--- a/Logic/Logic.csproj
+++ b/Logic/Logic.csproj
@@ -218,6 +218,7 @@
+
diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs
index f1900f10..5cb9545e 100644
--- a/Logic/Structure/Organization.cs
+++ b/Logic/Structure/Organization.cs
@@ -862,5 +862,27 @@ namespace Swarmops.Logic.Structure
return new DateTime(year, 12, 31, 23, 59, 59, 999);
}
+
+
+ public People ValidatingPeople
+ {
+ get
+ {
+ People result = new People();
+
+ // HACK: this gets the TEMPORARY list
+
+ string peopleIdstring = Parameters.TemporaryAccessListWrite;
+ string[] peopleIds = peopleIdstring.Split(' ');
+
+ foreach (string peopleId in peopleIds)
+ {
+ result.Add(Person.FromIdentity(Int32.Parse(peopleId)));
+ }
+
+ return result;
+ }
+ }
+
}
}
\ No newline at end of file
diff --git a/Logic/Support/LogEntries/InboundInvoiceCreatedLogEntry.cs b/Logic/Support/LogEntries/InboundInvoiceCreatedLogEntry.cs
new file mode 100644
index 00000000..d9c8977b
--- /dev/null
+++ b/Logic/Support/LogEntries/InboundInvoiceCreatedLogEntry.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Swarmops.Logic.Financial;
+using Swarmops.Logic.Swarm;
+
+namespace Swarmops.Logic.Support.LogEntries
+{
+ [Serializable]
+ public class InboundInvoiceCreatedLogEntry: FinancialActionBase
+ {
+ public InboundInvoiceCreatedLogEntry()
+ {
+ // empty ctor needed for serialize
+ }
+
+ public InboundInvoiceCreatedLogEntry(Person creatingPerson, string supplier, string description, double amount, FinancialAccount budget)
+ {
+ this.Amount = amount;
+ this.Currency = budget.Organization.Currency.Code;
+ this.DateTime = DateTime.UtcNow;
+ this.Description = description;
+ this.OrganizationId = budget.OrganizationId;
+ this.FinancialAccountId = budget.Identity;
+ this.FinancialAccountName = budget.Name; // redundancy in case of future name changes
+ this.OwnerPersonId = budget.OwnerPersonId;
+ this.OwnerPersonName = budget.OwnerPersonId != 0 ? budget.Owner.Name : string.Empty;
+ this.ActingPersonId = creatingPerson.Identity; // do not save name for data retention reasons
+ this.BeneficiaryPersonId = 0;
+ this.Supplier = supplier;
+ }
+
+ public string Supplier { get; set; }
+ }
+}
diff --git a/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs b/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs
index 580d7590..da5496d7 100644
--- a/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs
+++ b/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs
@@ -164,7 +164,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
}
InboundInvoice invoice = InboundInvoice.Create(CurrentOrganization, dueDate, amountCents, budget,
- this.TextSupplier.Text, this.TextAccount.Text, string.Empty,
+ this.TextSupplier.Text, this.TextPurpose.Text, this.TextAccount.Text, string.Empty,
this.TextReference.Text, CurrentUser);
foreach (int tagSetId in _tagSetIds)