Loading data/ddl/view/V_TBL_PIECE_JOINTE_DEMANDE.sql +14 −13 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, SUM(CASE WHEN vh.MOTIF_NON_PAIEMENT_ID IS NULL THEN vh.heures ELSE 0 END) heures, SUM(CASE WHEN vh.MOTIF_NON_PAIEMENT_ID IS NOT NULL THEN vh.heures ELSE 0 END) heures_non_payables, SUM(ep.taux_fc) fc --SUM(ep.taux_fc) fc SUM(CASE WHEN ep.taux_fc > 0 THEN vh.heures ELSE 0 END) fc FROM service s JOIN type_volume_horaire tvh ON tvh.code = 'PREVU' Loading @@ -31,8 +33,7 @@ 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, Loading @@ -40,15 +41,14 @@ SELECT MAX(tpjs.obligatoire) obligatoire, MAX(COALESCE(hetd.total_hetd, 0)) heures_pour_seuil_hetd, MIN(tpjs.duree_vie) duree_vie FROM intervenant i 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_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 WHERE i.histo_destruction IS NULL /*@INTERVENANT_ID=i.id*/ /*@ANNEE_ID=i.annee_id*/ Loading @@ -64,16 +64,17 @@ WHERE AND CASE WHEN tpjs.changement_rib = 0 OR d.id IS NULL THEN 1 ELSE CASE WHEN ELSE CASE WHEN replace(i.bic, ' ', '') = replace(d.bic, ' ', '') AND replace(i.iban, ' ', '') = replace(d.iban, ' ', '') THEN 0 ELSE 1 END THEN 0 ELSE 1 END END = 1 -- Filtre FC AND (tpjs.fc = 0 OR i_h.fc > 0) GROUP BY i.annee_id, GROUP BY i.annee_id, i.id, i.code, tpj.id No newline at end of file module/Application/src/Controller/PieceJointeController.php +9 −49 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ use Application\Entity\Db\TblPieceJointeDemande; use Application\Entity\Db\TypePieceJointe; use Application\Entity\Db\TypePieceJointeStatut; use Application\Entity\Db\Validation; use Application\Entity\Db\WfEtape; use Application\Form\PieceJointe\Traits\ModifierTypePieceJointeStatutFormAwareTrait; use Application\Service\Traits\IntervenantServiceAwareTrait; use Application\Service\Traits\PieceJointeServiceAwareTrait; Loading Loading @@ -65,7 +66,6 @@ class PieceJointeController extends AbstractController } /** * * @return ViewModel Loading Loading @@ -99,7 +99,7 @@ class PieceJointeController extends AbstractController $annee = $this->getServiceContext()->getAnnee(); $messages = $this->makeMessages($demandees, $fournies); $messages = $this->makeMessages($intervenant); $alertContrat = $role->getIntervenant() && $intervenant->getStatut()->getContrat(); Loading @@ -107,7 +107,6 @@ class PieceJointeController extends AbstractController } /** * * @return ViewModel Loading @@ -122,52 +121,30 @@ class PieceJointeController extends AbstractController $demandees = $this->getServicePieceJointe()->getTypesPiecesDemandees($intervenant); $fournies = $this->getServicePieceJointe()->getPiecesFournies($intervenant); $messages = $this->makeMessages($demandees, $fournies); $messages = $this->makeMessages($intervenant); return compact('messages'); } /** * @param TblPieceJointeDemande[] $demandees * @param TblPieceJointeFournie[] $fournies * * @return array */ protected function makeMessages(array $demandees, array $fournies) protected function makeMessages(Intervenant $intervenant) { $role = $this->getServiceContext()->getSelectedIdentityRole(); $isIntervenant = (boolean)$role->getIntervenant(); $nbDemandees = 0; $nbFournies = 0; $nbValidees = 0; $nbObligatoiresNonFournis = 0; foreach ($demandees as $demandee) { if ($demandee->isObligatoire()) { $nbDemandees++; if (isset($fournies[$demandee->getTypePieceJointe()->getId()])) { $pj = $fournies[$demandee->getTypePieceJointe()->getId()]; if (!$pj->getFichier()->isEmpty()) { $nbFournies++; if ($pj->getValidation()) { $nbValidees++; } } } } } $workflowEtapePjSaisie = $this->getServiceWorkflow()->getEtape(WfEtape::CODE_PJ_SAISIE, $intervenant); $workflowEtapePjValide = $this->getServiceWorkflow()->getEtape(WfEtape::CODE_PJ_VALIDATION, $intervenant); $msgs = []; if (0 == $nbDemandees) { $msgs['info'][] = 'Aucune pièce justificative obligatoire n\'est à fournir'; } elseif ($nbFournies < $nbDemandees) { if ($workflowEtapePjSaisie->getFranchie() != 1) { $msgs['danger'][] = "Des pièces justificatives obligatoires n'ont pas été fournies."; } elseif ($nbFournies == $nbDemandees && $nbValidees == $nbDemandees) { } elseif ($workflowEtapePjSaisie->getFranchie() == 1 && $workflowEtapePjValide->getFranchie() == 1) { $msgs['success'][] = "Toutes les pièces justificatives obligatoires ont été fournies et validées."; } elseif ($nbFournies == $nbDemandees && $nbValidees < $nbFournies) { } elseif ($workflowEtapePjSaisie->getFranchie() == 1 && $workflowEtapePjValide->getFranchie() != 1) { $msgs['success'][] = "Toutes les pièces justificatives obligatoires ont été fournies."; $msgs['warning'][] = "Mais certaines doivent encore être validées par un gestionnaire."; } Loading @@ -176,7 +153,6 @@ class PieceJointeController extends AbstractController } public function validationAction() { $this->initFilters(); Loading @@ -189,7 +165,6 @@ class PieceJointeController extends AbstractController } public function validerAction() { $this->initFilters(); Loading @@ -207,7 +182,6 @@ class PieceJointeController extends AbstractController } public function archiverAction() { $this->initFilters(); Loading @@ -229,7 +203,6 @@ class PieceJointeController extends AbstractController } public function devaliderAction() { $this->initFilters(); Loading @@ -247,7 +220,6 @@ class PieceJointeController extends AbstractController } public function listerAction() { $this->initFilters(); Loading @@ -268,7 +240,6 @@ class PieceJointeController extends AbstractController } public function televerserAction() { $intervenant = $this->getEvent()->getParam('intervenant'); Loading @@ -292,7 +263,6 @@ class PieceJointeController extends AbstractController } public function telechargerAction() { /** @var Fichier $fichier */ Loading @@ -313,7 +283,6 @@ class PieceJointeController extends AbstractController } public function supprimerAction() { if (!$this->getRequest()->isPost()) { Loading @@ -340,7 +309,6 @@ class PieceJointeController extends AbstractController } /* Actions liées à la configuration des PJ */ public function configurationAction() Loading @@ -349,7 +317,6 @@ class PieceJointeController extends AbstractController } public function typePieceJointeStatutAction() { $codeIntervenant = $this->params()->fromRoute('codeTypeIntervenant', TypeIntervenant::CODE_EXTERIEUR); Loading Loading @@ -412,7 +379,6 @@ class PieceJointeController extends AbstractController } public function typePieceJointeDeleteAction() { $typePieceJointe = $this->getEvent()->getParam('typePieceJointe'); Loading @@ -428,7 +394,6 @@ class PieceJointeController extends AbstractController } public function typePieceJointeSaisieAction() { /* @var $typePieceJointe TypePieceJointe */ Loading @@ -448,7 +413,6 @@ class PieceJointeController extends AbstractController } public function modifierTypePieceJointeStatutAction() { /* @var $tpjs TypePieceJointeStatut */ Loading @@ -474,7 +438,6 @@ class PieceJointeController extends AbstractController } public function typePieceJointeTrierAction() { /* @var $tpj TypePieceJointe */ Loading @@ -500,7 +463,6 @@ class PieceJointeController extends AbstractController } public function deleteTypePieceJointeStatutAction() { $typePieceJointeStatut = $this->getEvent()->getParam('typePieceJointeStatut'); Loading @@ -516,7 +478,6 @@ class PieceJointeController extends AbstractController } private function updateTableauxBord(Intervenant $intervenant, $validation = false) { $this->getServiceWorkflow()->calculerTableauxBord([ Loading @@ -537,7 +498,6 @@ class PieceJointeController extends AbstractController } public function refuserAction() { /** @var PieceJointe $pj */ Loading Loading
data/ddl/view/V_TBL_PIECE_JOINTE_DEMANDE.sql +14 −13 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, SUM(CASE WHEN vh.MOTIF_NON_PAIEMENT_ID IS NULL THEN vh.heures ELSE 0 END) heures, SUM(CASE WHEN vh.MOTIF_NON_PAIEMENT_ID IS NOT NULL THEN vh.heures ELSE 0 END) heures_non_payables, SUM(ep.taux_fc) fc --SUM(ep.taux_fc) fc SUM(CASE WHEN ep.taux_fc > 0 THEN vh.heures ELSE 0 END) fc FROM service s JOIN type_volume_horaire tvh ON tvh.code = 'PREVU' Loading @@ -31,8 +33,7 @@ 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, Loading @@ -40,15 +41,14 @@ SELECT MAX(tpjs.obligatoire) obligatoire, MAX(COALESCE(hetd.total_hetd, 0)) heures_pour_seuil_hetd, MIN(tpjs.duree_vie) duree_vie FROM intervenant i 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_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 WHERE i.histo_destruction IS NULL /*@INTERVENANT_ID=i.id*/ /*@ANNEE_ID=i.annee_id*/ Loading @@ -64,16 +64,17 @@ WHERE AND CASE WHEN tpjs.changement_rib = 0 OR d.id IS NULL THEN 1 ELSE CASE WHEN ELSE CASE WHEN replace(i.bic, ' ', '') = replace(d.bic, ' ', '') AND replace(i.iban, ' ', '') = replace(d.iban, ' ', '') THEN 0 ELSE 1 END THEN 0 ELSE 1 END END = 1 -- Filtre FC AND (tpjs.fc = 0 OR i_h.fc > 0) GROUP BY i.annee_id, GROUP BY i.annee_id, i.id, i.code, tpj.id No newline at end of file
module/Application/src/Controller/PieceJointeController.php +9 −49 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ use Application\Entity\Db\TblPieceJointeDemande; use Application\Entity\Db\TypePieceJointe; use Application\Entity\Db\TypePieceJointeStatut; use Application\Entity\Db\Validation; use Application\Entity\Db\WfEtape; use Application\Form\PieceJointe\Traits\ModifierTypePieceJointeStatutFormAwareTrait; use Application\Service\Traits\IntervenantServiceAwareTrait; use Application\Service\Traits\PieceJointeServiceAwareTrait; Loading Loading @@ -65,7 +66,6 @@ class PieceJointeController extends AbstractController } /** * * @return ViewModel Loading Loading @@ -99,7 +99,7 @@ class PieceJointeController extends AbstractController $annee = $this->getServiceContext()->getAnnee(); $messages = $this->makeMessages($demandees, $fournies); $messages = $this->makeMessages($intervenant); $alertContrat = $role->getIntervenant() && $intervenant->getStatut()->getContrat(); Loading @@ -107,7 +107,6 @@ class PieceJointeController extends AbstractController } /** * * @return ViewModel Loading @@ -122,52 +121,30 @@ class PieceJointeController extends AbstractController $demandees = $this->getServicePieceJointe()->getTypesPiecesDemandees($intervenant); $fournies = $this->getServicePieceJointe()->getPiecesFournies($intervenant); $messages = $this->makeMessages($demandees, $fournies); $messages = $this->makeMessages($intervenant); return compact('messages'); } /** * @param TblPieceJointeDemande[] $demandees * @param TblPieceJointeFournie[] $fournies * * @return array */ protected function makeMessages(array $demandees, array $fournies) protected function makeMessages(Intervenant $intervenant) { $role = $this->getServiceContext()->getSelectedIdentityRole(); $isIntervenant = (boolean)$role->getIntervenant(); $nbDemandees = 0; $nbFournies = 0; $nbValidees = 0; $nbObligatoiresNonFournis = 0; foreach ($demandees as $demandee) { if ($demandee->isObligatoire()) { $nbDemandees++; if (isset($fournies[$demandee->getTypePieceJointe()->getId()])) { $pj = $fournies[$demandee->getTypePieceJointe()->getId()]; if (!$pj->getFichier()->isEmpty()) { $nbFournies++; if ($pj->getValidation()) { $nbValidees++; } } } } } $workflowEtapePjSaisie = $this->getServiceWorkflow()->getEtape(WfEtape::CODE_PJ_SAISIE, $intervenant); $workflowEtapePjValide = $this->getServiceWorkflow()->getEtape(WfEtape::CODE_PJ_VALIDATION, $intervenant); $msgs = []; if (0 == $nbDemandees) { $msgs['info'][] = 'Aucune pièce justificative obligatoire n\'est à fournir'; } elseif ($nbFournies < $nbDemandees) { if ($workflowEtapePjSaisie->getFranchie() != 1) { $msgs['danger'][] = "Des pièces justificatives obligatoires n'ont pas été fournies."; } elseif ($nbFournies == $nbDemandees && $nbValidees == $nbDemandees) { } elseif ($workflowEtapePjSaisie->getFranchie() == 1 && $workflowEtapePjValide->getFranchie() == 1) { $msgs['success'][] = "Toutes les pièces justificatives obligatoires ont été fournies et validées."; } elseif ($nbFournies == $nbDemandees && $nbValidees < $nbFournies) { } elseif ($workflowEtapePjSaisie->getFranchie() == 1 && $workflowEtapePjValide->getFranchie() != 1) { $msgs['success'][] = "Toutes les pièces justificatives obligatoires ont été fournies."; $msgs['warning'][] = "Mais certaines doivent encore être validées par un gestionnaire."; } Loading @@ -176,7 +153,6 @@ class PieceJointeController extends AbstractController } public function validationAction() { $this->initFilters(); Loading @@ -189,7 +165,6 @@ class PieceJointeController extends AbstractController } public function validerAction() { $this->initFilters(); Loading @@ -207,7 +182,6 @@ class PieceJointeController extends AbstractController } public function archiverAction() { $this->initFilters(); Loading @@ -229,7 +203,6 @@ class PieceJointeController extends AbstractController } public function devaliderAction() { $this->initFilters(); Loading @@ -247,7 +220,6 @@ class PieceJointeController extends AbstractController } public function listerAction() { $this->initFilters(); Loading @@ -268,7 +240,6 @@ class PieceJointeController extends AbstractController } public function televerserAction() { $intervenant = $this->getEvent()->getParam('intervenant'); Loading @@ -292,7 +263,6 @@ class PieceJointeController extends AbstractController } public function telechargerAction() { /** @var Fichier $fichier */ Loading @@ -313,7 +283,6 @@ class PieceJointeController extends AbstractController } public function supprimerAction() { if (!$this->getRequest()->isPost()) { Loading @@ -340,7 +309,6 @@ class PieceJointeController extends AbstractController } /* Actions liées à la configuration des PJ */ public function configurationAction() Loading @@ -349,7 +317,6 @@ class PieceJointeController extends AbstractController } public function typePieceJointeStatutAction() { $codeIntervenant = $this->params()->fromRoute('codeTypeIntervenant', TypeIntervenant::CODE_EXTERIEUR); Loading Loading @@ -412,7 +379,6 @@ class PieceJointeController extends AbstractController } public function typePieceJointeDeleteAction() { $typePieceJointe = $this->getEvent()->getParam('typePieceJointe'); Loading @@ -428,7 +394,6 @@ class PieceJointeController extends AbstractController } public function typePieceJointeSaisieAction() { /* @var $typePieceJointe TypePieceJointe */ Loading @@ -448,7 +413,6 @@ class PieceJointeController extends AbstractController } public function modifierTypePieceJointeStatutAction() { /* @var $tpjs TypePieceJointeStatut */ Loading @@ -474,7 +438,6 @@ class PieceJointeController extends AbstractController } public function typePieceJointeTrierAction() { /* @var $tpj TypePieceJointe */ Loading @@ -500,7 +463,6 @@ class PieceJointeController extends AbstractController } public function deleteTypePieceJointeStatutAction() { $typePieceJointeStatut = $this->getEvent()->getParam('typePieceJointeStatut'); Loading @@ -516,7 +478,6 @@ class PieceJointeController extends AbstractController } private function updateTableauxBord(Intervenant $intervenant, $validation = false) { $this->getServiceWorkflow()->calculerTableauxBord([ Loading @@ -537,7 +498,6 @@ class PieceJointeController extends AbstractController } public function refuserAction() { /** @var PieceJointe $pj */ Loading