Commit 9c1a7f14 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajout du lien vers Type depuis correspondance

parent a02f0854
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -37,6 +37,15 @@ create or replace View V_PREECOG_CORRESPONDANCE_TYPE AS
        null AS D_FERMETURE
    FROM DUAL
;

-- ajout de la colonne référencant le type_id dans la vue des correspondances ou recréation de la vue.
create or replace VIEW V_PREECOG_CORRESPONDANCE AS
select ID, C_BAP, LIB_COURT, LIB_LONG,
       D_OUVERTURE,
       D_FERMETURE,
       1 AS TYPE_ID  -- ATTENTION ICI BRICOLAGE UNICAEN -- 
from BAP
;
```

Modification de la base de données côté EMC2
@@ -92,6 +101,29 @@ Nouvelle synchro
            'preserved_id' => true,
        ],
    ],
    [
        'name' => 'CARRIERE_CORRESPONDANCE',
        'order' => 1010,
        'source' => [
            'name' => 'octopus',
            'code' => 'OCTOPUS',
            'select'             => "
                SELECT B.ID AS ID_ORIG, B.C_BAP, B.LIB_COURT, B.LIB_LONG, 
                       B.D_OUVERTURE,  B.D_FERMETURE, B.TYPE_ID 
                FROM V_PREECOG_CORRESPONDANCE B
            ",
            'connection' => 'octopus',
            'source_code_column' => 'ID_ORIG',
        ],
        'destination' => [
            'name' => 'Listing des Correspondances (BAP, ...)',
            'table' => 'carriere_correspondance',
            'connection' => 'default',
            'source_code_column' => 'id_orig',
            'intermediate_table_auto_drop' => true,
            'preserved_id' => true,
        ],
    ],
    ...
],
```
+30 −0
Original line number Diff line number Diff line
@@ -23,6 +23,10 @@ class Correspondance {
    /** @var ArrayCollection (AgentGrade) */
    private $agentGrades;
    private ?CorrespondanceType $type = null;

    private ?DateTime $dateOuverture = null;
    private ?DateTime $dateFermeture = null;

    /**
     * @return int
     */
@@ -114,6 +118,32 @@ class Correspondance {
        $this->type = $type;
    }

    /**
     * @return DateTime|null
     */
    public function getDateOuverture(): ?DateTime
    {
        return $this->dateOuverture;
    }

    /**
     * @param DateTime|null $dateOuverture
     */
    public function setDateOuverture(?DateTime $dateOuverture): void
    {
        $this->dateOuverture = $dateOuverture;
    }

    public function getDateFermeture(): ?DateTime
    {
        return $this->dateFermeture;
    }

    public function setDateFermeture(?DateTime $dateFermeture): void
    {
        $this->dateFermeture = $dateFermeture;
    }

    /**
     * @return DateTime
     */
+2 −0
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@
        <field name="categorie"     column="c_bap"          type="string"       length="10"   />
        <field name="libelleCourt"  column="lib_court"      type="string"       length="20"   />
        <field name="libelleLong"   column="lib_long"       type="string"       length="200"  />
        <field name="dateOuverture" column="d_ouverture"    type="datetime"  />
        <field name="dateFermeture" column="d_fermeture"    type="datetime"  />

        <many-to-one target-entity="Carriere\Entity\Db\CorrespondanceType"  field="type">
            <join-column name="type_id" referenced-column-name="id"/>
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ class CorrespondanceService {
        $correspondances = $this->getCorrespondances($champ, $ordre, $avecAgent);
        $options = [];
        foreach($correspondances as $correspondance) {
            $options[$correspondance->getId()] = $correspondance->getCategorie() . " - " . $correspondance->getLibelleLong();
            $options[$correspondance->getId()] = (($correspondance->getType())?$correspondance->getType()->getLibelleCourt():""). " ". $correspondance->getLibelleCourt() . " - " . $correspondance->getLibelleLong();
        }
        return $options;
    }
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@
use Carriere\Entity\Db\Correspondance;
use Carriere\Provider\Privilege\CorpsPrivileges;

$date = new DateTime();
$correspondances = array_filter($correspondances, function (Correspondance $a) use ($date) { return $a->getDateFermeture() === null OR $a->getDateFermeture() > $date;});

$canAfficher = $this->isAllowed(CorpsPrivileges::getResourceId(CorpsPrivileges::CORPS_AFFICHER));

$this->headTitle("Liste des correspondances");