Commit 94b95fef authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Merge branch 'alc-imputation'

parents f31f3e74 dcb56b8f
Loading
Loading
Loading
Loading
+2 −2
Changes for doc/Connecteurs-Import/Octopus/MV_INTERVENANT.sql: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -96,8 +96,8 @@ WITH i AS (
             -- Si plusieurs, alors c'est celle qui commence le + tard qui est prise en comtpe
            SELECT
                individu_id,
                max(structure_id) KEEP (DENSE_RANK  LAST ORDER BY CASE WHEN source_id = 'SIHAM' THEN 1 ELSE 999 END DESC , t_principale, date_debut)   structure_id,
                max(source_id) KEEP (DENSE_RANK  LAST ORDER BY CASE WHEN source_id = 'SIHAM' THEN 1 ELSE 999 END DESC,t_principale, date_debut) source_id
                max(structure_id) KEEP (DENSE_RANK  LAST ORDER BY CASE WHEN source_id = 'SIHAM' THEN 1  WHEN source_id = 'OCTOREFID' THEN 2 ELSE 999 END DESC , t_principale, date_debut)   structure_id,
                max(source_id) KEEP (DENSE_RANK  LAST ORDER BY CASE WHEN source_id = 'SIHAM' THEN 1 WHEN source_id = 'OCTOREFID' THEN 2 ELSE 999 END DESC,t_principale, date_debut) source_id
             FROM octo.individu_affectation@octoprod
             WHERE type_id = 4
             AND date_fin + 1 >= (SYSDATE - (365 * 2))
+19 −1
Changes for module/Application/config/paiement.config.php: 19 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -76,6 +76,18 @@ return [
                            ],
                        ],
                    ],
                    'imputation-siham'      => [
                        'type'          => 'Literal',
                        'may_terminate' => true,
                        'options'       => [
                            'route'    => '/imputation-siham',
                            'defaults' => [
                                'action' => 'imputationSiham',
                                'etat'   => Entity\Db\MiseEnPaiement::IMPUTATION_BUDGETAIRE,

                            ],
                        ],
                    ],
                ],
            ],
        ],
@@ -161,6 +173,12 @@ return [
                                        'route'    => 'paiement/extraction-winpaie',
                                        'resource' => Privileges::getResourceId(Privileges::MISE_EN_PAIEMENT_EXPORT_PAIE),
                                    ],
                                    'imputation-siham'      => [
                                        'label'    => "Imputation budgétaire SIHAM",
                                        'title'    => "Export des données pour chargement en masse des imputations budgétaires dans SIHAM",
                                        'route'    => 'paiement/imputation-siham',
                                        'resource' => Privileges::getResourceId(Privileges::MISE_EN_PAIEMENT_EXPORT_PAIE),
                                    ],
                                ],
                            ],
                        ],
@@ -227,7 +245,7 @@ return [
                ],
                [
                    'controller' => 'Application\Controller\Paiement',
                    'action'     => ['extractionWinpaie'],
                    'action'     => ['extractionWinpaie', 'imputationSiham'],
                    'privileges' => [Privileges::MISE_EN_PAIEMENT_EXPORT_PAIE],
                ],
            ],
