Commit b128766a authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Prise en compte du paramètre centre de cout paye pour afficher les demandes de...

Prise en compte du paramètre centre de cout paye pour afficher les demandes de mise en paiement selon le contexte de l'utilisateur et de l'intervenant.
parent 5031baba
Loading
Loading
Loading
Loading
+17 −1
Changes for front/Paiement/DemandeMiseEnPaiement.vue: 17 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -5,13 +5,18 @@
        </div>
        Chargement des demandes de mise en paiement en cours...
    </div>
    <div id="accordionPanelsStayOpenExample" class="accordion">

    <div v-if="this.datasDemandesMiseEnPaiement" id="accordionPanelsStayOpenExample" class="accordion">

        <demande-mise-en-paiement-structure @refresh-btn-state="btnResetState" v-for="(structure, code) in datasDemandesMiseEnPaiement"
                                            :datas="structure"
                                            :intervenant="intervenant"
                                            @refresh="getDemandesMiseEnPaiement"/>
    </div>
    <div v-if="!haveDemandeMiseEnPaiement && this.datasDemandesMiseEnPaiement"  class="text-center alert alert-secondary" role="alert">
        Les demandes de mises en paiement sont effectuées par la composante : {{ this.intervenantStructure}}
    </div>

</template>

<script>
@@ -25,6 +30,7 @@ export default {
    components: {DemandeMiseEnPaiementStructure},
    props: {
        intervenant: {required: false},
        intervenantStructure : {required: false}
    },
    data()
    {
@@ -76,6 +82,16 @@ export default {

        },

    },
    computed: {
      haveDemandeMiseEnPaiement: function() {
          if(this.datasDemandesMiseEnPaiement)
          {
              return Object.keys(this.datasDemandesMiseEnPaiement).length > 0;
          }
          return false;
      }

    },
    mounted()
    {
+10 −6
Changes for module/Paiement/src/Controller/DemandesController.php: 10 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ use Application\Controller\AbstractController;
use Application\Entity\Db\Validation;
use Application\Provider\Privilege\Privileges;
use Application\Service\Traits\ContextServiceAwareTrait;
use Application\Service\Traits\ParametresServiceAwareTrait;
use Application\Service\Traits\WorkflowServiceAwareTrait;
use Enseignement\Entity\Db\VolumeHoraire;
use Intervenant\Entity\Db\Intervenant;
@@ -33,6 +34,7 @@ class DemandesController extends AbstractController
    use DemandesServiceAwareTrait;
    use StructureServiceAwareTrait;
    use IntervenantServiceAwareTrait;
    use ParametresServiceAwareTrait;


    protected function initFilters(): void
@@ -120,9 +122,12 @@ class DemandesController extends AbstractController

    public function getDemandesMiseEnPaiementAction()
    {
        $structure = null;
        $structureRole = null;
        $role      = $this->getServiceContext()->getSelectedIdentityRole();
        $this->initFilters();
        /**
         * @var Intervenant $intervenant
         */
        $intervenant = $this->getEvent()->getParam('intervenant');
        //Un intervenant ne peut pas récuperer les datas de demande de mise en paiement
        if ($role->getIntervenant()) {
@@ -130,11 +135,10 @@ class DemandesController extends AbstractController
        }
        //$this->updateTableauxBord($intervenant);
        if ($role->getPerimetre()->isComposante()) {
            $structure = $role->getStructure();
            $structureRole = $role->getStructure();
        }

        $servicesAPayer = $this->getServiceDemandes()->getDemandeMiseEnPaiementResume($intervenant, $structure);

        $servicesAPayer = $this->getServiceDemandes()->getDemandeMiseEnPaiementResume($intervenant, $structureRole);

        return new AxiosModel($servicesAPayer);
    }
@@ -151,9 +155,9 @@ class DemandesController extends AbstractController
            //On redirige vers la visualisation des mises en paiement
            $this->redirect()->toRoute('intervenant/mise-en-paiement/visualisation', ['intervenant' => $intervenant->getId()]);
        }
        $intervenantStructure = ($intervenant->getStructure())?$intervenant->getStructure()->getLibelleCourt():'';


        return compact('intervenant');
        return compact('intervenant', 'intervenantStructure');
    }


