Skip to content

Commit

Permalink
Merge pull request openemr#7244 from sjpadgett/702_cherries
Browse files Browse the repository at this point in the history
Master to 702 patch 2 Cherry Picks
  • Loading branch information
sjpadgett authored Feb 22, 2024
2 parents 9c3a636 + 8f1e07f commit a5cba0e
Show file tree
Hide file tree
Showing 101 changed files with 5,301 additions and 1,241 deletions.
31 changes: 7 additions & 24 deletions controllers/C_Document.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* @package OpenEMR
* @link https://www.open-emr.org
* @author Brady Miller <[email protected]>
* @author Jerry Padgett <[email protected]>
* @copyright Copyright (c) 2019 Brady Miller <[email protected]>
* @copyright Copyright (c) 2019-2024 Jerry Padgett <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

Expand All @@ -18,6 +20,7 @@
use OpenEMR\Common\Csrf\CsrfUtils;
use OpenEMR\Common\Logging\SystemLogger;
use OpenEMR\Common\Twig\TwigContainer;
use OpenEMR\Services\DocumentTemplates\DocumentTemplateService;
use OpenEMR\Services\FacilityService;
use OpenEMR\Services\PatientService;
use OpenEMR\Events\PatientDocuments\PatientDocumentTreeViewFilterEvent;
Expand All @@ -35,6 +38,7 @@ class C_Document extends Controller
private $Document;
private $cryptoGen;
private bool $skip_acl_check = false;
private DocumentTemplateService $templateService;

public function __construct($template_mod = "general")
{
Expand Down Expand Up @@ -66,6 +70,7 @@ public function __construct($template_mod = "general")

// Create a crypto object that will be used for for encryption/decryption
$this->cryptoGen = new CryptoGen();
$this->templateService = new DocumentTemplateService();
}

public function upload_action($patient_id, $category_id)
Expand Down Expand Up @@ -100,31 +105,9 @@ public function upload_action($patient_id, $category_id)
}
$this->assign("TEMPLATES_LIST", $templates_options);

// duplicate template list for new template form editor sjp 05/20/2019
// will call as module or individual template.
$templatedir = $GLOBALS['OE_SITE_DIR'] . '/documents/onsite_portal_documents/templates';
$templates_options = "<option value=''>-- " . xlt('Open Forms Module') . " --</option>";
if (file_exists($templatedir)) {
$dh = opendir($templatedir);
}
if ($dh) {
$templateslist = array();
while (false !== ($sfname = readdir($dh))) {
if (substr($sfname, 0, 1) == '.') {
continue;
}
if (substr(strtolower($sfname), strlen($sfname) - 4) == '.tpl') {
$templateslist[$sfname] = $sfname;
}
}
closedir($dh);
ksort($templateslist);
foreach ($templateslist as $sfname) {
$optname = str_replace('_', ' ', basename($sfname, ".tpl"));
$templates_options .= "<option value='" . attr($sfname) . "'>" . text($optname) . "</option>";
}
}
$this->assign("TEMPLATES_LIST_PATIENT", $templates_options);
$templates_list = $this->templateService->renderPortalTemplateMenu($patient_id, '-patient-', false) ?? [];
$this->assign("TEMPLATES_LIST_PATIENT", $templates_list);

$activity = $this->fetch($GLOBALS['template_dir'] . "documents/" . $this->template_mod . "_upload.html");
$this->assign("activity", $activity);
Expand Down
79 changes: 38 additions & 41 deletions interface/billing/sl_eob_process.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ function era_callback(&$out)

// This reports detail lines already on file for this service item.
if ($prev) {
$codetype = $codes[$codekey]['code_type']; //store code type
$codetype = $codes[$codekey]['code_type'] ?? 'none'; //store code type
writeOldDetail($prev, $patient_name, $invnumber, $service_date, $codekey, $bgcolor);
// Check for sanity in amount charged.
$prevchg = sprintf("%.2f", $prev['chg'] + ($prev['adj'] ?? null));
Expand All @@ -386,19 +386,6 @@ function era_callback(&$out)
$error = true;
}

// Check for already-existing primary remittance activity.
// Removed this check because it was not allowing for copays manually
// entered into the invoice under a non-copay billing code.
/****
if ((sprintf("%.2f",$prev['chg']) != sprintf("%.2f",$prev['bal']) ||
$prev['adj'] != 0) && $primary)
{
writeMessageLine($bgcolor, 'errdetail',
"This service item already has primary payments and/or adjustments!");
$error = true;
}
****/

