Loading module/Oscar/src/Oscar/Controller/AbstractOscarController.php +4 −0 Changes for module/Oscar/src/Oscar/Controller/AbstractOscarController.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -112,6 +112,10 @@ class AbstractOscarController extends AbstractActionController return $r; } protected function jsonOutput($datas){ return $this->ajaxResponse($datas); } protected function getHttpResponse($code, $content = null) { $response = new Response(); Loading module/Oscar/src/Oscar/Controller/TimesheetController.php +10 −1 Changes for module/Oscar/src/Oscar/Controller/TimesheetController.php: 10 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -1046,12 +1046,21 @@ class TimesheetController extends AbstractOscarController public function resumeActivityAction(){ $activity = $this->getEntityManager()->getRepository(Activity::class)->find($this->params()->fromRoute('id')); $this->getOscarUserContext()->check(Privileges::ACTIVITY_TIMESHEET_VIEW, $activity); $format = $this->params()->fromQuery('format', null); $method = $this->getHttpXMethod(); if( $this->isAjax() ){ if( $this->isAjax() || $format == 'json' ){ switch ($method) { case 'GET' : $datas = $this->getTimesheetService()->getResumeActivity($activity); if( $format == 'json' ){ return $this->jsonOutput($datas); } return $this->ajaxResponse($datas); } } Loading module/Oscar/src/Oscar/Service/TimesheetService.php +16 −1 Changes for module/Oscar/src/Oscar/Service/TimesheetService.php: 16 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -1204,8 +1204,12 @@ class TimesheetService implements ServiceLocatorAwareInterface, EntityManagerAwa // Début / Fin $periodsList = DateTimeUtils::allperiodsBetweenTwo($activity->getDateStart()->format('Y-m'), $activity->getDateEnd()->format('Y-m')); foreach ($periodsList as $period) { $periodBounds = DateTimeUtils::periodBounds($period); $periods[$period] = [ 'total' => 0.0, 'days' => $periodBounds['days'], 'workpackages' => [], 'persons' => [] ]; Loading @@ -1218,6 +1222,7 @@ class TimesheetService implements ServiceLocatorAwareInterface, EntityManagerAwa 'validation_state' => array_key_exists($validationKey, $validationsState) ? $validationsState[$validationKey] : 'none', 'displayname' => $person['displayname'], 'workpackages' => [], 'details' => [], ]; foreach ($workPackages as $wp) { $periods[$period]['persons'][$personId]['workpackages'][$wp['id']] = 0.0; Loading @@ -1242,14 +1247,24 @@ class TimesheetService implements ServiceLocatorAwareInterface, EntityManagerAwa $wpCode = $timesheet->getWorkpackage()->getCode(); $wpId = $timesheet->getWorkpackage()->getId(); $duration = $timesheet->getDuration(); $day = $timesheet->getDateFrom()->format('j'); $total += $duration; $workPackages[$wpId]['total'] += $duration; $persons[$personId]['total'] += $duration; $periods[$period]['total'] += $duration; $periods[$period]['persons'][$personId]['total'] += $duration; $periods[$period]['persons'][$personId]['workpackages'][$wpId] += $duration; if( !array_key_exists($wpId, $periods[$period]['persons'][$personId]['details']) ){ $periods[$period]['persons'][$personId]['details'][$wpId] = []; } if( !array_key_exists($day, $periods[$period]['persons'][$personId]['details'][$wpId]) ){ $periods[$period]['persons'][$personId]['details'][$wpId][$day] = 0.0; } $periods[$period]['persons'][$personId]['details'][$wpId][$day] += $duration; } $datas = [ Loading Loading
module/Oscar/src/Oscar/Controller/AbstractOscarController.php +4 −0 Changes for module/Oscar/src/Oscar/Controller/AbstractOscarController.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -112,6 +112,10 @@ class AbstractOscarController extends AbstractActionController return $r; } protected function jsonOutput($datas){ return $this->ajaxResponse($datas); } protected function getHttpResponse($code, $content = null) { $response = new Response(); Loading
module/Oscar/src/Oscar/Controller/TimesheetController.php +10 −1 Changes for module/Oscar/src/Oscar/Controller/TimesheetController.php: 10 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -1046,12 +1046,21 @@ class TimesheetController extends AbstractOscarController public function resumeActivityAction(){ $activity = $this->getEntityManager()->getRepository(Activity::class)->find($this->params()->fromRoute('id')); $this->getOscarUserContext()->check(Privileges::ACTIVITY_TIMESHEET_VIEW, $activity); $format = $this->params()->fromQuery('format', null); $method = $this->getHttpXMethod(); if( $this->isAjax() ){ if( $this->isAjax() || $format == 'json' ){ switch ($method) { case 'GET' : $datas = $this->getTimesheetService()->getResumeActivity($activity); if( $format == 'json' ){ return $this->jsonOutput($datas); } return $this->ajaxResponse($datas); } } Loading
module/Oscar/src/Oscar/Service/TimesheetService.php +16 −1 Changes for module/Oscar/src/Oscar/Service/TimesheetService.php: 16 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -1204,8 +1204,12 @@ class TimesheetService implements ServiceLocatorAwareInterface, EntityManagerAwa // Début / Fin $periodsList = DateTimeUtils::allperiodsBetweenTwo($activity->getDateStart()->format('Y-m'), $activity->getDateEnd()->format('Y-m')); foreach ($periodsList as $period) { $periodBounds = DateTimeUtils::periodBounds($period); $periods[$period] = [ 'total' => 0.0, 'days' => $periodBounds['days'], 'workpackages' => [], 'persons' => [] ]; Loading @@ -1218,6 +1222,7 @@ class TimesheetService implements ServiceLocatorAwareInterface, EntityManagerAwa 'validation_state' => array_key_exists($validationKey, $validationsState) ? $validationsState[$validationKey] : 'none', 'displayname' => $person['displayname'], 'workpackages' => [], 'details' => [], ]; foreach ($workPackages as $wp) { $periods[$period]['persons'][$personId]['workpackages'][$wp['id']] = 0.0; Loading @@ -1242,14 +1247,24 @@ class TimesheetService implements ServiceLocatorAwareInterface, EntityManagerAwa $wpCode = $timesheet->getWorkpackage()->getCode(); $wpId = $timesheet->getWorkpackage()->getId(); $duration = $timesheet->getDuration(); $day = $timesheet->getDateFrom()->format('j'); $total += $duration; $workPackages[$wpId]['total'] += $duration; $persons[$personId]['total'] += $duration; $periods[$period]['total'] += $duration; $periods[$period]['persons'][$personId]['total'] += $duration; $periods[$period]['persons'][$personId]['workpackages'][$wpId] += $duration; if( !array_key_exists($wpId, $periods[$period]['persons'][$personId]['details']) ){ $periods[$period]['persons'][$personId]['details'][$wpId] = []; } if( !array_key_exists($day, $periods[$period]['persons'][$personId]['details'][$wpId]) ){ $periods[$period]['persons'][$personId]['details'][$wpId][$day] = 0.0; } $periods[$period]['persons'][$personId]['details'][$wpId][$day] += $duration; } $datas = [ Loading