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

Correction bug duplication de statuts

parent 9e50239b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3,6 +3,14 @@ title: "Changements intervenus sur OSE"
author: Laurent Lécluse - DSI - Unicaen
---

# OSE 9.0.2-zf2 et 9.0.2-zf3

## Correction de bugs

* Un bug modifiant les paramètres globaux qui avaient été configurés a été résolu
* La duplication de statuts refonctionne


# OSE 9.0.1-zf2 et 9.0.1-zf3

## Correction de bugs
+28 −29
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ use Application\Form\StatutIntervenant\Traits\StatutIntervenantSaisieFormAwareTr
use Application\Service\Traits\StatutIntervenantServiceAwareTrait;
use UnicaenApp\View\Model\MessengerViewModel;
use Application\Service\Traits\TypeIntervenantServiceAwareTrait;
use Zend\View\Model\ViewModel;

class StatutIntervenantController extends AbstractController
{
@@ -69,6 +70,33 @@ class StatutIntervenantController extends AbstractController



    public function cloneAction()
    {
        /* @var $statutIntervenant StatutIntervenant */
        $statutIntervenant    = $this->getEvent()->getParam('statutIntervenant');
        $newStatutIntervenant = $statutIntervenant->dupliquer();
        $newStatutIntervenant->setOrdre($this->getServiceStatutIntervenant()->fetchMaxOrdre() + 1);
        $form                 = $this->getFormStatutIntervenantSaisie();
        $title                = 'Duplication d\'un statut d\'intervenant';

        $form->bindRequestSave($newStatutIntervenant, $this->getRequest(), function (StatutIntervenant $si) {
            try {
                $this->getServiceStatutIntervenant()->save($si);
                $this->flashMessenger()->addSuccessMessage('Duplication effectuée');
            } catch (\Exception $e) {
                $this->flashMessenger()->addErrorMessage($this->translate($e));
            }
        });

        $viewModel = new ViewModel();
        $viewModel->setVariables(compact('form', 'title'));
        $viewModel->setTemplate('application/statut-intervenant/saisie');

        return $viewModel;
    }



    public function deleteAction()
    {
        $statutIntervenant = $this->getEvent()->getParam('statutIntervenant');
@@ -114,34 +142,5 @@ class StatutIntervenantController extends AbstractController
        return new JsonModel(['msg' => 'Tri des champs effectué']);
    }



    public function cloneAction()
    {
        /* @var $statutIntervenant StatutIntervenant */
        $statutIntervenant = $this->getEvent()->getParam('statutIntervenant');
        $form              = $this->getFormStatutIntervenantSaisie();

        $title                = 'Duplication d\'un statut d\'intervenant';
        $newStatutIntervenant = $statutIntervenant->dupliquer();
        $newStatutIntervenant->setOrdre($this->getServiceStatutIntervenant()->fetchMaxOrdre() + 1);
        //$statutIntervenantNew->setOrdre($this->getServiceStatutIntervenant()->fetchMaxOrdre()+1);
        $form->bind($newStatutIntervenant);
        $request = $this->getRequest();
        if ($request->isPost()) {
            $form->setData($request->getPost());
            if ($form->isValid()) {
                try {
                    $this->getServiceStatutIntervenant()->save($newStatutIntervenant);
                    $form->get('id')->setValue($newStatutIntervenant->getId()); // transmet le nouvel ID
                    $this->flashMessenger()->addSuccessMessage('Enregistrement effectué');
                } catch (\Exception $e) {
                    $errors[] = $this->translate($e);
                }
            }
        }

        return compact('form', 'title');
    }
}
+0 −100
Original line number Diff line number Diff line
<?php

use Application\Provider\Privilege\Privileges;

/**
 * @var $this  \Application\View\Renderer\PhpRenderer
 * @var $form  \Application\Form\StatutIntervenant\StatutIntervenantSaisieForm
 */

$canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::INTERVENANT_STATUT_EDITION));
echo $this->form()->openTag($form); ?>

<style>
    .temoins {
        margin-left: 0px;
    }

    .temoins .form-group {
        margin-bottom: 1px;
    }

    .temoins .form-group .checkbox {
        margin-top: 1px;
        margin-bottom: 1px;
    }

    .atvb {
        margin-top: 20px;
    }

    .hetd {
        background-color: white;
        vertical-align: bottom;
        border-width: 0;
    }

</style>
<div class="panel panel-default">
    <div class="panel-body">
        <div class="row">
            <div class="col-md-9">
                <div class="row">
                    <div class="col-md-4">
                        <?= $this->formControlGroup($form->get('type-intervenant')); ?>
                    </div>
                    <div class="col-md-8">
                        <?= $this->formControlGroup($form->get('libelle')); ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-4">
                        <?= $this->formControlGroup($form->get('code')); ?>
                    </div>
                    <div class="col-md-2 atvb">
                        <?= $this->formControlGroup($form->get('TEM-ATV')); ?>
                    </div>
                    <div class="col-md-4 atvb">
                        <?= $this->formControlGroup($form->get('TEM-BIATSS')); ?>
                    </div>
                </div>
                <div class="row temoins">
                    <?= $this->formControlGroup($form->get('non-autorise')); ?>
                    <?= $this->formControlGroup($form->get('depassement')); ?>
                    <?= $this->formControlGroup($form->get('peut-saisir-referentiel')); ?>
                    <?= $this->formControlGroup($form->get('peut-saisir-service')); ?>
                    <?= $this->formControlGroup($form->get('peut-choisir-dans-dossier')); ?>
                    <?= $this->formControlGroup($form->get('peut-avoir-contrat')); ?>
                    <?= $this->formControlGroup($form->get('peut-saisir-dossier')); ?>
                    <?= $this->formControlGroup($form->get('peut-saisir-motif-non-paiement')); ?>
                    <?= $this->formControlGroup($form->get('peut-cloturer-saisie')); ?>
                    <?= $this->formControlGroup($form->get('peut-saisir-service-ext')); ?>
                    <?= $this->formControlGroup($form->get('depassement-sdshc')); ?>
                    <br/>
                    <?= $this->formControlGroup($form->get('security')); ?>
                    <?= $this->formSubmit($form->get('submit')); ?>
                </div>
            </div>
            <div class="col-md-3">
                <?= $this->formControlGroup($form->get('service-statutaire')); ?>
                <?= $this->formControlGroup($form->get('plafond-referentiel')); ?>
                <?= $this->formControlGroup($form->get('maximum-HETD')); ?>
                <?= $this->formControlGroup($form->get('plafond-h-h-c')); ?>
                <?= $this->formControlGroup($form->get('plafond-h-c')); ?>
            </div>
        </div>
    </div>


    <?php
    echo $this->form()->closeTag();
    echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
    ?>
    <script type="text/javascript">
        $(function () {
            $("body").on("statut-intervenant-clone", function (event, data) {
                console.log('toto');
                window.location.reload();
            });
        });
    </script>