Loading module/Oscar/config/module.config.php +1 −0 Changes for module/Oscar/config/module.config.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -285,6 +285,7 @@ return array( 'syntheseActivity', 'synthesisAll', 'synthesisActivityPeriod', 'synthesisActivityPeriodsBounds', 'exportActivityDates', 'checkperiod' ], Loading module/Oscar/config/routes.yml +6 −1 Changes for module/Oscar/config/routes.yml: 6 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -169,7 +169,12 @@ timesheet: route: /synthesisactivity defaults: action: synthesisActivityPeriod synthesisactivitybounds: type: segment options: route: /synthese-activite-periode defaults: action: synthesisActivityPeriodsBounds synthesis: type: segment Loading module/Oscar/src/Oscar/Controller/TimesheetController.php +20 −0 Changes for module/Oscar/src/Oscar/Controller/TimesheetController.php: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -567,6 +567,26 @@ class TimesheetController extends AbstractOscarController ]; } public function synthesisActivityPeriodsBoundsAction() { $datas = []; $activity_id = $this->params()->fromQuery('activity_id', null); try { $activity = $this->getProjectGrantService()->getActivityById($activity_id, true); $this->getOscarUserContextService()->check(Privileges::ACTIVITY_TIMESHEET_VIEW, $activity); $from = $activity->getDateStartStr('Y-m'); $to = $activity->getDateEndStr('Y-m'); $datas = $this->getTimesheetService()->getSynthesisActivityPeriods($from, $to, $activity->getId()); } catch (\Exception $e) { throw new OscarException($e->getMessage()); } var_dump($datas); die(); } /** * Accès à la synthèse des déclaration pour une activité. * Loading module/Oscar/src/Oscar/Entity/TimesheetRepository.php +37 −0 Changes for module/Oscar/src/Oscar/Entity/TimesheetRepository.php: 37 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -164,6 +164,43 @@ class TimesheetRepository extends EntityRepository return $this->getEntityManager()->getConnection()->fetchAll($sql); } public function getPersonPeriodSynthesisBounds($personIds, $from, $to) { if (count($personIds) == 0) { throw new \Exception("Aucune personne"); } $query = "SELECT CONCAT(pr.firstname, ' ', pr.lastname) as person, p.acronym acronym, t.person_id, t.label, COALESCE(w.code, t.label) as itemkey, t.activity_id, t.workpackage_id, EXTRACT(EPOCH from dateto - datefrom) / 3600 as duration, to_char(t.datefrom, 'YYYY-MM') as period, t.activity_id FROM timesheet t LEFT JOIN workpackage w ON w.id = workpackage_id LEFT JOIN activity a ON a.id = t.activity_id LEFT JOIN project p ON p.id = a.project_id LEFT JOIN person pr ON t.person_id = pr.id WHERE person_id IN(" . implode(',', $personIds) . ") AND to_char(t.datefrom, 'YYYY-MM') >= '$from' AND to_char(t.datefrom, 'YYYY-MM') <= '$to' ;"; $rsm = new ResultSetMapping(); $result = $this->getEntityManager()->getConnection()->fetchAll($query); return $result; } public function getPersonPeriodSynthesis($personIds, $period) { if (count($personIds) == 0) { Loading module/Oscar/src/Oscar/Entity/ValidationPeriodRepository.php +20 −0 Changes for module/Oscar/src/Oscar/Entity/ValidationPeriodRepository.php: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -222,6 +222,26 @@ class ValidationPeriodRepository extends EntityRepository ] )->getQuery()->getResult(); } /** * @param array $personIds * @param string $periodStr * @return \Doctrine\ORM\QueryBuilder * @throws OscarException */ public function getValidationPeriodsForPersonsAtPeriodBounds( array $personIds, string $from, string $to) { $periodInfos = PeriodInfos::getPeriodInfosObj($periodStr); return $this->createQueryBuilder('v') ->where('v.declarer IN(:personIds) AND v.month = :month AND v.year = :year') ->setParameters( [ 'personIds' => $personIds, 'year' => $periodInfos->getYear(), 'month' => $periodInfos->getMonth(), ] )->getQuery()->getResult(); } /** * Retourne LA procédure de validation pour : La période, l'activité et la personne. Loading Loading
module/Oscar/config/module.config.php +1 −0 Changes for module/Oscar/config/module.config.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -285,6 +285,7 @@ return array( 'syntheseActivity', 'synthesisAll', 'synthesisActivityPeriod', 'synthesisActivityPeriodsBounds', 'exportActivityDates', 'checkperiod' ], Loading
module/Oscar/config/routes.yml +6 −1 Changes for module/Oscar/config/routes.yml: 6 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -169,7 +169,12 @@ timesheet: route: /synthesisactivity defaults: action: synthesisActivityPeriod synthesisactivitybounds: type: segment options: route: /synthese-activite-periode defaults: action: synthesisActivityPeriodsBounds synthesis: type: segment Loading
module/Oscar/src/Oscar/Controller/TimesheetController.php +20 −0 Changes for module/Oscar/src/Oscar/Controller/TimesheetController.php: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -567,6 +567,26 @@ class TimesheetController extends AbstractOscarController ]; } public function synthesisActivityPeriodsBoundsAction() { $datas = []; $activity_id = $this->params()->fromQuery('activity_id', null); try { $activity = $this->getProjectGrantService()->getActivityById($activity_id, true); $this->getOscarUserContextService()->check(Privileges::ACTIVITY_TIMESHEET_VIEW, $activity); $from = $activity->getDateStartStr('Y-m'); $to = $activity->getDateEndStr('Y-m'); $datas = $this->getTimesheetService()->getSynthesisActivityPeriods($from, $to, $activity->getId()); } catch (\Exception $e) { throw new OscarException($e->getMessage()); } var_dump($datas); die(); } /** * Accès à la synthèse des déclaration pour une activité. * Loading
module/Oscar/src/Oscar/Entity/TimesheetRepository.php +37 −0 Changes for module/Oscar/src/Oscar/Entity/TimesheetRepository.php: 37 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -164,6 +164,43 @@ class TimesheetRepository extends EntityRepository return $this->getEntityManager()->getConnection()->fetchAll($sql); } public function getPersonPeriodSynthesisBounds($personIds, $from, $to) { if (count($personIds) == 0) { throw new \Exception("Aucune personne"); } $query = "SELECT CONCAT(pr.firstname, ' ', pr.lastname) as person, p.acronym acronym, t.person_id, t.label, COALESCE(w.code, t.label) as itemkey, t.activity_id, t.workpackage_id, EXTRACT(EPOCH from dateto - datefrom) / 3600 as duration, to_char(t.datefrom, 'YYYY-MM') as period, t.activity_id FROM timesheet t LEFT JOIN workpackage w ON w.id = workpackage_id LEFT JOIN activity a ON a.id = t.activity_id LEFT JOIN project p ON p.id = a.project_id LEFT JOIN person pr ON t.person_id = pr.id WHERE person_id IN(" . implode(',', $personIds) . ") AND to_char(t.datefrom, 'YYYY-MM') >= '$from' AND to_char(t.datefrom, 'YYYY-MM') <= '$to' ;"; $rsm = new ResultSetMapping(); $result = $this->getEntityManager()->getConnection()->fetchAll($query); return $result; } public function getPersonPeriodSynthesis($personIds, $period) { if (count($personIds) == 0) { Loading
module/Oscar/src/Oscar/Entity/ValidationPeriodRepository.php +20 −0 Changes for module/Oscar/src/Oscar/Entity/ValidationPeriodRepository.php: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -222,6 +222,26 @@ class ValidationPeriodRepository extends EntityRepository ] )->getQuery()->getResult(); } /** * @param array $personIds * @param string $periodStr * @return \Doctrine\ORM\QueryBuilder * @throws OscarException */ public function getValidationPeriodsForPersonsAtPeriodBounds( array $personIds, string $from, string $to) { $periodInfos = PeriodInfos::getPeriodInfosObj($periodStr); return $this->createQueryBuilder('v') ->where('v.declarer IN(:personIds) AND v.month = :month AND v.year = :year') ->setParameters( [ 'personIds' => $personIds, 'year' => $periodInfos->getYear(), 'month' => $periodInfos->getMonth(), ] )->getQuery()->getResult(); } /** * Retourne LA procédure de validation pour : La période, l'activité et la personne. Loading