Merge branch 'ent-12081-añadir-el-lapso-de-tiempo-none-para-el-filtro-de-los-informes-en-la-vista-HTML-por-defecto' into 'develop'

Ent 12081 añadir el lapso de tiempo none para el filtro de los informes en la vista html por defecto

See merge request artica/pandorafms!6496
This commit is contained in:
Rafael Ameijeiras 2023-10-02 11:23:35 +00:00
commit b0d12c8a18
2 changed files with 7 additions and 4 deletions

View File

@ -7318,6 +7318,7 @@ function html_print_select_date_range(
$fields[SECONDS_1MONTH] = __('Last 30 days'); $fields[SECONDS_1MONTH] = __('Last 30 days');
$fields['custom'] = __('Custom'); $fields['custom'] = __('Custom');
$fields['chose_range'] = __('Chose start/end date period'); $fields['chose_range'] = __('Chose start/end date period');
$fields['none'] = __('None');
$output = html_print_input_hidden('custom_date', $custom_date, true); $output = html_print_input_hidden('custom_date', $custom_date, true);
$output .= '<div id="'.$name.'_default" class="wauto inline_flex" '.$display_default.'>'; $output .= '<div id="'.$name.'_default" class="wauto inline_flex" '.$display_default.'>';

View File

@ -58,7 +58,7 @@ $datetime_end = strtotime($date_end.' '.$time_end);
// Calculate new inteval for all reports. // Calculate new inteval for all reports.
$custom_date = get_parameter('custom_date', 0); $custom_date = get_parameter('custom_date', 0);
$date = get_parameter('date', SECONDS_1DAY); $date = get_parameter('date', 'none');
$date_text = get_parameter('date_text', SECONDS_1DAY); $date_text = get_parameter('date_text', SECONDS_1DAY);
$custom_date_end = ''; $custom_date_end = '';
@ -111,6 +111,9 @@ if ($custom_date === '1') {
$first_of_week = date('Y-m-d', strtotime('monday', strtotime('last week'))); $first_of_week = date('Y-m-d', strtotime('monday', strtotime('last week')));
$period = (strtotime($date_end) - strtotime($first_of_week)); $period = (strtotime($date_end) - strtotime($first_of_week));
} }
} else if ($date === 'none') {
// Prioritize the report item period based on the current local date/time.
$date_end = date('Y/m/d H:i:s');
} else { } else {
$date_end = date('Y/m/d H:i:s'); $date_end = date('Y/m/d H:i:s');
$date_start = date('Y/m/d H:i:s', (strtotime($date_end) - $date)); $date_start = date('Y/m/d H:i:s', (strtotime($date_end) - $date));
@ -315,12 +318,12 @@ if ($html_menu_export === ENTERPRISE_NOT_HOOK) {
if ((bool) is_metaconsole() === true) { if ((bool) is_metaconsole() === true) {
$table2->data[0][2] = html_print_label_input_block( $table2->data[0][2] = html_print_label_input_block(
__('Date').' ', __('Date').' ',
html_print_select_date_range('date', true, get_parameter('date', SECONDS_1DAY), $date_init, $time_init, date('Y/m/d'), date('H:i:s'), $date_text), html_print_select_date_range('date', true, get_parameter('date', 'none'), $date_init, $time_init, date('Y/m/d'), date('H:i:s'), $date_text),
); );
} else { } else {
$table2->data[0][2] = html_print_label_input_block( $table2->data[0][2] = html_print_label_input_block(
__('Date').' ', __('Date').' ',
html_print_select_date_range('date', true, get_parameter('date', SECONDS_1DAY), $date_init, $time_init, date('Y/m/d'), date('H:i:s'), $date_text), html_print_select_date_range('date', true, get_parameter('date', 'none'), $date_init, $time_init, date('Y/m/d'), date('H:i:s'), $date_text),
['label_class' => 'filter_label_position_before'] ['label_class' => 'filter_label_position_before']
); );
} }
@ -451,7 +454,6 @@ $(document).ready (function () {
$("#string_to").show(); $("#string_to").show();
$('#string_from').show(); $('#string_from').show();
$("#string_items").hide(); $("#string_items").hide();
console.log($(".filter_label_position_before").html());
} else { } else {
$("#string_to").hide(); $("#string_to").hide();
$('#string_from').hide(); $('#string_from').hide();