Fixed crash when you selected the Open button on the Library Document tab in the Tools panel. Open button is only available for library documents with zero references.
If the open library document is not referenced, then save changes but don’t generate a PDF.
This commit is contained in:
parent
008a1e67eb
commit
f763a9a868
@ -413,11 +413,14 @@ namespace Volian.Controls.Library
|
|||||||
_MyLog.FatalFormat("File does not exist {0}\r\nFile was {1}", tmp, MyDSOFile.FullName);
|
_MyLog.FatalFormat("File does not exist {0}\r\nFile was {1}", tmp, MyDSOFile.FullName);
|
||||||
// if this was a library document, ask user if it should be saved for all usages.
|
// if this was a library document, ask user if it should be saved for all usages.
|
||||||
bool cvtLibDoc = false;
|
bool cvtLibDoc = false;
|
||||||
EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry;
|
if (MyDisplayTabItem.MyItemInfo != null) // B2016-131 if myiteminfo is null then the lib doc is not referenced, so just save the changes - don't generate a pdf
|
||||||
if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "")
|
|
||||||
{
|
{
|
||||||
DialogResult ans = MessageBox.Show("Save as Library Document for all usages?", "Document Save", MessageBoxButtons.YesNo);
|
EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry;
|
||||||
if (ans == DialogResult.No) cvtLibDoc = true;
|
if (myei != null && myei.MyDocument != null && myei.MyDocument.LibTitle != null && myei.MyDocument.LibTitle != "")
|
||||||
|
{
|
||||||
|
DialogResult ans = MessageBox.Show("Save as Library Document for all usages?", "Document Save", MessageBoxButtons.YesNo);
|
||||||
|
if (ans == DialogResult.No) cvtLibDoc = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MyDSOFile.SaveFile(doc.Length, doc.Ascii, MyDisplayTabItem.MyItemInfo, cvtLibDoc, StatusChanged);
|
MyDSOFile.SaveFile(doc.Length, doc.Ascii, MyDisplayTabItem.MyItemInfo, cvtLibDoc, StatusChanged);
|
||||||
if (cvtLibDoc)
|
if (cvtLibDoc)
|
||||||
|
@ -810,7 +810,7 @@ namespace Volian.Controls.Library
|
|||||||
foreach (object itm in b.Items)
|
foreach (object itm in b.Items)
|
||||||
{
|
{
|
||||||
DisplayTabItem myTabItem = itm as DisplayTabItem;
|
DisplayTabItem myTabItem = itm as DisplayTabItem;
|
||||||
if (myTabItem != null && myTabItem.MyStepTabPanel != null)
|
if (myTabItem != null && myTabItem.MyStepTabPanel != null && myItemInfo != null)
|
||||||
if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
|
if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
@ -1041,6 +1041,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
public DisplayTabItem OpenDSOTabPage(DocumentInfo myDocumentInfo)
|
public DisplayTabItem OpenDSOTabPage(DocumentInfo myDocumentInfo)
|
||||||
{
|
{
|
||||||
|
_MyBar = GetParentBar(null); // B2016-131 - allow open of a non-referenced library document
|
||||||
CleanUpClosedItems();
|
CleanUpClosedItems();
|
||||||
DisplayTabItem pg = null;
|
DisplayTabItem pg = null;
|
||||||
string key = "Doc - " + myDocumentInfo.DocID;
|
string key = "Doc - " + myDocumentInfo.DocID;
|
||||||
@ -1048,7 +1049,7 @@ namespace Volian.Controls.Library
|
|||||||
pg = _MyDisplayTabItems[key];
|
pg = _MyDisplayTabItems[key];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DSOTabPanel.Count > 18) // Limit the number of open document pages to 18
|
if (DSOTabPanel.Count > DSOTabPanel.MSWordLimit) //18) // Limit the number of open document pages to 18
|
||||||
{
|
{
|
||||||
MessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
|
MessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
|
||||||
return null;
|
return null;
|
||||||
|
@ -326,7 +326,10 @@ namespace Volian.Controls.Library
|
|||||||
private void SetupLibraryDocumentDSOTabPanel()
|
private void SetupLibraryDocumentDSOTabPanel()
|
||||||
{
|
{
|
||||||
UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID);
|
UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID);
|
||||||
_MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl, _MyItemInfo, UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion));
|
// B2016-131 if myiteminfo is null, then the lib doc is not referenced.
|
||||||
|
// - Allow editting only if you are an Administrator
|
||||||
|
// - Cannot check if you are a Writer or Set Aministrator because we don't have a Doc Verion
|
||||||
|
_MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl, _MyItemInfo, (MyItemInfo != null) ? UserInfo.CanEdit(ui, MyItemInfo.MyDocVersion):ui.IsAdministrator());
|
||||||
//
|
//
|
||||||
// tabItem
|
// tabItem
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user