Skip to content

Commit

Permalink
hardcode OID codetype in find code popup (openemr#5327)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenwaite committed May 14, 2022
1 parent 7c4764f commit 29a49b8
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions interface/patient_file/encounter/find_code_popup.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ function selcode_target(codetype, code, selector, codedesc, target_element) {
}
?>
<?php if (!empty($allowed_codes)) { ?>
<form class="form-inline" method='post' name='theform' action='find_code_popup.php<?php echo $string_target_element ?>codetype=<?php echo attr_url($codetype) ?>'>
<form class="form-inline" method='post' name='theform'
action='find_code_popup.php<?php echo $string_target_element ?>codetype=<?php echo attr_url($codetype) ?>'>
<?php } else { ?>
<form class="form-inline" method='post' name='theform' action='find_code_popup.php<?php echo $string_target_element ?>'>
<form class="form-inline" method='post' name='theform'
action='find_code_popup.php<?php echo $string_target_element ?>'>
<?php } ?>
<input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
<div class="form-group">
Expand All @@ -123,7 +125,8 @@ function selcode_target(codetype, code, selector, codedesc, target_element) {
}
$selected_attr = ($default == $code) ? " selected='selected'" : '';
?>
<option value='<?php echo attr($code) ?>'<?php echo $selected_attr ?>><?php echo xlt($code_types[$code]['label']) ?></option>
<option value='<?php echo attr($code) ?>'<?php
echo $selected_attr ?>><?php echo xlt($code_types[$code]['label']) ?></option>
<?php } ?>
</select>
<?php
Expand Down Expand Up @@ -156,12 +159,15 @@ function selcode_target(codetype, code, selector, codedesc, target_element) {
title='<?php echo xla('Any part of the desired code or its description'); ?>'
placeholder="<?php echo xla('Search for'); ?>" />
<div class="input-group-append">
<button type='submit' class='btn btn-primary btn-search' name='bn_search' value='Search'></button>
<button type='submit' class='btn btn-primary btn-search'
name='bn_search' value='Search'></button>
<?php if (!empty($target_element)) { ?>
<button type='button' class='btn btn-primary btn-delete' value=''
onclick="selcode_target('', '', '', '', <?php echo attr_js($target_element); ?>)"></button>
onclick="selcode_target('', '', '', '',
<?php echo attr_js($target_element); ?>)"></button>
<?php } else { ?>
<button type='button' class='btn btn-danger btn-delete' value='' onclick="selcode('', '', '', '')"></button>
<button type='button' class='btn btn-danger btn-delete' value=''
onclick="selcode('', '', '', '')"></button>
<?php } ?>
</div>
</div>
Expand Down Expand Up @@ -189,7 +195,8 @@ function selcode_target(codetype, code, selector, codedesc, target_element) {
$selector = $row['selector'];
$desc = $row['name'];
$anchor = "<a href='' " .
"onclick='return selcode(\"PROD\", " . attr_js($drug_id) . ", " . attr_js($selector) . ", " . attr_js($desc) . ")'>";
"onclick='return selcode(\"PROD\", " .
attr_js($drug_id) . ", " . attr_js($selector) . ", " . attr_js($desc) . ")'>";
echo "<tr>";
echo "<td>$anchor" . text($drug_id . ":" . $selector) . "</a></td>\n";
echo "<td>$anchor" . text($desc) . "</a></td>\n";
Expand All @@ -200,16 +207,22 @@ function selcode_target(codetype, code, selector, codedesc, target_element) {
$itercode = $row['code'];
$itertext = ucfirst(strtolower(trim($row['code_text'])));
$dynCodeType = $form_code_type ?: $codetype;
if (stripos($dynCodeType, 'VALUESET') !== false) {
if (stripos($dynCodeType, 'VALUESET-OID') !== false) {
$dynCodeType = 'OID';
} elseif (stripos($dynCodeType, 'VALUESET') !== false) {
$dynCodeType = $row['valueset_code_type'] ?? 'VALUESET';
}
if (!empty($target_element)) {
// add a 5th parameter to function to select the target element on the form for placing the code.
// add a 5th parameter to function to select the target element
// on the form for placing the code.
$anchor = "<a href='' " .
"onclick='return selcode_target(" . attr_js($dynCodeType) . ", " . attr_js($itercode) . ", \"\", " . attr_js($itertext) . ", " . attr_js($target_element) . ")'>";
"onclick='return selcode_target(" . attr_js($dynCodeType) .
", " . attr_js($itercode) . ", \"\", " . attr_js($itertext) .
", " . attr_js($target_element) . ")'>";
} else {
$anchor = "<a href='' " .
"onclick='return selcode(" . attr_js($dynCodeType) . ", " . attr_js($itercode) . ", \"\", " . attr_js($itertext) . ")'>";
"onclick='return selcode(" . attr_js($dynCodeType) .
", " . attr_js($itercode) . ", \"\", " . attr_js($itertext) . ")'>";
}
echo " <tr>";
echo " <td>$anchor" . text($itercode) . "</a></td>\n";
Expand Down

0 comments on commit 29a49b8

Please sign in to comment.