diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d2afd598..ff17d5e80 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,26 +1,33 @@ -name: Psalm Static analysis +name: Psalm -on: [push, pull_request] +on: + push: + paths: + - '**.php' + - 'psalm.xml.dist' jobs: psalm: - name: Psalm + name: psalm runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: Psalm - uses: docker://vimeo/psalm-github-actions - continue-on-error: true + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - security_analysis: true - report_file: results.sarif - composer_require_dev: true - composer_ignore_platform_reqs: false - - - name: Upload Security Analysis results to GitHub - uses: github/codeql-action/upload-sarif@v1 + php-version: '7.4' + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, ext-ldap + coverage: none + + - name: Cache composer dependencies + uses: actions/cache@v2 with: - sarif_file: results.sarif - + path: vendor + key: composer-${{ hashFiles('composer.lock') }} + + - name: Run composer install + run: composer install -n --prefer-dist + + - name: Run psalm + run: ./vendor/bin/psalm --output-format=github diff --git a/resources/language/en-GB.ini b/resources/language/en-GB.ini index 35ff6edb6..60dd2512f 100644 --- a/resources/language/en-GB.ini +++ b/resources/language/en-GB.ini @@ -220,6 +220,7 @@ notification.client_exists_already = "Client exists already" notification.client_has_todos = "Client has to-dos & projects assigned" notification.client_deleted = "Client deleted successfully" notification.event_created_successfully = "Event created successfully" +notification.event_edited_successfully = "Event edited successfully" notification.event_removed_successfully = "Event removed successfully" notification.could_not_delete_event = "Could not delete event" notification.user_created = "New user created successfully" diff --git a/resources/language/en-US.ini b/resources/language/en-US.ini index 3b71d0710..7599fbdd6 100644 --- a/resources/language/en-US.ini +++ b/resources/language/en-US.ini @@ -225,6 +225,7 @@ notification.client_exists_already = "Client exists already" notification.client_has_todos = "Client has to-dos & projects assigned" notification.client_deleted = "Client deleted successfully" notification.event_created_successfully = "Event created successfully" +notification.event_edited_successfully = "Event edited successfully" notification.event_removed_successfully = "Event removed successfully" notification.could_not_delete_event = "Could not delete event" notification.user_created = "New user created successfully" diff --git a/src/domain/calendar/templates/showMyCalendar.tpl.php b/src/domain/calendar/templates/showMyCalendar.tpl.php index 935786b69..5c0d4e2a6 100644 --- a/src/domain/calendar/templates/showMyCalendar.tpl.php +++ b/src/domain/calendar/templates/showMyCalendar.tpl.php @@ -49,7 +49,7 @@ $calendar['dateTo']['h'].','. $calendar['dateTo']['i'] ?>), - + allDay: true, allDay: false, diff --git a/src/domain/ldap/services/class.ldap.php b/src/domain/ldap/services/class.ldap.php index d5e8c7620..228a0e089 100644 --- a/src/domain/ldap/services/class.ldap.php +++ b/src/domain/ldap/services/class.ldap.php @@ -110,8 +110,8 @@ public function connect() { public function bind($username='', $password=''){ if($username != '' && $password != ''){ - $usernameDN = $this->ldapKeys->username."=".$this->bindUser.",".$this->ldapDn; - $passwordBind=''; + $usernameDN = $this->ldapKeys->username."=".$username.",".$this->ldapDn; + $passwordBind=$password; }else{ $usernameDN = $this->ldapKeys->username."=".$this->bindUser.",".$this->ldapDn; $passwordBind = $this->bindPassword; diff --git a/src/domain/projects/repositories/class.projects.php b/src/domain/projects/repositories/class.projects.php index 615988df1..005668247 100644 --- a/src/domain/projects/repositories/class.projects.php +++ b/src/domain/projects/repositories/class.projects.php @@ -118,7 +118,7 @@ public function getUserProjects($userId, $status = "all", $clientId = "") project.state, project.hourBudget, project.dollarBudget, - COUNT(ticket.projectId) AS numberOfTickets, + SUM(case when ticket.type <> 'milestone' AND ticket.type <> 'subtask' then 1 else 0 end) as numberOfTickets, client.name AS clientName, client.id AS clientId FROM zp_relationuserproject AS relation @@ -166,7 +166,7 @@ public function getClientProjects($clientId) project.hourBudget, project.dollarBudget, project.state, - COUNT(ticket.projectId) AS numberOfTickets, + SUM(case when ticket.type <> 'milestone' AND ticket.type <> 'subtask' then 1 else 0 end) as numberOfTickets, client.name AS clientName, client.id AS clientId FROM zp_projects as project @@ -234,7 +234,7 @@ public function getProject($id) zp_projects.hourBudget, zp_projects.dollarBudget, zp_clients.name AS clientName, - COUNT(zp_tickets.id) AS numberOfTickets + SUM(case when zp_tickets.type <> 'milestone' AND zp_tickets.type <> 'subtask' then 1 else 0 end) as numberOfTickets FROM zp_projects LEFT JOIN zp_tickets ON zp_projects.id = zp_tickets.projectId LEFT JOIN zp_clients ON zp_projects.clientId = zp_clients.id diff --git a/src/domain/sprints/services/class.sprints.php b/src/domain/sprints/services/class.sprints.php index 44e7942c9..6f2c47e0c 100644 --- a/src/domain/sprints/services/class.sprints.php +++ b/src/domain/sprints/services/class.sprints.php @@ -174,8 +174,29 @@ public function getSprintBurndown($sprint) $plannedEffortStart = 0; } - $dateStart = new DateTime($sprint->startDate); - $dateEnd = new DateTime($sprint->endDate); + //The sprint object can come from the repository or the service. + //Dates get formatted in the service and could not be parsed + //Checking if we have an iso date or not + if(strlen($sprint->startDate) > 11){ + //DB dateformat + $dateStart = new DateTime($sprint->startDate); + $dateEnd = new DateTime($sprint->endDate); + $period = new DatePeriod( + new DateTime($sprint->startDate), + new DateInterval('P1D'), + new DateTime($sprint->endDate) + ); + }else{ + //language formatted + $dateStart = new DateTime($this->language->getISODateString($sprint->startDate)); + $dateEnd = new DateTime($this->language->getISODateString($sprint->endDate)); + $period = new DatePeriod( + new DateTime($this->language->getISODateString($sprint->startDate)), + new DateInterval('P1D'), + new DateTime($this->language->getISODateString($sprint->endDate)) + ); + } + $sprintLength = $dateEnd->diff($dateStart)->format("%a"); $sprintLength++; //Diff is 1 day less than actual sprint days (eg even if a sprint starts and ends today it should still be a 1 day sprint, but the diff would be 0) @@ -183,12 +204,6 @@ public function getSprintBurndown($sprint) $dailyNumPlanned = $plannedNumStart / $sprintLength; $dailyEffortPlanned = $plannedEffortStart / $sprintLength; - $period = new DatePeriod( - new DateTime($sprint->startDate), - new DateInterval('P1D'), - new DateTime($sprint->endDate) - ); - $burnDown = []; $i = 0; foreach ($period as $key => $value) { diff --git a/src/domain/tickets/templates/delTicket.tpl.php b/src/domain/tickets/templates/delTicket.tpl.php index e3f011991..1b561c449 100644 --- a/src/domain/tickets/templates/delTicket.tpl.php +++ b/src/domain/tickets/templates/delTicket.tpl.php @@ -8,7 +8,7 @@
-

__('headline.delete_ticket'); ?>e($ticket->headline);?>

+

__('headline.delete_ticket'); ?>: e($ticket->headline);?>

diff --git a/src/domain/users/repositories/class.users.php b/src/domain/users/repositories/class.users.php index d9cb95005..110d1f07c 100644 --- a/src/domain/users/repositories/class.users.php +++ b/src/domain/users/repositories/class.users.php @@ -211,7 +211,7 @@ public function getAllClientUsers($clientId) twoFAEnabled, zp_clients.name AS clientName FROM `zp_user` - LEFT JOIN zp_clients ON zp_clients.id = zp_user.id + LEFT JOIN zp_clients ON zp_clients.id = zp_user.clientId WHERE clientId = :clientId ORDER BY lastname";