[Fusionforge-commits] r11037 - trunk/src/www/reporting

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Mon Oct 18 18:38:27 CEST 2010


Author: aljeux
Date: 2010-10-18 18:38:26 +0200 (Mon, 18 Oct 2010)
New Revision: 11037

Modified:
   trunk/src/www/reporting/groupadded.php
   trunk/src/www/reporting/groupcum.php
   trunk/src/www/reporting/toolspie.php
Log:
Refactor args parsing in reporting code.

Modified: trunk/src/www/reporting/groupadded.php
===================================================================
--- trunk/src/www/reporting/groupadded.php	2010-10-18 16:38:15 UTC (rev 11036)
+++ trunk/src/www/reporting/groupadded.php	2010-10-18 16:38:26 UTC (rev 11037)
@@ -27,6 +27,8 @@
 require_once $gfcommon.'reporting/report_utils.php';
 require_once $gfcommon.'reporting/Report.class.php';
 
+session_require_global_perm ('forge_stats', 'read') ;
+
 $report=new Report();
 if ($report->isError()) {
 	exit_error($report->getErrorMessage());
@@ -36,12 +38,12 @@
 $start = getIntFromRequest('start');
 $end = getIntFromRequest('end');
 
+if (!$start || !$end) $z =& $report->getMonthStartArr();
+
 if (!$start) {
-	$z =& $report->getMonthStartArr();
 	$start = $z[0];
 }
-if (!$end || $end <= $start) {
-	$z =& $report->getMonthStartArr();
+if (!$end) {
 	$end = $z[count($z)-1];
 }
 if ($end < $start) list($start, $end) = array($end, $start);
@@ -50,8 +52,6 @@
 	$error_msg .= _('Start and end dates must be different');
 }
 
-session_require_global_perm ('forge_stats', 'read') ;
-
 report_header(_('Projects Added'));
 
 ?>

Modified: trunk/src/www/reporting/groupcum.php
===================================================================
--- trunk/src/www/reporting/groupcum.php	2010-10-18 16:38:15 UTC (rev 11036)
+++ trunk/src/www/reporting/groupcum.php	2010-10-18 16:38:26 UTC (rev 11037)
@@ -26,6 +26,8 @@
 require_once $gfcommon.'reporting/report_utils.php';
 require_once $gfcommon.'reporting/Report.class.php';
 
+session_require_global_perm ('forge_stats', 'read') ;
+
 $report=new Report();
 if ($report->isError()) {
 	exit_error($report->getErrorMessage());
@@ -35,12 +37,12 @@
 $start = getIntFromRequest('start');
 $end = getIntFromRequest('end');
 
+if (!$start || !$end) $z =& $report->getMonthStartArr();
+
 if (!$start) {
-	$z =& $report->getMonthStartArr();
 	$start = $z[0];
 }
-if (!$end || $end <= $start) {
-	$z =& $report->getMonthStartArr();
+if (!$end) {
 	$end = $z[count($z)-1];
 }
 if ($end < $start) list($start, $end) = array($end, $start);
@@ -49,8 +51,6 @@
 	$error_msg .= _('Start and end dates must be different');
 }
 
-session_require_global_perm ('forge_stats', 'read') ;
-
 report_header(_('Cumulative Projects'));
 
 ?>

Modified: trunk/src/www/reporting/toolspie.php
===================================================================
--- trunk/src/www/reporting/toolspie.php	2010-10-18 16:38:15 UTC (rev 11036)
+++ trunk/src/www/reporting/toolspie.php	2010-10-18 16:38:26 UTC (rev 11037)
@@ -27,6 +27,8 @@
 require_once $gfcommon.'reporting/report_utils.php';
 require_once $gfcommon.'reporting/Report.class.php';
 
+session_require_global_perm ('forge_stats', 'read') ;
+
 $report=new Report();
 if ($report->isError()) {
 	exit_error($report->getErrorMessage());
@@ -50,8 +52,6 @@
 	$error_msg .= _('Start and end dates must be different');
 }
 
-session_require_global_perm ('forge_stats', 'read') ;
-
 report_header(_('Tool Pie Graphs'));
 
 if (!$datatype) {




More information about the Fusionforge-commits mailing list