From 3a2759470dd1eb99ab386abf8c7c83d1cfe92122 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 29 Nov 2016 13:52:43 +0000 Subject: [PATCH] =?UTF-8?q?check=20for=20null=20reference=20when=20deletin?= =?UTF-8?q?g=20a=20source=20step=20that=20has=20associated=20enhanced=20(f?= =?UTF-8?q?ound=20during=20fix=20for=20B2016-228)=20B2016-228:=20when=20cr?= =?UTF-8?q?eating=20section/procedure=20enhanced=20items,=20set=20?= =?UTF-8?q?=E2=80=98Number=E2=80=99=20B2016-228:=20when=20modifying=20sour?= =?UTF-8?q?ce=20section=20or=20procedure,=20save=20=E2=80=98Number?= =?UTF-8?q?=E2=80=99=20also=20B2016-198:=20User=20hold=20point=20no=20long?= =?UTF-8?q?er=20overwrites=20the=20=E2=80=98INIT/DATE=E2=80=99=20signoff?= =?UTF-8?q?=20heading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs | 1 + PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs | 8 ++++---- PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs | 8 ++++++++ PROMS/Volian.Print.Library/vlnParagraph.cs | 1 + 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 18960d0e..98d704fc 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -3077,6 +3077,7 @@ namespace VEPROMS.CSLA.Library if (sc.MyEnhancedDocuments != null && sc.MyEnhancedDocuments.Count == 1 && sc.MyEnhancedDocuments[0].Type == 0) { ItemInfo ii = ItemInfo.Get(sc.MyEnhancedDocuments[0].ItemID); + if (ii == null) return false; // when deleting a source step, this was causing a crash (null ii) return (ii.MyContent.DTS > MyProcedure.ChangeBarDate); } // if there is no override & return whether there was a change to the text. diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs index 8f40b3ce..edb5ddb2 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs @@ -1527,7 +1527,7 @@ namespace VEPROMS.CSLA.Library if (exEnh.IsStep) newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID); else - newEnh = exEnh.InsertEnhancedItems(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID); + newEnh = exEnh.InsertEnhancedItems(MyContent.Text, MyContent.Number, addtype, MyContent.Type, edSource.Type, this.ItemID); } } iiCur = iiCur.MyPrevious; @@ -1546,7 +1546,7 @@ namespace VEPROMS.CSLA.Library if (exEnh.IsStep) newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID); else - newEnh = exEnh.InsertEnhancedItems(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID); + newEnh = exEnh.InsertEnhancedItems(MyContent.Text, MyContent.Number, addtype, MyContent.Type, edSource.Type, this.ItemID); } } iiNxt = iiNxt.GetNextItem(); @@ -1567,7 +1567,7 @@ namespace VEPROMS.CSLA.Library { // get the enhaced docversioninfo: DocVersionInfo enhDVInfo = DocVersionInfo.Get(ded.VersionID); - using (Procedure newenhProcedure = Procedure.MakeProcedure(enhDVInfo, enhDVInfo.Procedures.Count != 0 ? enhDVInfo.Procedures[enhDVInfo.Procedures.Count - 1] : null, null, "New Procedure", 0)) + using (Procedure newenhProcedure = Procedure.MakeProcedure(enhDVInfo, enhDVInfo.Procedures.Count != 0 ? enhDVInfo.Procedures[enhDVInfo.Procedures.Count - 1] :null, MyContent.Number, "New Procedure", 0)) { newEnh = ItemInfo.Get(newenhProcedure.ItemID); string scng = null; @@ -1596,7 +1596,7 @@ namespace VEPROMS.CSLA.Library if (exEnh.IsStep) newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID); else - newEnh = exEnh.InsertEnhancedItems(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID); + newEnh = exEnh.InsertEnhancedItems(MyContent.Text, MyContent.Number, addtype, MyContent.Type, edSource.Type, this.ItemID); break; } } diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs index e75c595e..a31a2af0 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/ContentInfo.cs @@ -638,6 +638,14 @@ namespace VEPROMS.CSLA.Library DisplayText dt = new DisplayText(ii, ii.MyContent.Text, false); string str = ItemInfo.Get(tmp.ContentItems[0].ItemID).DisplayTextKeepSpecialChars; dt.Save(str); + if (tmp.Type < 20000 && ii.MyContent.Number != tmp.Number) // update number for sections & procedures, B2016-228 + { + using (Content enhCont = Content.Get(ii.MyContent.ContentID)) + { + enhCont.Number = tmp.Number; + enhCont.Save(); + } + } } } } diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 158784ca..b2827795 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -2558,6 +2558,7 @@ namespace Volian.Print.Library get { if (TopMostChild.PartsAbove.Count == 0) return false; + if (TopMostChild.PartsContainer != null && TopMostChild.PartsContainer.Count > 0) return false; // B2016-198: not 'EmptyTopMostPart' if there is a box. foreach (vlnPrintObject po in TopMostChild.PartsAbove) { vlnHeader hd = po as vlnHeader;