Page 1 of 1

Add Patient Fields in Date data type

Posted: Thu Jan 24, 2019 11:49 pm
by mopensoft
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

Re: Add Patient Fields in Date data type

Posted: Fri Jan 25, 2019 9:00 am
by jsalmon
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