Commit 1f4b0d88 authored by lecluse's avatar lecluse
Browse files

Erradication du type d'intervenant directement accessible depuis l'intervenant.

Le type se déduit désormais du statut (c'est + propre)
parent 914764a4
select q'[o'connor]' from dual;
\ No newline at end of file
select q'[o'connor]' from dual;
select
annee_id, annee_debut_id, annee_fin_id, res res_attendu,
case when
annee_id BETWEEN GREATEST(NVL(annee_debut_id,0),annee_id) AND LEAST(NVL(annee_fin_id,9999),annee_id)
then 1 else 0 end res_calcule from (
SELECT 2014 annee_id, null annee_debut_id, null annee_fin_id, 1 res FROM dual
UNION ALL SELECT 2014 annee_id, 2014 annee_debut_id, 2014 annee_fin_id, 1 res FROM dual
UNION ALL SELECT 2014 annee_id, null annee_debut_id, 2014 annee_fin_id, 1 res FROM dual
UNION ALL SELECT 2014 annee_id, 2014 annee_debut_id, null annee_fin_id, 1 res FROM dual
UNION ALL SELECT 2014 annee_id, 2012 annee_debut_id, 2015 annee_fin_id, 1 res FROM dual
UNION ALL SELECT 2014 annee_id, null annee_debut_id, 2015 annee_fin_id, 1 res FROM dual
UNION ALL SELECT 2014 annee_id, 2012 annee_debut_id, null annee_fin_id, 1 res FROM dual
UNION ALL SELECT 2014 annee_id, 2015 annee_debut_id, 2017 annee_fin_id, 0 res FROM dual
UNION ALL SELECT 2014 annee_id, 2015 annee_debut_id, null annee_fin_id, 0 res FROM dual
UNION ALL SELECT 2014 annee_id, 2011 annee_debut_id, 2013 annee_fin_id, 0 res FROM dual
UNION ALL SELECT 2014 annee_id, null annee_debut_id, 2013 annee_fin_id, 0 res FROM dual
) t1;
\ No newline at end of file
select * from intervenant where id = 3679;
select * from intervenant where source_code = '34424' AND annee_id = 2014;
update intervenant set statut_id = 4, type_id=1 WHERE id = 3112;
update intervenant set statut_id = 4, type_id=1 WHERE id = 3681;
select * from statut_intervenant;
select * from type_intervenant;
\ No newline at end of file
......@@ -1141,7 +1141,7 @@ class Intervenant implements IntervenantInterface, HistoriqueAwareInterface, Res
* @param \Application\Entity\Db\TypeIntervenant $type
*
* @return Intervenant
*/
*
public function setType(\Application\Entity\Db\TypeIntervenant $type = null)
{
$this->type = $type;
......@@ -1155,11 +1155,11 @@ class Intervenant implements IntervenantInterface, HistoriqueAwareInterface, Res
* Get type
*
* @return \Application\Entity\Db\TypeIntervenant
*/
*
public function getType()
{
return $this->type;
}
}*/
......
......@@ -96,11 +96,11 @@
<join-column name="HISTO_CREATEUR_ID" referenced-column-name="ID"/>
</join-columns>
</many-to-one>
<many-to-one field="type" target-entity="Application\Entity\Db\TypeIntervenant">
<!--<many-to-one field="type" target-entity="Application\Entity\Db\TypeIntervenant">
<join-columns>
<join-column name="TYPE_ID" referenced-column-name="ID"/>
</join-columns>
</many-to-one>
</many-to-one>-->
<many-to-one field="dossier" target-entity="Application\Entity\Db\Dossier">
<join-columns>
<join-column name="DOSSIER_ID" referenced-column-name="ID"/>
......
......@@ -6,6 +6,8 @@ use Application\Entity\Db\Intervenant as IntervenantEntity;
use Application\Entity\Db\Structure as StructureEntity;
use Application\Entity\Db\Periode as PeriodeEntity;
use Application\Entity\Db\Annee as AnneeEntity;
use Application\Entity\Db\TypeIntervenant;
use Application\Service\Traits\StatutIntervenantAwareTrait;
use Common\Exception\RuntimeException;
use Doctrine\ORM\QueryBuilder;
use Import\Processus\Import;
......@@ -17,6 +19,10 @@ use Import\Processus\Import;
*/
class Intervenant extends AbstractEntityService
{
use StatutIntervenantAwareTrait;
/**
* Recherche par :
* - id source exact (numéro Harpege ou autre),
......@@ -72,7 +78,7 @@ class Intervenant extends AbstractEntityService
*/
public function getEntityClass()
{
return 'Application\Entity\Db\Intervenant';
return IntervenantEntity::class;
}
......@@ -252,14 +258,16 @@ class Intervenant extends AbstractEntityService
/**
* Recherche d'intervenant par le "source code" et l'année.
*
* @param string $sourceCode Code de l'intervenant dans la source de données (ex: numéro Harpege)
* @param AnneeEntity $annee Année concernée
* @param string $sourceCode Code de l'intervenant dans la source de données (ex: numéro Harpege)
* @param AnneeEntity $annee Année concernée
* @param QueryBuilder|null $queryBuilder
* @param string|null $alias
*
* @return QueryBuilder
*/
public function finderBySourceCodeAndAnnee($sourceCode, AnneeEntity $annee, QueryBuilder $qb = null)
public function finderBySourceCodeAndAnnee($sourceCode, AnneeEntity $annee, QueryBuilder $qb = null, $alias = null)
{
list($qb, $alias) = $this->initQuery($qb);
list($qb, $alias) = $this->initQuery($qb, $alias);
$qb
->andWhere("$alias.sourceCode = :code AND $alias.annee = :annee")
->setParameter('code', $sourceCode)
......@@ -267,4 +275,26 @@ class Intervenant extends AbstractEntityService
return $qb;
}
/**
* Filtre par le type d'intervenant
*
* @param TypeIntervenant $typeIntervenant Type de l'intervenant
* @param QueryBuilder|null $queryBuilder
* @param string|null $alias
*
* @return QueryBuilder
*/
public function finderByType(TypeIntervenant $typeIntervenant, QueryBuilder $qb = null, $alias = null)
{
list($qb, $alias) = $this->initQuery($qb, $alias);
$sStatut = $this->getServiceStatutIntervenant();
$this->join($sStatut, $qb, 'statut', false, $alias);
$sStatut->finderByTypeIntervenant($typeIntervenant, $qb);
return $qb;
}
}
......@@ -70,7 +70,7 @@ class IntervenantViewHelper extends AbstractHtmlElement
"Adresse" => nl2br($entity->getAdressePrincipale()),
],
'metier' => [
"Type d'intervenant" => $entity->getType(),
"Type d'intervenant" => $entity->getStatut()->getTypeIntervenant(),
"Statut de l'intervenant" => $entity->getStatut(),
"N° {$entity->getSource()}" => $entity->getSourceCode(),
"Affectation principale" => $entity->getStructure() ?: "(Inconnue)",
......
<h3><?php echo $intervenant ?> <small><?php echo $intervenant->getType() ?></small></h3>
<h3><?php echo $intervenant ?> <small><?php echo $intervenant->getStatut()->getTypeIntervenant() ?></small></h3>
<?php echo $this->intervenant($intervenant) ?>
......@@ -24,7 +24,7 @@ $this->headTitle()->append($intervenant->getNomUsuel())->append("Heures compl.")
<style>
th { background-color: #eee }
</style>
<h1 class="page-header"><?php echo $intervenant ?> <small><?php echo $intervenant->getType() ?></small></h1>
<h1 class="page-header"><?php echo $intervenant ?> <small><?php echo $intervenant->getStatut()->getTypeIntervenant() ?></small></h1>
<?php echo $this->form()->openTag($form->prepare()); ?>
<div class="row">
<div class="col-sm-4"><?php echo $this->formControlGroup($form->get('type-volume-horaire')); ?></div>
......
<?php $this->headTitle()->append($intervenant->getNomUsuel())->append("Fiche") ?>
<h1 class="page-header"><?php echo $intervenant ?> <small><?php echo $intervenant->getType() ?></small></h1>
<h1 class="page-header"><?php echo $intervenant ?> <small><?php echo $intervenant->getStatut()->getTypeIntervenant() ?></small></h1>
<?php echo $this->intervenant($intervenant) ?>
......
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