From d76ddace94d9fccd322ca875186778a60d0f7516 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 9 Dec 2009 12:27:57 +0000 Subject: [PATCH] 2009-12-08 Miguel de Dios * godmode/reporting/reporting_builder.php: test empty title report before on submit in javascript, and test empty this title in PHP. Fixes: 2910627 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2185 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 +++++ .../godmode/reporting/reporting_builder.php | 25 +++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 871eb7d9c0..b8537694c2 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2009-12-08 Miguel de Dios + + * godmode/reporting/reporting_builder.php: test empty title report before on + submit in javascript, and test empty this title in PHP. + Fixes: 2910627 + 2009-12-09 Raul Mateos * godmode/db/db_info.php: Added icon to download database info. diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 41c988fbdc..ddd42d1ef2 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -45,7 +45,7 @@ $create_report = (bool) get_parameter ('create_report'); $delete_report = (int) get_parameter ('delete_report'); $update_report = (int) get_parameter ('update_report'); $delete_report_content = (bool) get_parameter ('delete_report_content'); -$report_name = (string) get_parameter ('report_name'); +$report_name = trim((string) get_parameter ('report_name')); $report_description = (string) get_parameter ('report_description'); $report_private = (bool) get_parameter ('report_private', 0); $id_report = (int) get_parameter ('id_report'); @@ -134,9 +134,13 @@ if ($create_report) { $values = array (); $values['description'] = $report_description; $values['private'] = $report_private; - $id_report = create_report ($report_name, $report_id_group, $values); - print_result_message ($id_report, - __('Successfully created'), + + if (strlen($report_name) == 0) + $result = false; + else { + $result = $id_report = create_report ($report_name, $report_id_group, $values); + } + print_result_message ($result, __('Successfully created'), __('Could not be created')); } @@ -148,9 +152,12 @@ if ($update_report) { $values['private'] = $report_private; $values['id_group'] = $report_id_group; - $result = update_report ($id_report, $values); - print_result_message ($result, - __('Successfully updated'), + if (strlen($report_name) == 0) + $result = false; + else { + $result = update_report ($id_report, $values); + } + print_result_message ($result, __('Successfully updated'), __('Could not be updated')); } @@ -321,7 +328,9 @@ if ($edit_sla_report_content) { $table->data[3][0] = __('Description'); $table->data[3][1] = print_textarea ('report_description', 3, 40, $report_description, '', true); - echo "
"; + echo ""; print_table ($table); // Button echo '
';