Commit a9943ad1 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Merge branch 'master' into module-unicaen-siham

parents 2d5df9d0 1919be13
......@@ -22,7 +22,11 @@ Objectif : Connecteur Export OSE => Logiciel RH
* Au niveau du connecteur Actul+, les formations fermées étaient ignorées, elles sont également synchronisées
## Nouveautés
* Nouvelle vue V_IMPORT_DEPUIS_DOSSIERS pouvant servir pour peupler les données des intervenants à partir des données personnelles
* Possibilité pour un gestionnire de saisir des heures d'enseignement ou de référentiel qui n'auront pas besoin d'être validées par la suite (nouveau privilège d'autovalidation associé)
* Ajout d'une colonne dans l'export CSV des charges précisant si un élément est mutualisé ou non
# OSE 16 (14/09/2021)
......
......@@ -19,6 +19,10 @@ SELECT
ep.code element_code,
ep.libelle element_libelle,
CASE
WHEN COALESCE(ch.nbch,0) > 1 THEN 'Oui'
ELSE 'Non'
END element_mutualise,
p.libelle_court periode,
d.source_code discipline_code,
d.libelle_court discipline_libelle,
......@@ -56,6 +60,12 @@ SELECT
LEFT JOIN scenario_noeud_effectif sne ON sne.scenario_noeud_id = sn.id
AND sne.type_heures_id = cph.type_heures_id
AND sne.etape_id = n.etape_id
LEFT JOIN (
SELECT element_pedagogique_id, count(*) nbch
FROM chemin_pedagogique
WHERE histo_destruction IS NULL
GROUP BY element_pedagogique_id
) ch ON ch.element_pedagogique_id = ep.id
ORDER BY
structure_porteuse_code,
etape_porteuse_code,
......
......@@ -125,6 +125,7 @@ return [
'edition-masse' => 'Édition en masse',
'exterieur' => 'Saisie de service dans une autre autre université',
'validation' => 'Validation',
'autovalidation' => 'Validation automatique',
'devalidation' => 'Dévalidation',
'export-pdf' => 'Export PDF',
'export-csv' => 'Export CSV',
......@@ -147,6 +148,7 @@ return [
'visualisation' => 'Visualisation',
'edition' => 'Édition',
'validation' => 'Validation',
'autovalidation' => 'Validation automatique',
'admin-edition' => 'Administration - Édition',
'devalidation' => 'Dévalidation',
'admin-visualisation' => 'Administration - Visualisation',
......
......@@ -394,8 +394,10 @@ return [
],
'resource_providers' => [
\BjyAuthorize\Provider\Resource\Config::class => [
'Service' => [],
'ServiceReferentiel' => [],
'Service' => [],
'ServiceReferentiel' => [],
'VolumeHoraire' => [],
'VolumeHoraireReferentiel' => [],
],
],
'rule_providers' => [
......@@ -411,8 +413,11 @@ return [
'assertion' => Assertion\ServiceAssertion::class,
],
[
'privileges' => Privileges::ENSEIGNEMENT_VALIDATION,
'resources' => 'Validation',
'privileges' => [
Privileges::ENSEIGNEMENT_VALIDATION,
Privileges::ENSEIGNEMENT_AUTOVALIDATION,
],
'resources' => ['Service', 'VolumeHoraire', 'Validation'],
'assertion' => Assertion\ServiceAssertion::class,
],
[
......@@ -446,8 +451,11 @@ return [
'assertion' => Assertion\ServiceAssertion::class,
],
[
'privileges' => Privileges::REFERENTIEL_VALIDATION,
'resources' => 'Validation',
'privileges' => [
Privileges::REFERENTIEL_VALIDATION,
Privileges::REFERENTIEL_AUTOVALIDATION,
],
'resources' => ['ServiceReferentiel', 'VolumeHoraireReferentiel', 'Validation'],
'assertion' => Assertion\ServiceAssertion::class,
],
[
......
......@@ -9,6 +9,8 @@ use Application\Entity\Db\ServiceReferentiel;
use Application\Entity\Db\Structure;
use Application\Entity\Db\TypeVolumeHoraire;
use Application\Entity\Db\Validation;
use Application\Entity\Db\VolumeHoraire;
use Application\Entity\Db\VolumeHoraireReferentiel;
use Application\Entity\Db\WfEtape;
use Application\Provider\Privilege\Privileges;
use Application\Service\Traits\CampagneSaisieServiceAwareTrait;
......@@ -105,6 +107,14 @@ class ServiceAssertion extends AbstractAssertion
return $this->assertServiceEdition($role, $entity);
case Privileges::ENSEIGNEMENT_EXTERIEUR:
return $this->assertServiceExterieur($role, $entity);
case Privileges::ENSEIGNEMENT_VALIDATION:
return $this->assertServiceValidation($role, $entity);
}
break;
case $entity instanceof VolumeHoraire:
switch ($privilege) {
case Privileges::ENSEIGNEMENT_VALIDATION:
return $this->assertVolumeHoraireValidation($role, $entity);
}
break;
case $entity instanceof ServiceReferentiel:
......@@ -113,6 +123,14 @@ class ServiceAssertion extends AbstractAssertion
return $this->assertServiceReferentielVisualisation($role, $entity);
case Privileges::REFERENTIEL_EDITION:
return $this->assertServiceReferentielEdition($role, $entity);
case Privileges::REFERENTIEL_VALIDATION:
return $this->assertServiceReferentielValidation($role, $entity);
}
break;
case $entity instanceof VolumeHoraireReferentiel:
switch ($privilege) {
case Privileges::REFERENTIEL_VALIDATION:
return $this->assertVolumeHoraireReferentielValidation($role, $entity);
}
break;
case $entity instanceof Intervenant:
......@@ -135,10 +153,10 @@ class ServiceAssertion extends AbstractAssertion
switch ($privilege) {
case Privileges::ENSEIGNEMENT_VALIDATION:
case Privileges::REFERENTIEL_VALIDATION:
return $this->assertServiceValidation($role, $entity);
return $this->assertValidationValidation($role, $entity);
case Privileges::ENSEIGNEMENT_DEVALIDATION:
case Privileges::REFERENTIEL_DEVALIDATION:
return $this->assertServiceDevalidation($role, $entity);
return $this->assertValidationDevalidation($role, $entity);
}
break;
}
......@@ -373,18 +391,59 @@ class ServiceAssertion extends AbstractAssertion
protected function assertServiceValidation(Role $role, Validation $validation)
protected function assertVolumeHoraireValidation(Role $role, VolumeHoraire $volumeHoraire)
{
$service = $volumeHoraire->getService();
return $this->assertServiceValidation($role, $service);
}
protected function assertServiceValidation(Role $role, Service $service)
{
return $this->assertValidation($role, $service->getIntervenant(), $service->getStructure());
}
protected function assertVolumeHoraireReferentielValidation(Role $role, VolumeHoraireReferentiel $volumeHoraireReferentiel)
{
$serviceReferentiel = $volumeHoraireReferentiel->getServiceReferentiel();
return $this->assertServiceReferentielValidation($role, $serviceReferentiel);
}
protected function assertServiceReferentielValidation(Role $role, ServiceReferentiel $serviceReferentiel)
{
return $this->assert($role, $serviceReferentiel->getIntervenant(), $serviceReferentiel->getStructure());
}
protected function assertValidationValidation(Role $role, Validation $validation)
{
return $this->asserts([
!$validation->getId(),
$this->assertIntervenant($role, $validation->getIntervenant()),
$this->assertStructure($role, $validation->getStructure()),
$this->assertValidation($role, $validation->getIntervenant(), $validation->getStructure()),
]);
}
protected function assertValidation(Role $role, Intervenant $intervenant, ?Structure $structure)
{
return $this->asserts([
$this->assertIntervenant($role, $intervenant),
$this->assertStructure($role, $structure),
]);
}
protected function assertServiceDevalidation(Role $role, Validation $validation)
protected function assertValidationDevalidation(Role $role, Validation $validation)
{
return $this->asserts([
$validation->getId(),
......@@ -440,7 +499,7 @@ class ServiceAssertion extends AbstractAssertion
protected function assertStructure(Role $role, Structure $structure = null)
protected function assertStructure(Role $role, ?Structure $structure = null)
{
if ($structure) {
if ($ri = $role->getStructure()) {
......
......@@ -6,11 +6,12 @@ use UnicaenApp\Entity\HistoriqueAwareInterface;
use UnicaenApp\Entity\HistoriqueAwareTrait;
use UnicaenImport\Entity\Db\Interfaces\ImportAwareInterface;
use UnicaenImport\Entity\Db\Traits\ImportAwareTrait;
use Zend\Permissions\Acl\Resource\ResourceInterface;
/**
* VolumeHoraireReferentiel
*/
class VolumeHoraireReferentiel implements HistoriqueAwareInterface, ImportAwareInterface
class VolumeHoraireReferentiel implements HistoriqueAwareInterface, ImportAwareInterface, ResourceInterface
{
use HistoriqueAwareTrait;
use ImportAwareTrait;
......@@ -354,7 +355,6 @@ class VolumeHoraireReferentiel implements HistoriqueAwareInterface, ImportAwareI
/**
* @return \DateTime
*/
......@@ -400,4 +400,11 @@ class VolumeHoraireReferentiel implements HistoriqueAwareInterface, ImportAwareI
return $this;
}
public function getResourceId()
{
return 'VolumeHoraireReferentiel';
}
}
......@@ -34,31 +34,33 @@ class SaisieMultipleFieldset extends AbstractFieldset implements EntityManagerAw
{
$qb = $this->getServiceTypeIntervention()->finderByContext();
$this->getServiceTypeIntervention()->finderByHistorique($qb);
return $this->getServiceTypeIntervention()->getList( $qb );
return $this->getServiceTypeIntervention()->getList($qb);
}
/**
*
*/
public function init()
{
$hydrator = new SaisieMultipleHydrator;
$hydrator->setServiceTypeIntervention( $this->getServiceTypeIntervention() );
$hydrator->setEntityManager( $this->getEntityManager() );
$hydrator->setServiceTypeIntervention($this->getServiceTypeIntervention());
$hydrator->setEntityManager($this->getEntityManager());
$this ->setAttribute('method', 'post')
->setAttribute('class', 'volume-horaire-multiple')
->setHydrator($hydrator)
->setAllowedObjectBindingClass(VolumeHoraireListe::class)
;
$this->setAttribute('method', 'post')
->setAttribute('class', 'volume-horaire-multiple')
->setHydrator($hydrator)
->setAllowedObjectBindingClass(VolumeHoraireListe::class);
$tis = $this->getTypesInterventions();
foreach( $tis as $typeIntervention ){
foreach ($tis as $typeIntervention) {
$this->add([
'name' => $typeIntervention->getCode(),
'options' => [
'label' => '<abbr title="'.$typeIntervention->getLibelle().'">'.$typeIntervention->getCode().'</abbr> :',
'label_options' => ['disable_html_escape' => true]
'label' => '<abbr title="' . $typeIntervention->getLibelle() . '">' . $typeIntervention->getCode() . '</abbr> :',
'label_options' => ['disable_html_escape' => true],
],
'attributes' => [
'title' => $typeIntervention->getLibelle(),
......@@ -68,13 +70,14 @@ class SaisieMultipleFieldset extends AbstractFieldset implements EntityManagerAw
],
'type' => 'Text',
]);
}
$this->add( new Hidden('type-volume-horaire') );
$this->add( new Hidden('service') );
$this->add( new Hidden('periode') );
$this->add(new Hidden('type-volume-horaire'));
$this->add(new Hidden('service'));
$this->add(new Hidden('periode'));
}
/**
* Should return an array specification compatible with
* {@link Zend\InputFilter\Factory::createInputFilter()}.
......@@ -84,14 +87,15 @@ class SaisieMultipleFieldset extends AbstractFieldset implements EntityManagerAw
public function getInputFilterSpecification()
{
$filters = [];
foreach( $this->getTypesInterventions() as $typeIntervention ){
foreach ($this->getTypesInterventions() as $typeIntervention) {
$filters[$typeIntervention->getCode()] = [
'required' => false,
'filters' => [
'filters' => [
['name' => FloatFromString::class],
],
];
}
return $filters;
}
......@@ -112,7 +116,6 @@ class SaisieMultipleHydrator implements HydratorInterface
use TypeInterventionServiceAwareTrait;
/**
*
* @return \Application\Service\TypeInterventionService[]
......@@ -124,6 +127,7 @@ class SaisieMultipleHydrator implements HydratorInterface
} else {
$qb = $this->getServiceTypeIntervention()->finderByHistorique();
$this->getServiceTypeIntervention()->finderByContext($qb);
return $this->getServiceTypeIntervention()->getList($qb);
}
}
......@@ -133,8 +137,8 @@ class SaisieMultipleHydrator implements HydratorInterface
/**
* Hydrate $object with the provided $data.
*
* @param array $data
* @param \Application\Entity\VolumeHoraireListe $object
* @param array $data
* @param \Application\Entity\VolumeHoraireListe $object
*
* @return object
*/
......@@ -153,7 +157,7 @@ class SaisieMultipleHydrator implements HydratorInterface
} else {
$heures = 0;
}
$object->setHeures($heures, false);
$object->setHeures($heures);
}
return $object;
......@@ -164,7 +168,7 @@ class SaisieMultipleHydrator implements HydratorInterface
/**
* Extract values from an object
*
* @param \Application\Entity\VolumeHoraireListe $object
* @param \Application\Entity\VolumeHoraireListe $object
*
* @return array
*/
......@@ -176,7 +180,7 @@ class SaisieMultipleHydrator implements HydratorInterface
'service' => $object->getService() ? $object->getService()->getId() : null,
'periode' => $object->getPeriode() ? $object->getPeriode()->getId() : null,
];
$tis = $this->getTypesInterventions($object->getService());
$tis = $this->getTypesInterventions($object->getService());
foreach ($tis as $typeIntervention) {
$vhl->setTypeIntervention($typeIntervention);
$data[$typeIntervention->getCode()] = StringFromFloat::run($vhl->getHeures(), false);
......
......@@ -63,6 +63,7 @@ class ExportProvider
'element-code' => $d['ELEMENT_CODE'],
'element-libelle' => $d['ELEMENT_LIBELLE'],
'element-mutualise' => $d['ELEMENT_MUTUALISE'],
'periode' => $d['PERIODE'],
'discipline-code' => $d['DISCIPLINE_CODE'],
'discipline-libelle' => $d['DISCIPLINE_LIBELLE'],
......@@ -120,21 +121,22 @@ class ExportProvider
'element-code' => $d[9],
'element-libelle' => $d[10],
'periode' => $d[11],
'discipline-code' => $d[12],
'discipline-libelle' => $d[13],
'type-heures' => $d[14],
'type-intervention' => $d[15],
'seuil-ouverture' => (int)$d[16],
'seuil-dedoublement' => (int)$d[17],
'assiduite' => stringToFloat($d[18]),
'effectif-etape' => (int)$d[19],
'effectif-element' => (int)$d[20],
'heures-ens' => stringToFloat($d[21]),
'groupes' => stringToFloat($d[22]),
'heures' => stringToFloat($d[23]),
'hetd' => stringToFloat($d[24]),
'element-mutualise' => $d[11],
'periode' => $d[12],
'discipline-code' => $d[13],
'discipline-libelle' => $d[14],
'type-heures' => $d[15],
'type-intervention' => $d[16],
'seuil-ouverture' => (int)$d[17],
'seuil-dedoublement' => (int)$d[18],
'assiduite' => stringToFloat($d[19]),
'effectif-etape' => (int)$d[20],
'effectif-element' => (int)$d[21],
'heures-ens' => stringToFloat($d[22]),
'groupes' => stringToFloat($d[23]),
'heures' => stringToFloat($d[24]),
'hetd' => stringToFloat($d[25]),
];
$data[] = $l;
}
......@@ -173,6 +175,7 @@ class ExportProvider
'element-code' => 'Ens. (code)',
'element-libelle' => 'Enseignement (libellé)',
'element-mutualise' => 'Mutualisation',
'periode' => 'Période',
'discipline-code' => 'Discipline (code)',
'discipline-libelle' => 'Discipline (libellé)',
......
......@@ -102,6 +102,7 @@ class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges
const DOSSIER_VISUALISATION = 'dossier-visualisation';
const DROIT_AFFECTATION_EDITION = 'droit-affectation-edition';
const DROIT_AFFECTATION_VISUALISATION = 'droit-affectation-visualisation';
const ENSEIGNEMENT_AUTOVALIDATION = 'enseignement-autovalidation';
const ENSEIGNEMENT_DEVALIDATION = 'enseignement-devalidation';
const ENSEIGNEMENT_EDITION = 'enseignement-edition';
const ENSEIGNEMENT_EDITION_MASSE = 'enseignement-edition-masse';
......@@ -202,6 +203,7 @@ class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges
const PLAFONDS_GESTION_VISUALISATION = 'plafonds-gestion-visualisation';
const REFERENTIEL_ADMIN_EDITION = 'referentiel-admin-edition';
const REFERENTIEL_ADMIN_VISUALISATION = 'referentiel-admin-visualisation';
const REFERENTIEL_AUTOVALIDATION = 'referentiel-autovalidation';
const REFERENTIEL_COMMUN_EMPLOYEUR_EDITION = 'referentiel-commun-employeur-edition';
const REFERENTIEL_COMMUN_EMPLOYEUR_VISUALISATION = 'referentiel-commun-employeur-visualisation';
const REFERENTIEL_COMMUN_VOIRIE_EDITION = 'referentiel-commun-voirie-edition';
......
......@@ -2,6 +2,8 @@
namespace Application\Service;
use Application\Entity\Db\VolumeHoraireReferentiel;
use Application\Provider\Privilege\Privileges;
use Application\Service\Traits\EtatVolumeHoraireServiceAwareTrait;
use Application\Service\Traits\SourceServiceAwareTrait;
use Application\Service\Traits\TypeVolumeHoraireServiceAwareTrait;
......@@ -20,7 +22,6 @@ class VolumeHoraireReferentielService extends AbstractEntityService
use SourceServiceAwareTrait;
/**
* retourne la classe des entités
*
......@@ -64,10 +65,10 @@ class VolumeHoraireReferentielService extends AbstractEntityService
/**
* Sauvegarde une entité
*
* @param mixed $entity
* @param VolumeHoraireReferentiel $entity
*
* @throws \RuntimeException
* @return mixed
* @throws \RuntimeException
*/
public function save($entity)
{
......@@ -77,8 +78,12 @@ class VolumeHoraireReferentielService extends AbstractEntityService
if (!$entity->getSourceCode()) {
$entity->setSourceCode(uniqid('ose-'));
}
if (!$entity->getId()) {
$canAutoValidate = $this->getAuthorize()->isAllowed($entity, Privileges::REFERENTIEL_AUTOVALIDATION);
if ($canAutoValidate) $entity->setAutoValidation(true);
}
return parent::save($entity); // TODO: Change the autogenerated stub
return parent::save($entity);
}
......@@ -93,7 +98,7 @@ class VolumeHoraireReferentielService extends AbstractEntityService
*/
public function finderByEtatVolumeHoraire(EtatVolumeHoraire $etatVolumeHoraire = null, QueryBuilder $qb = null, $alias = null)
{
list($qb, $alias) = $this->initQuery($qb, $alias);
[$qb, $alias] = $this->initQuery($qb, $alias);
if ($etatVolumeHoraire) {
$sEtatVolumeHoraire = $this->getServiceEtatVolumeHoraire();
......@@ -117,7 +122,7 @@ class VolumeHoraireReferentielService extends AbstractEntityService
*/
public function finderByStrictEtatVolumeHoraire(EtatVolumeHoraire $etatVolumeHoraire = null, QueryBuilder $qb = null, $alias = null)
{
list($qb, $alias) = $this->initQuery($qb, $alias);
[$qb, $alias] = $this->initQuery($qb, $alias);
if ($etatVolumeHoraire) {
$sEtatVolumeHoraire = $this->getServiceEtatVolumeHoraire();
......
......@@ -3,6 +3,7 @@
namespace Application\Service;
use Application\Entity\Db\Contrat;
use Application\Provider\Privilege\Privileges;
use Application\Service\Traits\ElementPedagogiqueServiceAwareTrait;
use Application\Service\Traits\EtatVolumeHoraireServiceAwareTrait;
use Application\Service\Traits\ServiceServiceAwareTrait;
......@@ -27,7 +28,6 @@ class VolumeHoraireService extends AbstractEntityService
use SourceServiceAwareTrait;
/**
* retourne la classe des entités
*
......@@ -97,8 +97,8 @@ class VolumeHoraireService extends AbstractEntityService
*
* @param mixed $entity
*
* @throws \RuntimeException
* @return mixed
* @throws \RuntimeException
*/
public function save($entity)
{
......@@ -109,6 +109,11 @@ class VolumeHoraireService extends AbstractEntityService
$entity->setSourceCode(uniqid('ose-'));
}
if (!$entity->getId()) {
$canAutoValidate = $this->getAuthorize()->isAllowed($entity, Privileges::ENSEIGNEMENT_AUTOVALIDATION);
if ($canAutoValidate) $entity->setAutoValidation(true);
}
return parent::save($entity); // TODO: Change the autogenerated stub
}
......@@ -124,7 +129,7 @@ class VolumeHoraireService extends AbstractEntityService
*/
public function finderByIntervenant(Intervenant $intervenant, QueryBuilder $qb = null, $alias = null)
{
list($qb, $alias) = $this->initQuery($qb, $alias);
[$qb, $alias] = $this->initQuery($qb, $alias);
$qb
->join("$alias.service", 'vhs2')
......@@ -147,7 +152,7 @@ class VolumeHoraireService extends AbstractEntityService
*/
public function finderByEtatVolumeHoraire(EtatVolumeHoraire $etatVolumeHoraire = null, QueryBuilder $qb = null, $alias = null)
{
list($qb, $alias) = $this->initQuery($qb, $alias);
[$qb, $alias] = $this->initQuery($qb, $alias);
if ($etatVolumeHoraire) {
$sEtatVolumeHoraire = $this->getServiceEtatVolumeHoraire();
......@@ -171,7 +176,7 @@ class VolumeHoraireService extends AbstractEntityService
*/
public function finderByStrictEtatVolumeHoraire(EtatVolumeHoraire $etatVolumeHoraire = null, QueryBuilder $qb = null, $alias = null)
{
list($qb, $alias) = $this->initQuery($qb, $alias);
[$qb, $alias] = $this->initQuery($qb, $alias);
if ($etatVolumeHoraire) {
$sEtatVolumeHoraire = $this->getServiceEtatVolumeHoraire();
......@@ -196,7 +201,7 @@ class VolumeHoraireService extends AbstractEntityService
*/
public function finderByContrat($contrat, QueryBuilder $qb = null, $alias = null)
{
list($qb, $alias) = $this->initQuery($qb, $alias);
[$qb, $alias] = $this->initQuery($qb, $alias);
if ($contrat instanceof \Application\Entity\Db\Contrat) {
$qb->addSelect("c")
......@@ -221,7 +226,7 @@ class VolumeHoraireService extends AbstractEntityService
*/
public function orderBy(QueryBuilder $qb = null, $alias = null)
{
list($qb, $alias) = $this->initQuery($qb, $alias);