Commit f0729964 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Correction pour update code intervenant lors de la pec et ren siham

parent 4286b10d
Loading
Loading
Loading
Loading
+25 −2
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Retourne l'intervenant en fonction des paramètres de route transmis :
     * - soit code:<i>CODE</i>
@@ -87,6 +88,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Retourne l'intervenant de l'année précédente
     *
@@ -108,6 +110,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function getByCode(string $code): ?Intervenant
    {
        $anneeId     = $this->getServiceContext()->getAnnee()->getId();
@@ -121,6 +124,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function getByCodeRh(string $codeRh): ?Intervenant
    {
        $anneeId     = $this->getServiceContext()->getAnnee()->getId();
@@ -134,6 +138,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     *
     * @param string $sourceCode
@@ -161,6 +166,7 @@ class IntervenantService extends AbstractEntityService
    }



    private function getBones(array $params): array
    {
        $psql = '';
@@ -186,6 +192,7 @@ class IntervenantService extends AbstractEntityService
    }



    private function bestIntervenantByBones(array $bones, ?string $code, ?int $anneeId, ?int $statutId, ?int $structureId): ?Intervenant
    {
        $count = count($bones);
@@ -223,6 +230,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function isImportable(Intervenant $intervenant): bool
    {
        $connection = $this->getEntityManager()->getConnection();
@@ -238,6 +246,7 @@ class IntervenantService extends AbstractEntityService
    }



    private function getIntervenantIdParDefaut(string $code, int $anneeId): ?int
    {
        if (!$code || !$anneeId) return null;
@@ -252,6 +261,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Permet de définit une fiche intervenant comme celle étant à consulter par défaut
     *
@@ -284,6 +294,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Permet de savoir si oui ou non cette fiche intervenant est définie comme étant celle par défaut.
     *
@@ -297,6 +308,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Retourne les identifiants des données concernés
     *
@@ -326,6 +338,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * @param $intervenant Intervenant
     *
@@ -342,6 +355,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Retourne l'alias d'entité courante
     *
@@ -353,6 +367,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function finderByMiseEnPaiement(Structure $structure = null, Periode $periode = null, QueryBuilder $qb = null, $alias = null)
    {
        $serviceMIS = $this->getServiceMiseEnPaiementIntervenantStructure();
@@ -373,6 +388,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * @return Intervenant
     */
@@ -390,6 +406,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Sauvegarde une entité
     *
@@ -411,6 +428,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     *
     * @param QueryBuilder|null $qb
@@ -426,6 +444,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Filtre par le type d'intervenant
     *
@@ -447,6 +466,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Supprime (historise par défaut) le service spécifié.
     *
@@ -510,6 +530,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function getSystemeInformationUrl(Intervenant $intervenant): ?string
    {
        if (!$intervenant->getSource()->getImportable()) return null;
@@ -529,6 +550,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * @param string    $nom
     * @param string    $prenom
@@ -580,6 +602,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function updateExportDate(Intervenant $intervenant): Intervenant
    {
        $date = new \DateTime();
@@ -590,17 +613,17 @@ class IntervenantService extends AbstractEntityService
        return $intervenant;
    }



    public function updateCode(Intervenant $intervenant, $code): Intervenant
    {
        if (!empty($code)) {
            if (empty($intervenant->getExportDate())) {
            $intervenant->setCode($code);
            $this->getEntityManager()->persist($intervenant);
            $this->getEntityManager()->flush();
            //On recalcul les tablaeux de bords de l'intervenant
            $this->getServiceWorkflow()->calculerTableauxBord([], $intervenant);
        }
        }

        return $intervenant;
    }