From 81059f41b3e70ace03c89049fb5e823be3f24815 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Wed, 1 Jan 2014 07:27:52 +0000 Subject: [PATCH] Fixed some stupid errors re. tags, added VisibilityLevel field --- .../BasicFinancialTransactionTagSet.cs | 6 ++- .../Database-FinancialTransactionTagSets.cs | 7 ++-- ...ialTransactionTagSetTypesStock.Designer.cs | 4 +- ....FinancialTransactionTagSetTypesStock.resx | 2 +- .../v5/Financial/CreateInboundInvoice.aspx.cs | 24 ++++++++---- .../v5/Financial/FileExpenseClaim.aspx.cs | 38 ++++++++++++------- 6 files changed, 52 insertions(+), 29 deletions(-) diff --git a/Basic/Types/Financial/BasicFinancialTransactionTagSet.cs b/Basic/Types/Financial/BasicFinancialTransactionTagSet.cs index 31332eac..fe3e6192 100644 --- a/Basic/Types/Financial/BasicFinancialTransactionTagSet.cs +++ b/Basic/Types/Financial/BasicFinancialTransactionTagSet.cs @@ -8,18 +8,19 @@ namespace Swarmops.Basic.Types.Financial { public class BasicFinancialTransactionTagSet: IHasIdentity { - public BasicFinancialTransactionTagSet (int financialTransactionTagSetId, int financialTransactionTagSetTypeId, int organizationId, int order, bool allowUntagged, int profitLossType) + public BasicFinancialTransactionTagSet (int financialTransactionTagSetId, int financialTransactionTagSetTypeId, int organizationId, int order, bool allowUntagged, int visibilityLevel, int profitLossType) { this.FinancialTransactionTagSetId = financialTransactionTagSetId; this.FinancialTransactionTagSetTypeId = financialTransactionTagSetTypeId; this.OrganizationId = organizationId; this.Order = order; this.AllowUntagged = allowUntagged; + this.VisibilityLevel = visibilityLevel; this.ProfitLossType = profitLossType; } public BasicFinancialTransactionTagSet (BasicFinancialTransactionTagSet original): - this (original.FinancialTransactionTagSetId, original.FinancialTransactionTagSetTypeId, original.OrganizationId, original.Order, original.AllowUntagged, original.ProfitLossType) + this (original.FinancialTransactionTagSetId, original.FinancialTransactionTagSetTypeId, original.OrganizationId, original.Order, original.AllowUntagged, original.VisibilityLevel, original.ProfitLossType) { // copy ctor } @@ -30,6 +31,7 @@ namespace Swarmops.Basic.Types.Financial public int Order { get; protected set; } public bool AllowUntagged { get; protected set; } public int ProfitLossType { get; protected set; } + public int VisibilityLevel { get; protected set; } #region Implementation of IHasIdentity diff --git a/Database/Database-FinancialTransactionTagSets.cs b/Database/Database-FinancialTransactionTagSets.cs index 1eb33787..0e4e42ba 100644 --- a/Database/Database-FinancialTransactionTagSets.cs +++ b/Database/Database-FinancialTransactionTagSets.cs @@ -17,7 +17,7 @@ namespace Swarmops.Database private const string financialTransactionTagSetFieldSequence = " FinancialTransactionTagSetId,FinancialTransactionTagSetTypeId,OrganizationId,DisplayOrder,AllowUntagged," + // 0-4 - "ProfitLossType " + // 5 + "VisibilityLevel,ProfitLossType " + // 5-6 "FROM FinancialTransactionTagSets "; private static BasicFinancialTransactionTagSet ReadFinancialTransactionTagSetFromDataReader(IDataRecord reader) @@ -27,9 +27,10 @@ namespace Swarmops.Database int organizationId = reader.GetInt32 (2); int order = reader.GetInt32 (3); bool allowUntagged = reader.GetBoolean (4); - int profitLossType = reader.GetInt32(5); + int visibilityLevel = reader.GetInt32(5); + int profitLossType = reader.GetInt32(6); - return new BasicFinancialTransactionTagSet(financialTransactionTagSetId, financialTransactionTagSetTypeId, organizationId, order, allowUntagged, profitLossType); + return new BasicFinancialTransactionTagSet(financialTransactionTagSetId, financialTransactionTagSetTypeId, organizationId, order, allowUntagged, visibilityLevel, profitLossType); } #endregion diff --git a/Logic/App_GlobalResources/Logic.Financial.FinancialTransactionTagSetTypesStock.Designer.cs b/Logic/App_GlobalResources/Logic.Financial.FinancialTransactionTagSetTypesStock.Designer.cs index 53a184f5..b3622cef 100644 --- a/Logic/App_GlobalResources/Logic.Financial.FinancialTransactionTagSetTypesStock.Designer.cs +++ b/Logic/App_GlobalResources/Logic.Financial.FinancialTransactionTagSetTypesStock.Designer.cs @@ -82,9 +82,9 @@ namespace Swarmops.Logic.App_GlobalResources { /// /// Looks up a localized string similar to Project. /// - internal static string Project { + internal static string ProjectName { get { - return ResourceManager.GetString("Project", resourceCulture); + return ResourceManager.GetString("ProjectName", resourceCulture); } } } diff --git a/Logic/App_GlobalResources/Logic.Financial.FinancialTransactionTagSetTypesStock.resx b/Logic/App_GlobalResources/Logic.Financial.FinancialTransactionTagSetTypesStock.resx index 34218e63..f411b12f 100644 --- a/Logic/App_GlobalResources/Logic.Financial.FinancialTransactionTagSetTypesStock.resx +++ b/Logic/App_GlobalResources/Logic.Financial.FinancialTransactionTagSetTypesStock.resx @@ -123,7 +123,7 @@ Income Type - + Project \ No newline at end of file diff --git a/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs b/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs index e02a4d24..f792734e 100644 --- a/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs +++ b/Site5/Pages/v5/Financial/CreateInboundInvoice.aspx.cs @@ -35,7 +35,8 @@ namespace Swarmops.Frontend.Pages.v5.Financial // Construct data source - List dataSource = new List(); + List dataSourceVisibleTags = new List(); + List dataSourceForcedTags = new List(); foreach (int tagSetId in _tagSetIds) { @@ -47,15 +48,20 @@ namespace Swarmops.Frontend.Pages.v5.Financial FinancialTransactionTagSet.FromIdentity(tagSetId). FinancialTransactionTagSetTypeId) }; - dataSource.Add(item); + dataSourceVisibleTags.Add(item); + + if (!FinancialTransactionTagSet.FromIdentity(tagSetId).AllowUntagged) + { + dataSourceForcedTags.Add(item); + } } // Bind data - this.RepeaterTagLabels.DataSource = dataSource; - this.RepeaterTagDrop.DataSource = dataSource; - this.RepeaterTagDropScript.DataSource = dataSource; - this.RepeaterErrorCheckTags.DataSource = dataSource; + this.RepeaterTagLabels.DataSource = dataSourceVisibleTags; + this.RepeaterTagDrop.DataSource = dataSourceVisibleTags; + this.RepeaterTagDropScript.DataSource = dataSourceVisibleTags; + this.RepeaterErrorCheckTags.DataSource = dataSourceForcedTags; this.RepeaterTagLabels.DataBind(); this.RepeaterTagDrop.DataBind(); @@ -169,7 +175,11 @@ namespace Swarmops.Frontend.Pages.v5.Financial if (!String.IsNullOrEmpty(selectedTagString)) { int selectedTagType = Int32.Parse(selectedTagString); - invoice.FinancialTransaction.CreateTag(FinancialTransactionTagType.FromIdentity(selectedTagType), CurrentUser); + if (selectedTagType != 0) + { + invoice.FinancialTransaction.CreateTag( + FinancialTransactionTagType.FromIdentity(selectedTagType), CurrentUser); + } } } diff --git a/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs b/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs index 0b809462..c471dbb2 100644 --- a/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs +++ b/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs @@ -35,27 +35,33 @@ namespace Swarmops.Frontend.Pages.v5.Financial // Construct data source - List dataSource = new List(); + List dataSourceVisibleTags = new List(); + List dataSourceForcedTags = new List(); foreach (int tagSetId in _tagSetIds) { TagSetDataSourceItem item = new TagSetDataSourceItem() - { - TagSetId = tagSetId, - TagSetLocalizedName = - FinancialTransactionTagSetType.GetLocalizedName( - FinancialTransactionTagSet.FromIdentity(tagSetId). - FinancialTransactionTagSetTypeId) - }; - dataSource.Add(item); + { + TagSetId = tagSetId, + TagSetLocalizedName = + FinancialTransactionTagSetType.GetLocalizedName( + FinancialTransactionTagSet.FromIdentity(tagSetId). + FinancialTransactionTagSetTypeId) + }; + dataSourceVisibleTags.Add(item); + + if (!FinancialTransactionTagSet.FromIdentity(tagSetId).AllowUntagged) + { + dataSourceForcedTags.Add(item); + } } // Bind data - this.RepeaterTagLabels.DataSource = dataSource; - this.RepeaterTagDrop.DataSource = dataSource; - this.RepeaterTagDropScript.DataSource = dataSource; - this.RepeaterErrorCheckTags.DataSource = dataSource; + this.RepeaterTagLabels.DataSource = dataSourceVisibleTags; + this.RepeaterTagDrop.DataSource = dataSourceVisibleTags; + this.RepeaterTagDropScript.DataSource = dataSourceVisibleTags; + this.RepeaterErrorCheckTags.DataSource = dataSourceForcedTags; this.RepeaterTagLabels.DataBind(); this.RepeaterTagDrop.DataBind(); @@ -172,7 +178,11 @@ namespace Swarmops.Frontend.Pages.v5.Financial if (!String.IsNullOrEmpty(selectedTagString)) { int selectedTagType = Int32.Parse(selectedTagString); - claim.FinancialTransaction.CreateTag(FinancialTransactionTagType.FromIdentity(selectedTagType), CurrentUser); + if (selectedTagType != 0) + { + claim.FinancialTransaction.CreateTag(FinancialTransactionTagType.FromIdentity(selectedTagType), + CurrentUser); + } } }