+67
Changes for module/Application/src/Controller/PaiementController.php: 67 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -407,6 +407,8 @@ class PaiementController extends AbstractController
    {
        if ($recherche->getEtat() == MiseEnPaiement::A_METTRE_EN_PAIEMENT) {
            $filename = 'demande_mise_en_paiement';
        } elseif ($recherche->getEtat() == 'imputation-budgetaire') {
            $filename = 'imputation-budgetaire';
        } else {
            $filename = 'etat_paiement';
        }
@@ -481,6 +483,71 @@ class PaiementController extends AbstractController



    public function imputationSihamAction()
    {
        $title = 'Export des données pour le chargement en masse des imputations budgétaires dans SIHAM';
        $this->initFilters();

        $role = $this->getServiceContext()->getSelectedIdentityRole();

        $recherche = new MiseEnPaiementRecherche;
        $recherche->setEtat(MiseEnPaiement::MIS_EN_PAIEMENT); // données à mettre en paiement uniquement
        $recherche->setAnnee($this->getServiceContext()->getAnnee());
        $recherche->setTypeIntervenant($this->context()->typeIntervenantFromPost('type-intervenant'));

        $rechercheForm = $this->getFormPaiementMiseEnPaiementRecherche();
        $rechercheForm->bind($recherche);


        $qb = $this->getServicePeriode()->finderByMiseEnPaiement();
        $this->getServiceMiseEnPaiement()->finderByTypeIntervenant($recherche->getTypeIntervenant(), $qb);
        $this->getServiceMiseEnPaiement()->finderByEtat($recherche->getEtat(), $qb);
        $periodes = $this->getServicePeriode()->getList($qb);

        $rechercheForm->populatePeriodes($periodes);
        if (count($periodes) == 1) {
            $recherche->setPeriode(current($periodes));
            $rechercheForm->get('periode')->setValue($recherche->getPeriode()->getId());
        } else {
            $recherche->setPeriode($this->context()->periodeFromPost());
        }

        $qb = $this->getServiceIntervenant()->finderByMiseEnPaiement(null, $recherche->getPeriode());
        $this->getServiceIntervenant()->finderByAnnee($recherche->getAnnee(), $qb);
        $this->getServiceMiseEnPaiement()->finderByTypeIntervenant($recherche->getTypeIntervenant(), $qb);
        $this->getServiceMiseEnPaiement()->finderByEtat($recherche->getEtat(), $qb);
        $intervenants = $this->getServiceIntervenant()->getList($qb);
        $rechercheForm->populateIntervenants($intervenants);
        $noData = count($intervenants) == 0;


        $request = $this->getRequest();
        if ($request->isPost()) {
            $rechercheForm->setData($request->getPost());
            $rechercheForm->isValid();
        }

        $etatSortie = $this->getServiceEtatSortie()->getRepo()->findOneBy(['code' => 'imputation-budgetaire']);


        //creation d'un privilege specifique aux imputations budgétaire
        if ($this->params()->fromPost('exporter-csv-imputation') !== null && $this->isAllowed(Privileges::getResourceId(Privileges::MISE_EN_PAIEMENT_EXPORT_CSV))) {
            $csvModel = $this->getServiceEtatSortie()->genererCsv($etatSortie, $recherche->getFilters());
            $csvModel->setFilename($this->makeFilenameFromRecherche($recherche) . '.csv');

            return $csvModel;
        } else {
            $etatPaiement = null;
            if ($recherche->getIntervenants()->count() > 0) {
                $etatPaiement = $this->getServiceMiseEnPaiement()->getEtatPaiement($recherche);
            }

            return compact('recherche', 'rechercheForm', 'etatPaiement', 'noData');
        }
    }



    public function miseEnPaiementAction()
    {
        $this->initFilters();
+1
Changes for module/Application/src/Entity/Db/MiseEnPaiement.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ class MiseEnPaiement implements HistoriqueAwareInterface, ResourceInterface

    const A_METTRE_EN_PAIEMENT  = 'a-mettre-en-paiement';
    const MIS_EN_PAIEMENT       = 'mis-en-paiement';
    const IMPUTATION_BUDGETAIRE = 'imputation-budgetaire';

    /**
     * @var \DateTime
+8
Changes for module/Application/src/Form/Paiement/MiseEnPaiementRechercheForm.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -136,6 +136,14 @@ class MiseEnPaiementRechercheForm extends AbstractForm
                'class' => 'btn btn-default',
            ],
        ]);

        $this->add([
            'name'       => 'exporter-csv-imputation',
            'type'       => 'Submit',
            'attributes' => [
                'class' => 'btn btn-default',
            ],
        ]);
    }


Loading