unset($codes[$codekey]);
} else { // If the service item is not in our database...
// This is not an error. If we are not in error mode and not debugging,
Expand Down Expand Up @@ -546,36 +533,46 @@ function era_callback(&$out)

writeMessageLine($bgcolor, $class, $description . ' ' .
sprintf("%.2f", $adj['amount']));
} else { // Other group codes for primary insurance are real adjustments.
if (!$error && !$debug) {
SLEOB::arPostAdjustment(
$pid,
$encounter,
$InsertionId[$out['check_number']],
$adj['amount'], //$InsertionId[$out['check_number']] gives the session id
$codekey,
substr($inslabel, 3),
"Adjust code " . $adj['reason_code'],
$debug,
'',
$codetype ?? '',
$out['payer_claim_id']
);
$invoice_total -= $adj['amount'];
}

writeDetailLine(
$bgcolor,
$class,
$patient_name,
$invnumber,
} elseif (
$svc['paid'] == 0
&& !(
$adj['group_code'] == "CO"
&& (
$adj['reason_code'] == '45'
|| $adj['reason_code'] == '59'
)
)
) {
$class = 'errdetail';
$error = true;
} elseif (!$error && !$debug) {
SLEOB::arPostAdjustment(
$pid,
$encounter,
$InsertionId[$out['check_number']],
$adj['amount'], //$InsertionId[$out['check_number']] gives the session id
$codekey,
$production_date,
$description,
0 - $adj['amount'],
($error ? '' : $invoice_total)
substr($inslabel, 3),
"Adjust code " . $adj['reason_code'],
$debug,
'',
$codetype ?? '',
$out['payer_claim_id']
);
$invoice_total -= $adj['amount'];
}

writeDetailLine(
$bgcolor,
$class,
$patient_name,
$invnumber,
$codekey,
$production_date,
$description,
0 - $adj['amount'],
($error ? '' : $invoice_total)
);
}
} // End of service item

Expand Down
4 changes: 4 additions & 0 deletions interface/forms/LBF/printable.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@

