Commit 53ceff82 authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Possibilité de créer un intervenant sans structure d'affectation, sans...

Possibilité de créer un intervenant sans structure d'affectation, sans cvilité, sans pays de naissance.
A terme, seuls nom, prénom et date de naissance seront demandés pour pouvoir créer un nouvel intervenant
parent ae42824e
......@@ -80,7 +80,6 @@ return [
'Application\Entity\Db\Interfaces\IndicateurAwareInterface' => __DIR__ . '/src/Application/Entity/Db/Interfaces/IndicateurAwareInterface.php',
'Application\Entity\Db\Interfaces\ModificationServiceDuAwareInterface' => __DIR__ . '/src/Application/Entity/Db/Interfaces/ModificationServiceDuAwareInterface.php',
'Application\Entity\Db\Interfaces\TypeCentreCoutAwareInterface' => __DIR__ . '/src/Application/Entity/Db/Interfaces/TypeCentreCoutAwareInterface.php',
'Application\Entity\Db\Interfaces\CiviliteAwareInterface' => __DIR__ . '/src/Application/Entity/Db/Interfaces/CiviliteAwareInterface.php',
'Application\Entity\Db\Interfaces\MotifModificationServiceDuAwareInterface' => __DIR__ . '/src/Application/Entity/Db/Interfaces/MotifModificationServiceDuAwareInterface.php',
'Application\Entity\Db\Interfaces\VolumeHoraireAwareInterface' => __DIR__ . '/src/Application/Entity/Db/Interfaces/VolumeHoraireAwareInterface.php',
'Application\Entity\Db\Interfaces\VServiceValideAwareInterface' => __DIR__ . '/src/Application/Entity/Db/Interfaces/VServiceValideAwareInterface.php',
......@@ -220,7 +219,6 @@ return [
'Application\Entity\Db\Traits\TypeIntervenantAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/TypeIntervenantAwareTrait.php',
'Application\Entity\Db\Traits\VServiceValideAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/VServiceValideAwareTrait.php',
'Application\Entity\Db\Traits\FormuleResultatServiceReferentielAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/FormuleResultatServiceReferentielAwareTrait.php',
'Application\Entity\Db\Traits\CiviliteAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/CiviliteAwareTrait.php',
'Application\Entity\Db\Traits\VIndicAttenteDemandeMepAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/VIndicAttenteDemandeMepAwareTrait.php',
'Application\Entity\Db\Traits\AdresseIntervenantAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/AdresseIntervenantAwareTrait.php',
'Application\Entity\Db\Traits\CentreCoutEpAwareTrait' => __DIR__ . '/src/Application/Entity/Db/Traits/CentreCoutEpAwareTrait.php',
......
......@@ -325,109 +325,6 @@ class ContratController extends AbstractController
/**
*
* @todo A Supprimer!!!
* @deprecated
*/
public function exporterOldAction()
{
$this->initFilters();
$contrat = $this->getEvent()->getParam('contrat');
/* @var $contrat Contrat */
$intervenant = $contrat->getIntervenant();
if (!$this->isAllowed($contrat, ContratAssertion::PRIV_EXPORT)) {
throw new UnAuthorizedException("Génération du contrat interdite.");
}
$estUnAvenant = $contrat->estUnAvenant();
$contratToString = (string)$contrat;
$estUnProjet = $contrat->getValidation() ? false : true;
$contratIniModif = $estUnAvenant && $contrat->getContrat()->getStructure() === $contrat->getStructure() ? true : false;
$dateSignature = $estUnProjet ? $contrat->getHistoCreation() : $contrat->getValidation()->getHistoCreation();
$servicesRecaps = $this->getProcessusContrat()->getServicesRecaps($contrat); // récap de tous les services au sein de la structure d'ens
$totalHETD = $contrat->getTotalHetd() ?: $this->getProcessusContrat()->getIntervenantTotalHetd($intervenant);
$tauxHoraire = $this->getServiceTauxHoraireHETD()->getByDate($contrat->getHistoCreation());
$dossier = $this->getServiceDossier()->getByIntervenant($intervenant);
if ($dossier->getId()) {
$nomIntervenant = strtoupper($dossier->getNomUsuel()) . ' ' . ucfirst($dossier->getPrenom());
$nomUsuel = $dossier->getNomUsuel();
$dateNaissance = $dossier->getDateNaissance() ? $dossier->getDateNaissance()->format(Constants::DATE_FORMAT) : $intervenant->getAdressePrincipale(true);
$adresseIntervenant = $dossier->getAdresse();
$numeroINSEE = $dossier->getNumeroInsee();
$nomCompletIntervenant = $dossier->getCivilite() . ' ' . $nomIntervenant;
$estUneFemme = $dossier->getCivilite()->estUneFemme();
$estATV = $dossier->getStatut()->getTemAtv();
} else {
$nomIntervenant = (string)$intervenant;
$nomUsuel = $intervenant->getNomUsuel();
$dateNaissance = $intervenant->getDateNaissanceToString();
$adresseIntervenant = $intervenant->getAdressePrincipale(true);
$numeroINSEE = $intervenant->getNumeroInsee() . ' ' . $intervenant->getNumeroInseeCle();
$nomCompletIntervenant = $intervenant->getCivilite() . ' ' . $nomIntervenant;
$estUneFemme = $intervenant->getCivilite()->estUneFemme();
$estATV = $intervenant->getStatut()->getTemAtv();
}
$fileName = sprintf(($estUnAvenant ? 'avenant' : 'contrat') . "_%s_%s_%s.pdf",
$contrat->getStructure()->getCode(),
$nomUsuel,
$intervenant->getCode());
$variables = [
'estUnAvenant' => $estUnAvenant,
'estUnProjet' => $estUnProjet,
'contratIniModif' => $contratIniModif,
'etablissement' => $this->getServiceParametres()->get('contrat_etablissement'),
'etablissementRepresente' => $this->getServiceParametres()->get('contrat_etablissement_represente'),
'civilitePresident' => $this->getServiceParametres()->get('contrat_civilite_president'),
'lieuSignature' => $this->getServiceParametres()->get('contrat_lieu_signature'),
'nomIntervenant' => $nomIntervenant,
'f' => $estUneFemme,
'dateNaissance' => $dateNaissance,
'adresseIntervenant' => nl2br($adresseIntervenant),
'numeroINSEE' => $numeroINSEE,
'estATV' => $estATV,
'nomCompletIntervenant' => $nomCompletIntervenant,
'annee' => $intervenant->getAnnee(),
'dateSignature' => $dateSignature->format(Constants::DATE_FORMAT),
'servicesRecaps' => $servicesRecaps,
'totalHETD' => \UnicaenApp\Util::formattedFloat($totalHETD, \NumberFormatter::DECIMAL, 2),
'tauxHoraire' => $tauxHoraire,
];
// Création du pdf, complétion et envoi au navigateur
$exp = $this->pdf()
->setHeaderSubtitle($contratToString)
->setMarginBottom(25)
->setMarginTop(25);
$exp->setFooterTitle($contratToString . ' - ' . $intervenant->getAnnee());
if ($estUnProjet) {
$exp->setWatermark("Projet");
}
$variables['mentionRetourner'] = "EXEMPLAIRE À CONSERVER";
$exp->addBodyScript('application/contrat/contrat-pdf.phtml', false, $variables);
$variables['mentionRetourner'] = "EXEMPLAIRE À RETOURNER " . (($contrat->getStructure()->getAffAdresseContrat()) ? 'SIGNÉ À L\'ADRESSE SUIVANTE :<br />' : '');
$variables['mentionRetourner'] .= str_replace("\n", ' - ',
$contrat->getStructure()->getAffAdresseContrat() ?
strtoupper($contrat->getStructure()) . "\n" . $contrat->getStructure()->getAdressePrincipale()
: ''
);
$exp->addBodyScript('application/contrat/contrat-pdf.phtml', true, $variables, 1);
$exp->export($fileName, Pdf::DESTINATION_BROWSER_FORCE_DL);
die(); // pour éviter de générer une erreur par la suite
}
/**
* Dépôt du contrat signé.
*
......
......@@ -420,11 +420,11 @@ class IntervenantController extends AbstractController
}
$container->recents[$intervenant->getSourceCode()] = [
'civilite' => $intervenant->getCivilite()->getLibelleLong(),
'civilite' => $intervenant->getCivilite() ? $intervenant->getCivilite()->getLibelleLong() : null,
'nom' => $intervenant->getNomUsuel(),
'prenom' => $intervenant->getPrenom(),
'date-naissance' => $intervenant->getDateNaissance(),
'structure' => $intervenant->getStructure()->getLibelleCourt(),
'structure' => (string)$intervenant->getStructure(),
'numero-personnel' => $intervenant->getSourceCode(),
'__horo_ajout__' => (int)date('U'),
];
......
......@@ -156,7 +156,7 @@ class Dossier implements HistoriqueAwareInterface
*
* @return Dossier
*/
public function setCivilite(Civilite $civilite)
public function setCivilite($civilite)
{
$this->civilite = $civilite;
......
<?php
namespace Application\Entity\Db\Interfaces;
use Application\Entity\Db\Civilite;
/**
* Description of CiviliteAwareInterface
*
* @author UnicaenCode
*/
interface CiviliteAwareInterface
{
/**
* @param Civilite $civilite
* @return self
*/
public function setCivilite( Civilite $civilite = null );
/**
* @return Civilite
*/
public function getCivilite();
}
\ No newline at end of file
......@@ -1359,18 +1359,6 @@ class Intervenant implements HistoriqueAwareInterface, ResourceInterface, AnneeA
/**
* Get civilite
*
* @return string
*/
public function getCiviliteToString()
{
return $this->getCivilite()->getLibelleCourt();
}
/**
* Get affectations
*
......
......@@ -27,7 +27,7 @@
<field name="histoCreation" type="datetime" column="HISTO_CREATION" nullable="false"/>
<field name="histoDestruction" type="datetime" column="HISTO_DESTRUCTION" nullable="true"/>
<field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/>
<field name="nomPatronymique" type="string" column="NOM_PATRONYMIQUE" length="60" nullable="false"/>
<field name="nomPatronymique" type="string" column="NOM_PATRONYMIQUE" length="60" nullable="true"/>
<field name="nomUsuel" type="string" column="NOM_USUEL" length="60" nullable="false"/>
<field name="numeroInsee" type="string" column="NUMERO_INSEE" length="13" nullable="true"/>
<field name="numeroInseeCle" type="string" column="NUMERO_INSEE_CLE" length="2" nullable="true"/>
......
<?php
namespace Application\Entity\Db\Traits;
use Application\Entity\Db\Civilite;
/**
* Description of CiviliteAwareTrait
*
* @author UnicaenCode
*/
trait CiviliteAwareTrait
{
/**
* @var Civilite
*/
private $civilite;
/**
* @param Civilite $civilite
* @return self
*/
public function setCivilite( Civilite $civilite = null )
{
$this->civilite = $civilite;
return $this;
}
/**
* @return Civilite
*/
public function getCivilite()
{
return $this->civilite;
}
}
\ No newline at end of file
......@@ -50,7 +50,7 @@ class NomCompletFormatter extends AbstractFilter
$nomUsuel = $value->getNomUsuel();
$nomPatro = $value->getNomPatronymique();
$prenom = $value->getPrenom();
$civilite = $value->getCiviliteToString();
$civilite = (string)$value->getCivilite();
}
else if ($value instanceof People) {
/* @var $value People */
......@@ -62,17 +62,10 @@ class NomCompletFormatter extends AbstractFilter
else if ($value instanceof Utilisateur) {
/* @var $value Utilisateur */
$nomUsuel = $value->getDisplayName();
$nomPatro = $value->getDisplayName();
$nomPatro = null;
$prenom = '';
$civilite = '';
}
else if ($value instanceof Personnel) {
/* @var $value Personnel */
$nomUsuel = $value->getNomUsuel();
$nomPatro = $value->getNomPatronymique();
$prenom = $value->getPrenom();
$civilite = $value->getCiviliteToString();
}
else if ($value instanceof \stdClass) {
foreach (['nomUsuel', 'nomPatronymique', 'prenom', 'civilite'] as $prop) {
if (!isset($value->$prop)) {
......@@ -107,7 +100,7 @@ class NomCompletFormatter extends AbstractFilter
$parts = [
$this->prenomDabord ? "$prenom $nomUsuel" : "$nomUsuel $prenom",
$civilite,
$this->avecNomPatro && $nomPatro != $nomUsuel ? "née $nomPatro" : null,
$this->avecNomPatro && $nomPatro && $nomPatro != $nomUsuel ? "née $nomPatro" : null,
];
$result = implode(', ', array_filter($parts));
......
......@@ -3,7 +3,6 @@
namespace Application\Form\Intervenant;
use Application\Entity\Db\Intervenant;
use Application\Entity\Db\StatutIntervenant;
use Application\Form\AbstractForm;
use Application\Service\Traits\ContextServiceAwareTrait;
use Application\Service\Traits\DossierServiceAwareTrait;
......
......@@ -345,7 +345,7 @@ class DossierFieldset extends AbstractFieldset
'required' => true,
],
'nomPatronymique' => [
'required' => true,
'required' => false,
],
'prenom' => [
'required' => true,
......
......@@ -44,8 +44,8 @@ class RechercheProcessus
i.annee_id
FROM
intervenant i
JOIN structure s ON s.id = i.structure_id
JOIN civilite c ON c.id = i.civilite_id
LEFT JOIN structure s ON s.id = i.structure_id
LEFT JOIN civilite c ON c.id = i.civilite_id
WHERE
i.histo_destruction IS NULL
......@@ -64,8 +64,8 @@ class RechercheProcessus
i.annee_id
FROM
src_intervenant i
JOIN structure s ON s.id = i.structure_id
JOIN civilite c ON c.id = i.civilite_id
LEFT JOIN structure s ON s.id = i.structure_id
LEFT JOIN civilite c ON c.id = i.civilite_id
)
SELECT * FROM vrec WHERE
rownum <= ' . (int)$limit . ' AND annee_id = ' . $anneeId;
......@@ -144,8 +144,8 @@ class RechercheProcessus
i.annee_id
FROM
intervenant i
JOIN structure s ON s.id = i.structure_id
JOIN civilite c ON c.id = i.civilite_id
LEFT JOIN structure s ON s.id = i.structure_id
LEFT JOIN civilite c ON c.id = i.civilite_id
WHERE
i.histo_destruction IS NULL
)
......
......@@ -834,12 +834,12 @@ class ServiceService extends AbstractEntityService
//if ($c5 = $recherche->getNiveauFormation() ) $conditions['niveau_formation_id'] = '(niveau_formation_id = -1 OR niveau_formation_id = ' . $c5->getId().')';
if ($c6 = $recherche->getEtape()) $conditions['etape_id'] = '(etape_id = -1 OR etape_id = ' . $c6->getId() . ')';
if ($c7 = $recherche->getElementPedagogique()) $conditions['element_pedagogique_id'] = '(element_pedagogique_id = -1 OR element_pedagogique_id = ' . $c7->getId() . ')';
if ($c8 = $recherche->getStructureAff()) $conditions['structure_aff_id'] = '(structure_aff_id = -1 OR structure_aff_id = ' . $c8->getId() . ')';
if ($c8 = $recherche->getStructureAff()) $conditions['structure_aff_id'] = '(structure_aff_id IS NULL OR structure_aff_id = -1 OR structure_aff_id = ' . $c8->getId() . ')';
if ($c9 = $recherche->getStructureEns()) $conditions['structure_ens_id'] = '(structure_ens_id = -1 OR structure_ens_id = ' . $c9->getId() . ')';
if ($options['composante'] instanceof Structure) {
$id = (int)$options['composante']->getId();
$conditions['composante'] = "(structure_aff_id = -1 OR structure_aff_id = $id OR structure_ens_id = -1 OR structure_ens_id = $id)";
$conditions['composante'] = "(structure_aff_id IS NULL OR structure_aff_id = -1 OR structure_aff_id = $id OR structure_ens_id = -1 OR structure_ens_id = $id)";
}
switch ($options['tri']) {
......
......@@ -5,7 +5,7 @@ namespace Application\Service\Traits;
use Application\Service\CiviliteService;
/**
* Description of CiviliteAwareTrait
* Description of CiviliteServiceAwareTrait
*
* @author UnicaenCode
*/
......
......@@ -55,16 +55,14 @@ class IntervenantViewHelper extends AbstractHtmlElement
return '';
}
$adresse = $entity->getAdressePrincipale();
$vars = [
'identite' => [
"NOM prénom" => $entity,
"Civilité" => $entity->getCiviliteToString(),
"Date de naissance" => $entity->getDateNaissanceToString(),
"Ville de naissance" => $entity->getVilleNaissanceLibelle() ?: '<span class="inconnu">(Inconnue)</span>',
"Pays de naissance" => $entity->getPaysNaissance(),
"N° INSEE" => $entity->getNumeroInsee(),
"Civilité" => (string)$entity->getCivilite(),
"Date de naissance" => (string)$entity->getDateNaissanceToString(),
"Ville de naissance" => (string)$entity->getVilleNaissanceLibelle() ?: '<span class="inconnu">(Inconnue)</span>',
"Pays de naissance" => (string)$entity->getPaysNaissance(),
"N° INSEE" => (string)$entity->getNumeroInsee(),
],
'coordonnees' => [
"Email" => $entity->getEmail() ?: '<span class="inconnu">(Inconnu)</span>',
......
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