Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OSE
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
OSE
Commits
22bbaa0e
Commit
22bbaa0e
authored
Apr 26, 2023
by
Laurent Lecluse
Browse files
Options
Downloads
Patches
Plain Diff
#46387
on peut saisir des dérogations avant d'avoir des heures à plafonner
parent
284e438a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
module/Plafond/src/Service/PlafondService.php
+33
-15
33 additions, 15 deletions
module/Plafond/src/Service/PlafondService.php
with
33 additions
and
15 deletions
module/Plafond/src/Service/PlafondService.php
+
33
−
15
View file @
22bbaa0e
...
@@ -107,25 +107,43 @@ class PlafondService extends AbstractEntityService
...
@@ -107,25 +107,43 @@ class PlafondService extends AbstractEntityService
/**
* @param TypeVolumeHoraire $typeVolumeHoraire
* @param Structure|Intervenant|ElementPedagogique|VolumeHoraire|FonctionReferentiel $entity
*
* @return PlafondControle[]
*/
public
function
derogations
(
TypeVolumeHoraire
$typeVolumeHoraire
,
Intervenant
$intervenant
):
array
public
function
derogations
(
TypeVolumeHoraire
$typeVolumeHoraire
,
Intervenant
$intervenant
):
array
{
{
$sqls
=
[];
$sql
=
"
SELECT
$sqls
[]
=
$this
->
makeControleQuery
(
$typeVolumeHoraire
,
$intervenant
,
null
,
false
,
false
,
false
);
p.id id,
//$sqls[] = $this->makeControleQuery($typeVolumeHoraire, $intervenant, PlafondPerimetre::STRUCTURE, false, false, false);
p.numero numero,
//$sqls[] = $this->makeControleQuery($typeVolumeHoraire, $intervenant, PlafondPerimetre::ELEMENT, false, false, false);
p.libelle libelle,
//$sqls[] = $this->makeControleQuery($typeVolumeHoraire, $intervenant, PlafondPerimetre::REFERENTIEL, false, false, false);
p.message message,
//$sqls[] = $this->makeControleQuery($typeVolumeHoraire, $intervenant, PlafondPerimetre::VOLUME_HORAIRE, false, false, false);
pp.code perimetre,
pe.code etat,
CASE pe.code WHEN 'bloquant' THEN 1 ELSE 0 END bloquant,
CASE WHEN COALESCE(tpi.heures,0) - ps.heures > 0 THEN 1 ELSE 0 END depassement,
COALESCE(tpi.heures,0) heures,
ps.heures plafond,
COALESCE(pd.heures,0) derogation
FROM
intervenant i
JOIN type_volume_horaire tvh ON 1=1
JOIN statut s ON s.id = i.statut_id
JOIN plafond_statut ps ON ps.statut_id = s.id AND ps.histo_destruction IS NULL
JOIN plafond p ON p.id = ps.plafond_id
JOIN plafond_perimetre pp ON pp.id = p.plafond_perimetre_id
JOIN plafond_etat pe ON pe.id = CASE tvh.code WHEN 'PREVU' THEN ps.plafond_etat_prevu_id WHEN 'REALISE' THEN ps.plafond_etat_realise_id ELSE 0 END
LEFT JOIN tbl_plafond_intervenant tpi ON tpi.intervenant_id = i.id AND tpi.plafond_id = p.id AND tpi.type_volume_horaire_id = tvh.id
LEFT JOIN plafond_derogation pd ON pd.histo_destruction IS NULL AND pd.intervenant_id = i.id AND pd.plafond_id = p.id
WHERE
i.id = :intervenant
AND tvh.id = :typeVolumeHoraire
AND pe.code NOT IN ('desactive', 'indicateur')
"
;
$sql
=
implode
(
"
\n\n
UNION ALL
\n\n
"
,
$sqls
);
$params
=
[
'intervenant'
=>
$intervenant
->
getId
(),
'typeVolumeHoraire'
=>
$typeVolumeHoraire
->
getId
(),
];
$res
=
$this
->
getEntityManager
()
->
getConnection
()
->
fetchAllAssociative
(
$sql
,
$params
);
$res
=
$this
->
getEntityManager
()
->
getConnection
()
->
fetchAllAssociative
(
$sql
);
$depassements
=
[];
$depassements
=
[];
foreach
(
$res
as
$r
)
{
foreach
(
$res
as
$r
)
{
$depassements
[]
=
PlafondControle
::
fromArray
(
$r
);
$depassements
[]
=
PlafondControle
::
fromArray
(
$r
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment