mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added alerts schedule notes into device notes (#9258)
* Add alerts schedule notes into device notes Signed-off-by: Rémy Jacquin <remy@remyj.fr> * Update preferences.inc.php
This commit is contained in:
committed by
Neil Lathwood
parent
62af66b49b
commit
d736adc289
@@ -129,6 +129,11 @@ if ($sub_type == 'new-maintenance') {
|
||||
foreach ($_POST['maps'] as $target) {
|
||||
$target = target_to_id($target);
|
||||
$item = dbInsert(array('schedule_id' => $schedule_id, 'target' => $target), 'alert_schedule_items');
|
||||
if ($notes && get_user_pref('add_schedule_note_to_device', false)) {
|
||||
$device_notes = dbFetchCell('SELECT `notes` FROM `devices` WHERE `device_id` = ?;', array($target));
|
||||
$device_notes.= ((empty($device_notes)) ? '' : PHP_EOL) . date("Y-m-d H:i") . ' Alerts delayed: ' . $notes;
|
||||
dbUpdate(array('notes' => $device_notes), 'devices', '`device_id` = ?', array($target));
|
||||
}
|
||||
if ($item > 0) {
|
||||
array_push($items, $item);
|
||||
} else {
|
||||
|
@@ -33,6 +33,14 @@ if (LegacyAuth::user()->isDemoUser()) {
|
||||
$updatedashboard_message = "User default dashboard updated";
|
||||
}
|
||||
}
|
||||
if ($vars['action'] === 'changenote') {
|
||||
set_user_pref('add_schedule_note_to_device', (bool)$vars['notetodevice']);
|
||||
if ($vars['notetodevice']) {
|
||||
$updatenote_message = "Schedule notes will now be added to device notes";
|
||||
} else {
|
||||
$updatenote_message = "Schedule notes will no longer be added to device notes";
|
||||
}
|
||||
}
|
||||
|
||||
include 'includes/update-preferences-password.inc.php';
|
||||
|
||||
@@ -163,6 +171,34 @@ echo "
|
||||
</div>";
|
||||
|
||||
|
||||
echo "<h3>Add schedule notes to devices notes</h3>
|
||||
<hr>
|
||||
<div class='well'>";
|
||||
if (!empty($updatenote_message)) {
|
||||
print_message($updatenote_message);
|
||||
}
|
||||
echo "
|
||||
<form method='post' action='preferences/' class='form-horizontal' role='form'>
|
||||
<div class='form-group'>
|
||||
<input type=hidden name='action' value='changenote'>
|
||||
<div class='form-group'>
|
||||
<label for='dashboard' class='col-sm-3 control-label'>Add schedule notes to devices notes</label>
|
||||
<div class='col-sm-4'>
|
||||
<input id='notetodevice' type='checkbox' name='notetodevice' data-size='small' " . ((get_user_pref('add_schedule_note_to_device', false)) ? 'checked' : '') . ">
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<div class='col-sm-4 col-sm-offset-3'>
|
||||
<button type='submit' class='btn btn-default'>Update preferences</button>
|
||||
</div>
|
||||
<div class='col-sm-6'></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>";
|
||||
|
||||
|
||||
|
||||
echo "<h3>Device Permissions</h3>";
|
||||
echo "<hr>";
|
||||
echo '<div class="well">';
|
||||
@@ -183,3 +219,5 @@ if (LegacyAuth::user()->hasGlobalAdmin()) {
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo "<script>$(\"[name='notetodevice']\").bootstrapSwitch('offColor','danger');</script>";
|
||||
|
Reference in New Issue
Block a user