Commit 44f1a5aa by Yvon

Merge branch 'develop' into 3576-inscription-modification-habitant

parents 7b6c7f97 c89e8ff7
......@@ -69,4 +69,27 @@ $(document).ready(function() {
}
});
});
// Hide or display Cotisation or Profils de Cotisation submenu depending on TAV env
const tav_env = document.getElementsByName('is-tav-env')[0].getAttribute('content');
let linksToCotisationAdherent = $('a[href="/admin/cotisation_adherent/list"]');
for(let i = 0 ; i < linksToCotisationAdherent.length ; i++) {
if(linksToCotisationAdherent[i].innerText === "Cotisation") {
linksToCotisationAdherent[i].parentNode.style.display = (tav_env === "1") ? "none" : "";
}
}
let linksToCotisationPresta = $('a[href="/admin/cotisation_prestataire/list"]');
for(let i = 0 ; i < linksToCotisationPresta.length ; i++) {
if(linksToCotisationPresta[i].innerText === "Cotisation") {
linksToCotisationPresta[i].parentNode.style.display = (tav_env === "1") ? "none" : "";
}
}
let linksToProfilDeCotisation = $('a[href="/admin/profilcotisation/list"]');
for(let i = 0 ; i < linksToProfilDeCotisation.length ; i++) {
if(linksToProfilDeCotisation[i].innerText === "Profils De Cotisation") {
linksToProfilDeCotisation[i].parentNode.style.display = (tav_env === "1") ? "" : "none";
}
}
});
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,7 +12,7 @@
"admin": {
"js": [
"/build/runtime.6ad5c9da.js",
"/build/admin.8a6adf4b.js"
"/build/admin.b35f5723.js"
],
"css": [
"/build/admin.5dc0eea7.css"
......
......@@ -2,7 +2,7 @@
"build/app.css": "/build/app.8f9aaf53.css",
"build/app.js": "/build/app.fe8f482e.js",
"build/admin.css": "/build/admin.5dc0eea7.css",
"build/admin.js": "/build/admin.8a6adf4b.js",
"build/admin.js": "/build/admin.b35f5723.js",
"build/runtime.js": "/build/runtime.6ad5c9da.js",
"build/images/fa-solid-900.svg": "/build/images/fa-solid-900.a838c42a.svg",
"build/images/fa-brands-400.svg": "/build/images/fa-brands-400.05d20183.svg",
......
......@@ -6,6 +6,7 @@ use App\Entity\AccountAdherent;
use App\Entity\Adherent;
use App\Entity\CotisationAdherent;
use App\Entity\Geoloc;
use App\Entity\GlobalParameter;
use App\Entity\Groupe;
use App\Entity\User;
use App\Entity\Usergroup;
......@@ -26,6 +27,7 @@ use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\DoctrineORMAdminBundle\Datagrid\OrderByToSelectWalker;
use Sonata\DoctrineORMAdminBundle\Filter\CallbackFilter;
use Sonata\Form\Type\DateTimeRangePickerType;
......@@ -173,10 +175,10 @@ class AdherentAdmin extends AbstractAdmin
$formMapper
->tab('General')
->with('Profil de cotisation', ['class' => 'col-md-5'])
->with('Informations de cotisation', ['class' => 'col-md-5'])
->add('profilDeCotisation', ChoiceType::class, [
'required' => true,
'label' => 'Choix du profil :',
'label' => 'Choix du profil de cotisation :',
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(ProfilDeCotisation::class)->findAll(),
'empty_data' => null,
'placeholder' => 'Choisir un profil',
......@@ -220,6 +222,23 @@ class AdherentAdmin extends AbstractAdmin
])
->end()
->end();
if (!empty($adherent) && !empty($adherent->getEmlcAccount()) ) {
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$balance = $adherent->getEmlcAccount()->getBalance();
$mlc = $em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_SYMBOL);
$formMapper
->tab('General')
->with('Informations de cotisation')
->add('idmlc', TextType::class, [
'disabled' => true,
'required' => false,
'label' => 'Solde e-' . $mlc . ' :',
'data' => $balance . ' ' . $mlc
])
->end()
->end();
}
}
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
......@@ -565,3 +584,4 @@ class AdherentAdmin extends AbstractAdmin
return $res;
}
}
......@@ -175,7 +175,7 @@ class UserAdherentController extends FluxController
$this->em->flush();
$this->addFlash(
'success',
$this->translator->trans('Cotisation payée ! [Payzen désactivé en attent du compte]')
$this->translator->trans('Cotisation payée ! [Paiement via Payzen temporairement désactivé]')
);
return $this->redirectToRoute('index');
......@@ -238,7 +238,7 @@ class UserAdherentController extends FluxController
$data = $form->getData();
$plainCode = $data->getPaymentCode();
if (is_numeric($plainCode) && strlen($plainCode) >= 4 && strlen($plainCode) <= 8) {
if (ctype_digit($plainCode) && strlen($plainCode) >= 4 && strlen($plainCode) <= 8) {
$encoded = crypt($plainCode, $this->getUser()->getSalt());
$adherent->setPaymentCode($encoded);
......
......@@ -324,7 +324,7 @@ class UserController extends AbstractController
$this->translator->trans('Solde de l\'habitant·e insuffisant')
);
return $this->redirectToRoute('index');
goto end;
}
// Save transaction
......
......@@ -56,7 +56,7 @@ class TAVCotisationUtils
$profile = $flux->getDestinataire()->getProfilDeCotisation();
$cotisationAmount = $profile->getMontant();
$cotisationTaux = $profile->getTauxCotisation();
$mlcAmount = $cotisationAmount * $cotisationTaux;
$mlcAmount = round($cotisationAmount * $cotisationTaux);
// get the difference between what the user paid and what he•she's supposed to receive
$amountDiff = $mlcAmount - $cotisationAmount;
......
......@@ -26,6 +26,7 @@ Modified for MLC from Sonata package.
<html {% block html_attributes %}class="no-js"{% endblock %}>
<head>
<title>{{title|default('Kohinos') }}</title>
<meta name="is-tav-env" content="{{ tav_env }}" />
<meta name="description" content="{{ description|default('Kohinos : Outil de gestion de monnaie locale complémentaire') }}" />
<meta name="keywords" content="{{ keywords|default('Kohinos, mlc, mlcc, monnaie locale, monnaies locales') }}" />
......
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