Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
open-source
OSE
Commits
91a6aba4
Commit
91a6aba4
authored
Dec 12, 2018
by
Laurent Lécluse
Browse files
Modification de l'infrastructure de gestion de la formule de calcul
parent
35aa0192
Changes
46
Expand all
Hide whitespace changes
Inline
Side-by-side
code/test1.php
View file @
91a6aba4
...
...
@@ -7,124 +7,20 @@
* @var $sl \Zend\ServiceManager\ServiceLocatorInterface
*/
use
Application\Service\StructureService
;
use
UnicaenApp\Util
;
use
Application\Service\EtatVolumeHoraireService
;
use
Application\Service\FormuleResultatService
;
use
Application\Service\IntervenantService
;
use
Application\Service\TypeVolumeHoraireService
;
$d
=
"'M','SCOUARNEC ','Jean-Max','EPS',04/04/1963,'France'
'M','BERTHELEM ','Eric','EPS',26/10/1956,'France'
'M','LEVASSEUR','Pierre-Yves','EPS',14/07/1985,'France'
'MME','LEMEE ','Sabine','EPS',18/09/1977,'France'
'M','BIDEL','Arnaud','EPS',21/11/1979,'France'
'M','HENRY','Jean-Luc','EPS',27/06/1977,'France'
'M','AUSSANT','Jean','EPS',06/12/1970,'France'
'M','PHILIPPE','Ludovic','EPS',27/05/1977,'France'
'M','ANDRE ','Vivien','EPS',17/04/1986,'France'
'M','JEANNE ','Pierre','EPS',15/10/1974,'France'
'MME','LETEINTURIER ','Caroline','Lettres',26/11/1976,'France'
'MME','FERNANDES ','Florinda','LVE Anglais',23/01/1974,'France'
'M','VAUDEVIRE ','Stéphane','LVE Anglais',05/02/1972,'France'
'M','ROUQUIER ','Philippe','LVE Anglais',10/06/1976,'France'
'MME','BOUHACEIN ','Caroline','LVE Espagnol',27/10/1973,'France'
'M','PINSAULT ','Nicolas','LVE Espagnol',13/03/1970,'France'
'M','BONINI ','Jean-François','LVE Italien',29/12/1956,'Maroc'
'MME','CARTHY','Karthleen','LVE Italien',12/11/1974,'France'
'M','LABBATE ','Ettore','LVE Italien',11/07/1973,'Italie'
'MME','DESCAMPS ','Sarah','LVE Allemand',02/02/1966,'France'
'MME','LANERY ','Hélène','Mathématiques',30/11/1972,'France'
'M','LEFEUVRE ','Yann','Mathématiques',04/07/1972,'France'
'MME','BOBLIN ','Emmanuele','Mathématiques',28/09/1959,'France'
'MME','WEIBEL','Nathalie','Mathématiques',09/04/1973,'France'
'MME','RODRIGUES DE OLIVEIR','Lisa','Philosophie',21/06/1973,'France'
'MME','MACHEFERT ','Hélène','Philosophie',15/05/1972,'France'
'MME','ARNOUX ','Frédérique','Physique chimie',09/03/1972,'France'
'MME','CHARMARTY ','Sandrine','Physique chimie',07/11/1973,'France'
'M','ROUX ','Giovanni','Physique chimie',10/04/1978,'France'
'MME','SEIGLE ','Mélanie','Physique chimie',20/05/1971,'France'
'M','ORLANDI','Daniel','SES',02/11/1970,'Italie'
'M','ANDRE ','Cédric','SES',01/07/1972,'France'
'M','MOLINA ','Stéphane','SES',05/04/1959,'France'
'M','COUTABLE ','Grégory','STI',25/09/1972,'France'
'M','JOUAUX ','François','STI',05/11/1984,'France'
'M','CAILMAIL ','Philippe','STI',16/04/1972,'France'
'M','CHARDON','Jean-Max','Champs pro',27/03/1963,'France'
'MME','DATHEE-BEAUGE','Anne-Gaelle','Champs pro',15/03/1976,'France'
'MME','LEFORT ','Marie','Champs pro',17/06/1961,'France'
'MME','LEROY ','Christine','Champs pro',30/01/1962,'France'
'MME','PICARD ','Dominique','Champs pro',21/10/1964,'France'
'MME','SEPARI ','Guilaine','Champs pro',04/08/1966,'France'
'M','GILLES ','Arnaud','SVT',27/11/1981,'France'
'M','PITT ','Grégoire','SVT',23/09/1986,'France'
'M','RIBOT ','Nicolas','SVT',08/07/1975,'France'
'MME','DUVIVIER-FAUCHET','Delphine','SVT',03/06/1973,'France'
'MME','HENRY ','Catherine','CPE',04/02/1958,'France'"
;
$intervenant
=
$sl
->
get
(
IntervenantService
::
class
)
->
get
(
648
);
$typeVolumeHoraire
=
$sl
->
get
(
TypeVolumeHoraireService
::
class
)
->
get
(
1
);
$etatVolumeHoraire
=
$sl
->
get
(
EtatVolumeHoraireService
::
class
)
->
get
(
1
);
$frs
=
$sl
->
get
(
FormuleResultatService
::
class
);
$d
=
explode
(
"
\n
"
,
$d
);
$index
=
1
;
echo
'<pre>'
;
foreach
(
$d
as
$l
)
{
$l
=
explode
(
','
,
$l
);
$civilite
=
trim
(
$l
[
0
])
==
"'M'"
?
2
:
1
;
$nom
=
trim
(
substr
(
trim
(
$l
[
1
]),
1
,
-
1
));
$prenom
=
trim
(
substr
(
trim
(
$l
[
2
]),
1
,
-
1
));
$dateNaissance
=
$l
[
4
];
$paysNaissance
=
substr
(
trim
(
$l
[
5
]),
1
,
-
1
);
$code
=
'999999'
.
str_pad
((
string
)(
$index
++
),
2
,
'0'
,
STR_PAD_LEFT
);
$data
=
$frs
->
getData
(
$intervenant
,
$typeVolumeHoraire
,
$etatVolumeHoraire
);
$critere
=
str_replace
(
'_'
,
' '
,
Util
::
reduce
(
$nom
.
' '
.
$prenom
)
);
unset
(
$data
[
'structure-affectation'
]
);
$paysCorresp
=
[
'France'
=>
'456'
,
'Maroc'
=>
'333'
,
'Italie'
=>
'452'
,
];
if
(
isset
(
$paysCorresp
[
$paysNaissance
]))
$paysNaissance
=
$paysCorresp
[
$paysNaissance
];
$sql
=
"
INSERT INTO intervenant (
id,
civilite_id,
nom_usuel,
prenom,
nom_patronymique,
date_naissance,
statut_id,
structure_id,
source_id,
source_code,
histo_creation,
histo_createur_id,
histo_modification,
histo_modificateur_id,
annee_id,
critere_recherche,
code,
supann_emp_id,
pays_naissance_id
) VALUES (
INTERVENANT_ID_SEQ.NEXTVAL,-- id,
$civilite
,-- civilite_id,
'
$nom
',-- nom_usuel,
'
$prenom
',-- prenom,
'
$nom
',-- nom_patronymique,
to_date('
$dateNaissance
', 'dd/mm/YYYY'),-- date_naissance,
31,-- statut_id,
102,-- structure_id,
2,-- source_id,
'
$code
',-- source_code,
sysdate,-- histo_creation,
4,-- histo_createur_id,
sysdate,-- histo_modification,
4,-- histo_modificateur_id,
2017,-- annee_id,
'
$critere
',-- critere_recherche,
'
$code
', -- code,
'
$code
', -- supann_emp_id,
$paysNaissance
-- pays_naissance_id
);
"
;
echo
$sql
;
}
echo
'</pre>'
;
\ No newline at end of file
var_dump
(
$data
);
\ No newline at end of file
module/Application/autoload_classmap.php
View file @
91a6aba4
This diff is collapsed.
Click to expand it.
module/Application/config/formule.config.php
View file @
91a6aba4
...
...
@@ -29,12 +29,6 @@ return [
'service_manager'
=>
[
'invokables'
=>
[
Service\FormuleIntervenantService
::
class
=>
Service\FormuleIntervenantService
::
class
,
Service\FormuleServiceModifieService
::
class
=>
Service\FormuleServiceModifieService
::
class
,
Service\FormuleServiceService
::
class
=>
Service\FormuleServiceService
::
class
,
Service\FormuleServiceReferentielService
::
class
=>
Service\FormuleServiceReferentielService
::
class
,
Service\FormuleVolumeHoraireService
::
class
=>
Service\FormuleVolumeHoraireService
::
class
,
Service\FormuleVolumeHoraireReferentielService
::
class
=>
Service\FormuleVolumeHoraireReferentielService
::
class
,
Service\FormuleResultatService
::
class
=>
Service\FormuleResultatService
::
class
,
Service\FormuleResultatServiceService
::
class
=>
Service\FormuleResultatServiceService
::
class
,
Service\FormuleResultatServiceReferentielService
::
class
=>
Service\FormuleResultatServiceReferentielService
::
class
,
...
...
module/Application/src/Application/Controller/IntervenantController.php
View file @
91a6aba4
...
...
@@ -15,6 +15,7 @@ use Application\Processus\Traits\ServiceReferentielProcessusAwareTrait;
use
Application\Provider\Privilege\Privileges
;
use
Application\Service\Traits\CampagneSaisieServiceAwareTrait
;
use
Application\Service\Traits\EtatVolumeHoraireServiceAwareTrait
;
use
Application\Service\Traits\FormuleResultatServiceAwareTrait
;
use
Application\Service\Traits\LocalContextServiceAwareTrait
;
use
Application\Service\Traits\TypeVolumeHoraireServiceAwareTrait
;
use
Application\Service\Traits\ValidationServiceAwareTrait
;
...
...
@@ -24,7 +25,6 @@ use LogicException;
use
Application\Entity\Db\Intervenant
;
use
Application\Service\Traits\ContextServiceAwareTrait
;
use
Application\Service\Traits\IntervenantServiceAwareTrait
;
use
Application\Service\Traits\TypeHeuresServiceAwareTrait
;
use
UnicaenApp\View\Model\MessengerViewModel
;
use
Zend\View\Model\ViewModel
;
...
...
@@ -37,7 +37,6 @@ class IntervenantController extends AbstractController
use
WorkflowServiceAwareTrait
;
use
ContextServiceAwareTrait
;
use
IntervenantServiceAwareTrait
;
use
TypeHeuresServiceAwareTrait
;
use
HeuresCompFormAwareTrait
;
use
SessionContainerTrait
;
use
EditionFormAwareTrait
;
...
...
@@ -50,6 +49,7 @@ class IntervenantController extends AbstractController
use
CampagneSaisieServiceAwareTrait
;
use
ValidationServiceAwareTrait
;
use
PlafondProcessusAwareTrait
;
use
FormuleResultatServiceAwareTrait
;
...
...
@@ -286,11 +286,6 @@ class IntervenantController extends AbstractController
public
function
voirHeuresCompAction
()
{
$this
->
em
()
->
getFilters
()
->
enable
(
'historique'
)
->
init
([
\
Application\Entity\Db\Service
::
class
,
\
Application\Entity\Db\VolumeHoraire
::
class
,
]);
$intervenant
=
$this
->
getEvent
()
->
getParam
(
'intervenant'
);
/* @var $intervenant \Application\Entity\Db\Intervenant */
...
...
@@ -312,156 +307,18 @@ class IntervenantController extends AbstractController
throw
new
LogicException
(
'Etat de volume horaire erroné'
);
}
$typesHeures
=
$this
->
getServiceTypeHeures
()
->
getList
();
$form
->
setData
([
'type-volume-horaire'
=>
$typeVolumeHoraire
->
getId
(),
'etat-volume-horaire'
=>
$etatVolumeHoraire
->
getId
(),
]);
$data
=
[
'structure-affectation'
=>
$intervenant
->
getStructure
(),
'heures-service-statutaire'
=>
$intervenant
->
getStatut
()
->
getServiceStatutaire
(),
'heures-modification-service'
=>
$intervenant
->
getFormuleIntervenant
()
->
getUniqueFormuleServiceModifie
()
->
getHeures
(),
'heures-decharge'
=>
$intervenant
->
getFormuleIntervenant
()
->
getUniqueFormuleServiceModifie
()
->
getHeuresDecharge
(),
'services'
=>
[],
'referentiel'
=>
[],
'types-intervention'
=>
[],
'has-ponderation-service-compl'
=>
false
,
'th-taux'
=>
[],
'th-service'
=>
[],
'th-compl'
=>
[],
];
$referentiels
=
$intervenant
->
getFormuleIntervenant
()
->
getFormuleServiceReferentiel
();
foreach
(
$referentiels
as
$referentiel
)
{
/* @var $referentiel \Application\Entity\Db\FormuleServiceReferentiel */
if
(
!
isset
(
$data
[
'referentiel'
][
$referentiel
->
getStructure
()
->
getId
()]))
{
$data
[
'referentiel'
][
$referentiel
->
getStructure
()
->
getId
()]
=
[
'structure'
=>
$referentiel
->
getStructure
(),
'heures'
=>
0
,
'hetd'
=>
0
,
'hetd-compl'
=>
0
,
'service-statutaire'
=>
$referentiel
->
isServiceStatutaire
(),
];
}
$data
[
'referentiel'
][
$referentiel
->
getStructure
()
->
getId
()][
'heures'
]
+=
$referentiel
->
getHeures
(
$typeVolumeHoraire
,
$etatVolumeHoraire
);
$frr
=
$referentiel
->
getServiceReferentiel
()
->
getUniqueFormuleResultatServiceReferentiel
(
$typeVolumeHoraire
,
$etatVolumeHoraire
);
$data
[
'referentiel'
][
$referentiel
->
getStructure
()
->
getId
()][
'hetd'
]
+=
$frr
?
$frr
->
getHeuresServiceReferentiel
()
:
0
;
$data
[
'referentiel'
][
$referentiel
->
getStructure
()
->
getId
()][
'hetd-compl'
]
+=
$frr
?
$frr
->
getHeuresComplReferentiel
()
:
0
;
}
$services
=
$intervenant
->
getFormuleIntervenant
()
->
getFormuleService
();
foreach
(
$services
as
$service
)
{
$dsId
=
$service
->
getId
();
$ds
=
[];
/* @var $service \Application\Entity\Db\FormuleService */
$typesIntervention
=
[];
$totalHeures
=
0
;
$fvhs
=
$service
->
getFormuleVolumeHoraire
(
$typeVolumeHoraire
,
$etatVolumeHoraire
);
foreach
(
$fvhs
as
$fvh
)
{
/* @var $fvh \Application\Entity\Db\FormuleVolumeHoraire */
$totalHeures
+=
$fvh
->
getHeures
();
if
(
!
isset
(
$typesIntervention
[
$fvh
->
getTypeIntervention
()
->
getId
()]))
{
$typesIntervention
[
$fvh
->
getTypeIntervention
()
->
getId
()]
=
[
'type-intervention'
=>
$fvh
->
getTypeIntervention
(),
'heures'
=>
0
,
'hetd'
=>
0
,
];
}
$typesIntervention
[
$fvh
->
getTypeIntervention
()
->
getId
()][
'heures'
]
+=
$fvh
->
getHeures
();
$hetd
=
0
;
if
(
$frvh
=
$fvh
->
getVolumeHoraire
()
->
getFormuleResultatVolumeHoraire
())
{
if
(
$frvhf
=
$frvh
->
first
())
{
$hetd
=
$frvhf
->
getTotal
();
}
}
$typesIntervention
[
$fvh
->
getTypeIntervention
()
->
getId
()][
'hetd'
]
+=
$hetd
;
}
if
(
$totalHeures
>
0
)
{
$frs
=
$service
->
getService
()
->
getUniqueFormuleResultatService
(
$typeVolumeHoraire
,
$etatVolumeHoraire
);
if
(
1.0
!==
$service
->
getPonderationServiceCompl
())
{
$data
[
'has-ponderation-service-compl'
]
=
true
;
}
$ds
=
[
'element-etablissement'
=>
$service
->
getService
()
->
getElementPedagogique
()
?
$service
->
getService
()
->
getElementPedagogique
()
:
$service
->
getService
()
->
getEtablissement
(),
'taux'
=>
[],
'structure'
=>
$service
->
getService
()
->
getElementPedagogique
()
?
$service
->
getService
()
->
getElementPedagogique
()
->
getStructure
()
:
$service
->
getService
()
->
getIntervenant
()
->
getStructure
(),
'ponderation-service-compl'
=>
$service
->
getPonderationServiceCompl
(),
'service-statutaire'
=>
$service
->
isServiceStatutaire
(),
'heures'
=>
[],
'hetd'
=>
[
'total'
=>
0
,
],
];
foreach
(
$typesHeures
as
$typeHeures
)
{
/* @var $typeHeures \Application\Entity\Db\TypeHeures */
// taux
try
{
$h
=
$service
->
getTaux
(
$typeHeures
);
}
catch
(
\
Exception
$ex
)
{
$h
=
0.0
;
}
if
(
$h
>
0
)
{
$ds
[
'taux'
][
$typeHeures
->
getId
()]
=
$h
;
$data
[
'th-taux'
][
$typeHeures
->
getId
()]
=
$typeHeures
;
}
// HETD service
try
{
$h
=
$frs
->
getHeuresService
(
$typeHeures
);
}
catch
(
\
Exception
$ex
)
{
$h
=
0.0
;
}
if
(
$h
>
0
)
{
$ds
[
'hetd'
][
'service'
][
$typeHeures
->
getId
()]
=
$h
;
$data
[
'th-service'
][
$typeHeures
->
getId
()]
=
$typeHeures
;
}
// HETD compl
try
{
$h
=
$frs
->
getHeuresCompl
(
$typeHeures
);
}
catch
(
\
Exception
$ex
)
{
$h
=
0.0
;
}
if
(
$h
>
0
)
{
$ds
[
'hetd'
][
'compl'
][
$typeHeures
->
getId
()]
=
$h
;
$data
[
'th-compl'
][
$typeHeures
->
getId
()]
=
$typeHeures
;
}
}
foreach
(
$typesIntervention
as
$ti
)
{
if
(
$ti
[
'heures'
]
>
0
)
{
$data
[
'types-intervention'
][
$ti
[
'type-intervention'
]
->
getId
()]
=
$ti
[
'type-intervention'
];
$ds
[
'heures'
][
$ti
[
'type-intervention'
]
->
getId
()]
=
$ti
[
'heures'
];
$ds
[
'hetd'
][
$ti
[
'type-intervention'
]
->
getId
()]
=
$ti
[
'hetd'
];
}
}
$data
[
'services'
][
$dsId
]
=
$ds
;
}
}
usort
(
$data
[
'types-intervention'
],
function
(
$ti1
,
$ti2
)
{
return
$ti1
->
getOrdre
()
>
$ti2
->
getOrdre
();
});
usort
(
$data
[
'th-taux'
],
function
(
$ti1
,
$ti2
)
{
return
$ti1
->
getOrdre
()
>
$ti2
->
getOrdre
();
});
usort
(
$data
[
'th-service'
],
function
(
$ti1
,
$ti2
)
{
return
$ti1
->
getOrdre
()
>
$ti2
->
getOrdre
();
});
usort
(
$data
[
'th-compl'
],
function
(
$ti1
,
$ti2
)
{
return
$ti1
->
getOrdre
()
>
$ti2
->
getOrdre
();
});
$data
=
$this
->
getServiceFormuleResultat
()
->
getData
(
$intervenant
,
$typeVolumeHoraire
,
$etatVolumeHoraire
);
return
compact
(
'form'
,
'intervenant'
,
'typeVolumeHoraire'
,
'etatVolumeHoraire'
,
'data'
);
return
compact
(
'form'
,
'intervenant'
,
'data'
);
}
...
...
module/Application/src/Application/Entity/Db/FormuleIntervenant.php
deleted
100644 → 0
View file @
35aa0192
<?php
namespace
Application\Entity\Db
;
/**
* FormuleIntervenant
*/
class
FormuleIntervenant
{
/**
* @var float
*/
private
$heuresServiceStatutaire
;
/**
* @var integer
*/
private
$id
;
/**
* @var \Application\Entity\Db\Intervenant
*/
private
$intervenant
;
/**
* @var \Doctrine\Common\Collections\Collection
*/
private
$formuleServiceModifie
;
/**
*
* @var boolean
*/
protected
$depassementServiceDuSansHC
;
/**
* @var \Doctrine\Common\Collections\Collection
*/
private
$formuleService
;
/**
* @var \Doctrine\Common\Collections\Collection
*/
private
$formuleServiceReferentiel
;
/**
* @var \Application\Entity\Db\Structure
*/
private
$structure
;
/**
* Constructor
*/
public
function
__construct
()
{
$this
->
formuleServiceModifie
=
new
\
Doctrine\Common\Collections\ArrayCollection
();
$this
->
formuleService
=
new
\
Doctrine\Common\Collections\ArrayCollection
();
$this
->
formuleServiceReferentiel
=
new
\
Doctrine\Common\Collections\ArrayCollection
();
}
/**
* Get heuresServiceStatutaire
*
* @return float
*/
public
function
getHeuresServiceStatutaire
()
{
return
$this
->
heuresServiceStatutaire
;
}
/**
* Get id
*
* @return integer
*/
public
function
getId
()
{
return
$this
->
id
;
}
/**
* Get intervenant
*
* @return \Application\Entity\Db\Intervenant
*/
public
function
getIntervenant
()
{
return
$this
->
intervenant
;
}
/**
* Get formuleServiceModifie
*
* @return \Doctrine\Common\Collections\Collection
*/
public
function
getFormuleServiceModifie
()
{
return
$this
->
formuleServiceModifie
;
}
/**
*
* @return FormuleServiceModifie
*/
public
function
getUniqueFormuleServiceModifie
()
{
$result
=
$this
->
getFormuleServiceModifie
()
->
first
();
if
(
false
===
$result
)
$result
=
new
FormuleServiceModifie
;
return
$result
;
}
/**
*
* @return boolean
*/
function
getDepassementServiceDuSansHC
()
{
return
$this
->
depassementServiceDuSansHC
;
}
/**
*
* @param boolean $depassementServiceDuSansHC
* @return self
*/
function
setDepassementServiceDuSansHC
(
$depassementServiceDuSansHC
)
{
$this
->
depassementServiceDuSansHC
=
$depassementServiceDuSansHC
;
return
$this
;
}
/**
* Get formuleService
*
* @return \Doctrine\Common\Collections\Collection
*/
public
function
getFormuleService
()
{
return
$this
->
formuleService
;
}
/**
* Get formuleServiceReferentiel
*
* @return \Doctrine\Common\Collections\Collection
*/
public
function
getFormuleServiceReferentiel
()
{
return
$this
->
formuleServiceReferentiel
;
}
/**
* Get structure
*
* @return \Application\Entity\Db\Structure
*/
public
function
getStructure
()
{
return
$this
->
structure
;
}
}
module/Application/src/Application/Entity/Db/FormuleService.php
deleted
100644 → 0
View file @
35aa0192
<?php
namespace
Application\Entity\Db
;
/**
* FormuleService
*/
class
FormuleService
{
/**
* @var float
*/
private
$tauxFa
;
/**
* @var float
*/
private
$tauxFc
;
/**
* @var float
*/
private
$tauxFi
;
/**
* @var float
*/
private
$ponderationServiceDu
;
/**
* @var float
*/
private
$ponderationServiceCompl
;
/**
* @var integer
*/
private
$id
;
/**
* @var \Application\Entity\Db\Service
*/
private
$service
;
/**
* @var \Doctrine\Common\Collections\Collection
*/
private
$formuleVolumeHoraire
;
/**
* @var \Application\Entity\Db\Intervenant
*/
private
$intervenant
;
/**
* @var \Application\Entity\Db\FormuleIntervenant
*/
private
$formuleIntervenant
;
/**
* @var bool
*/
private
$serviceStatutaire
=
true
;
/**
* Constructor
*/
public
function
__construct
()
{
$this
->
formuleVolumeHoraire
=
new
\
Doctrine\Common\Collections\ArrayCollection
();