Currently, having 0 set for labcase.PatNum will throw a null reference exception from FormLabCaseEdit.FormLabCaseEdit_Load.
Could a check of Patients.GetPat(CaseCur.PatNum) be done so this does not happen? The lab cases form already handles this correctly by not showing a patient name in the data grid.
Thanks!
Allow lab case entry without a patient
Re: Allow lab case entry without a patient
I don't like that idea. What kind of lab case doesn't have a corresponding patient? I can only assume that this bug has been recently introduced.tim wrote:Currently, having 0 set for labcase.PatNum will throw a null reference exception from FormLabCaseEdit.FormLabCaseEdit_Load.
Could a check of Patients.GetPat(CaseCur.PatNum) be done so this does not happen? The lab cases form already handles this correctly by not showing a patient name in the data grid...
1. How are you getting into this window without a patient associated?
2. What version are you on?
The best thing about a boolean is even if you are wrong, you are only off by a bit.
Jason Salmon
Open Dental Software
http://www.opendental.com
Jason Salmon
Open Dental Software
http://www.opendental.com
Re: Allow lab case entry without a patient
The motivation for this change is our plugin is creating new LabCase records from our external data source, but in some cases there isn't an exact patient match for us to automatically populate in the patient ID.
We ask the operator to resolve this in our UI that is generated in the FormLabCaseEdit.Load_end hook, but that hook does not run due to the exception being thrown.
We ask the operator to resolve this in our UI that is generated in the FormLabCaseEdit.Load_end hook, but that hook does not run due to the exception being thrown.
Re: Allow lab case entry without a patient
If we were to change the window to first check for a null patient it wouldn't be to let the user into the window, we would force the user out of the window and create a Database Maintenance because we consider this database corruption.tim wrote:The motivation for this change is our plugin is creating new LabCase records from our external data source, but in some cases there isn't an exact patient match for us to automatically populate in the patient ID.
We ask the operator to resolve this in our UI that is generated in the FormLabCaseEdit.Load_end hook, but that hook does not run due to the exception being thrown.
It sounds like your operator needs to ask for a Plugins.HookMethod and to completely take over the entire "FormLabCaseEdit_Load" method to allow for lab cases with invalid patients to be shown. There might be even more hooks needed for anything else in that window that does not expect an invalid patient.
The best thing about a boolean is even if you are wrong, you are only off by a bit.
Jason Salmon
Open Dental Software
http://www.opendental.com
Jason Salmon
Open Dental Software
http://www.opendental.com
Re: Allow lab case entry without a patient
OK, that seems reasonable. Could you add a plugin hook method FormLabCaseEdit_Load at the beginning of FormLabCaseEdit_Load with the arguments CaseCur and IsNew? (I don't think we need anymore hooks on that form, as we completely redraw the UI).jsalmon wrote:needs to ask for a Plugins.HookMethod and to completely take over the entire "FormLabCaseEdit_Load" method to allow for lab cases with invalid patients to be shown.
Thanks.
Re: Allow lab case entry without a patient
Tim,
We added this hook to the beginning of FormLabCaseEdit_Load:
This will be present in 17.1.8.
We added this hook to the beginning of FormLabCaseEdit_Load:
Code: Select all
if(Plugins.HookMethod(this,"FormLabCaseEdit.Load_start",CaseCur,IsNew)) {
return;
}