Skip to content

Commit

Permalink
correct issue with locked parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlimeunier committed Jan 18, 2018
1 parent e05bd99 commit 498a714
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
3 changes: 2 additions & 1 deletion include/global_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
'friendly_name' => __('Locked', 'reportit'),
'method' => 'checkbox',
'description' => __('The status "locked" avoids any kind of modification to your report template as well as assigned measurands and variable definitions', 'reportit'),
'value' => '|arg1:locked|'
'value' => '|arg1:locked|',
'default' => 'on'
),
'template_filter' => array(
'friendly_name' => __('Additional Pre-filter', 'reportit'),
Expand Down
2 changes: 1 addition & 1 deletion measurands.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function form_save() {
$measurand_data['data_precision'] = isset_request_var('measurand_precision') ? get_request_var('measurand_precision') : '';


if (false) {//is_error_message()
if (is_error_message()) {
header('Location: measurands.php?header=false&action=measurand_edit&id=' . get_request_var('id') . '&template_id=' . get_request_var('template_id'));
} else {
//Save data
Expand Down
14 changes: 6 additions & 8 deletions templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ function form_save() {
$template_data['enabled'] = isset_request_var('template_enabled') ? 'on' : '';
$template_data['locked'] = isset_request_var('template_locked') ? 'on' : '';
$template_data['export_folder'] = isset_request_var('template_export_folder') ? get_request_var('template_export_folder') : '';


$sql = "SELECT id, data_source_name
FROM data_template_rrd
Expand Down Expand Up @@ -665,18 +666,15 @@ function form_save() {
}

/* check if we can unlock this template. */
if ($template_data['locked'] == 0) {
if ($template_data['locked'] == '') {
if (stat_autolock_template($template_data['id'])) {
raise_message('reportit_templates__3');
}
}
$output = print_r ($template_data,true);

#if (!is_error_message()) {
if (true) {

if (!is_error_message()) {
/* save template data */
$output = print_r ($template_data,true);


$template_data['id'] = sql_save($template_data, 'plugin_reportit_templates');

/* update template id for data source items if necessary */
Expand Down Expand Up @@ -706,7 +704,7 @@ function form_save() {
raise_message(2);
}
}
//file_put_contents('/tmp/file3.txt', "OUT");

header('Location: templates.php?header=false&action=template_edit&id=' . $template_data['id']);
}

Expand Down

0 comments on commit 498a714

Please sign in to comment.