From 1f4ff4989d037fec002ccd8d06874dc0f8f68c10 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 15 Apr 2026 10:01:25 +0530 Subject: [PATCH] FIX_VALIDATION_FORM_JS_FILE --- .env.sample | 16 +++++++ app/Helpers/session_helper.php | 4 +- .../assets/js/pages/leads_form_validation.js | 24 ++-------- .../js/pages/new_client_modal_validation.js | 24 ++-------- .../js/pages/ticket_form_input_validation.js | 47 +++---------------- 5 files changed, 33 insertions(+), 82 deletions(-) diff --git a/.env.sample b/.env.sample index cc9a927c..b8c1b80f 100755 --- a/.env.sample +++ b/.env.sample @@ -159,3 +159,19 @@ bds.dailyReportEmails = MEDIASSIST_WELLNESS_KEY = MEDIASSIST_WELLNESS_IV = MEDIASSIST_WELLNESS_LOGIN_URL = + + +#-------------------------------------------------------------------- +# Icici api details LIVE +#-------------------------------------------------------------------- + +ICICI_TOKEN_URL = +ICICI_BASE_URL = +ICICI_PASSWORD = +ICICI_CLIENT_ID = +ICICI_CLIENT_SECRET = +ICICI_API_SCOPE = +ICICI_GRANT_TYPE = + + +ICICI_PRIMARY_KEY_CONSTANT = diff --git a/app/Helpers/session_helper.php b/app/Helpers/session_helper.php index bd54744c..8769216e 100755 --- a/app/Helpers/session_helper.php +++ b/app/Helpers/session_helper.php @@ -180,8 +180,8 @@ if (!function_exists('user_team')) { function user_team() { // $CI =& get_instance(); - $session = \Config\Services::session(); - return $session->get('user_team'); + $session = \Config\Services::session(); + return $session->get('user_team') ?: []; } } diff --git a/public/assets/js/pages/leads_form_validation.js b/public/assets/js/pages/leads_form_validation.js index 0f470a38..7b76a89d 100644 --- a/public/assets/js/pages/leads_form_validation.js +++ b/public/assets/js/pages/leads_form_validation.js @@ -1,3 +1,7 @@ +/** + * Parsley validation for the leads form. Does not strip or rewrite user input; + * invalid values are reported via Parsley messages only. + */ (function (getJq) { 'use strict'; @@ -162,25 +166,6 @@ }); } - function sanitizeOnInput(el) { - if (!el || isSkippableField(el)) { - return; - } - if (isMobileField(el)) { - var clean = (el.value || '').replace(/\D/g, '').substring(0, 10); - if (el.value !== clean) { - el.value = clean; - } - return; - } - if (isCharsetCandidate(el)) { - var raw = el.value || ''; - if (!TEXT_ALLOWED.test(raw)) { - el.value = raw.replace(/[^A-Za-z0-9/_.\- ]/g, ''); - } - } - } - function refreshParsley($form) { if (!$form || !$form.length || !isParsleyReady()) { return; @@ -227,7 +212,6 @@ $form.off(NS); $form.on('input' + NS, 'input:not([type=hidden]), textarea', function () { - sanitizeOnInput(this); validateField(this); }); $form.on('change' + NS, 'select, input:not([type=hidden]), textarea', function () { diff --git a/public/assets/js/pages/new_client_modal_validation.js b/public/assets/js/pages/new_client_modal_validation.js index fef444e2..c4db1770 100644 --- a/public/assets/js/pages/new_client_modal_validation.js +++ b/public/assets/js/pages/new_client_modal_validation.js @@ -1,3 +1,7 @@ +/** + * Parsley validation for the new-client modal. Does not strip or rewrite user input; + * invalid values are reported via Parsley messages only. + */ (function (getJq) { 'use strict'; @@ -142,25 +146,6 @@ }); } - function sanitizeOnInput(el) { - if (!el || isSkippable(el)) { - return; - } - if (isMobile(el)) { - var d = (el.value || '').replace(/\D/g, '').substring(0, 10); - if (el.value !== d) { - el.value = d; - } - return; - } - if (isCharsetCandidate(el)) { - var raw = el.value || ''; - if (!TEXT_ALLOWED.test(raw)) { - el.value = raw.replace(/[^A-Za-z0-9/_.\- ]/g, ''); - } - } - } - function refreshParsley($form) { try { var p = $form.parsley(); @@ -200,7 +185,6 @@ $form.off(NS); $form.on('input' + NS, 'input:not([type=hidden]), textarea', function () { - sanitizeOnInput(this); validateField(this); }); $form.on('change' + NS, 'select, input:not([type=hidden]), textarea', function () { diff --git a/public/assets/js/pages/ticket_form_input_validation.js b/public/assets/js/pages/ticket_form_input_validation.js index b8cfed70..b0e82a4f 100644 --- a/public/assets/js/pages/ticket_form_input_validation.js +++ b/public/assets/js/pages/ticket_form_input_validation.js @@ -1,6 +1,7 @@ /** * Ticket forms + claim file upload: charset, email, pincode, mobile, URLs, doc names. * Integrates with Parsley only — no separate Bootstrap invalid-feedback. + * Does not strip or rewrite user input; invalid values are reported via Parsley messages only. * Requires jQuery + Parsley. Inits run before form-validation.init binds .parsley-examples. * * Do not capture window.jQuery at parse time: layout/header.php loads full jQuery then jquery.slim, @@ -28,6 +29,8 @@ var MOBILE_IDS = ['emp_mobile', 'hospital_phone_no']; var PINCODE_IDS = ['hospital_pin_code']; var DIGITS_ONLY_IDS = ['claim_amount', 'approved_amount', 'si_amt']; + /** Same validation as claim upload URL fields — charset rules would strip : ? & from https links. */ + var APPROVED_SETTLE_LETTER_URL_IDS = ['approved_letter', 'settle_letter']; var MESSAGES = { text: 'Only letters, numbers, spaces, and the characters / _ - . are allowed.', @@ -83,6 +86,9 @@ if (DIGITS_ONLY_IDS.indexOf(id) !== -1) { return 'digits'; } + if (APPROVED_SETTLE_LETTER_URL_IDS.indexOf(id) !== -1) { + return 'urlfield'; + } return 'text'; } @@ -360,51 +366,12 @@ }); } - function sanitizeOnInput(el) { - var id = el.id; - if (!id || el.type === 'hidden' || isReadonly(el)) { - return; - } - - var kind = getFieldKindFromElement(el); - var $el = $(el); - - if (kind === 'mobile') { - var m = (el.value || '').replace(/\D/g, '').substring(0, 10); - if (el.value !== m) { - el.value = m; - } - } else if (kind === 'pincode') { - var p = (el.value || '').replace(/\D/g, '').substring(0, 6); - if (el.value !== p) { - el.value = p; - } - } else if (kind === 'digits') { - var d = (el.value || '').replace(/\D/g, ''); - if (el.value !== d) { - el.value = d; - } - } else if (kind === 'email' || kind === 'personalemail' || kind === 'urlfield') { - return; - } else if (kind === 'docname') { - var dn = el.value || ''; - if (!DOCNAME_ALLOWED.test(dn)) { - el.value = dn.replace(/[^a-zA-Z0-9_\- ]/g, ''); - } - } else if (kind === 'text') { - var raw = el.value || ''; - if (!TEXT_ALLOWED.test(raw)) { - el.value = raw.replace(/[^A-Za-z0-9/_.\- ]/g, ''); - } - } - } - function onFormInput(e) { var el = e.target; if (!el || (el.tagName !== 'INPUT' && el.tagName !== 'TEXTAREA')) { return; } - sanitizeOnInput(el); + revalidateParsleyField(el); } function revalidateParsleyField(el) {