#12594 schedule fix

This commit is contained in:
Jonathan 2024-02-29 17:47:28 +01:00
parent 3240c9e44c
commit 15be9df26f
3 changed files with 36 additions and 9 deletions

View File

@ -72,7 +72,7 @@ if (isset($id_task) === true) {
}
$table = new stdClass();
$traps_generator = '<form class="max_floating_element_size" method="POST" action="index.php?sec=custom_report&sec2=godmode/reporting/schedule">';
$traps_generator = '<form id="form_manage" class="max_floating_element_size" method="POST" action="index.php?sec=custom_report&sec2=godmode/reporting/schedule">';
$table->id = 'table_manage';
$table->width = '100%';
$table->class = 'filter-table-adv databox';
@ -318,6 +318,23 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
}
});
});
$('#button-btn_generate_trap').on('click', function() {
event.preventDefault();
var name = $('#text-name').val();
var report = $('#id_report :selected').val();
var task = $('#id_user_task :selected').val();
var group = $('#group :selected').val();
if (name !== '' && report !== '-1' && task !== '-1' && group !== '') {
$('#form_manage').submit();
} else {
confirmDialog({
title: "<?php echo __('Error'); ?>",
message: "<?php echo __('Name, Report, Task, Group, Date and Hour are required.'); ?>",
hideCancelButton: true,
});
}
})
});
$('#button-button_back').on('click', function(){

View File

@ -87,9 +87,17 @@ if ($update_schedule === '1') {
$new_schedule = get_parameter('new_schedule', false);
if ($new_schedule === '1') {
enterprise_include_once('/godmode/wizards/ConsoleTasks.class.php');
$task = new ConsoleTasks(0, 'Default message. Not set.', '/images/wizard/consoletasks.png', 'Report Tasks', true);
$result = $task->createTask();
$name = get_parameter('name', null);
$sql = sprintf('SELECT * FROM tuser_task_scheduled WHERE name = "%s"', io_safe_input($name));
if (db_get_all_rows_sql($sql) === false) {
enterprise_include_once('/godmode/wizards/ConsoleTasks.class.php');
$task = new ConsoleTasks(0, 'Default message. Not set.', '/images/wizard/consoletasks.png', 'Report Tasks', true);
$result = $task->createTask();
} else {
$result = false;
$_SESSION['report_task_msg'] = __('The schedule name is already in use.');
}
ui_print_result_message(
$result,
__('Successfully created'),
@ -172,16 +180,16 @@ if ($reports !== false) {
'id',
$row['id_user_task']
);
$params = unserialize($row['args']);
$id_report = ($row['id_report'] ?? $params[0]);
$report_name = db_get_value(
'name',
'treport',
'id_report',
$row['id_report']
$id_report
);
$data = [];
$params = unserialize($row['args']);
$data[0] = $row['name'];
$data[0] = ($row['name'] ?? __('No name'));
$data[1] = $report_name;
$data[2] = $function_name;
$data[3] = date('Y/m/d H:i:s', $params['first_execution']);

View File

@ -469,7 +469,9 @@ if ($access_console_node === true) {
$sub2 = [];
$sub2['godmode/reporting/reporting_builder']['text'] = __('Reports');
$sub2['godmode/reporting/reporting_builder&tab=template&action=list_template']['text'] = __('Templates');
$sub2['godmode/reporting/schedule']['text'] = __('Schedule');
if (check_acl($config['id_user'], 0, 'RW') || check_acl($config['id_user'], 0, 'RM')) {
$sub2['godmode/reporting/schedule']['text'] = __('Schedule');
}
$sub['custom_report']['sub2'] = $sub2;