diff --git a/src/Octopus/Entity/Db/Individu.php b/src/Octopus/Entity/Db/Individu.php index 0ffd9010aa081d816c4fb7fba51cdee5fc2894ef..7793df32899c9e0e1eeb52d12c41ff4b343f1dbe 100644 --- a/src/Octopus/Entity/Db/Individu.php +++ b/src/Octopus/Entity/Db/Individu.php @@ -8,7 +8,7 @@ use DateTime; class Individu { /** @var integer */ private $cIndividuChaine; - /** @var string */ + /** @var Source */ private $cSource; /** @var integer */ private $cEtu; @@ -54,7 +54,7 @@ class Individu { } /** - * @return string + * @return Source */ public function getCSource() { diff --git a/src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.Individu.dcm.xml b/src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.Individu.dcm.xml index 239e5e4207e70ae7d41dee957cc6004fcf717967..552745904ae824578e1ed50552cebd48fb2e1061 100644 --- a/src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.Individu.dcm.xml +++ b/src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.Individu.dcm.xml @@ -6,7 +6,11 @@ <generator strategy="IDENTITY"/> </id> - <field name="cSource" type="string" length="10" column="C_SOURCE" nullable="false"/> + <many-to-one target-entity="Octopus\Entity\Db\Source" field="cSource"> + <join-column name="C_SOURCE" referenced-column-name="C_SOURCE" /> + </many-to-one> + <!--<field name="cSource" type="string" length="10" column="C_SOURCE" nullable="false"/>--> + <field name="cEtu" type="integer" column="C_ETU" nullable="false"/> <field name="cIne" type="string" length="11" column="C_INE" nullable="false"/> <field name="sexe" type="string" length="1" column="SEXE" nullable="false"/> diff --git a/src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.Source.dcm.xml b/src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.Source.dcm.xml new file mode 100644 index 0000000000000000000000000000000000000000..9e6f21a57a394ed5f1bf3665b0da565ca45294a6 --- /dev/null +++ b/src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.Source.dcm.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> + <entity name="Octopus\Entity\Db\Source" table="SOURCE"> + + <id name="cSource" type="string" length="10" column="C_SOURCE"> + <generator strategy="IDENTITY"/> + </id> + + <field name="libelleCourt" type="string" length="16" column="LIB_COURT" nullable="false"/> + <field name="libelleLong" type="string" length="64" column="LIB_LONG" nullable="false"/> + <field name="tableLocale" type="string" length="1" column="T_TABLE_LOCALE" nullable="false"/> + <field name="priorite" type="integer" column="PRIORITE" nullable="false"/> + + </entity> +</doctrine-mapping> \ No newline at end of file diff --git a/src/Octopus/Entity/Db/Source.php b/src/Octopus/Entity/Db/Source.php new file mode 100644 index 0000000000000000000000000000000000000000..c48bed548c055b0aedde9cf0a5e41d442f6ccc89 --- /dev/null +++ b/src/Octopus/Entity/Db/Source.php @@ -0,0 +1,70 @@ +<?php + +namespace Octopus\Entity\Db; + +class Source { + /** @var string */ + private $cSource; + /** @var string */ + private $libelleCourt; + /** @var string */ + private $libelleLong; + /** @var string */ + private $tableLocale; + /** @var int */ + private $priorite; + + /** + * @return string + */ + public function getCSource() + { + return $this->cSource; + } + + /** + * @return string + */ + public function getLibelleCourt() + { + return $this->libelleCourt; + } + + /** + * @return string + */ + public function getLibelleLong() + { + return $this->libelleLong; + } + + /** + * @return string + */ + public function isTableLocale() + { + return ($this->tableLocale === "O"); + } + + /** + * @return int + */ + public function getPriorite() + { + return $this->priorite; + } + + public function __toString() + { + switch ($this->cSource) { + case 'OCTO' : return '<span class="badge" style="background-color: darkred;">'. $this->getLibelleLong() .'</span>'; + case 'HARP' : return '<span class="badge" style="background-color: hotpink;">'. $this->getLibelleLong() .'</span>'; + case 'APO' : return '<span class="badge" style="background-color: royalblue;">'. $this->getLibelleLong() .'</span>'; + case 'FCA' : return '<span class="badge" style="background-color: cadetblue;">'. $this->getLibelleLong() .'</span>'; + case 'INV' : return '<span class="badge" style="background-color: darkgreen;">'. $this->getLibelleLong() .'</span>'; + default : return '<span class="badge" style="background-color: gray;">'. $this->getLibelleLong() .'</span>'; + } + } + + +} \ No newline at end of file diff --git a/src/Octopus/Service/Individu/IndividuService.php b/src/Octopus/Service/Individu/IndividuService.php index 7a769ca4f49a76d25d1d83704a2e5c9becddde3c..ea9443e9a6d1024e0a9881592accf2b7c68fe3e2 100644 --- a/src/Octopus/Service/Individu/IndividuService.php +++ b/src/Octopus/Service/Individu/IndividuService.php @@ -34,8 +34,8 @@ class IndividuService { public function getIndividu($id) { $qb = $this->getEntityManager()->getRepository(Individu::class)->createQueryBuilder('individu') - ->andWhere('individu.id = :id') - ->setParameter('id', $id) + ->andWhere('individu.cIndividuChaine = :id') + ->setParameter('id', (int) $id) ; try { @@ -53,7 +53,7 @@ class IndividuService { public function getIndividusByTerm($term) { $qb = $this->getEntityManager()->getRepository(Individu::class)->createQueryBuilder('individu') - ->andWhere('individu.nom LIKE :search') + ->andWhere('individu.nomUsage LIKE :search') ->setParameter('search', '%'.$term.'%') ->orderBy('individu.nomUsage, individu.prenom') ; diff --git a/view/octopus/octopus/index.phtml b/view/octopus/octopus/index.phtml index faea26781454ec9ff93262c47cfd461a050981a5..64548ecd671976891ca8bfd768208e09256197a2 100644 --- a/view/octopus/octopus/index.phtml +++ b/view/octopus/octopus/index.phtml @@ -221,19 +221,6 @@ use UnicaenApp\Form\Element\SearchAndSelect; </span> </h3> - <form method='post' class="form-inline " style="margin-bottom:10px;"> - <?php - $sas = new SearchAndSelect('utilisateur'); - $sas->setAttribute('placeholder','Recherchez un utilisateur'); - $sas->setAttribute('class', 'individu-finder'); - // $sas->setAutocompleteSource($this->url('utilisateur-preecog/rechercher-utilisateur', [], [], true)); - $sas->setAutocompleteSource($this->url('poste/rechercher-batiment', [], [], true)); - echo $this->formControlGroup($sas, 'formSearchAndSelect'); - ?> - <input type="submit" class="" value="Sélectionner l'utilisateur"/> - </form> - - <table class="table table-condensed"> <thead> <tr>