Commit eae94d2b authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Merge branch 'master' of https://git.unicaen.fr/open-source/OSE into plafonds-perso

parents 9350a778 510cdd77
Loading
Loading
Loading
Loading
+1
Changes for CHANGELOG.md: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ Objectif : Plafonds personnalisables
* Le service dû s'affiche de nouveau normalement dans la page "Calcul HETD" de l'intervenant
* Adaptation de la commande update-employeur pour assurer la compatibilité avec les différentes versions d'oracle
* Correction sur un problème de route dans l'écran Engagements & Liquidation (#38763)
* Export CSV des agréments : inversion de colonnes (#41513)

## Notes de mise à jour

+6 −3
Changes for data/ddl/view/V_CONTRAT_MAIN.sql: 6 added lines, 3 removed lines.
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_CONTRAT_MAIN AS
WITH hs AS (
  SELECT contrat_id, sum(heures) "serviceTotal" FROM V_CONTRAT_SERVICES GROUP BY contrat_id
  SELECT contrat_id, sum(heures) "serviceTotal", max("libelleAutres") "libelleAutres" FROM V_CONTRAT_SERVICES GROUP BY contrat_id
)
SELECT
  ct.annee_id,
@@ -8,7 +8,6 @@ SELECT
  ct.intervenant_id,
  ct.formule_resultat_id,
  ct.id contrat_id,

  ct."composante",
  ct."annee",
  ct."nom",
@@ -31,6 +30,8 @@ SELECT
  'Exemplaire à conserver' "exemplaire1",
  'Exemplaire à retourner' || ct."exemplaire2" "exemplaire2",
  ct."serviceTotal",
  ct."legendeAutresHeures",
  ct."enteteAutresHeures",

  CASE ct.est_contrat
    WHEN 1 THEN -- contrat
@@ -92,6 +93,8 @@ FROM
      ), CHR(13), ' - ')
    ELSE '' END                                                                                   "exemplaire2",
    replace(ltrim(to_char(COALESCE(hs."serviceTotal",0), '999999.00')),'.',',')                   "serviceTotal",
    CASE WHEN hs."libelleAutres" IS NOT NULL THEN '*Dont type(s) intervention(s) : ' ||  hs."libelleAutres" END "legendeAutresHeures",
    CASE WHEN hs."libelleAutres" IS NOT NULL THEN 'Autres heures*' ELSE 'Autres heures' END                         "enteteAutresHeures",
    CASE WHEN c.contrat_id IS NULL THEN 1 ELSE 0 END                                              est_contrat,
    CASE WHEN v.id IS NULL THEN 1 ELSE 0 END                                                      est_projet,
    si.tem_atv                                                                                    est_atv
@@ -114,4 +117,4 @@ FROM
    LEFT JOIN contrat              cp ON cp.id = c.contrat_id
  WHERE
    c.histo_destruction IS NULL
) ct
 No newline at end of file
) ct;
 No newline at end of file
+51 −3
Changes for data/ddl/view/V_CONTRAT_SERVICES.sql: 51 added lines, 3 removed lines.
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_CONTRAT_SERVICES AS
WITH services AS (
	SELECT
	  c.id                                             						contrat_id,
	  str.libelle_court                                						"serviceComposante",
	  ep.code                                          						"serviceCode",
	  ep.libelle                                       						"serviceLibelle",
  sum(vh.heures)                                   heures,
  replace(ltrim(to_char(sum(vh.heures), '999999.00')),'.',',') "serviceHeures"
	  CASE WHEN ti.code = 'CM' THEN vh.heures ELSE 0 END 				    heures_cm,
	  CASE WHEN ti.code = 'TD' THEN vh.heures ELSE 0 END 				    heures_td,
	  CASE WHEN ti.code = 'TP' THEN vh.heures ELSE 0 END 				    heures_tp,
	  CASE WHEN ti.code NOT IN ('CM','TD','TP') THEN vh.heures ELSE 0 END   heures_autres,
	  CASE WHEN ti.code NOT IN ('CM','TD','TP') THEN ti.libelle ELSE '' END type_intervention_libelle,
	  vh.heures 															heures_totales
	FROM
	            contrat                  c
	       JOIN structure              str ON str.id = c.structure_id
	       JOIN volume_horaire          vh ON vh.contrat_id = c.id AND vh.histo_destruction IS NULL
	       JOIN service                  s ON s.id = vh.service_id
	       JOIN type_intervention       ti ON ti.id = vh.type_intervention_id
	  LEFT JOIN element_pedagogique     ep ON ep.id = s.element_pedagogique_id


)  ,
servicesAutres AS (
	SELECT
		t.contrat_id                  																	   contrat_id,
		listagg(t.type_intervention_libelle, ', ') WITHIN GROUP (ORDER BY t.type_intervention_libelle)	   type_intervention_libelle
		FROM (
			SELECT DISTINCT
			  c.id                                             						contrat_id,
			  ti.libelle                                                            type_intervention_libelle
			FROM
			            contrat                  c
			       JOIN volume_horaire          vh ON vh.contrat_id = c.id AND vh.histo_destruction IS NULL
			       JOIN type_intervention       ti ON ti.id = vh.type_intervention_id
			WHERE ti.code NOT IN ('CM','TD','TP')
		) t
		GROUP by
		t.contrat_id


)
SELECT

  s.contrat_id,
  s."serviceComposante",
  s."serviceCode",
  s."serviceLibelle",
  CASE WHEN sum(s.heures_cm) = 0 THEN to_char(0) ELSE replace(ltrim(to_char(sum(s.heures_cm), '999999.00')),'.',',') END 		 "cm",
  CASE WHEN sum(s.heures_td) = 0 THEN to_char(0) ELSE replace(ltrim(to_char(sum(s.heures_td), '999999.00')),'.',',') END 		 "td",
  CASE WHEN sum(s.heures_tp) = 0 THEN to_char(0) ELSE replace(ltrim(to_char(sum(s.heures_tp), '999999.00')),'.',',') END 		 "tp",
  CASE WHEN sum(s.heures_autres) = 0 THEN to_char(0) ELSE replace(ltrim(to_char(sum(s.heures_autres), '999999.00')),'.',',') END "autres",
  SUM(heures_totales)																			                                 heures,
  SUM(heures_totales) 																									 		 "serviceHeures",
  MAX(sa.type_intervention_libelle)																								 "libelleAutres"
  FROM services s
  LEFT JOIN servicesAutres sa ON sa.contrat_id = s.contrat_id
  GROUP BY
  c.id, str.libelle_court, ep.code, ep.libelle
 No newline at end of file
  s.contrat_id,
  s."serviceComposante",
  s."serviceCode",
  s."serviceLibelle"

+43.1 KiB

File added.

No diff preview for this file type.

+2 −2
Changes for data/nomenclatures.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -530,8 +530,8 @@ return [
        [
            'ID'                 => 2,
            'VALEUR'             => 41.41,
            'HISTO_CREATION'     => '2017-04-28 00:00:00',
            'HISTO_MODIFICATION' => '2017-04-28 00:00:00',
            'HISTO_CREATION'     => '2017-02-01 00:00:00',
            'HISTO_MODIFICATION' => '2017-02-01 00:00:00',
        ],
    ],

Loading