diff --git a/source/bizobjects/AyaLib/GZTW.AyaNova.BLL/Client.cs b/source/bizobjects/AyaLib/GZTW.AyaNova.BLL/Client.cs
index e267508..ba4c8fd 100644
--- a/source/bizobjects/AyaLib/GZTW.AyaNova.BLL/Client.cs
+++ b/source/bizobjects/AyaLib/GZTW.AyaNova.BLL/Client.cs
@@ -2368,40 +2368,7 @@ namespace GZTW.AyaNova.BLL
/*Custom fields*/
mCustom1,mCustom2,mCustom3,mCustom4,mCustom5,mCustom6,mCustom7,mCustom8,mCustom9,mCustom0));
- //case 3701 set pm's inactive if client is now inactive
- if (this.mActiveChanged && this.mActive == false)
- {
- //because firebird doesn't support updating through a join statement
- //Need to fetch as a list object first then update them all...
- //Find all PM's for this client
- string pmListCriteria = " \r\n" +
- " \r\n" +
- " \r\n" +
- " \r\n" +
- " \r\n" +
- " \r\n" +
- " ";
-
- var wopm = WorkorderPMList.GetList(pmListCriteria);
- if (wopm.Count > 0)
- {
- foreach (WorkorderPMList.WorkorderPMListInfo i in wopm)
- {
- if (i.LT_O_WorkorderPreventiveMaintenance.Value != Guid.Empty)
- {
- DBCommandWrapper cmPM = DBUtil.GetCommandFromSQL(
- "UPDATE " +
- " AWORKORDERPREVENTIVEMAINTENANCE " +
- " SET " +
- " AACTIVE=0 " +
- " WHERE AWORKORDERID=@PMID "
- );
- cmPM.AddInParameter("@PMID", DbType.Guid, i.LT_O_WorkorderPreventiveMaintenance.Value);
- DBUtil.DB.ExecuteNonQuery(cmPM, transaction);
- }
- }
- }
- }
+
MarkOld();//db is now synched with object
@@ -2425,6 +2392,42 @@ namespace GZTW.AyaNova.BLL
this.mModified.Date=dtModified;
+ //case 3701 set pm's inactive if client is now inactive
+ if (this.mActiveChanged && this.mActive == false)
+ {
+ //because firebird doesn't support updating through a join statement
+ //Need to fetch as a list object first then update them all...
+ //Find all PM's for this client
+ string pmListCriteria = " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " \r\n" +
+ " ";
+
+ var wopm = WorkorderPMList.GetList(pmListCriteria);
+ if (wopm.Count > 0)
+ {
+ foreach (WorkorderPMList.WorkorderPMListInfo i in wopm)
+ {
+ if (i.LT_O_WorkorderPreventiveMaintenance.Value != Guid.Empty)
+ {
+ DBCommandWrapper cmPM = DBUtil.GetCommandFromSQL(
+ "UPDATE " +
+ " AWORKORDERPREVENTIVEMAINTENANCE " +
+ " SET " +
+ " AACTIVE=0 " +
+ " WHERE AWORKORDERID=@PMID "
+ );
+ cmPM.AddInParameter("@PMID", DbType.Guid, i.LT_O_WorkorderPreventiveMaintenance.Value);
+ DBUtil.DB.ExecuteNonQuery(cmPM);
+ }
+ }
+ }
+ }
+
+
if (AyaBizUtils.AllowAutomaticMRUOnUpdate)
{
AyaBizUtils.MRU.Add(RootObjectTypes.Client, mID);