diff --git a/PROMS/VEPROMS User Interface/frmSectionProperties.cs b/PROMS/VEPROMS User Interface/frmSectionProperties.cs index 017c44b4..e42d1c9e 100644 --- a/PROMS/VEPROMS User Interface/frmSectionProperties.cs +++ b/PROMS/VEPROMS User Interface/frmSectionProperties.cs @@ -138,6 +138,12 @@ namespace VEPROMS SaveText(ppSectNumberStpRTB); // save the section number SaveText(ppSectTitleStpRTB); // save the section title FinishSectionSave(mySection); // this will also create an empty Word Doc if this is a word section + // B2018-126 & B2018-133: Refresh in case of library document usage change + if (_SectionConfig.MySection.MyContent.MyEntry != null && _SectionConfig.MySection.MyContent.MyEntry.MyDocument != null) + { + DocumentInfo docinfo = DocumentInfo.Get(_SectionConfig.MySection.MyContent.MyEntry.MyDocument.DocID); + docinfo.RefreshDocumentEntries(); + } // if there was a document to delete, do it. if (_DocumentToDelete != null) { @@ -827,7 +833,7 @@ namespace VEPROMS { ItemInfo ii = ItemInfo.Get(_SectionConfig.MySection.ItemID); DocumentInfo doclibinfo = ii.MyContent.MyEntry.MyDocument; - + doclibinfo.RefreshDocumentEntries(); // B2018-126 & B2018-133: Refresh for library document usage change // if just one usage (this one), then just convert this to a non-library document. If there are more // than one usage, make a copy so that the rest of the usages still point to the library document. if (doclibinfo.DocumentEntryCount == 1) @@ -839,6 +845,11 @@ namespace VEPROMS Document doc = Document.MakeDocument(null, doclibinfo.DocContent, doclibinfo.DocAscii, doclibinfo.Config,doclibinfo.FileExtension); _SectionConfig.MySection.MyContent.MyEntry.MyDocument = doc; } + // B2018-126 & B2018-133: Refresh for library document usage change + _SectionConfig.MySection.MyContent.MyEntry.MyDocument.Save(); + DocumentInfo docinfo = DocumentInfo.Get(_SectionConfig.MySection.MyContent.MyEntry.MyDocument.DocID); + docinfo.RefreshDocumentEntries(); + ppCmbxLibDoc.Items.Clear(); ppCmbxLibDoc.WatermarkEnabled = true; ppBtnCvrtToLibDoc.Text = "Convert this to a Library Document"; diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index b459d859..e4936b88 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -2727,6 +2727,10 @@ namespace VEPROMS displayLibDocs.LibDocListFillIn(tc); displayLibDocs.SetSelectedLibDoc(); } + + // B2018-126: Refresh libdoc list in case user changed lib doc to non: so it doesn't show up in libdoc panel + if (dr == DialogResult.Cancel && displayLibDocs.LibDocList != null) displayLibDocs.LibDocListFillIn(tc); + MySessionInfo.CheckInItem(ownerID); } } diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/Entry.cs b/PROMS/VEPROMS.CSLA.Library/Generated/Entry.cs index b23600fd..2c9d9e35 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/Entry.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/Entry.cs @@ -789,6 +789,12 @@ namespace VEPROMS.CSLA.Library else _LastChanged = Entry.Update(cn, content.ContentID, _DocID, _DTS, _UserID, ref _LastChanged); MarkOld(); + // B2018-126 & B2018-133: Refresh for library document usage change: + if (_MyDocument != null) + { + _MyDocument.Update(); + if (_MyDocument.DocumentEntries != null) _MyDocument.Reset_DocumentEntries(); + } } } [Transactional(TransactionalTypes.TransactionScope)] diff --git a/PROMS/Volian.Controls.Library/DisplayLibDocs.cs b/PROMS/Volian.Controls.Library/DisplayLibDocs.cs index a2b53b7d..863e3267 100644 --- a/PROMS/Volian.Controls.Library/DisplayLibDocs.cs +++ b/PROMS/Volian.Controls.Library/DisplayLibDocs.cs @@ -66,6 +66,7 @@ namespace Volian.Controls.Library { if (_SelectedLibDoc >= 0) { + if (listBoxLibDocs.Items.Count==0 || _SelectedLibDoc > listBoxLibDocs.Items.Count) return; // B2018-126: if no items in list return also (count==0) if (_SelectedLibDoc > listBoxLibDocs.Items.Count) return; listBoxLibDocs.SelectedIndex = _SelectedLibDoc; }