Commit d4ec7674 by Julien Jorry

BIG COMMIT : HELLOASSO + DON

parent 2651c7c6
...@@ -58,3 +58,6 @@ deploy.php ...@@ -58,3 +58,6 @@ deploy.php
#Theme custom Kohinos #Theme custom Kohinos
templates/themes/custom/ templates/themes/custom/
#VSCODE
.vscode/
\ No newline at end of file
# Update v2.4.0 (2022-03-?)
- HELLOASSO MODULE
- Gestion de dons (pour las adherents et prestatataires, pour l'achat et la cotisation)
- PHP CS FIXER sur tous les fichiers .php
- Corrections de bugs :
- Fix : un adhérent/prestataire pas à jour de sa cotisation ne pourra pas faire de virement ou de demande de reconversion
- Fix import => ajout du type de prestataire par défaut (prestataire)
- Ajout du bouton pour cotiser pour l'année suivante (si cotisation pour l'année en cours valide)
- et ajout de la date de fin de validité de la cotisation en cours
- Ajout d'une fonction pour avoir le nom complet d'un adhérent
# Update v2.3.0 (2022-03-29) # Update v2.3.0 (2022-03-29)
## Sécurité sociale alimentaire (Solidoume pour la doume) ## Sécurité sociale alimentaire (Solidoume pour la doume)
......
2.3.0 2.4.0
\ No newline at end of file \ No newline at end of file
...@@ -121,7 +121,7 @@ function addGroupeFormDeleteLinkGeoloc($tagFormLiGeoloc) { ...@@ -121,7 +121,7 @@ function addGroupeFormDeleteLinkGeoloc($tagFormLiGeoloc) {
}); });
} }
function showConfirmTransactionModal(div, form, montant, destinataire = null) { function showConfirmTransactionModal(div, form, montant, don, destinataire = null) {
// Get modal // Get modal
var modal = $('#confirmTransactionModal') var modal = $('#confirmTransactionModal')
...@@ -130,6 +130,7 @@ function showConfirmTransactionModal(div, form, montant, destinataire = null) { ...@@ -130,6 +130,7 @@ function showConfirmTransactionModal(div, form, montant, destinataire = null) {
// Set data in modal // Set data in modal
message.find('.montant_transaction').text(montant) message.find('.montant_transaction').text(montant)
message.find('.montant_don').text(don)
if (destinataire != null) { if (destinataire != null) {
message.find('.nom_destinataire').text(destinataire) message.find('.nom_destinataire').text(destinataire)
} }
...@@ -191,6 +192,14 @@ jQuery(document).ready(function() { ...@@ -191,6 +192,14 @@ jQuery(document).ready(function() {
// BOOTSTRAP TOOLTIPS // BOOTSTRAP TOOLTIPS
$('[data-toggle="tooltip"]').tooltip() $('[data-toggle="tooltip"]').tooltip()
$("input:text[name='formAchatMonnaieAdherent[don][montant]']").change(function() {
var valuetotal = parseFloat($('input.achatmonnaie-montant-slider').slider().val()) + parseFloat($("input:text[name='formAchatMonnaieAdherent[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$("input:text[name='formAchatMonnaieAConfirmerAdherent[don][montant]']").change(function() {
var valuetotal = parseFloat($('input.achatmonnaie-montant-slider').slider().val()) + parseFloat($("input:text[name='formAchatMonnaieAConfirmerAdherent[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$("input:radio[name='formAchatMonnaieAdherent[montantradio]']").change(function() { $("input:radio[name='formAchatMonnaieAdherent[montantradio]']").change(function() {
var mySlider = $("input.achatmonnaie-montant-slider").slider(); var mySlider = $("input.achatmonnaie-montant-slider").slider();
...@@ -198,14 +207,82 @@ jQuery(document).ready(function() { ...@@ -198,14 +207,82 @@ jQuery(document).ready(function() {
mySlider.slider('setValue', this.value) mySlider.slider('setValue', this.value)
$("span.achat_monnaie_montant_choisi").text(this.value + ' €') $("span.achat_monnaie_montant_choisi").text(this.value + ' €')
var valuetotal = parseFloat(this.value) + parseFloat($("input:text[name='formAchatMonnaieAdherent[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
}); });
$("input:radio[name='formAchatMonnaieAConfirmerAdherent[montantradio]']").change(function() {
var mySlider = $("input.achatmonnaie-montant-slider").slider();
// Set slider value like radio when radio changes
mySlider.slider('setValue', this.value)
$('input.achatmonnaie-montant-slider').slider().on('change', function(event){ $("span.achat_monnaie_montant_choisi").text(this.value + ' €')
var valuetotal = parseFloat(this.value) + parseFloat($("input:text[name='formAchatMonnaieAConfirmerAdherent[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$("form[name='formAchatMonnaieAdherent'] input.achatmonnaie-montant-slider").slider().on('change', function(event){
var value = event.value.newValue; var value = event.value.newValue;
$("span.achat_monnaie_montant_choisi").text(value + ' €') $("span.achat_monnaie_montant_choisi").text(value + ' €')
var valuetotal = parseFloat(value) + parseFloat($("input:text[name='formAchatMonnaieAdherent[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
}); });
$("form[name='formAchatMonnaieAConfirmerAdherent'] input.achatmonnaie-montant-slider").slider().on('change', function(event){
var value = event.value.newValue;
$("span.achat_monnaie_montant_choisi").text(value + ' €')
var valuetotal = parseFloat(value) + parseFloat($("input:text[name='formAchatMonnaieAConfirmerAdherent[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$("input:text[name='formAchatMonnaiePrestataire[don][montant]']").change(function() {
var valuetotal = parseFloat($('input.achatmonnaie-montant-slider').slider().val()) + parseFloat($("input:text[name='formAchatMonnaiePrestataire[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$("input:text[name='formAchatMonnaieAConfirmerPrestataire[don][montant]']").change(function() {
var valuetotal = parseFloat($('input.achatmonnaie-montant-slider').slider().val()) + parseFloat($("input:text[name='formAchatMonnaieAConfirmerPrestataire[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$("input:radio[name='formAchatMonnaiePrestataire[montantradio]']").change(function() {
var mySlider = $("input.achatmonnaie-montant-slider").slider();
// Set slider value like radio when radio changes
mySlider.slider('setValue', this.value)
$("span.achat_monnaie_montant_choisi").text(this.value + ' €')
var valuetotal = parseFloat(this.value) + parseFloat($("input:text[name='formAchatMonnaiePrestataire[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$("input:radio[name='formAchatMonnaieAConfirmerPrestataire[montantradio]']").change(function() {
var mySlider = $("input.achatmonnaie-montant-slider").slider();
// Set slider value like radio when radio changes
mySlider.slider('setValue', this.value)
$("span.achat_monnaie_montant_choisi").text(this.value + ' €')
var valuetotal = parseFloat(this.value) + parseFloat($("input:text[name='formAchatMonnaieAConfirmerPrestataire[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$("form[name='formAchatMonnaiePrestataire'] input.achatmonnaie-montant-slider").slider().on('change', function(event){
var value = event.value.newValue;
$("span.achat_monnaie_montant_choisi").text(value + ' €')
var valuetotal = parseFloat(value) + parseFloat($("input:text[name='formAchatMonnaiePrestataire[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$("form[name='formAchatMonnaieAConfirmerPrestataire'] input.achatmonnaie-montant-slider").slider().on('change', function(event){
var value = event.value.newValue;
$("span.achat_monnaie_montant_choisi").text(value + ' €')
var valuetotal = parseFloat(value) + parseFloat($("input:text[name='formAchatMonnaieAConfirmerPrestataire[don][montant]']").val().replace(",", "."))
$("span.achat_monnaie_montant_total").text(valuetotal + ' €')
});
$('.transactionSubmit').on('click', function(e){ $('.transactionSubmit').on('click', function(e){
// Stop form submition // Stop form submition
e.preventDefault(); e.preventDefault();
...@@ -229,7 +306,11 @@ jQuery(document).ready(function() { ...@@ -229,7 +306,11 @@ jQuery(document).ready(function() {
var montant_field = $('#' + form.name + '_montant')[0] var montant_field = $('#' + form.name + '_montant')[0]
var montant_value = montant_field.value var montant_value = montant_field.value
showConfirmTransactionModal(div, form, montant_value, destinataire_name) // Get don montant
var don_field = $('#' + form.name + '_don_montant')[0]
var don_value = don_field.value
showConfirmTransactionModal(div, form, montant_value, don_value, destinataire_name)
} else { } else {
// Use symfony validation // Use symfony validation
form.submit() form.submit()
...@@ -254,6 +335,7 @@ jQuery(document).ready(function() { ...@@ -254,6 +335,7 @@ jQuery(document).ready(function() {
// Set form moyen // Set form moyen
$('#' + form.name + '_moyen')[0].value = 'emlc' $('#' + form.name + '_moyen')[0].value = 'emlc'
$('#' + form.name + '_don_moyen')[0].value = 'emlc'
if (form.checkValidity()) { if (form.checkValidity()) {
var div = '.confirmCotisation' var div = '.confirmCotisation'
...@@ -262,17 +344,43 @@ jQuery(document).ready(function() { ...@@ -262,17 +344,43 @@ jQuery(document).ready(function() {
var montant_field = $('#' + form.name + '_montant')[0] var montant_field = $('#' + form.name + '_montant')[0]
var montant_value = montant_field.value var montant_value = montant_field.value
showConfirmTransactionModal(div, form, montant_value) // Get don montant
var don_field = $('#' + form.name + '_don_montant')[0]
var don_value = don_field.value
showConfirmTransactionModal(div, form, montant_value, don_value)
} else { } else {
// Use symfony validation // Use symfony validation
form.submit() form.submit()
} }
}); });
$('.achatCBSubmit').on('click', function(e){
var form = this.closest('form')
// Set form moyen
$('#' + form.name + '_moyen')[0].value = 'cb'
$('#' + form.name + '_don_moyen')[0].value = 'cb'
});
$('.achatHelloAssoSubmit').on('click', function(e){
var form = this.closest('form')
// Set form moyen
$('#' + form.name + '_moyen')[0].value = 'helloasso'
$('#' + form.name + '_don_moyen')[0].value = 'helloasso'
});
$('.cotisationCBSubmit').on('click', function(e){ $('.cotisationCBSubmit').on('click', function(e){
var form = this.closest('form') var form = this.closest('form')
// Set form moyen // Set form moyen
$('#' + form.name + '_moyen')[0].value = 'cb' $('#' + form.name + '_moyen')[0].value = 'cb'
$('#' + form.name + '_don_moyen')[0].value = 'cb'
});
$('.cotisationHelloAssoSubmit').on('click', function(e){
var form = this.closest('form')
// Set form moyen
$('#' + form.name + '_moyen')[0].value = 'helloasso'
$('#' + form.name + '_don_moyen')[0].value = 'helloasso'
}); });
$("input:radio[name='formAchatMonnaieAConfirmerAdherent[moyen]']").change(function() { $("input:radio[name='formAchatMonnaieAConfirmerAdherent[moyen]']").change(function() {
......
...@@ -19,11 +19,13 @@ ...@@ -19,11 +19,13 @@
"ext-intl": "*", "ext-intl": "*",
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"api-platform/api-pack": "^1.2", "api-platform/core": "^2.6",
"beberlei/doctrineextensions": "^1.3", "beberlei/doctrineextensions": "^1.3",
"composer/package-versions-deprecated": "1.11.99.1",
"cron/cron-bundle": "^2.4", "cron/cron-bundle": "^2.4",
"doctrine/annotations": "1.*", "doctrine/annotations": "1.*",
"doctrine/common": "^2.13", "doctrine/common": "^2.13",
"doctrine/doctrine-bundle": "^1.12",
"doctrine/doctrine-fixtures-bundle": "^3.4", "doctrine/doctrine-fixtures-bundle": "^3.4",
"doctrine/doctrine-migrations-bundle": "^3.0", "doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/migrations": "^3.1", "doctrine/migrations": "^3.1",
...@@ -37,14 +39,17 @@ ...@@ -37,14 +39,17 @@
"gregwar/captcha-bundle": "2.1.*", "gregwar/captcha-bundle": "2.1.*",
"hautelook/alice-bundle": "^2.9", "hautelook/alice-bundle": "^2.9",
"knplabs/knp-paginator-bundle": "2.*", "knplabs/knp-paginator-bundle": "2.*",
"knpuniversity/oauth2-client-bundle": "^2.8",
"lexik/translation-bundle": "~4.0", "lexik/translation-bundle": "~4.0",
"liip/imagine-bundle": "^2.5", "liip/imagine-bundle": "^2.5",
"michaeldegroot/doctrine-encrypt-bundle": "3.0.*", "michaeldegroot/doctrine-encrypt-bundle": "3.0.*",
"nelmio/api-doc-bundle": "^3.3", "nelmio/api-doc-bundle": "^3.3",
"nelmio/cors-bundle": "^2.1",
"payum/offline": "^1.6", "payum/offline": "^1.6",
"payum/payum-bundle": "^2.4", "payum/payum-bundle": "^2.4",
"php-http/guzzle6-adapter": "^2.0", "php-http/guzzle6-adapter": "^2.0",
"php-http/message": "^1.7", "php-http/message": "^1.7",
"phpdocumentor/reflection-docblock": "^5.2",
"pixassociates/sortable-behavior-bundle": "^1.5", "pixassociates/sortable-behavior-bundle": "^1.5",
"prodigious/sonata-menu-bundle": "^3.0", "prodigious/sonata-menu-bundle": "^3.0",
"ramsey/uuid-doctrine": "^1.6", "ramsey/uuid-doctrine": "^1.6",
...@@ -74,20 +79,24 @@ ...@@ -74,20 +79,24 @@
"symfony/flex": "^1.2", "symfony/flex": "^1.2",
"symfony/form": "4.4.*", "symfony/form": "4.4.*",
"symfony/framework-bundle": "4.4.*", "symfony/framework-bundle": "4.4.*",
"symfony/http-client": "4.4.*",
"symfony/monolog-bundle": "3.*", "symfony/monolog-bundle": "3.*",
"symfony/orm-pack": "2.*",
"symfony/process": "4.4.*", "symfony/process": "4.4.*",
"symfony/property-access": "4.4.*",
"symfony/property-info": "4.4.*",
"symfony/proxy-manager-bridge": "4.4.*",
"symfony/security-bundle": "4.4.*", "symfony/security-bundle": "4.4.*",
"symfony/serializer-pack": "1.*", "symfony/serializer": "4.4.*",
"symfony/swiftmailer-bundle": "^3.1", "symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.4.*", "symfony/translation": "4.4.*",
"symfony/twig-bundle": "4.4.*", "symfony/twig-bundle": "4.4.*",
"symfony/twig-pack": "^1.0",
"symfony/validator": "4.4.*", "symfony/validator": "4.4.*",
"symfony/web-link": "4.4.*", "symfony/web-link": "4.4.*",
"symfony/webpack-encore-bundle": "^1.11", "symfony/webpack-encore-bundle": "^1.11",
"symfony/yaml": "4.4.*", "symfony/yaml": "4.4.*",
"twig/extensions": "^1.5", "twig/extensions": "^1.5",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0",
"vich/uploader-bundle": "^1.8", "vich/uploader-bundle": "^1.8",
"willdurand/geocoder-bundle": "^5.0" "willdurand/geocoder-bundle": "^5.0"
}, },
...@@ -102,18 +111,22 @@ ...@@ -102,18 +111,22 @@
"squizlabs/php_codesniffer": "^3.5", "squizlabs/php_codesniffer": "^3.5",
"symfony/browser-kit": "4.4.*", "symfony/browser-kit": "4.4.*",
"symfony/css-selector": "4.4.*", "symfony/css-selector": "4.4.*",
"symfony/debug-pack": "*", "symfony/debug-bundle": "4.4.*",
"symfony/maker-bundle": "^1.0", "symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "^5.1", "symfony/phpunit-bridge": "^5.1",
"symfony/profiler-pack": "*", "symfony/stopwatch": "4.4.*",
"symfony/test-pack": "^1.0", "symfony/var-dumper": "4.4.*",
"symfony/var-dumper": "4.4.*" "symfony/web-profiler-bundle": "4.4.*"
}, },
"config": { "config": {
"preferred-install": { "preferred-install": {
"*": "dist" "*": "dist"
}, },
"sort-packages": true "sort-packages": true,
"allow-plugins": {
"symfony/flex": true,
"phpro/grumphp": true
}
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -60,4 +60,5 @@ return [ ...@@ -60,4 +60,5 @@ return [
SpecShaper\GdprBundle\SpecShaperGdprBundle::class => ['all' => true], SpecShaper\GdprBundle\SpecShaperGdprBundle::class => ['all' => true],
Cron\CronBundle\CronCronBundle::class => ['all' => true], Cron\CronBundle\CronCronBundle::class => ['all' => true],
Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true], Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true],
KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle::class => ['all' => true],
]; ];
# See https://symfony.com/doc/current/email/dev_environment.html # See https://symfony.com/doc/current/email/dev_environment.html
swiftmailer: swiftmailer:
# send all emails to a specific address # send all emails to a specific address
# delivery_addresses: ['julien.jorry@gmail.com'] delivery_addresses: ['julien.jorry@gmail.com']
\ No newline at end of file \ No newline at end of file
knpu_oauth2_client:
clients:
# configure your clients as described here: https://github.com/knpuniversity/oauth2-client-bundle#configuration
...@@ -251,9 +251,18 @@ sonata_admin: ...@@ -251,9 +251,18 @@ sonata_admin:
- admin.all.cotisations - admin.all.cotisations
- admin.all.achatsmonnaie - admin.all.achatsmonnaie
- admin.all.demande.achatsmonnaie - admin.all.demande.achatsmonnaie
- admin.dons
- admin.transfert.gerer - admin.transfert.gerer
- admin.transaction.gerer - admin.transaction.gerer
- admin.reconversion.gerer - admin.reconversion.gerer
# sonata.admin.group.helloasso:
# keep_open: false
# on_top: true
# label: "HelloAsso"
# label_catalogue: SonataAdminBundle
# icon: '<i class="fa fa-bookmark-o"></i>'
# items:
# - admin.helloasso
# sonata.admin.group.compta: # sonata.admin.group.compta:
# keep_open: false # keep_open: false
# on_top: true # on_top: true
......
...@@ -599,6 +599,27 @@ services: ...@@ -599,6 +599,27 @@ services:
manager_type: orm manager_type: orm
group: "Paramètres Solidoume" group: "Paramètres Solidoume"
label: "Paramètres Solidoume" label: "Paramètres Solidoume"
admin.dons:
class: App\Admin\DonAdmin
arguments: [~, App\Entity\Don, ~]
tags:
- name: sonata.admin
manager_type: orm
group: "Flux"
label: "Dons"
public: true
calls:
- [ setSecurity, ['@security.helper']]
admin.helloasso:
class: App\Admin\HelloAssoAdmin
arguments: [~, App\Entity\HelloAsso, App\Controller\HelloAssoController]
tags:
- name: sonata.admin
manager_type: orm
group: "HelloAsso"
label: "HelloAsso"
show_mosaic_button: false show_mosaic_button: false
public: true public: true
...@@ -689,9 +710,7 @@ services: ...@@ -689,9 +710,7 @@ services:
- '' - ''
- [] - []
- [] - []
tags: decorates: console.command.translation_update
{ name: console.command, command: 'translation:update' }
# id: console.command.translation_update
class: App\Command\TranslationUpdateCommand class: App\Command\TranslationUpdateCommand
app.menu_listener: app.menu_listener:
......
...@@ -35,6 +35,8 @@ App\Entity\Usergroup: ...@@ -35,6 +35,8 @@ App\Entity\Usergroup:
'ROLE_ADMIN_SIEGE', 'ROLE_ADMIN_SIEGE',
'ROLE_SONATA_USER_ADMIN_USER_ALL', 'ROLE_SONATA_USER_ADMIN_USER_ALL',
'ROLE_SONATA_USER_ADMIN_GROUP_ALL', 'ROLE_SONATA_USER_ADMIN_GROUP_ALL',
'ROLE_ADMIN_COMPTOIR_GERER_LIST',
'ROLE_ADMIN_COMPTOIR_GERER_VIEW',
'ROLE_ADMIN_ADHERENT_GERER_ALL', 'ROLE_ADMIN_ADHERENT_GERER_ALL',
'ROLE_ADMIN_ALL_COTISATIONS_ALL', 'ROLE_ADMIN_ALL_COTISATIONS_ALL',
'ROLE_ADMIN_ALL_ACHATSMONNAIE_ALL', 'ROLE_ADMIN_ALL_ACHATSMONNAIE_ALL',
...@@ -46,7 +48,12 @@ App\Entity\Usergroup: ...@@ -46,7 +48,12 @@ App\Entity\Usergroup:
'ROLE_ADMIN_OPERATION_ADHERENT_GERER_LIST', 'ROLE_ADMIN_OPERATION_ADHERENT_GERER_LIST',
'ROLE_ADMIN_OPERATION_COMPTOIR_GERER_LIST', 'ROLE_ADMIN_OPERATION_COMPTOIR_GERER_LIST',
'ROLE_ADMIN_OPERATION_GROUPE_GERER_LIST', 'ROLE_ADMIN_OPERATION_GROUPE_GERER_LIST',
'ROLE_ADMIN_OPERATION_SIEGE_GERER_LIST']] 'ROLE_ADMIN_OPERATION_SIEGE_GERER_LIST',
'ROLE_ADMIN_ADHERENT_COTISATIONS_ALL',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_ALL',
'ROLE_ADMIN_ALL_COTISATIONS_ALL',
'ROLE_ADMIN_HELLOASSO_ALL',
'ROLE_ADMIN_DONS_ALL']]
usergroup_redacteur: usergroup_redacteur:
__construct: ['Rédacteur', [ __construct: ['Rédacteur', [
'ROLE_REDACTEUR', 'ROLE_REDACTEUR',
...@@ -71,16 +78,20 @@ App\Entity\Usergroup: ...@@ -71,16 +78,20 @@ App\Entity\Usergroup:
usergroup_tresorier: usergroup_tresorier:
__construct: ['Trésorier', [ __construct: ['Trésorier', [
'ROLE_TRESORIER', 'ROLE_TRESORIER',
'ROLE_ADMIN_COMPTOIR_GERER_LIST',
'ROLE_ADMIN_COMPTOIR_GERER_VIEW',
'ROLE_ADMIN_ALL_COTISATIONS_ALL', 'ROLE_ADMIN_ALL_COTISATIONS_ALL',
'ROLE_ADMIN_ALL_ACHATSMONNAIE_ALL', 'ROLE_ADMIN_ALL_ACHATSMONNAIE_ALL',
'ROLE_ADMIN_RECONVERSION_GERER_ALL', 'ROLE_ADMIN_RECONVERSION_GERER_ALL',
'ROLE_ADMIN_TRANSFERT_GERER_ALL', 'ROLE_ADMIN_TRANSFERT_GERER_ALL',
'ROLE_ADMIN_ALL_DEMANDE_ACHATSMONNAIE_ALL', 'ROLE_ADMIN_ALL_DEMANDE_ACHATSMONNAIE_ALL',
'ROLE_ADMIN_OPERATION_PRESTATAIRE_GERER_LIST', 'ROLE_ADMIN_OPERATION_PRESTATAIRE_GERER_ALL',
'ROLE_ADMIN_OPERATION_ADHERENT_GERER_LIST', 'ROLE_ADMIN_OPERATION_ADHERENT_GERER_ALL',
'ROLE_ADMIN_OPERATION_COMPTOIR_GERER_LIST', 'ROLE_ADMIN_OPERATION_COMPTOIR_GERER_ALL',
'ROLE_ADMIN_OPERATION_GROUPE_GERER_LIST', 'ROLE_ADMIN_OPERATION_GROUPE_GERER_ALL',
'ROLE_ADMIN_OPERATION_SIEGE_GERER_LIST']] 'ROLE_ADMIN_OPERATION_SIEGE_GERER_ALL',
'ROLE_ADMIN_HELLOASSO_ALL',
'ROLE_ADMIN_DONS_ALL']]
usergroup_gestiongroupe: usergroup_gestiongroupe:
__construct: ['Gestionnaire de Groupe', [ __construct: ['Gestionnaire de Groupe', [
'ROLE_GESTION_GROUPE', 'ROLE_GESTION_GROUPE',
...@@ -113,7 +124,14 @@ App\Entity\Usergroup: ...@@ -113,7 +124,14 @@ App\Entity\Usergroup:
'ROLE_ADMIN_COMPTOIR_GERER_VIEW', 'ROLE_ADMIN_COMPTOIR_GERER_VIEW',
'ROLE_ADMIN_TRANSFERT_GERER_LIST', 'ROLE_ADMIN_TRANSFERT_GERER_LIST',
'ROLE_ADMIN_TRANSFERT_GERER_CREATE', 'ROLE_ADMIN_TRANSFERT_GERER_CREATE',
'ROLE_ADMIN_TRANSFERT_GERER_VIEW']] 'ROLE_ADMIN_TRANSFERT_GERER_VIEW',
'ROLE_ADMIN_PRESTATAIRE_GERER_VIEW',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_VIEW',
'ROLE_ADMIN_PRESTATAIRE_GERER_LIST',
'ROLE_ADMIN_PRESTATAIRE_GERER_EDIT',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_EDIT',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_LIST',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_CREATE']]
usergroup_contact: usergroup_contact:
__construct: ['Contact', [ __construct: ['Contact', [
'ROLE_CONTACT', 'ROLE_CONTACT',
......
...@@ -48,7 +48,12 @@ App\Entity\Usergroup: ...@@ -48,7 +48,12 @@ App\Entity\Usergroup:
'ROLE_ADMIN_OPERATION_ADHERENT_GERER_LIST', 'ROLE_ADMIN_OPERATION_ADHERENT_GERER_LIST',
'ROLE_ADMIN_OPERATION_COMPTOIR_GERER_LIST', 'ROLE_ADMIN_OPERATION_COMPTOIR_GERER_LIST',
'ROLE_ADMIN_OPERATION_GROUPE_GERER_LIST', 'ROLE_ADMIN_OPERATION_GROUPE_GERER_LIST',
'ROLE_ADMIN_OPERATION_SIEGE_GERER_LIST']] 'ROLE_ADMIN_OPERATION_SIEGE_GERER_LIST',
'ROLE_ADMIN_ADHERENT_COTISATIONS_ALL',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_ALL',
'ROLE_ADMIN_ALL_COTISATIONS_ALL',
'ROLE_ADMIN_HELLOASSO_ALL',
'ROLE_ADMIN_DONS_ALL']]
usergroup_redacteur: usergroup_redacteur:
__construct: ['Rédacteur', [ __construct: ['Rédacteur', [
'ROLE_REDACTEUR', 'ROLE_REDACTEUR',
...@@ -80,11 +85,13 @@ App\Entity\Usergroup: ...@@ -80,11 +85,13 @@ App\Entity\Usergroup:
'ROLE_ADMIN_RECONVERSION_GERER_ALL', 'ROLE_ADMIN_RECONVERSION_GERER_ALL',
'ROLE_ADMIN_TRANSFERT_GERER_ALL', 'ROLE_ADMIN_TRANSFERT_GERER_ALL',
'ROLE_ADMIN_ALL_DEMANDE_ACHATSMONNAIE_ALL', 'ROLE_ADMIN_ALL_DEMANDE_ACHATSMONNAIE_ALL',
'ROLE_ADMIN_OPERATION_PRESTATAIRE_GERER_LIST', 'ROLE_ADMIN_OPERATION_PRESTATAIRE_GERER_ALL',
'ROLE_ADMIN_OPERATION_ADHERENT_GERER_LIST', 'ROLE_ADMIN_OPERATION_ADHERENT_GERER_ALL',
'ROLE_ADMIN_OPERATION_COMPTOIR_GERER_LIST', 'ROLE_ADMIN_OPERATION_COMPTOIR_GERER_ALL',
'ROLE_ADMIN_OPERATION_GROUPE_GERER_LIST', 'ROLE_ADMIN_OPERATION_GROUPE_GERER_ALL',
'ROLE_ADMIN_OPERATION_SIEGE_GERER_LIST']] 'ROLE_ADMIN_OPERATION_SIEGE_GERER_ALL',
'ROLE_ADMIN_HELLOASSO_ALL',
'ROLE_ADMIN_DONS_ALL']]
usergroup_gestiongroupe: usergroup_gestiongroupe:
__construct: ['Gestionnaire de Groupe', [ __construct: ['Gestionnaire de Groupe', [
'ROLE_GESTION_GROUPE', 'ROLE_GESTION_GROUPE',
...@@ -117,7 +124,14 @@ App\Entity\Usergroup: ...@@ -117,7 +124,14 @@ App\Entity\Usergroup:
'ROLE_ADMIN_COMPTOIR_GERER_VIEW', 'ROLE_ADMIN_COMPTOIR_GERER_VIEW',
'ROLE_ADMIN_TRANSFERT_GERER_LIST', 'ROLE_ADMIN_TRANSFERT_GERER_LIST',
'ROLE_ADMIN_TRANSFERT_GERER_CREATE', 'ROLE_ADMIN_TRANSFERT_GERER_CREATE',
'ROLE_ADMIN_TRANSFERT_GERER_VIEW']] 'ROLE_ADMIN_TRANSFERT_GERER_VIEW',
'ROLE_ADMIN_PRESTATAIRE_GERER_VIEW',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_VIEW',
'ROLE_ADMIN_PRESTATAIRE_GERER_LIST',
'ROLE_ADMIN_PRESTATAIRE_GERER_EDIT',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_EDIT',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_LIST',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_CREATE']]
usergroup_contact: usergroup_contact:
__construct: ['Contact', [ __construct: ['Contact', [
'ROLE_CONTACT', 'ROLE_CONTACT',
...@@ -620,7 +634,7 @@ App\Entity\GlobalParameter: ...@@ -620,7 +634,7 @@ App\Entity\GlobalParameter:
description: "URL complète d'accès au Kohinos" description: "URL complète d'accès au Kohinos"
value: 'https://kohinos.xxx.fr' value: 'https://kohinos.xxx.fr'
mandatory: 1 mandatory: 1
gp11: gp1:
name: "COTISATION_ADHERENT" name: "COTISATION_ADHERENT"
description: 'Montant minimum de la cotisation des adhérents' description: 'Montant minimum de la cotisation des adhérents'
value: '10' value: '10'
...@@ -630,66 +644,147 @@ App\Entity\GlobalParameter: ...@@ -630,66 +644,147 @@ App\Entity\GlobalParameter:
description: 'Montant affiché par défaut de la cotisation des adhérents' description: 'Montant affiché par défaut de la cotisation des adhérents'
value: '10' value: '10'
mandatory: 1 mandatory: 1
gp12: gp2:
name: "COTISATION_PRESTATAIRE" name: "COTISATION_PRESTATAIRE"
description: 'Montant minimum de la cotisation des prestataires' description: 'Montant minimum de la cotisation des prestataires'
value: '10' value: '10'
mandatory: 1 mandatory: 1
gp1: gp3:
name: "RECONVERSION_PRESTATAIRE" name: "RECONVERSION_PRESTATAIRE"
description: 'Taux de reconversion des prestataires' description: 'Taux de reconversion des prestataires'
value: '0' value: '0'
mandatory: 1 mandatory: 1
gp2: gp4:
name: "USE_WORDPRESS" name: "USE_WORDPRESS"
description : "'true' : utiliser le module Wordpress et désactiver les fonctions du site kohinos, 'false' : utiliser le site Kohinos" description : "'true' : utiliser le module Wordpress et désactiver les fonctions du site kohinos, 'false' : utiliser le site Kohinos"
value: "false" value: "false"
mandatory: 1 mandatory: 1
gp3: gp5:
name: "MLC_NAME" name: "MLC_NAME"
description: 'Nom (long) de la MLC' description: 'Nom (long) de la MLC'
value: 'Monnaie locale complémentaire (Nom de la monnaie version longue)' value: 'Monnaie locale complémentaire (Nom de la monnaie version longue)'
mandatory: 1 mandatory: 1
gp4: gp6:
name: "MLC_NAME_SMALL" name: "MLC_NAME_SMALL"
description: 'Nom court ou abbréviation de la MLC' description: 'Nom court ou abbréviation de la MLC'
value: 'MLC (Nom de la Monnaie Locale court ou abbréviation utilisé pour les unités de compte par exemple)' value: 'MLC (Nom de la Monnaie Locale court ou abbréviation utilisé pour les unités de compte par exemple)'
mandatory: 1 mandatory: 1
gp5: gp7:
name: "MLC_NOTIF_EMAIL" name: "MLC_NOTIF_EMAIL"
description: "Email d'envoi des notification" description: "Email d'envoi des notification"
value: "emaildenvoidesnotifications@votredomaine.fr" value: "emaildenvoidesnotifications@votredomaine.fr"
mandatory: 1 mandatory: 1
gp6: gp8:
name: "MLC_CONTACT_EMAIL" name: "MLC_CONTACT_EMAIL"
description: "Email de reception du formulaire de contact" description: "Email de reception du formulaire de contact"
value: "emaildereceptiondesdemandesdecontact@votredomaine.fr" value: "emaildereceptiondesdemandesdecontact@votredomaine.fr"
mandatory: 1 mandatory: 1
gp7: gp9:
name: "MAP_CENTER" name: "MAP_CENTER"
description: '\Centre de la carte (Coordonnées GPS inscrites comme ceci : "[45.7,3.2]")' description: '\Centre de la carte (Coordonnées GPS inscrites comme ceci : "[45.7,3.2]")'
value: '\[45.7,3.2]' value: '\[45.7,3.2]'
mandatory: 1 mandatory: 1
gp8: gp10:
name: "MAP_ZOOM" name: "MAP_ZOOM"
description: 'Zoom de la carte (entre 8 et 12 en général)' description: 'Zoom de la carte (entre 8 et 12 en général)'
value: '9' value: '9'
mandatory: 1 mandatory: 1
gp14: gp11:
name: "USE_PAYZEN" name: "USE_PAYZEN"
description: "'true' : utiliser la module de paiement Payzen, 'false' : ne pas utiliser ce module" description: "'true' : utiliser la module de paiement Payzen, 'false' : ne pas utiliser ce module"
value: "1" value: "1"
mandatory: 1 mandatory: 1
gp15: gp12:
name: "USE_HELLOASSO"
description: "'true' : utiliser la module de paiement Helloasso, 'false' : ne pas utiliser ce module"
value: "1"
mandatory: 1
gp13:
name: "ALL_TICKETS" name: "ALL_TICKETS"
description: "Valeur des différents montants des billets de MLC (séparé par une virgule)" description: "Valeur des différents montants des billets de MLC (séparé par une virgule)"
value: '1,2,5,10,20,50' value: '1,2,5,10,20,50'
mandatory: 1 mandatory: 1
gp16: gp14:
name: "MLC_SYMBOL" name: "MLC_SYMBOL"
description: "Symbole / devise de la monnaie locale (3 caractères maximum)" description: "Symbole / devise de la monnaie locale (3 caractères maximum)"
value: 'mlc' value: 'mlc'
mandatory: 1 mandatory: 1
gp15:
name: "HELLOASSO_CLIENTID"
description: "HELLOASSO CLIENT ID"
value: 'HELLOASSO CLIENTID'
mandatory: 1
gp16:
name: "HELLOASSO_CLIENTSECRET"
description: "HELLOASSO CLIENT SECRET"
value: 'HELLOASSO CLIENTSECRET'
mandatory: 1
gp17:
name: "HELLOASSO_URL_EMLC_ADHERENT"
description: "HELLOASSO : Url de la campagne pour l'achat de monnaie numérique pour les adhérents"
value: 'https://www.helloasso.com/associations/xxx/paiements/xxx'
mandatory: 1
gp18:
name: "HELLOASSO_URL_EMLC_PRESTATAIRE"
description: "HELLOASSO : Url de la campagne pour l'achat de monnaie numérique pour les prestataires"
value: 'https://www.helloasso.com/associations/xxx/paiements/xxx'
mandatory: 1
gp19:
name: "HELLOASSO_URL_COTISATION_ADHERENT"
description: "HELLOASSO : Url de la campagne pour la cotisation d'un adhérent"
value: 'https://www.helloasso.com/associations/xxx/adhesions/xxx'
mandatory: 1
gp20:
name: "HELLOASSO_URL_COTISATION_PRESTATAIRE"
description: "HELLOASSO : Url de la campagne pour la cotisation d'un prestataire"
value: 'https://www.helloasso.com/associations/xxx/adhesions/xxx'
mandatory: 1
gp21:
name: "IBAN_ASSOCIATION"
description: "IBAN de gestion de l'Association"
value: 'FRXXXXXXXXXXXXXXXXXXXXXXXXX'
mandatory: 1
gp22:
name: "IBAN_GUARANTY"
description: "IBAN du fond de garantie"
value: 'FRXXXXXXXXXXXXXXXXXXXXXXXXX'
mandatory: 1
gp23:
name: "COTISATION_FREE_AMOUNT"
description: "Est-ce que la cotisation est un montant libre ?"
value: '0'
mandatory: 1
gp24:
name: "ACCEPT_DON_ADHERENT_COTISATION"
description: "Est-ce que les dons sont acceptés lors de la cotisation d'un adhérent ?"
value: 'true'
mandatory: 1
gp25:
name: "ACCEPT_DON_ADHERENT_ACHAT"
description: "Est-ce que les dons sont acceptés lors de l'achat de e-mlc d'un adhérent"
value: 'true'
mandatory: 1
gp26:
name: "ACCEPT_DON_PRESTATAIRE_COTISATION"
description: "Est-ce que les dons sont acceptés lors de la cotisation d'un prestataire ?"
value: 'true'
mandatory: 1
gp27:
name: "ACCEPT_DON_PRESTATAIRE_ACHAT"
description: "Est-ce que les dons sont acceptés lors de l'achat de e-mlc d'un prestataire"
value: 'true'
mandatory: 1
gp28:
name: "CHECK_ADDRESS"
description: "Paiement par chèque : Envoyer à cette adresse"
value: ''
mandatory: 1
gp29:
name: "CHECK_ORDER"
description: "Paiement par chèque : Ordre à mettre sur ceux-ci"
value: ''
mandatory: 1
App\Entity\Siege: App\Entity\Siege:
siege_1: siege_1:
......
{
"type": "project",
"homepage": "https://www.kohinos.com",
"name": "kohinos/kohinos",
"description": "Kohinos : Outil de gestion de monnaie locale complémentaire",
"license": "AGPL-3.0-or-later",
"authors": [
{
"name": "Julien Jorry",
"email": "julien.jorry@gmail.com",
"homepage": "https://www.malt.fr/profile/julienjorry"
}
],
"require": {
"php": "^7.4",
"ext-ctype": "*",
"ext-filter": "*",
"ext-iconv": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"api-platform/core": "^2.6",
"beberlei/doctrineextensions": "^1.3",
"cron/cron-bundle": "^2.4",
"doctrine/annotations": "1.*",
"doctrine/common": "^2.13",
"doctrine/doctrine-bundle": "^1.12",
"doctrine/doctrine-fixtures-bundle": "^3.4",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/migrations": "^3.1",
"doctrine/orm": "^2.7",
"ekyna/payum-payzen": "@dev",
"friendsofsymfony/user-bundle": "^2.1",
"gamez/ramsey-uuid-normalizer": "^2.1",
"geocoder-php/cache-provider": "^4.3",
"geocoder-php/google-maps-provider": "^4.6",
"geocoder-php/nominatim-provider": "^5.4",
"gregwar/captcha-bundle": "2.1.*",
"hautelook/alice-bundle": "^2.9",
"knplabs/knp-paginator-bundle": "2.*",
"knpuniversity/oauth2-client-bundle": "^2.8",
"lexik/translation-bundle": "~4.0",
"liip/imagine-bundle": "^2.5",
"michaeldegroot/doctrine-encrypt-bundle": "3.0.*",
"nelmio/api-doc-bundle": "^3.3",
"nelmio/cors-bundle": "^2.2",
"nyholm/psr7": "^1.4",
"payum/offline": "^1.6",
"payum/payum-bundle": "^2.4",
"php-http/guzzle6-adapter": "^2.0",
"php-http/message": "^1.7",
"phpdocumentor/reflection-docblock": "^5.3",
"phpstan/phpdoc-parser": "^1.4",
"pixassociates/sortable-behavior-bundle": "^1.5",
"prodigious/sonata-menu-bundle": "^3.0",
"ramsey/uuid-doctrine": "^1.6",
"sensio/framework-extra-bundle": "^5.1",
"shivas/versioning-bundle": "^3.2",
"sonata-project/admin-bundle": "3.*",
"sonata-project/block-bundle": "3.*",
"sonata-project/classification-bundle": "3.*",
"sonata-project/doctrine-extensions": "1.*",
"sonata-project/doctrine-orm-admin-bundle": "3.*",
"sonata-project/easy-extends-bundle": "2.*",
"sonata-project/form-extensions": "1.*",
"sonata-project/formatter-bundle": "4.*",
"sonata-project/intl-bundle": "2.*",
"sonata-project/media-bundle": "3.*",
"sonata-project/translation-bundle": "2.*",
"sonata-project/twig-extensions": "1.*",
"sonata-project/user-bundle": "4.*",
"specshaper/gdpr-bundle": "2.*",
"stof/doctrine-extensions-bundle": "1.*",
"symfony/apache-pack": "^1.0",
"symfony/asset": "4.4.*",
"symfony/cache": "4.4.*",
"symfony/console": "4.4.*",
"symfony/dotenv": "4.4.*",
"symfony/expression-language": "4.4.*",
"symfony/flex": "^1.2",
"symfony/form": "4.4.*",
"symfony/framework-bundle": "4.4.*",
"symfony/http-client": "4.4.*",
"symfony/monolog-bundle": "3.*",
"symfony/process": "4.4.*",
"symfony/property-access": "4.4.*",
"symfony/property-info": "4.4.*",
"symfony/proxy-manager-bridge": "4.4.*",
"symfony/security-bundle": "4.4.*",
"symfony/serializer": "4.4.*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.4.*",
"symfony/twig-bundle": "4.4.*",
"symfony/validator": "4.4.*",
"symfony/web-link": "4.4.*",
"symfony/webpack-encore-bundle": "^1.11",
"symfony/yaml": "4.4.*",
"twig/extensions": "^1.5",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0",
"vich/uploader-bundle": "^1.8",
"willdurand/geocoder-bundle": "^5.0"
},
"require-dev": {
"deployer/recipes": "^6.2",
"friendsofphp/php-cs-fixer": "^2.16",
"friendsoftwig/twigcs": "5.*",
"maglnet/composer-require-checker": "^2.0",
"phpmd/phpmd": "^2.9",
"phpro/grumphp": "^0.22.0",
"phpunit/phpunit": "^9.3",
"squizlabs/php_codesniffer": "^3.5",
"symfony/browser-kit": "4.4.*",
"symfony/css-selector": "4.4.*",
"symfony/debug-bundle": "4.4.*",
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "^5.1",
"symfony/stopwatch": "4.4.*",
"symfony/var-dumper": "4.4.*",
"symfony/web-profiler-bundle": "4.4.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true,
"allow-plugins": {
"phpro/grumphp": true,
"symfony/flex": true
}
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"egeloen/ckeditor-bundle": "*",
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": true,
"require": "4.4.*"
}
},
"repositories": [
{
"type": "path",
"url": "./lib/ekyna/payum-payzen"
}
]
}
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.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"app": { "app": {
"js": [ "js": [
"/build/runtime.6ad5c9da.js", "/build/runtime.6ad5c9da.js",
"/build/app.81717810.js" "/build/app.6263aa91.js"
], ],
"css": [ "css": [
"/build/app.1fb37df4.css" "/build/app.1fb37df4.css"
......
{ {
"build/app.css": "/build/app.1fb37df4.css", "build/app.css": "/build/app.1fb37df4.css",
"build/app.js": "/build/app.81717810.js", "build/app.js": "/build/app.6263aa91.js",
"build/admin.css": "/build/admin.5dc0eea7.css", "build/admin.css": "/build/admin.5dc0eea7.css",
"build/admin.js": "/build/admin.8a6adf4b.js", "build/admin.js": "/build/admin.8a6adf4b.js",
"build/runtime.js": "/build/runtime.6ad5c9da.js", "build/runtime.js": "/build/runtime.6ad5c9da.js",
......
const CACHE_VERSION = 2.4;
const BASE_CACHE_FILES = [
'/images/logo.png'
];
// const OFFLINE_CACHE_FILES = [
// '/index.php'
// ];
const NOT_FOUND_CACHE_FILES = [
'/404.html',
];
const OFFLINE_PAGE = '/offline.html';
const NOT_FOUND_PAGE = '/404.html';
const CACHE_VERSIONS = {
assets: 'assets-v' + CACHE_VERSION,
content: 'content-v' + CACHE_VERSION,
offline: 'offline-v' + CACHE_VERSION,
notFound: '404-v' + CACHE_VERSION,
};
const MAX_TTL = {
'/': 3600,
html: 3600,
json: 86400
};
// const CACHE_BLACKLIST = [
// '/gate.php',
// ];
const SUPPORTED_METHODS = [
'GET',
];
function isBlacklisted(url) {
// return (CACHE_BLACKLIST.length > 0) ? !CACHE_BLACKLIST.filter((rule) => {
// if (typeof rule === 'function') {
// return !rule(url);
// } else {
return false;
// }
// }).length : false
}
function getFileExtension(url) {
let extension = url.split('.').reverse()[0].split('?')[0];
return (extension.endsWith('/')) ? '/' : extension;
}
function getTTL(url) {
if (typeof url === 'string') {
let extension = getFileExtension(url);
if (typeof MAX_TTL[extension] === 'number') {
return MAX_TTL[extension];
} else {
return null;
}
} else {
return null;
}
}
function installServiceWorker() {
return Promise.all(
[
caches.open(CACHE_VERSIONS.assets)
.then(
(cache) => {
return cache.addAll(BASE_CACHE_FILES);
}
),
// caches.open(CACHE_VERSIONS.offline)
// .then(
// (cache) => {
// return cache.addAll(OFFLINE_CACHE_FILES);
// }
// ),
caches.open(CACHE_VERSIONS.notFound)
.then(
(cache) => {
return cache.addAll(NOT_FOUND_CACHE_FILES);
}
)
]
);
}
function cleanupLegacyCache() {
let currentCaches = Object.keys(CACHE_VERSIONS)
.map(
(key) => {
return CACHE_VERSIONS[key];
}
);
return new Promise(
(resolve, reject) => {
caches.keys()
.then(
(keys) => {
return legacyKeys = keys.filter(
(key) => {
return !~currentCaches.indexOf(key);
}
);
}
)
.then(
(legacy) => {
if (legacy.length) {
Promise.all(
legacy.map(
(legacyKey) => {
return caches.delete(legacyKey)
}
)
)
.then(
() => {
resolve()
}
)
.catch(
(err) => {
reject(err);
}
);
} else {
resolve();
}
}
)
.catch(
() => {
reject();
}
);
}
);
}
self.addEventListener(
'install', event => {
event.waitUntil(installServiceWorker());
}
);
self.addEventListener(
'activate', event => {
event.waitUntil(
Promise.all(
[
cleanupLegacyCache(),
]
)
.catch(
(err) => {
event.skipWaiting();
}
)
);
}
);
self.addEventListener(
'fetch', event => {
event.respondWith(
caches.open(CACHE_VERSIONS.content)
.then(
(cache) => {
return cache.match(event.request)
.then(
(response) => {
if (response) {
let headers = response.headers.entries();
let date = null;
for (let pair of headers) {
if (pair[0] === 'date') {
date = new Date(pair[1]);
}
}
if (date) {
let age = parseInt((new Date().getTime() - date.getTime()) / 1000);
let ttl = getTTL(event.request.url);
if (ttl && age > ttl) {
return new Promise(
(resolve) => {
return fetch(event.request)
.then(
(updatedResponse) => {
if (updatedResponse) {
cache.put(event.request, updatedResponse.clone());
resolve(updatedResponse);
} else {
resolve(response)
}
}
)
.catch(
() => {
resolve(response);
}
);
}
)
.catch(
(err) => {
return response;
}
);
} else {
return response;
}
} else {
return response;
}
} else {
return null;
}
}
)
.then(
(response) => {
if (response) {
return response;
} else {
return fetch(event.request)
.then(
(response) => {
if (response.status < 400) {
if (~SUPPORTED_METHODS.indexOf(event.request.method) && !isBlacklisted(event.request.url)) {
cache.put(event.request, response.clone());
}
return response;
} else {
return caches.open(CACHE_VERSIONS.notFound).then((cache) => {
return cache.match(NOT_FOUND_PAGE);
})
}
}
)
.then((response) => {
if (response) {
return response;
}
})
.catch(
() => {
return caches.open(CACHE_VERSIONS.offline)
.then(
(offlineCache) => {
return offlineCache.match(OFFLINE_PAGE)
}
)
}
);
}
}
)
.catch(
(error) => {
console.error('Error in fetch handler:', error);
throw error;
}
);
}
)
);
}
);
...@@ -261,6 +261,7 @@ class CotisationAdmin extends AbstractAdmin ...@@ -261,6 +261,7 @@ class CotisationAdmin extends AbstractAdmin
$em->getConnection()->rollBack(); $em->getConnection()->rollBack();
$this->getConfigurationPool()->getContainer()->get('session')->getFlashBag()->add('error', $e->getMessage()); $this->getConfigurationPool()->getContainer()->get('session')->getFlashBag()->add('error', $e->getMessage());
return null; return null;
} }
} }
......
...@@ -7,8 +7,8 @@ use FOS\CKEditorBundle\Form\Type\CKEditorType; ...@@ -7,8 +7,8 @@ use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\FormMapper;
use Sonata\MediaBundle\Form\Type\MediaType;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
...@@ -76,7 +76,7 @@ class DocumentAdmin extends AbstractAdmin ...@@ -76,7 +76,7 @@ class DocumentAdmin extends AbstractAdmin
->add('_action', null, [ ->add('_action', null, [
'actions' => [ 'actions' => [
'show' => [], 'show' => [],
'edit' => [] 'edit' => [],
], ],
]) ])
; ;
......
<?php
namespace App\Admin;
use App\Entity\Flux;
use App\Entity\Groupe;
use App\Entity\Prestataire;
use App\Entity\User;
use App\Enum\MoyenEnum;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\Regex;
/**
* Administration des dons.
*
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
*
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class DonAdmin extends AbstractAdmin
{
protected $baseRouteName = 'don';
protected $baseRoutePattern = 'don';
protected $security;
protected $translator;
protected $datagridValues = [
'_sort_order' => 'DESC',
'_sort_by' => 'createdAt',
'_per_page' => 250,
];
protected $maxPerPage = 250;
protected $perPageOptions = [50, 100, 250, 500, 1000];
public function setSecurity(Security $security)
{
$this->security = $security;
}
/**
* {@inheritdoc}
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper): void
{
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$datagridMapper
->add('montant', null, ['label' => 'Montant'])
->add('groupe', 'doctrine_orm_callback', [
'label' => 'Groupe local',
'callback' => function ($queryBuilder, $alias, $field, $value) {
if (!$value['value']) {
return;
}
$queryBuilder
->leftJoin('App\Entity\DonPrestataire', 'c', 'WITH', $alias . '.id = c.id')
->leftJoin('App\Entity\DonAdherent', 'ca', 'WITH', $alias . '.id = ca.id')
->leftJoin('c.expediteur', 'e')
->leftJoin('ca.expediteur', 'f')
->andWhere('e.groupe = :groupe OR f.groupe = :groupe')
->setParameter('groupe', $value['value']);
return true;
},
'advanced_filter' => false,
'show_filter' => true,
'field_type' => ChoiceType::class,
'field_options' => [
'choices' => $em->getRepository(Groupe::class)->findBy(['enabled' => true], ['name' => 'ASC']),
'choice_label' => 'name',
'placeholder' => 'Indifférent',
'expanded' => false,
'multiple' => false,
],
])
;
}
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$cotisation = $this->getSubject();
$now = new \DateTime();
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$formMapper
->with('Don', ['class' => 'col-md-8'])
->add('parenttype', HiddenType::class, [
'data' => Flux::TYPE_DON,
])
->add('operateur', HiddenType::class, [
'data' => $this->security->getUser(),
'data_class' => null,
'entity_class' => User::class,
'em' => $em,
])
->add('montant', MoneyType::class, [
'label' => 'Montant en euro(s)',
'scale' => 2,
'required' => true,
'constraints' => [
new Regex(['pattern' => '/[0-9]{1,}(\.[0-9]{1,2})?/']),
],
'empty_data' => (float) 0.0,
])
->add('role', HiddenType::class, [
'data' => $this->security->getUser() ? $this->security->getUser()->getGroups()[0]->__toString() : '',
])
->add('destinataire', HiddenType::class, [
'data' => $em->getRepository(Prestataire::class)->findOneBy(['mlc' => true]),
'data_class' => null,
'entity_class' => Prestataire::class,
'em' => $em,
])
->add('moyen', ChoiceType::class, [
'required' => true,
'choices' => MoyenEnum::getAvailableTypes(),
'choice_label' => function ($choice) {
return MoyenEnum::getTypeName($choice);
},
])
;
}
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('delete');
if (null != $this->security->getUser() && !($this->security->isGranted('ROLE_TRESORIER') || $this->security->isGranted('ROLE_SUPER_ADMIN') || $this->security->isGranted('ROLE_COMPTOIR'))) {
$collection->clearExcept(['list', 'export']);
}
}
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
{
unset($this->listModes['mosaic']);
$listMapper
->add('id', 'text', [
'label' => 'Expéditeur',
'template' => '@kohinos/bundles/SonataAdminBundle/Block/don_obj.html.twig',
])
->add('expediteur.groupe.name', null, [
'label' => 'Groupe',
])
->add('montant', 'decimal', [
'label' => 'Montant',
'attributes' => ['fraction_digits' => 2],
])
->add('moyen', null, [
'label' => 'Moyen',
])
->add('operateurAndRole', null, [
'label' => 'Opérateur',
])
->add('where', 'string', [
'label' => 'Achat / Cotisation',
'template' => '@kohinos/bundles/SonataAdminBundle/Block/don_type.html.twig',
])
// ->add('_action', null, [
// 'actions' => [
// // 'edit' => [],
// ],
// ])
;
}
public function getDataSourceIterator()
{
$iterator = parent::getDataSourceIterator();
$iterator->setDateTimeFormat('d/m/Y H:i:s'); //change this to suit your needs
return $iterator;
}
public function getExportFields()
{
return [
'Id' => 'expediteur',
'Groupe' => 'expediteur.groupe.name',
'Type' => 'type',
'Montant' => 'montant',
'Moyen' => 'moyen',
'Operateur' => 'operateurAndRole',
'Reference' => 'reference',
'Date' => 'created_at',
];
}
}
...@@ -45,9 +45,6 @@ class EtatprestataireAdmin extends AbstractAdmin ...@@ -45,9 +45,6 @@ class EtatprestataireAdmin extends AbstractAdmin
*/ */
protected function configureFormFields(FormMapper $formMapper) protected function configureFormFields(FormMapper $formMapper)
{ {
$user = $this->security->getUser();
$groupepresta = $this->getSubject();
$formMapper $formMapper
->with('Informations', ['class' => 'col-md-7']) ->with('Informations', ['class' => 'col-md-7'])
->add('name', TextType::class, [ ->add('name', TextType::class, [
......
<?php <?php
namespace App\Admin; namespace App\Admin;
use Sonata\AdminBundle\Object\Metadata;
use Sonata\MediaBundle\Admin\GalleryAdmin as BaseGalleryAdmin; use Sonata\MediaBundle\Admin\GalleryAdmin as BaseGalleryAdmin;
use Sonata\MediaBundle\Provider\MediaProviderInterface;
/** /**
* Administration des galleries de medias (image, document...) * Administration des galleries de medias (image, document...).
* *
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire * KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
*
* @author Julien Jorry <julien.jorry@gmail.com> * @author Julien Jorry <julien.jorry@gmail.com>
*/ */
class GalleryAdmin extends BaseGalleryAdmin class GalleryAdmin extends BaseGalleryAdmin
......
...@@ -5,7 +5,6 @@ namespace App\Admin; ...@@ -5,7 +5,6 @@ namespace App\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
...@@ -54,7 +53,7 @@ class GlobalParameterAdmin extends AbstractAdmin ...@@ -54,7 +53,7 @@ class GlobalParameterAdmin extends AbstractAdmin
{ {
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->add('name', null, array('label' => 'Nom')) ->add('name', null, ['label' => 'Nom'])
->add('description', null, ['label' => 'Description']) ->add('description', null, ['label' => 'Description'])
->add('value', null, ['editable' => true, 'truncate' => ['length' => 80], 'label' => 'Value']) ->add('value', null, ['editable' => true, 'truncate' => ['length' => 80], 'label' => 'Value'])
->add('_action', null, [ ->add('_action', null, [
......
...@@ -205,7 +205,7 @@ class GroupeAdmin extends AbstractAdmin ...@@ -205,7 +205,7 @@ class GroupeAdmin extends AbstractAdmin
] ]
) )
->add('enabled', null, [ ->add('enabled', null, [
'label' => 'Activé' 'label' => 'Activé',
]) ])
->add('_action', null, [ ->add('_action', null, [
'actions' => $actions, 'actions' => $actions,
......
<?php
namespace App\Admin;
use App\Enum\HelloassoStateEnum;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\Form\Type\DateTimeRangePickerType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
/**
* Gestion des paiements / cotisations HelloAsso.
*
* @author Julien Jorry <julien.jorry@gmail.com>
*/
class HelloAssoAdmin extends AbstractAdmin
{
protected $baseRoutePattern = 'helloasso';
protected $baseRouteName = 'helloasso';
protected $datagridValues = [
// reverse order (default = 'ASC')
'_sort_order' => 'DESC',
// name of the ordered field (default = the model's id field, if any)
'_sort_by' => 'createdAt',
// '_page' => 1,
// '_per_page' => 32
];
/**
* {@inheritdoc}
*/
protected function configureRoutes(RouteCollection $collection)
{
$collection->clearExcept(['list', 'show']);
$collection->add('synchro');
$collection->add('synchrotest');
}
public function configureActionButtons($action, $object = null)
{
$buttonList = parent::configureActionButtons($action, $object);
$buttonList['synchro'] = ['template' => '@kohinos/admin/helloasso_synchro_button.html.twig'];
$buttonList['synchrotest'] = ['template' => '@kohinos/admin/helloasso_synchro_test_button.html.twig'];
return $buttonList;
}
protected function configureListFields(ListMapper $listMapper): void
{
parent::configureListFields($listMapper);
unset($this->listModes['mosaic']);
$listMapper
->add('createdAt', 'datetime', [
'label' => 'Date',
])
->add('helloassoid')
->add('type')
->add('amount', null, [
'label' => 'Montant',
])
// ->add('data')
->add('fulluser', null, [
'label' => 'Utilisateur',
])
->add('fullpayer', null, [
'label' => 'Payeur',
])
->add(
'prestaoradh',
null,
[
'label' => 'Presta ou Adhérent',
'template' => '@kohinos/bundles/SonataAdminBundle/CRUD/list_presta_or_adherent.html.twig',
]
)
->add('state', null, [
'label' => 'Etat',
])
->add('statePayment', null, [
'label' => 'Etat du paiement',
])
->add('operationState', null, [
'label' => 'Etat de l\'opération',
])
->add('errors', null, [
'label' => 'Erreurs',
])
->add('flux')
->add('historical', null, [
'label' => 'Historique ?',
])
;
}
/**
* {@inheritdoc}
*/
protected function configureDatagridFilters(DatagridMapper $datagridMapper): void
{
$datagridMapper
->add('createdAt', 'doctrine_orm_datetime_range', [
'field_type' => DateTimeRangePickerType::class,
'label' => 'Date de création',
])
->add('state', 'doctrine_orm_string', [
'advanced_filter' => false,
'show_filter' => true,
'label' => 'Etat',
], ChoiceType::class, [
'choices' => [
'Waiting' => 'Waiting',
'Processed' => 'Processed',
'Registered' => 'Registered',
'Deleted' => 'Deleted',
'Refunded' => 'Refunded',
'Unknown' => 'Unknown',
'Canceled' => 'Canceled',
'Contested' => 'Contested',
],
])
->add('statePayment', 'doctrine_orm_string', [
'advanced_filter' => false,
'show_filter' => true,
'label' => 'Etat du paiement',
], ChoiceType::class, [
'choices' => [
'Pending' => 'Pending',
'Authorized' => 'Authorized',
'Refused' => 'Refused',
'Unknown' => 'Unknown',
'Registered' => 'Registered',
'Error' => 'Error',
'Refunded' => 'Refunded',
'Refunding' => 'Refunding',
'Waiting' => 'Waiting',
'Canceled' => 'Canceled',
'Contested' => 'Contested',
'WaitingBankValidation' => 'WaitingBankValidation',
'WaitingBankWithdraw' => 'WaitingBankWithdraw',
],
])
->add('operationState', null, [
'advanced_filter' => false,
'show_filter' => true,
'label' => 'Etat de l\'opération',
], ChoiceType::class, [
'choices' => HelloassoStateEnum::getAvailableTypes(),
'choice_label' => function ($choice) {
return HelloassoStateEnum::getTypeName($choice);
},
])
->add('prestataire', null, [
'label' => 'Prestataire',
'advanced_filter' => false,
])
->add('adherent', null, [
'label' => 'Adhérent',
'advanced_filter' => false,
])
->add('historical', null, [
'label' => 'Historique',
'advanced_filter' => false,
])
;
}
public function getBatchActions()
{
$actions = parent::getBatchActions();
unset($actions['delete']);
return $actions;
}
}
<?php <?php
namespace App\Admin; namespace App\Admin;
use Sonata\MediaBundle\Model\MediaInterface; use Sonata\MediaBundle\Model\MediaInterface;
use Sonata\MediaBundle\Provider\FileProvider; use Sonata\MediaBundle\Provider\FileProvider;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\HttpFoundation\File\File;
/** /**
* Import provider * Import provider.
* *
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire * KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
*
* @author Julien Jorry <julien.jorry@gmail.com> * @author Julien Jorry <julien.jorry@gmail.com>
*/ */
class ImportProvider extends FileProvider class ImportProvider extends FileProvider
......
<?php <?php
namespace App\Admin; namespace App\Admin;
use Sonata\AdminBundle\Object\Metadata; use Sonata\AdminBundle\Object\Metadata;
...@@ -6,9 +7,10 @@ use Sonata\MediaBundle\Admin\ORM\MediaAdmin as BaseMediaAdmin; ...@@ -6,9 +7,10 @@ use Sonata\MediaBundle\Admin\ORM\MediaAdmin as BaseMediaAdmin;
use Sonata\MediaBundle\Provider\MediaProviderInterface; use Sonata\MediaBundle\Provider\MediaProviderInterface;
/** /**
* Administration des medias (image, document...) * Administration des medias (image, document...).
* *
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire * KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
*
* @author Julien Jorry <julien.jorry@gmail.com> * @author Julien Jorry <julien.jorry@gmail.com>
*/ */
class MediaAdmin extends BaseMediaAdmin class MediaAdmin extends BaseMediaAdmin
......
...@@ -8,8 +8,8 @@ use Sonata\AdminBundle\Admin\AbstractAdmin; ...@@ -8,8 +8,8 @@ use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridInterface; use Sonata\AdminBundle\Datagrid\DatagridInterface;
use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\FormMapper;
use Sonata\MediaBundle\Form\Type\MediaType;
use Sonata\AdminBundle\Route\RouteCollectionInterface; use Sonata\AdminBundle\Route\RouteCollectionInterface;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
...@@ -77,7 +77,7 @@ class NewsAdmin extends AbstractAdmin ...@@ -77,7 +77,7 @@ class NewsAdmin extends AbstractAdmin
protected function configureRoutes(RouteCollectionInterface $collection): void protected function configureRoutes(RouteCollectionInterface $collection): void
{ {
$collection->add('move', $this->getRouterIdParameter().'/move/{position}'); $collection->add('move', $this->getRouterIdParameter() . '/move/{position}');
} }
/** /**
...@@ -94,11 +94,10 @@ class NewsAdmin extends AbstractAdmin ...@@ -94,11 +94,10 @@ class NewsAdmin extends AbstractAdmin
->add('_action', null, [ ->add('_action', null, [
'actions' => [ 'actions' => [
'move' => [ 'move' => [
'template' => '@PixSortableBehavior/Default/_sort.html.twig' 'template' => '@PixSortableBehavior/Default/_sort.html.twig',
],
], ],
]
]); ]);
;
} }
public function getBatchActions() public function getBatchActions()
......
<?php <?php
namespace App\Admin; namespace App\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
/** /**
* Administration des traductions * Administration des traductions.
* *
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire * KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
*
* @author Julien Jorry <julien.jorry@gmail.com> * @author Julien Jorry <julien.jorry@gmail.com>
*/ */
class TraductionAdmin extends AbstractAdmin class TraductionAdmin extends AbstractAdmin
......
...@@ -2,21 +2,17 @@ ...@@ -2,21 +2,17 @@
namespace App\Admin; namespace App\Admin;
use App\Application\Sonata\UserBundle\Admin\UserAdmin as SonataUserAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;
use App\Application\Sonata\UserBundle\Admin\UserAdmin as SonataUserAdmin;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
/** /**
* Administration des utilisateurs * Administration des utilisateurs.
* *
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire * KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
*
* @author Julien Jorry <julien.jorry@gmail.com> * @author Julien Jorry <julien.jorry@gmail.com>
*/ */
class UserAdmin extends SonataUserAdmin class UserAdmin extends SonataUserAdmin
...@@ -71,6 +67,7 @@ class UserAdmin extends SonataUserAdmin ...@@ -71,6 +67,7 @@ class UserAdmin extends SonataUserAdmin
{ {
if ($this->isChild()) { if ($this->isChild()) {
$collection->remove('delete'); $collection->remove('delete');
return; return;
} }
...@@ -86,17 +83,17 @@ class UserAdmin extends SonataUserAdmin ...@@ -86,17 +83,17 @@ class UserAdmin extends SonataUserAdmin
parent::configureDatagridFilters($datagridMapper); parent::configureDatagridFilters($datagridMapper);
$datagridMapper $datagridMapper
->add('email', null, [ ->add('email', null, [
'label' => "Email", 'label' => 'Email',
'advanced_filter' => false 'advanced_filter' => false,
]) ])
->add('enabled', null, array( ->add('enabled', null, [
'label' => 'Activé ?', 'label' => 'Activé ?',
'advanced_filter' => false 'advanced_filter' => false,
)) ])
; ;
} }
/** /*
* {@inheritdoc} * {@inheritdoc}
*/ */
// protected function configureRoutes(RouteCollection $collection) // protected function configureRoutes(RouteCollection $collection)
......
...@@ -7,10 +7,10 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; ...@@ -7,10 +7,10 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://symfony.com/doc/current/book/bundles.html * @see http://symfony.com/doc/current/book/bundles.html
*/ */
class ApplicationSonataClassificationBundle extends Bundle class ApplicationSonataClassificationBundle extends Bundle
{ {
......
...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Document\BaseCategory as BaseCategory; ...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Document\BaseCategory as BaseCategory;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html * @see http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*/ */
class Category extends BaseCategory class Category extends BaseCategory
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Document\BaseTag as BaseTag; ...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Document\BaseTag as BaseTag;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html * @see http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*/ */
class Tag extends BaseTag class Tag extends BaseTag
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Entity\BaseCategory as BaseCategory; ...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Entity\BaseCategory as BaseCategory;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en * @see http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*/ */
class Category extends BaseCategory class Category extends BaseCategory
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Entity\BaseCollection as BaseCollection; ...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Entity\BaseCollection as BaseCollection;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en * @see http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*/ */
class Collection extends BaseCollection class Collection extends BaseCollection
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Entity\BaseContext as BaseContext; ...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Entity\BaseContext as BaseContext;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en * @see http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*/ */
class Context extends BaseContext class Context extends BaseContext
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Entity\BaseTag as BaseTag; ...@@ -7,15 +7,15 @@ use Sonata\ClassificationBundle\Entity\BaseTag as BaseTag;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en * @see http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*/ */
class Tag extends BaseTag class Tag extends BaseTag
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,10 +7,10 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; ...@@ -7,10 +7,10 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://symfony.com/doc/current/book/bundles.html * @see http://symfony.com/doc/current/book/bundles.html
*/ */
class ApplicationSonataMediaBundle extends Bundle class ApplicationSonataMediaBundle extends Bundle
{ {
......
...@@ -7,15 +7,15 @@ use Sonata\MediaBundle\Document\BaseGallery as BaseGallery; ...@@ -7,15 +7,15 @@ use Sonata\MediaBundle\Document\BaseGallery as BaseGallery;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html * @see http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*/ */
class Gallery extends BaseGallery class Gallery extends BaseGallery
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,15 +7,15 @@ use Sonata\MediaBundle\Document\BaseMedia as BaseMedia; ...@@ -7,15 +7,15 @@ use Sonata\MediaBundle\Document\BaseMedia as BaseMedia;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html * @see http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*/ */
class Media extends BaseMedia class Media extends BaseMedia
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -8,10 +8,10 @@ use Sonata\MediaBundle\Entity\BaseGallery as BaseGallery; ...@@ -8,10 +8,10 @@ use Sonata\MediaBundle\Entity\BaseGallery as BaseGallery;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en * @see http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
* *
* @ORM\Entity * @ORM\Entity
* @ORM\HasLifecycleCallbacks() * @ORM\HasLifecycleCallbacks()
......
...@@ -8,10 +8,10 @@ use Sonata\MediaBundle\Entity\BaseGalleryHasMedia as BaseGalleryHasMedia; ...@@ -8,10 +8,10 @@ use Sonata\MediaBundle\Entity\BaseGalleryHasMedia as BaseGalleryHasMedia;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en * @see http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
* *
* @ORM\Entity * @ORM\Entity
* @ORM\HasLifecycleCallbacks() * @ORM\HasLifecycleCallbacks()
......
...@@ -8,10 +8,10 @@ use Sonata\MediaBundle\Entity\BaseMedia as BaseMedia; ...@@ -8,10 +8,10 @@ use Sonata\MediaBundle\Entity\BaseMedia as BaseMedia;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en * @see http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
* *
* @ORM\Entity * @ORM\Entity
* @ORM\HasLifecycleCallbacks() * @ORM\HasLifecycleCallbacks()
......
...@@ -7,15 +7,15 @@ use Sonata\MediaBundle\PHPCR\BaseGallery as BaseGallery; ...@@ -7,15 +7,15 @@ use Sonata\MediaBundle\PHPCR\BaseGallery as BaseGallery;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html * @see http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html
*/ */
class Gallery extends BaseGallery class Gallery extends BaseGallery
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,15 +7,15 @@ use Sonata\MediaBundle\PHPCR\BaseGalleryHasMedia as BaseGalleryHasMedia; ...@@ -7,15 +7,15 @@ use Sonata\MediaBundle\PHPCR\BaseGalleryHasMedia as BaseGalleryHasMedia;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html * @see http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html
*/ */
class GalleryHasMedia extends BaseGalleryHasMedia class GalleryHasMedia extends BaseGalleryHasMedia
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,10 +7,10 @@ use Sonata\MediaBundle\PHPCR\BaseGalleryHasMediaRepository; ...@@ -7,10 +7,10 @@ use Sonata\MediaBundle\PHPCR\BaseGalleryHasMediaRepository;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References : * References :
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html * @see http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html
*/ */
class GalleryHasMediaRepository extends BaseGalleryHasMediaRepository class GalleryHasMediaRepository extends BaseGalleryHasMediaRepository
{ {
......
...@@ -7,10 +7,10 @@ use Sonata\MediaBundle\PHPCR\BaseGalleryRepository; ...@@ -7,10 +7,10 @@ use Sonata\MediaBundle\PHPCR\BaseGalleryRepository;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References : * References :
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html * @see http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html
*/ */
class GalleryRepository extends BaseGalleryRepository class GalleryRepository extends BaseGalleryRepository
{ {
......
...@@ -7,15 +7,15 @@ use Sonata\MediaBundle\PHPCR\BaseMedia as BaseMedia; ...@@ -7,15 +7,15 @@ use Sonata\MediaBundle\PHPCR\BaseMedia as BaseMedia;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html * @see http://docs.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/index.html
*/ */
class Media extends BaseMedia class Media extends BaseMedia
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,10 +7,10 @@ use Sonata\MediaBundle\PHPCR\BaseMediaRepository; ...@@ -7,10 +7,10 @@ use Sonata\MediaBundle\PHPCR\BaseMediaRepository;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References : * References :
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html * @see http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html
*/ */
class MediaRepository extends BaseMediaRepository class MediaRepository extends BaseMediaRepository
{ {
......
...@@ -101,12 +101,12 @@ class UserAdmin extends BaseUserAdmin ...@@ -101,12 +101,12 @@ class UserAdmin extends BaseUserAdmin
->add('email') ->add('email')
->add('groups') ->add('groups')
->add('createdAt', 'doctrine_orm_datetime_range', [ ->add('createdAt', 'doctrine_orm_datetime_range', [
'field_type'=> DateTimeRangePickerType::class, 'field_type' => DateTimeRangePickerType::class,
'label' => 'Date de création' 'label' => 'Date de création',
]) ])
->add('lastLogin', 'doctrine_orm_datetime_range', [ ->add('lastLogin', 'doctrine_orm_datetime_range', [
'field_type'=> DateTimeRangePickerType::class, 'field_type' => DateTimeRangePickerType::class,
'label' => 'Date de dernière connexion' 'label' => 'Date de dernière connexion',
]) ])
; ;
} }
...@@ -196,22 +196,22 @@ class UserAdmin extends BaseUserAdmin ...@@ -196,22 +196,22 @@ class UserAdmin extends BaseUserAdmin
; ;
if ('dev' == $_ENV['APP_ENV'] && $this->isGranted('ROLE_SUPER_ADMIN')) { if ('dev' == $_ENV['APP_ENV'] && $this->isGranted('ROLE_SUPER_ADMIN')) {
$formMapper $formMapper
->add('plainPassword', RepeatedType::class, array( ->add('plainPassword', RepeatedType::class, [
'type' => PasswordType::class, 'type' => PasswordType::class,
'options' => array('translation_domain' => 'FOSUserBundle'), 'options' => ['translation_domain' => 'FOSUserBundle'],
'first_options' => array('label' => 'form.password'), 'first_options' => ['label' => 'form.password'],
'second_options' => array('label' => 'form.password_confirmation'), 'second_options' => ['label' => 'form.password_confirmation'],
'translation_domain' => 'FOSUserBundle', 'translation_domain' => 'FOSUserBundle',
'invalid_message' => 'fos_user.password.mismatch', 'invalid_message' => 'fos_user.password.mismatch',
'required' => (!$this->getSubject() || null === $this->getSubject()->getId()), 'required' => (!$this->getSubject() || null === $this->getSubject()->getId()),
)) ])
; ;
} else { } else {
$formMapper $formMapper
->add('plainPassword', HiddenType::class, [ ->add('plainPassword', HiddenType::class, [
'data' => random_bytes(10), 'data' => random_bytes(10),
'required' => false, 'required' => false,
'validation_groups' => false 'validation_groups' => false,
]) ])
; ;
} }
...@@ -349,7 +349,6 @@ class UserAdmin extends BaseUserAdmin ...@@ -349,7 +349,6 @@ class UserAdmin extends BaseUserAdmin
$this->postPersist($user); $this->postPersist($user);
} }
public function prePersist($user) public function prePersist($user)
{ {
if ($user->isEnabled()) { if ($user->isEnabled()) {
......
...@@ -7,10 +7,10 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; ...@@ -7,10 +7,10 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://symfony.com/doc/current/book/bundles.html * @see http://symfony.com/doc/current/book/bundles.html
*/ */
class ApplicationSonataUserBundle extends Bundle class ApplicationSonataUserBundle extends Bundle
{ {
......
...@@ -7,15 +7,15 @@ use Sonata\UserBundle\Document\BaseGroup as BaseGroup; ...@@ -7,15 +7,15 @@ use Sonata\UserBundle\Document\BaseGroup as BaseGroup;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html * @see http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*/ */
class Group extends BaseGroup class Group extends BaseGroup
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,15 +7,15 @@ use Sonata\UserBundle\Document\BaseUser as BaseUser; ...@@ -7,15 +7,15 @@ use Sonata\UserBundle\Document\BaseUser as BaseUser;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html * @see http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/working-with-objects.html
*/ */
class User extends BaseUser class User extends BaseUser
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,15 +7,15 @@ use Sonata\UserBundle\Entity\BaseGroup as BaseGroup; ...@@ -7,15 +7,15 @@ use Sonata\UserBundle\Entity\BaseGroup as BaseGroup;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en * @see http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*/ */
class Group extends BaseGroup class Group extends BaseGroup
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -7,15 +7,15 @@ use Sonata\UserBundle\Entity\BaseUser as BaseUser; ...@@ -7,15 +7,15 @@ use Sonata\UserBundle\Entity\BaseUser as BaseUser;
/** /**
* This file has been generated by the SonataEasyExtendsBundle. * This file has been generated by the SonataEasyExtendsBundle.
* *
* @link https://sonata-project.org/easy-extends * @see https://sonata-project.org/easy-extends
* *
* References: * References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en * @see http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*/ */
class User extends BaseUser class User extends BaseUser
{ {
/** /**
* @var int $id * @var int
*/ */
protected $id; protected $id;
......
...@@ -4,11 +4,16 @@ namespace App\Controller; ...@@ -4,11 +4,16 @@ namespace App\Controller;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\Payment; use App\Entity\Payment;
use App\Entity\Usergroup;
use App\Form\Type\AdhererFormType; use App\Form\Type\AdhererFormType;
use App\Security\LoginAuthenticator;
use Doctrine\ORM\EntityManagerInterface;
use Gamez\Symfony\Component\Serializer\Normalizer\UuidNormalizer; use Gamez\Symfony\Component\Serializer\Normalizer\UuidNormalizer;
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\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
use Symfony\Component\Serializer\Encoder\JsonEncoder; use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
...@@ -16,6 +21,22 @@ use Symfony\Component\Serializer\Serializer; ...@@ -16,6 +21,22 @@ use Symfony\Component\Serializer\Serializer;
class AdhesionController extends AbstractController class AdhesionController extends AbstractController
{ {
private $em;
private $authenticator;
private $guardHandler;
public function __construct(
EntityManagerInterface $em,
RouterInterface $router,
LoginAuthenticator $authenticator,
GuardAuthenticatorHandler $guardHandler)
{
$this->em = $em;
$this->router = $router;
$this->authenticator = $authenticator;
$this->guardHandler = $guardHandler;
}
/** /**
* @Route("/adherer", name="adherer") * @Route("/adherer", name="adherer")
*/ */
...@@ -28,6 +49,8 @@ class AdhesionController extends AbstractController ...@@ -28,6 +49,8 @@ class AdhesionController extends AbstractController
if ($form->isSubmitted()) { if ($form->isSubmitted()) {
if ($form->isValid()) { if ($form->isValid()) {
// CB PAIEMENT USE PAYZEN
if ($form->get('save')->isClicked()) {
$adherentNew = $form->getData(); $adherentNew = $form->getData();
// Serialize form data in json to store with payment object and persist when payment is valid // Serialize form data in json to store with payment object and persist when payment is valid
...@@ -52,6 +75,28 @@ class AdhesionController extends AbstractController ...@@ -52,6 +75,28 @@ class AdhesionController extends AbstractController
'type' => Payment::TYPE_ADHESION, 'type' => Payment::TYPE_ADHESION,
'extra_data' => $jsondata, 'extra_data' => $jsondata,
]); ]);
// HELLOASSO PAIEMENT
} elseif ($form->get('saveHelloAsso')->isClicked()) {
$adherentNew = $form->getData();
$usergroup = $this->em->getRepository(Usergroup::class)->findOneByName('Adherent');
$adherentNew->getUser()->addPossiblegroup($usergroup);
$adherentNew->getUser()->addGroup($usergroup);
$adherentNew->getUser()->setAdherent($adherentNew);
$adherentNew->getUser()->setEnabled(true);
$this->em->persist($adherentNew);
$this->em->flush();
// Connect new user
$this->guardHandler->authenticateUserAndHandleSuccess(
$adherentNew->getUser(),
$request,
$this->authenticator,
'main'
);
return $this->redirect($this->router->generate('index') . '?showmlcadhesionmodal=1');
}
} else { } else {
$this->addFlash( $this->addFlash(
'error', 'error',
......
...@@ -8,9 +8,14 @@ use App\Entity\AchatMonnaieAConfirmerAdherent; ...@@ -8,9 +8,14 @@ use App\Entity\AchatMonnaieAConfirmerAdherent;
use App\Entity\AchatMonnaieAConfirmerPrestataire; use App\Entity\AchatMonnaieAConfirmerPrestataire;
use App\Entity\AchatMonnaieAdherent; use App\Entity\AchatMonnaieAdherent;
use App\Entity\AchatMonnaiePrestataire; use App\Entity\AchatMonnaiePrestataire;
use App\Entity\Adherent;
use App\Entity\Flux; use App\Entity\Flux;
use App\Entity\HelloAsso;
use App\Entity\Prestataire;
use App\Entity\Reconversion; use App\Entity\Reconversion;
use App\Enum\HelloassoStateEnum;
use App\Utils\CustomEntityManager; use App\Utils\CustomEntityManager;
use App\Utils\HelloassoUtils;
use App\Utils\OperationUtils; use App\Utils\OperationUtils;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
...@@ -19,6 +24,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; ...@@ -19,6 +24,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security as SecurityS; use Symfony\Component\Security\Core\Security as SecurityS;
...@@ -29,13 +35,22 @@ class AdminController extends Controller ...@@ -29,13 +35,22 @@ class AdminController extends Controller
private $eventDispatcher; private $eventDispatcher;
private $operationUtils; private $operationUtils;
private $security; private $security;
private $session;
public function __construct(CustomEntityManager $em, SecurityS $security, EventDispatcherInterface $eventDispatcher, OperationUtils $operationUtils) public function __construct(
CustomEntityManager $em,
SecurityS $security,
EventDispatcherInterface $eventDispatcher,
OperationUtils $operationUtils,
HelloassoUtils $helloassoUtils,
SessionInterface $session)
{ {
$this->em = $em; $this->em = $em;
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
$this->security = $security; $this->security = $security;
$this->operationUtils = $operationUtils; $this->operationUtils = $operationUtils;
$this->helloassoUtils = $helloassoUtils;
$this->session = $session;
} }
/** /**
...@@ -59,14 +74,14 @@ class AdminController extends Controller ...@@ -59,14 +74,14 @@ class AdminController extends Controller
$this->em->flush(); $this->em->flush();
} else { } else {
$status = 'error'; $status = 'error';
$this->get('session')->getFlashBag()->add( $this->session->getFlashBag()->add(
'notice', 'notice',
'Erreur : veuillez recharger la page et réessayer !' 'Erreur : veuillez recharger la page et réessayer !'
); );
} }
} catch (\Exception $e) { } catch (\Exception $e) {
$status = 'error'; $status = 'error';
$this->get('session')->getFlashBag()->add( $this->session->getFlashBag()->add(
'notice', 'notice',
'Erreur : veuillez recharger la page et réessayer !' 'Erreur : veuillez recharger la page et réessayer !'
); );
...@@ -108,7 +123,6 @@ class AdminController extends Controller ...@@ -108,7 +123,6 @@ class AdminController extends Controller
/** /**
* @Route("/validate/achat/monnaie/{id}", name="validate_achat_monnaie") * @Route("/validate/achat/monnaie/{id}", name="validate_achat_monnaie")
* @TODO : add is granted role !
* @Security("user.canValidateAchat == true and (is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_ADMIN_SIEGE') or is_granted('ROLE_TRESORIER'))") * @Security("user.canValidateAchat == true and (is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_ADMIN_SIEGE') or is_granted('ROLE_TRESORIER'))")
*/ */
public function validateAchatMonnaieAction(Request $request, AchatMonnaieAConfirmer $achatAConfirmer) public function validateAchatMonnaieAction(Request $request, AchatMonnaieAConfirmer $achatAConfirmer)
...@@ -152,6 +166,62 @@ class AdminController extends Controller ...@@ -152,6 +166,62 @@ class AdminController extends Controller
} }
/** /**
* @Route("/helloasso/associate/{id}", name="helloasso_associate")
* @Security("(is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_ADMIN_SIEGE') or is_granted('ROLE_TRESORIER'))")
*/
public function helloassoAssociateAction(Request $request, $id)
{
if ($this->em->getFilters()->isEnabled('enabled_filter')) {
$this->em->getFilters()->disable('enabled_filter');
}
$helloasso = $this->em->getRepository(HelloAsso::class)->findOneById($id);
$status = 'success';
$flashMessage = 'Transaction HelloAsso correctement associée ';
if (null != $request->get('presta') && null != $request->get('adherent')) {
$status = 'Erreur : il faut choisir un adherent OU un prestataire !';
return new JsonResponse(['status' => false, 'error' => $status]);
} elseif (null != $request->get('presta')) {
$prestataire = $this->em->getRepository(Prestataire::class)->findOneById($request->get('presta'));
$helloasso->setPrestataire($prestataire);
$flashMessage .= 'au prestataire ' . $prestataire->__toString();
} elseif (null != $request->get('adherent')) {
$adherent = $this->em->getRepository(Adherent::class)->findOneById($request->get('adherent'));
$helloasso->setAdherent($adherent);
$flashMessage .= 'à l\'adherent ' . $adherent->__toString();
}
if ('Membership' == $helloasso->getType()) {
// COTISATION
$flux = $this->helloassoUtils->addCotisation($helloasso);
$helloasso->setFlux($flux);
} elseif ('Payment' == $helloasso->getType()) {
// ACHAT EMLC
$flux = $this->helloassoUtils->addAchatEmlc($helloasso);
$helloasso->setFlux($flux);
} elseif ('Donation' == $helloasso->getType()) {
// DONATION
$flux = $this->helloassoUtils->addDonation($helloasso);
$helloasso->setFlux($flux);
}
$helloasso->setErrors(null);
$helloasso->setOperationState(HelloassoStateEnum::HELLOASSO_STATE_OK);
$this->em->persist($helloasso);
$this->em->flush();
$this->session->getFlashBag()->add(
'success',
$flashMessage
);
if (!$this->em->getFilters()->isEnabled('enabled_filter')) {
$this->em->getFilters()->enable('enabled_filter');
}
return new JsonResponse(['status' => $status]);
}
/**
* @Route("/admin/getcsv", name="getcsv") * @Route("/admin/getcsv", name="getcsv")
* @IsGranted({"ROLE_SUPER_ADMIN", "ROLE_ADMIN_IMPORT_EDIT", "ROLE_ADMIN_IMPORT_LIST", "ROLE_ADMIN_IMPORT_CREATE", "ROLE_ADMIN_IMPORT_VIEW", "ROLE_ADMIN_IMPORT_DELETE", "ROLE_ADMIN_IMPORT_EXPORT", "ROLE_ADMIN_IMPORT_ALL"}) * @IsGranted({"ROLE_SUPER_ADMIN", "ROLE_ADMIN_IMPORT_EDIT", "ROLE_ADMIN_IMPORT_LIST", "ROLE_ADMIN_IMPORT_CREATE", "ROLE_ADMIN_IMPORT_VIEW", "ROLE_ADMIN_IMPORT_DELETE", "ROLE_ADMIN_IMPORT_EXPORT", "ROLE_ADMIN_IMPORT_ALL"})
*/ */
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\GlobalParameter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Shivas\VersioningBundle\Service\VersionManager; use Shivas\VersioningBundle\Service\VersionManager;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
...@@ -21,30 +20,30 @@ class BugReportController extends AbstractController ...@@ -21,30 +20,30 @@ class BugReportController extends AbstractController
$newline = '%0A'; $newline = '%0A';
$referer = $request->headers->get('referer'); $referer = $request->headers->get('referer');
$version = $manager->getVersion(); $version = $manager->getVersion();
$title = '[V'.$version.'] '; $title = '[V' . $version . '] ';
$description = $description =
'[URL] '.$referer.$newline.$newline. '[URL] ' . $referer . $newline . $newline .
'[Kohinos v '.$version.']'.$newline. '[Kohinos v ' . $version . ']' . $newline .
'[USER] '.$this->getUser()->getName().' ['.$this->getUser()->getId().']'.$newline. '[USER] ' . $this->getUser()->getName() . ' [' . $this->getUser()->getId() . ']' . $newline .
'[ROLES] '.implode(array_map(function ($o) { '[ROLES] ' . implode(array_map(function ($o) {
return $o->getName(); return $o->getName();
}, $this->getUser()->getGroups()->toArray())).$newline.$newline. }, $this->getUser()->getGroups()->toArray())) . $newline . $newline .
'* Résumé'.$newline. '* Résumé' . $newline .
'(Résumé concis du bug)'.$newline.$newline. '(Résumé concis du bug)' . $newline . $newline .
'* Étapes pour reproduire'.$newline. '* Étapes pour reproduire' . $newline .
'(Comment reproduire le bug)'.$newline.$newline. '(Comment reproduire le bug)' . $newline . $newline .
'* Comportement courant'.$newline. '* Comportement courant' . $newline .
'(ce qu\'il se passe et que vous trouver anormal)'.$newline.$newline. '(ce qu\'il se passe et que vous trouver anormal)' . $newline . $newline .
'* Comportement attendu'.$newline. '* Comportement attendu' . $newline .
'(ce qui devrait se passer selon vous ou qui se passait avant la régression)'.$newline.$newline. '(ce qui devrait se passer selon vous ou qui se passait avant la régression)' . $newline . $newline .
'* Environnement'.$newline. '* Environnement' . $newline .
'( Version / environnement / instance, ...) '.$newline.$newline. '( Version / environnement / instance, ...) ' . $newline . $newline .
'* Préciser le Compte / Rôle pour se connecter'.$newline. '* Préciser le Compte / Rôle pour se connecter' . $newline .
'(fournir les comptes si besoin)'.$newline.$newline. '(fournir les comptes si besoin)' . $newline . $newline .
'* Logs et/ou captures d\'écran pertinent'.$newline '* Logs et/ou captures d\'écran pertinent' . $newline
; ;
$url = str_replace(["%%title%%", "%%description%%"], [$title, $description], $urltype); $url = str_replace(['%%title%%', '%%description%%'], [$title, $description], $urltype);
return $this->redirect($url); return $this->redirect($url);
} }
......
...@@ -10,7 +10,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse; ...@@ -10,7 +10,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
class CRUDController extends Controller class CRUDController extends Controller
{ {
/** /**
* Create action. * Create action.
* *
...@@ -127,6 +126,7 @@ class CRUDController extends Controller ...@@ -127,6 +126,7 @@ class CRUDController extends Controller
'objectId' => null, 'objectId' => null,
], null); ], null);
} }
// /** // /**
// * @inheritdoc // * @inheritdoc
// */ // */
...@@ -220,7 +220,7 @@ class CRUDController extends Controller ...@@ -220,7 +220,7 @@ class CRUDController extends Controller
); );
return new RedirectResponse( return new RedirectResponse(
$this->admin->generateUrl('list', array('filter' => $this->admin->getFilterParameters())) $this->admin->generateUrl('list', ['filter' => $this->admin->getFilterParameters()])
); );
} }
if ($selectedUser->hasRole('ROLE_SUPER_ADMIN') || $selectedUser->hasRole('ROLE_ADMIN_SIEGE')) { if ($selectedUser->hasRole('ROLE_SUPER_ADMIN') || $selectedUser->hasRole('ROLE_ADMIN_SIEGE')) {
...@@ -230,7 +230,7 @@ class CRUDController extends Controller ...@@ -230,7 +230,7 @@ class CRUDController extends Controller
); );
return new RedirectResponse( return new RedirectResponse(
$this->admin->generateUrl('list', array('filter' => $this->admin->getFilterParameters())) $this->admin->generateUrl('list', ['filter' => $this->admin->getFilterParameters()])
); );
} }
} }
......
...@@ -42,7 +42,7 @@ class GroupCRUDController extends Controller ...@@ -42,7 +42,7 @@ class GroupCRUDController extends Controller
); );
return new RedirectResponse( return new RedirectResponse(
$this->admin->generateUrl('list', array('filter' => $this->admin->getFilterParameters())) $this->admin->generateUrl('list', ['filter' => $this->admin->getFilterParameters()])
); );
} }
} }
......
...@@ -7,6 +7,7 @@ use App\Entity\AchatMonnaiePrestataire; ...@@ -7,6 +7,7 @@ use App\Entity\AchatMonnaiePrestataire;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\CotisationAdherent; use App\Entity\CotisationAdherent;
use App\Entity\CotisationPrestataire; use App\Entity\CotisationPrestataire;
use App\Entity\Don;
use App\Entity\Flux; use App\Entity\Flux;
use App\Entity\Geoloc; use App\Entity\Geoloc;
use App\Entity\GlobalParameter; use App\Entity\GlobalParameter;
...@@ -23,6 +24,7 @@ use App\Utils\CustomEntityManager; ...@@ -23,6 +24,7 @@ use App\Utils\CustomEntityManager;
use App\Utils\OperationUtils; use App\Utils\OperationUtils;
use FOS\UserBundle\Model\UserManagerInterface; use FOS\UserBundle\Model\UserManagerInterface;
use FOS\UserBundle\Util\TokenGeneratorInterface; use FOS\UserBundle\Util\TokenGeneratorInterface;
use Gamez\Symfony\Component\Serializer\Normalizer\UuidNormalizer;
use Payum\Core\Payum; use Payum\Core\Payum;
use Payum\Core\Request\GetHumanStatus; use Payum\Core\Request\GetHumanStatus;
use Payum\Core\Request\Notify; use Payum\Core\Request\Notify;
...@@ -43,7 +45,10 @@ use Symfony\Component\Routing\Annotation\Route; ...@@ -43,7 +45,10 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler; use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
use Twig\Environment; use Twig\Environment;
...@@ -139,21 +144,21 @@ class FluxController extends AbstractController ...@@ -139,21 +144,21 @@ class FluxController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$this->tokenManager->refreshToken('flux_form'); $this->tokenManager->refreshToken('flux_form');
$flux = $form->getData(); $flux = $form->getData();
// try { try {
if ($this->operationUtils->executeOperations($flux)) { if ($this->operationUtils->executeOperations($flux)) {
// Redirect to confirmation page // Redirect to confirmation page
return $this->fluxSuccessRedirection($request, $flux); return $this->fluxSuccessRedirection($request, $flux);
} }
// } catch (\Exception $e) { } catch (\Exception $e) {
// $this->addFlash( $this->addFlash(
// 'error', 'error',
// $this->translator->trans($flux->getType() . '_title', [], 'flux') . ' : ' . $e->getMessage() $this->translator->trans($flux->getType() . '_title', [], 'flux') . ' : ' . $e->getMessage()
// ); );
// $referer = $request->headers->get('referer'); $referer = $request->headers->get('referer');
// if ($referer) { if ($referer) {
// return $this->redirect($referer); return $this->redirect($referer);
// } }
// } }
} }
return $this->render($template, array_merge([ return $this->render($template, array_merge([
...@@ -343,7 +348,9 @@ class FluxController extends AbstractController ...@@ -343,7 +348,9 @@ class FluxController extends AbstractController
public function preparePaymentAction(Form $form, $type, $extra_data = null) public function preparePaymentAction(Form $form, $type, $extra_data = null)
{ {
// Enregistre les données du Flux en json, pour l'enregistrer une fois le paiement validé // Enregistre les données du Flux en json, pour l'enregistrer une fois le paiement validé
$serializer = $this->container->get('serializer'); $encoders = [new JsonEncoder()];
$normalizers = [new UuidNormalizer(), new ObjectNormalizer()];
$serializer = new Serializer($normalizers, $encoders);
$toSerialize = Payment::TYPE_ADHESION == $type ? $form->get('cotisation')->getData() : $form->getData(); $toSerialize = Payment::TYPE_ADHESION == $type ? $form->get('cotisation')->getData() : $form->getData();
$data = $serializer->normalize( $data = $serializer->normalize(
...@@ -354,6 +361,16 @@ class FluxController extends AbstractController ...@@ -354,6 +361,16 @@ class FluxController extends AbstractController
'moyen', 'moyen',
'montant', 'montant',
'role', 'role',
'don' => [
'reference',
'moyen',
'montant',
'role',
'type',
'expediteur' => ['id'],
'destinataire' => ['id'],
'operateur' => ['id'],
],
'expediteur' => ['id'], 'expediteur' => ['id'],
'destinataire' => ['id'], 'destinataire' => ['id'],
'operateur' => ['id'], 'operateur' => ['id'],
...@@ -393,7 +410,13 @@ class FluxController extends AbstractController ...@@ -393,7 +410,13 @@ class FluxController extends AbstractController
$payment->setClientId('Nouvel adhérent'); $payment->setClientId('Nouvel adhérent');
$payment->setClientEmail($form->get('user')->get('email')->getData()); $payment->setClientEmail($form->get('user')->get('email')->getData());
} else { } else {
// $payment->setTotalAmount($form->get('montant')->getData() * 100); // 1.23 EUR
if ($form->has('don') && $form->get('don')->getData()->getMontant() > 0) {
$payment->setTotalAmount(($form->get('montant')->getData() * 100) + ($form->get('don')->getData()->getMontant() * 100)); // 1.23 EUR
} else {
$payment->setTotalAmount($form->get('montant')->getData() * 100); // 1.23 EUR $payment->setTotalAmount($form->get('montant')->getData() * 100); // 1.23 EUR
}
$payment->setClientId($this->getUser()->getId()); $payment->setClientId($this->getUser()->getId());
$payment->setClientEmail($this->getUser()->getEmail()); $payment->setClientEmail($this->getUser()->getEmail());
} }
...@@ -486,8 +509,9 @@ class FluxController extends AbstractController ...@@ -486,8 +509,9 @@ class FluxController extends AbstractController
// We got here, payment hasn't been processed, we're in the notification process. Update payment status and go on. // We got here, payment hasn't been processed, we're in the notification process. Update payment status and go on.
$payment->setStatus($status->getValue()); $payment->setStatus($status->getValue());
$this->em->persist($payment); // @TODO : decommenter cela
$this->em->flush(); // $this->em->persist($payment);
// $this->em->flush();
$type = ''; $type = '';
...@@ -514,6 +538,16 @@ class FluxController extends AbstractController ...@@ -514,6 +538,16 @@ class FluxController extends AbstractController
$op = $this->em->getRepository(User::class)->find($flux_array['operateur']); $op = $this->em->getRepository(User::class)->find($flux_array['operateur']);
$flux->setOperateur($op); $flux->setOperateur($op);
$flux->setReconverti(true); $flux->setReconverti(true);
if (null != $flux->getDon()) {
$flux->getDon()->setType(Don::TYPE_DON_ADHERENT);
$flux->getDon()->setOperateur($op);
$flux->getDon()->setExpediteur($dest);
$flux->getDon()->setDestinataire($this->em->getRepository(Prestataire::class)->findOneBy(['mlc' => true]));
}
$this->addFlash(
'success',
$this->translator->trans('Votre achat de monnaie locale a bien été pris en compte !')
);
} elseif (Payment::TYPE_ACHAT_MONNAIE_PRESTA == $type) { } elseif (Payment::TYPE_ACHAT_MONNAIE_PRESTA == $type) {
$flux = $serializer->deserialize( $flux = $serializer->deserialize(
$payment->getFluxData(), $payment->getFluxData(),
...@@ -531,6 +565,16 @@ class FluxController extends AbstractController ...@@ -531,6 +565,16 @@ class FluxController extends AbstractController
$op = $this->em->getRepository(User::class)->find($flux_array['operateur']); $op = $this->em->getRepository(User::class)->find($flux_array['operateur']);
$flux->setOperateur($op); $flux->setOperateur($op);
$flux->setReconverti(true); $flux->setReconverti(true);
if (null != $flux->getDon()) {
$flux->getDon()->setType(Don::TYPE_DON_PRESTATAIRE);
$flux->getDon()->setOperateur($op);
$flux->getDon()->setExpediteur($dest);
$flux->getDon()->setDestinataire($this->em->getRepository(Prestataire::class)->findOneBy(['mlc' => true]));
}
$this->addFlash(
'success',
$this->translator->trans('Votre achat de monnaie locale a bien été pris en compte !')
);
} elseif (Payment::TYPE_COTISATION_ADHERENT == $type) { } elseif (Payment::TYPE_COTISATION_ADHERENT == $type) {
$flux = $serializer->deserialize( $flux = $serializer->deserialize(
$payment->getFluxData(), $payment->getFluxData(),
...@@ -549,6 +593,16 @@ class FluxController extends AbstractController ...@@ -549,6 +593,16 @@ class FluxController extends AbstractController
$flux->setOperateur($op); $flux->setOperateur($op);
$flux->setRecu(true); $flux->setRecu(true);
if (null != $flux->getDon()) {
$flux->getDon()->setType(Don::TYPE_DON_ADHERENT);
$flux->getDon()->setOperateur($op);
$flux->getDon()->setExpediteur($exp);
$flux->getDon()->setDestinataire($this->em->getRepository(Prestataire::class)->findOneBy(['mlc' => true]));
}
$this->addFlash(
'success',
$this->translator->trans('Votre cotisation a bien été prise en compte !')
);
} elseif (Payment::TYPE_COTISATION_PRESTA == $type) { } elseif (Payment::TYPE_COTISATION_PRESTA == $type) {
$flux = $serializer->deserialize( $flux = $serializer->deserialize(
$payment->getFluxData(), $payment->getFluxData(),
...@@ -567,6 +621,17 @@ class FluxController extends AbstractController ...@@ -567,6 +621,17 @@ class FluxController extends AbstractController
$flux->setOperateur($op); $flux->setOperateur($op);
$flux->setRecu(true); $flux->setRecu(true);
if (null != $flux->getDon()) {
$flux->getDon()->setType(Don::TYPE_DON_PRESTATAIRE);
$flux->getDon()->setOperateur($op);
$flux->getDon()->setExpediteur($exp);
$flux->getDon()->setDestinataire($this->em->getRepository(Prestataire::class)->findOneBy(['mlc' => true]));
}
$this->addFlash(
'success',
$this->translator->trans('Votre cotisation a bien été prise en compte !')
);
} elseif (Payment::TYPE_ADHESION == $type) { } elseif (Payment::TYPE_ADHESION == $type) {
$new_adherent_data = json_decode($payment->getExtraData()); $new_adherent_data = json_decode($payment->getExtraData());
...@@ -617,6 +682,18 @@ class FluxController extends AbstractController ...@@ -617,6 +682,18 @@ class FluxController extends AbstractController
$payment->setClientId($user->getId()); $payment->setClientId($user->getId());
$payment->setExtraData(''); $payment->setExtraData('');
$this->em->persist($payment); $this->em->persist($payment);
$this->addFlash(
'success',
$this->translator->trans('Votre adhésion a bien été prise en compte, bienvenue !')
);
// Connect new user
$this->guardHandler->authenticateUserAndHandleSuccess(
$this->em->getRepository(User::class)->findOneBy(['id' => $payment->getClientId()]),
$request,
$this->authenticator,
'main'
);
} else { } else {
return new Response('', Response::HTTP_BAD_REQUEST); return new Response('', Response::HTTP_BAD_REQUEST);
} }
......
...@@ -4,12 +4,16 @@ namespace App\Controller; ...@@ -4,12 +4,16 @@ namespace App\Controller;
use App\Entity\GlobalParameter; use App\Entity\GlobalParameter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class FrontController extends AbstractController class FrontController extends AbstractController
{ {
/**
* If the global parameter USE_WORDPRESS is set to false, then the front is activated.
*
* @return The value of the parameter USE_WORDPRESS
*/
protected function isFrontActivated() protected function isFrontActivated()
{ {
return ($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::USE_WORDPRESS) == 'false'); return 'false' == $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::USE_WORDPRESS);
} }
} }
<?php
namespace App\Controller;
use App\Entity\GlobalParameter;
use App\Utils\OperationUtils;
use Doctrine\ORM\EntityManagerInterface;
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
use League\OAuth2\Client\Provider\GenericProvider;
use Psr\Log\LoggerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security as SecurityS;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Contracts\Cache\ItemInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
class HelloAssoApiController extends AbstractController
{
protected $client;
protected $em;
protected $security;
protected $translator;
protected $eventDispatcher;
protected $operationUtils;
const CASH_OUT_STATE_MONEY_IN = 'MoneyIn';
const CASH_OUT_STATE_CANT_TRANSFER_RECEIVER_FULL = 'CantTransferReceiverFull';
const CASH_OUT_STATE_TRANSFERED = 'Transfered';
const CASH_OUT_STATE_REFUNDED = 'Refunded';
const CASH_OUT_STATE_REFUNDING = 'Refunding';
const CASH_OUT_STATE_WAITING_FOR_CASH_OUT_CONFIRMATION = 'WaitingForCashOutConfirmation';
const CASH_OUT_STATE_CASHED_OUT = 'CashedOut';
const CASH_OUT_STATE_UNKNOWN = 'Unknown';
const CASH_OUT_STATE_CONTESTED = 'Contested';
const PAYMENT_MEANS_NONE = 'None';
const PAYMENT_MEANS_CARD = 'Card';
const PAYMENT_MEANS_SEPA = 'Sepa';
const PAYMENT_MEANS_CHECK = 'Check';
const STATE_PENDING = 'Pending';
const STATE_AUTHORIZED = 'Authorized';
const STATE_REFUSED = 'Refused';
const STATE_UNKNOWN = 'Unknown';
const STATE_REGISTERED = 'Registered';
const STATE_ERROR = 'Error';
const STATE_REFUNDED = 'Refunded';
const STATE_REFUNDING = 'Refunding';
const STATE_WAITING = 'Waiting';
const STATE_CANCELED = 'Canceled';
const STATE_CONTESTED = 'Contested';
const STATE_WAITING_BANK_VALIDATION = 'WaitingBankValidation';
const STATE_WAITING_BANK_WITHDRAW = 'WaitingBankWithdraw';
const TYPE_OFFLINE = 'Offline';
const TYPE_CREDIT = 'Credit';
const TYPE_DEBIT = 'Debit';
public function __construct(
HttpClientInterface $client,
Security $security,
EntityManagerInterface $em,
TranslatorInterface $translator,
EventDispatcherInterface $eventDispatcher,
LoggerInterface $logger,
OperationUtils $operationUtils
) {
$this->client = $client;
$this->security = $security;
$this->em = $em;
$this->translator = $translator;
$this->eventDispatcher = $eventDispatcher;
$this->operationUtils = $operationUtils;
}
/**
* Gets allowable values of the enum.
*
* @return string[]
*/
public static function getCashOutStateAllowableValues()
{
return [
self::CASH_OUT_STATE_MONEY_IN,
self::CASH_OUT_STATE_CANT_TRANSFER_RECEIVER_FULL,
self::CASH_OUT_STATE_TRANSFERED,
self::CASH_OUT_STATE_REFUNDED,
self::CASH_OUT_STATE_REFUNDING,
self::CASH_OUT_STATE_WAITING_FOR_CASH_OUT_CONFIRMATION,
self::CASH_OUT_STATE_CASHED_OUT,
self::CASH_OUT_STATE_UNKNOWN,
self::CASH_OUT_STATE_CONTESTED,
];
}
/**
* Gets allowable values of the enum.
*
* @return string[]
*/
public static function getPaymentMeansAllowableValues()
{
return [
self::PAYMENT_MEANS_NONE,
self::PAYMENT_MEANS_CARD,
self::PAYMENT_MEANS_SEPA,
self::PAYMENT_MEANS_CHECK,
];
}
/**
* Gets allowable values of the enum.
*
* @return string[]
*/
public static function getStateAllowableValues()
{
return [
self::STATE_PENDING,
self::STATE_AUTHORIZED,
self::STATE_REFUSED,
self::STATE_UNKNOWN,
self::STATE_REGISTERED,
self::STATE_ERROR,
self::STATE_REFUNDED,
self::STATE_REFUNDING,
self::STATE_WAITING,
self::STATE_CANCELED,
self::STATE_CONTESTED,
self::STATE_WAITING_BANK_VALIDATION,
self::STATE_WAITING_BANK_WITHDRAW,
];
}
/**
* Gets allowable values of the enum.
*
* @return string[]
*/
public static function getTypeAllowableValues()
{
return [
self::TYPE_OFFLINE,
self::TYPE_CREDIT,
self::TYPE_DEBIT,
];
}
/**
* @Route("/helloasso/sync/orders", name="helloasso_api_synchro")
* @SecurityS("(is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_ADMIN_SIEGE') or is_granted('ROLE_TRESORIER'))")
*/
public function synchroItems(int $pageIndex = 1, int $pageSize = 100, Request $request)
{
$accessToken = $this->authorize();
$cache = new FilesystemAdapter();
// API url to get all payments (> 0)
// https://api.helloasso.com/v5/organizations/federation-kohinos/payments
// To get all order (>= 0) with free cotisation or example !
$response = $this->client->request('GET', 'https://api.helloasso.com/v5/organizations/federation-kohinos/items?pageSize=' . $pageSize . '&pageIndex=' . $pageIndex, [
'auth_bearer' => $accessToken->getToken(),
]);
$data = $response->toArray();
return new JsonResponse(['data' => $data]);
}
public function authorize()
{
$helloClientId = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::HELLOASSO_CLIENTID);
$helloClientSecret = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::HELLOASSO_CLIENTSECRET);
if (empty($helloClientId) || empty($helloClientSecret)) {
throw new \Exception('NO HELLOASSO ID AND SECRET CONFIGURED ! ');
}
$cache = new FilesystemAdapter();
$provider = new GenericProvider([
'clientId' => $helloClientId, // The client ID assigned to you by the provider
'clientSecret' => $helloClientSecret, // The client password assigned to you by the provider
// 'redirectUri' => 'https://kohinos.test', // Necessary ?! not sure
'urlAuthorize' => 'https://auth.helloasso.com/authorize', // Url for authorization
'urlAccessToken' => 'https://api.helloasso.com/oauth2/token', // Url to get an access token
'urlResourceOwnerDetails' => 'https://api.helloasso.com', // API base endpoint url of Helloasso
]);
$value = $cache->get('helloasso_oauth_token2', function (ItemInterface $item) use ($provider) {
try {
// Try to get an access token using the client credentials grant.
$accessToken = $provider->getAccessToken('client_credentials');
} catch (IdentityProviderException $e) {
// Failed to get the access token
exit($e->getMessage());
}
$item->expiresAfter($accessToken->getExpires() - time());
return $accessToken;
});
// Item expiresAfter does'nt work ! (don't know why...) So if access token has been expired, get a new one with refresh_token !
if ($value->hasExpired()) {
$cache->delete('helloasso_oauth_token2');
$value = $cache->get('helloasso_oauth_token2', function (ItemInterface $item) use ($provider, $value) {
try {
$newValue = $provider->getAccessToken('refresh_token', [
'refresh_token' => $value->getRefreshToken(),
]);
} catch (IdentityProviderException $e) {
// Failed to get the access token
exit($e->getMessage());
}
$item->expiresAfter($newValue->getExpires() - time());
return $newValue;
});
}
return $value;
}
}
...@@ -16,6 +16,7 @@ use App\Entity\Import; ...@@ -16,6 +16,7 @@ use App\Entity\Import;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Rubrique; use App\Entity\Rubrique;
use App\Entity\Siege; use App\Entity\Siege;
use App\Entity\TypePrestataire;
use App\Entity\User; use App\Entity\User;
use App\Entity\Usergroup; use App\Entity\Usergroup;
use App\Enum\CurrencyEnum; use App\Enum\CurrencyEnum;
...@@ -508,6 +509,7 @@ class ImportController extends CRUDController ...@@ -508,6 +509,7 @@ class ImportController extends CRUDController
} }
if (empty($prestataire)) { if (empty($prestataire)) {
$prestataire = new Prestataire(); $prestataire = new Prestataire();
$prestataire->setTypeprestataire($this->em->getRepository(TypePrestataire::class)->findOneBy(['slug' => 'prestataire']));
$prestataire->setIdmlc($idmlc); $prestataire->setIdmlc($idmlc);
if (!empty($raison)) { if (!empty($raison)) {
......
...@@ -68,7 +68,6 @@ class IndexController extends AbstractController ...@@ -68,7 +68,6 @@ class IndexController extends AbstractController
/** /**
* @Route("/", name="index") * @Route("/", name="index")
*/ */
// public function index(TranslatorInterface $translator)
public function index(Request $request) public function index(Request $request)
{ {
/* Pour la première installation */ /* Pour la première installation */
...@@ -335,7 +334,6 @@ class IndexController extends AbstractController ...@@ -335,7 +334,6 @@ class IndexController extends AbstractController
* @Route("/login/groupe/choice/{usergrpid}/{grpid}", name="groupe_choice") * @Route("/login/groupe/choice/{usergrpid}/{grpid}", name="groupe_choice")
* @ParamConverter("group", class="App:Usergroup", options={"mapping": {"usergrpid": "id"}}) * @ParamConverter("group", class="App:Usergroup", options={"mapping": {"usergrpid": "id"}})
* @ParamConverter("groupe", class="App:Groupe", options={"mapping": {"grpid": "id"}}) * @ParamConverter("groupe", class="App:Groupe", options={"mapping": {"grpid": "id"}})
* IsGranted({"ROLE_GESTION_GROUPE", "ROLE_CONTACT", "ROLE_TRESORIER"})
* @IsGranted("ROLE_USER") * @IsGranted("ROLE_USER")
*/ */
public function groupeChoiceAction(Usergroup $group, Groupe $groupe, Request $request) public function groupeChoiceAction(Usergroup $group, Groupe $groupe, Request $request)
......
...@@ -26,8 +26,10 @@ class PrestataireAdminController extends CRUDController ...@@ -26,8 +26,10 @@ class PrestataireAdminController extends CRUDController
} }
/** /**
* Ajouter une cotisation gratuite à l'adhérent * Ajouter une cotisation gratuite à l'adhérent.
*
* @param Uuid $id Id du prestataire * @param Uuid $id Id du prestataire
*
* @return Response * @return Response
*/ */
public function addfreecotisationadhAction($id): Response public function addfreecotisationadhAction($id): Response
...@@ -39,7 +41,7 @@ class PrestataireAdminController extends CRUDController ...@@ -39,7 +41,7 @@ class PrestataireAdminController extends CRUDController
} }
$managers = $prestataire->getUsers(); $managers = $prestataire->getUsers();
if (count($managers) == 1) { if (1 == count($managers)) {
$manager = $managers[0]; $manager = $managers[0];
if (null != $manager->getAdherent()) { if (null != $manager->getAdherent()) {
$cotisation = new CotisationAdherent(); $cotisation = new CotisationAdherent();
...@@ -74,8 +76,10 @@ class PrestataireAdminController extends CRUDController ...@@ -74,8 +76,10 @@ class PrestataireAdminController extends CRUDController
} }
/** /**
* Ajouter une cotisation gratuite au prestataire * Ajouter une cotisation gratuite au prestataire.
*
* @param Uuid $id Id du prestataire * @param Uuid $id Id du prestataire
*
* @return Response * @return Response
*/ */
public function addfreecotisationprestaAction($id): Response public function addfreecotisationprestaAction($id): Response
......
...@@ -85,7 +85,7 @@ class SolidoumeController extends AbstractController ...@@ -85,7 +85,7 @@ class SolidoumeController extends AbstractController
if (empty($solidoumeParam)) { if (empty($solidoumeParam)) {
$this->addFlash( $this->addFlash(
'error', 'error',
'Programme non configuré !' 'Le programme de Sécurité Sociale Alimentaire non configuré !'
); );
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
......
...@@ -5,6 +5,7 @@ namespace App\Controller; ...@@ -5,6 +5,7 @@ namespace App\Controller;
use App\Entity\AchatMonnaieAConfirmerAdherent; use App\Entity\AchatMonnaieAConfirmerAdherent;
use App\Entity\AchatMonnaieAdherent; use App\Entity\AchatMonnaieAdherent;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\GlobalParameter;
use App\Entity\Payment; use App\Entity\Payment;
use App\Entity\TransactionAdherentAdherent; use App\Entity\TransactionAdherentAdherent;
use App\Entity\TransactionAdherentPrestataire; use App\Entity\TransactionAdherentPrestataire;
...@@ -101,11 +102,15 @@ class UserAdherentController extends FluxController ...@@ -101,11 +102,15 @@ class UserAdherentController extends FluxController
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
if ($form->get('payOther')->isClicked()) { if ($form->get('payOther')->isClicked()) {
return $this->redirectToRoute('achatMonnaieAConfirmerAdherent'); return $this->redirectToRoute('achatMonnaieAConfirmerAdherent');
} else { } elseif ($form->get('save')->isClicked()) {
return $this->preparePaymentAction( return $this->preparePaymentAction(
$form, $form,
Payment::TYPE_ACHAT_MONNAIE_ADHERENT Payment::TYPE_ACHAT_MONNAIE_ADHERENT
); );
} elseif ($form->get('saveHelloAsso')->isClicked()) {
$url = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::HELLOASSO_URL_EMLC_ADHERENT);
return $this->redirect($url);
} }
} }
...@@ -117,7 +122,7 @@ class UserAdherentController extends FluxController ...@@ -117,7 +122,7 @@ class UserAdherentController extends FluxController
/** /**
* @Route("/adherent/demande/achat-monnaie/", name="achatMonnaieAConfirmerAdherent") * @Route("/adherent/demande/achat-monnaie/", name="achatMonnaieAConfirmerAdherent")
* IsGranted("ROLE_ADHERENT") * @IsGranted("ROLE_ADHERENT")
*/ */
public function achatMonnaieAConfirmerAdherentAction(Request $request) public function achatMonnaieAConfirmerAdherentAction(Request $request)
{ {
......
...@@ -5,12 +5,16 @@ namespace App\Controller; ...@@ -5,12 +5,16 @@ namespace App\Controller;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\CotisationAdherent; use App\Entity\CotisationAdherent;
use App\Entity\CotisationPrestataire; use App\Entity\CotisationPrestataire;
use App\Entity\GlobalParameter;
use App\Entity\Payment; use App\Entity\Payment;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\User; use App\Entity\User;
use App\Enum\MoyenEnum; use App\Enum\MoyenEnum;
use App\Form\Type\CotiserFormType; use App\Form\Type\CotiserFormType;
use App\Form\Type\DonAdherentFormType;
use App\Form\Type\DonPrestataireFormType;
use App\Form\Type\UserInfosFormType; use App\Form\Type\UserInfosFormType;
use App\Utils\CotisationUtils;
use App\Utils\OperationUtils; use App\Utils\OperationUtils;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
...@@ -27,37 +31,62 @@ class UserController extends AbstractController ...@@ -27,37 +31,62 @@ class UserController extends AbstractController
private $translator; private $translator;
private $security; private $security;
private $operationUtils; private $operationUtils;
private $cotisationUtils;
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator, Security $security, OperationUtils $operationUtils) public function __construct(EntityManagerInterface $em, TranslatorInterface $translator, Security $security, OperationUtils $operationUtils, CotisationUtils $cotisationUtils)
{ {
$this->em = $em; $this->em = $em;
$this->translator = $translator; $this->translator = $translator;
$this->security = $security; $this->security = $security;
$this->operationUtils = $operationUtils; $this->operationUtils = $operationUtils;
$this->cotisationUtils = $cotisationUtils;
} }
/** /**
* @Route("/cotiser", name="cotiser") * @Route("/cotiser", name="cotiser", defaults={"type": "null"})
* @Route("/cotiser/next", name="cotisernextyear", defaults={"type": "nextyear"})
* @IsGranted("ROLE_USER") * @IsGranted("ROLE_USER")
*/ */
public function cotiserAction(Request $request) public function cotiserAction($type, Request $request)
{ {
$options = []; $options = [];
$payment_type = ''; $payment_type = '';
if ($this->security->isGranted('ROLE_ADHERENT')) { if ($this->security->isGranted('ROLE_ADHERENT')) {
$options['data_class'] = CotisationAdherent::class; $options['data_class'] = CotisationAdherent::class;
$options['don_class'] = DonAdherentFormType::class;
$payment_type = Payment::TYPE_COTISATION_ADHERENT; $payment_type = Payment::TYPE_COTISATION_ADHERENT;
} elseif ($this->security->isGranted('ROLE_PRESTATAIRE')) { } elseif ($this->security->isGranted('ROLE_PRESTATAIRE')) {
$options['data_class'] = CotisationPrestataire::class; $options['data_class'] = CotisationPrestataire::class;
$options['don_class'] = DonPrestataireFormType::class;
$payment_type = Payment::TYPE_COTISATION_PRESTA; $payment_type = Payment::TYPE_COTISATION_PRESTA;
} }
$form = $this->createForm(CotiserFormType::class, null, $options); $form = $this->createForm(CotiserFormType::class, null, $options);
$form->handleRequest($request); $form->handleRequest($request);
if ('nextyear' === $type) {
$nextYear = new \DateTime('+1 year');
$kohYear = (string) $nextYear->format('Y');
} else {
$now = new \DateTime();
$kohYear = (string) $now->format('Y');
}
if ($form->isSubmitted()) { if ($form->isSubmitted()) {
$cotisation = $form->getData(); $cotisation = $form->getData();
if ($form->isValid()) { if ($form->isValid()) {
//Manage don if null => delete it !
if ($cotisation->getDon() && 0 == $cotisation->getDon()->getMontant()) {
$cotisation->setDon(null);
}
if ('nextyear' === $type) {
// Cotiser pour l'année suivante
$nextYear = new \DateTime('+1 year');
$startDate = $this->cotisationUtils->isCotisationValid($this->getUser());
$cotisation->getCotisationInfos()->setAnnee((string) $nextYear->format('Y'));
$cotisation->getCotisationInfos()->setDebut($startDate);
$endDate = new \DateTime(date('Y-m-d H:i:s', strtotime('+1 year', strtotime($startDate->format('Y-m-d H:i:s')))));
$cotisation->getCotisationInfos()->setFin($endDate);
}
if (MoyenEnum::MOYEN_EMLC == $cotisation->getMoyen()) { if (MoyenEnum::MOYEN_EMLC == $cotisation->getMoyen()) {
try { try {
$cotisation->setRecu(true); $cotisation->setRecu(true);
...@@ -75,7 +104,15 @@ class UserController extends AbstractController ...@@ -75,7 +104,15 @@ class UserController extends AbstractController
} }
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
} elseif (MoyenEnum::MOYEN_HELLOASSO == $cotisation->getMoyen()) {
if ($this->security->isGranted('ROLE_ADHERENT')) {
$url = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::HELLOASSO_URL_COTISATION_ADHERENT);
} else { } else {
$url = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::HELLOASSO_URL_COTISATION_PRESTATAIRE);
}
return $this->redirect($url);
} elseif (MoyenEnum::MOYEN_CB == $cotisation->getMoyen()) {
// Redirect to payment page // Redirect to payment page
return $this->forward('App\Controller\FluxController::preparePaymentAction', [ return $this->forward('App\Controller\FluxController::preparePaymentAction', [
'form' => $form, 'form' => $form,
...@@ -92,6 +129,7 @@ class UserController extends AbstractController ...@@ -92,6 +129,7 @@ class UserController extends AbstractController
return $this->render('@kohinos/cotiser.html.twig', [ return $this->render('@kohinos/cotiser.html.twig', [
'form' => $form->createView(), 'form' => $form->createView(),
'koh_year' => $kohYear,
]); ]);
} }
......
...@@ -4,6 +4,7 @@ namespace App\Controller; ...@@ -4,6 +4,7 @@ namespace App\Controller;
use App\Entity\AchatMonnaieAConfirmerPrestataire; use App\Entity\AchatMonnaieAConfirmerPrestataire;
use App\Entity\AchatMonnaiePrestataire; use App\Entity\AchatMonnaiePrestataire;
use App\Entity\GlobalParameter;
use App\Entity\Payment; use App\Entity\Payment;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Reconversion; use App\Entity\Reconversion;
...@@ -246,9 +247,18 @@ class UserPrestataireController extends FluxController ...@@ -246,9 +247,18 @@ class UserPrestataireController extends FluxController
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$achat = $form->getData();
//Manage don if null => delete it !
if ($achat->getDon() && 0 == $achat->getDon()->getMontant()) {
$achat->setDon(null);
}
if ($form->get('payOther')->isClicked()) { if ($form->get('payOther')->isClicked()) {
return $this->redirectToRoute('achatMonnaieAConfirmerPrestataire'); return $this->redirectToRoute('achatMonnaieAConfirmerPrestataire');
} else { } elseif ($form->get('saveHelloAsso')->isClicked()) {
$url = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::HELLOASSO_URL_EMLC_PRESTATAIRE);
return $this->redirect($url);
} elseif ($form->get('save')->isClicked()) {
return $this->preparePaymentAction( return $this->preparePaymentAction(
$form, $form,
Payment::TYPE_ACHAT_MONNAIE_PRESTA Payment::TYPE_ACHAT_MONNAIE_PRESTA
......
...@@ -60,6 +60,6 @@ class AccountAdherent extends Account ...@@ -60,6 +60,6 @@ class AccountAdherent extends Account
public function __toString(): string public function __toString(): string
{ {
return 'AccountAdherent '.$this->getAdherent(); return 'AccountAdherent ' . $this->getAdherent();
} }
} }
...@@ -32,6 +32,8 @@ class AchatMonnaie extends Flux ...@@ -32,6 +32,8 @@ class AchatMonnaie extends Flux
*/ */
protected $reconverti = false; protected $reconverti = false;
protected $don;
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
...@@ -52,10 +54,15 @@ class AchatMonnaie extends Flux ...@@ -52,10 +54,15 @@ class AchatMonnaie extends Flux
public function getAllOperations($em) public function getAllOperations($em)
{ {
return [ $achatOperations = [
OperationFactory::getOperation($this, $this->getExpediteur(), CurrencyEnum::CURRENCY_EMLC, $this->getMontant()), OperationFactory::getOperation($this, $this->getExpediteur(), CurrencyEnum::CURRENCY_EMLC, $this->getMontant()),
OperationFactory::getOperation($this, $this->getDestinataire(), CurrencyEnum::CURRENCY_EMLC, $this->getMontant()), OperationFactory::getOperation($this, $this->getDestinataire(), CurrencyEnum::CURRENCY_EMLC, $this->getMontant()),
]; ];
if (null != $this->getDon()) {
return array_merge($this->getDon()->getAllOperations($em), $achatOperations);
}
return $achatOperations;
} }
public function operate($em) public function operate($em)
......
...@@ -195,6 +195,7 @@ abstract class AchatMonnaieAConfirmer implements FluxInterface ...@@ -195,6 +195,7 @@ abstract class AchatMonnaieAConfirmer implements FluxInterface
public function setDestinataire($destinataire) public function setDestinataire($destinataire)
{ {
$this->destinataire = $destinataire; $this->destinataire = $destinataire;
return $this; return $this;
} }
......
...@@ -19,6 +19,13 @@ class AchatMonnaieAdherent extends AchatMonnaie ...@@ -19,6 +19,13 @@ class AchatMonnaieAdherent extends AchatMonnaie
protected $destinataire; protected $destinataire;
/** /**
* @var DonAdherent
* @ORM\OneToOne(targetEntity="DonAdherent", cascade={"persist"})
* @ORM\JoinColumn(name="don_id", referencedColumnName="id", nullable=true)
*/
protected $don;
/**
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
...@@ -26,6 +33,28 @@ class AchatMonnaieAdherent extends AchatMonnaie ...@@ -26,6 +33,28 @@ class AchatMonnaieAdherent extends AchatMonnaie
return parent::TYPE_ACHAT_ADHERENT; return parent::TYPE_ACHAT_ADHERENT;
} }
/**
* Get don.
*
* @return DonAdherent
*/
public function getDon(): ?DonAdherent
{
return $this->don;
}
/**
* Set don.
*
* @return $this
*/
public function setDon(?DonAdherent $don)
{
$this->don = $don;
return $this;
}
public function getUsersToNotify() public function getUsersToNotify()
{ {
return [ return [
......
...@@ -19,6 +19,13 @@ class AchatMonnaiePrestataire extends AchatMonnaie ...@@ -19,6 +19,13 @@ class AchatMonnaiePrestataire extends AchatMonnaie
protected $destinataire; protected $destinataire;
/** /**
* @var DonPrestataire
* @ORM\OneToOne(targetEntity="DonPrestataire", cascade={"persist"})
* @ORM\JoinColumn(name="don_id", referencedColumnName="id", nullable=true)
*/
protected $don;
/**
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
...@@ -26,6 +33,28 @@ class AchatMonnaiePrestataire extends AchatMonnaie ...@@ -26,6 +33,28 @@ class AchatMonnaiePrestataire extends AchatMonnaie
return parent::TYPE_ACHAT_PRESTATAIRE; return parent::TYPE_ACHAT_PRESTATAIRE;
} }
/**
* Get don.
*
* @return DonPrestataire
*/
public function getDon(): ?DonPrestataire
{
return $this->don;
}
/**
* Set don.
*
* @return $this
*/
public function setDon(?DonPrestataire $don)
{
$this->don = $don;
return $this;
}
public function getUsersToNotify() public function getUsersToNotify()
{ {
return [ return [
......
...@@ -91,7 +91,8 @@ class Adherent extends AccountableObject implements AccountableInterface ...@@ -91,7 +91,8 @@ class Adherent extends AccountableObject implements AccountableInterface
} }
/** /**
* Get idmlc * Get idmlc.
*
* @return * @return
*/ */
public function getIdmlc(): ?string public function getIdmlc(): ?string
...@@ -100,7 +101,7 @@ class Adherent extends AccountableObject implements AccountableInterface ...@@ -100,7 +101,7 @@ class Adherent extends AccountableObject implements AccountableInterface
} }
/** /**
* Set idmlc * Set idmlc.
* *
* @return $this * @return $this
*/ */
...@@ -193,4 +194,23 @@ class Adherent extends AccountableObject implements AccountableInterface ...@@ -193,4 +194,23 @@ class Adherent extends AccountableObject implements AccountableInterface
return 'Adhérent [' . $this->getId() . ']'; return 'Adhérent [' . $this->getId() . ']';
} }
public function getFullname(): string
{
$return = '';
if (!empty($this->getUser())) {
if (!empty($this->getUser()->getLastname() . $this->getUser()->getFirstname())) {
$return = $this->getUser()->getLastname() . ' ' . $this->getUser()->getFirstname();
if (!empty($this->getUser()->getEmail())) {
$return .= '(' . $this->getUser()->getEmail() . ')';
}
} elseif (!empty($this->getUser()->getEmail())) {
$return = $this->getUser()->getEmail();
}
return $return;
}
return 'Adhérent [' . $this->getId() . ']';
}
} }
...@@ -29,6 +29,8 @@ class Cotisation extends Flux ...@@ -29,6 +29,8 @@ class Cotisation extends Flux
*/ */
protected $cotisationInfos; protected $cotisationInfos;
protected $don;
/** /**
* Constructeur. * Constructeur.
*/ */
...@@ -49,18 +51,22 @@ class Cotisation extends Flux ...@@ -49,18 +51,22 @@ class Cotisation extends Flux
public function getAllOperations($em) public function getAllOperations($em)
{ {
$cotisationOperations = [];
if (MoyenEnum::MOYEN_EMLC == $this->getMoyen()) { if (MoyenEnum::MOYEN_EMLC == $this->getMoyen()) {
return [ $cotisationOperations = [
OperationFactory::getOperation($this, $this->getExpediteur(), CurrencyEnum::CURRENCY_EMLC, -$this->getMontant()), OperationFactory::getOperation($this, $this->getExpediteur(), CurrencyEnum::CURRENCY_EMLC, -$this->getMontant()),
OperationFactory::getOperation($this, $this->getDestinataire(), CurrencyEnum::CURRENCY_EMLC, $this->getMontant()), OperationFactory::getOperation($this, $this->getDestinataire(), CurrencyEnum::CURRENCY_EMLC, $this->getMontant()),
]; ];
} elseif (MoyenEnum::MOYEN_CB == $this->getMoyen()) { } elseif (MoyenEnum::MOYEN_CB == $this->getMoyen() || MoyenEnum::MOYEN_HELLOASSO == $this->getMoyen()) {
return [ $cotisationOperations = [
OperationFactory::getOperation($this, $this->getDestinataire(), CurrencyEnum::CURRENCY_EURO, $this->getMontant()), OperationFactory::getOperation($this, $this->getDestinataire(), CurrencyEnum::CURRENCY_EURO, $this->getMontant()),
]; ];
} }
if (null != $this->getDon()) {
return array_merge($this->getDon()->getAllOperations($em), $cotisationOperations);
}
return []; return $cotisationOperations;
} }
public function operate($em) public function operate($em)
......
...@@ -34,6 +34,13 @@ class CotisationAdherent extends Cotisation ...@@ -34,6 +34,13 @@ class CotisationAdherent extends Cotisation
protected $expediteur; protected $expediteur;
/** /**
* @var DonAdherent
* @ORM\OneToOne(targetEntity="DonAdherent", cascade={"persist"})
* @ORM\JoinColumn(name="don_id", referencedColumnName="id", nullable=true)
*/
protected $don;
/**
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
...@@ -41,6 +48,28 @@ class CotisationAdherent extends Cotisation ...@@ -41,6 +48,28 @@ class CotisationAdherent extends Cotisation
return parent::TYPE_COTISATION_ADHERENT; return parent::TYPE_COTISATION_ADHERENT;
} }
/**
* Get don.
*
* @return DonAdherent
*/
public function getDon(): ?DonAdherent
{
return $this->don;
}
/**
* Set don.
*
* @return $this
*/
public function setDon(?DonAdherent $don)
{
$this->don = $don;
return $this;
}
public function getUsersToNotify() public function getUsersToNotify()
{ {
return [ return [
......
...@@ -35,6 +35,13 @@ class CotisationPrestataire extends Cotisation ...@@ -35,6 +35,13 @@ class CotisationPrestataire extends Cotisation
protected $expediteur; protected $expediteur;
/** /**
* @var DonPrestataire
* @ORM\OneToOne(targetEntity="DonPrestataire", cascade={"persist"})
* @ORM\JoinColumn(name="don_id", referencedColumnName="id", nullable=true)
*/
protected $don;
/**
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
...@@ -42,6 +49,28 @@ class CotisationPrestataire extends Cotisation ...@@ -42,6 +49,28 @@ class CotisationPrestataire extends Cotisation
return parent::TYPE_COTISATION_PRESTATAIRE; return parent::TYPE_COTISATION_PRESTATAIRE;
} }
/**
* Get don.
*
* @return DonPrestataire
*/
public function getDon(): ?DonPrestataire
{
return $this->don;
}
/**
* Set don.
*
* @return $this
*/
public function setDon(?DonPrestataire $don)
{
$this->don = $don;
return $this;
}
public function getUsersToNotify() public function getUsersToNotify()
{ {
return [ return [
......
<?php
namespace App\Entity;
use App\Enum\CurrencyEnum;
use App\Enum\MoyenEnum;
use App\Utils\OperationFactory;
use Doctrine\ORM\Mapping as ORM;
/**
* Don d'un utilisateur.
*
* @ORM\Entity
*/
class Don extends Flux
{
const TYPE_DON_ADHERENT = 'don_adherent';
const TYPE_DON_PRESTATAIRE = 'don_prestataire';
/**
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_dest_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
/**
* Constructeur.
*/
public function __construct()
{
parent::__construct();
}
public static function getAvailableTypes(): array
{
return [
self::TYPE_DON_ADHERENT => self::TYPE_DON_ADHERENT,
self::TYPE_DON_PRESTATAIRE => self::TYPE_DON_PRESTATAIRE,
];
}
public function getAllOperations($em)
{
if (MoyenEnum::MOYEN_MLC == $this->getMoyen()) {
return [
OperationFactory::getOperation($this, $this->getExpediteur(), CurrencyEnum::CURRENCY_EMLC, -$this->getMontant()),
OperationFactory::getOperation($this, $this->getDestinataire(), CurrencyEnum::CURRENCY_EMLC, $this->getMontant()),
];
} elseif (MoyenEnum::MOYEN_CB == $this->getMoyen()) {
return [
OperationFactory::getOperation($this, $this->getDestinataire(), CurrencyEnum::CURRENCY_EURO, $this->getMontant()),
];
}
return [];
}
public function operate($em)
{
if (MoyenEnum::MOYEN_MLC == $this->getMoyen()) {
$compteExp = $this->getExpediteur()->getEcompte() - $this->getMontant();
if ($compteExp < 0) {
throw new \Exception('[FLUX] Opération impossible ! Montant supérieur au solde de monnaie éléctronique !');
} else {
$this->getExpediteur()->removeEcompte($this->getMontant());
$this->getDestinataire()->addEcompte($this->getMontant());
return [$this->getExpediteur(), $this->getDestinataire()];
}
}
// Pas d'opération si la cotisation se fait par CB
return [];
}
public function getUsersToNotify()
{
return [];
}
/**
* @return string
*/
public function getParenttype(): string
{
return parent::TYPE_DON;
}
/**
* @return string
*/
public function getType(): string
{
return '';
}
public function __toString(): string
{
if (empty($this->getDestinataire()) || empty($this->getExpediteur()) || null === $this->getMontant()) {
return '[FLUX] Visualisation impossible ! Destinataire / Expéditeur et/ou montant manquant(s) !';
}
return ucwords(str_replace('_', ' ', $this->getType())) . ' : ' . $this->getExpediteur() . ' : ' . $this->getMontant() . '€' . ($this->getCreatedAt() ? ' (le ' . $this->getCreatedAt()->format('d/m/Y H:i') . ')' : '');
}
}
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Don d'un adhérent.
*
* @ORM\Entity
*/
class DonAdherent extends Don
{
/**
* @ORM\OneToOne(targetEntity="Adherent")
* @ORM\JoinColumn(name="adherent_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @return string
*/
public function getType(): string
{
return parent::TYPE_DON_ADHERENT;
}
public function getUsersToNotify()
{
return [
'expediteurs' => [$this->getExpediteur()->getUser()],
'destinataires' => $this->getDestinataire()->getUsers()->toArray(),
];
}
}
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Don d'un prestataire.
*
* @ORM\Entity
*/
class DonPrestataire extends Don
{
/**
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @return string
*/
public function getType(): string
{
return parent::TYPE_DON_PRESTATAIRE;
}
public function getUsersToNotify()
{
return [
'expediteurs' => $this->getExpediteur()->getUsers()->toArray(),
'destinataires' => $this->getDestinataire()->getUsers()->toArray(),
];
}
}
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/** /**
* @ORM\Entity() * @ORM\Entity()
...@@ -41,7 +40,8 @@ class EmailToken ...@@ -41,7 +40,8 @@ class EmailToken
} }
/** /**
* Get token * Get token.
*
* @return string * @return string
*/ */
public function getToken() public function getToken()
...@@ -50,17 +50,20 @@ class EmailToken ...@@ -50,17 +50,20 @@ class EmailToken
} }
/** /**
* Set token * Set token.
*
* @return $this * @return $this
*/ */
public function setToken($token) public function setToken($token)
{ {
$this->token = $token; $this->token = $token;
return $this; return $this;
} }
/** /**
* Get expiredAt * Get expiredAt.
*
* @return \DateTime * @return \DateTime
*/ */
public function getExpiredAt() public function getExpiredAt()
...@@ -69,17 +72,20 @@ class EmailToken ...@@ -69,17 +72,20 @@ class EmailToken
} }
/** /**
* Set expiredAt * Set expiredAt.
*
* @return $this * @return $this
*/ */
public function setExpiredAt($expiredAt) public function setExpiredAt($expiredAt)
{ {
$this->expiredAt = $expiredAt; $this->expiredAt = $expiredAt;
return $this; return $this;
} }
/** /**
* Get user * Get user.
*
* @return User * @return User
*/ */
public function getUser() public function getUser()
...@@ -88,22 +94,26 @@ class EmailToken ...@@ -88,22 +94,26 @@ class EmailToken
} }
/** /**
* Set user * Set user.
*
* @return $this * @return $this
*/ */
public function setUser(User $user) public function setUser(User $user)
{ {
$this->user = $user; $this->user = $user;
return $this; return $this;
} }
/** /**
* return true if the token is not expired * return true if the token is not expired.
* @return boolean true if valid *
* @return bool true if valid
*/ */
public function isValid() public function isValid()
{ {
$now = new \DateTime(); $now = new \DateTime();
return ($now < $this->expiredAt);
return $now < $this->expiredAt;
} }
} }
...@@ -3,13 +3,12 @@ ...@@ -3,13 +3,12 @@
namespace App\Entity\EntityTrait; namespace App\Entity\EntityTrait;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
trait ContactEmailTelTrait trait ContactEmailTelTrait
{ {
/** /**
* @var null|string * @var string|null
* *
* @ORM\Column(name="tel", type="string", length=20, nullable=true) * @ORM\Column(name="tel", type="string", length=20, nullable=true)
* @Groups({"read", "write"}) * @Groups({"read", "write"})
...@@ -17,7 +16,7 @@ trait ContactEmailTelTrait ...@@ -17,7 +16,7 @@ trait ContactEmailTelTrait
protected $tel; protected $tel;
/** /**
* @var null|string * @var string|null
* *
* @ORM\Column(name="email", type="string", length=100, nullable=true) * @ORM\Column(name="email", type="string", length=100, nullable=true)
* @Groups({"read", "write"}) * @Groups({"read", "write"})
...@@ -32,6 +31,7 @@ trait ContactEmailTelTrait ...@@ -32,6 +31,7 @@ trait ContactEmailTelTrait
public function setTel(?string $tel) public function setTel(?string $tel)
{ {
$this->tel = $tel; $this->tel = $tel;
return $this; return $this;
} }
...@@ -43,6 +43,7 @@ trait ContactEmailTelTrait ...@@ -43,6 +43,7 @@ trait ContactEmailTelTrait
public function setEmail(?string $email) public function setEmail(?string $email)
{ {
$this->email = $email; $this->email = $email;
return $this; return $this;
} }
} }
...@@ -3,13 +3,12 @@ ...@@ -3,13 +3,12 @@
namespace App\Traits; namespace App\Traits;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
trait DeleteableEntityTrait trait DeleteableEntityTrait
{ {
/** /**
* @var \DateTime $deletedAt * @var \DateTime
* *
* @ORM\Column(name="deletedAt", type="datetime", nullable=true) * @ORM\Column(name="deletedAt", type="datetime", nullable=true)
* @Groups({"read", "write"}) * @Groups({"read", "write"})
...@@ -17,7 +16,8 @@ trait DeleteableEntityTrait ...@@ -17,7 +16,8 @@ trait DeleteableEntityTrait
private $deletedAt; private $deletedAt;
/** /**
* Get deletedAt * Get deletedAt.
*
* @return DateTime * @return DateTime
*/ */
public function getDeletedAt() public function getDeletedAt()
...@@ -26,12 +26,14 @@ trait DeleteableEntityTrait ...@@ -26,12 +26,14 @@ trait DeleteableEntityTrait
} }
/** /**
* Set deletedAt * Set deletedAt.
*
* @return $this * @return $this
*/ */
public function setDeletedAt($deletedAt) public function setDeletedAt($deletedAt)
{ {
$this->deletedAt = $deletedAt; $this->deletedAt = $deletedAt;
return $this; return $this;
} }
} }
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
namespace App\Entity\EntityTrait; namespace App\Entity\EntityTrait;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
trait EnablableEntityTrait trait EnablableEntityTrait
{ {
/** /**
* @var boolean * @var bool
* @Assert\Type("bool") * @Assert\Type("bool")
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"read", "write"}) * @Groups({"read", "write"})
...@@ -24,6 +24,7 @@ trait EnablableEntityTrait ...@@ -24,6 +24,7 @@ trait EnablableEntityTrait
public function setEnabled(bool $enabled) public function setEnabled(bool $enabled)
{ {
$this->enabled = $enabled; $this->enabled = $enabled;
return $this; return $this;
} }
} }
...@@ -4,8 +4,6 @@ namespace App\Entity\EntityTrait; ...@@ -4,8 +4,6 @@ namespace App\Entity\EntityTrait;
use App\Entity\Geoloc; use App\Entity\Geoloc;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
trait GeolocEntityTrait trait GeolocEntityTrait
...@@ -26,14 +24,16 @@ trait GeolocEntityTrait ...@@ -26,14 +24,16 @@ trait GeolocEntityTrait
public function setGeoloc(Geoloc $geoloc) public function setGeoloc(Geoloc $geoloc)
{ {
$this->geoloc = $geoloc; $this->geoloc = $geoloc;
return $this; return $this;
} }
public function getFullAddresse() public function getFullAddresse()
{ {
if ($this->geoloc != null) { if (null != $this->geoloc) {
return $this->geoloc->getAdresse().' '.$this->geoloc->getCpostal().' '.$this->geoloc->getVille(); return $this->geoloc->getAdresse() . ' ' . $this->geoloc->getCpostal() . ' ' . $this->geoloc->getVille();
} }
return ''; return '';
} }
} }
...@@ -28,6 +28,9 @@ use Symfony\Component\Validator\Constraints as Assert; ...@@ -28,6 +28,9 @@ use Symfony\Component\Validator\Constraints as Assert;
* "cotisation" = "Cotisation", * "cotisation" = "Cotisation",
* "cotisation_adherent" = "CotisationAdherent", * "cotisation_adherent" = "CotisationAdherent",
* "cotisation_prestataire" = "CotisationPrestataire", * "cotisation_prestataire" = "CotisationPrestataire",
* "don" = "Don",
* "don_adherent" = "DonAdherent",
* "don_prestataire" = "DonPrestataire",
* "retrait" = "Retrait", * "retrait" = "Retrait",
* "ret_cpt_adh" = "RetraitComptoirAdherent", * "ret_cpt_adh" = "RetraitComptoirAdherent",
* "ret_cpt_pre" = "RetraitComptoirPrestataire", * "ret_cpt_pre" = "RetraitComptoirPrestataire",
...@@ -60,6 +63,7 @@ abstract class Flux implements FluxInterface ...@@ -60,6 +63,7 @@ abstract class Flux implements FluxInterface
const TYPE_ACHAT = 'achat'; const TYPE_ACHAT = 'achat';
const TYPE_CHANGE = 'change'; const TYPE_CHANGE = 'change';
const TYPE_COTISATION = 'cotisation'; const TYPE_COTISATION = 'cotisation';
const TYPE_DON = 'don';
const TYPE_RECONVERSION = 'reconversion'; const TYPE_RECONVERSION = 'reconversion';
const TYPE_RETRAIT = 'retrait'; const TYPE_RETRAIT = 'retrait';
const TYPE_TRANSACTION = 'transaction'; const TYPE_TRANSACTION = 'transaction';
......
...@@ -27,6 +27,11 @@ class GlobalParameter ...@@ -27,6 +27,11 @@ class GlobalParameter
const COTISATION_ADHERENT = 'COTISATION_ADHERENT'; const COTISATION_ADHERENT = 'COTISATION_ADHERENT';
const COTISATION_ADHERENT_DEFAULT = 'COTISATION_ADHERENT_DEFAULT'; const COTISATION_ADHERENT_DEFAULT = 'COTISATION_ADHERENT_DEFAULT';
const COTISATION_PRESTATAIRE = 'COTISATION_PRESTATAIRE'; const COTISATION_PRESTATAIRE = 'COTISATION_PRESTATAIRE';
const COTISATION_FREE_AMOUNT = 'COTISATION_FREE_AMOUNT';
const ACCEPT_DON_ADHERENT_COTISATION = 'ACCEPT_DON_ADHERENT_COTISATION';
const ACCEPT_DON_ADHERENT_ACHAT = 'ACCEPT_DON_ADHERENT_ACHAT';
const ACCEPT_DON_PRESTATAIRE_COTISATION = 'ACCEPT_DON_PRESTATAIRE_COTISATION';
const ACCEPT_DON_PRESTATAIRE_ACHAT = 'ACCEPT_DON_PRESTATAIRE_ACHAT';
const RECONVERSION_PRESTATAIRE = 'RECONVERSION_PRESTATAIRE'; const RECONVERSION_PRESTATAIRE = 'RECONVERSION_PRESTATAIRE';
const MAP_CENTER = 'MAP_CENTER'; const MAP_CENTER = 'MAP_CENTER';
const MAP_ZOOM = 'MAP_ZOOM'; const MAP_ZOOM = 'MAP_ZOOM';
...@@ -34,6 +39,17 @@ class GlobalParameter ...@@ -34,6 +39,17 @@ class GlobalParameter
const ALL_TICKETS = 'ALL_TICKETS'; const ALL_TICKETS = 'ALL_TICKETS';
const USE_SOLIDOUME = 'USE_SOLIDOUME'; const USE_SOLIDOUME = 'USE_SOLIDOUME';
const ADHESION_TEXT = 'ADHESION_TEXT'; const ADHESION_TEXT = 'ADHESION_TEXT';
const IBAN_ASSOCIATION = 'IBAN_ASSOCIATION';
const IBAN_GUARANTY = 'IBAN_GUARANTY';
const CHECK_ORDER = 'CHECK_ORDER';
const CHECK_ADDRESS = 'CHECK_ADDRESS';
const USE_HELLOASSO = 'USE_HELLOASSO';
const HELLOASSO_CLIENTID = 'HELLOASSO_CLIENTID';
const HELLOASSO_CLIENTSECRET = 'HELLOASSO_CLIENTSECRET';
const HELLOASSO_URL_EMLC_ADHERENT = 'HELLOASSO_URL_EMLC_ADHERENT';
const HELLOASSO_URL_EMLC_PRESTATAIRE = 'HELLOASSO_URL_EMLC_PRESTATAIRE';
const HELLOASSO_URL_COTISATION_ADHERENT = 'HELLOASSO_URL_COTISATION_ADHERENT';
const HELLOASSO_URL_COTISATION_PRESTATAIRE = 'HELLOASSO_URL_COTISATION_PRESTATAIRE';
/** /**
* @var \Ramsey\Uuid\UuidInterface * @var \Ramsey\Uuid\UuidInterface
......
...@@ -15,7 +15,6 @@ use Gedmo\Timestampable\Traits\TimestampableEntity; ...@@ -15,7 +15,6 @@ use Gedmo\Timestampable\Traits\TimestampableEntity;
use Ramsey\Uuid\Doctrine\UuidGenerator; use Ramsey\Uuid\Doctrine\UuidGenerator;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;
/** /**
* @ApiResource( * @ApiResource(
...@@ -148,7 +147,8 @@ class Groupe extends AccountableObject implements AccountableInterface ...@@ -148,7 +147,8 @@ class Groupe extends AccountableObject implements AccountableInterface
} }
/** /**
* Get idmlc * Get idmlc.
*
* @return * @return
*/ */
public function getIdmlc(): ?string public function getIdmlc(): ?string
...@@ -157,7 +157,7 @@ class Groupe extends AccountableObject implements AccountableInterface ...@@ -157,7 +157,7 @@ class Groupe extends AccountableObject implements AccountableInterface
} }
/** /**
* Set idmlc * Set idmlc.
* *
* @return $this * @return $this
*/ */
......
...@@ -112,7 +112,8 @@ class Groupeprestataire ...@@ -112,7 +112,8 @@ class Groupeprestataire
} }
/** /**
* Get idmlc * Get idmlc.
*
* @return * @return
*/ */
public function getIdmlc(): ?string public function getIdmlc(): ?string
...@@ -121,7 +122,7 @@ class Groupeprestataire ...@@ -121,7 +122,7 @@ class Groupeprestataire
} }
/** /**
* Set idmlc * Set idmlc.
* *
* @return $this * @return $this
*/ */
......
<?php
namespace App\Entity;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Enum\HelloassoStateEnum;
use App\Flux\FluxInterface;
use App\Repository\HelloAssoRepository;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Ramsey\Uuid\Doctrine\UuidGenerator;
/**
* @ORM\Entity(repositoryClass=HelloAssoRepository::class)
* @ORM\Table(name="helloasso")
*/
class HelloAsso
{
use EnablableEntityTrait;
use TimestampableEntity;
/**
* @var \Ramsey\Uuid\UuidInterface
*
* @ORM\Id
* @ORM\Column(type="uuid", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
protected $id;
/**
* @var User
*
* @ORM\ManyToOne(targetEntity="User", cascade={"persist"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
*/
private $user;
/**
* @var Prestataire
*
* @ORM\ManyToOne(targetEntity="Prestataire", cascade={"persist"})
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true)
*/
private $prestataire;
/**
* @ORM\ManyToOne(targetEntity="Adherent", cascade={"persist"})
* @ORM\JoinColumn(name="adherent_id", referencedColumnName="id", nullable=true)
*/
protected $adherent;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $errors;
/**
* HelloAsso data.
*
* @ORM\Column(type="json")
*/
private $data = [];
/**
* @ORM\Column(type="float", nullable=true)
*/
private $amount;
/**
* @ORM\Column(type="string", length=255)
*/
private $type;
/**
* HelloAsso State of data return.
*
* @ORM\Column(type="string", length=255)
*/
private $state;
/**
* HelloAsso State of data return.
*
* @ORM\Column(name="statepayment", type="string", length=255)
*/
private $statePayment;
/**
* HelloAsso PaymentReceiptUrl.
*
* @ORM\Column(name="paymentReceiptUrl", type="text", nullable=true)
*/
private $paymentReceiptUrl;
/**
* @ORM\Column(type="integer")
*/
private $helloassoid;
/**
* @ORM\Column(type="string", length=255)
*/
private $payeremail;
/**
* @ORM\Column(type="string", length=255)
*/
private $payerfirstname;
/**
* @ORM\Column(type="string", length=255)
*/
private $payerlastname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $userfirstname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $userlastname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $useremail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $operationState;
/**
* @ORM\OneToOne(targetEntity=Flux::class)
* @ORM\JoinColumn(name="flux_id", referencedColumnName="id", nullable=true)
*/
protected $flux;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $historical;
public function __construct()
{
$this->setEnabled(false);
$this->setHistorical(false);
}
public function getId()
{
return $this->id;
}
/**
* @return User|null
*/
public function getUser(): ?User
{
return $this->user;
}
/**
* @param User|null $user
*
* @return $this
*/
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/**
* Get prestataire.
*
* @return
*/
public function getPrestataire(): ?Prestataire
{
return $this->prestataire;
}
/**
* Set prestataire.
*
* @param Prestataire $prestataire
*
* @return $this
*/
public function setPrestataire($prestataire): self
{
$this->prestataire = $prestataire;
return $this;
}
/**
* Get adherent.
*
* @return Adherent adherent
*/
public function getAdherent(): ?Adherent
{
return $this->adherent;
}
/**
* Set Adherent.
*
* @param Adherent $adherent
*
* @return $this
*/
public function setAdherent(Adherent $adherent): self
{
$this->adherent = $adherent;
return $this;
}
public function __toString(): string
{
return 'HelloAsso id#' . $this->getId() . ' at:' . ($this->getCreatedAt() ? $this->getCreatedAt()->format('d/m/Y H:i') : '?');
}
public function getErrors(): ?string
{
return $this->errors;
}
public function setErrors(?string $errors): self
{
$this->errors = $errors;
return $this;
}
public function getData(): ?array
{
return $this->data;
}
public function setData(array $data): self
{
$this->data = $data;
return $this;
}
public function getAmount(): ?float
{
return $this->amount;
}
public function setAmount(float $amount): self
{
$this->amount = $amount;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getState(): ?string
{
return $this->state;
}
public function setState(string $state): self
{
$this->state = $state;
return $this;
}
public function getStatePayment(): ?string
{
return $this->statePayment;
}
public function setStatePayment(string $statePayment): self
{
$this->statePayment = $statePayment;
return $this;
}
public function getPaymentReceiptUrl(): ?string
{
return $this->paymentReceiptUrl;
}
public function setPaymentReceiptUrl(string $paymentReceiptUrl): self
{
$this->paymentReceiptUrl = $paymentReceiptUrl;
return $this;
}
public function getHelloassoid(): ?int
{
return $this->helloassoid;
}
public function setHelloassoid(int $helloassoid): self
{
$this->helloassoid = $helloassoid;
return $this;
}
public function getPayeremail(): ?string
{
return $this->payeremail;
}
public function setPayeremail(string $payeremail): self
{
$this->payeremail = $payeremail;
return $this;
}
public function getPayerfirstname(): ?string
{
return $this->payerfirstname;
}
public function setPayerfirstname(string $payerfirstname): self
{
$this->payerfirstname = $payerfirstname;
return $this;
}
public function getPayerlastname(): ?string
{
return $this->payerlastname;
}
public function setPayerlastname(string $payerlastname): self
{
$this->payerlastname = $payerlastname;
return $this;
}
public function getUserfirstname(): ?string
{
return $this->userfirstname;
}
public function setUserfirstname(string $userfirstname): self
{
$this->userfirstname = $userfirstname;
return $this;
}
public function getUserlastname(): ?string
{
return $this->userlastname;
}
public function setUserlastname(string $userlastname): self
{
$this->userlastname = $userlastname;
return $this;
}
public function getUseremail(): ?string
{
return $this->useremail;
}
public function setUseremail(string $useremail): self
{
$this->useremail = $useremail;
return $this;
}
public function getOperationState(): ?string
{
return $this->operationState;
}
public function setOperationState(string $operationState): self
{
if (!in_array($operationState, HelloassoStateEnum::getAvailableTypes())) {
throw new \InvalidArgumentException('Status HelloAsso invalide !');
}
$this->operationState = $operationState;
return $this;
}
/**
* Get flux.
*
* @return
*/
public function getFlux(): ?FluxInterface
{
return $this->flux;
}
/**
* Set flux.
*
* @return $this
*/
public function setFlux(FluxInterface $flux)
{
$this->flux = $flux;
return $this;
}
public function getFullpayer(): ?string
{
return $this->payerlastname . ' ' . $this->payerfirstname . ' (' . $this->payeremail . ')';
}
public function getFulluser(): ?string
{
return $this->userlastname . ' ' . $this->userfirstname . ' (' . $this->useremail . ')';
}
public function getHistorical(): ?bool
{
return $this->historical;
}
public function setHistorical(?bool $historical): self
{
$this->historical = $historical;
return $this;
}
}
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