mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
Change some code for the CSV reports.
(cherry picked from commit bc522e1d2dbd1e3607040766880043e4abad5fe3)
This commit is contained in:
parent
4a7e66c943
commit
e7577e0d1d
@ -391,12 +391,14 @@ function reporting_make_reporting_data($report = null, $id_report,
|
|||||||
case 'inventory':
|
case 'inventory':
|
||||||
$report['contents'][] = reporting_inventory(
|
$report['contents'][] = reporting_inventory(
|
||||||
$report,
|
$report,
|
||||||
$content);
|
$content,
|
||||||
|
$type);
|
||||||
break;
|
break;
|
||||||
case 'inventory_changes':
|
case 'inventory_changes':
|
||||||
$report['contents'][] = reporting_inventory_changes(
|
$report['contents'][] = reporting_inventory_changes(
|
||||||
$report,
|
$report,
|
||||||
$content);
|
$content,
|
||||||
|
$type);
|
||||||
break;
|
break;
|
||||||
case 'event_report_module':
|
case 'event_report_module':
|
||||||
$report['contents'][] = reporting_event_report_module(
|
$report['contents'][] = reporting_event_report_module(
|
||||||
@ -1361,7 +1363,7 @@ function reporting_event_report_module($report, $content) {
|
|||||||
return reporting_check_structure_content($return);
|
return reporting_check_structure_content($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reporting_inventory_changes($report, $content) {
|
function reporting_inventory_changes($report, $content, $type) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$return['type'] = 'inventory_changes';
|
$return['type'] = 'inventory_changes';
|
||||||
@ -1389,11 +1391,22 @@ function reporting_inventory_changes($report, $content) {
|
|||||||
$module_name = $es['inventory_modules'];
|
$module_name = $es['inventory_modules'];
|
||||||
|
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'data':
|
||||||
|
$inventory_changes = inventory_get_changes(
|
||||||
|
$id_agent, $module_name,
|
||||||
|
$report["datetime"] - $content['period'],
|
||||||
|
$report["datetime"], "csv");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$inventory_changes = inventory_get_changes(
|
||||||
|
$id_agent, $module_name,
|
||||||
|
$report["datetime"] - $content['period'],
|
||||||
|
$report["datetime"], "array");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$inventory_changes = inventory_get_changes(
|
|
||||||
$id_agent, $module_name,
|
|
||||||
$report["datetime"] - $content['period'],
|
|
||||||
$report["datetime"], "array");
|
|
||||||
|
|
||||||
$return['data'] = array();
|
$return['data'] = array();
|
||||||
|
|
||||||
@ -1411,7 +1424,7 @@ function reporting_inventory_changes($report, $content) {
|
|||||||
return reporting_check_structure_content($return);
|
return reporting_check_structure_content($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reporting_inventory($report, $content) {
|
function reporting_inventory($report, $content, $type) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$es = json_decode($content['external_source'], true);
|
$es = json_decode($content['external_source'], true);
|
||||||
@ -1444,9 +1457,20 @@ function reporting_inventory($report, $content) {
|
|||||||
$date = $es['date'];
|
$date = $es['date'];
|
||||||
$description = $content['description'];
|
$description = $content['description'];
|
||||||
|
|
||||||
$inventory_data = inventory_get_data(
|
switch ($type) {
|
||||||
(array)$id_agent, (array)$module_name, $date, '', false,
|
case 'data':
|
||||||
'hash');
|
$inventory_data = inventory_get_data(
|
||||||
|
(array)$id_agent, (array)$module_name, $date, '', false,
|
||||||
|
'csv');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$inventory_data = inventory_get_data(
|
||||||
|
(array)$id_agent, (array)$module_name, $date, '', false,
|
||||||
|
'hash');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($inventory_data == ERR_NODATA) {
|
if ($inventory_data == ERR_NODATA) {
|
||||||
$return['failed'] = __('No data found.');
|
$return['failed'] = __('No data found.');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user