Commit 3447cc7d authored by lecluse's avatar lecluse
Browse files

Séparation des indicateurs de charges par rapport aux services par période

parent 104c5689
......@@ -77,7 +77,7 @@ return [
],
],
'child_routes' => [
'prevu' => [
'prevu' => [
'type' => 'Literal',
'options' => [
'route' => '/prevu',
......@@ -85,6 +85,26 @@ return [
'type-volume-horaire-code' => 'PREVU',
],
],
'child_routes' => [
's1' => [
'type' => 'Literal',
'options' => [
'route' => '/s1',
'defaults' => [
'periode-code' => 'S1',
],
],
],
's2' => [
'type' => 'Literal',
'options' => [
'route' => '/s2',
'defaults' => [
'periode-code' => 'S2',
],
],
],
],
],
'realise' => [
'type' => 'Literal',
......@@ -94,6 +114,26 @@ return [
'type-volume-horaire-code' => 'REALISE',
],
],
'child_routes' => [
's1' => [
'type' => 'Literal',
'options' => [
'route' => '/s1',
'defaults' => [
'periode-code' => 'S1',
],
],
],
's2' => [
'type' => 'Literal',
'options' => [
'route' => '/s2',
'defaults' => [
'periode-code' => 'S2',
],
],
],
],
],
],
],
......
......@@ -14,6 +14,7 @@ use Application\Service\Traits\IndicateurServiceAwareTrait;
use Application\Service\Traits\IntervenantAwareTrait;
use Application\Service\Traits\NotificationIndicateurAwareTrait;
use Application\Filter\IntervenantEmailFormatter;
use Application\Service\Traits\PeriodeAwareTrait;
use Application\Service\Traits\TypeVolumeHoraireAwareTrait;
use Zend\Mvc\Router\Http\TreeRouteStack;
use Zend\View\Renderer\PhpRenderer;
......@@ -41,6 +42,7 @@ class IndicateurController extends AbstractController
use IndicateurProcessusAwareTrait;
use DossierAwareTrait;
use TypeVolumeHoraireAwareTrait;
use PeriodeAwareTrait;
/**
* @var TreeRouteStack
......@@ -306,11 +308,14 @@ class IndicateurController extends AbstractController
$typeVolumeHoraireCode = $this->params()->fromRoute('type-volume-horaire-code');
$typeVolumeHoraire = $this->getServiceTypeVolumeHoraire()->getByCode($typeVolumeHoraireCode);
$periodeCode = $this->params()->fromRoute('periode-code');
$periode = $this->getServicePeriode()->getByCode($periodeCode);
if (!$intervenant){
throw new \Exception('Un intervenant doit être spécifié');
}
$params = compact('typeVolumeHoraire','intervenant');
$params = compact('typeVolumeHoraire','periode', 'intervenant');
if ($structure = $this->getServiceContext()->getStructure()){
$params['structure'] = $structure->getId();
$sFilter = ' AND idc.structure = :structure';
......@@ -329,6 +334,7 @@ class IndicateurController extends AbstractController
WHERE
idc.intervenant = :intervenant
AND idc.typeVolumeHoraire = :typeVolumeHoraire
AND (idc.periode = :periode OR idc.periode IS NULL)
$sFilter
ORDER BY
s.libelleCourt, ep.libelle, ti.ordre
......
<?php
namespace Application\Entity\Db\Indicateur;
class Indicateur1111 extends AbstractIndicateur
{
}
<?php
namespace Application\Entity\Db\Indicateur;
class Indicateur1121 extends AbstractIndicateur
{
}
......@@ -5,6 +5,7 @@ namespace Application\Entity\Db;
use Application\Entity\Db\Traits\AnneeAwareTrait;
use Application\Entity\Db\Traits\ElementPedagogiqueAwareTrait;
use Application\Entity\Db\Traits\IntervenantAwareTrait;
use Application\Entity\Db\Traits\PeriodeAwareTrait;
use Application\Entity\Db\Traits\StructureAwareTrait;
use Application\Entity\Db\Traits\TypeInterventionAwareTrait;
use Application\Entity\Db\Traits\TypeVolumeHoraireAwareTrait;
......@@ -21,6 +22,7 @@ class IndicateurDepassementCharges
use StructureAwareTrait;
use ElementPedagogiqueAwareTrait;
use TypeInterventionAwareTrait;
use PeriodeAwareTrait;
/**
* @var integer
......
<?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="Application\Entity\Db\Indicateur\Indicateur1111" table="V_INDICATEUR_1111" read-only="true">
<id name="id" type="integer" column="ID"/>
<many-to-one field="annee" target-entity="Application\Entity\Db\Annee">
<join-column name="ANNEE_ID" referenced-column-name="ID"/>
</many-to-one>
<many-to-one field="intervenant" target-entity="Application\Entity\Db\Intervenant">
<join-column name="INTERVENANT_ID" referenced-column-name="ID"/>
</many-to-one>
<many-to-one field="structure" target-entity="Application\Entity\Db\Structure">
<join-column name="STRUCTURE_ID" referenced-column-name="ID"/>
</many-to-one>
</entity>
</doctrine-mapping>
<?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="Application\Entity\Db\Indicateur\Indicateur1121" table="V_INDICATEUR_1121" read-only="true">
<id name="id" type="integer" column="ID"/>
<many-to-one field="annee" target-entity="Application\Entity\Db\Annee">
<join-column name="ANNEE_ID" referenced-column-name="ID"/>
</many-to-one>
<many-to-one field="intervenant" target-entity="Application\Entity\Db\Intervenant">
<join-column name="INTERVENANT_ID" referenced-column-name="ID"/>
</many-to-one>
<many-to-one field="structure" target-entity="Application\Entity\Db\Structure">
<join-column name="STRUCTURE_ID" referenced-column-name="ID"/>
</many-to-one>
</entity>
</doctrine-mapping>
......@@ -31,5 +31,9 @@
</many-to-one>
<field name="heures" type="float" column="HEURES" nullable="false"/>
<many-to-one field="periode" target-entity="Application\Entity\Db\Periode">
<join-column name="PERIODE_ID" referenced-column-name="ID"/>
</many-to-one>
</entity>
</doctrine-mapping>
\ No newline at end of file
......@@ -29,6 +29,11 @@ class Periode extends AbstractEntityService
*/
protected $enseignement;
/**
* @var PeriodeEntity[]
*/
private $cache;
/**
......@@ -56,6 +61,23 @@ class Periode extends AbstractEntityService
/**
*
* @param string $code
*
* @return PeriodeEntity
*/
public function getByCode($code)
{
if (!isset($this->cache[$code])) {
$this->cache[$code] = $this->getRepo()->findOneBy(['code' => $code]);
}
return $this->cache[$code];
}
/**
*
* @param \DateTime $date
......
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