Hook Request: ./OpenDental/Forms/FormClaimAttachment.cs

This forum is for programmers who have questions about the source code.
Post Reply
FelixTheCat
Posts: 3
Joined: Sun Aug 02, 2020 6:01 pm

Hook Request: ./OpenDental/Forms/FormClaimAttachment.cs

Post by FelixTheCat » Sun Aug 02, 2020 6:05 pm

Hi OpenDental Team,

I would like to add a button to the FormClaimAttachment form that will allow the user to load images from a custom system.

I would need to be able to introspect the current claim and the current patient (to begin with to get PatNum, Date of Service, Patient Name). I'll need to pass the three parameters to our plugin as they're all private at the moment.

Code: Select all

private Claim _claimCur;
private Patient _claimPat;
private void ShowImageAttachmentItemEdit(Image img) {...}
I would like to hand the image off to ShowImageAttachmentItemEdit like the other buttons do. Since direct cast to object in Plugins.HookAddCode fails for private void(Image), we first need to cast to Action<Image>.

Could you please add the following hook at the end of the class "FormClaimAttachment":

Code: Select all

Plugins.HookAddCode(this,"FormClaimAttachment.Load_end", _patCur, _claimCur, (Action<Image>)ShowImageAttachmentItemEdit);
Thank you!

FelixTheCat
Posts: 3
Joined: Sun Aug 02, 2020 6:01 pm

Re: Hook Request: ./OpenDental/Forms/FormClaimAttachment.cs

Post by FelixTheCat » Sun Aug 02, 2020 7:26 pm

I mean of course:
Could you please add the following hook at the end of the constructor of the class "FormClaimAttachment":

PatrickC
Posts: 56
Joined: Thu Jun 06, 2019 11:37 am

Re: Hook Request: ./OpenDental/Forms/FormClaimAttachment.cs

Post by PatrickC » Tue Aug 04, 2020 2:56 pm

There's some discrepancies between your hook example and your stated location. I've placed it at the end of FormClaimAttachment_Load and changed _patCur to _claimPat. Let me know if the below is your intended placement and structure of this hook.

Code: Select all

private void FormClaimAttachment_Load(object sender,EventArgs e) {
			_claimPat=Patients.GetPat(_claimCur.PatNum);
			List<Def> imageTypeCategories=new List<Def>();
			List<Def> listClaimAttachmentDefs=CheckImageCatDefs();
			if(listClaimAttachmentDefs.Count<1) {//At least one Claim Attachment image definition exists.
				labelClaimAttachWarning.Visible=true;
			}
			//Non-DXC numbers (NEA) can be wiped out as they are no longer supported by DentalXChange starting 12/01/19.
			if(!string.IsNullOrWhiteSpace(_claimCur.AttachmentID) && !_claimCur.AttachmentID.ToLower().StartsWith("dxc") && 
				MsgBox.Show(this,MsgBoxButtons.YesNo,"The claim has a non DentalXChange Attachment ID. Would you like to clear it out?")) 
			{
				ClearAttachmentID();
			}
			Plugins.HookAddCode(this,"FormClaimAttachment.Load_end",_claimPat,_claimCur,(Action<Image>)ShowImageAttachmentItemEdit);
		}
Patrick Carlson
Open Dental Software
http://www.opendental.com

FelixTheCat
Posts: 3
Joined: Sun Aug 02, 2020 6:01 pm

Re: Hook Request: ./OpenDental/Forms/FormClaimAttachment.cs

Post by FelixTheCat » Tue Aug 04, 2020 4:59 pm

Hi Patrick,

This will work nicely. Thank you very much also for the correction.

Thx
Felix

PatrickC
Posts: 56
Joined: Thu Jun 06, 2019 11:37 am

Re: Hook Request: ./OpenDental/Forms/FormClaimAttachment.cs

Post by PatrickC » Wed Aug 05, 2020 2:52 pm

Hi Felix,

Your hook has been added to version 20.3.13.
Patrick Carlson
Open Dental Software
http://www.opendental.com

Post Reply