diff --git "a/code/Cr\303\251er un administrateur local.php" "b/code/Cr\303\251er un administrateur local.php" index 8fce8a0d6baedd2dd7958bd9df33f87b8cef9316..16f0149f582a35c7c95403e2dde67c6a40d40900 100644 --- "a/code/Cr\303\251er un administrateur local.php" +++ "b/code/Cr\303\251er un administrateur local.php" @@ -76,6 +76,7 @@ function creerAdmin($sl, array $admin) } $admins = [ + ]; foreach ($admins as $admin) { diff --git a/code/test6.php b/code/test6.php index 9b5dda9dbf8bea06bdb9deedd90a59654329fc09..8443aef099d237cdb43cdaf5b269f49da5c0193b 100644 --- a/code/test6.php +++ b/code/test6.php @@ -1,18 +1,8 @@ <?php -use UnicaenApp\Mouchard\MouchardMessage; - /** * @var $this \Application\View\Renderer\PhpRenderer * @var $controller \Zend\Mvc\Controller\AbstractController * @var $viewName string * @var $sl \Zend\ServiceManager\ServiceLocatorInterface */ - -echo 5 / 0; - -//throw new Exception('test'); - -//echo $this->messenger()->addMessage('test messenger', 'danger'); - -//$sl->get('') diff --git a/data/Sql/Taux fi fa fc.sql b/data/Sql/Taux fi fa fc.sql index 73385cdea2614d695dc781b7f12e07f2f5803112..c6731e42644feaf4eba5042aa12f09178d0bb4a9 100644 --- a/data/Sql/Taux fi fa fc.sql +++ b/data/Sql/Taux fi fa fc.sql @@ -58,7 +58,7 @@ SELECT ep.id ep_id, e.id e_id, etr.id etr_id, - CASE WHEN 1 = ose_divers.comprise_entre( etr.histo_creation,etr.histo_destruction ) THEN 1 ELSE 0 END etr_actif, + CASE WHEN etr.histo_destruction IS NULL THEN 1 ELSE 0 END etr_actif, s.libelle s_libelle, ep.annee_id annee, ep.source_code ep_code, @@ -69,9 +69,9 @@ SELECT ep.fa,ep.taux_fa, ep.fc,ep.taux_fc, -- NOUVEAUX TAUX FI FA FC - 100 /100 n_taux_fi, + 92 /100 n_taux_fi, 0 /100 n_taux_fa, - 0 /100 n_taux_fc + 8 /100 n_taux_fc -- FIN DES NOUVEAUX TAUX FI FA FC FROM element_pedagogique ep @@ -81,12 +81,10 @@ FROM LEFT JOIN element_taux_regimes etr ON etr.element_pedagogique_id = ep.id WHERE -- FILTRES - 1 = ose_divers.comprise_entre( ep.histo_creation,ep.histo_destruction ) + ep.histo_destruction IS NULL --AND s.code <> 'OSE' AND e.source_code IN ( -'1LPSYC_701', -'2LPSYC_701', -'3LPSYC_711' +'PLTERR_711' ) AND ep.annee_id = 2017 -- FIN DES FILTRES diff --git a/module/Application/autoload_classmap.php b/module/Application/autoload_classmap.php index 956e2fe03defc8cd82d9e6d6bd1948e92c69fc9d..6a747187473a56f6c945d62891ad362bc79055f7 100644 --- a/module/Application/autoload_classmap.php +++ b/module/Application/autoload_classmap.php @@ -727,8 +727,6 @@ return array( 'Application\Controller\WorkflowController' => __DIR__ . '/src/Application/Controller/WorkflowController.php', 'Application\Controller\IndicateurController' => __DIR__ . '/src/Application/Controller/IndicateurController.php', 'Application\ORM\Query\Functions\Replace' => __DIR__ . '/src/Application/ORM/Query/Functions/Replace.php', - 'Application\ORM\Query\Functions\OseDivers\CompriseEntre' => __DIR__ . '/src/Application/ORM/Query/Functions/OseDivers/CompriseEntre.php', - 'Application\ORM\Query\Functions\OseDivers\PasHistorise' => __DIR__ . '/src/Application/ORM/Query/Functions/OseDivers/PasHistorise.php', 'Application\ORM\Query\Functions\Convert' => __DIR__ . '/src/Application/ORM/Query/Functions/Convert.php', 'Application\ORM\Filter\AbstractFilter' => __DIR__ . '/src/Application/ORM/Filter/AbstractFilter.php', 'Application\ORM\Filter\AnneeFilter' => __DIR__ . '/src/Application/ORM/Filter/AnneeFilter.php', diff --git a/module/Application/config/aaa_module.config.php b/module/Application/config/aaa_module.config.php index 5cb0805221a7ad14a330bfe5c130f5e5d2353406..8274cccb154f8c3d0fd228fa0e3eca4ea8ab5895 100755 --- a/module/Application/config/aaa_module.config.php +++ b/module/Application/config/aaa_module.config.php @@ -31,8 +31,6 @@ return [ 'string_functions' => [ 'CONVERT' => ORM\Query\Functions\Convert::class, 'REPLACE' => ORM\Query\Functions\Replace::class, - 'compriseEntre' => ORM\Query\Functions\OseDivers\CompriseEntre::class, - 'pasHistorise' => ORM\Query\Functions\OseDivers\PasHistorise::class, ], 'filters' => [ 'historique' => ORM\Filter\HistoriqueFilter::class, diff --git a/module/Application/src/Application/Entity/Db/Structure.php b/module/Application/src/Application/Entity/Db/Structure.php index 0a8ba439601d15aa89816720612c00912284e82c..7297416db78a69ec836aadbdceb6ebf75c39fb75 100644 --- a/module/Application/src/Application/Entity/Db/Structure.php +++ b/module/Application/src/Application/Entity/Db/Structure.php @@ -486,7 +486,7 @@ class Structure implements HistoriqueAwareInterface, ResourceInterface, ImportAw WHERE a.structure = :structure AND a.principale = true - AND 1 = compriseEntre( a.histoCreation, a.histoDestruction ) + AND a.histoDestruction IS NULL "; return $this->getEntityManager()->createQuery($dql)->setParameter('structure', $this)->getOneOrNullResult(); diff --git a/module/Application/src/Application/Form/Chargens/FiltreForm.php b/module/Application/src/Application/Form/Chargens/FiltreForm.php index a26789b38cb24b627ff86362ef08c51201c4d04a..c2bb14b7db72be6d0a844763d502a810c3409a84 100755 --- a/module/Application/src/Application/Form/Chargens/FiltreForm.php +++ b/module/Application/src/Application/Form/Chargens/FiltreForm.php @@ -185,9 +185,9 @@ class FiltreForm extends AbstractForm JOIN noeud n ON n.etape_id = e.id JOIN lien l ON l.noeud_sup_id = n.id WHERE - 1 = OSE_DIVERS.COMPRISE_ENTRE( e.histo_creation, e.histo_destruction ) - AND 1 = OSE_DIVERS.COMPRISE_ENTRE( n.histo_creation, n.histo_destruction ) - AND 1 = OSE_DIVERS.COMPRISE_ENTRE( l.histo_creation, l.histo_destruction ) + e.histo_destruction IS NULL + AND n.histo_destruction IS NULL + AND l.histo_destruction IS NULL AND e.annee_id = '.$this->getServiceContext()->getAnnee()->getId().' '.(($s=$this->getServiceContext()->getStructure()) ? 'AND e.structure_id = '.$s->getId() : '').' ORDER BY diff --git a/module/Application/src/Application/Form/OffreFormation/ElementPedagogiqueRechercheFieldset.php b/module/Application/src/Application/Form/OffreFormation/ElementPedagogiqueRechercheFieldset.php index 930e79b35d7f96fd517090eb36ef010080c003d3..096ba4afabfeca459faba1cd00e9565ebeb26692 100644 --- a/module/Application/src/Application/Form/OffreFormation/ElementPedagogiqueRechercheFieldset.php +++ b/module/Application/src/Application/Form/OffreFormation/ElementPedagogiqueRechercheFieldset.php @@ -189,7 +189,7 @@ class ElementPedagogiqueRechercheFieldset extends AbstractFieldset implements En JOIN groupe_type_formation gtf ON gtf.id = tf.groupe_id JOIN structure s ON s.id = ep.structure_id WHERE - 1 = ose_divers.comprise_entre( ep.histo_creation, ep.histo_destruction ) + ep.histo_destruction IS NULL AND ep.annee_id = :annee "; diff --git a/module/Application/src/Application/ORM/Filter/HistoriqueFilter.php b/module/Application/src/Application/ORM/Filter/HistoriqueFilter.php index bf58c6e022ce3639f57d639fecf13d106231ca32..cbf2c735b1d52153666e3bfee29f3c672c3ba40e 100644 --- a/module/Application/src/Application/ORM/Filter/HistoriqueFilter.php +++ b/module/Application/src/Application/ORM/Filter/HistoriqueFilter.php @@ -26,20 +26,7 @@ class HistoriqueFilter extends AbstractFilter } if (isset($this->enabledEntities[$targetEntity->name])) { - if ($this->getServiceContext()){ - $dateObservation = $this->getServiceContext()->getDateObservation(); - }else{ - $dateObservation = new \DateTime(); - } - - - if ($dateObservation) { - $this->setParameter('date_observation', $dateObservation, \Doctrine\DBAL\Types\Type::DATETIME); - - return '1 = OSE_DIVERS.COMPRISE_ENTRE(' . $targetTableAlias . '.HISTO_CREATION,' . $targetTableAlias . '.HISTO_DESTRUCTION, ' . $this->getParameter('date_observation') . ')'; - } else { - return '1 = OSE_DIVERS.COMPRISE_ENTRE(' . $targetTableAlias . '.HISTO_CREATION,' . $targetTableAlias . '.HISTO_DESTRUCTION)'; - } + return $targetTableAlias . '.HISTO_DESTRUCTION IS NULL'; } else { return ''; } @@ -98,7 +85,7 @@ class HistoriqueFilter extends AbstractFilter * * @return self */ - public function init($entity, $dateObservation = null) + public function init($entity) { if ($entity) { $this->enableForEntity($entity); diff --git a/module/Application/src/Application/ORM/Query/Functions/OseDivers/CompriseEntre.php b/module/Application/src/Application/ORM/Query/Functions/OseDivers/CompriseEntre.php deleted file mode 100644 index 45fa02b3f1a40b768b48882660d2eaa45d0cf2ca..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/ORM/Query/Functions/OseDivers/CompriseEntre.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -namespace Application\ORM\Query\Functions\OseDivers; - -use Doctrine\ORM\Query\Lexer; -use Doctrine\ORM\Query\AST\Functions\FunctionNode; - -class CompriseEntre extends FunctionNode -{ - public $histoCreation; - public $histoDestruction; - public $dateObs; - - - public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) - { - $sql = sprintf('OSE_DIVERS.COMPRISE_ENTRE(%s, %s', - $this->histoCreation->dispatch($sqlWalker), - $this->histoDestruction->dispatch($sqlWalker)); - - if ($this->dateObs){ - $sql .= ','.$this->dateObs->dispatch($sqlWalker); - } - $sql .= ')'; - return $sql; - } - - /** - * NB: le format DQL attendu est "compriseEntre" - * (et non pas "OSE_DIVERS.COMPRISE_ENTRE"). - * - * @param \Doctrine\ORM\Query\Parser $parser - */ - public function parse(\Doctrine\ORM\Query\Parser $parser) - { - $lexer = $parser->getLexer(); - $parser->match(Lexer::T_IDENTIFIER); - $parser->match(Lexer::T_OPEN_PARENTHESIS); - $this->histoCreation = $parser->ArithmeticPrimary(); - if(Lexer::T_COMMA === $lexer->lookahead['type']){ - $parser->match(Lexer::T_COMMA); - $this->histoDestruction = $parser->ArithmeticPrimary(); - } - if(Lexer::T_COMMA === $lexer->lookahead['type']){ - $parser->match(Lexer::T_COMMA); - $this->dateObs = $parser->ArithmeticPrimary(); - } - $parser->match(Lexer::T_CLOSE_PARENTHESIS); - } -} \ No newline at end of file diff --git a/module/Application/src/Application/ORM/Query/Functions/OseDivers/PasHistorise.php b/module/Application/src/Application/ORM/Query/Functions/OseDivers/PasHistorise.php deleted file mode 100644 index 3d1e894cc7e90ac72a71370045198f5b5cf8f78e..0000000000000000000000000000000000000000 --- a/module/Application/src/Application/ORM/Query/Functions/OseDivers/PasHistorise.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -namespace Application\ORM\Query\Functions\OseDivers; - -use Doctrine\ORM\Query\AST\Functions\FunctionNode; -use Doctrine\ORM\Query\Lexer; -use Doctrine\ORM\Query\Parser; -use Doctrine\ORM\Query\SqlWalker; - -/** - * Fonction DQL maison "pasHistorise()". - * - * NB: le format DQL attendu est "pasHistorise(EntityExpression)". - * Exemples : - * <pre> - * $qb->andWhere("1 = pasHistorise(sr)") - * $qb->andWhere("1 = pasHistorise(int.serviceReferentiel)") - * </pre> - * - * Fait appel à la fonction Oracle OSE_DIVERS.COMPRISE_ENTRE(). - */ -class PasHistorise extends FunctionNode -{ - public $alias; - public $dateObservation; - - /** - * Parsing. - * - * NB: le format DQL attendu est "pasHistorise(EntityExpression)". - * Exemple : - * pasHistorise(s) - * pasHistorise(int.serviceReferentiel) - * - * @param Parser $parser - */ - public function parse(Parser $parser) - { - $lexer = $parser->getLexer(); - $parser->match(Lexer::T_IDENTIFIER); - $parser->match(Lexer::T_OPEN_PARENTHESIS); - $this->alias = $parser->EntityExpression(); - if(Lexer::T_COMMA === $lexer->lookahead['type']){ - $parser->match(Lexer::T_COMMA); - $this->dateObservation = $parser->ArithmeticPrimary(); - } - $parser->match(Lexer::T_CLOSE_PARENTHESIS); - } - - /** - * Génère le code SQL. - * - * @param SqlWalker $sqlWalker - * @return string - */ - public function getSql(SqlWalker $sqlWalker) - { - $expr1 = clone($this->alias); - $expr2 = clone($this->alias); - - $expr1->field = 'histoCreation'; - $expr2->field = 'histoDestruction'; - - $sql = sprintf('OSE_DIVERS.COMPRISE_ENTRE(%s, %s, %s)', - $expr1->dispatch($sqlWalker), - $expr2->dispatch($sqlWalker), - $this->dateObservation ? $this->dateObservation->dispatch($sqlWalker) : 'null'); - - return $sql; - } -} \ No newline at end of file diff --git a/module/Application/src/Application/Processus/ContratProcessus.php b/module/Application/src/Application/Processus/ContratProcessus.php index 2c98358c8735416775a801605db03c8e3603ffbc..769fde4078998827332b1a0208fc88f6b7c7cc02 100755 --- a/module/Application/src/Application/Processus/ContratProcessus.php +++ b/module/Application/src/Application/Processus/ContratProcessus.php @@ -74,8 +74,8 @@ class ContratProcessus extends AbstractProcessus JOIN vh.typeVolumeHoraire tvh WHERE i = :intervenant - AND 1 = compriseEntre(s.histoCreation, s.histoDestruction) - AND 1 = compriseEntre(vh.histoCreation, vh.histoDestruction) + AND s.histoDestruction IS NULL + AND vh.histoDestruction IS NULL AND " . ($contrat ? $fContrat : $fNonContrat) . " $fStructure "; diff --git a/module/Application/src/Application/Provider/Role/RoleProvider.php b/module/Application/src/Application/Provider/Role/RoleProvider.php index 903d8bb77d7a8b0f3e2cb10a02306a5cc9a2954e..deae52760896798f08180316f067b091053edc0b 100644 --- a/module/Application/src/Application/Provider/Role/RoleProvider.php +++ b/module/Application/src/Application/Provider/Role/RoleProvider.php @@ -118,10 +118,10 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface FROM Application\Entity\Db\Role r JOIN r.perimetre p - LEFT JOIN r.affectation a WITH 1=compriseEntre(a.histoCreation,a.histoDestruction) AND a.personnel = :personnel + LEFT JOIN r.affectation a WITH a.histoDestruction IS NULL AND a.personnel = :personnel LEFT JOIN a.structure s WHERE - 1=compriseEntre(r.histoCreation,r.histoDestruction)' + r.histoDestruction IS NULL' )->setParameter('personnel', $personnel); $result = $query->getResult(); diff --git a/module/Application/src/Application/Service/AbstractEntityService.php b/module/Application/src/Application/Service/AbstractEntityService.php index d14274e8bfdac0a40de8440b012b4893b3eafbd9..df46bab96d41a53ae76220de63a0afe84a40343d 100644 --- a/module/Application/src/Application/Service/AbstractEntityService.php +++ b/module/Application/src/Application/Service/AbstractEntityService.php @@ -526,10 +526,10 @@ abstract class AbstractEntityService extends AbstractService if ($hasHistorique) { $dateObservation = $this->getServiceContext()->getDateObservation(); if ($dateObservation) { - $qb->andWhere('1 = compriseEntre(' . $alias . '.histoCreation,' . $alias . '.histoDestruction, :dateObservation)'); + $qb->andWhere($alias . '.histoDestruction IS NULL'); $qb->setParameter('dateObservation', $dateObservation, \Doctrine\DBAL\Types\Type::DATETIME); } else { - $qb->andWhere('1 = compriseEntre(' . $alias . '.histoCreation,' . $alias . '.histoDestruction)'); + $qb->andWhere($alias . '.histoDestruction IS NULL'); } } diff --git a/module/Application/src/Application/Service/Context.php b/module/Application/src/Application/Service/Context.php index eb02b31f4a231e56b353f6287c99d2f66ab23944..e52553a13d83a9a1469d325789c410cf95cacf45 100644 --- a/module/Application/src/Application/Service/Context.php +++ b/module/Application/src/Application/Service/Context.php @@ -449,7 +449,7 @@ class Context extends AbstractService intervenant i WHERE i.annee_id = " . ((int)$annee->getId()) . " - AND 1 = ose_divers.comprise_entre( i.histo_creation, i.histo_destruction ) + AND i.histo_destruction IS NULL AND rownum = 1 "; $res = $this->getEntityManager()->getConnection()->executeQuery($sql)->fetchAll(); diff --git a/module/Application/src/Application/Service/Dossier.php b/module/Application/src/Application/Service/Dossier.php index 2224e556d5595f1940568d094ab4ae4fc391322d..0e2323a060d98aed343ffa7c172b2140463beeff 100644 --- a/module/Application/src/Application/Service/Dossier.php +++ b/module/Application/src/Application/Service/Dossier.php @@ -164,7 +164,7 @@ class Dossier extends AbstractEntityService ->set("t.histoDestruction", ":destruction") ->set("t.histoDestructeur", ":destructeur") ->where("t.intervenant = :intervenant") - ->andWhere("1 = compriseEntre(t.histoCreation, t.histoDestruction)"); + ->andWhere("t.histoDestruction IS NULL"); $qb ->setParameter('intervenant', $intervenant) diff --git a/module/Application/src/Application/Service/DotationService.php b/module/Application/src/Application/Service/DotationService.php index d02ae8631734f4a9146bdee5909b97e44fff4dbc..e88b889b7dc0f0a762cae5dc6d68f9bf243b2040 100644 --- a/module/Application/src/Application/Service/DotationService.php +++ b/module/Application/src/Application/Service/DotationService.php @@ -58,7 +58,7 @@ class DotationService extends AbstractEntityService FROM dotation d WHERE - 1 = ose_divers.comprise_entre(d.histo_creation, d.histo_destruction) + d.histo_destruction IS NULL AND d.annee_id = :annee ".Util::sqlAndIn('structure_id', $structures)." GROUP BY diff --git a/module/Application/src/Application/Service/ElementPedagogique.php b/module/Application/src/Application/Service/ElementPedagogique.php index daed5137178bc22676f1e5eefaffc4a35b925ac6..19df6f45bf246204edd17d75d55350984860d53d 100644 --- a/module/Application/src/Application/Service/ElementPedagogique.php +++ b/module/Application/src/Application/Service/ElementPedagogique.php @@ -134,14 +134,14 @@ select * from ( ep.source_code || ' ' || ep.libelle|| ' ' || e.source_code || ' ' || e.libelle || ' ' || gtf.LIBELLE_COURT || ' ' || e.NIVEAU || ' ' || tf.LIBELLE_COURT etape_info from chemin_pedagogique cp - JOIN element_pedagogique ep ON$af cp.element_pedagogique_id = ep.id and 1 = ose_divers.comprise_entre( ep.histo_creation, ep.histo_destruction)$orEp + JOIN element_pedagogique ep ON$af cp.element_pedagogique_id = ep.id AND ep.histo_destruction IS NULL$orEp JOIN etape e ON cp.etape_id = e.id JOIN TYPE_FORMATION tf on e.TYPE_FORMATION_ID = tf.ID JOIN GROUPE_TYPE_FORMATION gtf on tf.GROUPE_ID = gtf.ID JOIN structure s ON ep.structure_id = s.id LEFT JOIN periode pe ON ep.periode_id = pe.id where - (1 = ose_divers.comprise_entre( cp.histo_creation, cp.histo_destruction )$orCp) + (cp.histo_destruction IS NULL$orCp) and $whereTerm $whereContext order by diff --git a/module/Application/src/Application/Service/Intervenant.php b/module/Application/src/Application/Service/Intervenant.php index dda511daf3f1f1517f3c9e486e7287362143c972..a3dd7b1b096e53708e192ce9ef2ffa6b03017a66 100644 --- a/module/Application/src/Application/Service/Intervenant.php +++ b/module/Application/src/Application/Service/Intervenant.php @@ -218,7 +218,7 @@ class Intervenant extends AbstractEntityService WHERE service_id IN (SELECT id FROM service s WHERE intervenant_id = $id - AND 0 = OSE_DIVERS.COMPRISE_ENTRE(s.histo_creation, s.histo_destruction) + AND s.histo_destruction IS NOT NULL ) "; @@ -227,7 +227,7 @@ class Intervenant extends AbstractEntityService WHERE service_referentiel_id IN (SELECT id FROM service_referentiel s WHERE intervenant_id = $id - AND 0 = OSE_DIVERS.COMPRISE_ENTRE(s.histo_creation, s.histo_destruction) + AND s.histo_destruction IS NOT NULL ) "; @@ -251,7 +251,7 @@ class Intervenant extends AbstractEntityService $depTable WHERE intervenant_id = $id - AND 0 = OSE_DIVERS.COMPRISE_ENTRE(histo_creation, histo_destruction)"; + AND histo_destruction IS NOT NULL"; } foreach( $sqls as $sql ){ diff --git a/module/Application/src/Application/Service/NotificationIndicateur.php b/module/Application/src/Application/Service/NotificationIndicateur.php index 7ba680c0208dd6e749de1db59b66070d5d5b9433..2867e90fe773f25f4b6a22fb151b8ba21c3b3ee2 100644 --- a/module/Application/src/Application/Service/NotificationIndicateur.php +++ b/module/Application/src/Application/Service/NotificationIndicateur.php @@ -127,7 +127,7 @@ class NotificationIndicateur extends AbstractEntityService ->andWhere('ni.frequence IS NOT NULL') ->andWhere('i.enabled = true') - ->andWhere('1 = compriseEntre( a.histoCreation, a.histoDestruction )') + ->andWhere('a.histoDestruction IS NULL') ; if (!$force){ diff --git a/module/Application/src/Application/Service/SeuilChargeService.php b/module/Application/src/Application/Service/SeuilChargeService.php index 56b7170e0467072464abcdc3a1eba4e8c02886d3..e7beb3e4da1ad29eaed91e5695b43720adf85327 100755 --- a/module/Application/src/Application/Service/SeuilChargeService.php +++ b/module/Application/src/Application/Service/SeuilChargeService.php @@ -269,11 +269,11 @@ class SeuilChargeService extends AbstractEntityService type_intervention ti LEFT JOIN type_intervention_structure tis ON tis.type_intervention_id = ti.id - AND 1 = OSE_DIVERS.COMPRISE_ENTRE( tis.histo_creation, tis.histo_destruction ) + AND tis.histo_destruction IS NULL AND :annee BETWEEN NVL(tis.annee_debut_id,1) AND NVL(tis.annee_fin_id,999999999) " . ($structure ? 'AND tis.structure_id = ' . $structure->getId() : '') . " WHERE - 1 = OSE_DIVERS.COMPRISE_ENTRE( ti.histo_creation, ti.histo_destruction ) + ti.histo_destruction IS NULL ORDER BY ti.ordre "; @@ -316,9 +316,9 @@ class SeuilChargeService extends AbstractEntityService JOIN type_formation tf ON tf.id = e.type_formation_id JOIN groupe_type_formation gtf ON gtf.id = tf.groupe_id - AND 1 = OSE_DIVERS.COMPRISE_ENTRE( gtf.histo_creation, gtf.histo_destruction ) + AND gtf.histo_destruction IS NULL WHERE - 1 = OSE_DIVERS.COMPRISE_ENTRE( e.histo_creation, e.histo_destruction ) + e.histo_destruction IS NULL ORDER BY gtf.ordre diff --git a/module/Application/src/Application/Service/TauxHoraireHETDService.php b/module/Application/src/Application/Service/TauxHoraireHETDService.php index 60946c9a549a48ceaa581a55508d4713611bba73..faed5440d7118d1ff060c214a244dde8e3c4d60f 100755 --- a/module/Application/src/Application/Service/TauxHoraireHETDService.php +++ b/module/Application/src/Application/Service/TauxHoraireHETDService.php @@ -51,19 +51,20 @@ class TauxHoraireHETDService extends AbstractEntityService { if (!$date) $date = new \DateTime(); - $dql = " - SELECT - thh - FROM - Application\Entity\Db\TauxHoraireHETD thh - WHERE - 1 = compriseEntre( thh.histoCreation, thh.histoDestruction, :date ) - AND thh.histoCreation <= :date - ORDER BY - thh.histoCreation DESC + $date = $date->format('Y-m-d'); + + $sql = " + SELECT id + FROM taux_horaire_hetd t + WHERE TO_DATE(:date,'YYYY-MM-DD') BETWEEN t.histo_creation AND COALESCE(t.histo_destruction,SYSDATE) AND rownum = 1 + ORDER BY histo_creation DESC "; - return $this->getEntityManager()->createQuery($dql)->setParameter('date', $date)->setMaxResults(1)->getOneOrNullResult(); + $res = $this->getEntityManager()->getConnection()->fetchAll($sql, ['date' => $date]); + $id = (int)$res[0]['ID']; + + return $this->getEntityManager()->getRepository(TauxHoraireHETD::class)->find($id); + } } \ No newline at end of file