Skip to content

Commit

Permalink
use int cast for compares with php8 fatal errors in payment scripts (#…
Browse files Browse the repository at this point in the history
…4322)

* use int cast for compares

* fix logic

* 2 less paren :)
  • Loading branch information
stephenwaite committed Apr 3, 2021
1 parent 7c2c7b0 commit d51f601
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
6 changes: 5 additions & 1 deletion interface/billing/payment_pat_sel.inc.php
Expand Up @@ -24,7 +24,11 @@
//Patient ajax section and listing of charges..Used in New Payment and Edit Payment screen.
//===============================================================================
if (isset($_POST["mode"])) {
if (($_POST["mode"] == "search" || $_POST["default_search_patient"] == "default_search_patient") && (($_REQUEST['hidden_patient_code'] ?? null) * 1 > 0)) {
if (
($_POST["mode"] == "search") || ($_POST["default_search_patient"] == "default_search_patient") &&
isset($_REQUEST['hidden_patient_code']) &&
(int)$_REQUEST['hidden_patient_code'] > 0
) {
$hidden_patient_code = $_REQUEST['hidden_patient_code'];
$RadioPaid = $_REQUEST['RadioPaid'] ?? null;
if ($RadioPaid == 'Show_Paid') {
Expand Down
29 changes: 17 additions & 12 deletions library/js/common.js
@@ -1,12 +1,13 @@
function tabbify() {
function tabbify()
{

$('ul.tabNav a').click(function() {
$('ul.tabNav a').click(function () {
var curChildIndex = $(this).parent().prevAll().length + 1;
$(this).parent().parent().children('.current').removeClass('current');
$(this).parent().addClass('current');
$(this).parent().parent().next('.tabContainer').children('.current').each(function() {
$(this).parent().parent().next('.tabContainer').children('.current').each(function () {
$(this).removeClass('current');
$(this).parent().children('div:nth-child('+curChildIndex+')').each(function() {
$(this).parent().children('div:nth-child(' + curChildIndex + ')').each(function () {
$(this).addClass('current');
});
});
Expand All @@ -17,13 +18,17 @@ function tabbify() {

//----------------------------------------
function PreventIt(evt)//Specially for the browser chrome.
{//When focus is on the text box and enter key is pressed the form gets submitted.TO prevent it this function is used.
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode == 13)//tab key,enter key
{
if (evt.preventDefault) evt.preventDefault();
if (evt.stopPropagation) evt.stopPropagation();
}
{
//When focus is on the text box and enter key is pressed the form gets submitted.TO prevent it this function is used.
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode == 13) {//tab key,enter key
if (evt.preventDefault) {
evt.preventDefault();
}
if (evt.stopPropagation) {
evt.stopPropagation();
}
}
}

2 changes: 1 addition & 1 deletion library/payment.inc.php
Expand Up @@ -61,7 +61,7 @@ function DistributionInsert($CountRow, $created_time, $user_id)
//It automatically pushes to next insurance for billing.
//In the screen a drop down of Ins1,Ins2,Ins3,Pat are given.The posting can be done for any level.
$Affected = 'no';
if (isset($_POST["Payment$CountRow"]) && $_POST["Payment$CountRow"] * 1 > 0) {
if (isset($_POST["Payment$CountRow"]) && (int)$_POST["Payment$CountRow"] > 0) {
if (trim(formData('type_name')) == 'insurance') {
if (trim(formData("HiddenIns$CountRow")) == 1) {
$AccountCode = "IPP";
Expand Down

0 comments on commit d51f601

Please sign in to comment.