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

Modification de intervenant dossier, pour ne sauvegarder un nouveau dossier...

Modification de intervenant dossier, pour ne sauvegarder un nouveau dossier uniquement lorsque une action d'enregistrement est demandée par l'utilisateur, pour éviter de créer des dossiers en base automatiquement juste au première affichage (#38835).
parent b3ce9691
......@@ -404,9 +404,9 @@ class IntervenantDossierAssertion extends AbstractAssertion
$intervenantDossier = $this->getServiceDossier()->getByIntervenant($intervenant);
$isValidate = $this->getServiceDossier()->getValidation($intervenant);
return $this->asserts([
$intervenantDossier->getTblDossier()->getCompletude(),
(!empty($intervenantDossier->getTblDossier())) ? $intervenantDossier->getTblDossier()->getCompletude() : false,
!$isValidate,
$this->getRole()->hasPrivilege(Privileges::DOSSIER_VALIDATION),
]);
......
......@@ -66,41 +66,38 @@ class IntervenantDossierController extends AbstractController
}
/* Récupération du dossier de l'intervenant */
$intervenantDossier = $this->getServiceDossier()->getByIntervenant($intervenant);
/*Si dossier n'a pas encore d'id alors on le save et on calcule la completude*/
if (!$intervenantDossier->getId()) {
$this->getServiceDossier()->save($intervenantDossier);
$this->updateTableauxBord($intervenantDossier->getIntervenant());
}
/* Récupération de la validation du dossier si elle existe */
$intervenantDossierValidation = $this->getServiceDossier()->getValidation($intervenant);
$tblDossier = $intervenantDossier->getTblDossier();
if (!$tblDossier) {
$this->em()->refresh($intervenantDossier);
if (!$tblDossier and $intervenantDossier->getId()) {
//$this->em()->refresh($intervenantDossier);
$tblDossier = $intervenantDossier->getTblDossier();
}
$lastCompleted = (!empty($tblDossier)) ? $tblDossier->getCompletude() : '';
$lastCompleted = $tblDossier->getCompletude();
/* Initialisation du formulaire */
$form = $this->getIntervenantDossierForm($intervenant);
$form->bind($intervenantDossier);
//si on vient de post
if ($this->getRequest()->isPost()) {
//si on vient de post et que le dossier n'est pas encore validé
if ($this->getRequest()->isPost() && empty($intervenantDossierValidation)) {
$data = $this->getRequest()->getPost();
$form->setData($data);
if ($form->isValid()) {
/* Traitement du formulaire */
$intervenantDossier = $this->getServiceDossier()->save($intervenantDossier);
/*On reinitialise le formulaire car le statut du dossier a
pu être changé donc les règles d'affichage ne sont plus les mêmes*/
$form = $this->getIntervenantDossierForm($intervenant);
$form->bind($intervenantDossier);
//Alimentation de la table INDIC_MODIF_DOSSIER
$this->getServiceDossier()->updateIndicModifDossier($intervenant, $intervenantDossier);
//Recalcul des tableaux de bord nécessaires
$this->updateTableauxBord($intervenantDossier->getIntervenant());
$this->em()->refresh($tblDossier);
$this->em()->refresh($intervenantDossier);
$tblDossier = $intervenantDossier->getTblDossier();
$lastCompleted = $tblDossier->getCompletude();
/*On reinitialise le formulaire car le statut du dossier a
pu être changé donc les règles d'affichage ne sont plus les mêmes*/
$form = $this->getIntervenantDossierForm($intervenant);
$form->bind($intervenantDossier);
$this->flashMessenger()->addSuccessMessage('Enregistrement de vos données effectué');
//return $this->redirect()->toUrl($this->url()->fromRoute('intervenant/dossier', [], [], true));
......
......@@ -90,18 +90,25 @@ $fieldsets = $form->getFieldsets();
<?php if (!empty($formErrors)): ?>
<?= $this->formErrors($form); ?>
<?php else: ?>
<div class="messenger alert <?= ($tblDossier->getCompletude()) ? 'alert-success' : 'alert-warning' ?> ">
<?php if ($tblDossier->getCompletude() && $intervenantDossierValidation): ?>
Votre dossier est maintenant <span style="font-size:1em;" class="label label-success">Complet</span> et <span
style="font-size:1em;" class="label label-success">Validé</span>
<?php elseif ($tblDossier->getCompletude() && !$intervenantDossierValidation): ?>
Votre dossier est maintenant <span style="font-size:1em;"
class="label label-success">Complet</span> et en attente de validation par nos services
<?php else: ?>
Votre dossier est incomplet, merci de renseigner les informations obligatoires demandées dans les blocs
<span style="font-size:1em;" class="label label-warning">A compléter</span>
<?php endif; ?>
</div>
<?php if (!empty($tblDossier)): ?>
<div class="messenger alert <?= ($tblDossier->getCompletude()) ? 'alert-success' : 'alert-warning' ?> ">
<?php if ($tblDossier->getCompletude() && $intervenantDossierValidation): ?>
Votre dossier est maintenant <span style="font-size:1em;" class="label label-success">Complet</span> et <span
style="font-size:1em;" class="label label-success">Validé</span>
<?php elseif ($tblDossier->getCompletude() && !$intervenantDossierValidation): ?>
Votre dossier est maintenant <span style="font-size:1em;"
class="label label-success">Complet</span> et en attente de validation par nos services
<?php else: ?>
Votre dossier est incomplet, merci de renseigner les informations obligatoires demandées dans les blocs
<span style="font-size:1em;" class="label label-warning">A compléter</span>
<?php endif; ?>
</div>
<?php else: ?>
<div class="messenger alert alert-warning">
Veuillez vérifier / compléter vos données personnelles pré-renseignées et enregistrer celles-ci pour initialiser votre dossier.
</div>
<?php endif; ?>
<?php endif; ?>
......
......@@ -16,10 +16,12 @@ $dossierAdresse = $form->get('DossierAdresse');
<div class="panel panel-default">
<div class="panel-heading">
ADRESSE
<?php if (!$tblDossier->getCompletudeAdresse()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$tblDossier->getCompletudeAdresse()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -21,10 +21,12 @@ $dossierAdresse = $form->get('DossierAdresse'); /* @var $dossier \Application\Fo
<div class="panel panel-default">
<div class="panel-heading">
ADRESSE
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeAdresse()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeAdresse()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -31,10 +31,12 @@ $dossierAutres = $form->get('DossierAutres');
<div class="panel-heading">
AUTRES
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeAutres()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeAutres()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
......
......@@ -27,11 +27,14 @@ $dossierBancaire = $form->get('DossierBancaire');
<div class="panel panel-default ">
<div class="panel-heading">
COORDONNÉES BANCAIRES
<?php if (!$tblDossier->getCompletudeIban()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$tblDossier->getCompletudeIban()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
<?php
......
......@@ -20,10 +20,12 @@ $dossierBancaire = $form->get('DossierBancaire');
<div class="panel panel-default ">
<div class="panel-heading">
COORDONNÉES BANCAIRES
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeIban()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeIban()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -30,10 +30,12 @@ $dossierContact = $form->get('DossierContact');
<div class="panel panel-default ">
<div class="panel-heading">
CONTACT
<?php if (!$tblDossier->getCompletudeContact()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$tblDossier->getCompletudeContact()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -27,10 +27,12 @@ $dossierContact = $form->get('DossierContact');
<div class="panel panel-default ">
<div class="panel-heading">
CONTACT
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeContact()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeContact()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -30,10 +30,12 @@ $dossierInsee = $form->get('DossierEmployeur');
<div class="panel panel-default ">
<div class="panel-heading">
EMPLOYEUR
<?php if (!$tblDossier->getCompletudeEmployeur()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$tblDossier->getCompletudeEmployeur()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -20,11 +20,14 @@ $dossierEmployeur = $form->get('DossierEmployeur');
<div class="panel panel-default ">
<div class="panel-heading">
EMPLOYEUR
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeEmployeur()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeEmployeur()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
<div class="form-group">
......
......@@ -22,10 +22,12 @@ $dossierIdentite = $form->get('DossierIdentite');
<div class="panel panel-default">
<div class="panel-heading">
IDENTITÉ
<?php if (!$tblDossier->getCompletudeIdentite()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$tblDossier->getCompletudeIdentite()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -22,10 +22,12 @@ $dossierIdentiteComplementaire = $form->get('DossierIdentiteComplementaire');
<div class="panel panel-default">
<div class="panel-heading">
IDENTITÉ COMPLEMENTAIRE
<?php if (!$tblDossier->getCompletudeIdentiteComp()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$tblDossier->getCompletudeIdentiteComp()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -30,11 +30,14 @@ $dossierIdentiteComplementaire = $form->get('DossierIdentiteComplementaire');
<div class="panel panel-default">
<div class="panel-heading">
IDENTITÉ COMPLEMENTAIRE
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeIdentiteComp()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeIdentiteComp()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -30,10 +30,12 @@ $dossierIdentite = $form->get('DossierIdentite');
<div class="panel panel-default">
<div class="panel-heading">
IDENTITÉ
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeIdentite()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeIdentite()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -28,10 +28,12 @@ $dossierInsee = $form->get('DossierInsee');
<div class="panel panel-default ">
<div class="panel-heading">
INSEE
<?php if (!$tblDossier->getCompletudeInsee()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$tblDossier->getCompletudeInsee()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -25,10 +25,12 @@ $dossierInsee = $form->get('DossierInsee');
<div class="panel panel-default ">
<div class="panel-heading">
INSEE
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeInsee()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$intervenantDossier->getTblDossier()->getCompletudeInsee()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -27,10 +27,12 @@ $dossierStatut = $form->get('DossierStatut');
<div class="panel panel-default ">
<div class="panel-heading">
STATUT
<?php if (!$tblDossier->getCompletudeStatut()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php if (!empty($tblDossier)): ?>
<?php if (!$tblDossier->getCompletudeStatut()): ?>
<span class="label label-warning">A compléter</span>
<?php else: ?>
<span class="label label-success">Complet</span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="panel-body">
......
......@@ -180,7 +180,9 @@ Util = {
{},
function ()
{
window.location.reload();
//Préférable pour éviter de re-soumettre des posts lors d'un changement d'année
window.location = window.location.href;
//window.location.reload();
}
);
},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment