diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs
index 9694e1b0..855f07be 100644
--- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs
@@ -532,75 +532,85 @@ namespace Volian.Controls.Library
///
///
///
- public DisplayTabItem OpenItem(ItemInfo myItemInfo2, bool setFocus)
- {
- ItemInfo myItemInfo = myItemInfo2;
- if (myItemInfo.MyDocVersion == null) // bug fix: B2016-108 disconnected data will not have a MyDocVersion
- {
- MessageBox.Show(this, "Possible disconnected item", "Item Not Found");
- return null;
- }
- string message = string.Empty;
- if (myItemInfo.MyContent.MyEntry == null) //not a document
- {
- if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
- {
- MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return null;
- }
- }
- else
- {
- if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document, ref message))
- {
- MessageBox.Show(this, message, "Document Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return null;
- }
- }
+ public DisplayTabItem OpenItem(ItemInfo myItemInfo2, bool setFocus)
+ {
+ ItemInfo myItemInfo = myItemInfo2;
+ if (myItemInfo.MyDocVersion == null) // bug fix: B2016-108 disconnected data will not have a MyDocVersion
+ {
+ MessageBox.Show(this, "Possible disconnected item", "Item Not Found");
+ return null;
+ }
+ string message = string.Empty;
+ //if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyDocVersion.VersionID, CheckOutType.DocVersion, ref message))
+ //{
+ // message = "The Working Draft is being processed.\n\n" + message;
+ // MessageBox.Show(this, message, "Cannot Check Out Procedure", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ //}
+ if (myItemInfo.MyContent.MyEntry == null) //not a document
+ {
+ if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
+ {
+ MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return null;
+ }
+ }
+ else
+ {
+ if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document, ref message))
+ {
+ MessageBox.Show(this, message, "Document Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return null;
+ }
+ }
- CleanUpClosedItems();
- if (myItemInfo == null) return null;
+ CleanUpClosedItems();
+ if (myItemInfo == null) return null;
- // if this is an auto table of contents section, don't edit it:
- if (myItemInfo.IsAutoTOCSection)
- {
- MessageBox.Show("This is an automatically generated 'Table of Contents' section. It is not editable. It is generated during Print.", "Item not Editable", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return SelectedDisplayTabItem;
- }
- bool libDocAlreadyOpen = false;
- if (myItemInfo.MyContent.MyEntry != null) // Trying to open a Word document - see if it's a library document that is already opened.
- libDocAlreadyOpen = LibDocAlreadyOpen(myItemInfo);
+ // if this is an auto table of contents section, don't edit it:
+ if (myItemInfo.IsAutoTOCSection)
+ {
+ MessageBox.Show("This is an automatically generated 'Table of Contents' section. It is not editable. It is generated during Print.", "Item not Editable", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ return SelectedDisplayTabItem;
+ }
+ bool libDocAlreadyOpen = false;
+ if (myItemInfo.MyContent.MyEntry != null) // Trying to open a Word document - see if it's a library document that is already opened.
+ libDocAlreadyOpen = LibDocAlreadyOpen(myItemInfo);
- // C2015-022 modified if statement logic to support separate windows
- // if opening the first procedure in a set, and the main PROMS window has a procedure opened from a different set,
- // then create a new child window. All other procedures from that same set will open in this child window.
- // _AllDTCs is a dictionary of of all procedure sets opened along with their DisplayTabContol. The key to
- // the dictioan is the set's VersionID
- if (VersionID != 0)
- {
- if (SeparateWindows && !libDocAlreadyOpen)
- {
- if (!_AllDTCs.ContainsKey(myItemInfo.MyDocVersion.VersionID))
- {
- OnOpenInSeparateWindow(new ItemSelectedChangedEventArgs(myItemInfo2)); // create a child (separate) PROMS window
- return _AllDTCs[myItemInfo.MyDocVersion.VersionID].OpenItem(myItemInfo);
- }
- }
- if (VersionID != myItemInfo.MyDocVersion.VersionID && _AllDTCs.ContainsKey(myItemInfo.MyDocVersion.VersionID))
- {
- return _AllDTCs[myItemInfo.MyDocVersion.VersionID].OpenItem(myItemInfo);
- }
- }
+ // C2015-022 modified if statement logic to support separate windows
+ // if opening the first procedure in a set, and the main PROMS window has a procedure opened from a different set,
+ // then create a new child window. All other procedures from that same set will open in this child window.
+ // _AllDTCs is a dictionary of of all procedure sets opened along with their DisplayTabContol. The key to
+ // the dictioan is the set's VersionID
- if (!libDocAlreadyOpen)
- VersionID = myItemInfo.MyDocVersion.VersionID; // add it to _AllDTCs
+ // B2018-048 needed to add a check to see if we are in Separate Windows
+ // else we get stuck in a OpenItem loop when last DocVersion ID is not equal to the current DocVersion ID
+ // happened when you open a procedure then close the procedure tab, do a text search in a different procedure set
+ // then select one of search results.
+ if (SeparateWindows && VersionID != 0)
+ {
+ if (!libDocAlreadyOpen)
+ {
+ if (!_AllDTCs.ContainsKey(myItemInfo.MyDocVersion.VersionID))
+ {
+ OnOpenInSeparateWindow(new ItemSelectedChangedEventArgs(myItemInfo2)); // create a child (separate) PROMS window
+ return _AllDTCs[myItemInfo.MyDocVersion.VersionID].OpenItem(myItemInfo);
+ }
+ }
+ if (VersionID != myItemInfo.MyDocVersion.VersionID && _AllDTCs.ContainsKey(myItemInfo.MyDocVersion.VersionID))
+ {
+ return _AllDTCs[myItemInfo.MyDocVersion.VersionID].OpenItem(myItemInfo);
+ }
+ }
- _MyBar = GetParentBar(myItemInfo); // Get the docking bar associated with this item.
- if (myItemInfo.MyContent.MyEntry == null) // If it is not a Word document open in step editor
- return OpenStepTabPage(myItemInfo, setFocus);
- else // Otherwise open it in the Word editor
- return OpenDSOTabPage(myItemInfo);
- }
+ if (!libDocAlreadyOpen)
+ VersionID = myItemInfo.MyDocVersion.VersionID; // add it to _AllDTCs
+
+ _MyBar = GetParentBar(myItemInfo); // Get the docking bar associated with this item.
+ if (myItemInfo.MyContent.MyEntry == null) // If it is not a Word document open in step editor
+ return OpenStepTabPage(myItemInfo, setFocus);
+ else // Otherwise open it in the Word editor
+ return OpenDSOTabPage(myItemInfo);
+ }
public bool PasteRTBItem(ItemInfo myItemInfo, int copyStartID, ItemInfo.EAddpingPart pasteType, int type)
{
CleanUpClosedItems();