Hook Request

This forum is for programmers who have questions about the source code.
Post Reply
User avatar
mopensoft
Posts: 146
Joined: Tue Dec 04, 2012 3:33 pm
Location: Melbourne, Australia
Contact:

Hook Request

Post by mopensoft » Sat Jun 09, 2018 5:06 am

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;

User avatar
mopensoft
Posts: 146
Joined: Tue Dec 04, 2012 3:33 pm
Location: Melbourne, Australia
Contact:

Re: Hook Request

Post by mopensoft » Sat Jun 09, 2018 5:29 am

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
                    }

User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: Hook Request

Post by cmcgehee » Sat Jun 09, 2018 11:33 am

I will get these added sometime next week. :D
Chris McGehee
Open Dental Software
http://www.opendental.com

User avatar
mopensoft
Posts: 146
Joined: Tue Dec 04, 2012 3:33 pm
Location: Melbourne, Australia
Contact:

Re: Hook Request

Post by mopensoft » Mon Jun 11, 2018 9:28 pm

Thanks Chris, it would be great if it is included in the new release this week :)

User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: Hook Request

Post by cmcgehee » Tue Jun 12, 2018 9:29 am

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?
Chris McGehee
Open Dental Software
http://www.opendental.com

User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: Hook Request

Post by cmcgehee » Tue Jun 12, 2018 11:04 am

Your first hook has been added to 18.1.23. I will be happy to add your second hook if you still need it.
Chris McGehee
Open Dental Software
http://www.opendental.com

User avatar
mopensoft
Posts: 146
Joined: Tue Dec 04, 2012 3:33 pm
Location: Melbourne, Australia
Contact:

Re: Hook Request

Post by mopensoft » Thu Jun 14, 2018 12:27 am

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 :)

Post Reply