Skip to content

Commit

Permalink
fix some handling of empties (#5041)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenwaite committed Mar 27, 2022
1 parent e60c043 commit af8148a
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 42 deletions.
41 changes: 39 additions & 2 deletions interface/forms/eye_mag/php/eye_mag_functions.php
Expand Up @@ -99,6 +99,8 @@ function priors_select($zone, $orig_id, $id_to_show, $pid, $type = 'text')

if (!empty($output)) {
$output .= "<option value='" . attr($prior['id']) . "' " . attr($selected) . ">" . text($oeexam_date) . "</option>";
} else {
$output = "<option value='" . attr($prior['id']) . "' " . attr($selected) . ">" . text($oeexam_date) . "</option>";
}
$selected = '';
$i++;
Expand All @@ -116,6 +118,8 @@ function priors_select($zone, $orig_id, $id_to_show, $pid, $type = 'text')

if (!empty($output)) {
$output .= "<option value='" . attr($priors[$i]['id']) . "' " . attr($selected) . ">" . text($priors[$i]['exam_date']) . "</option>";
} else {
$output = "<option value='" . attr($priors[$i]['id']) . "' " . attr($selected) . ">" . text($priors[$i]['exam_date']) . "</option>";
}
}
}
Expand Down Expand Up @@ -2064,6 +2068,9 @@ function display_PMSFH($rows, $view = "pending", $min_height = "min-height:344px
if (!empty($total_PMSFH)) {
$total_PMSFH += count($PMSFH[0][$key]);
$total_PMSFH += 2; //add two for the title and a space
} else {
$total_PMSFH = count($PMSFH[0][$key]);
$total_PMSFH = 2; //add two for the title and a space
}
$count[$key] = count($PMSFH[0][$key]) + 1;
}
Expand All @@ -2082,6 +2089,8 @@ function display_PMSFH($rows, $view = "pending", $min_height = "min-height:344px
if ($value['display'] == '') {
if (!empty($total_PMSFH)) {
$total_PMSFH--;
} else {
$total_PMSFH = 0;
}
$count['FH']--;
}
Expand Down Expand Up @@ -2314,6 +2323,8 @@ function display_PMSFH($rows, $view = "pending", $min_height = "min-height:344px
$counter++;
if (!empty($mention_SOCH)) {
$mentions_SOCH++;
} else {
$mentions_SOCH = 1;
}
}
}
Expand Down Expand Up @@ -2555,6 +2566,8 @@ function show_PMSFH_panel($PMSFH, $columns = '1')
onclick=\"alter_issue2('0','SOCH','');\">" . xlt($item['short_title']) . ": " . text($item['display']) . "<br /></span>";
if (!empty($mention_SOCH)) {
$mention_SOCH++;
} else {
$mention_SOCH = 1;
}
}
}
Expand Down Expand Up @@ -2637,6 +2650,9 @@ function show_PMSFH_report($PMSFH)
if (!empty($total_PMSFH)) {
$total_PMSFH += count($PMSFH[0][$key]);
$total_PMSFH += 2; //add two for the title and a space
} else {
$total_PMSFH = count($PMSFH[0][$key]);
$total_PMSFH = 2; //add two for the title and a space
}
$count[$key] = count($PMSFH[0][$key]) + 1;
}
Expand All @@ -2646,6 +2662,8 @@ function show_PMSFH_report($PMSFH)
if (($value['display'] ?? '') == '') {
if (!empty($total_PMSFH)) {
$total_PMSFH--;
} else {
$total_PMSFH = 0;
}
$count['ROS']--;
}
Expand All @@ -2655,6 +2673,8 @@ function show_PMSFH_report($PMSFH)
if ($value['display'] == '') {
if (!empty($total_PMSFH)) {
$total_PMSFH--;
} else {
$total_PMSFH = 0;
}
$count['FH']--;
}
Expand All @@ -2664,6 +2684,8 @@ function show_PMSFH_report($PMSFH)
if (($value['display'] == '') || ($value['display'] == 'not_applicable')) {
if (!empty($total_PMSFH)) {
$total_PMSFH--;
} else {
$total_PMSFH = 0;
}
$count['SOCH']--;
}
Expand Down Expand Up @@ -2843,6 +2865,8 @@ function show_PMSFH_report($PMSFH)
echo xlt($item['short_title']) . ": " . text($item['display']) . "<br />";
if (!empty($mention_PSOCH)) {
$mention_PSOCH++;
} else {
$mention_PSOCH = 1;
}
$counter++;
}
Expand Down Expand Up @@ -2898,8 +2922,11 @@ function show_PMSFH_report($PMSFH)
foreach ($PMSFH[0]['ROS'] as $item) {
if ($item['display'] ?? '') {
echo xlt($item['short_title']) . ": " . $item['display'] . "<br />";
$mention_ROS ?? '';
$mention_ROS++;
if (!empty($mention_ROS)) {
$mention_ROS++;
} else {
$mention_ROS = 1;
}
$counter++;
}
}
Expand Down Expand Up @@ -3007,6 +3034,8 @@ function display_QP($zone, $provider_id)
echo $title_show;
if (!empty($number_rows)) {
$number_rows++;
} else {
$number_rows = 1;
}
?><br />
<?php
Expand Down Expand Up @@ -3862,6 +3891,8 @@ function display($pid, $encounter, $category_value)
$episode .= '</td></tr>';
if (!empty($i)) {
$i++;
} else {
$i = 1;
}
}

