Commit 5a388c7d authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Modification export service avec intégration des tags et motifs de non...

Modification export service avec intégration des tags et motifs de non paiement pour l'enseignement et le réferentiel.
parent a5ba0fe4
Loading
Loading
Loading
Loading
+170 −57
Changes for data/ddl/view/V_EXPORT_SERVICE.sql: 170 added lines, 57 removed lines.
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_EXPORT_SERVICE AS
WITH t AS ( SELECT
  'vh_' || vh.id                    id,
WITH t AS (
--Volumes horaire sans tag et sans motif de non paiement
    SELECT 'vh_' || vh.id                id,
           s.id                          service_id,
  null                              service_referentiel_id,
           NULL                          service_referentiel_id,
           s.intervenant_id              intervenant_id,
           vh.type_volume_horaire_id     type_volume_horaire_id,
           fr.etat_volume_horaire_id     etat_volume_horaire_id,
@@ -14,13 +14,15 @@ WITH t AS ( SELECT
           vh.type_intervention_id       type_intervention_id,
           NULL                          fonction_referentiel_id,
           NULL                          motif_non_paiement_id,
           NULL                          tag_id,

           s.description                 service_description,

           vh.heures                     heures,
           0                             heures_ref,
           0                             heures_non_payees,
  null                              motif_non_paiement,
           NULL                          motif_non_paiement,
           NULL                          tag,
           frvh.service_fi               service_fi,
           frvh.service_fa               service_fa,
           frvh.service_fc               service_fc,
@@ -34,18 +36,120 @@ WITH t AS ( SELECT
           fr.solde                      solde,
           NULL                          service_ref_formation,
           NULL                          commentaires
FROM
  formule_resultat_vh                frvh
    FROM formule_resultat_vh frvh
             JOIN formule_resultat fr ON fr.id = frvh.formule_resultat_id
  JOIN volume_horaire                  vh ON vh.id = frvh.volume_horaire_id AND vh.motif_non_paiement_id IS NULL AND vh.histo_destruction IS NULL
  JOIN service                          s ON s.id = vh.service_id AND s.intervenant_id = fr.intervenant_id AND s.histo_destruction IS NULL
             JOIN volume_horaire vh
                  ON vh.id = frvh.volume_horaire_id AND vh.motif_non_paiement_id IS NULL AND vh.tag_id IS NULL AND
                     vh.histo_destruction IS NULL
             JOIN service s
                  ON s.id = vh.service_id AND s.intervenant_id = fr.intervenant_id AND s.histo_destruction IS NULL
    WHERE s.intervenant_id = 656691

    UNION ALL
----Volumes horaire sans tag et avec motif de non paiement
    SELECT 'vh_' || vh.id             id,
           s.id                       service_id,
           NULL                       service_referentiel_id,
           s.intervenant_id           intervenant_id,
           vh.type_volume_horaire_id  type_volume_horaire_id,
           vhe.etat_volume_horaire_id etat_volume_horaire_id,
           s.element_pedagogique_id   element_pedagogique_id,
           s.etablissement_id         etablissement_id,
           NULL                       structure_aff_id,
           NULL                       structure_ens_id,
           vh.periode_id              periode_id,
           vh.type_intervention_id    type_intervention_id,
           NULL                       fonction_referentiel_id,
           mnp.id                     motif_non_paiement_id,
           NULL                       tag_id,

           s.description              service_description,

           vh.heures                  heures,
           0                          heures_ref,
           1                          heures_non_payees,
           mnp.libelle_court          motif_non_paiement,
           NULL                       tag,
           0                          service_fi,
           0                          service_fa,
           0                          service_fc,
           0                          service_referentiel,
           0                          heures_compl_fi,
           0                          heures_compl_fa,
           0                          heures_compl_fc,
           0                          heures_compl_fc_majorees,
           0                          heures_compl_referentiel,
           0                          total,
           COALESCE(fr.solde, 0)      solde,
           NULL                       service_ref_formation,
           NULL                       commentaires
    FROM volume_horaire vh
             JOIN service s ON s.id = vh.service_id
             JOIN v_vol_horaire_etat_multi vhe ON vhe.volume_horaire_id = vh.id
             JOIN motif_non_paiement mnp ON mnp.id = vh.motif_non_paiement_id
             LEFT JOIN formule_resultat fr ON fr.intervenant_id = s.intervenant_id AND
                                              fr.type_volume_horaire_id = vh.type_volume_horaire_id AND
                                              fr.etat_volume_horaire_id = vhe.etat_volume_horaire_id
    WHERE vh.histo_destruction IS NULL
      AND s.histo_destruction IS NULL
      AND vh.tag_id IS NULL


    UNION ALL
    --Volumes horaire avec tag et sans motif de non paiement

SELECT
  'vh_' || vh.id                    id,
    SELECT 'vh_' || vh.id             id,
           s.id                       service_id,
  null                              service_referentiel_id,
           NULL                       service_referentiel_id,
           s.intervenant_id           intervenant_id,
           vh.type_volume_horaire_id  type_volume_horaire_id,
           vhe.etat_volume_horaire_id etat_volume_horaire_id,
           s.element_pedagogique_id   element_pedagogique_id,
           s.etablissement_id         etablissement_id,
           NULL                       structure_aff_id,
           NULL                       structure_ens_id,
           vh.periode_id              periode_id,
           vh.type_intervention_id    type_intervention_id,
           NULL                       fonction_referentiel_id,
           NULL                       motif_non_paiement_id,
           tag.id                     tag_id,

           s.description              service_description,

           vh.heures                  heures,
           0                          heures_ref,
           1                          heures_non_payees,
           NULL                       motif_non_paiement,
           tag.libelle_court          tag,
           0                          service_fi,
           0                          service_fa,
           0                          service_fc,
           0                          service_referentiel,
           0                          heures_compl_fi,
           0                          heures_compl_fa,
           0                          heures_compl_fc,
           0                          heures_compl_fc_majorees,
           0                          heures_compl_referentiel,
           0                          total,
           COALESCE(fr.solde, 0)      solde,
           NULL                       service_ref_formation,
           NULL                       commentaires
    FROM volume_horaire vh
             JOIN service s ON s.id = vh.service_id
             JOIN v_vol_horaire_etat_multi vhe ON vhe.volume_horaire_id = vh.id
             JOIN tag ON tag.id = vh.tag_id
             LEFT JOIN formule_resultat fr ON fr.intervenant_id = s.intervenant_id AND
                                              fr.type_volume_horaire_id = vh.type_volume_horaire_id AND
                                              fr.etat_volume_horaire_id = vhe.etat_volume_horaire_id
    WHERE vh.histo_destruction IS NULL
      AND s.histo_destruction IS NULL
      AND vh.motif_non_paiement_id IS NULL

    UNION ALL

    SELECT 'vh_' || vh.id             id,
           s.id                       service_id,
           NULL                       service_referentiel_id,
           s.intervenant_id           intervenant_id,
           vh.type_volume_horaire_id  type_volume_horaire_id,
           vhe.etat_volume_horaire_id etat_volume_horaire_id,
@@ -57,6 +161,7 @@ SELECT
           vh.type_intervention_id    type_intervention_id,
           NULL                       fonction_referentiel_id,
           mnp.id                     motif_non_paiement_id,
           tag.id                     tag_id,

           s.description              service_description,

@@ -64,6 +169,7 @@ SELECT
           0                          heures_ref,
           1                          heures_non_payees,
           mnp.libelle_court          motif_non_paiement,
           tag.libelle_court          tag,
           0                          service_fi,
           0                          service_fa,
           0                          service_fc,
@@ -77,40 +183,44 @@ SELECT
           COALESCE(fr.solde, 0)      solde,
           NULL                       service_ref_formation,
           NULL                       commentaires
FROM
  volume_horaire                  vh
    FROM volume_horaire vh
             JOIN service s ON s.id = vh.service_id
             JOIN v_vol_horaire_etat_multi vhe ON vhe.volume_horaire_id = vh.id
             JOIN tag ON tag.id = vh.tag_id
             JOIN motif_non_paiement mnp ON mnp.id = vh.motif_non_paiement_id
  LEFT JOIN formule_resultat      fr ON fr.intervenant_id = s.intervenant_id AND fr.type_volume_horaire_id = vh.type_volume_horaire_id AND fr.etat_volume_horaire_id = vhe.etat_volume_horaire_id
WHERE
  vh.histo_destruction IS NULL
             LEFT JOIN formule_resultat fr ON fr.intervenant_id = s.intervenant_id AND
                                              fr.type_volume_horaire_id = vh.type_volume_horaire_id AND
                                              fr.etat_volume_horaire_id = vhe.etat_volume_horaire_id
    WHERE vh.histo_destruction IS NULL
      AND s.histo_destruction IS NULL


    UNION ALL
--Volumes horaire service référentiel 

SELECT
  'vh_ref_' || vhr.id               id,
  null                              service_id,
    SELECT 'vh_ref_' || vhr.id             id,
           NULL                            service_id,
           sr.id                           service_referentiel_id,
           sr.intervenant_id               intervenant_id,
           fr.type_volume_horaire_id       type_volume_horaire_id,
           fr.etat_volume_horaire_id       etat_volume_horaire_id,
           NULL                            element_pedagogique_id,
  OSE_PARAMETRE.GET_ETABLISSEMENT   etablissement_id,
           ose_parametre.get_etablissement etablissement_id,
           NULL                            structure_aff_id,
           sr.structure_id                 structure_ens_id,
           NULL                            periode_id,
           NULL                            type_intervention_id,
           sr.fonction_id                  fonction_referentiel_id,
  NULL                              motif_non_paiement_id,
           mnp.id                          motif_non_paiement_id,
           t.id                            tag_id,

           NULL                            service_description,

           0                               heures,
           vhr.heures                      heures_ref,
           0                               heures_non_payees,
  null                              motif_non_paiement,
           mnp.libelle_court               motif_non_paiement,
           t.libelle_court                 tag,
           0                               service_fi,
           0                               service_fa,
           0                               service_fc,
@@ -124,36 +234,40 @@ SELECT
           fr.solde                        solde,
           sr.formation                    service_ref_formation,
           sr.commentaires                 commentaires
FROM
  formule_resultat_vh_ref       frvr
    FROM formule_resultat_vh_ref frvr
             JOIN formule_resultat fr ON fr.id = frvr.formule_resultat_id
             JOIN volume_horaire_ref vhr ON vhr.id = frvr.volume_horaire_ref_id AND vhr.histo_destruction IS NULL
  JOIN service_referentiel        sr ON sr.id = vhr.service_referentiel_id AND sr.intervenant_id = fr.intervenant_id AND sr.histo_destruction IS NULL
             JOIN service_referentiel sr
                  ON sr.id = vhr.service_referentiel_id AND sr.intervenant_id = fr.intervenant_id AND
                     sr.histo_destruction IS NULL
             LEFT JOIN motif_non_paiement mnp ON mnp.id = sr.motif_non_paiement_id
             LEFT JOIN tag t ON t.id = sr.tag_id

    UNION ALL

SELECT
  'vh_0_' || i.id                   id,
    SELECT 'vh_0_' || i.id                                              id,
           NULL                                                         service_id,
           NULL                                                         service_referentiel_id,
           i.id                                                         intervenant_id,
           tvh.id                                                       type_volume_horaire_id,
           evh.id                                                       etat_volume_horaire_id,
           NULL                                                         element_pedagogique_id,
  OSE_PARAMETRE.GET_ETABLISSEMENT   etablissement_id,
           ose_parametre.get_etablissement                              etablissement_id,
           NULL                                                         structure_aff_id,
           NULL                                                         structure_ens_id,
           NULL                                                         periode_id,
           NULL                                                         type_intervention_id,
           NULL                                                         fonction_referentiel_id,
           NULL                                                         motif_non_paiement_id,
           NULL                                                         tag_id,

           NULL                                                         service_description,

           0                                                            heures,
           0                                                            heures_ref,
           0                                                            heures_non_payees,
  null                              motif_non_paiement,
           NULL                                                         motif_non_paiement,
           NULL                                                         tag,
           0                                                            service_fi,
           0                                                            service_fa,
           0                                                            service_fc,
@@ -167,38 +281,28 @@ SELECT
           si.service_statutaire + SUM(msd.heures * mms.multiplicateur) solde,
           NULL                                                         service_ref_formation,
           NULL                                                         commentaires
FROM
  intervenant i
    FROM intervenant i
             JOIN statut si ON si.id = i.statut_id
             JOIN etat_volume_horaire evh ON evh.code IN ('saisi', 'valide')
             JOIN type_volume_horaire tvh ON tvh.code IN ('PREVU', 'REALISE')
             JOIN modification_service_du msd ON msd.intervenant_id = i.id AND msd.histo_destruction IS NULL
             JOIN motif_modification_service mms ON mms.id = msd.motif_id
  LEFT JOIN formule_resultat fr ON fr.intervenant_id = i.id AND fr.type_volume_horaire_id = tvh.id AND fr.etat_volume_horaire_id = evh.id
WHERE
  i.histo_destruction IS NULL
             LEFT JOIN formule_resultat fr ON fr.intervenant_id = i.id AND fr.type_volume_horaire_id = tvh.id AND
                                              fr.etat_volume_horaire_id = evh.id
    WHERE i.histo_destruction IS NULL
      AND COALESCE(fr.total, 0) = 0
      AND msd.heures <> 0
GROUP BY
  i.id, si.service_statutaire, evh.id, tvh.id

), ponds AS (
SELECT
  ep.id                                          element_pedagogique_id,
    GROUP BY i.id, si.service_statutaire, evh.id, tvh.id),
     ponds AS (SELECT ep.id                                         element_pedagogique_id,
                      MAX(COALESCE(m.ponderation_service_du, 1))    ponderation_service_du,
                      MAX(COALESCE(m.ponderation_service_compl, 1)) ponderation_service_compl
FROM
            element_pedagogique ep
               FROM element_pedagogique ep
                        LEFT JOIN element_modulateur em ON em.element_id = ep.id
                   AND em.histo_destruction IS NULL
                        LEFT JOIN modulateur m ON m.id = em.modulateur_id
WHERE
  ep.histo_destruction IS NULL
GROUP BY
  ep.id
)
SELECT
  t.id                              id,
               WHERE ep.histo_destruction IS NULL
               GROUP BY ep.id)
SELECT t.id                                                 id,
       t.service_id                                         service_id,
       t.service_referentiel_id                             service_referentiel_id,
       i.id                                                 intervenant_id,
@@ -223,7 +327,7 @@ SELECT
       di.id                                                intervenant_discipline_id,
       de.id                                                element_discipline_id,
       t.motif_non_paiement_id                              motif_non_paiement_id,

       t.tag_id                                             tag_id,
       tvh.libelle || ' ' || evh.libelle                    type_etat,
       his.histo_modification                               service_date_modification,

@@ -258,13 +362,16 @@ SELECT
       t.service_ref_formation                              service_ref_formation,
       t.commentaires                                       commentaires,
       p.libelle_court                                      periode_libelle,
  CASE WHEN ponds.ponderation_service_compl = 1 THEN NULL ELSE ponds.ponderation_service_compl END element_ponderation_compl,
       CASE
           WHEN ponds.ponderation_service_compl = 1 THEN NULL
           ELSE ponds.ponderation_service_compl END         element_ponderation_compl,
       src.libelle                                          element_source_libelle,

       t.heures                                             heures,
       t.heures_ref                                         heures_ref,
       t.heures_non_payees                                  heures_non_payees,
       t.motif_non_paiement                                 motif_non_paiement,
       t.tag                                                tag,
       si.service_statutaire                                service_statutaire,
       fi.heures_service_modifie                            service_du_modifie,
       t.service_fi                                         service_fi,
@@ -280,21 +387,21 @@ SELECT
       t.solde                                              solde,
       v.histo_modification                                 date_cloture_realise

FROM
  t
FROM t
         JOIN intervenant i ON i.id = t.intervenant_id AND i.histo_destruction IS NULL
         JOIN statut si ON si.id = i.statut_id
         JOIN type_intervenant ti ON ti.id = si.type_intervenant_id
         JOIN etablissement etab ON etab.id = t.etablissement_id
         JOIN type_volume_horaire tvh ON tvh.id = t.type_volume_horaire_id
         JOIN etat_volume_horaire evh ON evh.id = t.etat_volume_horaire_id
  LEFT JOIN histo_intervenant_service   his ON his.intervenant_id = i.id AND his.type_volume_horaire_id = tvh.id AND his.referentiel = 0
         LEFT JOIN histo_intervenant_service his
                   ON his.intervenant_id = i.id AND his.type_volume_horaire_id = tvh.id AND his.referentiel = 0
         LEFT JOIN grade g ON g.id = i.grade_id
         LEFT JOIN discipline di ON di.id = i.discipline_id
         LEFT JOIN structure saff ON saff.id = i.structure_id AND ti.code = 'P'
         LEFT JOIN element_pedagogique ep ON ep.id = t.element_pedagogique_id
         LEFT JOIN discipline de ON de.id = ep.discipline_id
  LEFT JOIN structure                  sens ON sens.id  = NVL(t.structure_ens_id, ep.structure_id)
         LEFT JOIN structure sens ON sens.id = nvl(t.structure_ens_id, ep.structure_id)
         LEFT JOIN periode p ON p.id = t.periode_id
         LEFT JOIN source src ON src.id = ep.source_id OR (ep.source_id IS NULL AND src.code = 'OSE')
         LEFT JOIN etape etp ON etp.id = ep.etape_id
@@ -304,4 +411,10 @@ FROM
         LEFT JOIN ponds ponds ON ponds.element_pedagogique_id = ep.id
         LEFT JOIN fonction_referentiel fr ON fr.id = t.fonction_referentiel_id
         LEFT JOIN type_validation tv ON tvh.code = 'REALISE' AND tv.code = 'CLOTURE_REALISE'
  LEFT JOIN validation                    v ON v.intervenant_id = i.id AND v.type_validation_id = tv.id AND v.histo_destruction IS NULL
 No newline at end of file
         LEFT JOIN validation v
                   ON v.intervenant_id = i.id AND v.type_validation_id = tv.id AND v.histo_destruction IS NULL
--WHERE i.id = 656691
  
  
  
  
 No newline at end of file
+3 −1
Changes for module/Referentiel/config/module.config.php: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -198,6 +198,7 @@ return [
                Privileges::REFERENTIEL_PREVU_EDITION,
                Privileges::REFERENTIEL_REALISE_VISUALISATION,
                Privileges::REFERENTIEL_REALISE_EDITION,
                Privileges::MOTIF_NON_PAIEMENT_VISUALISATION,
            ],
            'resources'  => ['ServiceReferentiel', 'Intervenant'],
            'assertion'  => Assertion\ReferentielAssertion::class,
@@ -228,7 +229,7 @@ return [
        [
            'controller' => FonctionReferentielController::class,
            'action'     => ['saisie', 'delete'],
            'privileges' => [Privileges::REFERENTIEL_ADMIN_EDITION],
            'privileges' => [Privileges::REFERENTIEL_ADMIN_EDITION,],
        ],
        [
            'controller' => ServiceReferentielController::class,
@@ -252,6 +253,7 @@ return [
            'privileges' => [
                Privileges::REFERENTIEL_PREVU_EDITION,
                Privileges::REFERENTIEL_REALISE_EDITION,
                Privileges::MOTIF_NON_PAIEMENT_VISUALISATION,
            ],
            'assertion'  => Assertion\ReferentielAssertion::class,
        ],
+4 −7
Changes for module/Referentiel/src/Form/FonctionReferentielSaisieForm.php: 4 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Referentiel\Form;

use Application\Provider\Privilege\Privileges;
use Referentiel\Entity\Db\FonctionReferentiel;
use Application\Form\AbstractForm;
use Application\Service\Traits\DomaineFonctionnelServiceAwareTrait;
@@ -11,6 +12,7 @@ use UnicaenApp\Util;
use Laminas\Form\Element\Csrf;
use Laminas\Hydrator\HydratorInterface;
use Application\Service\Traits\ContextServiceAwareTrait;
use UnicaenAuth\Service\Traits\AuthorizeServiceAwareTrait;

/**
 * Description of FonctionReferentielSaisieForm
@@ -23,6 +25,7 @@ class FonctionReferentielSaisieForm extends AbstractForm
    use DomaineFonctionnelServiceAwareTrait;
    use StructureServiceAwareTrait;
    use ContextServiceAwareTrait;
    use AuthorizeServiceAwareTrait;


    public function init()
@@ -33,6 +36,7 @@ class FonctionReferentielSaisieForm extends AbstractForm

        $this->setAttribute('action', $this->getCurrentUrl());

        
        $this->add([
            'name'       => 'parent',
            'options'    => [
@@ -130,7 +134,6 @@ class FonctionReferentielSaisieForm extends AbstractForm
    }



    /**
     * @return FonctionReferentiel[]
     */
@@ -145,7 +148,6 @@ class FonctionReferentielSaisieForm extends AbstractForm
    }



    public function getStructures()
    {
        $role = $this->getServiceContext()->getSelectedIdentityRole();
@@ -161,7 +163,6 @@ class FonctionReferentielSaisieForm extends AbstractForm
    }



    /**
     * Should return an array specification compatible with
     * {@link Laminas\InputFilter\Factory::createInputFilter()}.
@@ -195,9 +196,6 @@ class FonctionReferentielSaisieForm extends AbstractForm
}





class FonctionReferentielHydrator implements HydratorInterface
{
    use FonctionReferentielServiceAwareTrait;
@@ -233,7 +231,6 @@ class FonctionReferentielHydrator implements HydratorInterface
    }



    /**
     * Extract values from an object
     *
+21 −1

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Changes for module/Referentiel/src/Service/ServiceReferentielService.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -262,9 +262,9 @@ class ServiceReferentielService extends AbstractEntityService
            if ($serviceAllreadyExists) {
                $result = $serviceAllreadyExists;
                if ($result->getId() != $entity->getId()) {
                    //parent::delete($entity);
                    //on remove l'ancien service puisque les volumes horaires vont être accrochés sur un service déjà existant
                    parent::delete($entity);
                }
                //on remove l'ancien service
            } else {
                $sourceOse = $this->getServiceSource()->getOse();
                if (!$entity->getSource()) {
Loading