Skip to content

Commit

Permalink
Fixing Issue #3597
Browse files Browse the repository at this point in the history
Template to Device sync provides no feedback
  • Loading branch information
TheWitness committed Jun 13, 2020
1 parent 578f63b commit f04f92b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -26,6 +26,7 @@ Cacti CHANGELOG
-issue#3588: Validation not performed warnings in host.php
-issue#3594: Automation hangs for certain schedule types
-issue#3595: Template to Device sync text is not consistent
-issue#3597: Template to Device sync provides no feedback
-issue#3598: When editing graphs and graph templates, back button results in broken page
-issue#3607: Can't access log after been kicked out by timeout

Expand Down
16 changes: 9 additions & 7 deletions lib/api_device.php
Expand Up @@ -847,11 +847,12 @@ function api_device_update_host_template($host_id, $host_template_id) {
array($host_template_id, $host_id), true, $rcnn_id);
}

/* add all snmp queries assigned to the device template */
/* add all new snmp queries assigned to the device template */
$snmp_queries = db_fetch_assoc_prepared('SELECT snmp_query_id
FROM host_template_snmp_query
WHERE host_template_id = ?',
array($host_template_id));
FROM host_template_snmp_query AS htsq
WHERE host_template_id = ?
AND htsq.snmp_query_id NOT IN (SELECT snmp_query_id FROM host_snmp_cache WHERE host_id = ?)',
array($host_template_id, $host_id));

if (cacti_sizeof($snmp_queries)) {
foreach ($snmp_queries as $snmp_query) {
Expand All @@ -874,9 +875,10 @@ function api_device_update_host_template($host_id, $host_template_id) {

/* add all graph templates assigned to the device template */
$graph_templates = db_fetch_assoc_prepared('SELECT graph_template_id
FROM host_template_graph
WHERE host_template_id = ?',
array($host_template_id));
FROM host_template_graph AS hg
WHERE host_template_id = ?
AND hg.graph_template_id NOT IN (SELECT graph_template_id FROM host_graph WHERE host_id = ?)',
array($host_template_id, $host_id));

if (cacti_sizeof($graph_templates)) {
foreach ($graph_templates as $graph_template) {
Expand Down

0 comments on commit f04f92b

Please sign in to comment.