LBF forms are not saving the first data field. There is a bug in the ./forms/LBF/new.php file near
if ($value !== '') {
if ($newid) {
sqlStatement("INSERT INTO lbf_data " .
"( form_id, field_id, field_value ) " .
" VALUES ( '$newid', '$field_id', '$value' )");
}
else {
$newid = sqlInsert("INSERT INTO lbf_data " .
"( field_id, field_value ) " .
" VALUES ( '$field_id', '$value' )");
/*echo "Inserting the missing data";
sqlStatement("INSERT INTO lbf_data " .
"( form_id, field_id, field_value ) " .
" VALUES ( '$newid', '$field_id', '$value' )");*/
}
}
I wrote the code in the comments as a temporary fix, the bug is that the $newid is 0 in the first run so the first data field is not store.
Test Case:
....../forms/LBF/new.php file. Around after line 100 if ($value !== '') { if ($newid) { sqlStatement("INSERT INTO lbf_data " . "( form_id, field_id, field_value ) " . " VALUES ( '$newid', '$field_id', '$value' )"); } else { echo "NotNewid<BR>"; $newid = sqlInsert("INSERT INTO lbf_data " . "( field_id, field_value ) " . " VALUES ( '$field_id', '$value' )"); } } // Note that a completely empty form will not be created at all! } } Here's a partial output when creating a new lbf same form for an encounter 0 complaints test 325912 psychosocial_history test1 325912 past_psych_history test2 I don't know what 325912 is. It's probably field_id, field_value in the above code but as you can see that for the first entry, it is 0 . So it's not saving the first data line for 325912.
hi,
Is there a way we can get this fix within git or in a patch format? Could use something like if ($newid || $newid===0)
thanks,
-brady