Page 1 of 1

Hook Request

Posted: Sat Jun 09, 2018 5:06 am
by mopensoft
Hi OpenDental,

Could I request a hook for AutomationL.cs in function Trigger (public static bool Trigger(AutomationTrigger trigger,List<string> procCodes,long patNum,long aptNum=0)) at line 45 as below:

Code: Select all

switch (listAutomations[i].AutoAction) {
					case AutomationAction.CreateCommlog:
                       if (Plugins.HookMethod(null, "AutomationL.Trigger_CreateCommlog_start", patNum, aptNum, listAutomations[i].CommType, listAutomations[i].MessageContent))
                        {
                            automationHappened = true;
                            continue;
                        }
                        Commlog commlogCur=new Commlog();
						commlogCur.PatNum=patNum;
						commlogCur.CommDateTime=DateTime.Now;
						commlogCur.CommType=listAutomations[i].CommType;
						commlogCur.Note=listAutomations[i].MessageContent;
						commlogCur.Mode_=CommItemMode.None;
						commlogCur.UserNum=Security.CurUser.UserNum;
						FormCommItem FormCI=new FormCommItem(commlogCur);
						FormCI.IsNew=true;
						FormCI.ShowDialog();
						automationHappened=true;
						continue;

Re: Hook Request

Posted: Sat Jun 09, 2018 5:29 am
by mopensoft
Could you also add the following hook into ContrAppt.cs in event pinBoard_MouseUp line 3240:

Code: Select all

               try {
		      ODTuple<Appointment,bool> aptTuple=Appointments.SchedulePlannedApt(aptCur,PatCur,listApptFields,aptCur.AptDateTime,aptCur.Op);
		      aptCur=aptTuple.Item1;
			procAlreadyAttached=aptTuple.Item2;

                        // Minh's code start
                        object[] parameters = { isCreate };
                        Plugins.HookAddCode(this, "ContrAppt.pinBoard_MouseUp_updateAppCreateCheck", parameters);
                        isCreate = (bool) parameters[0];
                        // Minh's code end
                    }

Re: Hook Request

Posted: Sat Jun 09, 2018 11:33 am
by cmcgehee
I will get these added sometime next week. :D

Re: Hook Request

Posted: Mon Jun 11, 2018 9:28 pm
by mopensoft
Thanks Chris, it would be great if it is included in the new release this week :)

Re: Hook Request

Posted: Tue Jun 12, 2018 9:29 am
by cmcgehee
I can hopefully get this in by the end of the week.

As mentioned in another forum post, I am going to change the code so that planned appointments placed on the schedule do trigger the ScheduleProcedure automation. If I change the code to this:

Code: Select all

try {
	ODTuple<Appointment,bool> aptTuple=Appointments.SchedulePlannedApt(aptCur,PatCur,listApptFields,aptCur.AptDateTime,aptCur.Op);
	aptCur=aptTuple.Item1;
	procAlreadyAttached=aptTuple.Item2;
	isCreate=true;
}
do you still need your second plugin hook?

Re: Hook Request

Posted: Tue Jun 12, 2018 11:04 am
by cmcgehee
Your first hook has been added to 18.1.23. I will be happy to add your second hook if you still need it.

Re: Hook Request

Posted: Thu Jun 14, 2018 12:27 am
by mopensoft
cmcgehee wrote:I can hopefully get this in by the end of the week.

As mentioned in another forum post, I am going to change the code so that planned appointments placed on the schedule do trigger the ScheduleProcedure automation. If I change the code to this:

Code: Select all

try {
	ODTuple<Appointment,bool> aptTuple=Appointments.SchedulePlannedApt(aptCur,PatCur,listApptFields,aptCur.AptDateTime,aptCur.Op);
	aptCur=aptTuple.Item1;
	procAlreadyAttached=aptTuple.Item2;
	isCreate=true;
}
do you still need your second plugin hook?
Not anymore Chris, that's exactly want I changed in my compiled OD version too :)