Commit 506a4507 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Amélioration export RH

parent 68e7d4e4
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -212,6 +212,9 @@ class SihamConnecteur implements ConnecteurRhInterface
            /*CONTRAT*/
            $config = $this->siham->getConfig();
            if (array_key_exists('contrat', $this->siham->getConfig())) {
                //On récupere le gradeTG pour le contrat
                $codeStatut = $datas['connecteurForm']['statut'];
                $gradeTG    = $this->recupererGradeTG($codeStatut);
                if ($this->siham->getConfig()['contrat']['active']) {
                    $contrat[] =
                        ['dateDebutContrat'  => $dateEffet,
@@ -221,6 +224,9 @@ class SihamConnecteur implements ConnecteurRhInterface
                         'typeLienJuridique' => $this->siham->getConfig()['contrat']['parameters']['typeLienJuridique'],
                         'modeRemuneration'  => $this->siham->getConfig()['contrat']['parameters']['modeRemuneration'],
                         'modeDeGestion'     => $this->siham->getConfig()['contrat']['parameters']['modeDeGestion'],
                         'gradeTG'           => $gradeTG,
                         'tauxHoraires'      => '',
                         'nbHeuresContrat'   => '',
                         'temoinValidite'    => $this->siham->getConfig()['contrat']['parameters']['temoinValidite'],
                        ];
                }
@@ -389,6 +395,19 @@ class SihamConnecteur implements ConnecteurRhInterface



    public function recupererGradeTG (string $codeStatut): ?string
    {
        $gradeTG = '';

        if (array_key_exists('gradeTG', $this->siham->getConfig()['contrat']['parameters'])) {
            $gradeTG = (array_key_exists($codeStatut, $this->siham->getConfig()['contrat']['parameters']['gradeTG'])) ? $this->siham->getConfig()['contrat']['parameters']['gradeTG'][$codeStatut] : '';
        }

        return $gradeTG;
    }



    public static function cleanDatas ($str, $strict = false, $encoding = 'UTF-8')
    {
        $from = 'ÀÁÂÃÄÅÇÐÈÉÊËÌÍÎÏÒÓÔÕÖØÙÚÛÜŸÑàáâãäåçðèéêëìíîïòóôõöøùúûüÿñ()…,<> /?€%!":’\'+.';
@@ -453,7 +472,12 @@ class SihamConnecteur implements ConnecteurRhInterface
            /*CONTRAT*/
            $config  = $this->siham->getConfig();
            $contrat = [];

            if (array_key_exists('contrat', $this->siham->getConfig())) {
                //On récupere le gradeTG pour le contrat

                $codeStatut = $datas['connecteurForm']['statut'];
                $gradeTG    = $this->recupererGradeTG($codeStatut);

                if ($this->siham->getConfig()['contrat']['active']) {
                    $contrat[] =
@@ -464,6 +488,9 @@ class SihamConnecteur implements ConnecteurRhInterface
                         'typeLienJuridique' => $this->siham->getConfig()['contrat']['parameters']['typeLienJuridique'],
                         'modeRemuneration'  => $this->siham->getConfig()['contrat']['parameters']['modeRemuneration'],
                         'modeDeGestion'     => $this->siham->getConfig()['contrat']['parameters']['modeDeGestion'],
                         'gradeTG'           => $gradeTG,
                         'tauxHoraires'      => '43.5',
                         'nbHeuresContrat'   => '20',
                         'temoinValidite'    => $this->siham->getConfig()['contrat']['parameters']['temoinValidite'],

                        ];
+5 −2
Original line number Diff line number Diff line
@@ -6,11 +6,11 @@ namespace ExportRh\Controller;
use Application\Controller\AbstractController;
use Application\Entity\Db\WfEtape;
use Application\Service\Traits\ContextServiceAwareTrait;
use Dossier\Service\Traits\DossierServiceAwareTrait;
use Application\Service\Traits\IntervenantServiceAwareTrait;
use Application\Service\Traits\ParametresServiceAwareTrait;
use Application\Service\Traits\WfEtapeServiceAwareTrait;
use Application\Service\Traits\WorkflowServiceAwareTrait;
use Dossier\Service\Traits\DossierServiceAwareTrait;
use ExportRh\Form\Traits\ExportRhFormAwareTrait;
use ExportRh\Service\ExportRhService;
use ExportRh\Service\ExportRhServiceAwareTrait;
@@ -93,7 +93,7 @@ class ExportRhController extends AbstractController
                $posts  = $this->getRequest()->getPost();
                $result = $this->exportRhService->priseEnChargeIntrervenantRh($intervenant, $posts);
                if ($result !== false) {
                    // $this->exportRhService->cloreDossier($intervenant);
                    $this->exportRhService->cloreDossier($intervenant);
                    $this->flashMessenger()->addSuccessMessage('La prise en charge s\'est déroulée avec succés et le dossier a été cloturé');
                    $this->getServiceIntervenant()->updateExportDate($intervenant);
                    //On met à jour le code intervenant si l'option est activée
@@ -195,6 +195,8 @@ class ExportRhController extends AbstractController
            $nameConnecteur = $this->exportRhService->getConnecteurName();
            $form           = $this->getFormExportRh($intervenant);
            $form->bind($intervenantDossier);
            //On essaie de mettre l'affectation par défaut en comparant les libellés cours des structures (OSE/SIHAM)
            $form->setAffectationDefault($intervenant);
        } catch (\Exception $e) {
            $this->flashMessenger()->addErrorMessage($e->getMessage());
        }
@@ -290,4 +292,5 @@ class ExportRhController extends AbstractController

        return $this->exporterAction();
    }

}
+29 −4
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace ExportRh\Form;

use Application\Entity\Db\Intervenant;
use Application\Form\AbstractForm;
use ExportRh\Form\Fieldset\GeneriqueFieldset;
use ExportRh\Hydrator\ExportRhHydrator;
@@ -12,11 +13,14 @@ class ExportRhForm extends AbstractForm

    protected $fieldsetConnecteur;

    protected $config;



    public function __construct (?Fieldset $fieldsetConnecteur)
    {
        $this->fieldsetConnecteur = $fieldsetConnecteur;

        parent::__construct('ExportRhForm', []);
    }

@@ -47,6 +51,27 @@ class ExportRhForm extends AbstractForm



    public function setAffectationDefault (Intervenant $intervenant): self
    {

        $intervenantAffectation = $intervenant->getStructure()->getLibelleCourt();
        //On récupére les libellés de composante dispo dans le form
        $elementAffectation = $this->get('connecteurForm')->get('affectation');
        $listeComposantes   = $this->get('connecteurForm')->get('affectation')->getValueOptions();
        foreach ($listeComposantes as $code => $composante) {
            //On prend que le libelle court ed SIHAM pour le comparer au libelle court de OSE
            $libelleAffectation = explode(' ', $composante, 2);
            $libelleCourt       = $libelleAffectation[1];
            if (strtolower($intervenantAffectation) == strtolower($libelleCourt)) {
                $elementAffectation->setValue($code);
            }
        }

        return $this;
    }



    /**
     * Should return an array specification compatible with
     * {@link Laminas\InputFilter\Factory::createInputFilter()}.