Skip to content

Commit

Permalink
fix: set default if only 1 effective insurance (openemr#7546)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenwaite committed Jul 2, 2024
1 parent 1fc056a commit ce4eac3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion interface/billing/billing_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -1117,12 +1117,16 @@ function criteriaSelectHasValue(select) {

$last_level_closed = sqlQuery("SELECT `last_level_closed` FROM `form_encounter` WHERE `encounter` = ?", array($iter['enc_encounter']))['last_level_closed'];
$effective_insurances = getEffectiveInsurances($iter['pid'], $iter['enc_date']);
$insuranceCount = count($effective_insurances ?? []);

foreach ($effective_insurances as $key => $row) {
$insuranceName = sqlQuery("SELECT `name` FROM `insurance_companies` WHERE `id` = ?", array($row['provider']))['name'];
$x12Partner = sqlQuery("SELECT `x12_default_partner_id` FROM `insurance_companies` WHERE `id` = ?", array($row['provider']))['x12_default_partner_id'];
$lhtml .= "<option value=\"" . attr(substr($row['type'], 0, 1) . $row['provider']) . "\"";
if ($key == $last_level_closed) {
if (
$key == $last_level_closed
|| $insuranceCount = 1
) {
$lhtml .= " selected";
$default_x12_partner = $x12Partner;
}
Expand Down

0 comments on commit ce4eac3

Please sign in to comment.