Commit 74da6fdf authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

wip refonte pj

parent ab6c0094
Loading
Loading
Loading
Loading
Loading
+25 −13
Original line number Diff line number Diff line
@@ -4,9 +4,9 @@

return [
    'name'        => 'PIECE_JOINTE_FICHIER',
    'temporary'   => FALSE,
    'logging'     => TRUE,
    'commentaire' => NULL,
    'temporary'   => false,
    'logging'     => true,
    'commentaire' => null,
    'sequence'    => 'PIECE_JOINTE_FICHIER_ID_SEQ',
    'columns'     => [
        'FICHIER_ID'      => [
@@ -14,24 +14,36 @@ return [
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => null,
            'position'    => 2,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'PIECE_JOINTE_ID' => [
            'name'        => 'PIECE_JOINTE_ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => null,
            'position'    => 1,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'VALIDATION_ID'         => [
            'name'        => 'VALIDATION_ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => true,
            'default'     => null,
            'position'    => 9,
            'commentaire' => null,
        ],
    ],
];
+49 −37
Original line number Diff line number Diff line
@@ -4,8 +4,8 @@

return [
    'name'        => 'TBL_PIECE_JOINTE',
    'temporary'   => FALSE,
    'logging'     => FALSE,
    'temporary'   => false,
    'logging'     => false,
    'commentaire' => 'Pièces justificatives',
    'sequence'    => 'TBL_PIECE_JOINTE_ID_SEQ',
    'columns'     => [
@@ -14,21 +14,21 @@ return [
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => null,
            'position'    => 2,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'DEMANDEE'             => [
            'name'        => 'DEMANDEE',
            'type'        => 'bool',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 1,
            'nullable'    => FALSE,
            'nullable'    => false,
            'default'     => '0',
            'position'    => 6,
            'commentaire' => 'Témoin (1 si la PJ est demandée)',
@@ -38,9 +38,9 @@ return [
            'type'        => 'bool',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 1,
            'nullable'    => FALSE,
            'nullable'    => false,
            'default'     => '0',
            'position'    => 7,
            'commentaire' => 'Témoin (1 si la PJ est fournie)',
@@ -50,9 +50,9 @@ return [
            'type'        => 'float',
            'bdd-type'    => 'FLOAT',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 126,
            'nullable'    => FALSE,
            'nullable'    => false,
            'default'     => '0',
            'position'    => 9,
            'commentaire' => 'NB d\'heures de seuil pour la demande',
@@ -62,73 +62,85 @@ return [
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => '"TBL_PIECE_JOINTE_ID_SEQ"."NEXTVAL"',
            'position'    => 1,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'INTERVENANT_ID'       => [
            'name'        => 'INTERVENANT_ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => null,
            'position'    => 5,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'OBLIGATOIRE'          => [
            'name'        => 'OBLIGATOIRE',
            'type'        => 'bool',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 1,
            'nullable'    => FALSE,
            'nullable'    => false,
            'default'     => '1',
            'position'    => 10,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'PIECE_JOINTE_ID'      => [
            'name'        => 'PIECE_JOINTE_ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => TRUE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => true,
            'default'     => null,
            'position'    => 4,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'TYPE_PIECE_JOINTE_ID' => [
            'name'        => 'TYPE_PIECE_JOINTE_ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => null,
            'position'    => 3,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'VALIDEE'              => [
            'name'        => 'VALIDEE',
            'type'        => 'bool',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 1,
            'nullable'    => FALSE,
            'nullable'    => false,
            'default'     => '0',
            'position'    => 8,
            'commentaire' => 'Témoin (1 si la PJ est validée)',
        ],
        'DEMANDEE_APRES_RECRUTEMENT' => [
            'name'        => 'DEMANDEE_APRES_RECRUTEMENT',,
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => '0',
            'position'    => 20,
            'commentaire' => 'PIECE DEMANDE APRES RECRUTEMENT',
        ],
    ],
];

+83 −83
Original line number Diff line number Diff line
@@ -4,9 +4,9 @@

return [
    'name'        => 'TYPE_PIECE_JOINTE_STATUT',
    'temporary'   => FALSE,
    'logging'     => TRUE,
    'commentaire' => NULL,
    'temporary'   => false,
    'logging'     => true,
    'commentaire' => null,
    'sequence'    => 'TYPE_PIECE_JOINTE_STATU_ID_SEQ',
    'columns'     => [
        'ANNEE_ID'              => [
@@ -14,33 +14,33 @@ return [
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => null,
            'position'    => 17,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'CHANGEMENT_RIB'        => [
            'name'        => 'CHANGEMENT_RIB',
            'type'        => 'bool',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 1,
            'nullable'    => FALSE,
            'nullable'    => false,
            'default'     => '0',
            'position'    => 13,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'DUREE_VIE'             => [
            'name'        => 'DUREE_VIE',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => '1',
            'position'    => 14,
            'commentaire' => 'Durée de vie de la pièce jointe',
@@ -50,153 +50,153 @@ return [
            'type'        => 'bool',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 1,
            'nullable'    => FALSE,
            'nullable'    => false,
            'default'     => '0',
            'position'    => 12,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'HISTO_CREATEUR_ID'     => [
            'name'        => 'HISTO_CREATEUR_ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => null,
            'position'    => 7,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'HISTO_CREATION'        => [
            'name'        => 'HISTO_CREATION',
            'type'        => 'date',
            'bdd-type'    => 'DATE',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => 'SYSDATE',
            'position'    => 6,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'HISTO_DESTRUCTEUR_ID'  => [
            'name'        => 'HISTO_DESTRUCTEUR_ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => TRUE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => true,
            'default'     => null,
            'position'    => 11,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'HISTO_DESTRUCTION'     => [
            'name'        => 'HISTO_DESTRUCTION',
            'type'        => 'date',
            'bdd-type'    => 'DATE',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => TRUE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => true,
            'default'     => null,
            'position'    => 10,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'HISTO_MODIFICATEUR_ID' => [
            'name'        => 'HISTO_MODIFICATEUR_ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => TRUE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => true,
            'default'     => null,
            'position'    => 9,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'HISTO_MODIFICATION'    => [
            'name'        => 'HISTO_MODIFICATION',
            'type'        => 'date',
            'bdd-type'    => 'DATE',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => 'SYSDATE',
            'position'    => 8,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'ID'                    => [
            'name'        => 'ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => null,
            'position'    => 1,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'NATIONALITE_ETRANGERE' => [
            'name'        => 'NATIONALITE_ETRANGERE',
            'type'        => 'bool',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 1,
            'nullable'    => FALSE,
            'nullable'    => false,
            'default'     => '0',
            'position'    => 19,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'NUM_REGLE'             => [
            'name'        => 'NUM_REGLE',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => '1',
            'position'    => 18,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'OBLIGATOIRE'           => [
            'name'        => 'OBLIGATOIRE',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => '1',
            'position'    => 3,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'OBLIGATOIRE_HNP'       => [
            'name'        => 'OBLIGATOIRE_HNP',
            'type'        => 'bool',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 1,
            'nullable'    => TRUE,
            'nullable'    => true,
            'default'     => '0',
            'position'    => 15,
            'commentaire' => 'Piece jointe obligatoire même si les heures sont non payables',
        ],
        'POST_RECRUTEMENT'      => [
            'name'        => 'POST_RECRUTEMENT',
        'DEMANDEE_APRES_RECRUTEMENT'      => [
            'name'        => 'DEMANDEE_APRES_RECRUTEMENT',
            'type'        => 'bool',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 1,
            'nullable'    => TRUE,
            'nullable'    => true,
            'default'     => '0',
            'position'    => 20,
            'commentaire' => 'Piece jointe obligatoire même si les heures sont non payables',
@@ -206,48 +206,48 @@ return [
            'type'        => 'float',
            'bdd-type'    => 'FLOAT',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 126,
            'nullable'    => FALSE,
            'nullable'    => false,
            'default'     => '0',
            'position'    => 5,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'STATUT_ID'             => [
            'name'        => 'STATUT_ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => null,
            'position'    => 16,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'TYPE_HEURE_HETD'       => [
            'name'        => 'TYPE_HEURE_HETD',
            'type'        => 'bool',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'scale'       => null,
            'precision'   => 1,
            'nullable'    => FALSE,
            'nullable'    => false,
            'default'     => '0',
            'position'    => 4,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
        'TYPE_PIECE_JOINTE_ID'  => [
            'name'        => 'TYPE_PIECE_JOINTE_ID',
            'type'        => 'int',
            'bdd-type'    => 'NUMBER',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => FALSE,
            'default'     => NULL,
            'scale'       => null,
            'precision'   => null,
            'nullable'    => false,
            'default'     => null,
            'position'    => 2,
            'commentaire' => NULL,
            'commentaire' => null,
        ],
    ],
];
+39 −23
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_TBL_PIECE_JOINTE_DEMANDE AS
--CREATE OR REPLACE FORCE VIEW V_TBL_PIECE_JOINTE_DEMANDE AS
WITH i_h AS (
	SELECT
		s.intervenant_id,
@@ -12,7 +12,7 @@ WITH i_h AS (
	JOIN volume_horaire vh ON vh.service_id = s.id
		AND vh.type_volume_horaire_id = tvh.id
		AND vh.histo_destruction IS NULL
    JOIN element_pedagogique  ep ON ep.id = s.element_pedagogique_id -- Service sur l'établissement
	JOIN element_pedagogique ep ON ep.id = s.element_pedagogique_id
	WHERE
		s.histo_destruction IS NULL
	    /*@INTERVENANT_ID=s.intervenant_id*/
@@ -32,41 +32,42 @@ hetd AS (
	GROUP BY
		intervenant_id
)
SELECT i.annee_id                        annee_id,
SELECT
	i.annee_id 								annee_id,
	i.code 									code_intervenant,
	i.id 									intervenant_id,
	tpj.id 									type_piece_jointe_id,
	MAX(COALESCE(i_h.heures, 0)) 			heures_pour_seuil,
	MAX(tpjs.obligatoire) 					obligatoire,
	MAX(COALESCE(hetd.total_hetd, 0)) 		heures_pour_seuil_hetd,
       MIN(tpjs.duree_vie)               duree_vie
FROM intervenant i
         LEFT JOIN intervenant_dossier d ON d.intervenant_id = i.id AND d.histo_destruction IS NULL
         JOIN type_piece_jointe_statut tpjs
              ON tpjs.statut_id = i.statut_id AND tpjs.histo_destruction IS NULL AND i.annee_id = tpjs.annee_id
         JOIN type_piece_jointe tpj ON tpj.id = tpjs.type_piece_jointe_id AND tpj.histo_destruction IS NULL
	MIN(tpjs.duree_vie) 				 	duree_vie,
	MAX(tpjs.demandee_apres_recrutement)	demandee_apres_recrutement
FROM
	intervenant i
LEFT JOIN intervenant_dossier d ON d.intervenant_id = i.id
	AND d.histo_destruction IS NULL
JOIN type_piece_jointe_statut tpjs ON tpjs.statut_id = i.statut_id
	AND tpjs.histo_destruction IS NULL
	AND i.annee_id = tpjs.annee_id
JOIN type_piece_jointe tpj ON tpj.id = tpjs.type_piece_jointe_id
	AND tpj.histo_destruction IS NULL
LEFT JOIN i_h ON i_h.intervenant_id = i.id
LEFT JOIN hetd ON hetd.intervenant_id = i.id
WHERE i.histo_destruction IS NULL
    /*@INTERVENANT_ID=i.id*/
    /*@ANNEE_ID=i.annee_id*/

WHERE
	-- Seuil heure soit en HETD soit en heure ou PJ obligatoire meme avec des heures non payables
  AND (
	(
            COALESCE(tpjs.seuil_hetd, 0) = 0
		OR (COALESCE(tpjs.type_heure_hetd, 0) = 0 AND COALESCE(i_h.heures, 0) > COALESCE(tpjs.seuil_hetd, -1))
		OR (tpjs.type_heure_hetd = 1 AND COALESCE(hetd.total_hetd, 0) > COALESCE(tpjs.seuil_hetd, -1))
		OR (COALESCE(i_h.heures_non_payables, 0) > 0 AND tpjs.obligatoire_hnp = 1)
    )

	-- Le RIB n'est demandé QUE s'il est différent!!
	AND CASE
			WHEN tpjs.changement_rib = 0 OR d.id IS NULL
			THEN 1
          ELSE CASE
                   WHEN
                               REPLACE(i.bic, ' ', '') = REPLACE(d.bic, ' ', '')
                           AND REPLACE(i.iban, ' ', '') = REPLACE(d.iban, ' ', '')
			ELSE
			CASE
				WHEN REPLACE(i.bic, ' ', '') = REPLACE(d.bic, ' ', '') AND REPLACE(i.iban, ' ', '') = REPLACE(d.iban, ' ', '')
	           	THEN 0
				ELSE 1 END
	END = 1
@@ -74,15 +75,30 @@ WHERE i.histo_destruction IS NULL
	AND CASE
			WHEN tpjs.nationalite_etrangere = 0	OR d.id IS NULL
	    	THEN 1
    ELSE CASE
        WHEN
          d.pays_nationalite_id = (SELECT MAX(id) FROM pays p WHERE libelle IN ('France','FRANCE') AND histo_destruction IS NULL GROUP BY id)
			ELSE
			CASE
				WHEN d.pays_nationalite_id = (
					SELECT
						MAX(id)
					FROM
						pays p
					WHERE
						libelle IN ('France', 'FRANCE')
						AND histo_destruction IS NULL
					GROUP BY
						id
				)
        	THEN 0
			ELSE 1 END
	END = 1
	-- Filtre FC
	AND (tpjs.fc = 0 OR i_h.fc > 0)
GROUP BY i.annee_id,
	AND
		i.histo_destruction IS NULL
    	/*@INTERVENANT_ID=i.id*/
		/*@ANNEE_ID=i.annee_id*/
GROUP BY
	i.annee_id,
	i.id,
	i.code,
	tpj.id
 No newline at end of file
+4 −2
Original line number Diff line number Diff line
@@ -83,9 +83,11 @@ class Fichier implements HistoriqueAwareInterface, ResourceInterface, UploadedFi
     */
    public function __toString()
    {
        $string = sprintf("%s - Fichier '%s'",
        $string = sprintf(
            "%s - Fichier '%s'",
            $this->getTypeMime(),
            $this->getNom());
            $this->getNom()
        );

        if ($this->getValidation()) {
            $string .= $this->getValidation();
Loading