Loading module/Oscar/config/module.config.php +1 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,7 @@ return array( 'pcru', 'pcruInfos', "pcruList", "traces", "apiUi", "timesheet", "myRole" Loading module/Oscar/config/routes.yml +7 −0 Original line number Diff line number Diff line Loading @@ -936,6 +936,13 @@ contract: defaults: action: timesheet traces: type: segment options: route: /traces/:id defaults: action: traces personaccess: type: segment options: Loading module/Oscar/src/Oscar/Controller/ProjectGrantController.php +10 −0 Original line number Diff line number Diff line Loading @@ -2189,6 +2189,16 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif ]; } public function tracesAction(): JsonModel { $output = []; $this->getOscarUserContextService()->check(Privileges::MAINTENANCE_MENU_ADMIN); $output['traces'] = $this->getActivityLogService()->activityActivities($this->params()->fromRoute('id')) ->getQuery() ->getArrayResult(); return $this->jsonOutput($output); } public function personsAccessDeepAction() { $activityId = $this->params()->fromRoute('id'); Loading module/Oscar/src/Oscar/Controller/WorkPackageController.php +2 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,8 @@ class WorkPackageController extends AbstractOscarController $this->getEntityManager()->flush(); return $this->getResponseOk(); } catch( \Exception $e ){ return $this->getResponseInternalError('Impossible de supprimer le déclarant.'); $this->getLoggerService()->error("Impossible le déclarant : " . $e->getMessage()); return $this->getResponseInternalError('Impossible de modifier le déclarant.'); } } else { Loading module/Oscar/src/Oscar/Service/ProjectGrantService.php +103 −2 Original line number Diff line number Diff line Loading @@ -1474,6 +1474,14 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi 'milestones/activity', ['idactivity' => $activity->getId()] ); if ($oscarUserContext->hasPrivileges(\Oscar\Provider\Privileges::ACTIVITY_NOTIFICATIONS_SHOW, $activity)) { $datas['milestones']['url_notifications'] = $urlPlugin->fromRoute( 'contract/notifications', ['id' => $activity->getId()] ); } } // --- Lot de travail Loading @@ -1494,19 +1502,89 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi $datas['timesheets'] = [ 'readable' => false, 'editable' => false, 'enabled' => false, "declarers" => [], "validators" => [ "prj" => [], "sci" => [], "adm" => [], ], 'datas' => [] ]; if ($oscarUserContext->hasPrivileges(Privileges::ACTIVITY_PAYMENT_SHOW, $activity)) { if ($oscarUserContext->hasPrivileges(Privileges::ACTIVITY_TIMESHEET_VIEW, $activity)) { $datas['timesheets']['readable'] = true; if( !$activity->getAcronym() ){ $datas['timesheets']['enabled'] = false; $datas['timesheets']['enabled_details'] = "L'activité doit appartenir à un projet pour activer les feuilles de temps"; } else { $datas['timesheets']['enabled'] = true; } // écran "bilan" $datas['timesheets']['url_global'] = $urlPlugin->fromRoute( 'contract/timesheet', ['id' => $activity->getId()] ); $datas['timesheets']['url_synthesis'] = $urlPlugin->fromRoute( 'timesheet/synthesis', ['id' => $activity->getId()] ) . '?activity_id=' . $activity->getId(); // Récupération des déclarants foreach ($activity->getPersonsDeep() as $personActivity) { /** @var Person $person */ $person = $personActivity->getPerson(); if( $activity->hasDeclarant($person) ){ $datas['timesheets']['declarers'][] = [ 'label' => $person->getDisplayName(), 'hasDeclaration' => $person->hasDeclarationIn($activity), 'url_details' => $urlPlugin->fromRoute('timesheet/resume').'?person_id=' . $person->getId(), ]; } } // --- Partenaires de l'activité // Récupération des validateurs foreach ($activity->getValidatorsPrj() as $validator) { $datas['timesheets']['validators']['prj'][] = $validator->toJson(); } foreach ($activity->getValidatorsSci() as $validator) { $datas['timesheets']['validators']['sci'][] = $validator->toJson(); } foreach ($activity->getValidatorsAdm() as $validator) { $datas['timesheets']['validators']['adm'][] = $validator->toJson(); } } // --- DEPENSES $datas['spents'] = [ 'readable' => false, 'editable' => false, 'url' => null ]; if ($oscarUserContext->hasPrivileges(Privileges::DEPENSE_SHOW, $activity)) { $datas['spents']['readable'] = true; $datas['spents']['url'] = $urlPlugin->fromRoute( 'contract/spent-synthesis', ['id' => $activity->getId()] ); if ($oscarUserContext->hasPrivileges(Privileges::DEPENSE_DETAILS, $activity)) { $datas['spents']['url_details'] = $urlPlugin->fromRoute( 'contract/list-spent', ['id' => $activity->getId()] ); } if ($oscarUserContext->hasPrivileges(Privileges::ACTIVITY_ESTIMATEDSPENT_SHOW, $activity)) { $datas['spents']['url_previsionnel'] = $urlPlugin->fromRoute( 'contract/estimated-spent', ['id' => $activity->getId()] ); } } // --- Versements de l'activité $datas['payments'] = [ 'readable' => false, 'editable' => false, Loading @@ -1514,6 +1592,29 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi ]; if ($oscarUserContext->hasPrivileges(Privileges::ACTIVITY_PAYMENT_SHOW, $activity)) { $datas['payments']['readable'] = true; $datas['payments']['editable'] = $oscarUserContext->hasPrivileges(Privileges::ACTIVITY_PAYMENT_MANAGE, $activity); $datas['payments']['url'] = $urlPlugin->fromRoute( 'activitypayment', ['idactivity' => $activity->getId()] ); } // --- Options d'administration $datas['administration'] = [ 'readable' => false, 'editable' => false ]; if ($oscarUserContext->hasPrivileges(Privileges::MAINTENANCE_MENU_ADMIN)) { $datas['administration']['url_logs'] = $urlPlugin->fromRoute( 'contract/traces', ['id' => $activity->getId()] ); } if ($oscarUserContext->hasPrivileges(Privileges::ACTIVITY_PCRU, $activity)) { $datas['administration']['readable'] = true; $datas['administration']['pcru'] = true; } Loading Loading
module/Oscar/config/module.config.php +1 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,7 @@ return array( 'pcru', 'pcruInfos', "pcruList", "traces", "apiUi", "timesheet", "myRole" Loading
module/Oscar/config/routes.yml +7 −0 Original line number Diff line number Diff line Loading @@ -936,6 +936,13 @@ contract: defaults: action: timesheet traces: type: segment options: route: /traces/:id defaults: action: traces personaccess: type: segment options: Loading
module/Oscar/src/Oscar/Controller/ProjectGrantController.php +10 −0 Original line number Diff line number Diff line Loading @@ -2189,6 +2189,16 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif ]; } public function tracesAction(): JsonModel { $output = []; $this->getOscarUserContextService()->check(Privileges::MAINTENANCE_MENU_ADMIN); $output['traces'] = $this->getActivityLogService()->activityActivities($this->params()->fromRoute('id')) ->getQuery() ->getArrayResult(); return $this->jsonOutput($output); } public function personsAccessDeepAction() { $activityId = $this->params()->fromRoute('id'); Loading
module/Oscar/src/Oscar/Controller/WorkPackageController.php +2 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,8 @@ class WorkPackageController extends AbstractOscarController $this->getEntityManager()->flush(); return $this->getResponseOk(); } catch( \Exception $e ){ return $this->getResponseInternalError('Impossible de supprimer le déclarant.'); $this->getLoggerService()->error("Impossible le déclarant : " . $e->getMessage()); return $this->getResponseInternalError('Impossible de modifier le déclarant.'); } } else { Loading
module/Oscar/src/Oscar/Service/ProjectGrantService.php +103 −2 Original line number Diff line number Diff line Loading @@ -1474,6 +1474,14 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi 'milestones/activity', ['idactivity' => $activity->getId()] ); if ($oscarUserContext->hasPrivileges(\Oscar\Provider\Privileges::ACTIVITY_NOTIFICATIONS_SHOW, $activity)) { $datas['milestones']['url_notifications'] = $urlPlugin->fromRoute( 'contract/notifications', ['id' => $activity->getId()] ); } } // --- Lot de travail Loading @@ -1494,19 +1502,89 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi $datas['timesheets'] = [ 'readable' => false, 'editable' => false, 'enabled' => false, "declarers" => [], "validators" => [ "prj" => [], "sci" => [], "adm" => [], ], 'datas' => [] ]; if ($oscarUserContext->hasPrivileges(Privileges::ACTIVITY_PAYMENT_SHOW, $activity)) { if ($oscarUserContext->hasPrivileges(Privileges::ACTIVITY_TIMESHEET_VIEW, $activity)) { $datas['timesheets']['readable'] = true; if( !$activity->getAcronym() ){ $datas['timesheets']['enabled'] = false; $datas['timesheets']['enabled_details'] = "L'activité doit appartenir à un projet pour activer les feuilles de temps"; } else { $datas['timesheets']['enabled'] = true; } // écran "bilan" $datas['timesheets']['url_global'] = $urlPlugin->fromRoute( 'contract/timesheet', ['id' => $activity->getId()] ); $datas['timesheets']['url_synthesis'] = $urlPlugin->fromRoute( 'timesheet/synthesis', ['id' => $activity->getId()] ) . '?activity_id=' . $activity->getId(); // Récupération des déclarants foreach ($activity->getPersonsDeep() as $personActivity) { /** @var Person $person */ $person = $personActivity->getPerson(); if( $activity->hasDeclarant($person) ){ $datas['timesheets']['declarers'][] = [ 'label' => $person->getDisplayName(), 'hasDeclaration' => $person->hasDeclarationIn($activity), 'url_details' => $urlPlugin->fromRoute('timesheet/resume').'?person_id=' . $person->getId(), ]; } } // --- Partenaires de l'activité // Récupération des validateurs foreach ($activity->getValidatorsPrj() as $validator) { $datas['timesheets']['validators']['prj'][] = $validator->toJson(); } foreach ($activity->getValidatorsSci() as $validator) { $datas['timesheets']['validators']['sci'][] = $validator->toJson(); } foreach ($activity->getValidatorsAdm() as $validator) { $datas['timesheets']['validators']['adm'][] = $validator->toJson(); } } // --- DEPENSES $datas['spents'] = [ 'readable' => false, 'editable' => false, 'url' => null ]; if ($oscarUserContext->hasPrivileges(Privileges::DEPENSE_SHOW, $activity)) { $datas['spents']['readable'] = true; $datas['spents']['url'] = $urlPlugin->fromRoute( 'contract/spent-synthesis', ['id' => $activity->getId()] ); if ($oscarUserContext->hasPrivileges(Privileges::DEPENSE_DETAILS, $activity)) { $datas['spents']['url_details'] = $urlPlugin->fromRoute( 'contract/list-spent', ['id' => $activity->getId()] ); } if ($oscarUserContext->hasPrivileges(Privileges::ACTIVITY_ESTIMATEDSPENT_SHOW, $activity)) { $datas['spents']['url_previsionnel'] = $urlPlugin->fromRoute( 'contract/estimated-spent', ['id' => $activity->getId()] ); } } // --- Versements de l'activité $datas['payments'] = [ 'readable' => false, 'editable' => false, Loading @@ -1514,6 +1592,29 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi ]; if ($oscarUserContext->hasPrivileges(Privileges::ACTIVITY_PAYMENT_SHOW, $activity)) { $datas['payments']['readable'] = true; $datas['payments']['editable'] = $oscarUserContext->hasPrivileges(Privileges::ACTIVITY_PAYMENT_MANAGE, $activity); $datas['payments']['url'] = $urlPlugin->fromRoute( 'activitypayment', ['idactivity' => $activity->getId()] ); } // --- Options d'administration $datas['administration'] = [ 'readable' => false, 'editable' => false ]; if ($oscarUserContext->hasPrivileges(Privileges::MAINTENANCE_MENU_ADMIN)) { $datas['administration']['url_logs'] = $urlPlugin->fromRoute( 'contract/traces', ['id' => $activity->getId()] ); } if ($oscarUserContext->hasPrivileges(Privileges::ACTIVITY_PCRU, $activity)) { $datas['administration']['readable'] = true; $datas['administration']['pcru'] = true; } Loading