Add Patient Fields in Date data type

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:

Add Patient Fields in Date data type

Post by mopensoft » Thu Jan 24, 2019 11:49 pm

Hi OpenDental,

I got into an issue with Patient Field setup with Date data type. In FormPatFieldDateEdit.cs, the butOK_Click() implementation doesn't allow user to enter any value if the field is empty. Checking the code below, the _fieldCur.FieldValue and _fieldOld.FieldValue are both empty if there's no value for the current field. If you want to keep that code, I think you need to update the _fieldCur.FieldValue when the textFieldDate.Text changed but currently there's no such event handler. Could you double check and give advice? Note that if the patient field data type is TEXT, there's no issue.

Code: Select all

private void butOK_Click(object sender, System.EventArgs e) {
			if(textFieldDate.errorProvider1.GetError(textFieldDate)!="") {
				MsgBox.Show(this,"Invalid date");
				return;
			}
			if(_fieldCur.FieldValue==""){//if blank, then delete
				if(IsNew) {
					DialogResult=DialogResult.Cancel;
					return;
				}
				PatFields.Delete(_fieldCur);
				if(_fieldOld.FieldValue!="") {//We don't need to make a log for field values that were blank because the user simply clicked cancel.
					PatFields.MakeDeleteLogEntry(_fieldOld);
				}
				DialogResult=DialogResult.OK;
				return;
			}
			_fieldCur.FieldValue=textFieldDate.Text;
			if(IsNew){
				PatFields.Insert(_fieldCur);
			}
			else{
				PatFields.Update(_fieldCur);
				PatFields.MakeEditLogEntry(_fieldOld,_fieldCur);
			}
			DialogResult=DialogResult.OK;
		}
Thanks,
Minh

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: Add Patient Fields in Date data type

Post by jsalmon » Fri Jan 25, 2019 9:00 am

That bug, "Patient Fields, date and currency types were not being saved to the database", was fixed and released with v18.4.19 and will be released with v18.3.46
https://opendentalsoft.com:1943/ODBugTr ... .aspx#18.3
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

Post Reply