Skip to content

Commit

Permalink
[#431] Fix several 'undefined index' warnings.
Browse files Browse the repository at this point in the history
There were several errors like this in the logs:

PHP Notice:  Undefined index: dateFormat in
/var/www/html/phpreport/web/services/getProjectUserWeeklyHoursReportJsonService.php on line 41

Used the new PHP7 null coalesce operator to assign default
values in those cases that printed a warning. Also removed
$login which was never used in these services.
  • Loading branch information
jaragunde committed Dec 1, 2018
1 parent 54f798a commit 0f30c55
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/admin/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To install PhpReport in your system, you will need the following software:

* PostgreSQL database server (tested with PostgreSQL 9)

* PHP 5.4 or higher
* PHP 7.0 or higher

* Support for PostgreSQL

Expand Down
2 changes: 1 addition & 1 deletion web/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/


$sid = $_GET['sid'];
$sid = $_GET['sid'] ?? NULL;

/* We check authentication and authorization */
require_once(PHPREPORT_ROOT . '/util/LoginManager.php');
Expand Down
13 changes: 4 additions & 9 deletions web/services/getProjectUserCustomerReportJsonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@

$projectId = $_GET['pid'];

$init = $_GET['init'];
$init = $_GET['init'] ?? "";

$end = $_GET['end'];
$end = $_GET['end'] ?? "";

$dateFormat = $_GET['dateFormat'];
$dateFormat = $_GET['dateFormat'] ?? "Y-m-d";

$login = $_GET['login'];

$sid = $_GET['sid'];
$sid = $_GET['sid'] ?? NULL;

do {

Expand Down Expand Up @@ -97,9 +95,6 @@
}
}

if ($dateFormat=="")
$dateFormat = "Y-m-d";

if ($init!="")
{
$response['init'] = $init;
Expand Down
11 changes: 4 additions & 7 deletions web/services/getProjectUserStoryReportJsonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@

$projectId = $_GET['pid'];

$init = $_GET['init'];
$init = $_GET['init'] ?? "";

$end = $_GET['end'];
$end = $_GET['end'] ?? "";

$dateFormat = $_GET['dateFormat'];
$dateFormat = $_GET['dateFormat'] ?? "Y-m-d";

$sid = $_GET['sid'];
$sid = $_GET['sid'] ?? NULL;

do {

Expand Down Expand Up @@ -76,9 +76,6 @@
break;
}

if ($dateFormat=="")
$dateFormat = "Y-m-d";

if ($init!="")
{
$response['init'] = $init;
Expand Down
11 changes: 4 additions & 7 deletions web/services/getProjectUserWeeklyHoursReportJsonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@

$projectId = $_GET['pid'];

$init = $_GET['init'];
$init = $_GET['init'] ?? "";

$end = $_GET['end'];
$end = $_GET['end'] ?? "";

$dateFormat = $_GET['dateFormat'];
$dateFormat = $_GET['dateFormat'] ?? "Y-m-d";

$login = $_GET['login'];
$sid = $_GET['sid'] ?? NULL;

do {

Expand Down Expand Up @@ -74,9 +74,6 @@
break;
}

if ($dateFormat=="")
$dateFormat = "Y-m-d";

if ($init!="")
{
$response['init'] = $init;
Expand Down

0 comments on commit 0f30c55

Please sign in to comment.