Skip to content
Snippets Groups Projects
Commit 84752553 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Début d'ajout des individus

parent cf1a4170
No related branches found
No related tags found
No related merge requests found
......@@ -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()
{
......
......@@ -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"/>
......
<?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
<?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
......@@ -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')
;
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment