Commit 99cf59ac authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Finalisation de l'IHM des domaines fonctionnels

parents ab82c014 0d1b355b
......@@ -5,9 +5,17 @@ author: Laurent Lécluse - DSI - Unicaen
#OSE 8.1
## Corrections de bugs
* Les avenants comportaient par défaut un champ "modifieComplete" qui n'était pas fourni par la vue.
## Nouveautés
* Il est désormais possible de customiser et/ou de traduire de petites parties de l'application. Attention toutefois : le travail de mise en place du dispositif n'en est qu'au tout début.
* Possibilité de choisir sa formule dans les paramétrages généraux via une liste déroulante
* Formule de calcul de l'université de Montpellier
* Interface de test de la formule de calcul directmement intégrée dans OSE
* Interface d'administration des motifs de modification de service dû
#OSE 8.0.3
......
......@@ -7,8 +7,47 @@
* @var $sl \Zend\ServiceManager\ServiceLocatorInterface
*/
$d = "2015-04-30 15:11:48";
$max = 10;
$r = \DateTime::createFromFormat('Y-m-d H:i:s', $d);
$ress = [];
var_dump( $r);
\ No newline at end of file
for( $i = 1;$i<$max;$i++){
for( $j = 1;$j<$max;$j++){
$res = round($i / $j,6);
if (!in_array($res, $ress)) {
if ($res != round($res, 5)) {
echo "$res: '$i/$j',<br />";
}
$ress[] = $res;
}
}
}
$t = [
'1/3' => 0.333333,
'1/6' => 0.166667,
'1/7' => 0.142857,
'1/9' => 0.111111,
'2/3' => 0.666667,
'2/7' => 0.285714,
'2/9' => 0.222222,
'3/7' => 0.428571,
'4/3' => 1.333333,
'4/7' => 0.571429,
'4/9' => 0.444444,
'5/3' => 1.666667,
'5/6' => 0.833333,
'5/7' => 0.714286,
'5/9' => 0.555556,
'6/7' => 0.857143,
'7/3' => 2.333333,
'7/6' => 1.166667,
'7/9' => 0.777778,
'8/3' => 2.666667,
'8/7' => 1.142857,
'8/9' => 0.888889,
'9/7' => 1.285714,
];
\ No newline at end of file
......@@ -89,4 +89,107 @@ FROM (
UNION ALL SELECT 'formule' c, 'tests' p, 'Tests' l FROM dual
) t1;
\ No newline at end of file
) t1;
CREATE OR REPLACE FORCE VIEW "V_CONTRAT_MAIN" AS
WITH hs AS (
SELECT contrat_id, sum(heures) "serviceTotal" FROM V_CONTRAT_SERVICES GROUP BY contrat_id
)
SELECT
ct.id contrat_id,
ct."annee",
ct."nom",
ct."prenom",
ct."civilite",
ct."e",
ct."dateNaissance",
ct."adresse",
ct."numInsee",
ct."statut",
ct."totalHETD",
ct."tauxHoraireValeur",
ct."tauxHoraireDate",
ct."dateSignature",
ct."modifieComplete",
CASE WHEN ct.est_contrat=1 THEN 1 ELSE null END "contrat1",
CASE WHEN ct.est_contrat=1 THEN null ELSE 1 END "avenant1",
CASE WHEN ct.est_contrat=1 THEN '3' ELSE '2' END "n",
to_char(SYSDATE, 'dd/mm/YYYY - hh24:mi:ss') "horodatage",
'Exemplaire à conserver' "exemplaire1",
'Exemplaire à retourner' || ct."exemplaire2" "exemplaire2",
ct."serviceTotal",
CASE ct.est_contrat
WHEN 1 THEN -- contrat
'Contrat de travail '
ELSE
'Avenant au contrat de travail initial modifiant le volume horaire initial'
|| ' de recrutement en qualité '
END "titre",
CASE WHEN ct.est_atv = 1 THEN
'd''agent temporaire vacataire'
ELSE
'de chargé' || ct."e" || ' d''enseignement vacataire'
END "qualite",
CASE
WHEN ct.est_projet = 1 AND ct.est_contrat = 1 THEN 'Projet de contrat'
WHEN ct.est_projet = 0 AND ct.est_contrat = 1 THEN 'Contrat n°' || ct.id
WHEN ct.est_projet = 1 AND ct.est_contrat = 0 THEN 'Projet d''avenant'
WHEN ct.est_projet = 0 AND ct.est_contrat = 0 THEN 'Avenant n°' || ct.contrat_id || '.' || ct.numero_avenant
END "titreCourt"
FROM
(
SELECT
c.*,
a.libelle "annee",
COALESCE(d.nom_usuel,i.nom_usuel) "nom",
COALESCE(d.prenom,i.prenom) "prenom",
civ.libelle_court "civilite",
CASE WHEN civ.sexe = 'F' THEN 'e' ELSE '' END "e",
to_char(COALESCE(d.date_naissance,i.date_naissance), 'dd/mm/YYYY') "dateNaissance",
COALESCE(d.adresse,ose_divers.formatted_adresse(
ai.NO_VOIE, ai.NOM_VOIE, ai.BATIMENT, ai.MENTION_COMPLEMENTAIRE, ai.LOCALITE,
ai.CODE_POSTAL, ai.VILLE, ai.PAYS_LIBELLE)) "adresse",
COALESCE(d.numero_insee,i.numero_insee || ' ' || COALESCE(LPAD(i.numero_insee_cle,2,'0'),'')) "numInsee",
si.libelle "statut",
replace(ltrim(to_char(COALESCE(fr.total,0), '999999.00')),'.',',') "totalHETD",
replace(ltrim(to_char(COALESCE(th.valeur,0), '999999.00')),'.',',') "tauxHoraireValeur",
COALESCE(to_char(th.histo_creation, 'dd/mm/YYYY'), 'TAUX INTROUVABLE') "tauxHoraireDate",
to_char(COALESCE(v.histo_creation, c.histo_creation), 'dd/mm/YYYY') "dateSignature",
CASE WHEN c.structure_id <> COALESCE(cp.structure_id,0) THEN 'modifié' ELSE 'complété' END "modifieComplete",
CASE WHEN s.aff_adresse_contrat = 1 THEN
' signé à l''adresse suivante :' || CHR(13) || CHR(10) ||
s.libelle_court || ' - ' || REPLACE(ose_divers.formatted_adresse(
astr.NO_VOIE, astr.NOM_VOIE, null, null, astr.LOCALITE,
astr.CODE_POSTAL, astr.VILLE, null), CHR(13), ' - ')
ELSE '' END "exemplaire2",
replace(ltrim(to_char(COALESCE(hs."serviceTotal",0), '999999.00')),'.',',') "serviceTotal",
CASE WHEN c.contrat_id IS NULL THEN 1 ELSE 0 END est_contrat,
CASE WHEN v.id IS NULL THEN 1 ELSE 0 END est_projet,
si.tem_atv est_atv
FROM
contrat c
JOIN type_contrat tc ON tc.id = c.type_contrat_id
JOIN intervenant i ON i.id = c.intervenant_id
JOIN annee a ON a.id = i.annee_id
JOIN statut_intervenant si ON si.id = i.statut_id
JOIN structure s ON s.id = c.structure_id
LEFT JOIN adresse_structure astr ON astr.structure_id = s.id AND astr.principale = 1 AND astr.histo_destruction IS NULL
LEFT JOIN dossier d ON d.intervenant_id = i.id AND d.histo_destruction IS NULL
JOIN civilite civ ON civ.id = COALESCE(d.civilite_id,i.civilite_id)
LEFT JOIN validation v ON v.id = c.validation_id AND v.histo_destruction IS NULL
LEFT JOIN adresse_intervenant ai ON ai.intervenant_id = i.id AND ai.histo_destruction IS NULL
JOIN type_volume_horaire tvh ON tvh.code = 'PREVU'
JOIN etat_volume_horaire evh ON evh.code = 'valide'
LEFT JOIN formule_resultat fr ON fr.intervenant_id = i.id AND fr.type_volume_horaire_id = tvh.id AND fr.etat_volume_horaire_id = evh.id
LEFT JOIN taux_horaire_hetd th ON c.histo_creation BETWEEN th.histo_creation AND COALESCE(th.histo_destruction,SYSDATE)
LEFT JOIN hs ON hs.contrat_id = c.id
LEFT JOIN contrat cp ON cp.id = c.contrat_id
WHERE
c.histo_destruction IS NULL
) ct;
......@@ -82,6 +82,7 @@ return [
Privileges::TYPE_INTERVENTION_VISUALISATION,
Privileges::MODULATEUR_VISUALISATION,
Privileges::DOMAINES_FONCTIONNELS_ADMINISTRATION_VISUALISATION,
Privileges::MOTIFS_MODIFICATION_SERVICE_DU_VISUALISATION,
],
'assertion' => Assertion\GestionAssertion::class,
],
......
......@@ -49,6 +49,19 @@ return [
],
'may_terminate' => true,
],
'enregistrement' => [
'type' => 'Segment',
'options' => [
'route' => '/enregistrement[/:formuleTestIntervenant]',
'constraints' => [
'formuleTestIntervenant' => '[0-9]*',
],
'defaults' => [
'action' => 'test-enregistrement',
],
],
'may_terminate' => true,
],
'supprimer' => [
'type' => 'Segment',
'options' => [
......@@ -111,7 +124,7 @@ return [
PrivilegeController::class => [
[
'controller' => 'Application\Controller\Formule',
'action' => ['test', 'test-saisir', 'test-supprimer'],
'action' => ['test', 'test-saisir', 'test-enregistrement', 'test-supprimer'],
'privileges' => [Privileges::FORMULE_TESTS],
],
],
......@@ -132,9 +145,4 @@ return [
],
],
'form_elements' => [
'factories' => [
Form\FormuleTest\IntervenantForm::class => Form\FormuleTest\Factory\IntervenantFormFactory::class,
],
],
];
\ No newline at end of file
<?php
namespace Application;
use Application\Provider\Privilege\Privileges;
use UnicaenAuth\Guard\PrivilegeController;
return [
'router' => [
'routes' => [
'motif-modification-service' => [
'type' => 'Literal',
'options' => [
'route' => '/motif-modification-service',
'defaults' => [
'controller' => 'Application\Controller\MotifModificationService',
'action' => 'index',
],
],
'may_terminate' => true,
'child_routes' => [
'delete' => [
'type' => 'Segment',
'options' => [
'route' => '/delete/:motif-modification-service',
'constraints' => [
'motif-modification-service' => '[0-9]*',
],
'defaults' => [
'action' => 'delete',
],
],
],
'saisie' => [
'type' => 'Segment',
'options' => [
'route' => '/saisie/[:motif-modification-service]',
'constraints' => [
'motif-modification-service' => '[0-9]*',
],
'defaults' => [
'action' => 'saisie',
],
],
],
],
],
],
],
'navigation' => [
'default' => [
'home' => [
'pages' => [
'administration' => [
'pages' => [
'motif-modification-service' => [
'label' => 'Motifs de modification du service dû',
'icon' => 'fa fa-graduation-cap',
'route' => 'motif-modification-service',
'resource' => PrivilegeController::getResourceId('Application\Controller\MotifModificationService', 'index'),
'order' => 80,
'border-color' => '#BBCF55',
],
],
],
],
],
],
],
'bjyauthorize' => [
'guards' => [
PrivilegeController::class => [
[
'controller' => 'Application\Controller\MotifModificationService',
'action' => ['index'],
'privileges' => Privileges::MOTIFS_MODIFICATION_SERVICE_DU_VISUALISATION,
],
[
'controller' => 'Application\Controller\MotifModificationService',
'action' => ['saisie','delete'],
'privileges' => Privileges::MOTIFS_MODIFICATION_SERVICE_DU_EDITION,
],
],
],
],
'controllers' => [
'invokables' => [
'Application\Controller\MotifModificationService' => Controller\MotifModificationServiceController::class,
],
],
'service_manager' => [
'invokables' => [
Service\MotifModificationServiceService::class => Service\MotifModificationServiceService::class,
],
],
'view_helpers' => [
],
'form_elements' => [
'invokables' => [
Form\MotifModificationService\MotifModificationServiceSaisieForm::class => Form\MotifModificationService\MotifModificationServiceSaisieForm::class,
],
],
];
......@@ -3,9 +3,18 @@
namespace Application\Controller;
use Application\Entity\Db\Annee;
use Application\Entity\Db\EtatVolumeHoraire;
use Application\Entity\Db\Formule;
use Application\Entity\Db\FormuleTestIntervenant;
use Application\Form\FormuleTest\Traits\IntervenantFormAwareTrait;
use Application\Entity\Db\FormuleTestStructure;
use Application\Entity\Db\TypeIntervenant;
use Application\Entity\Db\TypeVolumeHoraire;
use Application\Service\Traits\ContextServiceAwareTrait;
use Application\Service\Traits\FormuleTestIntervenantServiceAwareTrait;
use Application\Service\Traits\ParametresServiceAwareTrait;
use UnicaenApp\View\Model\MessengerViewModel;
use Zend\View\Model\JsonModel;
/**
* Description of FormuleController
......@@ -15,7 +24,8 @@ use Application\Service\Traits\FormuleTestIntervenantServiceAwareTrait;
class FormuleController extends AbstractController
{
use FormuleTestIntervenantServiceAwareTrait;
use IntervenantFormAwareTrait;
use ContextServiceAwareTrait;
use ParametresServiceAwareTrait;
public function testAction()
{
......@@ -31,26 +41,28 @@ class FormuleController extends AbstractController
/* @var $formuleTestIntervenant FormuleTestIntervenant */
$formuleTestIntervenant = $this->getEvent()->getParam('formuleTestIntervenant');
$form = $this->getFormFormuleTestIntervenant();
$structures = $this->em()->createQuery("SELECT s FROM ".FormuleTestStructure::class." s ORDER BY s.libelle")->execute();
$formules = $this->em()->createQuery("SELECT f FROM ".Formule::class." f ORDER BY f.id")->execute();
$annees = $this->em()->createQuery("SELECT a FROM ".Annee::class." a WHERE a.id BETWEEN 2013 AND 2030 ORDER BY a.id")->execute();
$typesIntervenants = $this->em()->createQuery("SELECT ti FROM ".TypeIntervenant::class." ti ORDER BY ti.id")->execute();
$typesVh = $this->em()->createQuery("SELECT t FROM ".TypeVolumeHoraire::class." t ORDER BY t.id")->execute();
$etatsVh = $this->em()->createQuery("SELECT t FROM ".EtatVolumeHoraire::class." t ORDER BY t.id")->execute();
$annee = $this->getServiceContext()->getAnnee();
$formuleId = $this->getServiceParametres()->get('formule');
if (!$formuleTestIntervenant) {
$title = 'Ajout d\'un test de formule';
$formuleTestIntervenant = new FormuleTestIntervenant();
} else {
$title = 'Modification d\'un test de formule';
}
$form->bindRequestSave($formuleTestIntervenant, $this->getRequest(), function (FormuleTestIntervenant $fti) {
try {
$this->getServiceFormuleTestIntervenant()->save($fti);
$this->flashMessenger()->addSuccessMessage('Test de formule bien enregistré');
return $this->redirect()->toRoute('formule-calcul/test');
} catch (\Exception $e) {
$this->getServiceFormuleTestIntervenant()->calculer($formuleTestIntervenant);
}catch(\Exception $e){
$this->flashMessenger()->addErrorMessage($this->translate($e));
}
});
}
return compact('form', 'formuleTestIntervenant', 'title');
return compact('formuleTestIntervenant', 'title', 'annee', 'formuleId', 'structures', 'formules', 'annees', 'typesIntervenants', 'typesVh', 'etatsVh');
}
......@@ -58,7 +70,7 @@ class FormuleController extends AbstractController
public function testSupprimerAction()
{
/* @var $formuleTestIntervenant FormuleTestIntervenant */
$formuleTestIntervenant = $this->getEvent()->getParam('FormuleTestIntervenant');
$formuleTestIntervenant = $this->getEvent()->getParam('formuleTestIntervenant');
try {
$this->getServiceFormuleTestIntervenant()->delete($formuleTestIntervenant);
......@@ -72,6 +84,62 @@ class FormuleController extends AbstractController
public function testEnregistrementAction()
{
/* @var $formuleTestIntervenant FormuleTestIntervenant */
$formuleTestIntervenant = $this->getEvent()->getParam('formuleTestIntervenant');
if (!$formuleTestIntervenant){
$formuleTestIntervenant = new FormuleTestIntervenant();
}
$result = ['errors' => '', 'data' => []];
$data = json_decode($this->params()->fromPost('data'), true);
$formuleTestIntervenant->fromArray($data);
$passed = true;
if (!$formuleTestIntervenant->getLibelle()){
$result['errors'][] = 'Libellé manquant';
$passed = false;
}
if (!$formuleTestIntervenant->getFormule()){
$result['errors'][] = 'La formule à utiliser n\'est pas précisée';
$passed = false;
}
if (!$formuleTestIntervenant->getAnnee()){
$result['errors'][] = 'L\'année doit être renseignée';
$passed = false;
}
if (!$formuleTestIntervenant->getTypeIntervenant()){
$result['errors'][] = 'Le type d\'intervenant (permanent, vacataire) doit être renseigné';
$passed = false;
}
if (!$formuleTestIntervenant->getStructureTest()){
$result['errors'][] = 'La structure doit être renseignée';
$passed = false;
}
if (!$formuleTestIntervenant->getTypeVolumeHoraire()){
$result['errors'][] = 'Le type de volume horaire (prévu ou réalisé) doit être renseigné';
$passed = false;
}
if (!$formuleTestIntervenant->getEtatVolumeHoraire()){
$result['errors'][] = 'L\'état de volume horaire (saisi, validé, etc) doit être renseigné';
$passed = false;
}
if ($passed) {
$this->getServiceFormuleTestIntervenant()->save($formuleTestIntervenant);
try {
$this->getServiceFormuleTestIntervenant()->calculer($formuleTestIntervenant);
} catch (\Exception $e) {
$result['errors'] = $this->translate($e);
}
}
$result['data'] = $formuleTestIntervenant->toArray();
return new JsonModel($result);
}
public function calculerToutAction()
{
$this->em()->getConnection()->exec('BEGIN OSE_FORMULE.CALCULER_TOUT; END;');
......
<?php
namespace Application\Controller;
use Application\Service\Traits\MotifModificationServiceServiceAwareTrait;
use Application\Entity\Db\MotifModificationServiceDu;
use Application\Form\MotifModificationService\Traits\MotifModificationServiceSaisieFormAwareTrait;
use UnicaenApp\View\Model\MessengerViewModel;
class MotifModificationServiceController extends AbstractController
{
use MotifModificationServiceServiceAwareTrait;
use MotifModificationServiceSaisieFormAwareTrait;
public function indexAction()
{
$this->em()->getFilters()->enable('historique')->init([
MotifModificationServiceDu::class,
]);
$motifModificationServices = $this->getServiceMotifModificationService()->getList();
return compact('motifModificationServices');
}
public function saisieAction()
{
/* @var $motifModificationService MotifModificationServiceDu */
$motifModificationServiceDu = $this->getEvent()->getParam('motif-modification-service');
$form = $this->getFormMotifModificationServiceSaisie();
if (empty($motifModificationServiceDu)) {
$title = 'Création d\'un nouveau motif de modification de service dû';
$motifModificationServiceDu = $this->getServiceMotifModificationService()->newEntity();
} else {
$title = 'Édition d\'un motif de modification de service dû';
}
$form->bindRequestSave($motifModificationServiceDu, $this->getRequest(), function (MotifModificationServiceDu $fr) {
try {
$this->getServiceMotifModificationService()->save($fr);
$this->flashMessenger()->addSuccessMessage('Enregistrement effectué');
} catch (\Exception $e) {
$this->flashMessenger()->addErrorMessage($this->translate($e));
}
});
return compact('form', 'title');
}
public function deleteAction()
{
$motifModificationServiceDu = $this->getEvent()->getParam('motif-modification-service');
try {
$this->getServiceMotifModificationService()->delete($motifModificationServiceDu);
$this->flashMessenger()->addSuccessMessage("Motif de Modification de Service supprimé avec succès.");
} catch (\Exception $e) {
$this->flashMessenger()->addErrorMessage(DbException::translate($e)->getMessage());
}
return new MessengerViewModel(compact('motifModificationService'));
}
}
......@@ -8,6 +8,7 @@ use Application\Entity\Db\Traits\FormuleAwareTrait;
use Application\Entity\Db\Traits\FormuleTestStructureAwareTrait;
use Application\Entity\Db\Traits\TypeIntervenantAwareTrait;
use Application\Entity\Db\Traits\TypeVolumeHoraireAwareTrait;
use Application\Hydrator\FormuleTestIntervenantHydrator;
class FormuleTestIntervenant
{
......@@ -88,6 +89,11 @@ class FormuleTestIntervenant
*/
protected $volumeHoraireTest;
/**
* @var string
*/
private $debugInfo;
/**
......@@ -113,9 +119,11 @@ class FormuleTestIntervenant
/**
* @param string $libelle
*/
public function setLibelle(string $libelle)
public function setLibelle(string $libelle): FormuleTestIntervenant
{
$this->libelle = $libelle;
return $this;
}
......@@ -133,9 +141,11 @@ class FormuleTestIntervenant
/**
* @param float $heuresDecharge
*/