Merge branch 'ent-5850-error-reports-historical-serialize-command-snapshots' into 'develop'

Ent 5850 error reports historical serialize command snapshots

See merge request artica/pandorafms!3217
This commit is contained in:
Daniel Rodriguez 2020-06-25 15:17:24 +02:00
commit a645f3c0b2
3 changed files with 30 additions and 10 deletions

View File

@ -3621,16 +3621,21 @@ function html_print_timezone_select($name, $selected='')
* Enclose a text into a result_div * Enclose a text into a result_div
* *
* @param string Text to enclose * @param string Text to enclose
* @param boolean Return formatted text without html tags.
* *
* @return string Text inside the result_div * @return string Text inside the result_div
*/ */
function html_print_result_div($text) function html_print_result_div($text, $text_only)
{ {
$text = preg_replace('/</', '&lt;', $text); $text = preg_replace('/</', '&lt;', $text);
$text = preg_replace('/>/', '&gt;', $text); $text = preg_replace('/>/', '&gt;', $text);
$text = preg_replace('/\n/i', '<br>', $text); $text = preg_replace('/\n/i', '<br>', $text);
$text = preg_replace('/\s/i', '&nbsp;', $text); $text = preg_replace('/\s/i', '&nbsp;', $text);
if ($text_only) {
return $text;
}
$enclose = "<div id='result_div' style='width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>"; $enclose = "<div id='result_div' style='width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
$enclose .= $text; $enclose .= $text;
$enclose .= '</div>'; $enclose .= '</div>';

View File

@ -3357,7 +3357,7 @@ function reporting_database_serialized($report, $content)
); );
// Adds string data if there is no numeric data. // Adds string data if there is no numeric data.
if ((count($result) < 0) || (!$result)) { if ($result === false) {
// This query gets information from the default and the historic database. // This query gets information from the default and the historic database.
$result = db_get_all_rows_sql( $result = db_get_all_rows_sql(
'SELECT * 'SELECT *

View File

@ -2158,12 +2158,21 @@ function reporting_html_historical_data($table, $item, $pdf=0)
wordwrap(io_safe_input($data[__('Data')]), 60, "<br>\n", true), wordwrap(io_safe_input($data[__('Data')]), 60, "<br>\n", true),
]; ];
} }
} else {
// Command line snapshot.
if (is_text_to_black_string($data[__('Data')])) {
$table1->style[1] = 'text-align: left; font-family: monospace, mono';
$row = [
$data[__('Date')],
'<pre>'.$data[__('Data')].'</pre>',
];
} else { } else {
$row = [ $row = [
$data[__('Date')], $data[__('Date')],
$data[__('Data')], $data[__('Data')],
]; ];
} }
}
} else { } else {
$row = [ $row = [
$data[__('Date')], $data[__('Date')],
@ -2181,15 +2190,16 @@ function reporting_html_historical_data($table, $item, $pdf=0)
$table1, $table1,
true true
); );
return html_print_table($table, true);
} else { } else {
$table1->title = $item['title']; $table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf'; $table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;'; $table1->titlestyle = 'text-align:left;';
return html_print_table(
$table1, return html_print_table($table1, true);
true
);
} }
} }
@ -2234,6 +2244,11 @@ function reporting_html_database_serialized($table, $item, $pdf=0)
} else { } else {
$data_unserialized[$key] = wordwrap(io_safe_input($data_value), 60, "<br>\n", true); $data_unserialized[$key] = wordwrap(io_safe_input($data_value), 60, "<br>\n", true);
} }
} else if (is_text_to_black_string($data_unserialized[$key])) {
$table1->style[1] = 'white-space: pre-wrap;';
$table1->style[1] .= 'font-family: monospace, mono; ';
$table1->style[1] .= 'text-align: left';
$data_unserialized[$key] = '<pre>'.$data_value.'</pre>';
} }
} }