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
This commit is contained in:
Alex
2026-03-12 16:48:03 +00:00
committed by GitHub
parent 778d33d72e
commit 92609e825a
4 changed files with 34 additions and 21 deletions
+3 -3
View File
@@ -394,11 +394,11 @@
echo " </div>\n";
echo " <div class='field'>\n";
echo " <select class='formfld' name='extension_uuids[]' id='extension_uuid'>\n";
echo " <option value=''></option>";
echo " <option value=''></option>\n";
if (is_array($extensions) && @sizeof($extensions) != 0) {
foreach ($extensions as $row) {
$selected = ($row['extension_uuid'] == $extension_uuid[0]) ? "selected" : null;
echo " <option value='".escape($row['extension_uuid'])."' ".escape($selected).">".((is_numeric($row['extension'])) ? escape($row['extension']) : escape($row['number_alias'])." (".escape($row['extension']).")")."</option>";
$selected = ($row['extension_uuid'] == $extension_uuids[0]) ? "selected" : null;
echo " <option value='".escape($row['extension_uuid'])."' ".escape($selected).">".((is_numeric($row['extension'])) ? escape($row['extension']) : escape($row['number_alias'])." (".escape($row['extension']).")")."</option>\n";
}
}
echo " </select>\n";
+2 -2
View File
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
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"] ?? '';
-1
View File
@@ -201,7 +201,6 @@
echo " </div>\n";
echo " </div>\n";
echo " </div>\n";
echo " <input type='text' class='formfld' style='display: none;' name='caller_id_numbers[]' id='caller_id_number_0' value='".escape($caller_id_number)."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>";
+29 -15
View File
@@ -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 = `<span class="placeholder_text">{/literal}{$text.label_select}{literal}...</span>`;
} 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}