Skip to content

Commit

Permalink
Rel 702 openemr 7503 7509 7511 7527 (openemr#7536)
Browse files Browse the repository at this point in the history
* Fixes openemr#7503 user admin create empty google sign in (openemr#7504)

* Fixes openemr#7503 user admin create empty google sign in

Fixes openemr#7503 by allowing the multiple users to have an empty google sign
in email address. If the address is empty it sets the value to null
which doesn't trigger the unique constraint.

* Fixes unit tests.

Was missing the null value on the insert, thought the custom escape
would handle it... but no.  Tried to refactor to be bound parameters but
found out the insert happens inside AuthUtils... instead of breaking the
heavily vetted password creation pieces by changing up the function
logic, backed out all the code and made the simple fix... sad.

* Fixes openemr#7509 twigify dicom viewer (openemr#7510)

* Fixes openemr#7509 twigify dicom viewer

Make it so the dicom viewer uses twig for its rendering so module
writers can extend the template.

Also fixed a number of strings and variables missing escaping and
language translation.

* Fix style fixes

* Fixes openemr#7511 documents stray html tags (openemr#7512)

Made it so the <br /> tag does not show up in the message statuses when
updating document properties.
Fixes openemr#7511

* Fixes openemr#7526 labcore fix date collected issues (openemr#7527)

* Fixes openemr#7526 labcore fix date collected issues

Made it so the date collected issue works when doing the manual ereq for
labcore.

Fixes openemr#7526

* Remove unneccessary use statement

* Change collection_date null to empty string value

* fix: bug

---------

Co-authored-by: stephen waite <[email protected]>
  • Loading branch information
adunsulag and stephenwaite authored Jun 29, 2024
1 parent ef74254 commit 1fc056a
Show file tree
Hide file tree
Showing 7 changed files with 506 additions and 474 deletions.
6 changes: 3 additions & 3 deletions controllers/C_Document.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ public function update_action_process(string $patient_id = null, $document_id)
$d->set_name($docname);
$d->persist();
$d->populate();
$messages .= xl('Document successfully renamed.') . "<br />";
$messages .= xl('Document successfully renamed.') . "\n";
}

if (preg_match('/^\d\d\d\d-\d+-\d+$/', $docdate)) {
Expand All @@ -1082,7 +1082,7 @@ public function update_action_process(string $patient_id = null, $document_id)
$sql = "UPDATE documents SET docdate = ?, list_id = ? WHERE id = ?";
$this->tree->_db->Execute($sql, [$docdate, $issue_id, $document_id]);
}
$messages .= xl('Document date and issue updated successfully') . "<br />";
$messages .= xl('Document date and issue updated successfully') . "\n";
}

$this->_state = false;
Expand Down Expand Up @@ -1329,7 +1329,7 @@ public function tag_action_process(string $patient_id = null, $document_id)
$d->set_encounter_check($encounter_check);
$d->persist();

$messages .= xlt('Document tagged to Encounter successfully') . "<br />";
$messages .= xlt('Document tagged to Encounter successfully') . "\n";
}

