Page 1 of 1

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

Posted: Sun Aug 02, 2020 6:05 pm
by FelixTheCat
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!

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

Posted: Sun Aug 02, 2020 7:26 pm
by FelixTheCat
I mean of course:
Could you please add the following hook at the end of the constructor of the class "FormClaimAttachment":

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

Posted: Tue Aug 04, 2020 2:56 pm
by PatrickC
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);
		}

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

Posted: Tue Aug 04, 2020 4:59 pm
by FelixTheCat
Hi Patrick,

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

Thx
Felix

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

Posted: Wed Aug 05, 2020 2:52 pm
by PatrickC
Hi Felix,

Your hook has been added to version 20.3.13.