if ($PDF_OUTPUT) {
$config_mpdf = Config_Mpdf::getConfigMpdf();
$config_mpdf['margin_top'] = $config_mpdf['margin_top'] * 1.5;
$config_mpdf['margin_bottom'] = $config_mpdf['margin_bottom'] * 1.5;
$config_mpdf['margin_header'] = $GLOBALS['pdf_top_margin'];
$config_mpdf['margin_footer'] = $GLOBALS['pdf_bottom_margin'];
$pdf = new mPDF($config_mpdf);
$pdf->SetDisplayMode('real');
if ($_SESSION['language_direction'] == 'rtl') {
Expand Down
48 changes: 45 additions & 3 deletions interface/forms/fee_sheet/new.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function echoServiceLines()
if ($codetype != 'COPAY' && (!empty($code_types[$codetype]['mod']) || $modifier)) {
echo " <td class='billcell'><input type='text' class='form-control form-control-sm' name='bill[" . attr($lino) . "][mod]' " .
"title='" . xla("Multiple modifiers can be separated by colons or spaces, maximum of 4 (M1:M2:M3:M4)") . "' " .
"value='" . attr($modifier) . "' size='" . attr($code_types[$codetype]['mod']) . " 'onkeyup='policykeyup(this)' /></td>\n";
"value='" . attr($modifier) . "' size='" . attr($code_types[$codetype]['mod']) . "' onkeyup='policykeyup(this)' onblur='formatModifier(this)' /></td>\n";
} else {
echo " <td class='billcell'>&nbsp;</td>\n";
}
Expand Down Expand Up @@ -670,7 +670,12 @@ function echoProductLines()

$arrcode = explode('|', $codestring);
if (strpos($arrcode[1], ':') !== false) {
list($code, $modifier) = explode(":", $arrcode[1]);
$tmp = explode(':', $arrcode[1]);
$code = $tmp[0] ?? '';
$modifier = $tmp[1] ?? '';
$modifier .= ($tmp[2] ?? '') ? ":" . $tmp[2] : '';
$modifier .= ($tmp[3] ?? '') ? ":" . $tmp[3] : '';
$modifier .= ($tmp[4] ?? '') ? ":" . $tmp[4] : '';
} else {
$code = $arrcode[1];
$modifier = '';
Expand Down Expand Up @@ -906,6 +911,38 @@ function defaultPriceLevelChanged(sel) {
}
}

function formatModifier(e) {
let mods = e.value;
mods = mods.substring(0, 11).trim();
let modArray = mods.includes(':') ? mods.split(":") : mods.split(" ");
let cntr = 0;
modArray.forEach( function(m) {
let l = m.length;
if (l) {
cntr++;
if (l !== 2) {
alert("Removing invalid modifier " + m);
modArray.pop();
}
} else {
modArray.pop();
}
});

let modString = modArray.join(":");
e.value = checkLastChar(modString);
}

function checkLastChar(s) {
let last_char = s.slice(-1);
if (last_char === ':') {
s = s.substring(0, s.length - 1);
return checkLastChar(s);
} else {
return s;
}
}

</script>
<style>
@media only screen and (max-width: 1024px) {
Expand Down Expand Up @@ -1566,7 +1603,12 @@ function defaultPriceLevelChanged(sel) {
);
} else {
if (strpos($newcode, ':') !== false) {
list($code, $modifier) = explode(":", $newcode);
$tmp = explode(':', $arrcode[1]);
$code = $tmp[0] ?? '';
$modifier = $tmp[1] ?? '';
$modifier .= ($tmp[2] ?? '') ? ":" . $tmp[2] : '';
$modifier .= ($tmp[3] ?? '') ? ":" . $tmp[3] : '';
$modifier .= ($tmp[4] ?? '') ? ":" . $tmp[4] : '';
} else {
$code = $newcode;
$modifier = '';
Expand Down
7 changes: 7 additions & 0 deletions interface/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,13 @@ function GetCallingScriptName()
$GLOBALS[$gl_name] = $gl_value;
}
}
// Set any user settings that are not also in GLOBALS.
// This is for modules support.
foreach ($gl_user as $setting) {
if (!array_key_exists($setting['setting_label'], $GLOBALS)) {
$GLOBALS[$setting['setting_label']] = $setting['setting_value'];
}
}

// Language cleanup stuff.
$GLOBALS['language_menu_login'] = false;
Expand Down
2 changes: 1 addition & 1 deletion interface/main/calendar/add_edit_event.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
$eid = $_GET['eid'] ?? null; // only for existing events
$date = $_GET['date'] ?? null; // this and below only for new events
$userid = $_GET['userid'] ?? null;
$default_catid = !empty($_GET['catid']) ? $_GET['catid'] : '5';
$default_catid = !empty($_GET['catid']) ? $_GET['catid'] : (!empty($GLOBALS['default_visit_category'] ?? '') ? $GLOBALS['default_visit_category'] : '5');

// form logic fails if not set to boolean
if (isset($_GET['group'])) {
Expand Down
38 changes: 4 additions & 34 deletions interface/main/tabs/menu/menus/standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,8 @@
"children": [
{
"label": "Codes",
"menu_id": "adm0",
"target": "adm",
"menu_id": "cod0",
"target": "cod",
"url": "/interface/patient_file/encounter/superbill_custom_full.php",
"children": [],
"requirement": 0,
Expand All @@ -916,8 +916,8 @@
},
{
"label": "Native Data Loads",
"menu_id": "adm0",
"target": "adm",
"menu_id": "cod0",
"target": "cod",
"url": "/interface/super/load_codes.php",
"children": [],
"requirement": 0,
Expand Down Expand Up @@ -1239,21 +1239,6 @@
"global_req": [
"erx_enable"
]
},
{
"label":"Weno Management",
"menu_id":"adm0",
"target":"adm",
"url":"/interface/weno/facilities.php",
"children":[],
"requirement":0,
"acl_req": [
"admin",
"super"
],
"global_req": [
"weno_rx_enable"
]
}
],
"requirement": 0,
Expand Down Expand Up @@ -1328,21 +1313,6 @@
],
"global_req": "!disable_prescriptions"
},
{
"label":"Prescription Log",
"menu_id":"rep0",
"target":"rep",
"url":"/interface/weno/rxlogmanager.php",
"children":[],
"requirement":0,
"acl_req": [
"patients",
"rx"
],
"global_req": [
"weno_rx_enable"
]
},
{
"label": "Patient List Creation",
"menu_id": "rep0",
Expand Down
1 change: 0 additions & 1 deletion interface/modules/custom_modules/README

This file was deleted.

Empty file.
Loading

0 comments on commit a5cba0e

Please sign in to comment.