Expand Down Expand Up @@ -5205,11 +5236,15 @@ function display_GlaucomaFlowSheet($pid, $bywhat = 'byday')
$gonios .= "<tr><td class='GFS_td_1 " . $hideme . "'>" . $visit['exam_date'] . "</td><td class='GFS_td " . $hideme . "' style='border:1pt dotted gray;'>" . $visit['ODGONIO'] . "</td><td class='GFS_td " . $hideme . "' style='border:1pt dotted gray;'>" . $visit['OSGONIO'] . "</td></tr>";
if (!empty($GONIO_chart)) {
$GONIO_chart .= '"1",';
} else {
$GONIO_chart = '"1",';
}
$count++;
} else {
if (!empty($GONIO_chart)) {
$GONIO_chart .= ',';
} else {
$GONIO_chart = '"1",';
}
}
}
Expand Down Expand Up @@ -5250,6 +5285,8 @@ function display_GlaucomaFlowSheet($pid, $bywhat = 'byday')
} else {
if (!empty($DISCS_chart)) {
$DISCS_chart .= '"",';
} else {
$DISCS_chart = '"",';
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions interface/forms/eye_mag/php/taskman_functions.php
Expand Up @@ -148,6 +148,8 @@ function update_taskman($task, $action, $value)
sqlQuery($sql, array($task['DOC_ID'],$task['ID']));
if (!empty($send['comments'])) {
$send['comments'] .= "Document created. ";
} else {
$send['comments'] = "Document created. ";
}
}

Expand Down
130 changes: 90 additions & 40 deletions interface/forms/eye_mag/view.php
Expand Up @@ -757,47 +757,49 @@
while ($wearing = sqlFetchArray($wear)) {
if (!empty($count_rx)) {
$count_rx++;
${"display_W_$count_rx"} = '';
${"ODSPH_$count_rx"} = $wearing['ODSPH'];
${"ODCYL_$count_rx"} = $wearing['ODCYL'];
${"ODAXIS_$count_rx"} = $wearing['ODAXIS'];
${"OSSPH_$count_rx"} = $wearing['OSSPH'];
${"OSCYL_$count_rx"} = $wearing['OSCYL'];
${"OSAXIS_$count_rx"} = $wearing['OSAXIS'];
${"ODMIDADD_$count_rx"} = $wearing['ODMIDADD'];
${"OSMIDADD_$count_rx"} = $wearing['OSMIDADD'];
${"ODADD_$count_rx"} = $wearing['ODADD'];
${"OSADD_$count_rx"} = $wearing['OSADD'];
${"ODVA_$count_rx"} = $wearing['ODVA'];
${"OSVA_$count_rx"} = $wearing['OSVA'];
${"ODNEARVA_$count_rx"} = $wearing['ODNEARVA'];
${"OSNEARVA_$count_rx"} = $wearing['OSNEARVA'];
${"ODPRISM_$count_rx"} = $wearing['ODPRISM'] ?? null;
${"OSPRISM_$count_rx"} = $wearing['OSPRISM'] ?? null;
${"W_$count_rx"} = '1';
${"RX_TYPE_$count_rx"} = $wearing['RX_TYPE'];
${"ODHPD_$count_rx"} = $wearing['ODHPD'];
${"ODHBASE_$count_rx"} = $wearing['ODHBASE'];
${"ODVPD_$count_rx"} = $wearing['ODVPD'];
${"ODVBASE_$count_rx"} = $wearing['ODVBASE'];
${"ODSLABOFF_$count_rx"} = $wearing['ODSLABOFF'];
${"ODVERTEXDIST_$count_rx"} = $wearing['ODVERTEXDIST'];
${"OSHPD_$count_rx"} = $wearing['OSHPD'];
${"OSHBASE_$count_rx"} = $wearing['OSHBASE'];
${"OSVPD_$count_rx"} = $wearing['OSVPD'];
${"OSVBASE_$count_rx"} = $wearing['OSVBASE'];
${"OSSLABOFF_$count_rx"} = $wearing['OSSLABOFF'];
${"OSVERTEXDIST_$count_rx"} = $wearing['OSVERTEXDIST'];
${"ODMPDD_$count_rx"} = $wearing['ODMPDD'];
${"ODMPDN_$count_rx"} = $wearing['ODMPDN'];
${"OSMPDD_$count_rx"} = $wearing['OSMPDD'];
${"OSMPDN_$count_rx"} = $wearing['OSMPDN'];
${"BPDD_$count_rx"} = $wearing['BPDD'];
${"BPDN_$count_rx"} = $wearing['BPDN'];
${"LENS_MATERIAL_$count_rx"} = $wearing['LENS_MATERIAL'];
${"LENS_TREATMENTS_$count_rx"} = $wearing['LENS_TREATMENTS'];
${"COMMENTS_$count_rx"} = $wearing['COMMENTS'];
} else {
$count_rx = 1;
}
${"display_W_$count_rx"} = '';
${"ODSPH_$count_rx"} = $wearing['ODSPH'];
${"ODCYL_$count_rx"} = $wearing['ODCYL'];
${"ODAXIS_$count_rx"} = $wearing['ODAXIS'];
${"OSSPH_$count_rx"} = $wearing['OSSPH'];
${"OSCYL_$count_rx"} = $wearing['OSCYL'];
${"OSAXIS_$count_rx"} = $wearing['OSAXIS'];
${"ODMIDADD_$count_rx"} = $wearing['ODMIDADD'];
${"OSMIDADD_$count_rx"} = $wearing['OSMIDADD'];
${"ODADD_$count_rx"} = $wearing['ODADD'];
${"OSADD_$count_rx"} = $wearing['OSADD'];
${"ODVA_$count_rx"} = $wearing['ODVA'];
${"OSVA_$count_rx"} = $wearing['OSVA'];
${"ODNEARVA_$count_rx"} = $wearing['ODNEARVA'];
${"OSNEARVA_$count_rx"} = $wearing['OSNEARVA'];
${"ODPRISM_$count_rx"} = $wearing['ODPRISM'] ?? null;
${"OSPRISM_$count_rx"} = $wearing['OSPRISM'] ?? null;
${"W_$count_rx"} = '1';
${"RX_TYPE_$count_rx"} = $wearing['RX_TYPE'];
${"ODHPD_$count_rx"} = $wearing['ODHPD'];
${"ODHBASE_$count_rx"} = $wearing['ODHBASE'];
${"ODVPD_$count_rx"} = $wearing['ODVPD'];
${"ODVBASE_$count_rx"} = $wearing['ODVBASE'];
${"ODSLABOFF_$count_rx"} = $wearing['ODSLABOFF'];
${"ODVERTEXDIST_$count_rx"} = $wearing['ODVERTEXDIST'];
${"OSHPD_$count_rx"} = $wearing['OSHPD'];
${"OSHBASE_$count_rx"} = $wearing['OSHBASE'];
${"OSVPD_$count_rx"} = $wearing['OSVPD'];
${"OSVBASE_$count_rx"} = $wearing['OSVBASE'];
${"OSSLABOFF_$count_rx"} = $wearing['OSSLABOFF'];
${"OSVERTEXDIST_$count_rx"} = $wearing['OSVERTEXDIST'];
${"ODMPDD_$count_rx"} = $wearing['ODMPDD'];
${"ODMPDN_$count_rx"} = $wearing['ODMPDN'];
${"OSMPDD_$count_rx"} = $wearing['OSMPDD'];
${"OSMPDN_$count_rx"} = $wearing['OSMPDN'];
${"BPDD_$count_rx"} = $wearing['BPDD'];
${"BPDN_$count_rx"} = $wearing['BPDN'];
${"LENS_MATERIAL_$count_rx"} = $wearing['LENS_MATERIAL'];
${"LENS_TREATMENTS_$count_rx"} = $wearing['LENS_TREATMENTS'];
${"COMMENTS_$count_rx"} = $wearing['COMMENTS'];
}
?>
<div class="loading" id="LayerTechnical_sections_loading" name="LayerTechnical_sections_loading"><i class="fa fa-spinner fa-spin"></i>
Expand Down Expand Up @@ -1596,6 +1598,14 @@

$CTLMANUFACTURER_list_OD .= '>' . text(substr($row['title'], 0, 12)) . '</option>
' ;
} else {
$CTLMANUFACTURER_list_OD = '<option value="' . attr($row['option_id']) . '"';
if ($CTLMANUFACTUREROD == $row['option_id']) {
$CTLMANUFACTURER_list_OD = "selected";
}

$CTLMANUFACTURER_list_OD = '>' . text(substr($row['title'], 0, 12)) . '</option>
' ;
}