+25 −4
Changes for module/Paiement/src/Service/DemandesService.php: 25 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ use Paiement\Entity\Db\CentreCout;
use Paiement\Entity\Db\MiseEnPaiement;
use Paiement\Entity\Db\TblPaiement;
use Referentiel\Entity\Db\ServiceReferentiel;
use UnicaenVue\View\Model\AxiosModel;

/**
 * Description of DemandesService
@@ -170,6 +171,25 @@ class DemandesService extends AbstractService
        $dmep = [];
        //Récupération du paramétrage des centres de cout pour les paiements
        $parametreCentreCout = $this->getServiceParametres()->get('centres_couts_paye');
        $intervenantStrucutre = $intervenant->getStructure();
        if($intervenantStrucutre instanceof Structure && $structure instanceof Structure)
        {
            if($parametreCentreCout == 'affectation')
            {   //Cas ou c'est la composante d'affectation qui fait les demandes de mises en paiement
                if($intervenantStrucutre->getId() == $structure->getId())
                {
                    /*Si j'ai un role avec un périmètre composante et que ma structure d'affectation est la même que
                    celle de l'intervenant j'accède à toutes les demandes de mise en paiement peu importe la structure
                    de l'enseignement réalisé de l'intervenant on ne filtre pas les dmep*/
                    $structure = null;
                }
                else{
                    //Sinon on ne doit voir aucune demande de mise en paiement
                    return $dmep;
                }
            }
        }


        $sql = "
        
@@ -496,16 +516,17 @@ class DemandesService extends AbstractService
            }


            //On alimente les centres couts disponibles pour ces demandes de mise en paiement
            //Si le paramétrage est affectation, on va chercher une fois pour toutes les centres de couts de paiement de la structure d'affectation de l'intervenant
            if ($parametreCentreCout == 'affectation' && empty($centresCoutsPaiementAffectation)) {
            /*On alimente les centres couts disponibles pour ces demandes de mise en paiement
            Si le paramétrage est affectation, on va chercher une fois pour toutes les centres de couts de paiement
            de la structure d'affectation de l'intervenant*/
            if ($parametreCentreCout == 'affectation' && empty($centresCoutsPaiementAffectation) && $intervenant->getStructure()) {
                $structure                       = $this->getServiceStructure()->get($intervenant->getStructure()->getId());
                $centresCoutsPaiementAffectation = $this->getServiceCentreCout()->getCentresCoutsMiseEnPaiement($structure);
            }

            if (!array_key_exists('centreCoutPaiement', $dmep[$value['STRUCTURE_CODE']])) {
                $dmep[$value['STRUCTURE_CODE']]['centreCoutPaiement'] = [];
                if ($parametreCentreCout == 'enseignement') {
                if ($parametreCentreCout == 'enseignement' || empty($intervenant->getStructure())) {
                    $structure    = $this->getServiceStructure()->get($value['STRUCTURE_ID']);
                    $centresCouts = $this->getServiceCentreCout()->getCentresCoutsMiseEnPaiement($structure);
                } else {
+1
Changes for module/Paiement/view/paiement/demandes/demande-mise-en-paiement.phtml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,5 +7,6 @@ $this->intervenant($intervenant)->renderTitle("Demande de mise en paiement");

echo $this->vue('paiement/demande-mise-en-paiement', [
    'intervenant' => $intervenant->getId(),
    'intervenantStructure' => $intervenantStructure,
]);
+1 −1
Changes for public/dist/.vite/manifest.json: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
    "name": "vendor"
  },
  "main.js": {
    "file": "assets/main-t-6bYXrv.js",
    "file": "assets/main-CAjqFYNN.js",
    "name": "main",
    "src": "main.js",
    "isEntry": true,
Loading