Commit a9bbf1e1 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Fix warnings/erreurs/typos

parent 5a43eae5
Loading
Loading
Loading
Loading
+36 −48
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
    private $organizationService;

    /** @var ProjectGrantService */
    private $activityService;
    private ProjectGrantService $activityService;

    /** @var ActivityTypeService */
    private $activityTypeService;
@@ -117,7 +117,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
    /** @var TimesheetService */
    private $timesheetService;

    private $projectGrantApiService;
    private ProjectGrantApiService $projectGrantApiService;

    /** @var AdministrationConfigService */
    private $administrationConfigService;
@@ -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;
@@ -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'];
@@ -397,7 +391,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
                        }

                        if (count($status) == 0) {
                            $activityRequest = [];
                            $activityRequests = [];
                        }
                        else {
                            if ($spot == 'global') {
@@ -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++) {
@@ -696,6 +692,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
                            }

                            $datas['files'] = array_merge($datas['files'], $activityRequest->getFiles());
                        }

                        try {
                            $activityRequest->setLabel($datas['label'])
@@ -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
@@ -733,7 +729,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif

        return [
            'demandeur'     => $demandeur,
            'form'          => $usedFileds,
            'form'          => $usedFields,
            'organizations' => $organizations,
            'lockMessage'   => $lockMessage
        ];
@@ -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';
@@ -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();
@@ -905,8 +902,6 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
                    ['id' => $projectGrant->getId()]
                );
            } else {
//                var_dump($form->getMessages());
//                die();

            }
        }
@@ -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
@@ -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))) {