Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
various bugs (#4331)
* various bugs
- escape fix for ledger title with apostrophe etc.
- utility fix for const delimit

* - post payment invoice table style

(cherry picked from commit 746678a)
  • Loading branch information
sjpadgett committed Apr 16, 2021
1 parent 8347f0d commit 2835cc3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
4 changes: 2 additions & 2 deletions interface/billing/sl_eob_invoice.php
Expand Up @@ -603,8 +603,8 @@ function updateFields(payField, adjField, balField, coPayField, isFirstProcCode)
<thead>
<tr>
<th><?php echo xlt('Code') ?></th>
<th class="text-right"><?php echo xlt('Charge') ?></th>
<th class="text-right"><?php echo xlt('Balance') ?>&nbsp;</th>
<th class="text-left"><?php echo xlt('Charge') ?></th>
<th class="text-left"><?php echo xlt('Balance') ?>&nbsp;</th>
<th><?php echo xlt('By/Source') ?></th>
<th><?php echo xlt('Date') ?></th>
<th><?php echo xlt('Pay') ?></th>
Expand Down
53 changes: 28 additions & 25 deletions library/js/utility.js
Expand Up @@ -26,30 +26,33 @@ function xl(string) {
// html escaping functions - special case when sending js string to html (see codebase for examples)
// jsText (equivalent to text() )
// jsAttr (equivalent to attr() )
const htmlEscapesText = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;'
};
const htmlEscapesAttr = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#x27;'
};
const htmlEscaperText = /[&<>]/g;
const htmlEscaperAttr = /[&<>"']/g;
jsText = function(string) {
return ('' + string).replace(htmlEscaperText, function(match) {
return htmlEscapesText[match];
});
};
jsAttr = function(string) {
return ('' + string).replace(htmlEscaperAttr, function(match) {
return htmlEscapesAttr[match];
});
};
// must be careful assigning const in this script. can't reinit a constant
if (typeof htmlEscapesText === 'undefined') {
const htmlEscapesText = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;'
};
const htmlEscapesAttr = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#x27;'
};
const htmlEscaperText = /[&<>]/g;
const htmlEscaperAttr = /[&<>"']/g;
jsText = function (string) {
return ('' + string).replace(htmlEscaperText, function (match) {
return htmlEscapesText[match];
});
};
jsAttr = function (string) {
return ('' + string).replace(htmlEscaperAttr, function (match) {
return htmlEscapesAttr[match];
});
};
}

// another useful function
async function syncFetchFile(fileUrl, type = 'text') {
Expand Down Expand Up @@ -344,7 +347,7 @@ function oeSortable(callBackFn) {
})
}

};
}


/*
Expand Down
2 changes: 1 addition & 1 deletion src/OeUI/OemrUI.php
Expand Up @@ -393,7 +393,7 @@ private function headerExpandJs($arrFiles = array())
private function headerActionJs($arrAction = array())
{
$arrAction = $this->arrAction;
$page = str_replace(" ", "", $this->heading);
$page = attr(str_replace(" ", "", $this->heading));

// Build the labels for when the icon is moused-over
$labels = "";
Expand Down

0 comments on commit 2835cc3

Please sign in to comment.