Merge branch 'ent-11851-fallo-en-el-editor-de-intervalos-del-setup' into 'develop'

Ent 11851 fallo en el editor de intervalos del setup

See merge request artica/pandorafms!6324
This commit is contained in:
Rafael Ameijeiras 2023-08-11 06:32:24 +00:00
commit 0e317edf70
3 changed files with 22 additions and 7 deletions

View File

@ -1927,7 +1927,7 @@ $table_other->data[$row][] = html_print_label_input_block(
).html_print_div( ).html_print_div(
[ [
'class' => '', 'class' => '',
'content' => __('Interval').html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'), 'content' => __('Interval').html_print_select($units, 'interval_unit', '', '', '', '', true, false, false, '', false, 'width: 100%'),
], ],
true true
).html_print_button( ).html_print_button(
@ -1975,7 +1975,7 @@ $table_other->data[$row][] = html_print_label_input_block(
).html_print_button( ).html_print_button(
__('Delete'), __('Delete'),
'interval_del_btn', 'interval_del_btn',
empty($config['interval_values']), false,
'', '',
[ [
'mode' => 'link', 'mode' => 'link',
@ -2009,7 +2009,7 @@ $table_other->data[$row][] = html_print_label_input_block(
).html_print_div( ).html_print_div(
[ [
'class' => '', 'class' => '',
'content' => __('Interval').html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'), 'content' => __('Interval').html_print_select($units, 'module_interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'),
], ],
true true
).html_print_button( ).html_print_button(
@ -2316,9 +2316,15 @@ $(document).ready (function () {
// CUSTOM INTERVAL VALUES // CUSTOM INTERVAL VALUES
//------------------------------------------------------------------ //------------------------------------------------------------------
$("#button-interval_del_btn").click( function() { $("#button-interval_del_btn").click( function() {
var interval_selected = $('#intervals option:selected').val(); confirmDialog({
$('#hidden-interval_to_delete').val(interval_selected); title: "<?php echo __('Delete interval'); ?>",
$('#submit-update_button').trigger('click'); message: "<?php echo __('This action is not reversible. Are you sure'); ?>",
onAccept: function() {
var interval_selected = $('#intervals option:selected').val();
$('#hidden-interval_to_delete').val(interval_selected);
$('#button-update_button').trigger('click');
}
});
}); });
$("#button-interval_add_btn").click( function() { $("#button-interval_add_btn").click( function() {

View File

@ -1489,6 +1489,15 @@ function config_update_config()
$interval_values_array = explode(',', $interval_values); $interval_values_array = explode(',', $interval_values);
if (in_array($new_interval, $interval_values_array) === false) { if (in_array($new_interval, $interval_values_array) === false) {
$interval_values_array[] = $new_interval; $interval_values_array[] = $new_interval;
// Get current periods.
$current_period = get_periods(false, false, true);
if (!isset($current_period[-1])) {
$new_current_period = array_keys($current_period);
$new_current_period = implode(',', $new_current_period);
// Add new periods to current.
array_push($interval_values_array, $new_current_period);
}
$interval_values = implode(',', $interval_values_array); $interval_values = implode(',', $interval_values_array);
} }
} }

View File

@ -2227,7 +2227,7 @@ function html_print_extended_select_for_time(
$nothing_value, $nothing_value,
false, false,
false, false,
false, true,
$class, $class,
$readonly, $readonly,
'font-size: xx-small;'.$select_style 'font-size: xx-small;'.$select_style