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

#15042

parent 0f43cea8
......@@ -21,9 +21,9 @@ author: Laurent Lécluse - DSI - Unicaen
* Possibilité d'importer des heures d'enseignement depuis ADE.
* Possibilité de basculer OSE en mode calendaire ou en mode semestriel (par défaut).
* Possibilité de basculer OSE en mode calendaire ou en mode semestriel (par défaut) selon qu'on soit en prévisionnel ou en réalisé.
* Le pays "France" peut maintenant être sélectionné dans la configuration globale de l'application
## Notes de mise à jour
......
......@@ -7,8 +7,10 @@
* @var $sl \Zend\ServiceManager\ServiceLocatorInterface
*/
use Application\Service\ContextService;
use Application\Service\PaysService;
/** @var PaysService $cs */
$cs = $sl->get(PaysService::class);
/** @var ContextService $cs */
$cs = $sl->get(ContextService::class);
......@@ -175,6 +175,26 @@ INSERT INTO parametre (
(select id from utilisateur where username='oseappli')
);
INSERT INTO parametre (
id,
nom,
valeur,
description,
histo_creation,
histo_createur_id,
histo_modification,
histo_modificateur_id
) VALUES (
parametre_id_seq.nextval,
'pays_france',
null,
'Pays "France"',
sysdate,
(select id from utilisateur where username='oseappli'),
sysdate,
(select id from utilisateur where username='oseappli')
);
INSERT INTO PRIVILEGE (ID, CATEGORIE_ID, CODE, LIBELLE, ORDRE)
SELECT
privilege_id_seq.nextval id,
......
......@@ -15,7 +15,6 @@ class Pays implements HistoriqueAwareInterface, ImportAwareInterface
use HistoriqueAwareTrait;
use ImportAwareTrait;
const CODE_FRANCE = "100";
/**
* @var string
......
......@@ -4,6 +4,7 @@ namespace Application\Form\Intervenant;
use Application\Entity\Db\Dossier as Dossier;
use Application\Entity\Db\Pays as PaysEntity;
use Application\Entity\Db\Pays;
use Application\Entity\Db\StatutIntervenant;
use Application\Form\AbstractFieldset;
use Application\Service\Traits\CiviliteServiceAwareTrait;
......@@ -141,7 +142,7 @@ class DossierFieldset extends AbstractFieldset
->setObjectManager($this->getServiceContext()->getEntityManager())
->setTargetClass(\Application\Entity\Db\Pays::class);
foreach ($paysSelect->getProxy()->getObjects() as $p) {
$estFrance = PaysEntity::CODE_FRANCE === $p->getSourceCode();
$estFrance = $this->getServicePays()->isFrance($p);
if ($estFrance) {
self::$franceId = $p->getId();
}
......@@ -420,7 +421,7 @@ class DossierFieldset extends AbstractFieldset
'required' => $this->has('premierRecrutement'),
],
'statut' => [
'required' => true,
'required' => true,
],
];
......@@ -454,6 +455,10 @@ class PaysSelect extends EntitySelect
*/
class PaysProxy extends Proxy
{
use PaysServiceAwareTrait;
protected function loadValueOptions()
{
parent::loadValueOptions();
......@@ -461,7 +466,7 @@ class PaysProxy extends Proxy
foreach ($this->valueOptions as $key => $value) {
$id = $value['value'];
$pays = $this->objects[$id];
$estFrance = PaysEntity::CODE_FRANCE === $pays->getSourceCode();
$estFrance = $this->getServicePays()->isFrance($pays);
$this->valueOptions[$key]['attributes'] = [
'class' => "pays" . ($estFrance ? " france" : null),
......@@ -542,7 +547,7 @@ class StatutIntervenantProxy extends Proxy
$pays = [];
foreach ($this->objects as $o) {
/* @var $o StatutIntervenant */
if ($o->estNonHistorise()){
if ($o->estNonHistorise()) {
$pays[$o->getId()] = $o;
}
}
......
......@@ -5,6 +5,7 @@ namespace Application\Form;
use Application\Entity\Db\Parametre;
use Application\Service\Traits\AnneeServiceAwareTrait;
use Application\Service\Traits\DomaineFonctionnelServiceAwareTrait;
use Application\Service\Traits\PaysServiceAwareTrait;
use Application\Service\Traits\ScenarioServiceAwareTrait;
use Application\Service\Traits\UtilisateurServiceAwareTrait;
use UnicaenApp\Form\Element\SearchAndSelect;
......@@ -22,6 +23,7 @@ class ParametresForm extends AbstractForm
use DomaineFonctionnelServiceAwareTrait;
use UtilisateurServiceAwareTrait;
use ScenarioServiceAwareTrait;
use PaysServiceAwareTrait;
public function init()
{
......@@ -256,7 +258,65 @@ class ParametresForm extends AbstractForm
$this->add([
'type' => 'Select',
'name' => 'modalite_services',
'name' => 'pays_france',
'options' => [
'value_options' => Util::collectionAsOptions($this->getServicePays()->getList($this->getServicePays()->finderByHistorique())),
],
'attributes' => [
'class' => 'selectpicker',
'data-live-search' => 'true',
'data-size' => 20,
],
]);
$this->add([
'type' => 'Select',
'name' => 'modalite_services_prev_ens',
'options' => [
'value_options' => [
Parametre::SERVICES_MODALITE_SEMESTRIEL => 'Par semestre (mode semestriel)',
Parametre::SERVICES_MODALITE_CALENDAIRE => 'Par date et heure de cours (mode calendaire)'
],
],
'attributes' => [
'class' => 'selectpicker',
'data-size' => 20,
],
]);
$this->add([
'type' => 'Select',
'name' => 'modalite_services_prev_ref',
'options' => [
'value_options' => [
Parametre::SERVICES_MODALITE_SEMESTRIEL => 'Par semestre (mode semestriel)',
Parametre::SERVICES_MODALITE_CALENDAIRE => 'Par date et heure de cours (mode calendaire)'
],
],
'attributes' => [
'class' => 'selectpicker',
'data-size' => 20,
],
]);
$this->add([
'type' => 'Select',
'name' => 'modalite_services_real_ens',
'options' => [
'value_options' => [
Parametre::SERVICES_MODALITE_SEMESTRIEL => 'Par semestre (mode semestriel)',
Parametre::SERVICES_MODALITE_CALENDAIRE => 'Par date et heure de cours (mode calendaire)'
],
],
'attributes' => [
'class' => 'selectpicker',
'data-size' => 20,
],
]);
$this->add([
'type' => 'Select',
'name' => 'modalite_services_real_ref',
'options' => [
'value_options' => [
Parametre::SERVICES_MODALITE_SEMESTRIEL => 'Par semestre (mode semestriel)',
......
......@@ -2,6 +2,8 @@
namespace Application\Service;
use Application\Entity\Db\Pays;
use Application\Service\Traits\ParametresServiceAwareTrait;
use Doctrine\ORM\QueryBuilder;
/**
......@@ -9,6 +11,9 @@ use Doctrine\ORM\QueryBuilder;
*/
class PaysService extends AbstractEntityService
{
use ParametresServiceAwareTrait;
/**
* retourne la classe des entités
......@@ -17,9 +22,11 @@ class PaysService extends AbstractEntityService
*/
public function getEntityClass()
{
return \Application\Entity\Db\Pays::class;
return Pays::class;
}
/**
* Retourne l'alias d'entité courante
*
......@@ -30,6 +37,32 @@ class PaysService extends AbstractEntityService
return 'p';
}
/**
* @return Pays
*/
public function getFrance(): Pays
{
$franceId = $this->getServiceParametres()->get('pays_france');
return $this->get($franceId);
}
/**
* @param Pays $pays
*
* @return bool
*/
public function isFrance(Pays $pays): bool
{
return $pays == $this->getFrance();
}
/**
* Retourne la liste des pays, triés par libellé long.
*
......
......@@ -29,6 +29,30 @@
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Services et référentiel</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6">
<?= $this->formControlGroup($form->get('modalite_services_prev_ens')); ?>
</div>
<div class="col-md-6">
<?= $this->formControlGroup($form->get('modalite_services_prev_ref')); ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $this->formControlGroup($form->get('modalite_services_real_ens')); ?>
</div>
<div class="col-md-6">
<?= $this->formControlGroup($form->get('modalite_services_real_ref')); ?>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Contrat</h3>
......@@ -164,10 +188,10 @@
</div>
<div class="row">
<div class="col-md-6">
<?= $this->formControlGroup($form->get('scenario_charges_services')); ?>
<?= $this->formControlGroup($form->get('pays_france')); ?>
</div>
<div class="col-md-6">
<?= $this->formControlGroup($form->get('modalite_services')); ?>
<?= $this->formControlGroup($form->get('scenario_charges_services')); ?>
</div>
</div>
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment