diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index a08d76b9..b2ca472b 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -526,8 +526,57 @@ CURRENTLY DOING: PM stuff: Error on generation, should it set the PM inactive? Yes if it can notify the user and it doesn't fail for trivial reasons But, if it doesn't save a wo then it shouldn't matter if it reprocesses again, though it's wasting time if it does, on the other hand the user might fix something and expect it to go - Notification when pm reaches stop generating date?? + From v7: + catch (Exception exx) + { + dest.Delete(); + dest.Save(); + //crack the exception + while (exx.InnerException != null) + exx = exx.InnerException; + + Memo mwarn = Memo.NewItem(); + mwarn.ToID = User.AdministratorID; + + //case 3826 + if (User.CurrentUserType == UserTypes.Utility) + { + //Utility accounts should not be sending memos, it fucks up downstream + //trying to view the memo, also it's confusing + mwarn.FromID = User.AdministratorID; + } + else + { + mwarn.FromID = User.CurrentThreadUserID; + } + + + mwarn.Subject = "SYSTEM WARNING: Preventive Maintenance WO PROBLEM"; + StringBuilder sb = new StringBuilder(); + sb.AppendLine("This is an automated message sent on behalf of the current user from the \"NewServiceWorkorderFromPM\" module."); + sb.AppendLine("This message concerns Preventive Maintenance workorder number " + source.WorkorderPreventiveMaintenance.PreventiveMaintenanceNumber.ToString()); + sb.AppendLine("The Preventive Maintenance workorder had an error when trying to save it during generation of a service workorder."); + sb.AppendLine("This kind of problem could result in loop which generates a very large number of identical service workorders."); + sb.AppendLine("In order to prevent this the operation has been stopped and this message generated so you can fix the problem with the source PM workorder."); + sb.AppendLine("See below for details and examine the PM workorder for problems or contact support@ayanova.com for help with the information in this message."); + sb.AppendLine("Here are the details of the error preventing save:"); + sb.AppendLine("================================="); + sb.AppendLine("Exception saving source PM:"); + sb.AppendLine(exx.Message); + sb.AppendLine("================================="); + string sSourceErr = source.GetBrokenRulesString(); + if (!string.IsNullOrWhiteSpace(sSourceErr)) + { + sb.AppendLine("Broken business rules on PM object:"); + sb.AppendLine(sSourceErr); + sb.AppendLine("=============================="); + } + mwarn.Message = sb.ToString(); + mwarn.Save(); + throw new System.ApplicationException("Workorder->NewServiceWorkorderFromPM: Error during service workorder generation. Memo with details sent to Administrator account."); + Notification when pm reaches stop generating date?? + test help links Child->grandchild data lists for quotes and pm's like workorders release