Commit 41e021b7 authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Refonte de l'infrastructure de gestion de la formule de calcul

et nouvelle implémentation de la formule
parent 91a6aba4
...@@ -7,20 +7,3 @@ ...@@ -7,20 +7,3 @@
* @var $sl \Zend\ServiceManager\ServiceLocatorInterface * @var $sl \Zend\ServiceManager\ServiceLocatorInterface
*/ */
use Application\Service\EtatVolumeHoraireService;
use Application\Service\FormuleResultatService;
use Application\Service\IntervenantService;
use Application\Service\TypeVolumeHoraireService;
$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);
$data = $frs->getData($intervenant, $typeVolumeHoraire, $etatVolumeHoraire);
unset($data['structure-affectation']);
var_dump($data );
\ No newline at end of file
...@@ -7,69 +7,69 @@ ...@@ -7,69 +7,69 @@
* @var $sl \Zend\ServiceManager\ServiceLocatorInterface * @var $sl \Zend\ServiceManager\ServiceLocatorInterface
*/ */
use Application\Connecteur\LdapConnecteur; use Application\Entity\Db\Fichier;
use Application\Constants; use Application\Entity\Db\PieceJointe;
use Doctrine\ORM\EntityManager; use Application\Entity\Db\Validation;
use UnicaenApp\Mapper\Ldap\People; use Application\Service\FichierService;
use Application\Service\IntervenantService;
use Application\Service\PieceJointeService;
use Application\Service\TypePieceJointeService;
use Application\Service\TypeValidationService;
use Application\Service\ValidationService;
use Application\Service\WorkflowService;
$sql = ' $dirs = scandir('/home/laurent/cv');
SELECT //$dirs = ['2624.pdf'];
a.id, /** @var IntervenantService $si */
p.supann_emp_id $si = $sl->get(IntervenantService::class);
FROM
affectation a
JOIN personnel p ON p.id = a.personnel_id
WHERE
a.histo_destruction IS NULL
';
/** @var EntityManager $em */ $typePieceJointe = $sl->get(TypePieceJointeService::class)->get(1);
$em = $sl->get(Constants::BDD); $tvPJ = $sl->get(TypeValidationService::class)->get(4);
$tvFichier = $sl->get(TypeValidationService::class)->get(5);
/** @var People $ldap */ foreach( $dirs as $dir ){
$ldapMapper = $sl->get('ldap_people_mapper'); if ($dir == '.' || $dir == '..') continue;
/** @var LdapConnecteur $ldap */ $code = explode('.', $dir)[0];
$ldap = $sl->get(LdapConnecteur::class);
$a = $em->getConnection()->fetchAll($sql); $intervenant = $si->getBySourceCode($code);
foreach( $a as $aff ){ $fichier = new Fichier();
$p = $ldapMapper->findOneByNoIndividu($aff['SUPANN_EMP_ID'], true); $fichier->setContenu(file_get_contents('/home/laurent/cv/'.$dir));
$aid = $aff['ID']; $fichier->setNom($dir);
if ($p){ $fichier->setTaille(filesize('/home/laurent/cv/'.$dir));
$login = $p->getSupannAliasLogin(); $fichier->setTypeMime('application/pdf');
$utilisateur = $ldap->getUtilisateur($login); $valFichier = new Validation();
$valFichier->setIntervenant($intervenant);
$valFichier->setTypeValidation($tvFichier);
$valFichier->setStructure($intervenant->getStructure());
$sl->get(ValidationService::class)->save($valFichier);
$fichier->setValidation($valFichier);
$uid = $utilisateur->getId(); $pj = $sl->get(PieceJointeService::class)->getByType($intervenant, $typePieceJointe);
$usql = "UPDATE affectation SET utilisateur_id=$uid WHERE id = $aid;"; if (!$pj || !$pj->estNonHistorise()) {
echo $usql."<br />"; $pj = new PieceJointe();
$pj->setIntervenant($intervenant);
$pj->setType($typePieceJointe);
$sl->get(PieceJointeService::class)->save($pj);
} }
} $sl->get(FichierService::class)->save($fichier);
/* $sql = "INSERT INTO piece_jointe_fichier(piece_jointe_id,fichier_id) values (".$pj->getId().",".$fichier->getId().")";
select /* Validation */
a.id, if (!($pj->getValidation() && $pj->getValidation()->estNonHistorise())){
p.nom_usuel || ' ' || p.prenom personnel, $validation = new Validation();
p.supann_emp_id supp, $validation->setIntervenant($intervenant);
r.libelle role, $validation->setTypeValidation($tvPJ);
s.libelle_court structure, $validation->setStructure($intervenant->getStructure());
s.libelle source, $sl->get(ValidationService::class)->save($validation);
a.source_code a_sc, $pj->setValidation($validation);
p.source_code p_sc $sl->get(PieceJointeService::class)->save($pj);
from }
affectation a
JOIN source s ON s.id = a.source_id
JOIN personnel p ON p.id = a.personnel_id
JOIN role r ON r.id = a.role_id
LEFT JOIN structure s ON s.id = a.structure_id
where
a.utilisateur_id is null
and a.histo_destruction is null;
update affectation set utilisateur_id = 1 where id = 1; $sl->get(WorkflowService::class)->calculerTableauxBord([], $intervenant);
delete from affectation where utilisateur_id is null;
*/ echo $dir.' '.$intervenant->getCode()."<br />";
\ No newline at end of file }
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
], ],
"require" : { "require" : {
"php" : "^7.0", "php" : "^7.0",
"unicaen/app" : "1.3.16", "unicaen/app" : "1.3.21",
"unicaen/auth" : "1.2.13", "unicaen/auth" : "1.2.18",
"zendframework/zend-code" : "^2.4", "zendframework/zend-code" : "^2.4",
"zendframework/zend-text" : "^2.4", "zendframework/zend-text" : "^2.4",
"bjyoungblood/bjy-authorize": "dev-master", "bjyoungblood/bjy-authorize": "dev-master",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "e0242f63ab7d625a4f4b2b15d3ad8d99", "content-hash": "782d389b10ffacb1bc285c94d038d271",
"packages": [ "packages": [
{ {
"name": "bjyoungblood/bjy-authorize", "name": "bjyoungblood/bjy-authorize",
...@@ -881,16 +881,16 @@ ...@@ -881,16 +881,16 @@
}, },
{ {
"name": "jasig/phpcas", "name": "jasig/phpcas",
"version": "1.3.5", "version": "1.3.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/apereo/phpCAS.git", "url": "https://github.com/apereo/phpCAS.git",
"reference": "61c8899c8f91204e8b9135d795461e50fe5c2db0" "reference": "7972833e84f6ee5fa41f1479eab5d855109627f5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/apereo/phpCAS/zipball/61c8899c8f91204e8b9135d795461e50fe5c2db0", "url": "https://api.github.com/repos/apereo/phpCAS/zipball/7972833e84f6ee5fa41f1479eab5d855109627f5",
"reference": "61c8899c8f91204e8b9135d795461e50fe5c2db0", "reference": "7972833e84f6ee5fa41f1479eab5d855109627f5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -928,10 +928,11 @@ ...@@ -928,10 +928,11 @@
"description": "Provides a simple API for authenticating users against a CAS server", "description": "Provides a simple API for authenticating users against a CAS server",
"homepage": "https://wiki.jasig.org/display/CASC/phpCAS", "homepage": "https://wiki.jasig.org/display/CASC/phpCAS",
"keywords": [ "keywords": [
"apereo",
"cas", "cas",
"jasig" "jasig"
], ],
"time": "2017-04-10T19:12:45+00:00" "time": "2018-10-25T20:22:09+00:00"
}, },
{ {
"name": "kriswallsmith/assetic", "name": "kriswallsmith/assetic",
...@@ -1060,16 +1061,16 @@ ...@@ -1060,16 +1061,16 @@
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "1.0.2", "version": "1.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -1103,7 +1104,7 @@ ...@@ -1103,7 +1104,7 @@
"psr", "psr",
"psr-3" "psr-3"
], ],
"time": "2016-10-10T12:19:37+00:00" "time": "2018-11-20T15:27:04+00:00"
}, },
{ {
"name": "rwoverdijk/assetmanager", "name": "rwoverdijk/assetmanager",
...@@ -1285,16 +1286,16 @@ ...@@ -1285,16 +1286,16 @@
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
"version": "v3.4.17", "version": "v3.4.20",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/debug.git", "url": "https://github.com/symfony/debug.git",
"reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6" "reference": "a2233f555ddf55e5600f386fba7781cea1cb82d3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/0a612e9dfbd2ccce03eb174365f31ecdca930ff6", "url": "https://api.github.com/repos/symfony/debug/zipball/a2233f555ddf55e5600f386fba7781cea1cb82d3",
"reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6", "reference": "a2233f555ddf55e5600f386fba7781cea1cb82d3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -1337,20 +1338,20 @@ ...@@ -1337,20 +1338,20 @@
], ],
"description": "Symfony Debug Component", "description": "Symfony Debug Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-10-02T16:33:53+00:00" "time": "2018-11-27T12:43:10+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.9.0", "version": "v1.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" "reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", "reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -1396,20 +1397,20 @@ ...@@ -1396,20 +1397,20 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2018-08-06T14:22:27+00:00" "time": "2018-09-21T13:07:52+00:00"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v2.8.46", "version": "v2.8.49",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6" "reference": "c3591a09c78639822b0b290d44edb69bf9f05dc8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6", "url": "https://api.github.com/repos/symfony/process/zipball/c3591a09c78639822b0b290d44edb69bf9f05dc8",
"reference": "f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6", "reference": "c3591a09c78639822b0b290d44edb69bf9f05dc8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -1445,15 +1446,15 @@ ...@@ -1445,15 +1446,15 @@
], ],
"description": "Symfony Process Component", "description": "Symfony Process Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-09-06T17:11:15+00:00" "time": "2018-11-11T11:18:13+00:00"
}, },
{ {
"name": "unicaen/app", "name": "unicaen/app",
"version": "1.3.16", "version": "1.3.21",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.unicaen.fr/lib/unicaen/app.git", "url": "https://git.unicaen.fr/lib/unicaen/app.git",
"reference": "6ebaf169356e018220e26456fe0bd525de4c728a" "reference": "b9bff28b8f304748390ef9b8b8d4f30889147a0f"
}, },
"require": { "require": {
"doctrine/doctrine-orm-module": ">=0.7", "doctrine/doctrine-orm-module": ">=0.7",
...@@ -1496,15 +1497,15 @@ ...@@ -1496,15 +1497,15 @@
] ]
}, },
"description": "Module de base des applications unicaen", "description": "Module de base des applications unicaen",
"time": "2018-09-13T07:34:51+00:00" "time": "2018-12-14T10:27:17+00:00"
}, },
{ {
"name": "unicaen/auth", "name": "unicaen/auth",
"version": "1.2.13", "version": "1.2.18",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.unicaen.fr/lib/unicaen/auth.git", "url": "https://git.unicaen.fr/lib/unicaen/auth.git",
"reference": "037dee5a1d68bc9de93ede25892186c955d95ad3" "reference": "87c6802dfadfcdc8b05602607ea69b959c1ec063"
}, },
"require": { "require": {
"bjyoungblood/bjy-authorize": ">=1.4", "bjyoungblood/bjy-authorize": ">=1.4",
...@@ -1526,7 +1527,7 @@ ...@@ -1526,7 +1527,7 @@
] ]
}, },
"description": "Module d'authentification pour les applications Unicaen", "description": "Module d'authentification pour les applications Unicaen",
"time": "2018-06-13T09:28:44+00:00" "time": "2018-11-19T16:04:53+00:00"
}, },
{ {
"name": "unicaen/code", "name": "unicaen/code",
...@@ -1604,11 +1605,11 @@ ...@@ -1604,11 +1605,11 @@
}, },
{ {
"name": "unicaen/oracle", "name": "unicaen/oracle",
"version": "1.2.1", "version": "1.2.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.unicaen.fr/lib/unicaen/oracle.git", "url": "https://git.unicaen.fr/lib/unicaen/oracle.git",
"reference": "fc16a7394c40ffa50324f7028e90431f9ecae12a" "reference": "bc79ca51396e377999225c02f1726a153a2f342c"
}, },
"require": { "require": {
"doctrine/dbal": "^2.5", "doctrine/dbal": "^2.5",
...@@ -1628,7 +1629,7 @@ ...@@ -1628,7 +1629,7 @@
] ]
}, },
"description": "Bibliothèque utile lorsqu'on utilise un base de données Oracle", "description": "Bibliothèque utile lorsqu'on utilise un base de données Oracle",
"time": "2018-09-11T07:47:55+00:00" "time": "2018-12-06T10:39:40+00:00"
}, },
{ {
"name": "unicaen/tbl", "name": "unicaen/tbl",
......
...@@ -49,6 +49,25 @@ INSERT INTO parametre ( ...@@ -49,6 +49,25 @@ INSERT INTO parametre (
); );
UPDATE tbl SET feuille_de_route = 1 WHERE tbl_name IN (
'agrement',
'cloture_realise',
'contrat',
'dossier',
'paiement',
'piece_jointe',
'piece_jointe_demande',
'piece_jointe_fournie',
'service',
'service_referentiel',
'service_saisie',
'validation_referentiel',
'workflow',
'validation_enseignement',
'formule'
);
-- =!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!= -- =!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
-- = bien ajouter les requêtes de modif de DDL générées ! ! ! ! = -- = bien ajouter les requêtes de modif de DDL générées ! ! ! ! =
-- =!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!= -- =!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
\ No newline at end of file
...@@ -250,7 +250,7 @@ class DossierFieldset extends AbstractFieldset ...@@ -250,7 +250,7 @@ class DossierFieldset extends AbstractFieldset
'label' => 'Adresse mail personnelle (éventuelle)', 'label' => 'Adresse mail personnelle (éventuelle)',
], ],
'attributes' => [ 'attributes' => [
'info_icon' => "Si vous renseignez une adresse mail perso, celle-ci sera uttilisée pour vous contacter.", 'info_icon' => "Si vous renseignez une adresse mail perso, celle-ci sera utilisée pour vous contacter.",
'readonly' => false, 'readonly' => false,
], ],
'type' => 'Text', 'type' => 'Text',
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
namespace Application\Service; namespace Application\Service;
use Application\Entity\Db\ElementPedagogique;
use Application\Entity\Db\Etablissement;
use Application\Entity\Db\EtatVolumeHoraire; use Application\Entity\Db\EtatVolumeHoraire;
use Application\Entity\Db\Intervenant; use Application\Entity\Db\Intervenant;
use Application\Entity\Db\Structure; use Application\Entity\Db\Structure;
...@@ -213,6 +215,15 @@ class FormuleResultatService extends AbstractEntityService ...@@ -213,6 +215,15 @@ class FormuleResultatService extends AbstractEntityService
foreach ($fr as $k => $v) { foreach ($fr as $k => $v) {
$data[$k] = $v; $data[$k] = $v;
} }
$data['SERVICE_TOTAL'] = $data['SERVICE_FI']
+ $data['SERVICE_FA']
+ $data['SERVICE_FC']
+ $data['SERVICE_REFERENTIEL'];
$data['HEURES_COMPL_TOTAL'] = $data['HEURES_COMPL_FI']
+ $data['HEURES_COMPL_FA']
+ $data['HEURES_COMPL_FC']
+ $data['HEURES_COMPL_FC_MAJOREES']
+ $data['HEURES_COMPL_REFERENTIEL'];
$sql = "SELECT * FROM formule_resultat_service WHERE formule_resultat_id = :frId"; $sql = "SELECT * FROM formule_resultat_service WHERE formule_resultat_id = :frId";
$frss = $conn->fetchAll($sql, compact('frId')); $frss = $conn->fetchAll($sql, compact('frId'));
foreach ($frss as $frs) { foreach ($frss as $frs) {
...@@ -245,6 +256,27 @@ class FormuleResultatService extends AbstractEntityService ...@@ -245,6 +256,27 @@ class FormuleResultatService extends AbstractEntityService
return $ti1->getOrdre() > $ti2->getOrdre(); return $ti1->getOrdre() > $ti2->getOrdre();
}); });
usort($data['s'], function ($ee1, $ee2) {
if ($ee1['element-etablissement'] instanceof ElementPedagogique){
$ee1Code = $ee1['element-etablissement']->getCode();
}elseif($ee1['element-etablissement'] instanceof Etablissement){
$ee1Code = $ee1['element-etablissement']->getLibelle();
}
if ($ee2['element-etablissement'] instanceof ElementPedagogique){
$ee2Code = $ee2['element-etablissement']->getCode();
}elseif($ee2['element-etablissement'] instanceof Etablissement){
$ee2Code = $ee2['element-etablissement']->getLibelle();
}
return $ee1Code > $ee2Code;
});
usort($data['r'], function ($r1, $r2) {
return $r1['fonction']->getLibelleCourt() > $r2['fonction']->getLibelleCourt();
});
return $data; return $data;
} }
} }
\ No newline at end of file
...@@ -211,11 +211,11 @@ function vn(array $array, $key, $type = 's') ...@@ -211,11 +211,11 @@ function vn(array $array, $key, $type = 's')
<div class="col-sm-2 nombre"><?= vn($data, 'SERVICE_FI') ?></div> <div class="col-sm-2 nombre"><?= vn($data, 'SERVICE_FI') ?></div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-4">Service FA</div> <div class="col-sm-4">+ Service FA</div>
<div class="col-sm-2 nombre"><?= vn($data, 'SERVICE_FA') ?></div> <div class="col-sm-2 nombre"><?= vn($data, 'SERVICE_FA') ?></div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-4">Service FC</div> <div class="col-sm-4">+ Service FC</div>
<div class="col-sm-2 nombre"><?= vn($data, 'SERVICE_FC') ?></div> <div class="col-sm-2 nombre"><?= vn($data, 'SERVICE_FC') ?></div>
</div> </div>
<div class="row"> <div class="row">
...@@ -225,7 +225,7 @@ function vn(array $array, $key, $type = 's') ...@@ -225,7 +225,7 @@ function vn(array $array, $key, $type = 's')
<div class="row"> <div class="row">
<div class="col-sm-4">= Service assuré</div> <div class="col-sm-4">= Service assuré</div>
<div class="col-sm-2 nombre"><span class="label label-info" <div class="col-sm-2 nombre"><span class="label label-info"
style="font-size:12pt"><?= vn($data, 'TOTAL') ?></span> style="font-size:12pt"><?= vn($data, 'SERVICE_TOTAL') ?></span>
</div> </div>
</div> </div>