$this->_state = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
window.location.href = "<?php echo $GLOBALS['web_root'] ?>/interface/patient_file/summary/demographics.php?set_pid=<?php echo urlencode(attr($_SESSION['pid'] ?? $pid ?? '')) ?>";
});
});
<?php } else if (!$isValidKey) { ?>
<?php } elseif (!$isValidKey) { ?>
$(function () {
$('#form_reset_key').removeClass('d-none');
const warnMsg = "<?php
Expand Down Expand Up @@ -219,7 +219,7 @@ function generateDebugInfo() {
</div>
</div>
<div class="container-xl mt-3">
<iframe id="wenoIfram" title="Weno IFRAME" width="100%" height="900" src="<?php echo $urlOut; ?>"></iframe>
<iframe id="wenoIfram" title="Weno IFRAME" width="100%" height="900" src="<?php echo attr($urlOut); ?>"></iframe>
</div>
<footer>
<a href="<?php echo $GLOBALS['web_root'] ?>/interface/patient_file/summary/demographics.php?set_pid=<?php echo urlencode(attr($_SESSION['pid'] ?? $pid)) ?>" class="btn btn-primary float-right mt-2 mb-4 mr-3"><?php echo xlt("Return to Demographics"); ?></a>
Expand Down
52 changes: 32 additions & 20 deletions interface/procedure_tools/labcorp/ereq_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ function ereqForm($pid, $encounter, $form_id, $reqStr = null, $doDoc = true)
$pdfContent .= '<td style="width:55%;">';
$pdfContent .= '<table>';

$collection_date = date("m/d/Y", strtotime($procedure['date_collected']));
$collection_time = date("H:i", strtotime($procedure['date_collected']));
if (!empty($procedure['date_collected'])) {
$collection_date = date("m/d/Y", strtotime($procedure['date_collected']));
$collection_time = date("H:i", strtotime($procedure['date_collected']));
} else {
$collection_date = '';
$collection_time = '';
}
$pdfContent .= '<tr>';
$pdfContent .= '<td style="text-align:right;width:35%;">Collection Date:</td>';
$pdfContent .= '<td style="width:65%;">' . text($collection_date) . '</td>';
Expand Down Expand Up @@ -161,6 +166,7 @@ function ereqForm($pid, $encounter, $form_id, $reqStr = null, $doDoc = true)
$procedure_left = $proc_order - $procedure_right;
$all_procedures = array();
$all_diagnoses = array();

if (!empty($procedure['order_diagnosis'])) {
$all_diagnoses[] = $procedure['order_diagnosis'];
}
Expand All @@ -181,7 +187,9 @@ function ereqForm($pid, $encounter, $form_id, $reqStr = null, $doDoc = true)
$pdfContent .= '<tr>';
$pdfContent .= '<td class="width50">' . text($all_procedures[$i]['procedure_code']) . '</td>';
$temp_diag = explode(";", $all_procedures[$i]['diagnoses']);
$all_diagnoses[] = $temp_diag;
foreach ($temp_diag as $sub_diag) {
$all_diagnoses[] = $sub_diag;
}
$pdfContent .= '</tr>';
}
$pdfContent .= '</table>';
Expand All @@ -201,7 +209,9 @@ function ereqForm($pid, $encounter, $form_id, $reqStr = null, $doDoc = true)
$pdfContent .= '<tr>';
$pdfContent .= '<td class="width50">' . text($all_procedures[$i]['procedure_code']) . '</td>';
$temp_diag = explode(";", $all_procedures[$i]['diagnoses']);
$all_diagnoses[] = $temp_diag;
foreach ($temp_diag as $sub_diag) {
$all_diagnoses[] = $sub_diag;
}
$pdfContent .= '</tr>';
}
$pdfContent .= '</table>';
Expand Down Expand Up @@ -365,25 +375,27 @@ function ereqForm($pid, $encounter, $form_id, $reqStr = null, $doDoc = true)
$pdfContent .= '<td style="padding-left:8px;" colspan="8"><b>Diagnosis Codes:</b>List all applicable Diagnosis codes. Must be at Highest Level Specificity.</td>';
$pdfContent .= '</tr>';
$pdfContent .= '<tr>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[0])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[1])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[2])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[3])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[4])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[5])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[6])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[7])) . '</td>';
// need to remove the code system prefix
$codesOnlyArray = [];
foreach ($all_diagnoses as $diagnosis) {
$splitCode = explode(":", $diagnosis);
if (!empty($splitCode)) {
if (!empty($splitCode[1])) {
$codesOnlyArray[] = $splitCode[1];
} else {
$codesOnlyArray[] = $splitCode;
}
}
}
for ($i = 0; $i < 8; $i++) {
$pdfContent .= '<td style="width:12.5%;" >' . text($codesOnlyArray[$i] ?? '') . '</td>';
}
$pdfContent .= '</tr>';
if (!empty($all_diagnoses[8])) {
$pdfContent .= '<tr>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[8])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[9])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[10])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[11])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[12])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[13])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[14])) . '</td>';
$pdfContent .= '<td style="width:12.5%;" >' . text(str_replace('ICD10:', '', $all_diagnoses[15])) . '</td>';
for ($i = 8; $i < 16; $i++) {
$pdfContent .= '<td style="width:12.5%;" >' . text($codesOnlyArray[$i] ?? '') . '</td>';
}
$pdfContent .= '</tr>';
}

Expand Down
12 changes: 9 additions & 3 deletions interface/procedure_tools/labcorp/gen_hl7_order.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@

use OpenEMR\Common\Logging\EventAuditLogger;

require_once("$srcdir/classes/Address.class.php");
require_once("$srcdir/classes/InsuranceCompany.class.php");
require_once("$webserver_root/custom/code_types.inc.php");

function hl7Text($s)
Expand Down Expand Up @@ -355,7 +353,11 @@ function gen_hl7_order($orderid, &$out, &$reqStr)
$P[70] = $vitals['height'];
$P[88] = $vitals['bps'] . '^' . $vitals['bpd'];
$P[89] = $vitals['waist_circ'];
$C[17] = hl7Date(date("Ymd", strtotime($porow['date_collected'])));
if (!empty($porow['date_collected'])) {
$C[17] = hl7Date(date("Ymd", strtotime($porow['date_collected'])));
} else {
$C[17] = '';
}
if (empty($porow['account'])) {
return "ERROR! Missing this orders facility location account code (Facility Id) in Facility!";
}
Expand Down Expand Up @@ -817,6 +819,10 @@ function send_hl7_order($ppid, $out)
// Compute the target path/file name.
$filename = $msgid . '.hl7';
if ($pprow['orders_path']) {
if (!file_exists($pprow['orders_path'])) {
// attempt to make the directory
mkdir($pprow['orders_path']);
}
$filename = $pprow['orders_path'] . '/' . $filename;
}

Expand Down
13 changes: 11 additions & 2 deletions interface/usergroup/usergroup_admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,15 @@
}

if ($doit == true) {
// google_signin_email has unique key constraint, needs to be handled differently
$googleSigninEmail = "NULL";
if (isset($_POST["google_signin_email"])) {
if (empty($_POST["google_signin_email"])) {
$googleSigninEmail = "NULL";
} else {
$googleSigninEmail = "'" . add_escape_custom(trim($_POST["google_signin_email"])) . "'";
}
}
$insertUserSQL =
"insert into users set " .
"username = '" . add_escape_custom(trim((isset($_POST['rumple']) ? $_POST['rumple'] : ''))) .
Expand All @@ -351,8 +360,8 @@
"', mname = '" . add_escape_custom(trim((isset($_POST['mname']) ? $_POST['mname'] : ''))) .
"', lname = '" . add_escape_custom(trim((isset($_POST['lname']) ? $_POST['lname'] : ''))) .
"', suffix = '" . add_escape_custom(trim((isset($_POST['suffix']) ? $_POST['suffix'] : ''))) .
"', google_signin_email = '" . add_escape_custom(trim((isset($_POST['google_signin_email']) ? $_POST['google_signin_email'] : ''))) .
"', valedictory = '" . add_escape_custom(trim((isset($_POST['valedictory']) ? $_POST['valedictory'] : ''))) .
"', google_signin_email = " . $googleSigninEmail .
", valedictory = '" . add_escape_custom(trim((isset($_POST['valedictory']) ? $_POST['valedictory'] : ''))) .
"', federaltaxid = '" . add_escape_custom(trim((isset($_POST['federaltaxid']) ? $_POST['federaltaxid'] : ''))) .
"', state_license_number = '" . add_escape_custom(trim((isset($_POST['state_license_number']) ? $_POST['state_license_number'] : ''))) .
"', newcrop_user_role = '" . add_escape_custom(trim((isset($_POST['erxrole']) ? $_POST['erxrole'] : ''))) .
Expand Down
Loading

0 comments on commit 1fc056a

Please sign in to comment.