if (!empty($CTLMANUFACTURER_list_OS)) {
Expand All @@ -1606,6 +1616,14 @@

$CTLMANUFACTURER_list_OS .= '>' . text(substr($row['title'], 0, 12)) . '</option>
' ;
} else {
$CTLMANUFACTURER_list_OS = '<option value="' . attr($row['option_id']) . '"';
if ($CTLMANUFACTUREROS == $row['option_id']) {
$CTLMANUFACTURER_list_OS = "selected";
}

$CTLMANUFACTURER_list_OS = '>' . text(substr($row['title'], 0, 12)) . '</option>
' ;
}
}

Expand All @@ -1621,6 +1639,14 @@

$CTLSUPPLIER_list_OD .= '>' . text(substr($row['title'], 0, 10)) . '</option>
' ;
} else {
$CTLSUPPLIER_list_OD = '<option value="' . attr($row['option_id']) . '"';
if ($CTLSUPPLIEROD == $row['option_id']) {
$CTLSUPPLIER_list_OD = "selected";
}

$CTLSUPPLIER_list_OD = '>' . text(substr($row['title'], 0, 10)) . '</option>
' ;
}

if (!empty($CTLSUPPLIER_list_OS)) {
Expand All @@ -1631,6 +1657,14 @@

$CTLSUPPLIER_list_OS .= '>' . text(substr($row['title'], 0, 10)) . '</option>
' ;
} else {
$CTLSUPPLIER_list_OS = '<option value="' . attr($row['option_id']) . '"';
if ($CTLSUPPLIEROS == $row['option_id']) {
$CTLSUPPLIER_list_OS = "selected";
}

$CTLSUPPLIER_list_OS = '>' . text(substr($row['title'], 0, 10)) . '</option>
' ;
}
}

Expand All @@ -1646,6 +1680,14 @@

$CTLBRAND_list_OD .= '>' . text(substr($row['title'], 0, 15)) . '</option>
' ;
} else {
$CTLBRAND_list_OD = '<option value="' . attr($row['option_id']) . '"';
if ($CTLBRANDOD == $row['option_id']) {
$CTLBRAND_list_OD = "selected";
}

$CTLBRAND_list_OD = '>' . text(substr($row['title'], 0, 15)) . '</option>
' ;
}

if (!empty($CTLSBRAN_list_OS)) {
Expand All @@ -1656,6 +1698,14 @@

$CTLBRAND_list_OS .= '>' . text(substr($row['title'], 0, 15)) . '</option>
' ;
} else {
$CTLBRAND_list_OS = '<option value="' . attr($row['option_id']) . '"';
if ($CTLBRANDOS == $row['option_id']) {
$CTLBRAND_list_OS = "selected";
}

$CTLBRAND_list_OS = '>' . text(substr($row['title'], 0, 15)) . '</option>
' ;
}
}
?>
Expand Down

0 comments on commit af8148a

Please sign in to comment.