SQL Query Error When Adding New Patient

This error appears reproducible. It occurs if Edit Global Settings>Insurance>Simplified Demographics is checked, but not when it’s unchecked. It occurs when a patient is created using Add New Patient in Patient Finder.

Query Error

ERROR: insert failed: INSERT INTO insurance_data SET type = ?, provider = ?, policy_number = ?, group_number = ?, plan_name = ?, subscriber_lname = ?, subscriber_mname = ?, subscriber_fname = ?, subscriber_relationship = ?, subscriber_ss = ?, subscriber_DOB = ?, subscriber_street = ?, subscriber_postal_code = ?, subscriber_city = ?, subscriber_state = ?, subscriber_country = ?, subscriber_phone = ?, subscriber_employer = ?, subscriber_employer_city = ?, subscriber_employer_street = ?, subscriber_employer_postal_code = ?, subscriber_employer_state = ?, subscriber_employer_country = ?, copay = ?, subscriber_sex = ?, pid = ?, date = ?, accept_assignment = ?, policy_type = ?

Error: Column ‘accept_assignment’ cannot be null

/var/www/openemr/library/patient.inc at 1349:sqlInsert
/var/www/openemr/interface/new/new_comprehensive_save.php at 126:newInsuranceData(5,primary,)

I’m running openemr 6.0.0 on Turnkey Linux LAMP in VirtualBox

hi @gvh, it was fixed in patch 1.

Thanks Stephen. I’ll search first from now on.

I installed 6.0.0 patch 1 and that fixed the Query Error, " Error: Column ‘accept_assignment’ cannot be null", that occurred when a patient was created.

But the same error still occurs when saving an edit of the Patient Demographic data. Despite the error, the edit is saved.

The error appears reproducible even after today’s release of patch 2 is applied. Here’s the error:

Query Error

ERROR: insert failed: INSERT INTO insurance_data SET type = ?, provider = ?, policy_number = ?, group_number = ?, plan_name = ?, subscriber_lname = ?, subscriber_mname = ?, subscriber_fname = ?, subscriber_relationship = ?, subscriber_ss = ?, subscriber_DOB = ?, subscriber_street = ?, subscriber_postal_code = ?, subscriber_city = ?, subscriber_state = ?, subscriber_country = ?, subscriber_phone = ?, subscriber_employer = ?, subscriber_employer_city = ?, subscriber_employer_street = ?, subscriber_employer_postal_code = ?, subscriber_employer_state = ?, subscriber_employer_country = ?, copay = ?, subscriber_sex = ?, pid = ?, date = ?, accept_assignment = ?, policy_type = ?

Error: Column ‘accept_assignment’ cannot be null

/var/www/openemr/library/patient.inc at 1353:sqlInsert
/var/www/openemr/interface/patient_file/summary/demographics_save.php at 105:newInsuranceData(10001004,primary,)

thanks for the bug report @gvh, will get this fixed for the next patch, for an easy fix try adding

    if (is_null($accept_assignment)) {
        $accept_assignment = "TRUE";
    }
    if (is_null($policy_type)) {
        $policy_type = "";
    }

to this line of this file

Thanks for the fix Stephen

1 Like