B2018-126 & B2018-133: Issues with library document usages

This commit is contained in:
Kathy Ruffing 2018-10-02 13:00:22 +00:00
parent d5514caf4c
commit b0b15cff0b
4 changed files with 23 additions and 1 deletions

View File

@ -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";

View File

@ -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);
}
}

View File

@ -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)]

View File

@ -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;
}