From 0c690c4e512a5ab438c07ac9f4a3cb6b10ef9d2e Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 1 Sep 2026 18:24:46 -0400 Subject: [PATCH 1/4] Fix 3 Digit octet fix on IP address for IMask plugin --- js/app.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/js/app.js b/js/app.js index 7cdc0ea16..7ad0ac28d 100644 --- a/js/app.js +++ b/js/app.js @@ -568,15 +568,26 @@ function itflowInit() { el.dataset.imaskReady = '1'; var spec = el.getAttribute('data-inputmask') || ''; if (spec.indexOf('ip') !== -1) { + // A pattern mask built from MaskedRange blocks will not advance past the dot + // until the block reaches its maxLength, so 10.0.0.1 had to be entered as + // 010.000.000.001. A regex mask has no per-block completeness rule - it tests + // the whole value on every keystroke, so partial input like "10.0." is valid on + // its own. Octets are still bounded to 0-255 and leading zeros are still + // accepted, matching what jquery.inputmask's 'ip' alias allowed. + // + // interface_ip / asset_ip are varchar(200) and hold free text as well - 'DHCP' + // is written there by the checkbox on these same modals. Masking a value like + // that would strip it to nothing the moment the modal opened, so anything not + // made of digits and dots is left unmasked instead. + if (el.value && !/^[\d.]*$/.test(el.value)) { + return; + } + var octet = '(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)'; + var octet4 = octet + '?'; + var octet3 = '(' + octet + '(\\.' + octet4 + ')?)?'; + var octet2 = '(' + octet + '(\\.' + octet3 + ')?)?'; IMask(el, { - mask: 'a.b.c.d', - blocks: { - a: { mask: IMask.MaskedRange, from: 0, to: 255 }, - b: { mask: IMask.MaskedRange, from: 0, to: 255 }, - c: { mask: IMask.MaskedRange, from: 0, to: 255 }, - d: { mask: IMask.MaskedRange, from: 0, to: 255 } - }, - lazy: true + mask: new RegExp('^(' + octet + '(\\.' + octet2 + ')?)?$') }); } else if (spec.indexOf('mac') !== -1) { IMask(el, { From 9e8c4d002afe93071862239802257326faf9c1fb Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 1 Sep 2026 18:54:44 -0400 Subject: [PATCH 2/4] Shorten Description, Text dark IP and make table smaller in IPs --- agent/assets.php | 5 ----- agent/expenses.php | 9 ++------- agent/network.php | 12 ++++++------ agent/products.php | 9 ++------- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/agent/assets.php b/agent/assets.php index 3e62841ec..e0d310c87 100644 --- a/agent/assets.php +++ b/agent/assets.php @@ -556,11 +556,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $asset_type = escapeHtml($row['asset_type']); $asset_name = escapeHtml($row['asset_name']); $asset_description = escapeHtml($row['asset_description']); - if ($asset_description) { - $asset_description_display = $asset_description; - } else { - $asset_description_display = "-"; - } $asset_make = escapeHtml($row['asset_make']); $asset_model = escapeHtml($row['asset_model']); $asset_serial = escapeHtml($row['asset_serial']); diff --git a/agent/expenses.php b/agent/expenses.php index dee986761..63f82d5e5 100644 --- a/agent/expenses.php +++ b/agent/expenses.php @@ -268,12 +268,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $category_name = escapeHtml($row['category_name']); $account_name = escapeHtml($row['account_name']); $expense_account_id = intval($row['expense_account_id']); - $client_name = escapeHtml($row['client_name']); - if(empty($client_name)) { - $client_name_display = "-"; - } else { - $client_name_display = $client_name; - } + $client_name = escapeHtml($row['client_name']) ?: '-'; $expense_client_id = intval($row['expense_client_id']); if (empty($expense_receipt)) { @@ -307,7 +302,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - +