Commit 58579dfd authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Calcul auto des feuilles de route si synchro ou restau

SRC_INTERVENANT MAJ
parent 172d5fec
Loading
Loading
Loading
Loading
+11 −2
Changes for doc/Connecteurs Import/Générique/SRC_INTERVENANT.sql: 11 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -57,7 +57,13 @@ FROM (
    CASE

      -- Cas 1 : Si on est sur les mêmes fiches, alors on synchronise tout le temps
      WHEN statuts_identiques = 1 THEN 'update'
      WHEN statuts_identiques = 1 THEN CASE
        -- Si c'est un intervenant qui a été historisé et qu'une nouvelle fiche a été créée plus tard
        WHEN intervenant_histo = 1 AND nb_sources = 1 AND nb_intervenants = 2 AND nb_statuts_egaux = 2 THEN 'drop'

        -- Sinon on met à jour
        ELSE 'update'
      END


      -- Cas 2 : On ne restaure pas les locaux historisés s'il ne sont pas dans la source
@@ -97,6 +103,9 @@ FROM (
        -- Si la fiche est vide et vient du SI alors on supprime
        WHEN intervenant_local = 0 AND intervenant_donnees = 0 THEN 'drop'

        -- Si l'intervenant est historisé alors on supprime, ce sera l'autre fiche qui l'emportera
        WHEN intervenant_histo = 1 THEN 'drop'

        -- Pour le reste on met à jour tout de même
        ELSE 'update-no-statut'
      END
@@ -154,7 +163,7 @@ FROM (
        WHEN statuts_identiques = 0 AND statut_source_id <> statuts_egaux_id AND statut_intervenant_id <> statuts_egaux_id AND types_identiques = 1 THEN 'update'

        -- Autres fiches de type différent
        WHEN statuts_identiques = 0 AND statut_source_id <> statuts_egaux_id AND statut_intervenant_id <> statuts_egaux_id AND types_identiques = 1 THEN 'insert'
        WHEN statuts_identiques = 0 AND statut_source_id <> statuts_egaux_id AND statut_intervenant_id <> statuts_egaux_id AND types_identiques = 0 THEN 'insert'

        ELSE 'drop'
      END
+2 −0
Changes for module/Application/src/Application/Controller/IntervenantController.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -401,6 +401,7 @@ class IntervenantController extends AbstractController
    {
        $intervenant = $this->getEvent()->getParam('intervenant');
        $this->getProcessusImport()->execMaj('INTERVENANT', 'CODE', $intervenant->getCode());
        $this->getServiceWorkflow()->calculerTableauxBord([], $intervenant);

        return $this->redirect()->toRoute('intervenant/voir', ['intervenant' => $intervenant->getId()], ['query' => ['tab' => 'synchronisation']]);
    }
@@ -522,6 +523,7 @@ class IntervenantController extends AbstractController
        }
        $intervenant->dehistoriser();
        $this->getServiceIntervenant()->save($intervenant);
        $this->getServiceWorkflow()->calculerTableauxBord([], $intervenant);

        return $this->redirect()->toRoute('intervenant/voir', ['intervenant' => $intervenant->getId()]);
    }
+1 −1
Changes for module/Application/src/Application/View/Helper/Intervenant/IntervenantViewHelper.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ class IntervenantViewHelper extends AbstractHtmlElement

            $canRestaure = $this->getView()->isAllowed(Privileges::getResourceId(Privileges::INTERVENANT_AJOUT_STATUT));
            if ($canRestaure) {
                $msg .= "<br />" . $this->getView()->tag('a', ['href' => $this->getView()->url('intervenant/restaurer', ['intervenant' => $entity->getId()])])->html('Restaurer la fiche');
                $msg .= "<br />" . $this->getView()->tag('a', ['class' => 'no-intranavigation', 'href' => $this->getView()->url('intervenant/restaurer', ['intervenant' => $entity->getId()])])->html('Restaurer la fiche');
            }

            $html .= '<div class="alert alert-danger">' . $msg . '</div>';