Loading module/Oscar/src/Oscar/Controller/ProjectGrantController.php +36 −48 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif private $organizationService; /** @var ProjectGrantService */ private $activityService; private ProjectGrantService $activityService; /** @var ActivityTypeService */ private $activityTypeService; Loading @@ -117,7 +117,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif /** @var TimesheetService */ private $timesheetService; private $projectGrantApiService; private ProjectGrantApiService $projectGrantApiService; /** @var AdministrationConfigService */ private $administrationConfigService; Loading @@ -133,18 +133,12 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } /** * @return ProjectGrantApiService */ public function getProjectGrantApiService() public function getProjectGrantApiService(): ProjectGrantApiService { return $this->projectGrantApiService; } /** * @param mixed $projectGrantApiService */ public function setProjectGrantApiService($projectGrantApiService): self public function setProjectGrantApiService(ProjectGrantApiService $projectGrantApiService): self { $this->projectGrantApiService = $projectGrantApiService; return $this; Loading Loading @@ -365,7 +359,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $demande = $activityRequestService->getActivityRequest($this->params()->fromQuery('id')); $fileInfo = $demande->getFileInfosByFile($dl); $filepath = $this->getOscarConfigurationService()->getCOnfiguration( $filepath = $this->getOscarConfigurationService()->getConfiguration( 'paths.document_request' ) . '/' . $fileInfo['file']; $filename = $fileInfo['name']; Loading Loading @@ -397,7 +391,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } if (count($status) == 0) { $activityRequest = []; $activityRequests = []; } else { if ($spot == 'global') { Loading Loading @@ -669,7 +663,9 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $datas['dateEnd'] = null; } if ($_FILES) { $datas['files'] = $activityRequest->getFiles(); if (!empty($_FILES['files']['tmp_name'])) { $datas['files'] = []; $nbr = count($_FILES['files']['tmp_name']); for ($i = 0; $i < $nbr; $i++) { Loading @@ -696,6 +692,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } $datas['files'] = array_merge($datas['files'], $activityRequest->getFiles()); } try { $activityRequest->setLabel($datas['label']) Loading @@ -719,13 +716,12 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif throw new OscarException("Impossible d'enregistrer le demande : " . $e->getMessage()); } } } } catch (OscarException $e) { return $this->getResponseInternalError($e->getMessage()); } } $usedFileds = [ $usedFields = [ 'label' => true, 'description' => true, 'documents' => true Loading @@ -733,7 +729,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif return [ 'demandeur' => $demandeur, 'form' => $usedFileds, 'form' => $usedFields, 'organizations' => $organizations, 'lockMessage' => $lockMessage ]; Loading Loading @@ -832,7 +828,9 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } } } catch (Exception $e) { $this->getLoggerService()->warning("Le template $doc ne contient pas de variable $key"); $this->getLoggerService()->warning( sprintf("Le template %s ne contient pas les variables attendues: %s", $doc, $e->getMessage()) ); } $filename = 'oscar-' . $activity->getOscarNum() . '-' . $doc . '.docx'; Loading @@ -857,7 +855,6 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif */ public function editAction() { $id = $this->params()->fromRoute('id'); $numerotationKeys = $this->getEditableConfKey('numerotation', []); $numerotationEditable = $this->getOscarConfigurationService()->getNumerotationEditable(); Loading Loading @@ -905,8 +902,6 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif ['id' => $projectGrant->getId()] ); } else { // var_dump($form->getMessages()); // die(); } } Loading Loading @@ -965,11 +960,6 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif { $activity = $this->getActivityFromRoute(); // Contrôle des droits if (!$this->getOscarUserContextService()->hasPrivileges(Privileges::PROJECT_CREATE)) { if (!$this->getOscarUserContextService()->hasPrivilegeInOrganizations(Privileges::PROJECT_CREATE)) { } } $this->getOscarUserContextService()->checkWithorganizationDeep(Privileges::PROJECT_CREATE); // Création du projet Loading @@ -989,10 +979,8 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } /** * @param string $fieldName * @return null|Activity */ private function getActivityFromRoute($fieldName = 'id') private function getActivityFromRoute(string $fieldName = 'id'): Activity { $id = $this->params()->fromRoute($fieldName); if (!($activity = $this->getEntityManager()->getRepository(Activity::class)->find($id))) { Loading Loading
module/Oscar/src/Oscar/Controller/ProjectGrantController.php +36 −48 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif private $organizationService; /** @var ProjectGrantService */ private $activityService; private ProjectGrantService $activityService; /** @var ActivityTypeService */ private $activityTypeService; Loading @@ -117,7 +117,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif /** @var TimesheetService */ private $timesheetService; private $projectGrantApiService; private ProjectGrantApiService $projectGrantApiService; /** @var AdministrationConfigService */ private $administrationConfigService; Loading @@ -133,18 +133,12 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } /** * @return ProjectGrantApiService */ public function getProjectGrantApiService() public function getProjectGrantApiService(): ProjectGrantApiService { return $this->projectGrantApiService; } /** * @param mixed $projectGrantApiService */ public function setProjectGrantApiService($projectGrantApiService): self public function setProjectGrantApiService(ProjectGrantApiService $projectGrantApiService): self { $this->projectGrantApiService = $projectGrantApiService; return $this; Loading Loading @@ -365,7 +359,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $demande = $activityRequestService->getActivityRequest($this->params()->fromQuery('id')); $fileInfo = $demande->getFileInfosByFile($dl); $filepath = $this->getOscarConfigurationService()->getCOnfiguration( $filepath = $this->getOscarConfigurationService()->getConfiguration( 'paths.document_request' ) . '/' . $fileInfo['file']; $filename = $fileInfo['name']; Loading Loading @@ -397,7 +391,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } if (count($status) == 0) { $activityRequest = []; $activityRequests = []; } else { if ($spot == 'global') { Loading Loading @@ -669,7 +663,9 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $datas['dateEnd'] = null; } if ($_FILES) { $datas['files'] = $activityRequest->getFiles(); if (!empty($_FILES['files']['tmp_name'])) { $datas['files'] = []; $nbr = count($_FILES['files']['tmp_name']); for ($i = 0; $i < $nbr; $i++) { Loading @@ -696,6 +692,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } $datas['files'] = array_merge($datas['files'], $activityRequest->getFiles()); } try { $activityRequest->setLabel($datas['label']) Loading @@ -719,13 +716,12 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif throw new OscarException("Impossible d'enregistrer le demande : " . $e->getMessage()); } } } } catch (OscarException $e) { return $this->getResponseInternalError($e->getMessage()); } } $usedFileds = [ $usedFields = [ 'label' => true, 'description' => true, 'documents' => true Loading @@ -733,7 +729,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif return [ 'demandeur' => $demandeur, 'form' => $usedFileds, 'form' => $usedFields, 'organizations' => $organizations, 'lockMessage' => $lockMessage ]; Loading Loading @@ -832,7 +828,9 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } } } catch (Exception $e) { $this->getLoggerService()->warning("Le template $doc ne contient pas de variable $key"); $this->getLoggerService()->warning( sprintf("Le template %s ne contient pas les variables attendues: %s", $doc, $e->getMessage()) ); } $filename = 'oscar-' . $activity->getOscarNum() . '-' . $doc . '.docx'; Loading @@ -857,7 +855,6 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif */ public function editAction() { $id = $this->params()->fromRoute('id'); $numerotationKeys = $this->getEditableConfKey('numerotation', []); $numerotationEditable = $this->getOscarConfigurationService()->getNumerotationEditable(); Loading Loading @@ -905,8 +902,6 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif ['id' => $projectGrant->getId()] ); } else { // var_dump($form->getMessages()); // die(); } } Loading Loading @@ -965,11 +960,6 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif { $activity = $this->getActivityFromRoute(); // Contrôle des droits if (!$this->getOscarUserContextService()->hasPrivileges(Privileges::PROJECT_CREATE)) { if (!$this->getOscarUserContextService()->hasPrivilegeInOrganizations(Privileges::PROJECT_CREATE)) { } } $this->getOscarUserContextService()->checkWithorganizationDeep(Privileges::PROJECT_CREATE); // Création du projet Loading @@ -989,10 +979,8 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } /** * @param string $fieldName * @return null|Activity */ private function getActivityFromRoute($fieldName = 'id') private function getActivityFromRoute(string $fieldName = 'id'): Activity { $id = $this->params()->fromRoute($fieldName); if (!($activity = $this->getEntityManager()->getRepository(Activity::class)->find($id))) { Loading