diff --git a/Logic/DashboardTasks/Tasks.cs b/Logic/DashboardTasks/Tasks.cs index 072edd34..2dee5841 100644 --- a/Logic/DashboardTasks/Tasks.cs +++ b/Logic/DashboardTasks/Tasks.cs @@ -121,12 +121,14 @@ namespace Swarmops.Logic.DashboardTasks private void AddReceiptValidation (Person person, Organization organization) { - TaskGroup group = new TaskGroup (TaskGroupType.ValidateExpenseClaims); throw new NotImplementedException(); // not moved to v5 framework (undecided whether it will happen) // TODO: Loop over roles, get all open claims for roles where person can attest /* + + TaskGroup group = new TaskGroup (TaskGroupType.ValidateExpenseClaims); + if ( !person.GetAuthority() .HasPermission (Permission.CanDoEconomyTransactions, organization.Identity, Geography.RootIdentity, @@ -181,13 +183,14 @@ namespace Swarmops.Logic.DashboardTasks private void AddPayouts (Person person, Organization organization) { - TaskGroup group = new TaskGroup (TaskGroupType.Payout); - TaskGroup groupUrgent = new TaskGroup (TaskGroupType.PayoutUrgently); - TaskGroup groupOverdue = new TaskGroup (TaskGroupType.PayoutOverdue); - throw new NotImplementedException(); // not moved to v5 framework (undecided whether it will happen) /* + + TaskGroup group = new TaskGroup (TaskGroupType.Payout); + TaskGroup groupUrgent = new TaskGroup (TaskGroupType.PayoutUrgently); + TaskGroup groupOverdue = new TaskGroup (TaskGroupType.PayoutOverdue); + if ( !person.GetAuthority() .HasPermission (Permission.CanPayOutMoney, organization.Identity, 1, diff --git a/Logic/Financial/Payout.cs b/Logic/Financial/Payout.cs index 3f9ab23d..15a53ba0 100644 --- a/Logic/Financial/Payout.cs +++ b/Logic/Financial/Payout.cs @@ -695,18 +695,9 @@ namespace Swarmops.Logic.Financial salary.TaxPaid = true; } - string referenceString = string.Empty; - Organization organization = Organization.FromIdentity (organizationId); - if (identityList.Count == 1) - { - referenceString = "Tax for salary #" + identityList[0]; - } - else - { - identityList.Sort(); - referenceString = "Tax for salaries " + Formatting.GenerateRangeString (identityList); - } + Organization organization = Organization.FromIdentity (organizationId); + identityList.Sort(); payoutId = SwarmDb.GetDatabaseForWriting() .CreatePayout (organization.Identity, "The Tax Man", organization.Parameters.TaxAccount, diff --git a/Logic/Financial/Payouts.cs b/Logic/Financial/Payouts.cs index 72ca5e30..25f6588a 100644 --- a/Logic/Financial/Payouts.cs +++ b/Logic/Financial/Payouts.cs @@ -428,9 +428,10 @@ namespace Swarmops.Logic.Financial try { - FinancialTransaction tiedTransaction = FinancialTransaction.FromDependency (payout); + // If this succeeds, there is a transaction already + + FinancialTransaction.FromDependency(payout); - // Console.WriteLine(" - - - but is tied to transaction #{0} already", tiedTransaction.Identity); break; } catch (Exception) @@ -465,6 +466,8 @@ namespace Swarmops.Logic.Financial throw new NotImplementedException("Waiting for rewrite for Bitcoin Cash"); + // TODO + DateTime utcNow = DateTime.UtcNow; foreach (Organization organization in Organizations.GetAll()) diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index 6f460add..a47755e0 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -432,7 +432,6 @@ - diff --git a/Logic/Support/BackendServices/RasterizeDocumentHiresOrder.cs b/Logic/Support/BackendServices/RasterizeDocumentHiresOrder.cs index dd015d77..aaa717f2 100644 --- a/Logic/Support/BackendServices/RasterizeDocumentHiresOrder.cs +++ b/Logic/Support/BackendServices/RasterizeDocumentHiresOrder.cs @@ -22,7 +22,6 @@ namespace Swarmops.Logic.Support.BackendServices public override void Run() { - Document document = Document.FromIdentity(this.DocumentId); HasWorkerThread = true; WorkerThread = new Thread(LongRun); WorkerThread.Start(this); diff --git a/Logic/Swarm/AuditedPerson.cs b/Logic/Swarm/AuditedPerson.cs deleted file mode 100644 index 35225a24..00000000 --- a/Logic/Swarm/AuditedPerson.cs +++ /dev/null @@ -1,307 +0,0 @@ -using System; -using Swarmops.Common.Enums; -using Swarmops.Logic.Structure; -using Swarmops.Logic.Support; - -namespace Swarmops.Logic.Swarm -{ - public class AuditedPerson - { - private readonly Person person; - private string actionDescr = ""; - private Person executor; - - protected AuditedPerson (Person person) - { - this.person = person; - this.executor = null; - this.actionDescr = ""; - } - - public virtual string Name - { - get { return this.person.Name; } - set - { - AuditField ("Name", Name, value); - this.person.Name = value; - } - } - - - public virtual string Street - { - get { return this.person.Street; } - set - { - AuditField ("Street", Street, value); - this.person.Street = value; - } - } - - - public virtual string PostalCode - { - get { return this.person.PostalCode; } - set - { - AuditField ("PostalCode", PostalCode, value); - this.person.PostalCode = value; - } - } - - - public virtual string City - { - get { return this.person.CityName; } - set - { - AuditField ("City", City, value); - this.person.CityName = value; - } - } - - - public virtual Country Country - { - get { return this.person.Country; } - set - { - AuditField ("Country", Country == null ? "" : Country.Identity.ToString(), - value == null ? "" : value.Identity.ToString()); - this.person.Country = value; - } - } - - - public virtual Geography Geography - { - get { return this.person.Geography; } - set - { - AuditField ("Geography", Geography == null ? "" : Geography.Identity.ToString(), - value == null ? "" : value.Identity.ToString()); - this.person.Geography = value; - } - } - - - public virtual string Email - { - get { return this.person.Mail; } - set - { - AuditField ("Email", Email, value); - this.person.Mail = value; - } - } - - - public virtual string Phone - { - get { return this.person.Phone; } - set - { - AuditField ("Phone", Phone, value); - this.person.Phone = value; - } - } - - - public virtual DateTime Birthdate - { - get { return this.person.Birthdate; } - set - { - AuditField ("Birthdate", Birthdate.ToString(), value.ToString()); - this.person.Birthdate = value; - } - } - - public virtual PersonGender Gender - { - get { return this.person.Gender; } - set - { - AuditField ("Gender", Gender.ToString(), value.ToString()); - this.person.Gender = value; - } - } - - - // Optional data properties - - public virtual string PartyEmail - { - get { return this.person.PartyEmail; } - set - { - AuditField ("PartyEmail", PartyEmail, value); - this.person.PartyEmail = value; - } - } - - - public virtual string BankName - { - get { return this.person.BankName; } - set - { - AuditField ("BankName", BankName, value); - this.person.BankName = value; - } - } - - - public virtual string BankAccount - { - get { return this.person.BankAccount; } - set - { - AuditField ("BankAccount", BankAccount, value); - this.person.BankAccount = value; - } - } - - - public virtual string BankClearing - { - get { return this.person.BankClearing; } - set - { - AuditField ("BankClearing", BankClearing, value); - this.person.BankClearing = value; - } - } - - [Obsolete ("Use NationalIdNumber instead")] - public virtual string PersonalNumber - { - get { return this.person.PersonalNumber; } - set - { - AuditField ("PersonalNumber", PersonalNumber, value); - this.person.PersonalNumber = value; - } - } - - public virtual bool MailUnreachable - { - get { return this.person.MailUnreachable; } - set - { - AuditField ("MailUnreachable", MailUnreachable.ToString(), value.ToString()); - this.person.MailUnreachable = value; - } - } - - public virtual bool LimitMailToLatin1 - { - get { return this.person.LimitMailToLatin1; } - set - { - AuditField ("LimitMailToLatin1", LimitMailToLatin1.ToString(), value.ToString()); - this.person.LimitMailToLatin1 = value; - } - } - - public virtual bool LimitMailToText - { - get { return this.person.LimitMailToText; } - set - { - AuditField ("LimitMailToText", LimitMailToText.ToString(), value.ToString()); - this.person.LimitMailToText = value; - } - } - - public virtual bool NeverMail - { - get { return this.person.NeverMail; } - set - { - AuditField ("NeverMail", NeverMail.ToString(), value.ToString()); - this.person.NeverMail = value; - } - } - - public virtual bool EMailIsInvalid - { - get { return this.person.EMailIsInvalid; } - set - { - AuditField ("EMailIsInvalid", EMailIsInvalid.ToString(), value.ToString()); - this.person.EMailIsInvalid = value; - } - } - - - public virtual string Handle - { - get { return this.person.Handle; } - set - { - AuditField ("Handle", Handle, value); - this.person.Handle = value; - } - } - - public virtual int SwedishForumAccountId - { - get { return this.person.SwedishForumAccountId; } - set - { - AuditField ("SwedishForumAccountId", SwedishForumAccountId.ToString(), value.ToString()); - this.person.SwedishForumAccountId = value; - } - } - - public static implicit operator Person (AuditedPerson a) - { - return a.person; - } - - - public static AuditedPerson FromPerson (Person person) - { - return new AuditedPerson (person); - } - - public static AuditedPerson FromPerson (Person person, Person executor, string actionDescr) - { - AuditedPerson ap = new AuditedPerson (person); - ap.SetAudit (executor, actionDescr); - return ap; - } - - public void SetAudit (Person executor, string actionDescr) - { - this.executor = executor; - this.actionDescr = actionDescr; - } - - protected void AuditField (string field, string oldVal, string newVal) - { - if (this.executor != null && ("" + oldVal).Trim() != ("" + newVal).Trim()) - { - //PWLog.Write (this.executor, PWLogItem.Person, this.person.Identity, PWLogAction.PersonFieldChange, - // this.actionDescr, "", field, "" + oldVal, "" + newVal); - - // TODO: New log format - } - } - - - public virtual void SetPassword (string newPassword) - { - AuditField ("SetPassword", "oldpassword", "newpassword"); - this.person.SetPassword (newPassword); - } - - public virtual void SetSubscription (int newsletterFeedId, bool subscribe) - { - AuditField ("SetSubscription", "Feed:" + newsletterFeedId, "" + subscribe); - this.person.SetSubscription (newsletterFeedId, subscribe); - } - } -} \ No newline at end of file diff --git a/Logic/Swarm/PaymentCode.cs b/Logic/Swarm/PaymentCode.cs index 338bd7cb..0fbbae0d 100644 --- a/Logic/Swarm/PaymentCode.cs +++ b/Logic/Swarm/PaymentCode.cs @@ -50,7 +50,7 @@ namespace Swarmops.Logic.Swarm try { - int codeId = SwarmDb.GetDatabaseForWriting().CreatePaymentCode (randomCode, phoneNumber, personId); + SwarmDb.GetDatabaseForWriting().CreatePaymentCode (randomCode, phoneNumber, personId); success = true; return FromBasic (SwarmDb.GetDatabaseForReading().GetPaymentCode (randomCode)); }