Commit e2c90d3a by Yvon Kerdoncuff

Merge branch '7984-upgrade-quartier-and-subterritory-params' into 'develop'

user territory param to activate territory filter in flux admin & extend…

See merge request !145
parents afacd518 706b6fe9
......@@ -173,8 +173,8 @@ class AdherentAdmin extends AbstractAdmin
}
$withQuartier = $em->getRepository(GlobalParameter::class)->val(GlobalParameter::SSA_HOUSEHOLD_WITH_QUARTIER);
$withSubterritory = $em->getRepository(GlobalParameter::class)->val(GlobalParameter::SSA_HOUSEHOLD_WITH_SUBTERRITORY);
$withQuartier = $em->getRepository(GlobalParameter::class)->val(GlobalParameter::GEOLOC_WITH_QUARTIER);
$withSubterritory = $em->getRepository(GlobalParameter::class)->val(GlobalParameter::GEOLOC_WITH_SUBTERRITORY);
$formMapper
->tab('General')
......@@ -189,8 +189,8 @@ class AdherentAdmin extends AbstractAdmin
'required' => true,
'with_geoloc' => false,
'with_latlon' => false,
'with_subterritory' => $tav_env && 'true' === $withSubterritory,
'with_quartier' => $tav_env && 'true' === $withQuartier
'with_subterritory' => 'true' === $withSubterritory,
'with_quartier' => 'true' === $withQuartier
])
->end()
->with('Groupe', ['class' => 'col-md-5'])
......@@ -731,16 +731,18 @@ class AdherentAdmin extends AbstractAdmin
])
;
$withSubterritory = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(GlobalParameter::class)->val(GlobalParameter::GEOLOC_WITH_SUBTERRITORY);
if('true' === $withSubterritory) {
$datagridMapper->add('geoloc.subterritory', null, [
'label' => 'Territoire',
'advanced_filter' => false,
'show_filter' => true,
]);
}
if ($this->getConfigurationPool()->getContainer()->getParameter('tav_env')) {
$datagridMapper
->remove('cotisationajour');
if($this->getConfigurationPool()->getContainer()->getParameter('household_based_allowance')) {
$datagridMapper->add('geoloc.subterritory', null, [
'label' => 'Territoire',
'advanced_filter' => false,
'show_filter' => true,
]);
}
if ($this->getConfigurationPool()->getContainer()->getParameter('ccas_mode')) {
$datagridMapper
->add('anonymoustoken', CallbackFilter::class, [
......
......@@ -4,6 +4,7 @@ namespace App\Admin;
use App\Entity\Flux;
use App\Entity\Subterritory;
use App\Entity\GlobalParameter;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
......@@ -177,11 +178,10 @@ class FluxAdmin extends AbstractAdmin
])
;
// In household based allowance (but not simplified) add filter on adherent territory
$household_based_allowance = $this->getConfigurationPool()->getContainer()->getParameter('household_based_allowance');
$simplified_household_based_allowance = $this->getConfigurationPool()->getContainer()->getParameter('simplified_household_based_allowance');
// Add filter on adherent territory if active
$withSubterritory = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(GlobalParameter::class)->val(GlobalParameter::GEOLOC_WITH_SUBTERRITORY);
if($household_based_allowance && !$simplified_household_based_allowance) {
if('true' === $withSubterritory) {
$datagridMapper->add('territory', CallbackFilter::class, [
'callback' => [$this, 'getTerritoryFilter'],
'field_type' => SChoiceType::class,
......
......@@ -71,11 +71,10 @@ class OperationAdherentAdmin extends OperationAdmin
'show_filter' => true,
]);
// In household based allowance (but not simplified) add filter on adherent territory
$household_based_allowance = $this->getConfigurationPool()->getContainer()->getParameter('household_based_allowance');
$simplified_household_based_allowance = $this->getConfigurationPool()->getContainer()->getParameter('simplified_household_based_allowance');
// Add filter on adherent territory if active
$withSubterritory = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(GlobalParameter::class)->val(GlobalParameter::GEOLOC_WITH_SUBTERRITORY);
if($household_based_allowance && !$simplified_household_based_allowance) {
if('true' === $withSubterritory) {
$datagridMapper->add('account.adherent.geoloc.subterritory', null, [
'label' => 'Territoire',
'advanced_filter' => false,
......
......@@ -69,9 +69,9 @@ class GlobalParameter
const SSA_HOUSEHOLD_MAX_ALLOCATION_AMOUNT = 'SSA_HOUSEHOLD_MAX_ALLOCATION_AMOUNT';
const SSA_HOUSEHOLD_COTISATION_MINIMUM = 'SSA_HOUSEHOLD_COTISATION_MINIMUM';
const ALTERNATE_AVAILABLE_PAYMENT_TYPES_COMPTOIR = 'ALTERNATE_AVAILABLE_PAYMENT_TYPES_COMPTOIR';
const SSA_HOUSEHOLD_WITH_QUARTIER = 'SSA_HOUSEHOLD_WITH_QUARTIER';
const SSA_HOUSEHOLD_QUARTIER_LIST_VALUES = 'SSA_HOUSEHOLD_QUARTIER_LIST_VALUES';
const SSA_HOUSEHOLD_WITH_SUBTERRITORY = 'SSA_HOUSEHOLD_WITH_SUBTERRITORY';
const GEOLOC_WITH_QUARTIER = 'GEOLOC_WITH_QUARTIER';
const GEOLOC_QUARTIER_LIST_VALUES = 'GEOLOC_QUARTIER_LIST_VALUES';
const GEOLOC_WITH_SUBTERRITORY = 'GEOLOC_WITH_SUBTERRITORY';
/**
* @var \Ramsey\Uuid\UuidInterface
......
......@@ -79,7 +79,7 @@ class GeolocFormType extends AbstractType
;
}
if (true === $options['with_quartier']) {
$quartierListValues = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::SSA_HOUSEHOLD_QUARTIER_LIST_VALUES);
$quartierListValues = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::GEOLOC_QUARTIER_LIST_VALUES);
if (null !== $quartierListValues && '' !== $quartierListValues) {
$quartierListValuesArr = explode(",", $quartierListValues);
......
......@@ -24,8 +24,8 @@ final class Version20250415103920 extends AbstractMigration
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql("INSERT INTO global_parameter (id, name, description, value, mandatory) VALUES (UUID(), 'SSA_HOUSEHOLD_WITH_QUARTIER', 'En mode SSA, si la valeur est à true, affiche le champ \'Quartier\' dans la fiche Adhérent.', 'true', '0')");
$this->addSql("INSERT INTO global_parameter (id, name, description, value, mandatory) VALUES (UUID(), 'SSA_HOUSEHOLD_QUARTIER_LIST_VALUES', 'En mode SSA, si le champ \'Quartier\' est affiché et que ce paramètre est renseigné, affiche le champ sous forme de liste déroulante plutôt que de champ libre. Renseigner les valeurs séparées par une virgule sans espace (ex: Facultés,Hôpitaux,Montpellier Ouest,Gambetta).', '', '0')");
$this->addSql("INSERT INTO global_parameter (id, name, description, value, mandatory) VALUES (UUID(), 'SSA_HOUSEHOLD_WITH_QUARTIER', 'Si la valeur est à true, affiche le champ \'Quartier\' dans la fiche Adhérent.', 'true', '0')");
$this->addSql("INSERT INTO global_parameter (id, name, description, value, mandatory) VALUES (UUID(), 'SSA_HOUSEHOLD_QUARTIER_LIST_VALUES', 'Si le champ \'Quartier\' est affiché et que ce paramètre est renseigné, affiche le champ sous forme de liste déroulante plutôt que de champ libre. Renseigner les valeurs séparées par une virgule sans espace (ex: Facultés,Hôpitaux,Montpellier Ouest,Gambetta).', '', '0')");
$containerName = trim(file_get_contents('/etc/hostname'));
......@@ -41,7 +41,7 @@ INSERT INTO global_parameter (id, name, description, value, mandatory)
VALUES (
UUID(),
'SSA_HOUSEHOLD_WITH_SUBTERRITORY',
'En mode SSA, si la valeur est à true, affiche le champ \'Territoire\' dans la fiche Adhérent.',
'Si la valeur est à true, affiche le champ \'Territoire\' dans la fiche Adhérent.',
'$withSubterritoryDefaultValue',
'0'
)
......
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250418111930 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql("UPDATE global_parameter SET name = 'GEOLOC_WITH_QUARTIER' WHERE name = 'SSA_HOUSEHOLD_WITH_QUARTIER'");
$this->addSql("UPDATE global_parameter SET name = 'GEOLOC_QUARTIER_LIST_VALUES' WHERE name = 'SSA_HOUSEHOLD_QUARTIER_LIST_VALUES'");
$this->addSql("UPDATE global_parameter SET name = 'GEOLOC_WITH_SUBTERRITORY' WHERE name = 'SSA_HOUSEHOLD_WITH_SUBTERRITORY'");
}
public function down(Schema $schema) : void
{
$this->addSql("UPDATE global_parameter SET name = 'SSA_HOUSEHOLD_WITH_QUARTIER' WHERE name = 'GEOLOC_WITH_QUARTIER'");
$this->addSql("UPDATE global_parameter SET name = 'SSA_HOUSEHOLD_QUARTIER_LIST_VALUES' WHERE name = 'GEOLOC_QUARTIER_LIST_VALUES'");
$this->addSql("UPDATE global_parameter SET name = 'SSA_HOUSEHOLD_WITH_SUBTERRITORY' WHERE name = 'GEOLOC_WITH_SUBTERRITORY'");
// this down() migration is auto-generated, please modify it to your needs
}
}
Markdown is supported
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