Commit 7c25f39e by Yvon

Merge branch 'develop' into ssa-gironde

parents a3712990 38241d8e
...@@ -58,7 +58,7 @@ Copier le fichier .env.dist en .env et configurer : ...@@ -58,7 +58,7 @@ Copier le fichier .env.dist en .env et configurer :
- en environnement TAV, la variable AUTOMATISATION_RECONVERSION permet d'activer l'automatisation des reconversions - en environnement TAV, la variable AUTOMATISATION_RECONVERSION permet d'activer l'automatisation des reconversions
- en environnement TAV, la variable PRESTA_EXTRA_DATA permet d'indiquer puis d'afficher publiquement plus de données concernant les prestataires (e.g. familles de produits) - en environnement TAV, la variable PRESTA_EXTRA_DATA permet d'indiquer puis d'afficher publiquement plus de données concernant les prestataires (e.g. familles de produits)
- en environnement TAV, la variable HOUSEHOLD_BASED_ALLOWANCE permet d'activer un mode de cotisations libres et d'allocations basées sur la composition du foyer - en environnement TAV, la variable HOUSEHOLD_BASED_ALLOWANCE permet d'activer un mode de cotisations libres et d'allocations basées sur la composition du foyer
- en environnement TAV, la variable SSA_FRIENDLY_FLUX_TYPE_NAMES permet d'adapter le nommage des types de flux à un projet de type ssa - en environnement TAV, la variable SSA_FRIENDLY_FLUX_TYPE_NAMES permet d'adapter le nommage des types de flux et les écrans de visualisation des flux à un projet de type SSA
- en environnement TAV, la varialble CCAS_MODE permet d'activer les fonctionnalités de branchement avec une CCAS. Attention : Pour activer CCAS_MODE, le paramètre AUTOMATISATION_RECONVERSION doit OBLIGATOIREMENT être activé. - en environnement TAV, la varialble CCAS_MODE permet d'activer les fonctionnalités de branchement avec une CCAS. Attention : Pour activer CCAS_MODE, le paramètre AUTOMATISATION_RECONVERSION doit OBLIGATOIREMENT être activé.
Si vous utilisez Payzen comme moyen de paiement par CB : Si vous utilisez Payzen comme moyen de paiement par CB :
...@@ -168,27 +168,6 @@ EN CAS D'ERREUR 500 : ...@@ -168,27 +168,6 @@ EN CAS D'ERREUR 500 :
Pour cela on peut utiliser la commande suivante : Pour cela on peut utiliser la commande suivante :
**tail -f var/log/prod.xxx.log | grep CRITICAL** **tail -f var/log/prod.xxx.log | grep CRITICAL**
## Mettre en place les CRON jobs
Ecrire dans un fichier tav dans /etc/cron.d :
Quand TAV_ENV = 1, pour envoyer les rappels de cotisation :
42 0 * * * kohinos php /home/kohinos/kohinos/bin/console kohinos:tav:mail-rappel-cotisation
Quand AUTOMATISATION_RECONVERSION = 1, pour que les reconversions aient lieu les dimanches soir qui précèdent les 14 et/ou 28 :
15 23 * * 0 kohinos [ "$(date +\%d)" -ge 08 -a "$(date +\%d)" -le 14 ] && php /home/kohinos/kohinos/bin/console kohinos:ssa:reconversion-prestataires twice_a_month
15 23 * * 0 kohinos [ "$(date +\%d)" -ge 22 -a "$(date +\%d)" -le 28 ] && php /home/kohinos/kohinos/bin/console kohinos:ssa:reconversion-prestataires twice_a_month
17 23 * * 0 kohinos [ "$(date +\%d)" -ge 22 -a "$(date +\%d)" -le 28 ] && php /home/kohinos/kohinos/bin/console kohinos:ssa:reconversion-prestataires once_a_month
19 23 * 1,3,5,7,9,11 0 kohinos [ "$(date +\%d)" -ge 22 -a "$(date +\%d)" -le 28 ] && php /home/kohinos/kohinos/bin/console kohinos:ssa:reconversion-prestataires once_every_two_month
Quand CCAS_MODE = 1, pour que les reconversions CCAS soient effectuées et les exports envoyés puis effacés du disque le 1 du mois :
47 1 1 * * kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:reconversion-ccas-prestataires
57 1 1 * * kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:export-ccas-transactions
27 2 1 * * kohinos rm -f /home/kohinos/kohinos/ccastransactions/*
## Lancer le Kohinos en local ## Lancer le Kohinos en local
Installer le client symfony Installer le client symfony
......
...@@ -8,6 +8,7 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper; ...@@ -8,6 +8,7 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
/** /**
* Administration des flux 'Achat de monnaie'. * Administration des flux 'Achat de monnaie'.
...@@ -51,18 +52,34 @@ class AchatMonnaieAdmin extends FluxAdmin ...@@ -51,18 +52,34 @@ class AchatMonnaieAdmin extends FluxAdmin
*/ */
protected function configureDatagridFilters(DatagridMapper $datagridMapper): void protected function configureDatagridFilters(DatagridMapper $datagridMapper): void
{ {
//In mode ssa_friendly_flux_type_names, we display on this page all cotisation if($this->getConfigurationPool()->getContainer()->getParameter('tav_env')
//initial operation (i.e. we display vente_emlc operations in addition to achat_monnaie) && $this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names')) {
//therefore filtering by type achat_monnaie_adherent VS achat_monnaie_prestataire $datagridMapper->add('type', null, [
//would be confusing (selecting one of them would hide all vente_emlc operations) 'advanced_filter' => false,
if(!$this->getConfigurationPool()->getContainer()->getParameter('tav_env') 'show_filter' => true,
|| !$this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names')) { 'field_type' => ChoiceType::class,
'field_options' => [
'choices' => [
'Achat des adhérents' => 'achat_monnaie_adherent',
'Achat des prestataires' => 'achat_monnaie_prestataire',
'Vente aux adhérents' => 'vente_emlc_adherent',
'Vente aux prestataires' => 'vente_emlc_prestataire',
],
'placeholder' => 'Indifférent',
'expanded' => false,
'multiple' => false,
],
]);
} else {
$datagridMapper->add('type', null, [ $datagridMapper->add('type', null, [
'advanced_filter' => false, 'advanced_filter' => false,
'show_filter' => true, 'show_filter' => true,
'field_type' => ChoiceType::class, 'field_type' => ChoiceType::class,
'field_options' => [ 'field_options' => [
'choices' => ['Adhérent' => 'achat_monnaie_adherent', 'Prestataire' => 'achat_monnaie_prestataire'], 'choices' => [
'Adhérent' => 'achat_monnaie_adherent',
'Prestataire' => 'achat_monnaie_prestataire',
],
'placeholder' => 'Indifférent', 'placeholder' => 'Indifférent',
'expanded' => true, 'expanded' => true,
'multiple' => false, 'multiple' => false,
......
...@@ -585,6 +585,13 @@ class AdherentAdmin extends AbstractAdmin ...@@ -585,6 +585,13 @@ class AdherentAdmin extends AbstractAdmin
if ($this->getConfigurationPool()->getContainer()->getParameter('tav_env')) { if ($this->getConfigurationPool()->getContainer()->getParameter('tav_env')) {
$datagridMapper $datagridMapper
->remove('cotisationajour'); ->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')) { if ($this->getConfigurationPool()->getContainer()->getParameter('ccas_mode')) {
$datagridMapper $datagridMapper
->add('anonymoustoken', CallbackFilter::class, [ ->add('anonymoustoken', CallbackFilter::class, [
......
...@@ -69,7 +69,13 @@ class OperationAdherentAdmin extends OperationAdmin ...@@ -69,7 +69,13 @@ class OperationAdherentAdmin extends OperationAdmin
'label' => 'Adherent', 'label' => 'Adherent',
'advanced_filter' => false, 'advanced_filter' => false,
'show_filter' => true, 'show_filter' => true,
]) ]);
; if($this->getConfigurationPool()->getContainer()->getParameter('household_based_allowance')) {
$datagridMapper->add('account.adherent.geoloc.subterritory', null, [
'label' => 'Territoire',
'advanced_filter' => false,
'show_filter' => true,
]);
}
} }
} }
...@@ -9,19 +9,26 @@ use Doctrine\ORM\EntityManagerInterface; ...@@ -9,19 +9,26 @@ use Doctrine\ORM\EntityManagerInterface;
use Knp\Component\Pager\PaginatorInterface; use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security as Secur;
class OperationsController extends AbstractController class OperationsController extends AbstractController
{ {
protected $em; protected $em;
protected $paginator; protected $paginator;
protected $operationUtils; protected $operationUtils;
protected $security;
private $session;
public function __construct(EntityManagerInterface $em, PaginatorInterface $paginator, OperationUtils $operationUtils)
public function __construct(EntityManagerInterface $em, PaginatorInterface $paginator, OperationUtils $operationUtils, Secur $security, SessionInterface $session)
{ {
$this->em = $em; $this->em = $em;
$this->paginator = $paginator; $this->paginator = $paginator;
$this->operationUtils = $operationUtils; $this->operationUtils = $operationUtils;
$this->security = $security;
$this->session = $session;
} }
/** /**
...@@ -32,6 +39,20 @@ class OperationsController extends AbstractController ...@@ -32,6 +39,20 @@ class OperationsController extends AbstractController
if (empty($this->getUser())) { if (empty($this->getUser())) {
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
} }
//Prepare query depending on user role
$user = $this->security->getUser();
$role = "";
if (null != $this->session->get('_prestagere') && $user->isGranted('ROLE_PRESTATAIRE')) {
$role = "ROLE_PRESTATAIRE";
} elseif (null != $user->getAdherent() && $user->isGranted('ROLE_ADHERENT')) {
$role = "ROLE_ADHERENT";
} elseif (null != $this->session->get('_comptoirgere') && $user->isGranted('ROLE_COMPTOIR')) {
$role = "ROLE_COMPTOIR";
} elseif (null != $this->session->get('_groupegere') && $user->isGranted('ROLE_GESTION_GROUPE')) {
$role = "ROLE_GESTION_GROUPE";
}
if (!in_array($currency, CurrencyEnum::getAvailableTypes())) { if (!in_array($currency, CurrencyEnum::getAvailableTypes())) {
throw new \Exception('Opération impossible ! Type de currency ' . $currency . ' inexistant'); throw new \Exception('Opération impossible ! Type de currency ' . $currency . ' inexistant');
} }
...@@ -39,7 +60,7 @@ class OperationsController extends AbstractController ...@@ -39,7 +60,7 @@ class OperationsController extends AbstractController
$datemin = new \DateTime('first day of this month'); $datemin = new \DateTime('first day of this month');
$datemin->setTime(0, 0, 0); $datemin->setTime(0, 0, 0);
$datemax = new \DateTime('now'); $datemax = new \DateTime('now');
$form = $this->createForm(ListOperationFormType::class); $form = $this->createForm(ListOperationFormType::class, null, array("role" => $role));
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
......
...@@ -106,8 +106,8 @@ class UserPrestataireController extends FluxController ...@@ -106,8 +106,8 @@ class UserPrestataireController extends FluxController
} }
} else { } else {
foreach ($form->getErrors(true, true) as $error) { foreach ($form->getErrors(true, true) as $error) {
// Add flash error message in case of error with the embedded form // Errors detected here can be productFamily errors or other errors like csrf token errors
if (str_contains($error->getCause()->getPropertyPath(), 'productFamily')) { // Add flash message showing the first error message
$this->addFlash( $this->addFlash(
'error', 'error',
$error->getMessage() $error->getMessage()
...@@ -115,7 +115,6 @@ class UserPrestataireController extends FluxController ...@@ -115,7 +115,6 @@ class UserPrestataireController extends FluxController
break; break;
} }
} }
}
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
} }
......
...@@ -46,4 +46,9 @@ class Subterritory ...@@ -46,4 +46,9 @@ class Subterritory
return $this; return $this;
} }
public function __toString(): string
{
return $this->getName();
}
} }
...@@ -2,9 +2,12 @@ ...@@ -2,9 +2,12 @@
namespace App\Form\Type; namespace App\Form\Type;
use App\Entity\Cotisation;
use App\Entity\Transaction;
use App\Enum\MoyenEnum; use App\Enum\MoyenEnum;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
...@@ -58,6 +61,13 @@ class ListOperationFormType extends AbstractType ...@@ -58,6 +61,13 @@ class ListOperationFormType extends AbstractType
->add('xls', SubmitType::class) ->add('xls', SubmitType::class)
->add('xml', SubmitType::class) ->add('xml', SubmitType::class)
; ;
if($options['role'] === 'ROLE_ADHERENT') {
$builder
->add('showMonAPurchaseOnly', CheckboxType::class, [
'label' => 'Afficher uniquement les cotisations',
'required' => false
]);
}
} }
/** /**
...@@ -67,6 +77,7 @@ class ListOperationFormType extends AbstractType ...@@ -67,6 +77,7 @@ class ListOperationFormType extends AbstractType
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => null, 'data_class' => null,
'role' => ""
]); ]);
} }
......
...@@ -7,8 +7,10 @@ use App\Entity\AccountComptoir; ...@@ -7,8 +7,10 @@ use App\Entity\AccountComptoir;
use App\Entity\AccountGroupe; use App\Entity\AccountGroupe;
use App\Entity\AccountPrestataire; use App\Entity\AccountPrestataire;
use App\Entity\AccountSiege; use App\Entity\AccountSiege;
use App\Entity\AchatMonnaie;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\Comptoir; use App\Entity\Comptoir;
use App\Entity\Flux;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Entity\OperationAdherent; use App\Entity\OperationAdherent;
use App\Entity\OperationComptoir; use App\Entity\OperationComptoir;
...@@ -19,6 +21,7 @@ use App\Entity\Prestataire; ...@@ -19,6 +21,7 @@ use App\Entity\Prestataire;
use App\Entity\Reconversion; use App\Entity\Reconversion;
use App\Entity\Siege; use App\Entity\Siege;
use App\Entity\Transaction; use App\Entity\Transaction;
use App\Entity\VenteEmlc;
use App\Enum\CurrencyEnum; use App\Enum\CurrencyEnum;
use App\Enum\MoyenEnum; use App\Enum\MoyenEnum;
use App\Events\FluxEvent; use App\Events\FluxEvent;
...@@ -80,6 +83,13 @@ class OperationUtils ...@@ -80,6 +83,13 @@ class OperationUtils
->setParameter('moyen', $request->get('formListOperations')['moyen']) ->setParameter('moyen', $request->get('formListOperations')['moyen'])
; ;
} }
if (!empty($request->get('formListOperations')['showMonAPurchaseOnly'])) {
$qb
->andWhere('flux.type IN (:type_achat_monnaie_adherent, :type_vente_emlc_adherent)')
->setParameter('type_achat_monnaie_adherent', AchatMonnaie::TYPE_ACHAT_ADHERENT)
->setParameter('type_vente_emlc_adherent', VenteEmlc::TYPE_VENTE_EMLC_ADHERENT)
;
}
return $qb->getQuery(); return $qb->getQuery();
} }
......
...@@ -13,7 +13,12 @@ ...@@ -13,7 +13,12 @@
<div class='col-4'>{{ form_row(searchForm.moyen) }}</div> <div class='col-4'>{{ form_row(searchForm.moyen) }}</div>
<div class='col-4'>{{ form_row(searchForm.datemin) }}</div> <div class='col-4'>{{ form_row(searchForm.datemin) }}</div>
<div class='col-4'>{{ form_row(searchForm.datemax) }}</div> <div class='col-4'>{{ form_row(searchForm.datemax) }}</div>
{% if searchForm.showMonAPurchaseOnly is defined and ssa_friendly_flux_type_names %}
<div class='col-4'>{{ form_row(searchForm.showMonAPurchaseOnly) }}</div>
<div class='col-8 text-right'>{{ form_row(searchForm.submit) }}</div>
{% else %}
<div class='col-12 text-right'>{{ form_row(searchForm.submit) }}</div> <div class='col-12 text-right'>{{ form_row(searchForm.submit) }}</div>
{% endif %}
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table"> <table class="table">
......
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