SparkDevNetwork / Rock

An open source CMS, Relationship Management System (RMS) and Church Management System (ChMS) all rolled into one.
http://www.rockrms.com
574 stars 346 forks source link

Unique Attribute Key Check #449

Closed BEGamache closed 10 years ago

BEGamache commented 10 years ago

Would it be possible to make the Attribute Key check to see if there is another key with the same name before saving, and if there is add an increment value or prompt for new key name? It's not a critical issue but more so convenience and a time saver (compared to sifting through all the attribute key names). After adding over 100 attributes, I went to check on a Person Profile and get this error:

HttpUnhandledException in System.Web

Message Exception of type 'System.Web.HttpUnhandledException' was thrown.

Stack Trace at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.themes_rock_layouts_persondetail_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

-ArgumentException in mscorlib

Message An item with the same key has already been added.

Stack Trace at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Rock.Attribute.Helper.LoadAttributes(IHasAttributes entity) at Rock.Web.UI.RockPage.GetCurrentContext(EntityTypeCache entity) at Rock.Web.UI.RockBlock.OnInit(EventArgs e) at Rock.Web.UI.PersonBlock.OnInit(EventArgs e) at RockWeb.Blocks.Crm.PersonDetail.Badges.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at Rock.Web.UI.RockPage.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

azturner commented 10 years ago

https://github.com/SparkDevNetwork/Rock/commit/8a3bf4d6f70e3a80340c6e833a3c0609d2a45d88