From 92609e825aa21d62a7ac7686a367086970260ef2 Mon Sep 17 00:00:00 2001
From: Alex <40072887+alexdcrane@users.noreply.github.com>
Date: Thu, 12 Mar 2026 16:48:03 +0000
Subject: [PATCH] Minor CDR search bug fixes (#7787)
* Minor CDR search bug fixes
* Update xml_cdr_search.php
* Update xml_cdr_inc.php
* Update xml_cdr.php
* Update template.php
---
app/xml_cdr/xml_cdr.php | 6 ++---
app/xml_cdr/xml_cdr_inc.php | 4 ++--
app/xml_cdr/xml_cdr_search.php | 1 -
themes/default/template.php | 44 ++++++++++++++++++++++------------
4 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php
index 79694321f..0b490c81f 100644
--- a/app/xml_cdr/xml_cdr.php
+++ b/app/xml_cdr/xml_cdr.php
@@ -394,11 +394,11 @@
echo " \n";
echo "
\n";
echo " \n";
diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php
index 5804a2e85..fce05eb3e 100644
--- a/app/xml_cdr/xml_cdr_inc.php
+++ b/app/xml_cdr/xml_cdr_inc.php
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane
- Portions created by the Initial Developer are Copyright (C) 2008-2025
+ Portions created by the Initial Developer are Copyright (C) 2008-2026
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -108,7 +108,7 @@
$caller_id_name = $_REQUEST["caller_id_name"] ?? '';
$caller_id_number = $_REQUEST["caller_id_number"] ?? '';
$caller_destination = $_REQUEST["caller_destination"] ?? '';
- $extension_uuids = $_REQUEST["extension_uuids"] ?? '';
+ $extension_uuids = array_filter($_REQUEST["extension_uuids"]) ?? [];
$destination_number = $_REQUEST["destination_number"] ?? '';
$context = $_REQUEST["context"] ?? '';
$start_stamp_begin = $_REQUEST["start_stamp_begin"] ?? '';
diff --git a/app/xml_cdr/xml_cdr_search.php b/app/xml_cdr/xml_cdr_search.php
index 59e864488..f17189f35 100644
--- a/app/xml_cdr/xml_cdr_search.php
+++ b/app/xml_cdr/xml_cdr_search.php
@@ -201,7 +201,6 @@
echo "
\n";
echo " \n";
echo " \n";
- echo " \n";
echo " \n";
echo " \n";
echo " ";
diff --git a/themes/default/template.php b/themes/default/template.php
index c3aa1e195..11bd28d92 100644
--- a/themes/default/template.php
+++ b/themes/default/template.php
@@ -734,7 +734,7 @@
}
{/literal}
- //multi select box with search
+ // Multi select box with search
{literal}
const container = document.querySelector('.multiselect_container');
const trigger_btn = container.querySelector('.selected_values');
@@ -745,19 +745,20 @@
const placeholder = container.querySelector('.placeholder_text');
let is_open = false;
- //toggle Dropdown Open/Close
+ // Toggle dropdown open/close
trigger_btn.addEventListener('click', (event) => {
event.stopPropagation();
is_open = !is_open;
if (is_open) {
dropdown_list.classList.add('open');
search_input.focus();
- } else {
+ }
+ else {
dropdown_list.classList.remove('open');
}
});
- //close dropdown if clicked outside
+ // Close dropdown if clicked outside
document.addEventListener('click', (event) => {
if (!container.contains(event.target)) {
is_open = false;
@@ -765,12 +766,12 @@
}
});
- //prevent dropdown from closing when clicking inside the dropdown
+ // Prevent dropdown from closing when clicking inside the dropdown
dropdown_list.addEventListener('click', (event) => {
event.stopPropagation();
});
- //handle Search Filtering
+ // Handle Search Filtering
search_input.addEventListener('input', (event) => {
const search_term = event.target.value.toLowerCase();
const option_items = document.querySelectorAll('.option_item');
@@ -782,26 +783,38 @@
if (text.includes(search_term)) {
item.style.display = 'block';
visible_count++;
- } else {
+ }
+ else {
item.style.display = 'none';
}
});
if (visible_count === 0) {
no_results.style.display = 'block';
- } else {
+ }
+ else {
no_results.style.display = 'none';
}
});
- //handle Checkbox Selection
+ // Handle checkbox selection
container.addEventListener('change', (event) => {
if (event.target.type === 'checkbox') {
+ // If unchecked, remove the corresponding hidden input
+ if (!event.target.checked) {
+ const value = event.target.value;
+ const hidden_input = document.querySelector(`input[name="extension_uuids[]"][value="${value}"]`);
+ if (hidden_input) {
+ hidden_input.remove();
+ }
+ }
+
+ // Update visual tags and handle checked boxes
update_selected_values();
}
});
- //also handle clicking the text part of the option
+ // Handle clicking the text part of the option
container.addEventListener('click', (event) => {
if (event.target.classList.contains('option_item')) {
const checkbox = event.target.querySelector('input[type="checkbox"]');
@@ -812,16 +825,17 @@
}
});
- //update display Logic (tags & hidden input)
+ // Update display logic (tags & hidden input)
function update_selected_values() {
const checked_boxes = document.querySelectorAll('.option_item input:checked');
const selected_count = checked_boxes.length;
- //update visual tags
+ // Update visual tags
if (selected_count === 0) {
placeholder.style.display = 'block';
trigger_btn.innerHTML = `{/literal}{$text.label_select}{literal}...`;
- } else {
+ }
+ else {
placeholder.style.display = 'none';
let html = '';
@@ -842,7 +856,7 @@
}
}
- //helper function to remove a tag when clicked (External to scope)
+ // Helper function to remove a tag when clicked (External to scope)
window.remove_option = function(value) {
const checkbox = document.querySelector(`input[value="${value}"]`);
if (checkbox) {
@@ -870,7 +884,7 @@
}
}
- //initialize state
+ // Initialize state
update_selected_values();
{/literal}