diff --git a/PROMS/DataLoader/LibDoc.cs b/PROMS/DataLoader/LibDoc.cs index ccb0077c..3290f646 100644 --- a/PROMS/DataLoader/LibDoc.cs +++ b/PROMS/DataLoader/LibDoc.cs @@ -76,7 +76,7 @@ namespace DataLoader ci.AddItem("Edit", "Initialized", "true"); ci.AddItem("History", "OriginalFileName", fi.Name); string tmpRtfFileName = GetLibDocData(fi, ci, ref title); - int Docid = SaveWordDoc(tmpRtfFileName, title, null, ci, string.Empty,fi.LastWriteTimeUtc); + int Docid = SaveWordDoc(tmpRtfFileName, title, null, false, ci, string.Empty,fi.LastWriteTimeUtc); File.Delete(tmpRtfFileName); return Docid; } diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index 54e8e8f5..07ea20f4 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -7001,4 +7001,63 @@ GO IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_FindROUsageIDs Succeeded' ELSE PRINT 'TableFunction Creation: vefn_FindROUsageIDs Error on Creation' GO +/****** Object: TableFunction [vefn_GetVersionFormatItems] ******/ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetVersionFormatItems]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1) + DROP FUNCTION [vefn_GetVersionFormatItems]; +GO + +/***************************************************************************** + Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE + Copyright 2012 - Volian Enterprises, Inc. All rights reserved. +*****************************************************************************/ +CREATE FUNCTION [dbo].[vefn_GetVersionFormatItems](@DocVersionList varchar(MAX)) +RETURNS @VersionItems TABLE +( + VersionID int, + ItemID int, + ContentID int primary key, + FormatID int +) +WITH EXECUTE AS OWNER +AS +BEGIN + BEGIN + with Itemz([VersionID], [ItemID], [ContentID], [FormatID], [ParentFormatID]) as + (Select DV.VersionID, [I].[ItemID], [I].[ContentID], + isnull(C.[FormatID],isnull(DV2.[FormatID],isnull(F.[FormatID],P.[FormatID]))), + isnull(DV2.[FormatID],isnull(F.[FormatID],P.[FormatID])) + FROM [Items] I + JOIN vefn_DocVersionSplit(@DocVersionList) DV ON I.[ItemID] = DV.[ItemID] + join docversions DV2 on DV.[VersionID] = DV2.[VersionID] + join folders F on DV2.[FolderID] = F.[FolderID] + join folders P on P.[FolderID] = F.[ParentID] + join Contents C on I.ContentID = C.ContentID + + Union All + -- Children + select Z.VersionID, I.[ItemID], I.[ContentID], isnull(C.[FormatID],Z.[FormatID]), Z.[FormatID] + from Itemz Z + join Parts P on P.ContentID = Z.ContentID + join Items I on I.ItemID = P.ItemID + join Contents C on I.ContentID = C.ContentID + Union All + -- Siblings + select Z.VersionID, I.[ItemID], I.[ContentID], isnull(C.[FormatID],Z.[ParentFormatID]), Z.[ParentFormatID] + from Itemz Z + join Items I on I.PreviousID = Z.ItemID + join Contents C on I.ContentID = C.ContentID + ) + insert into @VersionItems + select VersionID, [ItemID], [ContentID], [FormatID] + from ItemZ I + --Select * From rousages RU Where RU.ContentID in (Select ContentID from ItemZ) + OPTION (MAXRECURSION 10000) + END +RETURN +END +GO +-- Display the status of func creation +IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetVersionFormatItems Succeeded' +ELSE PRINT 'TableFunction Creation: vefn_GetVersionFormatItems Error on Creation' +GO diff --git a/PROMS/DataLoader/Sections.cs b/PROMS/DataLoader/Sections.cs index 3c4bf42f..6200d312 100644 --- a/PROMS/DataLoader/Sections.cs +++ b/PROMS/DataLoader/Sections.cs @@ -52,7 +52,8 @@ namespace DataLoader int tmpE2 = LookupOldToNew(dstyleindx); //int docstyleindx = GetDocStyleIndx(dstyleindx, format, procitem, docver,Number,Title); int docstyleindx = GetDocStyleIndx(dstyleindx, format, procitem, Number, Title); - + DocStyle myDocStyle = format.PlantFormat.DocStyles.DocStyleList[docstyleindx]; + bool isLandscape = myDocStyle.Layout.PageWidth > myDocStyle.Layout.PageLength; // Adjust the section number. The 16bit vfw code was sometimes printing section numbers // differently than what was stored as data. For example VEWCNOFN: OFN MA-001, the section // number was '1.' and 16bit printed it as '1.0'. The flag that caused this was (surprisingly), @@ -129,7 +130,7 @@ namespace DataLoader string procnum = ""; using (ItemInfo ii = ItemInfo.Get(procitem.ItemID)) procnum = ii.DisplayNumber; - SaveSectionDocument(fname, stpseq, SecType, ref Documentid, procnum + ":" + (Number == string.Empty ? Title : Number)); + SaveSectionDocument(fname, stpseq, SecType, ref Documentid, procnum + ":" + (Number == string.Empty ? Title : Number), isLandscape); if (Documentid == 0) { if (MissingDocument == null) @@ -536,6 +537,8 @@ namespace DataLoader } // Save section level Checkoff information int chkOffType = (rid[0] & 0x007F) - '0'; + if (rid[0] == '\u2591') //for SUM,CAT,MCG with only 2 checkoff options and default checkoff is enabled + chkOffType = 1; //this diables checkoffs for this section if (chkOffType > 0) ci.AddItem("Section", "CheckoffSelection", chkOffType.ToString());