Commit 21bfd01d authored by lecluse's avatar lecluse
Browse files

Disciplines + Refactoring + bugs

parent 4601d712
......@@ -7,7 +7,6 @@ use Application\Acl\ComposanteRole;
use Application\Acl\DrhRole;
use Application\Acl\EtablissementRole;
use Application\Acl\IntervenantRole;
use Application\Entity\Db\IntervenantPermanent;
use Application\Entity\Db\Intervenant;
use Application\Entity\Db\Service;
use Zend\Permissions\Acl\Acl;
......
......@@ -5,7 +5,7 @@ namespace Application\Controller;
use Application\Acl\IntervenantRole;
use Application\Controller\Plugin\Context;
use Application\Entity\Db\Intervenant;
use Application\Entity\Db\IntervenantExterieur;
use Application\Entity\Db\Intervenant;
use Application\Entity\Db\StatutIntervenant;
use Application\Entity\Db\Listener\DossierListener;
use Application\Entity\Db\TypeValidation;
......@@ -52,7 +52,7 @@ class DossierController extends AbstractActionController implements WorkflowInte
/**
* @var IntervenantExterieur
* @var Intervenant
*/
private $intervenant;
......@@ -76,7 +76,6 @@ class DossierController extends AbstractActionController implements WorkflowInte
{
$this->em()->getFilters()->enable('historique')->init([
'Application\Entity\Db\Intervenant',
'Application\Entity\Db\IntervenantExterieur',
'Application\Entity\Db\Validation',
'Application\Entity\Db\TypeValidation',
'Application\Entity\Db\Dossier',
......@@ -127,7 +126,7 @@ class DossierController extends AbstractActionController implements WorkflowInte
}
// refetch intervenant avec jointure sur dossier (et respect de l'historique)
$qb = $this->em()->getRepository('Application\Entity\Db\IntervenantExterieur')->createQueryBuilder("i")
$qb = $this->em()->getRepository('Application\Entity\Db\Intervenant')->createQueryBuilder("i")
->select("i, d")
->leftJoin("i.dossier", "d")
->andWhere("i = :i")
......
......@@ -5,7 +5,7 @@ namespace Application\Controller;
use Application\Assertion\FichierAssertion;
use Application\Assertion\PieceJointeAssertion;
use Application\Entity\Db\Fichier;
use Application\Entity\Db\IntervenantExterieur;
use Application\Entity\Db\Intervenant;
use Application\Entity\Db\PieceJointe;
use Application\Entity\Db\TypePieceJointe;
use Application\Entity\Db\TypePieceJointeStatut;
......@@ -89,7 +89,7 @@ class PieceJointeController extends AbstractActionController implements Workflow
{
$this->initFilters();
if (!$this->getIntervenant() instanceof IntervenantExterieur) {
if ($this->getIntervenant()->estPermanent()) {
throw new MessageException("Les pièces justificatives ne concernent que les intervenants extérieurs.");
}
......@@ -469,7 +469,7 @@ class PieceJointeController extends AbstractActionController implements Workflow
/**
* @var IntervenantExterieur
* @var Intervenant
*/
private $intervenant;
......
......@@ -11,7 +11,6 @@ use Application\Service\Traits\VolumeHoraireReferentielAwareTrait;
use Zend\Mvc\Controller\AbstractActionController;
use Common\Exception\MessageException;
use Application\Exception\DbException;
use Application\Entity\Db\IntervenantPermanent;
use Application\Entity\Service\Recherche;
use Application\Service\Traits\ContextAwareTrait;
......
......@@ -59,7 +59,7 @@ class ValidationController extends AbstractActionController
private $isReferentiel;
/**
* @var \Application\Entity\Db\IntervenantExterieur
* @var \Application\Entity\Db\Intervenant
*/
private $intervenant;
......
......@@ -24,7 +24,7 @@ class Contrat implements HistoriqueAwareInterface, ResourceInterface
private $typeContrat;
/**
* @var \Application\Entity\Db\IntervenantExterieur
* @var \Application\Entity\Db\Intervenant
*/
private $intervenant;
......@@ -226,11 +226,11 @@ class Contrat implements HistoriqueAwareInterface, ResourceInterface
/**
* Set intervenant
*
* @param \Application\Entity\Db\IntervenantExterieur $intervenant
* @param \Application\Entity\Db\Intervenant $intervenant
*
* @return self
*/
public function setIntervenant(\Application\Entity\Db\IntervenantExterieur $intervenant = null)
public function setIntervenant(\Application\Entity\Db\Intervenant $intervenant = null)
{
$this->intervenant = $intervenant;
......@@ -242,7 +242,7 @@ class Contrat implements HistoriqueAwareInterface, ResourceInterface
/**
* Get intervenant
*
* @return \Application\Entity\Db\IntervenantExterieur
* @return \Application\Entity\Db\Intervenant
*/
public function getIntervenant()
{
......
......@@ -553,10 +553,10 @@ class Dossier implements HistoriqueAwareInterface
/**
*
* @param \Application\Entity\Db\IntervenantExterieur $intervenant
* @param \Application\Entity\Db\Intervenant $intervenant
* @return \Application\Entity\Db\Dossier
*/
public function fromIntervenant(IntervenantExterieur $intervenant)
public function fromIntervenant(Intervenant $intervenant)
{
$this
->setNomUsuel($intervenant->getNomUsuel())
......
<?php
namespace Application\Entity\Db;
use UnicaenApp\Entity\HistoriqueAwareInterface;
use UnicaenApp\Entity\HistoriqueAwareTrait;
......@@ -9,12 +10,10 @@ use UnicaenApp\Entity\HistoriqueAwareTrait;
*/
class TypeIntervenant implements HistoriqueAwareInterface
{
use HistoriqueAwareTrait;
CONST CODE_PERMANENT = 'P';
CONST CODE_EXTERIEUR = 'E';
public $classToCode = [
'Application\Entity\Db\IntervenantPermanent' => 'P',
'Application\Entity\Db\IntervenantExterieur' => 'E',
];
use HistoriqueAwareTrait;
/**
* @var string
......@@ -101,13 +100,6 @@ class TypeIntervenant implements HistoriqueAwareInterface
CONST CODE_PERMANENT = 'P';
CONST CODE_EXTERIEUR = 'E';
CONST TYPE_PERMANENT = 1;
CONST TYPE_EXTERIEUR = 2;
/**
* Retourne la représentation littérale de cet objet.
*
......
<?php
namespace Application\Entity\Db;
use UnicaenApp\Entity\HistoriqueAwareInterface;
use UnicaenApp\Entity\HistoriqueAwareTrait;
/**
* TypeIntervenantExterieur
*/
class TypeIntervenantExterieur implements HistoriqueAwareInterface
{
use HistoriqueAwareTrait;
/**
* @var string
*/
protected $libelle;
/**
* @var float
*/
protected $limiteHeuresComplementaires;
/**
* @var integer
*/
protected $id;
/**
* Set libelle
*
* @param string $libelle
*
* @return TypeIntervenantExterieur
*/
public function setLibelle($libelle)
{
$this->libelle = $libelle;
return $this;
}
/**
* Get libelle
*
* @return string
*/
public function getLibelle()
{
return $this->libelle;
}
/**
* Set limiteHeuresComplementaires
*
* @param float $limiteHeuresComplementaires
*
* @return TypeIntervenantExterieur
*/
public function setLimiteHeuresComplementaires($limiteHeuresComplementaires)
{
$this->limiteHeuresComplementaires = $limiteHeuresComplementaires;
return $this;
}
/**
* Get limiteHeuresComplementaires
*
* @return float
*/
public function getLimiteHeuresComplementaires()
{
return $this->limiteHeuresComplementaires;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
}
......@@ -62,7 +62,7 @@ class Dossier extends Form implements ServiceLocatorAwareInterface
public function bind($object, $flags = FormInterface::VALUES_NORMALIZED)
{
if ($object->estPermanent()) {
throw new LogicException("Ce formulaire ne peut être bindé qu'à un IntervenantExterieur.");
throw new LogicException("Ce formulaire ne peut être bindé qu'à un vacataire.");
}
return parent::bind($object, $flags);
......
......@@ -2,7 +2,7 @@
namespace Application\Form\Intervenant;
use Application\Entity\Db\Dossier as DossierEntity;
use Application\Entity\Db\IntervenantExterieur;
use Application\Entity\Db\Intervenant;
use Application\Entity\Db\StatutIntervenant;
use Zend\Stdlib\Hydrator\HydratorInterface;
......@@ -25,8 +25,8 @@ class DossierHydrator implements HydratorInterface
* Hydrate $object with the provided $data.
*
* @param array $data
* @param IntervenantExterieur $intervenant
* @return IntervenantExterieur
* @param Intervenant $intervenant
* @return Intervenant
*/
public function hydrate(array $data, $intervenant)
{
......@@ -47,7 +47,7 @@ class DossierHydrator implements HydratorInterface
/**
* Extract values from an object
*
* @param IntervenantExterieur $intervenant
* @param Intervenant $intervenant
* @return array
*/
public function extract($intervenant)
......
......@@ -10,7 +10,7 @@ use Zend\ServiceManager\ServiceLocatorAwareTrait;
use Application\Acl\ComposanteRole;
use Application\Acl\IntervenantRole;
use Zend\InputFilter\InputFilterProviderInterface;
use Application\Entity\Db\IntervenantExterieur;
/**
* Description of SaisieFieldset
......@@ -70,7 +70,7 @@ class SaisieFieldset extends Fieldset implements InputFilterProviderInterface, S
$this->add($intervenant);
}
if (!($identityRole instanceof IntervenantRole && $identityRole->getIntervenant() instanceof IntervenantExterieur)){
if (!($identityRole instanceof IntervenantRole && !$identityRole->getIntervenant()->estPermanent())){
$this->add([
'type' => 'Radio',
'name' => 'interne-externe',
......
......@@ -3,7 +3,6 @@
namespace Application\Rule\Intervenant;
use Application\Entity\Db\Contrat;
use Application\Entity\Db\IntervenantExterieur;
use Application\Entity\Db\TypeContrat;
use Application\Entity\Db\Validation;
use Application\Entity\Db\VolumeHoraire;
......@@ -63,7 +62,7 @@ class PeutCreerContratInitialRule extends PeutCreerContratAbstractRule
public function isRelevant()
{
return $this->getIntervenant() instanceof IntervenantExterieur;
return !$this->getIntervenant()->estPermanent();
}
/**
......
......@@ -2,10 +2,8 @@
namespace Application\Rule\Intervenant;
use Application\Entity\Db\IntervenantExterieur;
use Application\Traits\StructureAwareTrait;
use Application\Traits\TypeContratAwareTrait;
use Common\Exception\LogicException;
use Doctrine\ORM\QueryBuilder;
/**
......@@ -68,7 +66,7 @@ class PossedeContratRule extends AbstractIntervenantRule
public function getQueryBuilder()
{
$qb = $this->getServiceIntervenant()->getEntityManager()->createQueryBuilder()
->from("Application\Entity\Db\IntervenantExterieur", "i")
->from("Application\Entity\Db\Intervenant", "i")
->select("i.id")
->join("i.contrat", "c");
......@@ -97,7 +95,7 @@ class PossedeContratRule extends AbstractIntervenantRule
public function isRelevant()
{
if ($this->getIntervenant()) {
return $this->getIntervenant() instanceof IntervenantExterieur;
return !$this->getIntervenant()->estPermanent();
}
return true;
......
......@@ -2,7 +2,6 @@
namespace Application\Rule\Intervenant;
use Application\Entity\Db\IntervenantExterieur;
use Common\Exception\LogicException;
/**
......@@ -71,13 +70,13 @@ class PossedeDossierRule extends AbstractIntervenantRule
public function getQueryBuilder()
{
$em = $this->getServiceIntervenant()->getEntityManager();
$qb = $em->getRepository('Application\Entity\Db\IntervenantExterieur')->createQueryBuilder("i")
$qb = $em->getRepository('Application\Entity\Db\Intervenant')->createQueryBuilder("i")
->select("i.id")
->join("i.dossier", "d");
if ($this->getIntervenant()) {
if (!$this->getIntervenant() instanceof IntervenantExterieur) {
throw new LogicException("L'intervenant spécifié doit être un IntervenantExterieur.");
if ($this->getIntervenant()->estPermanent()) {
throw new LogicException("L'intervenant spécifié doit être un vacataire.");
}
$qb->andWhere("i = " . $this->getIntervenant()->getId());
......
......@@ -8,7 +8,6 @@ use Application\Entity\Db\Annee as AnneeEntity;
use Application\Entity\Db\Structure as StructureEntity;
use \DateTime;
use Zend\Session\Container;
use \Application\Interfaces\StructureAwareInterface;
/**
* Service fournissant les différents contextes de fonctionnement de l'application.
......@@ -17,12 +16,12 @@ use \Application\Interfaces\StructureAwareInterface;
*/
class Context extends AbstractService
{
use Traits\EtablissementAwareTrait,
Traits\AnneeAwareTrait,
Traits\IntervenantAwareTrait,
Traits\ParametresAwareTrait,
Traits\StructureAwareTrait
;
use Traits\EtablissementAwareTrait;
use Traits\AnneeAwareTrait;
use Traits\IntervenantAwareTrait;
use Traits\ParametresAwareTrait;
use Traits\StructureAwareTrait;
/**
* selectedIdentityRole
......
......@@ -39,9 +39,9 @@ class AgrementCAMaisPasContratIndicateurImpl extends AbstractIntervenantResultIn
protected function getQueryBuilder()
{
// INDISPENSABLE si plusieurs requêtes successives sur Intervenant !
$this->getEntityManager()->clear('Application\Entity\Db\IntervenantExterieur');
$this->getEntityManager()->clear('Application\Entity\Db\Intervenant');
$qb = $this->getEntityManager()->getRepository('Application\Entity\Db\IntervenantExterieur')->createQueryBuilder("int");
$qb = $this->getEntityManager()->getRepository('Application\Entity\Db\Intervenant')->createQueryBuilder("int");
$qb
->join("int.statut", "st", Join::WITH, "st.peutAvoirContrat = 1")
->join("int.agrement", "a")
......
......@@ -39,9 +39,9 @@ class AttenteAvenantIndicateurImpl extends AbstractIntervenantResultIndicateurIm
protected function getQueryBuilder()
{
// INDISPENSABLE si plusieurs requêtes successives sur Intervenant !
$this->getEntityManager()->clear('Application\Entity\Db\IntervenantExterieur');
$this->getEntityManager()->clear('Application\Entity\Db\Intervenant');
$qb = $this->getEntityManager()->getRepository('Application\Entity\Db\IntervenantExterieur')->createQueryBuilder("int");
$qb = $this->getEntityManager()->getRepository('Application\Entity\Db\Intervenant')->createQueryBuilder("int");
$qb
->join("int.statut", "st", Join::WITH, "st.peutAvoirContrat = 1")
->join("int.service", "s")
......
......@@ -39,9 +39,9 @@ class AttenteContratIndicateurImpl extends AbstractIntervenantResultIndicateurIm
protected function getQueryBuilder()
{
// INDISPENSABLE si plusieurs requêtes successives sur Intervenant !
$this->getEntityManager()->clear('Application\Entity\Db\IntervenantExterieur');
$this->getEntityManager()->clear('Application\Entity\Db\Intervenant');
$qb = $this->getEntityManager()->getRepository('Application\Entity\Db\IntervenantExterieur')->createQueryBuilder("int");
$qb = $this->getEntityManager()->getRepository('Application\Entity\Db\Intervenant')->createQueryBuilder("int");
$qb
->join("int.statut", "st", Join::WITH, "st.peutAvoirContrat = 1")
->join("int.service", "s")
......
......@@ -69,7 +69,7 @@ class AttenteRetourContratIndicateurImpl extends AbstractIntervenantResultIndica
*/
protected function getQueryBuilder()
{
$qb = $this->getEntityManager()->getRepository('Application\Entity\Db\IntervenantExterieur')->createQueryBuilder("int");
$qb = $this->getEntityManager()->getRepository('Application\Entity\Db\Intervenant')->createQueryBuilder("int");
$qb
->join("int.contrat", "c")
->andWhere("int.annee = :annee")
......@@ -85,7 +85,7 @@ class AttenteRetourContratIndicateurImpl extends AbstractIntervenantResultIndica
protected function initQueryBuilder(QueryBuilder $qb)
{
// INDISPENSABLE si plusieurs requêtes successives sur Intervenant !
$this->getEntityManager()->clear('Application\Entity\Db\IntervenantExterieur');
$this->getEntityManager()->clear('Application\Entity\Db\Intervenant');
$qb
->join("c.typeContrat", "tc", Join::WITH, "tc.code = :codeTypeContrat")
......
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