diff --git a/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs b/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs index 56d41a1b5..a4e7c31fa 100644 --- a/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs +++ b/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs @@ -2640,13 +2640,13 @@ public string Time() static public DateTime AddMth(DateTime dt, int cantMonths) { - if (dt == nullDate && cantMonths < 0) + if (dt == nullDate && (cantMonths < 0 || Preferences.IgnoreAddOnEmptyDates)) return nullDate; return dt.AddMonths(cantMonths); } static public DateTime AddYr(DateTime dt, int cantYears) { - if (dt == nullDate && cantYears < 0) + if (dt == nullDate && (cantYears < 0 || Preferences.IgnoreAddOnEmptyDates)) return nullDate; return dt.AddYears(cantYears); } @@ -2701,13 +2701,13 @@ static public int DDiff(DateTime dtMinu, DateTime dtSust) } static public DateTime TAdd(DateTime dt, int seconds) { - if (dt == nullDate && seconds < 0) + if (dt == nullDate && (seconds < 0 || Preferences.IgnoreAddOnEmptyDates)) return nullDate; return dt.AddSeconds(seconds); } static public DateTime TAddMs(DateTime dt, double seconds) { - if (dt == nullDate && seconds < 0) + if (dt == nullDate && (seconds < 0 || Preferences.IgnoreAddOnEmptyDates)) return nullDate; if (seconds % 1 == 0) return dt.AddSeconds((int)seconds); @@ -2716,7 +2716,7 @@ static public DateTime TAddMs(DateTime dt, double seconds) } static public DateTime DAdd(DateTime dt, int days) { - if (dt == nullDate && days < 0) + if (dt == nullDate && (days < 0 || Preferences.IgnoreAddOnEmptyDates)) return nullDate; return dt.AddDays(days); } diff --git a/dotnet/src/dotnetframework/GxClasses/Core/gxconfig.cs b/dotnet/src/dotnetframework/GxClasses/Core/gxconfig.cs index 49b5a370d..555196a2a 100644 --- a/dotnet/src/dotnetframework/GxClasses/Core/gxconfig.cs +++ b/dotnet/src/dotnetframework/GxClasses/Core/gxconfig.cs @@ -727,6 +727,7 @@ public class Preferences static string blobPath; static string blobPathFolderName; static int blankEmptyDates = -1; + static int ignoreAddOnEmptyDate = -1; static int setupDB = -1; static HTMLDocType docType = HTMLDocType.UNDEFINED; static int docTypeDTD = -1; @@ -898,7 +899,29 @@ public static bool Remote } } + public static bool IgnoreAddOnEmptyDates + { + get + { + if (ignoreAddOnEmptyDate == -1) + { + string val; + if (Config.GetValueOf("IGNORE_ADD_ON_EMPTY_DATE", out val) && val == "1") + { + ignoreAddOnEmptyDate = 1; + return true; + } + else + { + ignoreAddOnEmptyDate = 0; + return false; + } + } + else return (ignoreAddOnEmptyDate == 1); + } + } + public static bool BlankEmptyDates { get