Commit ad7dd51f authored by Florian Joriot's avatar Florian Joriot
Browse files

Merge remote-tracking branch 'origin/FJ_LL_Tbl_Contrat' into FJ_LL_Tbl_Contrat

parents e5264437 e4c80618
Loading
Loading
Loading
Loading
Loading
+1 −4
Changes for code/contrats/debugTests.php: 1 added line, 4 removed lines.
Original line number Diff line number Diff line
@@ -269,9 +269,6 @@ foreach ($contrats as $cid => $contrat) {
    if ($contrat['validation_id'] && null == $contrat['validation_histo_destruction']) {
        $php .= "$" . $cnom . "->edite         = true;\n";
    }
    if ($contrat['total_hetd']) {
        $php .= "$" . $cnom . "->totalHetd     = " . $contrat['total_hetd'] . ";\n";
    }

    $volumeHoraireVariables = [];

@@ -337,7 +334,7 @@ function volumeHoraireToPhp(array $volumesHoraire, string $vnom): string
        $php .= "$" . $vnom . "->tauxRemuMajoreId   = " . $volumesHoraire['taux_remu_majore_id'] . ";\n";
    }
    if ($volumesHoraire['date_fin_mission']) {
        $php .= "$" . $vnom . "->dateFinMission     = new \Datetime('" . substr($contrat['date_fin_mission'], 0, 10) . "');\n";
        $php .= "$" . $vnom . "->dateFinMission     = new \Datetime('" . substr($volumesHoraire['date_fin_mission'], 0, 10) . "');\n";
    }
    if ($volumesHoraire['cm']) {
        $php .= "$" . $vnom . "->cm                 = " . $volumesHoraire['cm'] . ";\n";
+5 −3
Changes for data/ddl/view/V_CONTRAT_MAIN.sql: 5 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ SELECT
    WHEN tc.edite = 0 AND tyc.code = 'CONTRAT' THEN 'Projet de contrat'
    WHEN tc.edite = 1 AND tyc.code = 'CONTRAT' THEN 'Contrat n°' || tc.contrat_id
    WHEN tc.edite = 0 AND tyc.code = 'AVENANT' THEN 'Projet d''avenant'
    WHEN tc.edite = 1 AND tyc.code = 'AVENANT' THEN 'Avenant n°' || tc.contrat_id || '.' || tc.numero_avenant
    WHEN tc.edite = 1 AND tyc.code = 'AVENANT' THEN 'Avenant n°' || cp.id || '.' || tc.numero_avenant
  END                                                                                   "titreCourt",
  tc.numero_avenant                                                                     "numeroAvenant",
  to_char(sysdate, 'dd/mm/YYYY - hh24:mi:ss')                                           "horodatage",
@@ -52,12 +52,13 @@ SELECT
  to_char(tc.date_creation, 'dd/mm/YYYY')                                               "dateCreation",
  to_char(cp.date_retour_signe, 'dd/mm/YYYY')                                           "dateContratLie",
  CASE
    WHEN tc.autre_libelle IS NOT NULL
    WHEN tc.autre_libelle IS NOT NULL AND ts.code <> 'MIS'
      THEN '*Dont type(s) intervention(s) : ' || tc.autre_libelle
  END                                                                                   "legendeAutresHeures",
  'Autres heures' || CASE WHEN tc.autre_libelle IS NOT NULL THEN '*' ELSE '' END        "enteteAutresHeures",
  'Autres heures' || CASE WHEN tc.autre_libelle IS NOT NULL AND ts.code <> 'MIS' THEN '*' ELSE '' END "enteteAutresHeures",
  tc.types_mission_libelles                                                             "typesMission",
  tc.missions_libelles                                                                  "missions",
  CASE WHEN ts.code = 'MIS' THEN tc.autre_libelle ELSE NULL END                         "missionsTypesMissions",


  -- Données concernant l'intervenant
@@ -116,6 +117,7 @@ FROM
       JOIN statut             si ON si.id = i.statut_id
       JOIN taux_remu          tr ON tr.id = tc.taux_remu_id
       JOIN taux_remu         trm ON trm.id = tc.taux_remu_majore_id
       JOIN type_service       ts ON ts.id = tc.type_service_id
  LEFT JOIN intervenant_dossier d ON d.intervenant_id = i.id AND d.histo_destruction IS NULL
  LEFT JOIN civilite          civ ON civ.id = COALESCE(d.civilite_id,i.civilite_id)
  LEFT JOIN pays                p ON p.id = COALESCE(d.pays_nationalite_id, i.pays_nationalite_id)
+4 −3
Changes for module/Contrat/src/Tbl/Process/ContratProcess.php: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -601,9 +601,10 @@ class ContratProcess implements ProcessInterface
            throw new \Exception('Le calcul du taux de rémunération ne peut être effectué sans année affecté au contrat');
        }
        if ($contrat->tauxRemuId) {
            $contrat->tauxRemuDate         = $contrat->debutValidite ?? $contrat->histoCreation ?? $contrat->annee->getDateDebut();
            $contrat->tauxRemuValeur       = $this->getServiceTauxRemu()->tauxValeur($contrat->tauxRemuId, $contrat->tauxRemuDate);
            $contrat->tauxRemuMajoreValeur = $this->getServiceTauxRemu()->tauxValeur($contrat->tauxRemuMajoreId, $contrat->tauxRemuDate);
            $dateRef = $contrat->debutValidite ?? $contrat->histoCreation ?? $contrat->annee->getDateDebut();
            $contrat->tauxRemuDate         = $this->getServiceTauxRemu()->tauxDate($contrat->tauxRemuId, $dateRef);
            $contrat->tauxRemuValeur       = $this->getServiceTauxRemu()->tauxValeur($contrat->tauxRemuId, $dateRef);
            $contrat->tauxRemuMajoreValeur = $this->getServiceTauxRemu()->tauxValeur($contrat->tauxRemuMajoreId, $dateRef);
        }
    }

+40 −0
Changes for module/Paiement/src/Service/TauxRemuService.php: 40 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -119,6 +119,46 @@ class TauxRemuService extends AbstractEntityService



    public function tauxDate(TauxRemu|int $tauxRemu, \DateTime|string $date): \DateTime
    {
        $tauxValeur = $this->getTauxMap();

        if ($tauxRemu instanceof TauxRemu) {
            $tauxRemu = $tauxRemu->getId();
        }

        if (!isset($tauxValeur[$tauxRemu])){
            throw new \Exception('Taux de rémunération invalide : ID '.$tauxRemu.' inconnu');
        }


        if ($date instanceof \DateTime) {
            $date = $date->format('Y-m-d');
        }
        $valeur = $date; // pas de taux => date de référence

        foreach($tauxValeur[$tauxRemu]['valeurs'] as $d => $v ){
            if ($d <= $date){
                $valeur = $d;
            }else{
                break;
            }
        }

        if (!empty($tauxValeur[$tauxRemu]['parent'])){
            $dateParent = $this->tauxDate($tauxValeur[$tauxRemu]['parent'], $date);
            if ($dateParent->format('Y-m-d') > $valeur){
                return $dateParent;
            }else{
                return new \DateTime($valeur);
            }
        }else{
            return new \DateTime($valeur);
        }
    }



    public function clearCache(): self
    {
        $session = $this->getSessionContainer();