Skip to content

Commit

Permalink
QA: Fix: #6070 - Undefined variable
Browse files Browse the repository at this point in the history
- Undefined variable due to the data input data returning no data.
  • Loading branch information
TheWitness committed Feb 24, 2025
1 parent 65ab16f commit b41fd72
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions data_templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,13 @@ function template_edit() {
if ($input_type != 1 && $input_type != 5) {
unset($struct_data_source_item['data_input_field_id']);
} else {
$struct_data_source_item['data_input_field_id']['sql'] = "SELECT id, CONCAT(data_name, ' - ', name) AS name FROM data_input_fields WHERE data_input_id=" . $template_data['data_input_id'] . " AND input_output='out' AND update_rra='on' ORDER BY data_name, name";
$struct_data_source_item['data_input_field_id']['sql'] = "SELECT id,
CONCAT(data_name, ' - ', name) AS name
FROM data_input_fields
WHERE data_input_id = " . $template_data['data_input_id'] . "
AND input_output='out'
AND update_rra='on'
ORDER BY data_name, name";
}
}

Expand Down Expand Up @@ -888,7 +894,7 @@ function template_edit() {
$message = __esc('This value is disabled due to it either it value being derived from the Device or special Data Query object that keeps track of critical data Data Query associations.');

if (cacti_sizeof($data_input_data)) {
$old_value = $data_input_data['value'];
$old_value = $data_input_data['value'] ?? '';
$old_tvalue = 'on';
$disable = 'disable';
} else {
Expand All @@ -899,15 +905,15 @@ function template_edit() {
} elseif ($field['type_code'] == 'host_id') {
$message = __esc('This value is disabled due to it being derived from the Device and read only.');

$old_value = $data_input_data['value'];
$old_value = $data_input_data['value'] ?? '';
$old_tvalue = '';
$disable = 'disable';
} else {
$message = __esc('Check this checkbox if you wish to allow the user to override the value on the right during Data Source creation.');

if (cacti_sizeof($data_input_data)) {
$old_value = $data_input_data['value'];
$old_tvalue = $data_input_data['t_value'];
$old_value = $data_input_data['value'] ?? '';
$old_tvalue = $data_input_data['t_value'] ?? '';
$disable = '';
} else {
$old_value = '';
Expand Down

0 comments on commit b41fd72

Please sign in to comment.