Commit ef02565c by Julien Jorry

in dev 3 : lot of stuff...

parent eb2195b9
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
###< MAC ### ###< MAC ###
###> symfony/framework-bundle ### ###> symfony/framework-bundle ###
# /.env /.env
/.env.test /.env.test
/.env.local /.env.local
/.env.*.local /.env.*.local
...@@ -34,3 +34,7 @@ yarn-error.log ...@@ -34,3 +34,7 @@ yarn-error.log
/mlc.test-access.log /mlc.test-access.log
/mlc.test-error.log /mlc.test-error.log
###< symfony/webpack-encore-bundle ### ###< symfony/webpack-encore-bundle ###
###> lexik/jwt-authentication-bundle ###
/config/jwt/*.pem
###< lexik/jwt-authentication-bundle ###
...@@ -18,3 +18,6 @@ body { ...@@ -18,3 +18,6 @@ body {
background-color: #e1e3e9; background-color: #e1e3e9;
color: #333; color: #333;
} }
label.required:after {
content: '*';
}
\ No newline at end of file
...@@ -6,7 +6,14 @@ ...@@ -6,7 +6,14 @@
*/ */
// any CSS you require will output into a single css file (app.css in this case) // any CSS you require will output into a single css file (app.css in this case)
// UTILISER LES FONT AWESOME POUR L'ICONOGRAPHIE
require('../../public/fontawesome/css/all.min.css');
// UTILISER LEAFLET POUR LA CARTE
require('../../public/leaflet/leaflet.css');
// CSS DU KOHINOS
require('../css/app.css'); require('../css/app.css');
// THEME BOOTSTRAP / BOOTSWATCH + CONFIGURATION GLOBALE (COULEURS, FONTS...)
require('../css/global.scss'); require('../css/global.scss');
// Need jQuery? Install it with "yarn add jquery", then uncomment to require it. // Need jQuery? Install it with "yarn add jquery", then uncomment to require it.
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"ext-ctype": "*", "ext-ctype": "*",
"ext-iconv": "*", "ext-iconv": "*",
"api-platform/api-pack": "^1.2", "api-platform/api-pack": "^1.2",
"beberlei/doctrineextensions": "^1.2",
"doctrine/annotations": "^1.8", "doctrine/annotations": "^1.8",
"friendsofsymfony/user-bundle": "^2.1", "friendsofsymfony/user-bundle": "^2.1",
"geocoder-php/cache-provider": "^4.1", "geocoder-php/cache-provider": "^4.1",
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
return [ return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
......
api_platform: api_platform:
title: 'API Kohinos'
version: '2.3.0'
enable_fos_user: true enable_fos_user: true
# enable_entrypoint: false
mapping: mapping:
paths: ['%kernel.project_dir%/src/Entity'] paths: ['%kernel.project_dir%/src/Entity']
swagger:
api_keys:
apiKey:
name: API-AUTH-TOKEN
type: header
# Exemple : ##############################
### DEFAULT CONFIGURATION ###
##############################
#
# api_platform:
# # The title of the API.
# title: 'API title'
# # The description of the API.
# description: 'API description'
# # The version of the API.
# version: '0.0.0'
# # Set this to false if you want Webby to disappear.
# show_webby: true
# # Specify a name converter to use.
# name_converter: ~
# # Specify a path name generator to use.
# path_segment_name_generator: 'api_platform.path_segment_name_generator.underscore'
# # Allow using plain IDs for JSON format
# allow_plain_identifiers: false
# validator:
# # Enable the serialization of payload fields when a validation error is thrown
# # If you want to serialize only some payload fields, define them like this [ severity, anotherPayloadField ]
# serialize_payload_fields: []
# eager_loading:
# # To enable or disable eager loading.
# enabled: true
# # Fetch only partial data according to serialization groups.
# # If enabled, Doctrine ORM entities will not work as expected if any of the other fields are used.
# fetch_partial: false
# # Max number of joined relations before EagerLoading throws a RuntimeException.
# max_joins: 30
# # Force join on every relation.
# # If disabled, it will only join relations having the EAGER fetch mode.
# force_eager: true
# # Enable the FOSUserBundle integration.
# enable_fos_user: false
# # Enabling the NelmioApiDocBundle integration has been deprecated in 2.2 and will be removed in 3.0.
# # NelmioApiDocBundle 3 has native support for API Platform
# enable_nelmio_api_doc: false
# # Enable the Swagger documentation and export.
# enable_swagger: true
# # Enable Swagger ui.
# enable_swagger_ui: true
# # Enable ReDoc.
# enable_re_doc: true
# # Enable the entrypoint.
# enable_entrypoint: true
# # Enable the docs.
# enable_docs: true
# # Enable the data collector and the WebProfilerBundle integration.
# enable_profiler: true
# collection:
# # The name of the query parameter to filter nullable results (with the ExistsFilter).
# exists_parameter_name: 'exists'
# # The default order of results.
# order: 'ASC'
# # The name of the query parameter to order results (with the OrderFilter).
# order_parameter_name: 'order'
# pagination:
# # To enable or disable pagination for all resource collections by default.
# enabled: true
# # To allow partial pagination for all resource collections.
# # This improves performances by skipping the `COUNT` query.
# partial: false
# # To allow the client to enable or disable the pagination.
# client_enabled: false
# # To allow the client to set the number of items per page.
# client_items_per_page: false
# # To allow the client to enable or disable the partial pagination.
# client_partial: false
# # The default number of items per page.
# items_per_page: 30
# # The maximum number of items per page.
# maximum_items_per_page: ~
# # The default name of the parameter handling the page number.
# page_parameter_name: 'page'
# # The name of the query parameter to enable or disable pagination.
# enabled_parameter_name: 'pagination'
# # The name of the query parameter to set the number of items per page.
# items_per_page_parameter_name: 'itemsPerPage'
# # The name of the query parameter to enable or disable the partial pagination.
# partial_parameter_name: 'partial'
# mapping:
# # The list of paths with files or directories where the bundle will look for additional resource files.
# paths: []
# # The list of your resources class directories. Defaults to the directories of the mapping paths but might differ.
# resource_class_directories:
# - '%kernel.project_dir%/src/Entity'
# doctrine:
# # To enable or disable Doctrine ORM support.
# enabled: true
# doctrine_mongodb_odm:
# # To enable or disable Doctrine MongoDB ODM support.
# enabled: false
# oauth:
# # To enable or disable oauth.
# enabled: false
# # The oauth client id.
# clientId: ''
# # The oauth client secret.
# clientSecret: ''
# # The oauth type.
# type: 'oauth2'
# # The oauth flow grant type.
# flow: 'application'
# # The oauth token url.
# tokenUrl: '/oauth/v2/token'
# # The oauth authentication url.
# authorizationUrl: '/oauth/v2/auth'
# # The oauth scopes.
# scopes: []
# graphql:
# # Enabled by default with installed GraphQL
# enabled: false
# # The default IDE (graphiql or graphql-playground) used when going to the GraphQL endpoint. False to disable.
# default_ide: 'graphiql'
# graphiql:
# # Enabled by default with installed GraphQL and Twig
# enabled: false
# graphql_playground:
# # Enabled by default with installed GraphQL and Twig
# enabled: false
# # The nesting separator used in the filter names.
# nesting_separator: _
# collection:
# pagination:
# enabled: true
# swagger:
# # The active versions of OpenAPI to be exported or used in the swagger_ui. The first value is the default.
# versions: [2, 3]
# # The swagger api keys.
# api_keys: []
# # The name of the header or query parameter containing the api key.
# # name: ''
# # Whether the api key should be a query parameter or a header.
# # type: 'query' or 'header'
# http_cache:
# # Automatically generate etags for API responses.
# etag: true
# # Default value for the response max age.
# max_age: 3600
# # Default value for the response shared (proxy) max age.
# shared_max_age: 3600
# # Default values of the "Vary" HTTP header.
# vary: ['Accept']
# # To make all responses public by default.
# public: ~
# invalidation:
# # To enable the tags-based cache invalidation system.
# enabled: false
# # URLs of the Varnish servers to purge using cache tags when a resource is updated.
# varnish_urls: []
# # To pass options to the client charged with the request.
# request_options: []
# mercure:
# # Enabled by default with installed GraphQL
# enabled: false
# # The URL sent in the Link HTTP header. If not set, will default to the URL for MercureBundle's default hub.
# hub_url: null
# messenger:
# # Enabled by default with installed symfony/messenger and not installed symfony/symfony
# enabled: false
# elasticsearch:
# # To enable or disable Elasticsearch support.
# enabled: false
# # The hosts to the Elasticsearch nodes.
# hosts: []
# # The mapping between resource classes and indexes.
# mapping: []
# # The list of exceptions mapped to their HTTP status code.
# exception_to_status:
# # With a status code.
# Symfony\Component\Serializer\Exception\ExceptionInterface: 400
# # Or with a constant defined in the 'Symfony\Component\HttpFoundation\Response' class.
# ApiPlatform\Core\Exception\InvalidArgumentException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST
# ApiPlatform\Core\Exception\FilterValidationException: 400
# Doctrine\ORM\OptimisticLockException: 409
# # ...
# # The list of enabled formats. The first one will be the default.
# formats:
# jsonld:
# mime_types: ['application/ld+json']
# json:
# mime_types: ['application/json']
# html:
# mime_types: ['text/html']
# # ...
# # The list of enabled patch formats. The first one will be the default.
# patch_formats: []
# # The list of enabled error formats. The first one will be the default.
# error_formats:
# jsonproblem:
# mime_types: ['application/problem+json']
# jsonld:
# mime_types: ['application/ld+json']
# # ...
# Exemples :
# App\Entity\Book: # App\Entity\Book:
# itemOperations: # itemOperations:
# get: # get:
......
# 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: ['me@example.com'] delivery_addresses: ['julien.jorry@gmail.com']
...@@ -36,6 +36,11 @@ doctrine: ...@@ -36,6 +36,11 @@ doctrine:
dql: dql:
string_functions: string_functions:
str_to_date: App\DQL\StrToDate str_to_date: App\DQL\StrToDate
numeric_functions:
acos: DoctrineExtensions\Query\Mysql\Acos
cos: DoctrineExtensions\Query\Mysql\Cos
radians: DoctrineExtensions\Query\Mysql\Radians
sin: DoctrineExtensions\Query\Mysql\Sin
filters: filters:
softdeleteable: softdeleteable:
class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
......
...@@ -3,8 +3,8 @@ fos_user: ...@@ -3,8 +3,8 @@ fos_user:
firewall_name: main firewall_name: main
user_class: App\Entity\User user_class: App\Entity\User
from_email: from_email:
address: noreply@doume.org address: noreply@kohinos.fr
sender_name: Doume sender_name: Kohinos
service: service:
mailer: fos_user.mailer.twig_swift mailer: fos_user.mailer.twig_swift
user_manager: sonata.user.orm.user_manager user_manager: sonata.user.orm.user_manager
......
# Optional! # Optional!
nelmio_api_doc: # nelmio_api_doc:
# models: { use_jms: true } # # models: { use_jms: true }
documentation: # documentation:
info: # info:
title: MLC # title: MLC
description: Application de gesiton de Monnaie Locale Complémentaire # description: Application de gesiton de Monnaie Locale Complémentaire
version: 2.3.0 # version: 2.3.0
security_definitions: # security_definitions:
api_key: # api_key:
type: apiKey # type: apiKey
name: api_key # name: api_key
in: header # in: header
security: # security:
api_key: [] # api_key: []
areas: # to filter documented areas # areas: # to filter documented areas
path_patterns: # an array of regexps # path_patterns: # an array of regexps
- ^/api(?!/doc$) # - ^/api(?!/doc$)
# host_patterns: # # host_patterns:
# - ^api\. # # - ^api\.
\ No newline at end of file \ No newline at end of file
...@@ -41,7 +41,7 @@ monolog: ...@@ -41,7 +41,7 @@ monolog:
handler: swift_critical handler: swift_critical
swift_critical: swift_critical:
type: swift_mailer type: swift_mailer
from_email: debug@doume.org from_email: noreply@kohinos.fr
to_email: [julien.jorry@gmail.com, stephan@gelberger.com] to_email: [julien.jorry@gmail.com, stephan@gelberger.com]
subject: "MLC : PHP Error !" subject: "MLC : PHP Error !"
level: info level: info
...@@ -33,6 +33,8 @@ security: ...@@ -33,6 +33,8 @@ security:
entity: entity:
class: App\Entity\User class: App\Entity\User
property: username property: username
api_key_user_provider:
id: App\Security\ApiKeyUserProvider
firewalls: firewalls:
dev: dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/ pattern: ^/(_(profiler|wdt)|css|images|js)/
...@@ -56,6 +58,34 @@ security: ...@@ -56,6 +58,34 @@ security:
# context: mlc_context # context: mlc_context
# access_denied_handler: App\Security\AccessDeniedHandler # access_denied_handler: App\Security\AccessDeniedHandler
# -> end custom configuration # -> end custom configuration
# login:
# pattern: ^/api/login
# stateless: true
# anonymous: true
# provider: api_key_user_provider
# form_login:
# check_path: /api/login_check
# success_handler: lexik_jwt_authentication.handler.authentication_success
# failure_handler: lexik_jwt_authentication.handler.authentication_failure
# require_previous_session: false
# api:
# pattern: ^/api/
# stateless: true
# anonymous: true
# provider: api_key_user_provider
# guard:
# authenticators:
# - lexik_jwt_authentication.jwt_token_authenticator
api:
pattern: ^/api
stateless: true
# can be set to false to disabled API doc available for anonymous user !
anonymous: true
guard:
authenticators:
- App\Security\ApiKeyAuthenticator
provider: api_key_user_provider
main: main:
pattern: ^/ pattern: ^/
form_login: form_login:
...@@ -83,19 +113,17 @@ security: ...@@ -83,19 +113,17 @@ security:
switch_user: switch_user:
provider: fos_userbundle provider: fos_userbundle
# access_denied_handler: App\Security\AccessDeniedHandler # access_denied_handler: App\Security\AccessDeniedHandler
api:
pattern: ^/api
stateless: true
anonymous: false
provider: entity_provider
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
encoders: encoders:
FOS\UserBundle\Model\UserInterface: bcrypt # FOS\UserBundle\Model\UserInterface: bcrypt
FOS\UserBundle\Model\UserInterface:
# Use native password encoder
# This value auto-selects the best possible hashing algorithm
# (i.e. Sodium when available).
algorithm: auto
role_hierarchy: role_hierarchy:
ROLE_API: ROLE_USER
ROLE_ADHERENT: ROLE_USER ROLE_ADHERENT: ROLE_USER
ROLE_PRESTATAIRE: ROLE_USER ROLE_PRESTATAIRE: ROLE_USER
ROLE_ADMIN_SIEGE: [ROLE_USER, ROLE_ADMIN] ROLE_ADMIN_SIEGE: [ROLE_USER, ROLE_ADMIN]
...@@ -106,11 +134,14 @@ security: ...@@ -106,11 +134,14 @@ security:
ROLE_COMPTOIR: [ROLE_USER, ROLE_ADMIN] ROLE_COMPTOIR: [ROLE_USER, ROLE_ADMIN]
ROLE_CONTACT: [ROLE_USER, ROLE_ADMIN] ROLE_CONTACT: [ROLE_USER, ROLE_ADMIN]
ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN] ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH, ROLE_API]
# Easy way to control access for large sections of your site # Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used # Note: Only the *first* access control that matches will be used
access_control: access_control:
#
# @TODO : better access control !
#
# Admin login page needs to be accessed without credential # Admin login page needs to be accessed without credential
# - { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } # - { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
# - { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY } # - { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
...@@ -124,6 +155,7 @@ security: ...@@ -124,6 +155,7 @@ security:
# Change these rules to adapt them to your needs # Change these rules to adapt them to your needs
# - { path: ^/admin/, role: [ROLE_SUPER_ADMIN, ROLE_SONATA_ADMIN, ROLE_ADMIN_SIEGE, ROLE_REDACTEUR, ROLE_TRESORIER, ROLE_CONTROLEUR, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT] } # - { path: ^/admin/, role: [ROLE_SUPER_ADMIN, ROLE_SONATA_ADMIN, ROLE_ADMIN_SIEGE, ROLE_REDACTEUR, ROLE_TRESORIER, ROLE_CONTROLEUR, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT] }
- { path: ^/admin/, role: [ROLE_ADMIN] } - { path: ^/admin/, role: [ROLE_ADMIN] }
- { path: ^/api, roles: IS_AUTHENTICATED_FULLY } # Bottom line can be uncommented to disabled API doc available for anonymous user !
# - { path: '^/api', roles: ROLE_API }
- { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
...@@ -4,7 +4,7 @@ sonata_admin: ...@@ -4,7 +4,7 @@ sonata_admin:
handler: app.security.handler.role handler: app.security.handler.role
role_admin: ROLE_ADMIN role_admin: ROLE_ADMIN
role_super_admin: ROLE_SUPER_ADMIN role_super_admin: ROLE_SUPER_ADMIN
title: 'MLC Admin' title: 'Admin'
title_logo: /images/logo.png title_logo: /images/logo.png
# Pour modifier l'image par défaut sur la vue "Mosaique" de l'administration # Pour modifier l'image par défaut sur la vue "Mosaique" de l'administration
# options: # options:
...@@ -51,9 +51,10 @@ sonata_admin: ...@@ -51,9 +51,10 @@ sonata_admin:
# The default stylesheet list: # The default stylesheet list:
# - build/app.css # - build/app.css
- bundles/sonatacore/vendor/bootstrap/dist/css/bootstrap.min.css - bundles/sonatacore/vendor/bootstrap/dist/css/bootstrap.min.css
- fontawesome/css/fontawesome.min.css - bundles/sonatacore/vendor/components-font-awesome/css/font-awesome.min.css
- fontawesome/css/solid.css # - fontawesome/css/fontawesome.min.css
- fontawesome/css/brands.css # - fontawesome/css/solid.css
# - fontawesome/css/brands.css
# - public/fontawesome/css/v4-shims.css # - public/fontawesome/css/v4-shims.css
- bundles/sonatacore/vendor/ionicons/css/ionicons.min.css - bundles/sonatacore/vendor/ionicons/css/ionicons.min.css
- bundles/sonataadmin/vendor/admin-lte/dist/css/AdminLTE.min.css - bundles/sonataadmin/vendor/admin-lte/dist/css/AdminLTE.min.css
...@@ -197,7 +198,7 @@ sonata_admin: ...@@ -197,7 +198,7 @@ sonata_admin:
keep_open: false keep_open: false
label: "Prestataires" label: "Prestataires"
label_catalogue: SonataAdminBundle label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-user-tie"></i>' icon: '<i class="fa fa-shopping-basket"></i>'
items: items:
- route: prestataire_create - route: prestataire_create
label: Ajouter label: Ajouter
...@@ -211,7 +212,7 @@ sonata_admin: ...@@ -211,7 +212,7 @@ sonata_admin:
on_top: true on_top: true
label: "Groupes locaux" label: "Groupes locaux"
label_catalogue: SonataAdminBundle label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-chess-rook"></i>' icon: '<i class="fa fa-object-group"></i>'
items: items:
- admin.groupe.gerer - admin.groupe.gerer
sonata.admin.group.comptoir: sonata.admin.group.comptoir:
...@@ -225,7 +226,7 @@ sonata_admin: ...@@ -225,7 +226,7 @@ sonata_admin:
keep_open: false keep_open: false
label: "Flux" label: "Flux"
label_catalogue: SonataAdminBundle label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-euro-sign"></i>' icon: '<i class="fa fa-euro"></i>'
items: items:
- admin.flux.gerer - admin.flux.gerer
- admin.all.cotisations - admin.all.cotisations
...@@ -245,7 +246,7 @@ sonata_admin: ...@@ -245,7 +246,7 @@ sonata_admin:
on_top: true on_top: true
label: "Actualités" label: "Actualités"
label_catalogue: SonataAdminBundle label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-newspaper"></i>' icon: '<i class="fa fa-newspaper-o"></i>'
items: items:
- admin.news.gerer - admin.news.gerer
sonata.admin.group.document: sonata.admin.group.document:
...@@ -261,7 +262,7 @@ sonata_admin: ...@@ -261,7 +262,7 @@ sonata_admin:
on_top: true on_top: true
label: "Pages" label: "Pages"
label_catalogue: SonataAdminBundle label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-pager"></i>' icon: '<i class="fa fa-file-image-o"></i>'
items: items:
- admin.page.gerer - admin.page.gerer
sonata.admin.group.faq: sonata.admin.group.faq:
......
...@@ -22,17 +22,11 @@ lexik_translation_edition: ...@@ -22,17 +22,11 @@ lexik_translation_edition:
resource: "@LexikTranslationBundle/Resources/config/routing.yml" resource: "@LexikTranslationBundle/Resources/config/routing.yml"
prefix: /admin prefix: /admin
authentication_token:
path: /api/authentication_token
methods: ['POST']
app.swagger_ui: app.swagger_ui:
path: /api/doc path: /api/doc
methods: GET methods: GET
defaults: { _controller: nelmio_api_doc.controller.swagger_ui } defaults: { _controller: nelmio_api_doc.controller.swagger_ui }
# sonata_api_user:
# type: rest
# prefix: /api/user
# resource: "@SonataUserBundle/Resources/config/routing/api.xml"
# sonata_api_media:
# type: rest
# prefix: /api/media
# resource: "@SonataMediaBundle/Resources/config/routing/api.xml"
\ No newline at end of file
...@@ -84,7 +84,7 @@ services: ...@@ -84,7 +84,7 @@ services:
app.twig.main.extension: app.twig.main.extension:
class: App\Twig\AppExtension class: App\Twig\AppExtension
autowire: false autowire: false
arguments: ["@service_container", "@doctrine.orm.entity_manager", "@knp_paginator", "@session", "@app.rolecheck"] arguments: ["@service_container", "@security.helper", "@doctrine.orm.entity_manager", "@knp_paginator", "@session", "@app.rolecheck"]
app.twig.mlc.globals.extension: app.twig.mlc.globals.extension:
class: App\Twig\MlcGlobalsExtension class: App\Twig\MlcGlobalsExtension
...@@ -155,6 +155,9 @@ services: ...@@ -155,6 +155,9 @@ services:
arguments: arguments:
- '@security.authorization_checker' - '@security.authorization_checker'
- [ROLE_SUPER_ADMIN] - [ROLE_SUPER_ADMIN]
calls:
- [setManager, ['@doctrine.orm.entity_manager']]
- [setRolecheck, ['@app.rolecheck']]
admin.block.dashboard: admin.block.dashboard:
class: App\Block\DashboardKohinosBlock class: App\Block\DashboardKohinosBlock
...@@ -181,6 +184,7 @@ services: ...@@ -181,6 +184,7 @@ services:
calls: calls:
- [ setUserManager, ['@fos_user.user_manager']] - [ setUserManager, ['@fos_user.user_manager']]
- [ setSecurity, ['@security.helper']] - [ setSecurity, ['@security.helper']]
- [ setEventDispatcher, ['@event_dispatcher']]
admin.all.cotisations: admin.all.cotisations:
class: App\Admin\CotisationAdmin class: App\Admin\CotisationAdmin
...@@ -193,6 +197,7 @@ services: ...@@ -193,6 +197,7 @@ services:
public: true public: true
calls: calls:
- [ setSecurity, ['@security.helper']] - [ setSecurity, ['@security.helper']]
- [ setRoleCheck, ['@app.rolecheck']]
admin.adherent.cotisations: admin.adherent.cotisations:
class: App\Admin\CotisationAdherentAdmin class: App\Admin\CotisationAdherentAdmin
...@@ -205,6 +210,7 @@ services: ...@@ -205,6 +210,7 @@ services:
public: true public: true
calls: calls:
- [ setSecurity, ['@security.helper']] - [ setSecurity, ['@security.helper']]
- [ setRoleCheck, ['@app.rolecheck']]
admin.prestataire.gerer: admin.prestataire.gerer:
class: App\Admin\PrestataireAdmin class: App\Admin\PrestataireAdmin
...@@ -232,6 +238,7 @@ services: ...@@ -232,6 +238,7 @@ services:
public: true public: true
calls: calls:
- [ setSecurity, ['@security.helper']] - [ setSecurity, ['@security.helper']]
- [ setRoleCheck, ['@app.rolecheck']]
admin.groupe.gerer: admin.groupe.gerer:
class: App\Admin\GroupeAdmin class: App\Admin\GroupeAdmin
...@@ -447,3 +454,8 @@ services: ...@@ -447,3 +454,8 @@ services:
arguments: ["@session"] arguments: ["@session"]
tags: tags:
- { name: kernel.event_listener, event: kernel.response } - { name: kernel.event_listener, event: kernel.response }
App\Swagger\SwaggerDecorator:
decorates: 'api_platform.swagger.normalizer.api_gateway'
arguments: [ '@App\Swagger\SwaggerDecorator.inner' ]
autoconfigure: false
...@@ -246,6 +246,100 @@ Prodigious\Sonata\MenuBundle\Entity\MenuItem: ...@@ -246,6 +246,100 @@ Prodigious\Sonata\MenuBundle\Entity\MenuItem:
target: 0 target: 0
enabled: 1 enabled: 1
# App\Application\Sonata\ClassificationBundle\Entity\Context:
# context1:
# id: actualites
# name: Actualites
# enabled: true
# context2:
# id: comptoir
# name: Comptoir
# enabled: true
# context3:
# id: default
# name: Default
# enabled: true
# context4:
# id: document
# name: Document
# enabled: true
# context5:
# id: faq
# name: Faq
# enabled: true
# context6:
# id: groupe
# name: Groupe
# enabled: true
# context7:
# id: import
# name: Import
# enabled: true
# context8:
# id: prestataire
# name: Prestataire
# enabled: true
# context9:
# id: rubrique
# name: Rubrique
# enabled: true
# App\Application\Sonata\ClassificationBundle\Entity\Category:
# mediacat1:
# context: '@context3'
# name: Default
# enabled: true
# slug: default
# description: Default
# mediacat2:
# context: '@context1'
# name: Actualites
# enabled: true
# slug: actualites
# description: Actualites
# mediacat3:
# context: '@context4'
# name: Document
# enabled: true
# slug: document
# description: Document
# mediacat4:
# context: '@context7'
# name: Import
# enabled: true
# slug: import
# description: Import
# mediacat5:
# context: '@context2'
# name: Comptoir
# enabled: true
# slug: comptoir
# description: Comptoir
# mediacat6:
# context: '@context6'
# name: Groupe
# enabled: true
# slug: groupe
# description: Groupe
# mediacat7:
# context: '@context9'
# name: Rubrique
# enabled: true
# slug: rubrique
# description: Rubrique
# mediacat8:
# context: '@context8'
# name: Prestataire
# enabled: true
# slug: prestataire
# description: Prestataire
# mediacat9:
# context: '@context5'
# name: Faq
# enabled: true
# slug: faq
# description: Faq
App\Application\Sonata\MediaBundle\Entity\Media: App\Application\Sonata\MediaBundle\Entity\Media:
media6: media6:
name: 'wosmpl-marker-icon17-produits-de-lagriculture-et-elevage.png' name: 'wosmpl-marker-icon17-produits-de-lagriculture-et-elevage.png'
...@@ -607,7 +701,6 @@ App\Entity\Rubrique: ...@@ -607,7 +701,6 @@ App\Entity\Rubrique:
enabled: true enabled: true
media: '@media17' media: '@media17'
# Rubrique de la doume # Rubrique de la doume
# App\Entity\Rubrique: # App\Entity\Rubrique:
# rubrique1: # rubrique1:
......
...@@ -16,8 +16,8 @@ App\Entity\GlobalParameter: ...@@ -16,8 +16,8 @@ App\Entity\GlobalParameter:
value: '0' value: '0'
mandatory: 1 mandatory: 1
gp2: gp2:
name: "MLC_TITLE" name: "USE_WORDPRESS"
value: 'KOHINOS : Outil de gestion de monnaie locale complémentaire' value: 'false'
mandatory: 1 mandatory: 1
gp3: gp3:
name: "MLC_NAME" name: "MLC_NAME"
...@@ -32,25 +32,17 @@ App\Entity\GlobalParameter: ...@@ -32,25 +32,17 @@ App\Entity\GlobalParameter:
value: "emaildenvoidesnotifications@votredomaine.fr" value: "emaildenvoidesnotifications@votredomaine.fr"
mandatory: 1 mandatory: 1
gp6: gp6:
name: "MLC_CONTACT_EMAIL"
value: "emaildereceptiondesdemandesdecontact@votredomaine.fr"
mandatory: 1
gp7:
name: "MAP_CENTER" name: "MAP_CENTER"
value: '<(strtolower("[45.7,3.2]"))>' value: '<(strtolower("[45.7,3.2]"))>'
mandatory: 1 mandatory: 1
gp7: gp8:
name: "MAP_ZOOM" name: "MAP_ZOOM"
value: '9' value: '9'
mandatory: 1 mandatory: 1
# gp8:
# name: "FAVICON_URL"
# value: '/images/favicon.png'
# mandatory: 1
gp9:
name: "MLC_DESCRIPTION"
value: 'Kohinos : outil de gestion de monnaie locale'
mandatory: 1
gp10:
name: "MLC_KEYWORDS"
value: 'kohinos, mlc, mlcc, monnaie, locale, complémentaire, monnaie locale'
mandatory: 1
App\Entity\Siege: App\Entity\Siege:
siege_1: siege_1:
...@@ -61,29 +53,29 @@ App\Entity\Siege: ...@@ -61,29 +53,29 @@ App\Entity\Siege:
App\Entity\Groupe: App\Entity\Groupe:
groupe{1..10}: groupe{1..10}:
name: '<text(10)>' name (unique): '<text(10)>'
content: '<text(200)>' content: '<text(200)>'
compte: '<randomFloat(2, 1000, 2000)>' compte: '<randomFloat(2, 1000, 2000)>'
siege: '@siege_1' siege: '@siege_1'
App\Entity\Geoloc: App\Entity\Geoloc:
geoloc{1..70}: geoloc{1..50}:
adresse: '<streetAddress()>' adresse: '<streetAddress()>'
cpostal: <postcode()> cpostal: <postcode()>
ville: '<city()>' ville: '<city()>'
lat: '<randomFloat(6, 45, 46)>' lat: '<randomFloat(6, 45.75, 45.82)>'
lon: '<randomFloat(6, 2, 5)>' lon: '<randomFloat(6, 3.03, 3.18)>'
enabled: true enabled: true
App\Entity\Comptoir: App\Entity\Comptoir:
comptoir{1..50}: comptoir{1..10}:
name: '<text(10)>' name (unique): '<text(10)>'
enabled: true enabled: true
tel: '<phoneNumber()>' tel: '<phoneNumber()>'
email: '<email()>' email: '<email()>'
compte: '<randomFloat(2, 1000, 2000)>' compte: '<randomFloat(2, 1000, 2000)>'
groupe: '@groupe<numberBetween(1,10)>' groupe: '@groupe<numberBetween(1,10)>'
geoloc (unique): '@geoloc<numberBetween(1,70)>' geoloc (unique): '@geoloc<numberBetween(5,15)>'
App\Entity\Groupeprestataire: App\Entity\Groupeprestataire:
grppresta1: grppresta1:
...@@ -91,26 +83,31 @@ App\Entity\Groupeprestataire: ...@@ -91,26 +83,31 @@ App\Entity\Groupeprestataire:
type: 'amap' type: 'amap'
horaires: 'Tous les Jeudis de 12h à 14h' horaires: 'Tous les Jeudis de 12h à 14h'
groupe: '@groupe1' groupe: '@groupe1'
geoloc: '@geoloc1'
grppresta2: grppresta2:
name: 'AMAP de test 2' name: 'AMAP de test 2'
type: 'amap' type: 'amap'
horaires: 'Tous les Mercredis de 12h à 14h' horaires: 'Tous les Mercredis de 12h à 14h'
groupe: '@groupe2' groupe: '@groupe2'
geoloc: '@geoloc2'
grppresta3: grppresta3:
name: 'Marché de test' name: 'Marché de test'
type: 'marche' type: 'marche'
horaires: 'Tous les Dimanches de 8h à 12h' horaires: 'Tous les Dimanches de 8h à 12h'
groupe: '@groupe1' groupe: '@groupe1'
geoloc: '@geoloc3'
grppresta4: grppresta4:
name: 'Marché de test 2' name: 'Marché de test 2'
type: 'marche' type: 'marche'
horaires: 'Tous les 1er Dimanches du mois de 8h à 12h et de 18h à 20h' horaires: 'Tous les 1er Dimanches du mois de 8h à 12h et de 18h à 20h'
groupe: '@groupe3' groupe: '@groupe3'
geoloc: '@geoloc4'
App\Entity\Adherent: App\Entity\Adherent:
adherent{1..11}: adherent{1..11}:
ecompte: '<randomFloat(2, 1000, 2000)>' ecompte: '<randomFloat(2, 1000, 2000)>'
groupe: '@groupe<numberBetween(1, 10)>' groupe: '@groupe<numberBetween(1, 10)>'
# enabled: true
# user (unique): '@user<numberBetween(1,10)>' # user (unique): '@user<numberBetween(1,10)>'
App\Entity\Prestataire: App\Entity\Prestataire:
...@@ -171,7 +168,7 @@ App\Entity\Prestataire: ...@@ -171,7 +168,7 @@ App\Entity\Prestataire:
App\Entity\GeolocPrestataire: App\Entity\GeolocPrestataire:
geolocp{1..32}: geolocp{1..32}:
name: <text(10)> name: <text(10)>
geoloc (unique): '@geoloc<numberBetween(1,70)>' geoloc (unique): '@geoloc<numberBetween(16,50)>'
prestataire: '@prestataire<current()>' prestataire: '@prestataire<current()>'
enabled: true enabled: true
...@@ -245,7 +242,7 @@ App\Entity\User: ...@@ -245,7 +242,7 @@ App\Entity\User:
roles: ['ROLE_SUPER_ADMIN', 'ROLE_PRESTATAIRE'] roles: ['ROLE_SUPER_ADMIN', 'ROLE_PRESTATAIRE']
usercontact: usercontact:
username: 'user_contact' username: 'user_contact'
email: 'contact@doume.test' email: 'contact@kohinos.test'
plainPassword: 'test' plainPassword: 'test'
enabled: true enabled: true
groups: ['@usergroup_contact'] groups: ['@usergroup_contact']
...@@ -253,7 +250,7 @@ App\Entity\User: ...@@ -253,7 +250,7 @@ App\Entity\User:
groupesgeres: ['@groupe1'] groupesgeres: ['@groupe1']
usercomptoir: usercomptoir:
username: 'user_comptoir' username: 'user_comptoir'
email: 'comptoir@doume.test' email: 'comptoir@kohinos.test'
plainPassword: 'test' plainPassword: 'test'
enabled: true enabled: true
groups: ['@usergroup_comptoir'] groups: ['@usergroup_comptoir']
...@@ -261,7 +258,7 @@ App\Entity\User: ...@@ -261,7 +258,7 @@ App\Entity\User:
comptoirsgeres: ['@comptoir1'] comptoirsgeres: ['@comptoir1']
usergestiongroupe: usergestiongroupe:
username: 'user_gestiongroupe' username: 'user_gestiongroupe'
email: 'groupe@doume.test' email: 'groupe@kohinos.test'
plainPassword: 'test' plainPassword: 'test'
enabled: true enabled: true
groups: ['@usergroup_gestiongroupe'] groups: ['@usergroup_gestiongroupe']
...@@ -269,35 +266,35 @@ App\Entity\User: ...@@ -269,35 +266,35 @@ App\Entity\User:
groupesgeres: ['@groupe1'] groupesgeres: ['@groupe1']
usertresorier: usertresorier:
username: 'user_tresorier' username: 'user_tresorier'
email: 'tresorier@doume.test' email: 'tresorier@kohinos.test'
plainPassword: 'test' plainPassword: 'test'
enabled: true enabled: true
groups: ['@usergroup_tresorier'] groups: ['@usergroup_tresorier']
roles: ['ROLE_TRESORIER'] roles: ['ROLE_TRESORIER']
userredacteur: userredacteur:
username: 'user_redacteur' username: 'user_redacteur'
email: 'redacteur@doume.test' email: 'redacteur@kohinos.test'
plainPassword: 'test' plainPassword: 'test'
enabled: true enabled: true
groups: ['@usergroup_redacteur'] groups: ['@usergroup_redacteur']
roles: ['ROLE_REDACTEUR'] roles: ['ROLE_REDACTEUR']
usercontroleur: usercontroleur:
username: 'user_controleur' username: 'user_controleur'
email: 'controleur@doume.test' email: 'controleur@kohinos.test'
plainPassword: 'test' plainPassword: 'test'
enabled: true enabled: true
groups: ['@usergroup_controleur'] groups: ['@usergroup_controleur']
roles: ['ROLE_CONTROLEUR'] roles: ['ROLE_CONTROLEUR']
useradminsiege: useradminsiege:
username: 'user_adminsiege' username: 'user_adminsiege'
email: 'siege@doume.test' email: 'siege@kohinos.test'
plainPassword: 'test' plainPassword: 'test'
enabled: true enabled: true
groups: ['@usergroup_adminsiege'] groups: ['@usergroup_adminsiege']
roles: ['ROLE_ADMIN_SIEGE'] roles: ['ROLE_ADMIN_SIEGE']
userprestataire: userprestataire:
username: 'user_prestataire' username: 'user_prestataire'
email: 'prestataire@doume.test' email: 'prestataire@kohinos.test'
plainPassword: 'test' plainPassword: 'test'
enabled: true enabled: true
groups: ['@usergroup_prestataire'] groups: ['@usergroup_prestataire']
...@@ -308,7 +305,7 @@ App\Entity\User: ...@@ -308,7 +305,7 @@ App\Entity\User:
lastname: 'lastname adherent' lastname: 'lastname adherent'
phone: '012345789' phone: '012345789'
username: 'user_adherent' username: 'user_adherent'
email: 'adherent@doume.test' email: 'adherent@kohinos.test'
plainPassword: 'test' plainPassword: 'test'
enabled: true enabled: true
groups: ['@usergroup_adherent'] groups: ['@usergroup_adherent']
...@@ -330,148 +327,167 @@ App\Entity\User: ...@@ -330,148 +327,167 @@ App\Entity\User:
groups: ['@usergroup_prestataire'] groups: ['@usergroup_prestataire']
roles: ['ROLE_PRESTATAIRE'] roles: ['ROLE_PRESTATAIRE']
prestataires: ['@prestataire<current()>'] prestataires: ['@prestataire<current()>']
userapi:
username: 'userapi'
email: 'api@kohinos.fr'
plainPassword: 'nopassword'
enabled: true
roles: ['ROLE_API']
# TEST DE TRANSACTIONS / TRANSFERTS ! # TEST DE TRANSACTIONS / TRANSFERTS !
# App\Entity\TransactionAdherentPrestataire: # App\Entity\TransactionAdherentPrestataire:
# tro_adh_pre{2..11}: # tro_adh_pre{2..5}:
# operateur: '@usera<current()>' # operateur: '@usera<numberBetween(2, 5)>'
# role: 'Adherent'
# parenttype: 'transaction'
# type: 'adherent_prestataire' # type: 'adherent_prestataire'
# reference: 'test' # reference: 'test'
# moyen: 'cb' # moyen: 'virement'
# montant: '<randomFloat(2,1,2)>' # montant: 1
# expediteur: '@adherent<current()>' # expediteur: '@adherent<numberBetween(2, 5)>'
# destinataire: '@prestataire<current()>' # destinataire: '@prestataire<numberBetween(2, 5)>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'transaction'
# App\Entity\TransactionAdherentAdherent: # App\Entity\TransactionAdherentAdherent:
# tro_adh_adh{2..5}: # tro_adh_adh{2..5}:
# operateur: '@usera<current()>' # operateur: '@usera<current()>'
# role: 'Adherent'
# parenttype: 'transaction'
# type: 'adherent_adherent' # type: 'adherent_adherent'
# reference: 'test' # reference: 'test'
# moyen: 'cb' # moyen: 'transfert'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@adherent<current()>' # expediteur: '@adherent<current()>'
# destinataire: '@adherent<numberBetween(6, 11)>' # destinataire: '@adherent<numberBetween(6, 11)>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'transaction'
# App\Entity\TransactionPrestataireAdherent: # App\Entity\TransactionPrestataireAdherent:
# tro_pre_adh{2..11}: # tro_pre_adh{2..5}:
# operateur: '@userp<current()>' # operateur: '@userp<current()>'
# role: 'Prestataire'
# parenttype: 'transaction'
# type: 'prestataire_adherent' # type: 'prestataire_adherent'
# reference: 'test' # reference: 'test'
# moyen: 'cb' # moyen: 'transfert'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@prestataire<current()>' # expediteur: '@prestataire<current()>'
# destinataire: '@adherent<current()>' # destinataire: '@adherent<current()>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'transaction'
# App\Entity\TransactionPrestatairePrestataire: # App\Entity\TransactionPrestatairePrestataire:
# tro_pre_pre{2..11}: # tro_pre_pre{2..5}:
# operateur: '@userp<current()>' # operateur: '@userp<current()>'
# role: 'Prestataire'
# parenttype: 'transaction'
# type: 'prestataire_prestataire' # type: 'prestataire_prestataire'
# reference: 'test' # reference: 'test'
# moyen: 'cb' # moyen: 'transfert'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@prestataire<current()>' # expediteur: '@prestataire<current()>'
# destinataire: '@prestataire<numberBetween(11, 21)>' # destinataire: '@prestataire<numberBetween(11, 21)>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'transaction'
# App\Entity\TransfertComptoirGroupe: # App\Entity\TransfertComptoirGroupe:
# tre_cpt_grp{2..11}: # tre_cpt_grp{2..5}:
# operateur: '@usercomptoir' # operateur: '@usercomptoir'
# role: 'Comptoir'
# type: 'comptoir_groupe' # type: 'comptoir_groupe'
# reference: 'test' # reference: 'test'
# moyen: 'cb' # moyen: 'transfert'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@comptoir<numberBetween(1,50)>' # expediteur: '@comptoir<numberBetween(1,10)>'
# destinataire: '@groupe<numberBetween(1,10)>' # destinataire: '@groupe<numberBetween(1,10)>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'transfert' # parenttype: 'transfert'
# App\Entity\TransfertGroupeComptoir: # App\Entity\TransfertGroupeComptoir:
# tre_grp_cpt{1..10}: # tre_grp_cpt{1..5}:
# operateur: '@usergestiongroupe' # operateur: '@usergestiongroupe'
# role: 'Groupe'
# type: 'groupe_comptoir' # type: 'groupe_comptoir'
# reference: 'test' # reference: 'test'
# moyen: 'cb' # moyen: 'transfert'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@groupe<numberBetween(1,10)>' # expediteur: '@groupe<numberBetween(1,10)>'
# destinataire: '@comptoir<numberBetween(1,50)>' # destinataire: '@comptoir<numberBetween(1,10)>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'transfert' # parenttype: 'transfert'
# App\Entity\TransfertPrestataireComptoir: # App\Entity\TransfertPrestataireComptoir:
# tre_pre_cpt{2..11}: # tre_pre_cpt{2..5}:
# operateur: '@userp<current()>' # operateur: '@userp<current()>'
# role: 'Prestataire'
# type: 'prestataire_comptoir' # type: 'prestataire_comptoir'
# reference: 'test' # reference: 'test'
# moyen: 'cb' # moyen: 'transfert'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@prestataire<current()>' # expediteur: '@prestataire<current()>'
# destinataire: '@comptoir<numberBetween(1,50)>' # destinataire: '@comptoir<numberBetween(1,10)>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'transfert' # parenttype: 'transfert'
# App\Entity\TransfertPrestataireSiege: # App\Entity\TransfertPrestataireSiege:
# tre_pre_sie{2..11}: # tre_pre_sie{2..5}:
# operateur: '@userp<current()>' # operateur: '@userp<current()>'
# type: 'prestataire_siege' # role: 'Prestataire'
# type: 'reconversion'
# reference: 'test' # reference: 'test'
# moyen: 'cb' # moyen: 'transfert'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@prestataire<current()>' # expediteur: '@prestataire<current()>'
# destinataire: '@siege_1' # destinataire: '@siege_1'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'transfert' # parenttype: 'transfert'
# App\Entity\TransfertSiegeGroupe: # App\Entity\TransfertSiegeGroupe:
# tre_sie_grp{1..10}: # tre_sie_grp{1..5}:
# operateur: '@useradminsiege' # operateur: '@useradminsiege'
# role: 'ADMIN_SIEGE'
# type: 'siege_groupe' # type: 'siege_groupe'
# reference: 'test' # reference: 'test'
# moyen: 'cb' # moyen: 'transfert'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@siege_1' # expediteur: '@siege_1'
# destinataire: '@groupe<numberBetween(1,10)>' # destinataire: '@groupe<numberBetween(1,10)>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'transfert' # parenttype: 'transfert'
# App\Entity\VenteComptoirAdherent: # App\Entity\VenteComptoirAdherent:
# vte_cpt_adh{2..11}: # vte_cpt_adh{2..5}:
# operateur: '@usercomptoir' # operateur: '@usercomptoir'
# role: 'Comptoir'
# type: 'comptoir_adherent' # type: 'comptoir_adherent'
# reference: 'vte_cpt_adh<current()>' # reference: 'vte_cpt_adh<current()>'
# moyen: 'vente' # moyen: 'vente'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@comptoir<numberBetween(1,50)>' # expediteur: '@comptoir<numberBetween(1,10)>'
# destinataire: '@adherent<current()>' # destinataire: '@adherent<current()>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'vente' # parenttype: 'vente'
# App\Entity\VenteComptoirPrestataire: # App\Entity\VenteComptoirPrestataire:
# vte_cpt_pre{2..11}: # vte_cpt_pre{2..5}:
# operateur: '@usercomptoir' # operateur: '@usercomptoir'
# role: 'Comptoir'
# type: 'comptoir_prestataire' # type: 'comptoir_prestataire'
# reference: 'vte_cpt_pre<current()>' # reference: 'vte_cpt_pre<current()>'
# moyen: 'vente' # moyen: 'vente'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@comptoir<numberBetween(1,50)>' # expediteur: '@comptoir<numberBetween(1,10)>'
# destinataire: '@prestataire<current()>' # destinataire: '@prestataire<current()>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'vente' # parenttype: 'vente'
# App\Entity\RetraitComptoirAdherent: # App\Entity\RetraitComptoirAdherent:
# ret_cpt_adh{2..11}: # ret_cpt_adh{2..5}:
# operateur: '@usercomptoir' # operateur: '@usercomptoir'
# role: 'Comptoir'
# type: 'retrait_adherent' # type: 'retrait_adherent'
# reference: 'vte_cpt_adh<current()>' # reference: 'vte_cpt_adh<current()>'
# moyen: 'retrait' # moyen: 'retrait'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@comptoir<numberBetween(1,50)>' # expediteur: '@comptoir<numberBetween(1,10)>'
# destinataire: '@adherent<current()>' # destinataire: '@adherent<current()>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'retrait' # parenttype: 'retrait'
# App\Entity\RetraitComptoirPrestataire: # App\Entity\RetraitComptoirPrestataire:
# ret_cpt_pre{2..11}: # ret_cpt_pre{2..5}:
# operateur: '@usercomptoir' # operateur: '@usercomptoir'
# role: 'Comptoir'
# type: 'retrait_prestataire' # type: 'retrait_prestataire'
# reference: 'vte_cpt_pre<current()>' # reference: 'vte_cpt_pre<current()>'
# moyen: 'retrait' # moyen: 'retrait'
# montant: '<randomFloat(2,1,2)>' # montant: '<randomFloat(2,1,2)>'
# expediteur: '@comptoir<numberBetween(1,50)>' # expediteur: '@comptoir<numberBetween(1,10)>'
# destinataire: '@prestataire<current()>' # destinataire: '@prestataire<current()>'
# createdAt: '<dateTimeBetween("-200 days", "now")>' # createdAt: '<dateTimeBetween("-200 days", "now")>'
# parenttype: 'retrait' # parenttype: 'retrait'
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
"entrypoints": { "entrypoints": {
"app": { "app": {
"js": [ "js": [
"/build/runtime.js", "/build/runtime.6cf710cd.js",
"/build/app.js" "/build/app.5ceba3b7.js"
], ],
"css": [ "css": [
"/build/app.css" "/build/app.f6a68444.css"
] ]
}, },
"admin": { "admin": {
"js": [ "js": [
"/build/runtime.js", "/build/runtime.6cf710cd.js",
"/build/admin.js" "/build/admin.065fe9cf.js"
], ],
"css": [ "css": [
"/build/admin.css" "/build/admin.fecc301b.css"
] ]
} }
} }
......
{ {
"build/admin.css": "/build/admin.css", "build/admin.css": "/build/admin.fecc301b.css",
"build/admin.js": "/build/admin.js", "build/admin.js": "/build/admin.065fe9cf.js",
"build/app.css": "/build/app.css", "build/app.css": "/build/app.f6a68444.css",
"build/app.js": "/build/app.js", "build/app.js": "/build/app.5ceba3b7.js",
"build/runtime.js": "/build/runtime.js", "build/runtime.js": "/build/runtime.6cf710cd.js",
"build/ckeditor/adapters/jquery.js": "/build/ckeditor/adapters/jquery.js", "build/ckeditor/adapters/jquery.js": "/build/ckeditor/adapters/jquery.js",
"build/ckeditor/ckeditor.js": "/build/ckeditor/ckeditor.js", "build/ckeditor/ckeditor.js": "/build/ckeditor/ckeditor.js",
"build/ckeditor/config.js": "/build/ckeditor/config.js", "build/ckeditor/config.js": "/build/ckeditor/config.js",
...@@ -2650,5 +2650,23 @@ ...@@ -2650,5 +2650,23 @@
"build/ckeditor/skins/moono/images/spinner.gif": "/build/ckeditor/skins/moono/images/spinner.gif", "build/ckeditor/skins/moono/images/spinner.gif": "/build/ckeditor/skins/moono/images/spinner.gif",
"build/ckeditor/skins/moono/readme.md": "/build/ckeditor/skins/moono/readme.md", "build/ckeditor/skins/moono/readme.md": "/build/ckeditor/skins/moono/readme.md",
"build/ckeditor/skins/moono/skin.js": "/build/ckeditor/skins/moono/skin.js", "build/ckeditor/skins/moono/skin.js": "/build/ckeditor/skins/moono/skin.js",
"build/ckeditor/styles.js": "/build/ckeditor/styles.js" "build/ckeditor/styles.js": "/build/ckeditor/styles.js",
"build/fonts/fa-brands-400.woff2": "/build/fonts/fa-brands-400.4b115e11.woff2",
"build/fonts/fa-brands-400.woff": "/build/fonts/fa-brands-400.b90365bc.woff",
"build/fonts/fa-brands-400.ttf": "/build/fonts/fa-brands-400.c39278f7.ttf",
"build/fonts/fa-brands-400.eot": "/build/fonts/fa-brands-400.d9d17590.eot",
"build/fonts/fa-regular-400.eot": "/build/fonts/fa-regular-400.414ff5da.eot",
"build/fonts/fa-regular-400.woff": "/build/fonts/fa-regular-400.5dd3976c.woff",
"build/fonts/fa-regular-400.woff2": "/build/fonts/fa-regular-400.65779ebc.woff2",
"build/fonts/fa-regular-400.ttf": "/build/fonts/fa-regular-400.f6c6f6c8.ttf",
"build/fonts/fa-solid-900.woff2": "/build/fonts/fa-solid-900.46280631.woff2",
"build/fonts/fa-solid-900.woff": "/build/fonts/fa-solid-900.61969d43.woff",
"build/fonts/fa-solid-900.eot": "/build/fonts/fa-solid-900.b5596f4d.eot",
"build/fonts/fa-solid-900.ttf": "/build/fonts/fa-solid-900.b70cea03.ttf",
"build/images/fa-brands-400.svg": "/build/images/fa-brands-400.80533988.svg",
"build/images/fa-regular-400.svg": "/build/images/fa-regular-400.e7e957c8.svg",
"build/images/fa-solid-900.svg": "/build/images/fa-solid-900.82905d8d.svg",
"build/images/layers-2x.png": "/build/images/layers-2x.4f0283c6.png",
"build/images/layers.png": "/build/images/layers.a6137456.png",
"build/images/marker-icon.png": "/build/images/marker-icon.2273e3d8.png"
} }
\ No newline at end of file
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} {"name":"Kohinos","short_name":"Kohinos","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
\ No newline at end of file \ No newline at end of file
...@@ -8,10 +8,11 @@ use App\Entity\Geoloc; ...@@ -8,10 +8,11 @@ use App\Entity\Geoloc;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Entity\User; use App\Entity\User;
use App\Entity\Usergroup; use App\Entity\Usergroup;
use App\Events\MLCEvents;
use App\Enum\MoyenEnum; use App\Enum\MoyenEnum;
use App\Form\Type\UserFormType; use App\Form\Type\UserFormType;
use App\Form\Type\GeolocFormType; use App\Form\Type\GeolocFormType;
use FOS\UserBundle\Event\FilterUserResponseEvent; use FOS\UserBundle\Event\UserEvent;
use FOS\UserBundle\FOSUserEvents; use FOS\UserBundle\FOSUserEvents;
use Knp\Menu\ItemInterface as MenuItemInterface; use Knp\Menu\ItemInterface as MenuItemInterface;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
...@@ -130,18 +131,9 @@ class AdherentAdmin extends AbstractAdmin ...@@ -130,18 +131,9 @@ class AdherentAdmin extends AbstractAdmin
$user->setAdherent($adherent); $user->setAdherent($adherent);
$adherent->setUser($user); $adherent->setUser($user);
} }
// if (count($adherent->getUser()->getCotisations()) <= 0) {
// $cotisation = new Cotisation();
// $cotisation->setOperateur($adherent->getUser());
// $cotisation->setExpediteur($adherent);
// $cotisation->setDebut($now);
// $cotisation->setFin(new \DateTime('+ 1 year'));
// $adherent->getUser()->addCotisation($cotisation);
// }
if ($adherent->getGeoloc() == null) { if ($adherent->getGeoloc() == null) {
$adherent->setGeoloc(new Geoloc()); $adherent->setGeoloc(new Geoloc());
} }
//nom, prénom, adresse, tel, mail et cotisation en une seule fois et générer un mdp
$formMapper $formMapper
->tab('General') ->tab('General')
->with('Identité', ['class' => 'col-md-7']) ->with('Identité', ['class' => 'col-md-7'])
...@@ -157,76 +149,6 @@ class AdherentAdmin extends AbstractAdmin ...@@ -157,76 +149,6 @@ class AdherentAdmin extends AbstractAdmin
->end() ->end()
->end() ->end()
; ;
// ->with('Identité', ['class' => 'col-md-7'])
// ->add('user.firstname', TextType::class, array(
// 'label' => 'Prénom :',
// 'required' => true
// ))
// ->add('user.lastname', TextType::class, array(
// 'label' => 'Nom :',
// 'required' => true
// ));
// if (!$this->isCurrentRoute('create')) {
// $formMapper
// ->add('user.username', TextType::class, array(
// 'label' => 'Username :',
// 'required' => true,
// 'disabled' => true
// ));
// }
// $formMapper
// ->add('user.phone', TextType::class, array(
// 'label' => 'Téléphone :',
// 'required' => false
// ))
// ->add('user.email', TextType::class, array(
// 'label' => 'Email :',
// 'required' => true
// ))
// ->add('groupe', ChoiceType::class, array(
// 'required' => true,
// 'label' => 'Groupe local :',
// 'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Groupe::class)->findAll(),
// 'choice_label' => 'name',
// 'placeholder' => 'Choisir un groupe',
// ))
// ->end();
// ->with('Cotisation', ['class' => 'col-md-5'])
// //@TODO : géré une ou plusieurs cotisations
// ->add('user.cotisations.first.cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y')))
// ->add('user.cotisations.first.montant', TextType::class, array('label' => 'Montant'))
// ->add('user.cotisations.first.moyen', ChoiceType::class, array(
// 'required' => true,
// 'label' => 'Moyen :',
// 'choices' => MoyenEnum::getAvailableTypes(),
// 'choice_label' => function ($choice) {
// return MoyenEnum::getTypeName($choice);
// },
// ));
// if ($this->security->getUser()->isGranted('ROLE_TRESORIER')) {
// $formMapper
// ->add('user.cotisations.first.cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu'));
// }
// $formMapper->end();
// if (!$this->isCurrentRoute('create')) {
// $formMapper
// ->with('Date', ['class' => 'col-md-5'])
// ->add('user.cotisations.first.cotisationInfos.debut', DateType::class, array(
// 'label' => 'Date de début',
// 'data' => new \DateTime(),
// 'widget' => 'single_text',
// 'html5' => false,
// 'attr' => ['class' => 'js-datepicker'],
// ))
// ->add('user.cotisations.first.cotisationInfos.fin', DateType::class, array(
// 'label' => 'Date de fin',
// 'data' => new \DateTime('+ 1 year'),
// 'widget' => 'single_text',
// 'html5' => false,
// 'attr' => ['class' => 'js-datepicker'],
// ))
// ->end();
// }
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$formMapper->getFormBuilder()->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($em) { $formMapper->getFormBuilder()->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($em) {
...@@ -236,7 +158,7 @@ class AdherentAdmin extends AbstractAdmin ...@@ -236,7 +158,7 @@ class AdherentAdmin extends AbstractAdmin
$repo = $em->getRepository(User::class); $repo = $em->getRepository(User::class);
$emailExist = $repo->findBy(array('email' => $user->getEmail())); $emailExist = $repo->findBy(array('email' => $user->getEmail()));
if (count($emailExist) > 0) { if (count($emailExist) > 0) {
$event->getForm()->get('user__email')->addError(new FormError('Courriel déjà utilisé !')); $event->getForm()->get('user')->get('email')->addError(new FormError('Courriel déjà utilisé !'));
} else { } else {
$user->setUsername($user->getEmail()); $user->setUsername($user->getEmail());
} }
...@@ -258,20 +180,19 @@ class AdherentAdmin extends AbstractAdmin ...@@ -258,20 +180,19 @@ class AdherentAdmin extends AbstractAdmin
$adherent->getUser()->setUsername($adherent->getUser()->getEmail()); $adherent->getUser()->setUsername($adherent->getUser()->getEmail());
} }
if (empty($adherent->getUser()->getPassword())) { if (empty($adherent->getUser()->getPassword())) {
// @TODO : generate password with tokengenerator
// $tokenGenerator = $this->getConfigurationPool()->getContainer()->get('fos_user.util.token_generator'); // $tokenGenerator = $this->getConfigurationPool()->getContainer()->get('fos_user.util.token_generator');
// $password = substr($tokenGenerator->generateToken(), 0, 12); // $password = substr($tokenGenerator->generateToken(), 0, 12);
$bytes = random_bytes(64); $bytes = random_bytes(64);
$password = rtrim(strtr(base64_encode($bytes), '+/', '-_'), '='); $password = rtrim(strtr(base64_encode($bytes), '+/', '-_'), '=');
$adherent->getUser()->setPassword($password); $adherent->getUser()->setPassword($password);
// @TODO : send email to user
} }
$this->userManager->updateUser($adherent->getUser()); $this->userManager->updateUser($adherent->getUser());
$adherent->getUser()->createEmailToken(); $adherent->getUser()->createEmailToken();
$em->persist($adherent->getUser()); $em->persist($adherent->getUser());
$em->persist($adherent); $em->persist($adherent);
$em->flush(); $em->flush();
// @TODO : envoyer un mail au nouvel utilisateur avec l'emailtoken via le dispatch d'un event $this->eventDispatcher->dispatch(MLCEvents::REGISTRATION_ADHERENT, new UserEvent($adherent->getUser(), $this->getRequest()));
// $this->eventDispatcher->dispatch(FOSUserEvents::REGISTRATION_COMPLETED, new FilterUserResponseEvent($adherent->getUser(), $this->getRequest(), $response));
} }
/** /**
...@@ -360,7 +281,10 @@ class AdherentAdmin extends AbstractAdmin ...@@ -360,7 +281,10 @@ class AdherentAdmin extends AbstractAdmin
'sort_field_mapping' => array('fieldName' => 'name'), 'sort_field_mapping' => array('fieldName' => 'name'),
'sort_parent_association_mappings' => array(array('fieldName' => 'groupe')) 'sort_parent_association_mappings' => array(array('fieldName' => 'groupe'))
)) ))
->addIdentifier('user.enabled', null, array('label' => 'Activé', 'datatype' => 'App.User', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig')) ->add('user.enabled', null, array(
'label' => 'Activé',
'editable' => true
))
->addIdentifier('user.updatedAt', null, array('label' => 'Mis à jour')) ->addIdentifier('user.updatedAt', null, array('label' => 'Mis à jour'))
; ;
} }
......
...@@ -6,6 +6,7 @@ use App\Entity\Geoloc; ...@@ -6,6 +6,7 @@ use App\Entity\Geoloc;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Form\Type\GeolocFormType; use App\Form\Type\GeolocFormType;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\ListMapper;
...@@ -27,6 +28,8 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; ...@@ -27,6 +28,8 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
class ComptoirAdmin extends AbstractAdmin class ComptoirAdmin extends AbstractAdmin
{ {
protected $security; protected $security;
protected $baseRouteName = 'comptoir';
protected $baseRoutePattern = 'comptoir';
protected $datagridValues = [ protected $datagridValues = [
'_sort_order' => 'ASC', '_sort_order' => 'ASC',
'_sort_by' => 'name', '_sort_by' => 'name',
...@@ -95,11 +98,15 @@ class ComptoirAdmin extends AbstractAdmin ...@@ -95,11 +98,15 @@ class ComptoirAdmin extends AbstractAdmin
)) ))
->add('email', null, array( ->add('email', null, array(
'label' => 'Email', 'label' => 'Email',
'required' => true, 'required' => false,
)) ))
->add('tel', null, array( ->add('tel', null, array(
'label' => 'Téléphone', 'label' => 'Téléphone',
'required' => true, 'required' => false,
))
->add('content', CKEditorType::class, array(
'label' => 'Description :',
'required' => false
)) ))
->add('enabled', null, array('label' => 'Activé ?')) ->add('enabled', null, array('label' => 'Activé ?'))
->end() ->end()
...@@ -153,9 +160,29 @@ class ComptoirAdmin extends AbstractAdmin ...@@ -153,9 +160,29 @@ class ComptoirAdmin extends AbstractAdmin
protected function configureRoutes(RouteCollection $collection) protected function configureRoutes(RouteCollection $collection)
{ {
$collection->add('test');
$collection->remove('delete'); $collection->remove('delete');
} }
public function configureActionButtons($action, $object = null)
{
$list = parent::configureActionButtons($action, $object);
$list['test']['template'] = '@SonataAdmin/show_map_comptoir.html.twig';
return $list;
}
public function getRouteShowOnFront($object)
{
return $this->routeGenerator->generate('show_comptoir', array('slug' => $object->getSlug()));
}
public function getRouteShowMap()
{
return $this->routeGenerator->generate('comptoirs_carte');
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -164,11 +191,19 @@ class ComptoirAdmin extends AbstractAdmin ...@@ -164,11 +191,19 @@ class ComptoirAdmin extends AbstractAdmin
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('name') ->addIdentifier('name')
->addIdentifier('email') ->add('compte', null, array('label' => 'Solde'))
->addIdentifier('compte', null, array('label' => 'Solde')) ->add('geoloc', null, array('label' => 'Adresse'))
->addIdentifier('geoloc.adresse', null, array('label' => 'Adresse')) ->add('tel', null, array('label' => 'Téléphone'))
->addIdentifier('tel', null, array('label' => 'Téléphone')) ->add('enabled', null, array(
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Comptoir', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig')) 'label' => 'Activé',
'editable' => true
))
->add('_action', null, [
'actions' => [
'show' => ['template' => '@SonataAdmin/CRUD/list__action_showonfront.html.twig'],
'edit' => []
]
])
; ;
} }
} }
...@@ -12,6 +12,7 @@ use Sonata\AdminBundle\Route\RouteCollection; ...@@ -12,6 +12,7 @@ use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
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\MoneyType; use Symfony\Component\Form\Extension\Core\Type\MoneyType;
/** /**
...@@ -47,10 +48,12 @@ class CotisationAdherentAdmin extends CotisationAdmin ...@@ -47,10 +48,12 @@ class CotisationAdherentAdmin extends CotisationAdmin
} }
} else { } else {
$groupe = $this->getRequest()->getSession()->get('_groupegere'); $groupe = $this->getRequest()->getSession()->get('_groupegere');
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$adhTable = $em->getMetadataFactory()->getMetadataFor(Adherent::class)->getTableName(); $adhTable = $em->getMetadataFactory()->getMetadataFor(Adherent::class)->getTableName();
$fluxTable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
$connection = $em->getConnection(); $connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM flux f INNER JOIN '.$adhTable.' a ON (a.id = f.adherent_id OR a.id = f.adherent_dest_id) WHERE a.groupe_id = '.$groupe->getId()); $statement = $connection->prepare("SELECT f.id FROM $fluxTable f INNER JOIN $adhTable a ON (a.id = f.adherent_id OR a.id = f.adherent_dest_id) WHERE a.groupe_id = :groupe_id");
$statement->bindValue(':groupe_id', $groupe->getId());
$statement->execute(); $statement->execute();
$ids = $statement->fetchAll(); $ids = $statement->fetchAll();
$query $query
...@@ -85,33 +88,30 @@ class CotisationAdherentAdmin extends CotisationAdmin ...@@ -85,33 +88,30 @@ class CotisationAdherentAdmin extends CotisationAdmin
*/ */
protected function configureFormFields(FormMapper $formMapper): void protected function configureFormFields(FormMapper $formMapper): void
{ {
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$cotisation = $this->getSubject(); $cotisation = $this->getSubject();
$expediteurInfos = array( $expediteurInfos = array(
'label' => 'Expéditeur', 'label' => 'Expéditeur',
'class' => Adherent::class, 'class' => Adherent::class,
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Adherent::class)->findOrderByName(), 'choices' => $em->getRepository(Adherent::class)->findOrderByName(),
'placeholder' => 'Choisir un adhérent', 'placeholder' => 'Choisir un adhérent',
'required' => true, 'required' => true,
); );
$exp = $this->getRequest()->get('expediteur'); $exp = $this->getRequest()->get('expediteur');
if (!empty($exp)) { if (!empty($exp)) {
$expediteurInfos['data'] = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Adherent::class)->findOneById($exp); $expediteurInfos['data'] = $em->getRepository(Adherent::class)->findOneById($exp);
} }
$formMapper $formMapper
->with('Cotisation', ['class' => 'col-md-8']) ->with('Cotisation', ['class' => 'col-md-8'])
->add('montant', MoneyType::class, array( ->add('montant', MoneyType::class, array(
'label' => 'Montant', 'label' => 'Montant',
'data' => ($cotisation->getMontant() != null)?$cotisation->getMontant():floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_ADHERENT)) 'data' => ($cotisation->getMontant() != null)?$cotisation->getMontant():floatval($em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_ADHERENT)),
'help' => 'Montant par défaut des cotisations adhérent : '.floatval($em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_ADHERENT))
)) ))
->add('reference', HiddenType::class, array( ->add('reference', TextType::class, array(
'data' => 'cotisation_adherent' 'required' => false
)) ))
->add('expediteur', EntityType::class, $expediteurInfos) ->add('expediteur', EntityType::class, $expediteurInfos)
->add('operateur', HiddenType::class, array(
'data' => $this->security->getUser()->getId(),
'entity_class' => User::class,
'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager()
))
->end() ->end()
; ;
parent::configureFormFields($formMapper); parent::configureFormFields($formMapper);
......
...@@ -6,7 +6,9 @@ use App\Entity\Adherent; ...@@ -6,7 +6,9 @@ use App\Entity\Adherent;
use App\Entity\GlobalParameter; use App\Entity\GlobalParameter;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Siege; use App\Entity\Siege;
use App\Entity\User;
use App\Enum\MoyenEnum; use App\Enum\MoyenEnum;
use App\Tools\RoleCheck;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper;
...@@ -35,6 +37,7 @@ class CotisationAdmin extends AbstractAdmin ...@@ -35,6 +37,7 @@ class CotisationAdmin extends AbstractAdmin
protected $baseRouteName = 'cotisation'; protected $baseRouteName = 'cotisation';
protected $baseRoutePattern = 'cotisation'; protected $baseRoutePattern = 'cotisation';
protected $security; protected $security;
protected $rolecheck;
protected $translator; protected $translator;
protected $datagridValues = [ protected $datagridValues = [
...@@ -47,6 +50,11 @@ class CotisationAdmin extends AbstractAdmin ...@@ -47,6 +50,11 @@ class CotisationAdmin extends AbstractAdmin
$this->security = $security; $this->security = $security;
} }
public function setRoleCheck(RoleCheck $rolecheck)
{
$this->rolecheck = $rolecheck;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -55,7 +63,11 @@ class CotisationAdmin extends AbstractAdmin ...@@ -55,7 +63,11 @@ class CotisationAdmin extends AbstractAdmin
$datagridMapper $datagridMapper
->add('cotisationInfos.annee', null, array('label' => 'Année')) ->add('cotisationInfos.annee', null, array('label' => 'Année'))
->add('montant', null, array('label' => 'Montant')) ->add('montant', null, array('label' => 'Montant'))
->add('cotisationInfos.recu', null, array('label' => 'Recu ?')) ->add('cotisationInfos.recu', null, [
'label' => "Recu ?",
'show_filter' => true,
'advanced_filter' => false
])
; ;
} }
...@@ -72,15 +84,21 @@ class CotisationAdmin extends AbstractAdmin ...@@ -72,15 +84,21 @@ class CotisationAdmin extends AbstractAdmin
->add('parenttype', HiddenType::class, array( ->add('parenttype', HiddenType::class, array(
'data' => 'cotisation' 'data' => 'cotisation'
)) ))
->add('operateur', HiddenType::class, array(
'data' => $this->security->getUser()->getId(),
'data_class' => null,
'entity_class' => User::class,
'em' => $em
))
->add('role', HiddenType::class, array(
'data' => $this->rolecheck->getCurrentRole()->__toString()
))
->add('destinataire', HiddenType::class, array( ->add('destinataire', HiddenType::class, array(
'data' => $em->getRepository(Prestataire::class)->findBy(array('mlc' => true)), 'data' => $em->getRepository(Prestataire::class)->findOneBy(array('mlc' => true))->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Prestataire::class, 'entity_class' => Prestataire::class,
'em' => $em 'em' => $em
)) ))
->add('cotisationInfos.annee', null, array(
'label' => 'Année',
))
->add('moyen', ChoiceType::class, array( ->add('moyen', ChoiceType::class, array(
'required' => true, 'required' => true,
'choices' => MoyenEnum::getAvailableTypes(), 'choices' => MoyenEnum::getAvailableTypes(),
...@@ -89,25 +107,33 @@ class CotisationAdmin extends AbstractAdmin ...@@ -89,25 +107,33 @@ class CotisationAdmin extends AbstractAdmin
}, },
)) ))
; ;
if ($this->security->getUser() != null && $this->security->getUser()->isGranted('ROLE_TRESORIER')) { if ($this->security->getUser() != null && ($this->security->getUser()->isGranted('ROLE_SUPER_ADMIN') || $this->security->getUser()->isGranted('ROLE_TRESORIER'))) {
$formMapper $formMapper
->add('cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu')); ->add('cotisationInfos.recu', CheckboxType::class, array(
'label' => 'Reçu',
'required' => false
));
} }
$formMapper->end() $formMapper->end()
->with('Date', ['class' => 'col-md-4']) ->with('Date', ['class' => 'col-md-4'])
->add('cotisationInfos.debut', DateTimeType::class, array( ->add('cotisationInfos.annee', null, array(
'label' => 'Année',
'required' => false
))
->add('cotisationInfos.debut', DateType::class, array(
'label' => 'Date de début', 'label' => 'Date de début',
'widget' => 'single_text', 'widget' => 'single_text',
'required' => true,
// 'html5' => false, // 'html5' => false,
'date_format' => IntlDateFormatter::SHORT, 'format' => IntlDateFormatter::SHORT,
// 'attr' => ['class' => 'js-datepicker'], 'attr' => ['class' => 'js-datepicker'],
)) ))
->add('cotisationInfos.fin', DateTimeType::class, array( ->add('cotisationInfos.fin', DateType::class, array(
'label' => 'Date de fin', 'label' => 'Date de fin',
'widget' => 'single_text', 'widget' => 'single_text',
// 'html5' => false, // 'html5' => false,
'date_format' => IntlDateFormatter::SHORT, 'format' => IntlDateFormatter::SHORT,
// 'attr' => ['class' => 'js-datepicker'], 'attr' => ['class' => 'js-datepicker'],
)) ))
->end() ->end()
; ;
...@@ -128,22 +154,32 @@ class CotisationAdmin extends AbstractAdmin ...@@ -128,22 +154,32 @@ class CotisationAdmin extends AbstractAdmin
{ {
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('cotisationInfos.annee', null, array( ->add('cotisationInfos.annee', null, array(
'label' => 'Année' 'label' => 'Année'
)) ))
->addIdentifier('montant', null, array( ->add('montant', null, array(
'label' => 'Montant' 'label' => 'Montant'
)) ))
->addIdentifier('moyen', null, array( ->add('moyen', null, array(
'label' => 'Moyen' 'label' => 'Moyen'
)) ))
->addIdentifier('createdAt', null, array( ->add('cotisationInfos.debut', null, array(
'label' => 'Crée le' 'label' => 'Crée le'
)) ))
->addIdentifier('operateur', null, array( ->add('cotisationInfos.fin', null, array(
'label' => 'Opérateur', 'label' => 'Expire le'
// 'disabled' => true ))
->add('cotisationInfos.recu', null, array(
'label' => 'Reçu ?'
))
->add('operateurAndRole', null, array(
'label' => 'Opérateur'
)) ))
->add('_action', null, [
'actions' => [
'edit' => [],
]
])
; ;
} }
} }
...@@ -14,6 +14,7 @@ use Sonata\AdminBundle\Show\ShowMapper; ...@@ -14,6 +14,7 @@ use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
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\MoneyType; use Symfony\Component\Form\Extension\Core\Type\MoneyType;
/** /**
...@@ -49,11 +50,12 @@ class CotisationPrestataireAdmin extends CotisationAdmin ...@@ -49,11 +50,12 @@ class CotisationPrestataireAdmin extends CotisationAdmin
} }
} else { } else {
$groupe = $this->getRequest()->getSession()->get('_groupegere'); $groupe = $this->getRequest()->getSession()->get('_groupegere');
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$fluxTable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName(); $fluxTable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
$prestaTable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName(); $prestaTable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName();
$connection = $em->getConnection(); $connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM '.$fluxTable.' f INNER JOIN '.$prestaTable.' a ON (a.id = f.prestataire_id OR a.id = f.prestataire_dest_id) WHERE a.groupe_id = '.$groupe->getId()); $statement = $connection->prepare("SELECT f.id FROM $fluxTable f INNER JOIN $prestaTable a ON (a.id = f.prestataire_id OR a.id = f.prestataire_dest_id) WHERE a.groupe_id = :groupe_id");
$statement->bindValue(':groupe_id', $groupe->getId());
$statement->execute(); $statement->execute();
$ids = $statement->fetchAll(); $ids = $statement->fetchAll();
$query $query
...@@ -89,33 +91,30 @@ class CotisationPrestataireAdmin extends CotisationAdmin ...@@ -89,33 +91,30 @@ class CotisationPrestataireAdmin extends CotisationAdmin
*/ */
protected function configureFormFields(FormMapper $formMapper): void protected function configureFormFields(FormMapper $formMapper): void
{ {
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$cotisation = $this->getSubject(); $cotisation = $this->getSubject();
$expediteurInfos = array( $expediteurInfos = array(
'label' => 'Expéditeur', 'label' => 'Expéditeur',
'class' => Prestataire::class, 'class' => Prestataire::class,
'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC')), 'choices' => $em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false), array('raison'=> 'ASC')),
'placeholder' => 'Choisir un prestataire', 'placeholder' => 'Choisir un prestataire',
'required' => true, 'required' => true,
); );
$exp = $this->getRequest()->get('expediteur'); $exp = $this->getRequest()->get('expediteur');
if (!empty($exp)) { if (!empty($exp)) {
$expediteurInfos['data'] = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findOneById($exp); $expediteurInfos['data'] = $em->getRepository(Prestataire::class)->findOneById($exp);
} }
$formMapper $formMapper
->with('Cotisation', ['class' => 'col-md-8']) ->with('Cotisation', ['class' => 'col-md-8'])
->add('montant', MoneyType::class, array( ->add('montant', MoneyType::class, array(
'label' => 'Montant', 'label' => 'Montant',
'data' => ($cotisation->getMontant() != null)?$cotisation->getMontant():floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_PRESTATAIRE)) 'data' => ($cotisation->getMontant() != null)?$cotisation->getMontant():floatval($em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_PRESTATAIRE)),
'help' => 'Montant par défaut des cotisations prestataire : '.floatval($em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_PRESTATAIRE))
)) ))
->add('reference', HiddenType::class, array( ->add('reference', TextType::class, array(
'data' => 'cotisation_prestataire' 'required' => false
)) ))
->add('expediteur', EntityType::class, $expediteurInfos) ->add('expediteur', EntityType::class, $expediteurInfos)
->add('operateur', HiddenType::class, array(
'data' => $this->security->getUser()->getId(),
'entity_class' => User::class,
'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager()
))
->end() ->end()
; ;
parent::configureFormFields($formMapper); parent::configureFormFields($formMapper);
......
...@@ -21,6 +21,8 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; ...@@ -21,6 +21,8 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
*/ */
class DocumentAdmin extends AbstractAdmin class DocumentAdmin extends AbstractAdmin
{ {
protected $baseRouteName = 'document';
protected $baseRoutePattern = 'document';
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -32,7 +34,7 @@ class DocumentAdmin extends AbstractAdmin ...@@ -32,7 +34,7 @@ class DocumentAdmin extends AbstractAdmin
'data' => $this->getConfigurationPool()->getContainer()->get('security.token_storage')->getToken()->getUser()->getId(), 'data' => $this->getConfigurationPool()->getContainer()->get('security.token_storage')->getToken()->getUser()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => User::class, 'entity_class' => User::class,
'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager() 'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager()
)) ))
->add('media', MediaType::class, array( ->add('media', MediaType::class, array(
'provider' => 'sonata.media.provider.file', 'provider' => 'sonata.media.provider.file',
...@@ -64,7 +66,10 @@ class DocumentAdmin extends AbstractAdmin ...@@ -64,7 +66,10 @@ class DocumentAdmin extends AbstractAdmin
->addIdentifier('name', null, array('label' => 'Titre')) ->addIdentifier('name', null, array('label' => 'Titre'))
->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description')) ->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description'))
->addIdentifier('media', null, array('label' => 'Fichier')) ->addIdentifier('media', null, array('label' => 'Fichier'))
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Document', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig')) ->add('enabled', null, array(
'label' => 'Activé',
'editable' => true
))
; ;
} }
} }
...@@ -28,6 +28,8 @@ use Symfony\Component\Security\Core\Security; ...@@ -28,6 +28,8 @@ use Symfony\Component\Security\Core\Security;
class EtatprestataireAdmin extends AbstractAdmin class EtatprestataireAdmin extends AbstractAdmin
{ {
protected $security; protected $security;
protected $baseRouteName = 'tags';
protected $baseRoutePattern = 'tags';
protected $datagridValues = [ protected $datagridValues = [
// reverse order (default = 'ASC') // reverse order (default = 'ASC')
'_sort_order' => 'DESC', '_sort_order' => 'DESC',
...@@ -51,7 +53,7 @@ class EtatprestataireAdmin extends AbstractAdmin ...@@ -51,7 +53,7 @@ class EtatprestataireAdmin extends AbstractAdmin
protected function configureFormFields(FormMapper $formMapper) protected function configureFormFields(FormMapper $formMapper)
{ {
$user = $this->security->getUser(); $user = $this->security->getUser();
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC')); $prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false), array('raison'=> 'ASC'));
$groupepresta = $this->getSubject(); $groupepresta = $this->getSubject();
$formMapper $formMapper
...@@ -84,13 +86,17 @@ class EtatprestataireAdmin extends AbstractAdmin ...@@ -84,13 +86,17 @@ class EtatprestataireAdmin extends AbstractAdmin
->addIdentifier('name', null, array( ->addIdentifier('name', null, array(
'label' => 'Nom' 'label' => 'Nom'
)) ))
->addIdentifier('content', null, array( ->add('content', null, array(
'label' => 'Description' 'label' => 'Description',
'sortable' => false
)) ))
->addIdentifier('enabled', null, array( ->add('getPrestatairesCount', null, array(
'label' => 'Nombre de prestas',
'sortable' => false
))
->add('enabled', null, array(
'label' => 'Activé', 'label' => 'Activé',
'datatype' => 'App.EtatPrestataire', 'editable' => true
'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'
)) ))
; ;
} }
......
...@@ -21,7 +21,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; ...@@ -21,7 +21,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
*/ */
class FaqAdmin extends AbstractAdmin class FaqAdmin extends AbstractAdmin
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -33,7 +32,7 @@ class FaqAdmin extends AbstractAdmin ...@@ -33,7 +32,7 @@ class FaqAdmin extends AbstractAdmin
'data' => $this->getConfigurationPool()->getContainer()->get('security.token_storage')->getToken()->getUser()->getId(), 'data' => $this->getConfigurationPool()->getContainer()->get('security.token_storage')->getToken()->getUser()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => User::class, 'entity_class' => User::class,
'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager() 'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager()
)) ))
->add('name', TextType::class, array( ->add('name', TextType::class, array(
'label' => 'Titre :' 'label' => 'Titre :'
...@@ -68,11 +67,14 @@ class FaqAdmin extends AbstractAdmin ...@@ -68,11 +67,14 @@ class FaqAdmin extends AbstractAdmin
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('name', null, array('label' => 'Titre')) ->addIdentifier('name', null, array('label' => 'Titre'))
->addIdentifier('content', 'html', array('label' => 'Text')) ->add('content', 'html', array('label' => 'Text', 'sortable' => false))
->addIdentifier('fichier', null, array('label' => 'Fichier')) ->add('fichier', null, array('label' => 'Fichier'))
->addIdentifier('image', null, array('label' => 'Image')) ->add('image', null, array('label' => 'Image'))
->addIdentifier('user', null, array('label' => 'Auteur')) ->addIdentifier('user', null, array('label' => 'Auteur'))
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Document', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig')) ->add('enabled', null, array(
'label' => 'Activé',
'editable' => true
))
; ;
} }
} }
...@@ -137,14 +137,15 @@ class FluxAdmin extends AbstractAdmin ...@@ -137,14 +137,15 @@ class FluxAdmin extends AbstractAdmin
{ {
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('createdAt', 'datetime', array('label' => 'Date')) ->add('createdAt', 'datetime', array('label' => 'Date'))
->addIdentifier('type', null, array('label' => 'Type')) ->add('type', null, array('label' => 'Type'))
->addIdentifier('montant', null, array('label' => 'Montant')) ->add('montant', null, array('label' => 'Montant'))
->addIdentifier('expediteur', null, array('label' => 'Expediteur')) ->add('expediteur', null, array('label' => 'Expediteur'))
->addIdentifier('destinataire', null, array('label' => 'Destinataire')) ->add('destinataire', null, array('label' => 'Destinataire'))
->add('operateur', null, array('label' => 'Operateur')) ->add('operateur', null, array('label' => 'Operateur'))
->addIdentifier('reference', null, array('label' => 'Reference')) ->addIdentifier('reference', null, array('label' => 'Reference'))
->addIdentifier('verify', null, array('label' => 'Vérifié')) // @TODO : ajouter le verify uniquement si l'on souhaite (param url)=> sinon c'est beaucoup trop long...
// ->addIdentifier('verify', null, array('label' => 'Vérifié'))
; ;
} }
} }
...@@ -142,6 +142,11 @@ class GroupeAdmin extends AbstractAdmin ...@@ -142,6 +142,11 @@ class GroupeAdmin extends AbstractAdmin
$collection->remove('delete'); $collection->remove('delete');
} }
public function getRouteShowOnFront($object)
{
return $this->routeGenerator->generate('show_groupe', array('slug' => $object->getSlug()));
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -150,9 +155,9 @@ class GroupeAdmin extends AbstractAdmin ...@@ -150,9 +155,9 @@ class GroupeAdmin extends AbstractAdmin
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('name', null, array('label' => 'Nom du groupe')) ->addIdentifier('name', null, array('label' => 'Nom du groupe'))
->addIdentifier('gestionnaires', null, array('label' => 'Gestionnaires')) ->add('gestionnaires', null, array('label' => 'Gestionnaires'))
->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description')) ->add('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description'))
->addIdentifier('compte', null, array('label' => 'Solde')) ->add('compte', null, array('label' => 'Solde'))
->add( ->add(
'getPrestatairesCount', 'getPrestatairesCount',
null, null,
...@@ -182,7 +187,16 @@ class GroupeAdmin extends AbstractAdmin ...@@ -182,7 +187,16 @@ class GroupeAdmin extends AbstractAdmin
'sort_parent_association_mappings' => [], 'sort_parent_association_mappings' => [],
] ]
) )
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Groupeprestataire', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig')) ->add('enabled', null, array(
'label' => 'Activé',
'editable' => true
))
->add('_action', null, [
'actions' => [
'show' => ['template' => '@SonataAdmin/CRUD/list__action_showonfront.html.twig'],
'edit' => []
]
])
; ;
} }
} }
...@@ -4,6 +4,7 @@ namespace App\Admin; ...@@ -4,6 +4,7 @@ namespace App\Admin;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Enum\GroupePrestaEnum; use App\Enum\GroupePrestaEnum;
use App\Form\Type\GeolocFormType;
use FOS\CKEditorBundle\Form\Type\CKEditorType; use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper;
...@@ -62,22 +63,6 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -62,22 +63,6 @@ class GroupeprestataireAdmin extends AbstractAdmin
->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere')) ->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere'))
; ;
} }
// @TODO : NE FONCTIONNE PAS : pour pouvoir classer par nombre de prestataires !
// voir https://github.com/sonata-project/SonataDoctrineORMAdminBundle/issues/297
if ('list' === $context) {
$rootAlias = $query->getRootAliases()[0];
$parameters = $this->getFilterParameters();
if ('getPrestatairesCount' === $parameters['_sort_by']) {
$query->setDistinct(true);
// $query->select('o', 'DISTINCT o');
// $query
// ->leftJoin($rootAlias.'.prestataires', 'gpr')
// // ->leftJoin('groupes_prestataires.prestataires', 'pr')
// ->groupBy($rootAlias.'.id')
// ->orderBy('COUNT(gpr.id)', $parameters['_sort_order'])
// ;
}
}
return $query; return $query;
} }
...@@ -107,7 +92,7 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -107,7 +92,7 @@ class GroupeprestataireAdmin extends AbstractAdmin
if (($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT') || $user->isGranted('ROLE_TRESORIER')) && !empty($this->getRequest()->getSession()->get('_groupegere'))) { if (($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT') || $user->isGranted('ROLE_TRESORIER')) && !empty($this->getRequest()->getSession()->get('_groupegere'))) {
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findByGroupeLocal($this->getRequest()->getSession()->get('_groupegere')); $prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findByGroupeLocal($this->getRequest()->getSession()->get('_groupegere'));
} else { } else {
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC')); $prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false), array('raison'=> 'ASC'));
} }
if ($user->isGranted('ROLE_SUPER_ADMIN') || $user->isGranted('ROLE_ADMIN_SIEGE')) { if ($user->isGranted('ROLE_SUPER_ADMIN') || $user->isGranted('ROLE_ADMIN_SIEGE')) {
$formMapper $formMapper
...@@ -132,6 +117,12 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -132,6 +117,12 @@ class GroupeprestataireAdmin extends AbstractAdmin
'label_attr' => array('class' => 'checkbox-inline') 'label_attr' => array('class' => 'checkbox-inline')
)) ))
->end() ->end()
->with('Adresse', ['class' => 'col-md-5'])
->add('geoloc', GeolocFormType::class, array(
'label' => false,
'required' => false
))
->end()
->with('Image', ['class' => 'col-md-5']) ->with('Image', ['class' => 'col-md-5'])
->add('image', MediaType::class, array( ->add('image', MediaType::class, array(
'provider' => 'sonata.media.provider.image', 'provider' => 'sonata.media.provider.image',
...@@ -178,6 +169,7 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -178,6 +169,7 @@ class GroupeprestataireAdmin extends AbstractAdmin
->addIdentifier('type', null, array( ->addIdentifier('type', null, array(
'label' => 'Type' 'label' => 'Type'
)) ))
->addIdentifier('geoloc', null, array('label' => 'Adresse'))
->addIdentifier('horaires', 'html', array( ->addIdentifier('horaires', 'html', array(
'label' => 'Horaires', 'label' => 'Horaires',
'strip' => true, 'strip' => true,
...@@ -187,10 +179,9 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -187,10 +179,9 @@ class GroupeprestataireAdmin extends AbstractAdmin
'label' => 'Nombre de prestas', 'label' => 'Nombre de prestas',
'sortable' => false, 'sortable' => false,
)) ))
->addIdentifier('enabled', null, array( ->add('enabled', null, array(
'label' => 'Activé', 'label' => 'Activé',
'datatype' => 'App.Groupeprestataire', 'editable' => true
'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'
)) ))
; ;
} }
......
...@@ -38,7 +38,7 @@ class NewsAdmin extends AbstractAdmin ...@@ -38,7 +38,7 @@ class NewsAdmin extends AbstractAdmin
'data' => $this->getConfigurationPool()->getContainer()->get('security.token_storage')->getToken()->getUser()->getId(), 'data' => $this->getConfigurationPool()->getContainer()->get('security.token_storage')->getToken()->getUser()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => User::class, 'entity_class' => User::class,
'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager() 'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager()
)) ))
->add('media', MediaType::class, array( ->add('media', MediaType::class, array(
'provider' => 'sonata.media.provider.file', 'provider' => 'sonata.media.provider.file',
......
...@@ -66,7 +66,7 @@ class PageAdmin extends AbstractAdmin ...@@ -66,7 +66,7 @@ class PageAdmin extends AbstractAdmin
'data' => $this->getConfigurationPool()->getContainer()->get('security.token_storage')->getToken()->getUser()->getId(), 'data' => $this->getConfigurationPool()->getContainer()->get('security.token_storage')->getToken()->getUser()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => User::class, 'entity_class' => User::class,
'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager() 'em' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager()
)) ))
->add('name', TextType::class, array( ->add('name', TextType::class, array(
'label' => 'Titre :', 'label' => 'Titre :',
...@@ -113,7 +113,10 @@ class PageAdmin extends AbstractAdmin ...@@ -113,7 +113,10 @@ class PageAdmin extends AbstractAdmin
$listMapper $listMapper
->addIdentifier('user', null, array('label' => 'Auteur')) ->addIdentifier('user', null, array('label' => 'Auteur'))
->addIdentifier('name', null, array('label' => 'Titre')) ->addIdentifier('name', null, array('label' => 'Titre'))
// ->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Page', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig')) // ->add('enabled', null, array(
// 'label' => 'Activé',
// 'editable' => true
// ))
; ;
} }
......
...@@ -8,6 +8,7 @@ use App\Entity\Cotisation; ...@@ -8,6 +8,7 @@ use App\Entity\Cotisation;
use App\Entity\CotisationPrestataire; use App\Entity\CotisationPrestataire;
use App\Entity\EtatPrestataire; use App\Entity\EtatPrestataire;
use App\Entity\Geoloc; use App\Entity\Geoloc;
use App\Entity\GlobalParameter;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Rubrique; use App\Entity\Rubrique;
...@@ -36,12 +37,15 @@ use Sonata\MediaBundle\Provider\Pool; ...@@ -36,12 +37,15 @@ use Sonata\MediaBundle\Provider\Pool;
use Sonata\MediaBundle\Provider\MediaProviderInterface; use Sonata\MediaBundle\Provider\MediaProviderInterface;
use Sonata\AdminBundle\Object\Metadata; use Sonata\AdminBundle\Object\Metadata;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType; use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\PercentType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
...@@ -64,7 +68,7 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -64,7 +68,7 @@ class PrestataireAdmin extends AbstractAdmin
// reverse order (default = 'ASC') // reverse order (default = 'ASC')
'_sort_order' => 'DESC', '_sort_order' => 'DESC',
// name of the ordered field (default = the model's id field, if any) // name of the ordered field (default = the model's id field, if any)
'_sort_by' => 'updatedAt', '_sort_by' => 'raison',
// '_page' => 1, // '_page' => 1,
// '_per_page' => 32 // '_per_page' => 32
]; ];
...@@ -91,10 +95,7 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -91,10 +95,7 @@ class PrestataireAdmin extends AbstractAdmin
{ {
$user = $this->security->getUser(); $user = $this->security->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
// $query
// ->innerJoin($query->getRootAliases()[0] .'.users', 'u')
// ->addSelect('u')
// ;
if ($user->hasRole('ROLE_GESTION_GROUPE') || $user->hasRole('ROLE_CONTACT')) { if ($user->hasRole('ROLE_GESTION_GROUPE') || $user->hasRole('ROLE_CONTACT')) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
$query->andWhere('false'); $query->andWhere('false');
...@@ -121,7 +122,7 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -121,7 +122,7 @@ class PrestataireAdmin extends AbstractAdmin
$users = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(User::class)->findByPrestataire($id); $users = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(User::class)->findByPrestataire($id);
if ($this->isGranted('EDIT') && !empty($users)) { if ($this->isGranted('EDIT') && !empty($users)) {
// TODO : si plusieurs utilisateurs, mettre un lien par user pour modifier celui-ci ? // @TODO : si plusieurs utilisateurs, mettre un lien par user pour modifier celui-ci ?
// $menu->addChild("Modifier l'utilisateur", [ // $menu->addChild("Modifier l'utilisateur", [
// 'uri' => $this->getConfigurationPool ()->getContainer()->get('router')->generate('admin_app_user_edit', ['id' => $user->getId()], UrlGeneratorInterface::ABSOLUTE_URL) // 'uri' => $this->getConfigurationPool ()->getContainer()->get('router')->generate('admin_app_user_edit', ['id' => $user->getId()], UrlGeneratorInterface::ABSOLUTE_URL)
// ]); // ]);
...@@ -204,16 +205,28 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -204,16 +205,28 @@ class PrestataireAdmin extends AbstractAdmin
'label' => 'Horaires', 'label' => 'Horaires',
'required' => false 'required' => false
)) ))
->add('web', UrlType::class, array(
'label' => 'Site Web',
'required' => false
))
->add('description', CKEditorType::class, array( ->add('description', CKEditorType::class, array(
'label' => 'Description', 'label' => 'Description',
'required' => false 'required' => false
)) ))
->add('tauxreconversion', PercentType::class, array(
'label' => 'Taux de reconversion',
'required' => false,
'type' => 'integer',
'help' => 'Si la valeur est nulle, par défaut le taux de reconversion sera de '.$this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(GlobalParameter::class)->val(GlobalParameter::RECONVERSION_PRESTATAIRE).' %'
))
->add('enabled', CheckboxType::class, array(
'label' => 'Activé ?'
))
->end() ->end()
->with('Contact(s)', ['class' => 'col-md-6']) ->with('Contact(s)', ['class' => 'col-md-6'])
->add('contacts', CollectionType::class, array( ->add('contacts', CollectionType::class, array(
'entry_type' => ContactPrestataireFormType::class, 'entry_type' => ContactPrestataireFormType::class,
'entry_options' => array('label' => false), 'entry_options' => array('label' => false),
'required' => false,
'allow_add' => true, 'allow_add' => true,
'allow_delete' => true, 'allow_delete' => true,
'by_reference' => false, 'by_reference' => false,
...@@ -224,7 +237,6 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -224,7 +237,6 @@ class PrestataireAdmin extends AbstractAdmin
->add('geolocs', CollectionType::class, array( ->add('geolocs', CollectionType::class, array(
'entry_type' => GeolocPrestataireFormType::class, 'entry_type' => GeolocPrestataireFormType::class,
'entry_options' => array('label' => false), 'entry_options' => array('label' => false),
'required' => false,
'allow_add' => true, 'allow_add' => true,
'allow_delete' => true, 'allow_delete' => true,
'by_reference' => false, 'by_reference' => false,
...@@ -281,108 +293,21 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -281,108 +293,21 @@ class PrestataireAdmin extends AbstractAdmin
'allow_delete' => true 'allow_delete' => true
)) ))
->end() ->end()
->end()
; ;
// if ($cotisation != null) { // @TODO : add tags model transformer if add new from text
// //@TODO : cotisationS // ->get('etats')
// $formMapper // ->addModelTransformer(new CallbackTransformer(
// ->with('Cotisation', ['class' => 'col-md-6']) // function ($tagsAsArray) {
// ->add('user.cotisations.last.cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => intval($now->format('Y')))) // // transform the array to a string
// ->add('user.cotisations.last.montant', MoneyType::class, array( // return $tagsAsArray;
// 'label' => 'Montant',
// ))
// ->add('user.cotisations.last.moyen', ChoiceType::class, array(
// 'required' => true,
// 'label' => 'Moyen :',
// 'choices' => MoyenEnum::getAvailableTypes(),
// 'choice_label' => function ($choice) {
// return MoyenEnum::getTypeName($choice);
// }, // },
// )) // function ($tagsAsString) {
// ->add('user.cotisations.last.cotisationInfos.recu', CheckboxType::class, array( // // transform the string back to an array
// 'label' => 'Reçu', // return explode(', ', $tagsAsString);
// 'required' => false
// ))
// ->end();
// if (!$this->isCurrentRoute('create')) {
// $formMapper
// ->with('Date', ['class' => 'col-md-6'])
// ->add('user.cotisations.last.cotisationInfos.debut', DateType::class, array(
// 'label' => 'Date de début',
// 'data' => new \DateTime(),
// 'widget' => 'single_text',
// 'html5' => false,
// 'attr' => ['class' => 'js-datepicker'],
// ))
// ->add('user.cotisations.last.cotisationInfos.fin', DateType::class, array(
// 'label' => 'Date de fin',
// 'data' => new \DateTime('+ 1 year'),
// 'widget' => 'single_text',
// 'html5' => false,
// 'attr' => ['class' => 'js-datepicker'],
// ))
// ->end();
// } // }
// } else {
// if (count($presta->getUser()->getCotisations()) > 0) {
// $formMapper
// ->end()
// ->tab('Cotisation')
// ->with('Cotisations', ['class' => 'col-md-12'])
// ->add('user.cotisations', CollectionType::class, array(
// 'entry_type' => CotisationFormType::class,
// // 'data' => $presta->getUser()->getCotisations(),
// // 'entry_options' => array(
// // // 'class' => Cotisation::class,
// // // 'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(CotisationPrestataire::class)->findBy(array('expediteur' => $presta)),
// // // 'choice_label' => 'reference',
// // // 'placeholder' => 'Cotisation',
// // // 'required' => false,
// // 'label' => false
// // ),
// 'by_reference' => false,
// 'allow_add' => false,
// 'allow_delete' => false,
// 'disabled' => true,
// ), array(
// 'admin_code' => 'admin.prestataire.cotisations'
// )) // ))
// ->end()
// ;
// }
// $formMapper
// ->tab('Cotisation '.$cotisation->getAnnee())
// ->with('Cotisation', ['class' => 'col-md-6'])
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y')))
// ->add('user.cotisations.get('.$cnt.').montant', TextType::class, array('label' => 'Montant'))
// ->add('user.cotisations.get('.$cnt.').moyen', ChoiceType::class, array(
// 'required' => true,
// 'label' => 'Moyen :',
// 'choices' => MoyenEnum::getAvailableTypes(),
// 'choice_label' => function ($choice) {
// return MoyenEnum::getTypeName($choice);
// },
// ))
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu'))
// ->end()
// ->with('Date', ['class' => 'col-md-6'])
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.debut', DateType::class, array(
// 'label' => 'Date de début',
// 'data' => new \DateTime(),
// 'widget' => 'single_text',
// 'html5' => false,
// 'attr' => ['class' => 'js-datepicker'],
// ))
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.fin', DateType::class, array(
// 'label' => 'Date de fin',
// 'data' => new \DateTime('+ 1 year'),
// 'widget' => 'single_text',
// 'html5' => false,
// 'attr' => ['class' => 'js-datepicker'],
// ))
// ->end()
// ;
$formMapper->end();
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$formMapper->getFormBuilder()->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($em) { $formMapper->getFormBuilder()->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($em) {
$prestataire = $event->getData(); $prestataire = $event->getData();
...@@ -446,6 +371,7 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -446,6 +371,7 @@ class PrestataireAdmin extends AbstractAdmin
'label' => "Tags", 'label' => "Tags",
'show_filter' => true, 'show_filter' => true,
'advanced_filter' => false 'advanced_filter' => false
], null, ['expanded' => true, 'multiple' => true
]) ])
->add('typeprestataire', null, [ ->add('typeprestataire', null, [
'label' => "Type", 'label' => "Type",
...@@ -494,26 +420,53 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -494,26 +420,53 @@ class PrestataireAdmin extends AbstractAdmin
return $this->userManager; return $this->userManager;
} }
public function getRouteShowOnFront($object)
{
return $this->routeGenerator->generate('show_prestataire', array('slug' => $object->getSlug()));
}
protected function configureListFields(ListMapper $listMapper): void protected function configureListFields(ListMapper $listMapper): void
{ {
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$user = $this->security->getUser(); $user = $this->security->getUser();
$listMapper $listMapper
->addIdentifier('raison') ->addIdentifier('raison')
->add('rubriques', null) ->add('groupe', null, array(
->addIdentifier('groupe', null, array(
'label' => 'Groupe', 'label' => 'Groupe',
'sortable' => true, 'sortable' => true,
'sort_field_mapping' => array('fieldName' => 'name'), 'sort_field_mapping' => array('fieldName' => 'name'),
'sort_parent_association_mappings' => array(array('fieldName' => 'groupe')) 'sort_parent_association_mappings' => array(array('fieldName' => 'groupe'))
)) ))
->addIdentifier('users', null, array('label' => 'Gestionnaires')) // ->addIdentifier('users', null, array('label' => 'Gestionnaires'))
->addIdentifier('etats', null, array('label' => 'Tags')) ->add('rubriques', null)
->addIdentifier('enabled', null, array( ->add('etats', null, array(
'label' => 'Tags',
// 'editable' => true,
// 'class' => EtatPrestataire::class,
// 'multiple' => true,
// // 'required' => false,
// // 'by_reference' => false,
// 'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(EtatPrestataire::class)->findBy(array('enabled' => true))
))
->add('enabled', null, array(
'label' => 'Activé', 'label' => 'Activé',
'datatype' => 'App.Groupeprestataire', 'editable' => true
'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig' ))
->add('updatedAt', null, array(
'label' => 'Mis à jour'
)) ))
// You may also specify the actions you want to be displayed in the list
->add('_action', null, [
'actions' => [
'show' => ['template' => '@SonataAdmin/CRUD/list__action_showonfront.html.twig'],
'edit' => [
// You may add custom link parameters used to generate the action url
'link_parameters' => [
'full' => true,
]
],
]
])
; ;
} }
......
...@@ -41,8 +41,9 @@ class ReconversionAdmin extends FluxAdmin ...@@ -41,8 +41,9 @@ class ReconversionAdmin extends FluxAdmin
{ {
$user = $this->security->getUser(); $user = $this->security->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
$query->andWhere($query->getRootAliases()[0].".type = :type") $query
->setParameter('type', 'prestataire_siege'); ->andWhere($query->getRootAliases()[0].".type = :type")
->setParameter('type', 'reconversion');
; ;
return $query; return $query;
} }
...@@ -59,9 +60,11 @@ class ReconversionAdmin extends FluxAdmin ...@@ -59,9 +60,11 @@ class ReconversionAdmin extends FluxAdmin
->addIdentifier('operateur', User::class, array('label' => 'Operateur')) ->addIdentifier('operateur', User::class, array('label' => 'Operateur'))
->addIdentifier('expediteur', null, array('label' => 'Expediteur')) ->addIdentifier('expediteur', null, array('label' => 'Expediteur'))
->addIdentifier('destinataire', null, array('label' => 'Destinataire')) ->addIdentifier('destinataire', null, array('label' => 'Destinataire'))
->addIdentifier('montant', null, array('label' => 'Montant')) ->add('montant', null, array('label' => 'Montant initial'))
->addIdentifier('reference', null, array('label' => 'Reference')) ->add('tauxreconversion', null, array('label' => 'Taux reconversion'))
->addIdentifier('reconverti', null, array('label' => 'Reconverti ?', 'datatype' => 'App.Flux', 'template' => 'block/reconverti_field.html.twig')) ->add('montantareconvertir', null, array('label' => 'Montant à transférer'))
->add('reference', null, array('label' => 'Reference'))
->add('reconverti', null, array('label' => 'Reconverti ?', 'datatype' => 'App.Flux', 'template' => 'block/reconverti_field.html.twig'))
; ;
} }
......
...@@ -33,7 +33,7 @@ class RubriqueAdmin extends AbstractAdmin ...@@ -33,7 +33,7 @@ class RubriqueAdmin extends AbstractAdmin
protected $security; protected $security;
protected $datagridValues = [ protected $datagridValues = [
'_sort_order' => 'ASC', '_sort_order' => 'ASC',
'_sort_by' => 'id', '_sort_by' => 'name',
]; ];
public function configure() public function configure()
...@@ -66,7 +66,7 @@ class RubriqueAdmin extends AbstractAdmin ...@@ -66,7 +66,7 @@ class RubriqueAdmin extends AbstractAdmin
{ {
$rubrique = $this->getSubject(); $rubrique = $this->getSubject();
$user = $this->security->getUser(); $user = $this->security->getUser();
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison'=> 'ASC')); $prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false), array('raison'=> 'ASC'));
// get the current Image instance // get the current Image instance
$imageHelp = null; $imageHelp = null;
...@@ -126,19 +126,16 @@ class RubriqueAdmin extends AbstractAdmin ...@@ -126,19 +126,16 @@ class RubriqueAdmin extends AbstractAdmin
; ;
} }
public function getRouteShowOnFront($object)
{
return $this->routeGenerator->generate('show_rubrique', array('slug' => $object->getSlug()));
}
protected function configureRoutes(RouteCollection $collection) protected function configureRoutes(RouteCollection $collection)
{ {
// $collection->remove('delete'); // $collection->remove('delete');
} }
// public function getBatchActions()
// {
// $actions = parent::getBatchActions();
// unset($actions['delete']);
// return $actions;
// }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -146,17 +143,20 @@ class RubriqueAdmin extends AbstractAdmin ...@@ -146,17 +143,20 @@ class RubriqueAdmin extends AbstractAdmin
{ {
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('file', null, array('label' => 'Icône', 'template' => '@SonataAdmin/Image/preview_image_o.html.twig')) ->add('file', null, array('label' => 'Icône', 'template' => '@SonataAdmin/Image/preview_image_o.html.twig'))
->add('name', null, array('editable' => true, 'truncate' => array('length' => 80), 'label' => 'Nom du groupe')) ->add('name', null, array('editable' => true, 'truncate' => array('length' => 80), 'label' => 'Nom du groupe'))
->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description')) ->add('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description'))
->add('getPrestatairesCount', null, array( ->add('getPrestatairesCount', null, array(
'label' => 'Nombre de prestas', 'label' => 'Nombre de prestas',
'sortable' => false, 'sortable' => false
))
->add('enabled', null, array(
'label' => 'Activé',
'editable' => true
)) ))
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Groupeprestataire', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
// You may also specify the actions you want to be displayed in the list
->add('_action', null, [ ->add('_action', null, [
'actions' => [ 'actions' => [
'show' => ['template' => '@SonataAdmin/CRUD/list__action_showonfront.html.twig'],
'edit' => [], 'edit' => [],
'delete' => [], 'delete' => [],
] ]
......
...@@ -65,7 +65,7 @@ class TransfertAdmin extends FluxAdmin ...@@ -65,7 +65,7 @@ class TransfertAdmin extends FluxAdmin
// $query->andWhere($query->getRootAliases()[0].".parenttype = :type") // $query->andWhere($query->getRootAliases()[0].".parenttype = :type")
// ->setParameter('type', 'transfert'); // ->setParameter('type', 'transfert');
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$fluxtable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName(); $fluxtable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
if ($this->rolecheck->isGranted('ROLE_GESTION_GROUPE') || $this->rolecheck->isGranted('ROLE_CONTACT')) { if ($this->rolecheck->isGranted('ROLE_GESTION_GROUPE') || $this->rolecheck->isGranted('ROLE_CONTACT')) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
...@@ -74,7 +74,7 @@ class TransfertAdmin extends FluxAdmin ...@@ -74,7 +74,7 @@ class TransfertAdmin extends FluxAdmin
$groupe = $this->getRequest()->getSession()->get('_groupegere'); $groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection(); $connection = $em->getConnection();
$prestatable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName(); $prestatable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName();
$statement = $connection->prepare('SELECT f.id FROM '.$fluxtable.' f WHERE f.groupe_id = '.$groupe->getId().' OR (f.type = \'prestataire_siege\' AND f.prestataire_id IN (SELECT p.id FROM '.$fluxtable.' p WHERE p.groupe_id = '.$groupe->getId().'))'); $statement = $connection->prepare('SELECT f.id FROM '.$fluxtable.' f WHERE f.groupe_id = '.$groupe->getId().' OR (f.type = \'reconversion\' AND f.prestataire_id IN (SELECT p.id FROM '.$fluxtable.' p WHERE p.groupe_id = '.$groupe->getId().'))');
$statement->execute(); $statement->execute();
$ids = $statement->fetchAll(); $ids = $statement->fetchAll();
$query $query
...@@ -83,11 +83,11 @@ class TransfertAdmin extends FluxAdmin ...@@ -83,11 +83,11 @@ class TransfertAdmin extends FluxAdmin
; ;
} }
} elseif ($this->rolecheck->isGranted('ROLE_COMPTOIR')) { } elseif ($this->rolecheck->isGranted('ROLE_COMPTOIR')) {
if (empty($user->getComptoirsgeres())) { if (empty($this->getRequest()->getSession()->get('_comptoirgere'))) {
$query->andWhere('false'); $query->andWhere('false');
} else { } else {
$comptoir = $this->session->get('_comptoirgere'); $comptoir = $this->getRequest()->getSession()->get('_comptoirgere');
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$connection = $em->getConnection(); $connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM '.$fluxtable.' f WHERE f.comptoir_id = '.$comptoir->getId().' OR f.user_id = '.$user->getId()); $statement = $connection->prepare('SELECT f.id FROM '.$fluxtable.' f WHERE f.comptoir_id = '.$comptoir->getId().' OR f.user_id = '.$user->getId());
$statement->execute(); $statement->execute();
......
...@@ -59,7 +59,10 @@ class UserAdmin extends BaseUserAdmin ...@@ -59,7 +59,10 @@ class UserAdmin extends BaseUserAdmin
->addIdentifier('username') ->addIdentifier('username')
->add('email') ->add('email')
->add('groups') ->add('groups')
->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.User', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig')) ->add('enabled', null, array(
'label' => 'Activé',
'editable' => true
))
->add('createdAt') ->add('createdAt')
; ;
......
...@@ -4,10 +4,9 @@ namespace App\Controller; ...@@ -4,10 +4,9 @@ namespace App\Controller;
use App\Entity\Comptoir; use App\Entity\Comptoir;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
class ComptoirController extends AbstractController class ComptoirController extends FrontController
{ {
private $em; private $em;
...@@ -21,6 +20,9 @@ class ComptoirController extends AbstractController ...@@ -21,6 +20,9 @@ class ComptoirController extends AbstractController
*/ */
public function listeComptoirAction() public function listeComptoirAction()
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
return $this->render('comptoir/liste.html.twig', array( return $this->render('comptoir/liste.html.twig', array(
'comptoirs' => $this->em->getRepository(Comptoir::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC')) 'comptoirs' => $this->em->getRepository(Comptoir::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC'))
)); ));
...@@ -31,6 +33,9 @@ class ComptoirController extends AbstractController ...@@ -31,6 +33,9 @@ class ComptoirController extends AbstractController
*/ */
public function carteComptoirAction() public function carteComptoirAction()
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
return $this->render('comptoir/carte.html.twig', array( return $this->render('comptoir/carte.html.twig', array(
'comptoirs' => $this->em->getRepository(Comptoir::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC')) 'comptoirs' => $this->em->getRepository(Comptoir::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC'))
)); ));
...@@ -41,9 +46,11 @@ class ComptoirController extends AbstractController ...@@ -41,9 +46,11 @@ class ComptoirController extends AbstractController
*/ */
public function showGroupeAction(Comptoir $comptoir) public function showGroupeAction(Comptoir $comptoir)
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
return $this->render('comptoir/show.html.twig', array( return $this->render('comptoir/show.html.twig', array(
'comptoir' => $comptoir 'comptoir' => $comptoir
)); ));
} }
} }
<?php
namespace App\Controller;
use App\Entity\Faq;
use Doctrine\ORM\EntityManagerInterface;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class FaqController extends FrontController
{
protected $em;
private $paginator;
public function __construct(EntityManagerInterface $em, PaginatorInterface $paginator)
{
$this->em = $em;
$this->paginator = $paginator;
}
/**
* @Route("/faq", name="faq")
*/
public function faqAction()
{
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
return $this->render('faq/liste.html.twig', array(
'faqs' => $this->em->getRepository(Faq::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC'))
));
}
/**
* @Route("/faq/{slug}", name="show_faq")
*/
public function showFaqAction(Faq $faq)
{
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
return $this->render('faq/show.html.twig', array(
'faq' => $faq
));
}
}
...@@ -13,6 +13,7 @@ use Symfony\Component\HttpFoundation\Request; ...@@ -13,6 +13,7 @@ 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\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
/** /**
...@@ -41,8 +42,9 @@ class FluxController extends AbstractController ...@@ -41,8 +42,9 @@ class FluxController extends AbstractController
protected $eventDispatcher; protected $eventDispatcher;
protected $session; protected $session;
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator, EventDispatcherInterface $eventDispatcher, SessionInterface $session) public function __construct(Security $security, EntityManagerInterface $em, TranslatorInterface $translator, EventDispatcherInterface $eventDispatcher, SessionInterface $session)
{ {
$this->security = $security;
$this->em = $em; $this->em = $em;
$this->translator = $translator; $this->translator = $translator;
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
...@@ -51,6 +53,9 @@ class FluxController extends AbstractController ...@@ -51,6 +53,9 @@ class FluxController extends AbstractController
protected function manageFluxForm(Request $request, Form $form, $compte, $success, $title) protected function manageFluxForm(Request $request, Form $form, $compte, $success, $title)
{ {
if ($this->security->getUser() == null) {
throw new \Exception("[FLUX] Opération impossible ! Utilisateur déconnecté !");
}
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData(); $data = $form->getData();
...@@ -74,7 +79,6 @@ class FluxController extends AbstractController ...@@ -74,7 +79,6 @@ class FluxController extends AbstractController
return $this->render('flux/transaction.html.twig', [ return $this->render('flux/transaction.html.twig', [
'form' => $form->createView(), 'form' => $form->createView(),
// 'compte' => $compte,
'title' => $title 'title' => $title
]); ]);
} }
......
<?php
namespace App\Controller;
use App\Entity\GlobalParameter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class FrontController extends AbstractController
{
protected function isFrontActivated()
{
return ($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::USE_WORDPRESS) == 'false');
}
}
...@@ -4,13 +4,12 @@ namespace App\Controller; ...@@ -4,13 +4,12 @@ namespace App\Controller;
use App\Entity\Groupe; use App\Entity\Groupe;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
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;
class GroupeController extends AbstractController class GroupeController extends FrontController
{ {
private $em; protected $em;
public function __construct(EntityManagerInterface $em) public function __construct(EntityManagerInterface $em)
{ {
...@@ -22,6 +21,9 @@ class GroupeController extends AbstractController ...@@ -22,6 +21,9 @@ class GroupeController extends AbstractController
*/ */
public function listeGroupeAction() public function listeGroupeAction()
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
return $this->render('groupe/liste.html.twig', array( return $this->render('groupe/liste.html.twig', array(
'groupes' => $this->em->getRepository(Groupe::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC')) 'groupes' => $this->em->getRepository(Groupe::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC'))
)); ));
...@@ -33,9 +35,11 @@ class GroupeController extends AbstractController ...@@ -33,9 +35,11 @@ class GroupeController extends AbstractController
*/ */
public function showGroupeAction(Groupe $groupe) public function showGroupeAction(Groupe $groupe)
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
return $this->render('groupe/show.html.twig', array( return $this->render('groupe/show.html.twig', array(
'groupe' => $groupe 'groupe' => $groupe
)); ));
} }
} }
...@@ -24,7 +24,7 @@ class GroupePrestaController extends AbstractController ...@@ -24,7 +24,7 @@ class GroupePrestaController extends AbstractController
} }
/** /**
* @Route("/prestataires/groupe/{type}/{slug}", name="show_groupeprestataire") * @Route("/prestataires/groupe/{slug}", name="show_groupeprestataire")
*/ */
public function showGroupeAction(Groupeprestataire $groupe) public function showGroupeAction(Groupeprestataire $groupe)
{ {
......
...@@ -30,6 +30,7 @@ use Geocoder\Provider\Nominatim\Nominatim; ...@@ -30,6 +30,7 @@ use Geocoder\Provider\Nominatim\Nominatim;
use Geocoder\Query\GeocodeQuery; use Geocoder\Query\GeocodeQuery;
use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Annotation\Model;
use Nelmio\ApiDocBundle\Annotation\Security; use Nelmio\ApiDocBundle\Annotation\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Swagger\Annotations as SWG; use Swagger\Annotations as SWG;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
...@@ -45,6 +46,7 @@ use Symfony\Component\Security\Core\Exception\AuthenticationException; ...@@ -45,6 +46,7 @@ use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security as Secur; use Symfony\Component\Security\Core\Security as Secur;
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\Templating\EngineInterface;
class IndexController extends AbstractController class IndexController extends AbstractController
{ {
...@@ -54,8 +56,10 @@ class IndexController extends AbstractController ...@@ -54,8 +56,10 @@ class IndexController extends AbstractController
private $tokenManager; private $tokenManager;
private $guard; private $guard;
private $session; private $session;
private $mailer;
private $templating;
public function __construct(EventDispatcherInterface $eventDispatcher, EntityManagerInterface $em, UserManagerInterface $userManager, CsrfTokenManagerInterface $tokenManager = null, GuardAuthenticatorHandler $guard, SessionInterface $session) public function __construct(EventDispatcherInterface $eventDispatcher, EntityManagerInterface $em, UserManagerInterface $userManager, CsrfTokenManagerInterface $tokenManager = null, GuardAuthenticatorHandler $guard, SessionInterface $session, \Swift_Mailer $mailer, EngineInterface $templating)
{ {
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
$this->em = $em; $this->em = $em;
...@@ -63,6 +67,8 @@ class IndexController extends AbstractController ...@@ -63,6 +67,8 @@ class IndexController extends AbstractController
$this->tokenManager = $tokenManager; $this->tokenManager = $tokenManager;
$this->guard = $guard; $this->guard = $guard;
$this->session = $session; $this->session = $session;
$this->mailer = $mailer;
$this->templating = $templating;
} }
/** /**
...@@ -94,7 +100,13 @@ class IndexController extends AbstractController ...@@ -94,7 +100,13 @@ class IndexController extends AbstractController
? $this->tokenManager->getToken('authenticate')->getValue() ? $this->tokenManager->getToken('authenticate')->getValue()
: null; : null;
return $this->render('index.html.twig', [ $isWordpress = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::USE_WORDPRESS) != 'false';
$template = 'index.html.twig';
if ($isWordpress) {
$template = 'index_wordpress.html.twig';
}
return $this->render($template, [
'news' => array(), 'news' => array(),
'last_username' => $lastUsername, 'last_username' => $lastUsername,
'csrf_token' => $csrfToken 'csrf_token' => $csrfToken
...@@ -107,9 +119,10 @@ class IndexController extends AbstractController ...@@ -107,9 +119,10 @@ class IndexController extends AbstractController
public function installationAction(Request $request) public function installationAction(Request $request)
{ {
$siege = $this->em->getRepository(Siege::class)->findOneById(1); $siege = $this->em->getRepository(Siege::class)->findOneById(1);
// if (!empty($siege)) { if (!empty($siege)) {
// return $this->redirectToRoute('index'); // Installation déjà effectuée !
// } return $this->redirectToRoute('index');
}
$repogroup = $this->em->getRepository(Usergroup::class); $repogroup = $this->em->getRepository(Usergroup::class);
$group = $repogroup->findOneBy(array('name' => 'Super Admin')); $group = $repogroup->findOneBy(array('name' => 'Super Admin'));
if (empty($group)) { if (empty($group)) {
...@@ -153,16 +166,24 @@ class IndexController extends AbstractController ...@@ -153,16 +166,24 @@ class IndexController extends AbstractController
foreach ($configs as $config) { foreach ($configs as $config) {
$this->em->persist($config); $this->em->persist($config);
} }
// Création de l'utilisateur avec ROLE_API pour le plugin Wordpress ou les applis tierces !
$userAPI = $this->userManager->createUser();
$userAPI->setEnabled(true);
$userAPI->setUsername('userapi');
$userAPI->setemail('userapi@kohinos.fr');
$userAPI->addRole('ROLE_API');
$this->em->persist($userAPI);
$this->em->flush(); $this->em->flush();
$this->addFlash( $this->addFlash(
'success', 'success',
'BRAVO ! Vous avez créer le siège et le premier utilisateur' "BRAVO ! Vous venez de configurer le Kohinos. Vous pouvez maintenant accéder à l'interface d'administration."
); );
$url = $this->generateUrl('fos_user_registration_confirmed'); $url = $this->generateUrl('fos_user_registration_confirmed');
$response = new RedirectResponse($url); $response = new RedirectResponse($url);
// TODO : send mail with this event catch ! // @TODO : send mail with this event catch !
$this->eventDispatcher->dispatch(FOSUserEvents::REGISTRATION_COMPLETED, new FilterUserResponseEvent($user, $request, $response)); $this->eventDispatcher->dispatch(FOSUserEvents::REGISTRATION_COMPLETED, new FilterUserResponseEvent($user, $request, $response));
$referer = $request->headers->get('referer'); $referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) { if ($referer && !$request->isXmlHttpRequest()) {
...@@ -192,16 +213,17 @@ class IndexController extends AbstractController ...@@ -192,16 +213,17 @@ class IndexController extends AbstractController
$adherent->setEcompte('0'); $adherent->setEcompte('0');
$user->setAdherent($adherent); $user->setAdherent($adherent);
$adherent->setUser($user); $adherent->setUser($user);
if (count($adherent->getUser()->getCotisations()) <= 0) { // @TODO : ajouter le moyen de payer sa cotisation en CB directement
$cotisation = new Cotisation(); // if (count($adherent->getUser()->getCotisations()) <= 0) {
$cotisation->setMontant(floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_MONTANT))); // $cotisation = new Cotisation();
$cotisation->setOperateur($adherent->getUser()); // $cotisation->setMontant(floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_ADHERENT)));
$cotisation->setExpediteur($adherent); // $cotisation->setOperateur($adherent->getUser());
$cotisation->setMoyen(MoyenEnum::MOYEN_AUTRE); // $cotisation->setExpediteur($adherent);
$cotisation->setDebut(new \DateTime()); // $cotisation->setMoyen(MoyenEnum::MOYEN_AUTRE);
$cotisation->setFin(new \DateTime('+ 1 year')); // $cotisation->setDebut(new \DateTime());
$adherent->getUser()->addCotisation($cotisation); // $cotisation->setFin(new \DateTime('+ 1 year'));
} // $adherent->getUser()->addCotisation($cotisation);
// }
if ($adherent->getGeoloc() == null) { if ($adherent->getGeoloc() == null) {
$adherent->setGeoloc(new Geoloc()); $adherent->setGeoloc(new Geoloc());
} }
...@@ -211,22 +233,19 @@ class IndexController extends AbstractController ...@@ -211,22 +233,19 @@ class IndexController extends AbstractController
if ($form->isSubmitted()) { if ($form->isSubmitted()) {
if ($form->isValid()) { if ($form->isValid()) {
$adherentNew = $form->getData(); $adherentNew = $form->getData();
$cotisationNew = $form['cotisation']->getData(); // @TODO : redirect to paiement page
$this->em->persist($cotisationNew); // $this->em->persist($adherentNew);
$adherentNew->getUser()->addCotisation($cotisationNew); // $this->em->flush();
$this->em->persist($adherentNew); // $this->addFlash(
$this->em->persist($adherentNew->getUser()); // 'success',
$this->em->flush(); // 'Adhésion bien pris en compte, vous recevrez un email très bientôt !'
$this->addFlash( // );
'success',
'Adhésion bien pris en compte, vous recevrez un email très bientôt !'
);
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
} else { } else {
$this->addFlash( $this->addFlash(
'error', 'error',
'Problème avec l\'adhésion !' 'Problème avec l\'adhésion, veuillez vérifier les informations du formulaire !'
); );
} }
} }
...@@ -250,6 +269,7 @@ class IndexController extends AbstractController ...@@ -250,6 +269,7 @@ 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")
*/ */
public function groupeChoiceAction(Usergroup $group, Groupe $groupe, Request $request) public function groupeChoiceAction(Usergroup $group, Groupe $groupe, Request $request)
{ {
...@@ -267,6 +287,7 @@ class IndexController extends AbstractController ...@@ -267,6 +287,7 @@ class IndexController extends AbstractController
* @Route("/login/comptoir/choice/{usergrpid}/{cptid}", name="comptoir_choice") * @Route("/login/comptoir/choice/{usergrpid}/{cptid}", name="comptoir_choice")
* @ParamConverter("group", class="App:Usergroup", options={"mapping": {"usergrpid": "id"}}) * @ParamConverter("group", class="App:Usergroup", options={"mapping": {"usergrpid": "id"}})
* @ParamConverter("comptoir", class="App:Comptoir", options={"mapping": {"cptid": "id"}}) * @ParamConverter("comptoir", class="App:Comptoir", options={"mapping": {"cptid": "id"}})
* @IsGranted("ROLE_ADMIN")
*/ */
public function comptoirChoiceAction(Usergroup $group, Comptoir $comptoir, Request $request) public function comptoirChoiceAction(Usergroup $group, Comptoir $comptoir, Request $request)
{ {
...@@ -284,6 +305,7 @@ class IndexController extends AbstractController ...@@ -284,6 +305,7 @@ class IndexController extends AbstractController
* @Route("/login/presta/choice/{usergrpid}/{prestaid}", name="presta_choice") * @Route("/login/presta/choice/{usergrpid}/{prestaid}", name="presta_choice")
* @ParamConverter("group", class="App:Usergroup", options={"mapping": {"usergrpid": "id"}}) * @ParamConverter("group", class="App:Usergroup", options={"mapping": {"usergrpid": "id"}})
* @ParamConverter("prestataire", class="App:Prestataire", options={"mapping": {"prestaid": "id"}}) * @ParamConverter("prestataire", class="App:Prestataire", options={"mapping": {"prestaid": "id"}})
* @IsGranted({"ROLE_ADMIN", "ROLE_PRESTATAIRE"})
*/ */
public function prestaChoiceAction(Usergroup $group, Prestataire $prestataire, Request $request) public function prestaChoiceAction(Usergroup $group, Prestataire $prestataire, Request $request)
{ {
...@@ -298,6 +320,7 @@ class IndexController extends AbstractController ...@@ -298,6 +320,7 @@ class IndexController extends AbstractController
/** /**
* @Route("/login/group/choice/{id}", name="usergroup_choice") * @Route("/login/group/choice/{id}", name="usergroup_choice")
* @IsGranted("ROLE_ADMIN")
*/ */
public function groupChoiceAction(Usergroup $group, Request $request) public function groupChoiceAction(Usergroup $group, Request $request)
{ {
...@@ -311,41 +334,6 @@ class IndexController extends AbstractController ...@@ -311,41 +334,6 @@ class IndexController extends AbstractController
} }
/** /**
* @Route("/page/{slug}", name="show_page")
*/
public function pageAction(Page $page)
{
$template = 'page.html.twig';
if (!empty($page->getTemplate()) && $this->get('templating')->exists($page->getTemplate())) {
$template = $page->getTemplate();
}
return $this->render($template, array(
'page' => $page
));
}
/**
* @Route("/faq", name="faq")
*/
public function faqAction()
{
return $this->render('faq/liste.html.twig', array(
'faqs' => $this->em->getRepository(Faq::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC'))
));
}
/**
* @Route("/faq/{slug}", name="show_faq")
*/
public function showFaqAction(Faq $faq)
{
return $this->render('faq/show.html.twig', array(
'faq' => $faq
));
}
/**
* @Route("/contact", name="contact") * @Route("/contact", name="contact")
*/ */
public function contactAction(Request $request) public function contactAction(Request $request)
...@@ -354,10 +342,12 @@ class IndexController extends AbstractController ...@@ -354,10 +342,12 @@ class IndexController extends AbstractController
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$nom = $form['nom']->getData(); $name = $form['nom']->getData();
$emailFrom = $form['email']->getData(); $emailFrom = $form['email']->getData();
$message = $form['message']->getData(); $message = $form['message']->getData();
// TODO : send mail
$this->sendMail($name, $emailFrom, $message);
$this->addFlash( $this->addFlash(
'success', 'success',
'Merci ! Le message a bien été envoyé !' 'Merci ! Le message a bien été envoyé !'
...@@ -373,4 +363,25 @@ class IndexController extends AbstractController ...@@ -373,4 +363,25 @@ class IndexController extends AbstractController
'form' => $form->createView() 'form' => $form->createView()
)); ));
} }
private function sendMail($name, $from, $message)
{
$subject = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_NAME_SMALL).' : Contact';
$mail = (new \Swift_Message($subject))
->setFrom($from)
->setTo($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_CONTACT_EMAIL))
->setBody(
$this->templating->render(
'email/contact.html.twig',
array(
'subject' => $subject,
'from' => $from,
'name' => $name,
'message' => $message,
)
),
'text/html'
);
$this->mailer->send($mail);
}
} }
...@@ -3,90 +3,139 @@ ...@@ -3,90 +3,139 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Rubrique; use App\Entity\Comptoir;
use App\Entity\Groupeprestataire;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Sonata\MediaBundle\Provider\Pool;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\RouterInterface;
use Sonata\MediaBundle\Provider\ImageProvider; use Sonata\MediaBundle\Twig\Extension\MediaExtension;
use Symfony\Component\HttpFoundation\Request;
class MapController extends AbstractController class MapController extends AbstractController
{ {
protected $imageProvider; public function __construct(EntityManagerInterface $em, RouterInterface $router, Pool $mediaext)
private $em;
public function __construct(ImageProvider $imageProvider, EntityManagerInterface $em)
{ {
$this->imageProvider = $imageProvider;
$this->em = $em; $this->em = $em;
$this->router = $router;
$this->mediaext = $mediaext;
} }
/** /**
* @Route("/map/json/prestataire", name="map_prestataire_json", defaults={"rubrique": null}) * @Route(
* @Route("/map/json/prestataire/{id}", name="map_prestataire_json_rubrique") * name="papi_poi_all",
* path="/public/poi/all",
* methods={"GET"},
* defaults={
* "_api_resource_class"=Map::class,
* "_api_item_operation_name"="get_all_poi"
* }
* )
*/ */
public function getJsonPrestataireMap(Rubrique $rubrique = null) public function __invoke(Request $request)
{ {
$points = []; // @TODO : à tester plus !
$filtered_cat = null; if ($request->query->has('geoloc') && $request->query->has('distance')) {
if ($rubrique != null) { $geoloc = json_decode($request->query->get('geoloc'));
$prestataires = $this->em->getRepository(Prestataire::class)->findByRubrique($rubrique); $lat = $geoloc[0];
$lon = $geoloc[1];
$distance = intval($request->query->get('distance'));
$prestas = $this->em->getRepository(Prestataire::class)->findByGeoloc($lat, $lon, $distance);
$comptoirs = $this->em->getRepository(Comptoir::class)->findByGeoloc($lat, $lon, $distance);
$groupeprestataires = $this->em->getRepository(Groupeprestataire::class)->findByGeoloc($lat, $lon, $distance);
} else { } else {
$prestataires = $this->em->getRepository(Prestataire::class)->findBy(['enabled' => true]); $prestas = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'mlc' => false), array('raison'=> 'ASC'));
} $comptoirs = $this->em->getRepository(Comptoir::class)->findBy(array('enabled' => true), array('name'=> 'ASC'));
dump($rubrique); $groupeprestataires = $this->em->getRepository(Groupeprestataire::class)->findBy(array('enabled' => true), array('name'=> 'ASC'));
dump($prestataires); }
foreach ($prestataires as $presta) {
dump($presta->getGeolocs()->toArray()); $data = [];
// if ($rubrique === null || $presta->getRubriques()->contains($rubrique)) { $count = 0;
$geolocs = array_map(function ($geoloc) { foreach ($prestas as $presta) {
if ($geoloc->isEnabled()) { if (count($presta->getGeolocs()) > 0) {
return $geoloc; foreach ($presta->getGeolocs() as $geolocp) {
} if ($geolocp->isEnabled() && $geolocp->getGeoloc()->getLat() != null && $geolocp->getGeoloc()->getLon() != null) {
}, $presta->getGeolocs()->toArray()); $data[$count]['name'] = $presta->__toString();
if (count($geolocs) > 0) { $data[$count]['content'] = $presta->getDescription();
dump('yeah'); $data[$count]['web'] = $presta->getWeb();
$geoloc = $geolocs[0]; $data[$count]['link'] = $this->router->generate('show_prestataire', ['slug' => $presta->getSlug()]);
// list($lat, $lon) = explode(',', $presta->latlon); $data[$count]['hours'] = $presta->getHoraires();
if ($geoloc->getGeoloc()->getLon() != null and $geoloc->getGeoloc()->getLat() != null) { if ($presta->getMedia() != null) {
dump('yeah2'); $data[$count]['thumbnail'] = $this->path($presta->getMedia(), 'small', $request);
$p = new \StdClass(); }
$p->type = "Feature"; $data[$count]['geolocs'][] = $geolocp;
$p->geometry = [ if (count($presta->getRubriques()) > 0) {
'type'=>'Point', foreach ($presta->getRubriques() as $rub) {
'coordinates' => [$geoloc->getGeoloc()->getLon(),$geoloc->getGeoloc()->getLat()] $data[$count]['rubriques'][] = [
]; 'name' => $rub->getName(),
// $cat = []; 'url' => $this->router->generate('show_rubrique', ['slug' => $rub->getSlug()]),
// foreach ($geo_cats as $gc) {
// if ($gc['id'] == $c->cat) {
// $cat = $gc;
// }
// }
$p->cat = array_map(function ($rubrique) {
// $provider = $this->container->get($rubrique->getMedia()->getProviderName());
return [
'name' => $rubrique->getName(),
'icon' => (($rubrique->getMedia() != null)?$this->imageProvider->generatePublicUrl($rubrique->getMedia(), 'preview'):null),
'content' => $rubrique->getContent()
]; ];
}, $presta->getRubriques()->toArray()); }
if ($presta->getRubriques()[0]->getMedia() != null) {
$data[$count]['icon'] = $this->path($presta->getRubriques()[0]->getMedia(), 'preview', $request);
}
}
$count++;
}
}
}
}
$properties = [ foreach ($comptoirs as $comptoir) {
if ($comptoir->getGeoloc() != null && $comptoir->getGeoloc()->getLat() != null && $comptoir->getGeoloc()->getLon() != null) {
$data[$count]['name'] = $comptoir->__toString();
$data[$count]['content'] = $comptoir->getContent();
$data[$count]['geolocs'][] = $comptoir->getGeoloc();
$data[$count]['link'] = $this->router->generate('show_comptoir', ['slug' => $comptoir->getSlug()]);
if ($comptoir->getMedia() != null) {
$data[$count]['thumbnail'] = $this->path($comptoir->getMedia(), 'small', $request);
}
$count++;
}
}
foreach ($groupeprestataires as $groupeprestataire) {
if ($groupeprestataire->getGeoloc() != null && $groupeprestataire->getGeoloc()->getLat() != null && $groupeprestataire->getGeoloc()->getLon() != null) {
$data[$count]['name'] = $groupeprestataire->__toString();
$data[$count]['content'] = $groupeprestataire->getContent();
$data[$count]['geolocs'][] = $groupeprestataire->getGeoloc();
$data[$count]['hours'] = $groupeprestataire->getHoraires();
$data[$count]['link'] = $this->router->generate('show_groupeprestataire', ['slug' => $groupeprestataire->getSlug()]);
// if ($groupeprestataire->getMedia() != null) {
// $data[$count]['thumbnail'] = $this->path($groupeprestataire->getMedia(), 'small', $request);
// }
foreach ($groupeprestataire->getPrestataires() as $presta) {
$groupeprestaData = [
'name' => $presta->__toString(), 'name' => $presta->__toString(),
'popupContent'=>$presta->getMapContent(), 'link' => $this->router->generate('show_prestataire', ['slug' => $presta->getSlug()])
]; ];
// if (isset($cat['id'])) { if (count($presta->getRubriques()) > 0) {
// $properties['cat'] = $cat['id']; if ($presta->getRubriques()[0]->getMedia() != null) {
// } $groupeprestaData['rubrique']['name'] = $presta->getRubriques()[0]->getName();
$p->properties = $properties; $groupeprestaData['rubrique']['icon'] = $this->path($presta->getRubriques()[0]->getMedia(), 'preview', $request);
$points[] = $p;
} }
} }
// } $data[$count]['prestataires'][] = $groupeprestaData;
}
$count++;
} }
dump($points); }
exit();
return new JsonResponse($points); return $data;
}
private function path($media, $format, $request)
{
if (!$media) {
return '';
}
$provider = $this->mediaext
->getProvider($media->getProviderName());
$format = $provider->getFormatName($media, $format);
return $request->getSchemeAndHttpHost().$provider->generatePublicUrl($media, $format);
} }
} }
...@@ -9,9 +9,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; ...@@ -9,9 +9,9 @@ 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;
class NewsController extends AbstractController class NewsController extends FrontController
{ {
private $em; protected $em;
private $paginator; private $paginator;
public function __construct(EntityManagerInterface $em, PaginatorInterface $paginator) public function __construct(EntityManagerInterface $em, PaginatorInterface $paginator)
...@@ -25,6 +25,9 @@ class NewsController extends AbstractController ...@@ -25,6 +25,9 @@ class NewsController extends AbstractController
*/ */
public function listeNewsAction(Request $request) public function listeNewsAction(Request $request)
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
$pagination = $this->paginator->paginate( $pagination = $this->paginator->paginate(
$this->em->getRepository(News::class)->findLatest(), $this->em->getRepository(News::class)->findLatest(),
$request->query->getInt('page', 1), $request->query->getInt('page', 1),
...@@ -40,6 +43,9 @@ class NewsController extends AbstractController ...@@ -40,6 +43,9 @@ class NewsController extends AbstractController
*/ */
public function showNewsAction(News $news) public function showNewsAction(News $news)
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
return $this->render('news/show.html.twig', array( return $this->render('news/show.html.twig', array(
'news' => $news 'news' => $news
)); ));
......
<?php
namespace App\Controller;
use App\Entity\Page;
use Doctrine\ORM\EntityManagerInterface;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class PageController extends FrontController
{
protected $em;
private $paginator;
public function __construct(EntityManagerInterface $em, PaginatorInterface $paginator)
{
$this->em = $em;
$this->paginator = $paginator;
}
/**
* @Route("/page/{slug}", name="show_page")
*/
public function pageAction(Page $page)
{
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
$template = 'page.html.twig';
if (!empty($page->getTemplate()) && $this->get('templating')->exists($page->getTemplate())) {
$template = $page->getTemplate();
}
return $this->render($template, array(
'page' => $page
));
}
}
...@@ -10,15 +10,14 @@ use App\Form\Type\PrestataireInfosFormType; ...@@ -10,15 +10,14 @@ use App\Form\Type\PrestataireInfosFormType;
use App\Form\Type\TransactionPrestataireAdherentFormType; use App\Form\Type\TransactionPrestataireAdherentFormType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
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\Routing\RouterInterface;
class PrestatairesController extends AbstractController class PrestatairesController extends FrontController
{ {
private $em; protected $em;
private $router; private $router;
public function __construct(EntityManagerInterface $em, RouterInterface $router) public function __construct(EntityManagerInterface $em, RouterInterface $router)
...@@ -32,6 +31,9 @@ class PrestatairesController extends AbstractController ...@@ -32,6 +31,9 @@ class PrestatairesController extends AbstractController
*/ */
public function showPrestaAction(Prestataire $prestataire) public function showPrestaAction(Prestataire $prestataire)
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
if ($prestataire->isMlc()) { if ($prestataire->isMlc()) {
// Ne pas montrer la page du prestataire recevant les cotisations ! // Ne pas montrer la page du prestataire recevant les cotisations !
return new RedirectResponse($this->router->generate('index')); return new RedirectResponse($this->router->generate('index'));
...@@ -46,6 +48,9 @@ class PrestatairesController extends AbstractController ...@@ -46,6 +48,9 @@ class PrestatairesController extends AbstractController
*/ */
public function listePrestaAction() public function listePrestaAction()
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
$type_presta = $this->em->getRepository(TypePrestataire::class)->findOneBy(array('slug' => 'prestataire')); $type_presta = $this->em->getRepository(TypePrestataire::class)->findOneBy(array('slug' => 'prestataire'));
$prestas = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'typeprestataire' => $type_presta), array('raison' => 'ASC')); $prestas = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'typeprestataire' => $type_presta), array('raison' => 'ASC'));
...@@ -60,6 +65,9 @@ class PrestatairesController extends AbstractController ...@@ -60,6 +65,9 @@ class PrestatairesController extends AbstractController
*/ */
public function listePartnerAction() public function listePartnerAction()
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
$type_partner = $this->em->getRepository(TypePrestataire::class)->findOneBy(array('slug' => 'partenaire')); $type_partner = $this->em->getRepository(TypePrestataire::class)->findOneBy(array('slug' => 'partenaire'));
$partners = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'typeprestataire' => $type_partner), array('raison' => 'ASC')); $partners = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true, 'typeprestataire' => $type_partner), array('raison' => 'ASC'));
...@@ -74,6 +82,9 @@ class PrestatairesController extends AbstractController ...@@ -74,6 +82,9 @@ class PrestatairesController extends AbstractController
*/ */
public function cartePrestaAction() public function cartePrestaAction()
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
$prestas = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison' => 'ASC')); $prestas = $this->em->getRepository(Prestataire::class)->findBy(array('enabled' => true), array('raison' => 'ASC'));
return $this->render('presta/carte.html.twig', array( return $this->render('presta/carte.html.twig', array(
...@@ -86,6 +97,9 @@ class PrestatairesController extends AbstractController ...@@ -86,6 +97,9 @@ class PrestatairesController extends AbstractController
*/ */
public function rubriquesAction() public function rubriquesAction()
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
$rubriques = $this->em->getRepository(Rubrique::class)->findBy(array('enabled' => true), array('name' => 'ASC')); $rubriques = $this->em->getRepository(Rubrique::class)->findBy(array('enabled' => true), array('name' => 'ASC'));
return $this->render('presta/rubriques.html.twig', array( return $this->render('presta/rubriques.html.twig', array(
...@@ -98,6 +112,9 @@ class PrestatairesController extends AbstractController ...@@ -98,6 +112,9 @@ class PrestatairesController extends AbstractController
*/ */
public function showRubriqueAction(Rubrique $rubrique) public function showRubriqueAction(Rubrique $rubrique)
{ {
if (!$this->isFrontActivated()) {
return $this->redirectToRoute('index');
}
return $this->render('presta/show_rubrique.html.twig', array( return $this->render('presta/show_rubrique.html.twig', array(
'rubrique' => $rubrique 'rubrique' => $rubrique
)); ));
......
...@@ -3,8 +3,12 @@ ...@@ -3,8 +3,12 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\User; use App\Entity\User;
use App\Entity\CotisationAdherent;
use App\Entity\CotisationPrestataire;
use App\Enum\MoyenEnum;
use App\Form\Type\CotiserFormType; use App\Form\Type\CotiserFormType;
use App\Form\Type\UserInfosFormType; use App\Form\Type\UserInfosFormType;
use App\Tools\RoleCheck;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
...@@ -17,30 +21,55 @@ class UserController extends AbstractController ...@@ -17,30 +21,55 @@ class UserController extends AbstractController
{ {
private $em; private $em;
private $translator; private $translator;
private $rolecheck;
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator) public function __construct(EntityManagerInterface $em, TranslatorInterface $translator, RoleCheck $rolecheck)
{ {
$this->em = $em; $this->em = $em;
$this->translator = $translator; $this->translator = $translator;
$this->rolecheck = $rolecheck;
} }
/** /**
* @Route("/cotiser", name="cotiser") * @Route("/cotiser", name="cotiser")
* @IsGranted("ROLE_USER") * @IsGranted("ROLE_USER")
*/ */
public function cotiserAction(Request $request) public function cotiserAction(Request $request)
{ {
$form = $this->createForm(CotiserFormType::class, $adherent); $options = [];
if ($this->rolecheck->isGranted('ROLE_ADHERENT')) {
$options['data_class'] = CotisationAdherent::class;
} elseif ($this->rolecheck->isGranted('ROLE_PRESTATAIRE')) {
$options['data_class'] = CotisationPrestataire::class;
}
$form = $this->createForm(CotiserFormType::class, null, $options);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted()) { if ($form->isSubmitted()) {
$cotisation = $form->getData();
if ($form->get('payMLC')->isClicked()) {
$cotisation->setMoyen(MoyenEnum::MOYEN_MLC);
} else {
$cotisation->setMoyen(MoyenEnum::MOYEN_CB);
}
if ($form->isValid()) { if ($form->isValid()) {
$adherentNew = $form->getData(); if ($form->get('payMLC')->isClicked()) {
$this->em->persist($cotisation);
$this->em->flush();
$this->addFlash(
'success',
// "Cotisation pour l'année {$cotisation->getCotisationInfos()->getAnnee()} bien reçue. Merci !"
$this->translator->trans("Cotisation bien reçue. Merci !")
);
return $this->redirectToRoute('index');
} else {
//@TODO : redirect to payment page
}
} else { } else {
$this->addFlash( $this->addFlash(
'error', 'error',
'Problème avec l\'adhésion !' $this->translator->trans('Problème avec la cotisation !')
); );
} }
} }
......
...@@ -34,7 +34,7 @@ class UserGestionnaireGroupeController extends FluxController ...@@ -34,7 +34,7 @@ class UserGestionnaireGroupeController extends FluxController
*/ */
public function groupeInfosAction(Request $request) public function groupeInfosAction(Request $request)
{ {
// TODO : récupérer groupe gere en session // @TODO : récupérer groupe gere en session
$form = $this->createForm(GroupeInfosFormType::class, $this->session->get('_groupegere')); $form = $this->createForm(GroupeInfosFormType::class, $this->session->get('_groupegere'));
$form->handleRequest($request); $form->handleRequest($request);
......
...@@ -11,7 +11,16 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -11,7 +11,16 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_ADHERENT_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_ADHERENT_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_ADHERENT_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_ADHERENT_GERER_LIST')"},
* "put"={"security"="is_granted('ROLE_ADMIN_ADHERENT_GERER_EDIT') or object.user == user"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
......
<?php
namespace App\Entity;
use App\Entity\GlobalParameter;
use App\Entity\Prestataire;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* COMMISSION
* - PRESTATAIRES => PRESTATAIRE MLC (Commission de Reconversion)
*
* @ORM\Entity()
*/
class CommissionPrestataireMLC extends Flux
{
/**
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id")
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_dest_id", referencedColumnName="id")
*/
protected $destinataire;
/**
* @return string
*/
public function getParenttype(): string
{
return self::TYPE_COMMISSION;
}
/**
* @return string
*/
public function getType(): string
{
return 'reconversion_prestataire';
}
public function operate($em)
{
return [];
}
public function getUsersToNotify()
{
return [];
}
}
...@@ -16,10 +16,19 @@ use Symfony\Component\Serializer\Annotation\Groups; ...@@ -16,10 +16,19 @@ use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * @ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_COMPTOIR_GERER_VIEW') or is_granted('ROLE_API')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_COMPTOIR_GERER_LIST') or is_granted('ROLE_API')"},
* "post"={"security"="is_granted('ROLE_ADMIN_COMPTOIR_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_COMPTOIR_GERER_VIEW') or is_granted('ROLE_API')"},
* "put"={"security"="is_granted('ROLE_ADMIN_COMPTOIR_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
* @ORM\Entity * @ORM\Entity(repositoryClass="App\Repository\ComptoirRepository")
* @ORM\HasLifecycleCallbacks() * @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="comptoir") * @ORM\Table(name="comptoir")
*/ */
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
namespace App\Entity; namespace App\Entity;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\EntityTrait\ContactEmailTelTrait;
use App\Entity\EntityTrait\EnablableEntityTrait; use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\GeolocEntityTrait;
use App\Entity\EntityTrait\NameSlugContentEntityTrait; use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
...@@ -14,7 +14,16 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -14,7 +14,16 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
...@@ -25,7 +34,8 @@ class ContactPrestataire ...@@ -25,7 +34,8 @@ class ContactPrestataire
{ {
use NameSlugContentEntityTrait, use NameSlugContentEntityTrait,
TimestampableEntity, TimestampableEntity,
EnablableEntityTrait; EnablableEntityTrait,
ContactEmailTelTrait;
/** /**
* @ORM\Id() * @ORM\Id()
......
...@@ -17,7 +17,7 @@ class Cotisation extends Flux ...@@ -17,7 +17,7 @@ class Cotisation extends Flux
{ {
/** /**
* @ORM\OneToOne(targetEntity="Prestataire") * @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true) * @ORM\JoinColumn(name="prestataire_dest_id", referencedColumnName="id", nullable=true)
*/ */
protected $destinataire; protected $destinataire;
......
...@@ -8,7 +8,16 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -8,7 +8,16 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_ADHERENT_COTISATIONS_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_ADHERENT_COTISATIONS_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_ADHERENT_COTISATIONS_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_ADHERENT_COTISATIONS_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_ADMIN_ADHERENT_COTISATIONS_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
......
...@@ -8,7 +8,16 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -8,7 +8,16 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_ADHERENT_COTISATIONS_GERER_VIEW') or is_granted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_ADHERENT_COTISATIONS_GERER_LIST') or is_granted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_ADHERENT_COTISATIONS_GERER_EDIT') or is_granted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_ADHERENT_COTISATIONS_GERER_LIST') or is_granted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_ADMIN_ADHERENT_COTISATIONS_GERER_EDIT') or is_granted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
......
...@@ -8,12 +8,22 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -8,12 +8,22 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
*
* TRANSACTION * TRANSACTION
* - Cotisation d'un prestataire * - Cotisation(s) d'un prestataire
* *
* @ORM\Entity * @ORM\Entity
*/ */
......
...@@ -11,7 +11,16 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -11,7 +11,16 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_DOCUMENT_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_DOCUMENT_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_DOCUMENT_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_DOCUMENT_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_ADMIN_DOCUMENT_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
......
...@@ -12,7 +12,16 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -12,7 +12,16 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
...@@ -80,4 +89,14 @@ class EtatPrestataire ...@@ -80,4 +89,14 @@ class EtatPrestataire
} }
return $this; return $this;
} }
public function getPrestatairesCount()
{
return $this->getPrestataires()->count();
}
public function __toString(): string
{
return $this->getName()?$this->getName():'[Tag]';
}
} }
...@@ -11,7 +11,16 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -11,7 +11,16 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_FAQ_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_FAQ_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_FAQ_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_FAQ_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_ADMIN_FAQ_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
......
...@@ -13,16 +13,12 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -13,16 +13,12 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* FLUX = TRANSFERT ou TRANSACTION ou COTISATIONS * FLUX = TRANSFERT ou TRANSACTION ou COTISATIONS
* @ORM\Entity(repositoryClass="App\Repository\FluxRepository") * @ORM\Entity(repositoryClass="App\Repository\FluxRepository")
* @ORM\HasLifecycleCallbacks() * @ORM\HasLifecycleCallbacks()
* @ORM\InheritanceType("SINGLE_TABLE") * @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="discr", type="string") * @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"cotisation" = "Cotisation", "cotisation_adherent" = "CotisationAdherent", "cotisation_prestataire" = "CotisationPrestataire", "tro_adh_pre" = "TransactionAdherentPrestataire", "tro_adh_adh" = "TransactionAdherentAdherent", "tro_pre_adh" = "TransactionPrestataireAdherent", "tro_pre_pre" = "TransactionPrestatairePrestataire", "tre_cpt_grp" = "TransfertComptoirGroupe", "tre_grp_cpt" = "TransfertGroupeComptoir", "tre_pre_cpt" = "TransfertPrestataireComptoir", "tre_pre_sie" = "TransfertPrestataireSiege", "tre_sie_grp" = "TransfertSiegeGroupe", "tre_grp_sie" = "TransfertGroupeSiege", "vte_cpt_pre" = "VenteComptoirPrestataire", "vte_cpt_adh" = "VenteComptoirAdherent", "ret_cpt_pre" = "RetraitComptoirPrestataire", "ret_cpt_adh" = "RetraitComptoirAdherent"}) * @ORM\DiscriminatorMap({"cotisation" = "Cotisation", "cotisation_adherent" = "CotisationAdherent", "cotisation_prestataire" = "CotisationPrestataire", "tro_adh_pre" = "TransactionAdherentPrestataire", "tro_adh_adh" = "TransactionAdherentAdherent", "tro_pre_adh" = "TransactionPrestataireAdherent", "tro_pre_pre" = "TransactionPrestatairePrestataire", "tre_cpt_grp" = "TransfertComptoirGroupe", "tre_grp_cpt" = "TransfertGroupeComptoir", "tre_pre_cpt" = "TransfertPrestataireComptoir", "tre_pre_sie" = "TransfertPrestataireSiege", "tre_sie_grp" = "TransfertSiegeGroupe", "tre_grp_sie" = "TransfertGroupeSiege", "vte_cpt_pre" = "VenteComptoirPrestataire", "vte_cpt_adh" = "VenteComptoirAdherent", "ret_cpt_pre" = "RetraitComptoirPrestataire", "ret_cpt_adh" = "RetraitComptoirAdherent", "com_rec_pre" = "CommissionPrestataireMLC"})
*/ */
abstract class Flux abstract class Flux
{ {
...@@ -33,6 +29,7 @@ abstract class Flux ...@@ -33,6 +29,7 @@ abstract class Flux
const TYPE_TRANSACTION = 'transaction'; const TYPE_TRANSACTION = 'transaction';
const TYPE_VENTE = 'vente'; const TYPE_VENTE = 'vente';
const TYPE_RETRAIT = 'retrait'; const TYPE_RETRAIT = 'retrait';
const TYPE_COMMISSION = 'commission';
/** /**
* @var int * @var int
...@@ -45,7 +42,7 @@ abstract class Flux ...@@ -45,7 +42,7 @@ abstract class Flux
protected $id; protected $id;
/** /**
* @ORM\ManyToOne(targetEntity="User", inversedBy="flux", cascade={"all"}) * @ORM\ManyToOne(targetEntity="User", inversedBy="flux")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true) * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
* @Groups({"read", "write"}) * @Groups({"read", "write"})
*/ */
...@@ -120,6 +117,14 @@ abstract class Flux ...@@ -120,6 +117,14 @@ abstract class Flux
*/ */
protected $hash; protected $hash;
/**
* @var float
*
* @ORM\Column(name="tauxreconversion", type="decimal", precision=7, scale=2, nullable=true)
* @Groups({"read", "write"})
*/
protected $tauxreconversion;
protected $expediteur = null; protected $expediteur = null;
protected $destinataire = null; protected $destinataire = null;
protected $cotisationInfos = null; protected $cotisationInfos = null;
...@@ -136,10 +141,7 @@ abstract class Flux ...@@ -136,10 +141,7 @@ abstract class Flux
* Obtenir la liste des utilisateurs à notifier * Obtenir la liste des utilisateurs à notifier
* @return array Tableau d'utilisateurs * @return array Tableau d'utilisateurs
*/ */
public function getUsersToNotify() abstract public function getUsersToNotify();
{
return [];
}
public function __construct() public function __construct()
{ {
...@@ -325,6 +327,30 @@ abstract class Flux ...@@ -325,6 +327,30 @@ abstract class Flux
return $this; return $this;
} }
/**
* Get tauxreconversion
* @return
*/
public function getTauxreconversion(): ?float
{
return $this->tauxreconversion;
}
/**
* Set tauxreconversion
* @return $this
*/
public function setTauxreconversion(?float $tauxreconversion): self
{
$this->tauxreconversion = $tauxreconversion;
return $this;
}
public function getMontantareconvertir()
{
return ($this->getMontant() - ($this->getMontant()*($this->getTauxreconversion()/100)));
}
public function isVente() public function isVente()
{ {
return false; return false;
...@@ -364,10 +390,11 @@ abstract class Flux ...@@ -364,10 +390,11 @@ abstract class Flux
if ($flux->getExpediteur() == $flux->getDestinataire()) { if ($flux->getExpediteur() == $flux->getDestinataire()) {
throw new \Exception("[FLUX] Opération impossible ! Expéditeur et Destinataire ne peuvent pas être les mêmes !"); throw new \Exception("[FLUX] Opération impossible ! Expéditeur et Destinataire ne peuvent pas être les mêmes !");
} }
$hash = password_hash($flux->getAllInfosUncrypted(), PASSWORD_BCRYPT, ['cost' => 12]); // @TODO : generation du hash du flux trop gourmand en ressource !
$flux->setHash($hash); // $hash = password_hash($flux->getAllInfosUncrypted(), PASSWORD_BCRYPT, ['cost' => 12]);
$event->getEntityManager()->persist($flux); // $flux->setHash($hash);
$event->getEntityManager()->flush(); // $event->getEntityManager()->persist($flux);
// $event->getEntityManager()->flush();
} }
/** /**
...@@ -377,29 +404,22 @@ abstract class Flux ...@@ -377,29 +404,22 @@ abstract class Flux
*/ */
public function validateConstraint(ExecutionContextInterface $context) public function validateConstraint(ExecutionContextInterface $context)
{ {
if ($this->getMoyen() == MoyenEnum::MOYEN_MLC && $this->getParenttype() == self::TYPE_COTISATION) { if ($this->getMoyen() == MoyenEnum::MOYEN_MLC
&& $this->getParenttype() == self::TYPE_COTISATION
&& $this->getExpediteur()->getEcompte() < $this->getMontant()
) {
$context->addViolation('Montant supérieur au solde de monnaie éléctronique.'); $context->addViolation('Montant supérieur au solde de monnaie éléctronique.');
} }
} }
public function toHtmlArray(): string public function getAllInfosUncrypted(): string
{ {
if (empty($this->getDestinataire()) || empty($this->getExpediteur()) || empty($this->getMontant())) { return $_ENV['APP_SECRET'].$this->id.$this->operateur->getId().$this->role.$this->type.$this->montant.$this->moyen.$this->reference.$this->destinataire->getId().$this->expediteur->getId();
return "[FLUX] Visualisation impossible ! Destinataire / Expéditeur et/ou montant manquant(s) !";
}
$return = '<tr>';
$return .= '<td>'.$this->getCreatedAt()->format('d/m/Y H:i').'</td>';
$return .= '<td>'.ucwords($this->getParenttype()).'</td>';
$return .= '<td>'.$this->getExpediteur().'</td>';
$return .= '<td>'.$this->getDestinataire().'</td>';
$return .= '<td>'.$this->getMontant().'&euro;</td>';
$return .= '</tr>';
return $return;
} }
public function getAllInfosUncrypted(): string public function getOperateurAndRole(): string
{ {
return $_ENV['APP_SECRET'].$this->id.$this->operateur->getId().$this->role.$this->type.$this->montant.$this->moyen.$this->reference.$this->destinataire->getId().$this->expediteur->getId(); return $this->operateur->__toString() . ' (' . $this->role . ')';
} }
public function __toString(): string public function __toString(): string
......
...@@ -10,10 +10,6 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -10,10 +10,6 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="geoloc") * @ORM\Table(name="geoloc")
*/ */
......
...@@ -15,6 +15,15 @@ use Symfony\Component\Serializer\Annotation\Groups; ...@@ -15,6 +15,15 @@ use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * @ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW') or is_granted('ROLE_API')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_LIST') or is_granted('ROLE_API')"},
* "post"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW') or is_granted('ROLE_API')"},
* "put"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
......
...@@ -4,32 +4,29 @@ namespace App\Entity; ...@@ -4,32 +4,29 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity(repositoryClass="App\Repository\GlobalParameterRepository") * @ORM\Entity(repositoryClass="App\Repository\GlobalParameterRepository")
* @UniqueEntity(
* fields={"name"},
* errorPath="name",
* message="Ce nom de paramètre est déjà utilisé !"
* )
*/ */
class GlobalParameter class GlobalParameter
{ {
// Default global parameters for MLC // Default global parameters for MLC
const MLC_TITLE = 'MLC_TITLE'; const USE_WORDPRESS = 'USE_WORDPRESS';
const MLC_DESCRIPTION = 'MLC_DESCRIPTION';
const MLC_KEYWORDS = 'MLC_KEYWORDS';
const MLC_NAME = 'MLC_NAME'; const MLC_NAME = 'MLC_NAME';
const MLC_NAME_SMALL = 'MLC_NAME_SMALL'; const MLC_NAME_SMALL = 'MLC_NAME_SMALL';
const MLC_NOTIF_EMAIL = 'MLC_NOTIF_EMAIL'; const MLC_NOTIF_EMAIL = 'MLC_NOTIF_EMAIL';
const MLC_CONTACT_EMAIL = 'MLC_CONTACT_EMAIL';
const COTISATION_ADHERENT = 'COTISATION_ADHERENT'; const COTISATION_ADHERENT = 'COTISATION_ADHERENT';
const COTISATION_PRESTATAIRE = 'COTISATION_PRESTATAIRE'; const COTISATION_PRESTATAIRE = 'COTISATION_PRESTATAIRE';
const RECONVERSION_ADHERENT = 'RECONVERSION_ADHERENT';
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';
// const FAVICON_URL = 'FAVICON_URL';
/** /**
* @ORM\Id() * @ORM\Id()
......
...@@ -10,14 +10,8 @@ use Doctrine\ORM\Mapping as ORM; ...@@ -10,14 +10,8 @@ use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Timestampable\Traits\TimestampableEntity; use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource(
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* )
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="groupe") * @ORM\Table(name="groupe")
*/ */
...@@ -40,7 +34,7 @@ class Groupe ...@@ -40,7 +34,7 @@ class Groupe
/** /**
* @var Siege * @var Siege
* *
* @ORM\ManyToOne(targetEntity="Siege", inversedBy="groupes", cascade={"persist"}) * @ORM\ManyToOne(targetEntity="Siege", inversedBy="groupes")
* @ORM\JoinColumn(name="siege_id", referencedColumnName="id", nullable=false) * @ORM\JoinColumn(name="siege_id", referencedColumnName="id", nullable=false)
*/ */
private $siege; private $siege;
......
...@@ -16,10 +16,19 @@ use Symfony\Component\Serializer\Annotation\Groups; ...@@ -16,10 +16,19 @@ use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * @ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW') or is_granted('ROLE_API')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_LIST') or is_granted('ROLE_API')"},
* "post"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW') or is_granted('ROLE_API')"},
* "put"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
* @ORM\Entity * @ORM\Entity(repositoryClass="App\Repository\GroupeprestataireRepository")
* @ORM\Table(name="groupeprestaire") * @ORM\Table(name="groupeprestaire")
*/ */
class Groupeprestataire class Groupeprestataire
......
<?php
namespace App\Entity;
use App\Dto\MapInput;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Controller\MapController;
use App\Entity\EntityTrait\GeolocEntityTrait;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* collectionOperations={
* "get",
* "post"
* },
* itemOperations={
* "get",
* "put",
* "delete",
* },
* collectionOperations={
* "get",
* "post",
* "get_all_poi"={
* "controller"=MapController::class,
* "method"="GET",
* "input"=false,
* "output"=Map::class,
* "path"="/public/poi/all",
* "read"=false,
* "swagger_context" = {
* "parameters" = {
* {
* "name" = "geoloc",
* "in" = "query",
* "description" = "[Latitude, Longitude], exemple : [45.123,4.023]",
* "required" = false,
* "type" : "string",
* },
* {
* "name" = "distance",
* "in" = "query",
* "description" = "Distance in kilometers",
* "required" = false,
* "type" : "string"
* }
* }
* },
* "security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_LIST') or is_granted('ROLE_API')"},
* },
* )
*/
class Map
{
/**
* @var string|null
*
* @ORM\Column(length=150)
* @Groups({"read", "write"})
*/
protected $name;
/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
* @Groups({"read", "write"})
*/
private $content;
/**
* @var null|string
*
* @ORM\Column(name="web", type="string", length=255, nullable=true)
* @Groups({"read", "write"})
*/
private $web;
/**
* @var null|string
*
* @ORM\Column(name="link", type="string", length=255, nullable=true)
* @Groups({"read", "write"})
*/
private $link;
/**
* @var null|string
*
* @ORM\Column(name="hours", type="string", length=255, nullable=true)
* @Groups({"read", "write"})
*/
private $hours;
/**
* @var null|string
*
* @ORM\Column(name="icon", type="string", length=255, nullable=true)
* @Groups({"read", "write"})
*/
private $icon;
/**
* @var Rubrique[]
* @ORM\OneToMany(targetEntity="Rubrique")
* @Groups({"read", "write"})
*/
private $rubriques;
/**
* @var Geoloc[]
* @ORM\OneToMany(targetEntity="Geoloc")
* @Groups({"read", "write"})
*/
private $geolocs;
/**
* Get name
* @return
*/
public function getName()
{
return $this->name;
}
/**
* Get content
* @return
*/
public function getContent()
{
return $this->content;
}
/**
* Get web
* @return
*/
public function getWeb()
{
return $this->web;
}
/**
* Get link
* @return
*/
public function getLink()
{
return $this->link;
}
/**
* Get hours
* @return
*/
public function getHours()
{
return $this->hours;
}
/**
* Get icon
* @return
*/
public function getIcon()
{
return $this->icon;
}
/**
* Get rubriques
* @return
*/
public function getRubriques(): ?Rubrique
{
return $this->rubriques;
}
/**
* Get geolocs
* @return
*/
public function getGeolocs(): ?Geoloc
{
return $this->geolocs;
}
}
<?php
namespace App\Entity;
use App\Entity\EntityTrait\EnablableEntityTrait;
use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="message")
*/
class Message
{
use NameSlugContentEntityTrait,
EnablableEntityTrait,
TimestampableEntity;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @var User
*
* @ORM\ManyToOne(targetEntity="User", inversedBy="messagesSend", cascade={"persist"})
*/
private $expediteur;
/**
* @var User
*
* @ORM\ManyToOne(targetEntity="User", inversedBy="messagesReceived", cascade={"persist"})
*/
private $destinataire;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param User $destinataire
* @return $this
*/
public function setDestinataire(User $destinataire)
{
$this->destinataire = $destinataire;
return $this;
}
/**
* @return User
*/
public function getDestinataire(): User
{
return $this->destinataire;
}
/**
* @param User $expediteur
* @return $this
*/
public function setExpediteur(User $expediteur)
{
$this->expediteur = $expediteur;
return $this;
}
/**
* @return User
*/
public function getExpediteur(): User
{
return $this->expediteur;
}
}
...@@ -12,7 +12,16 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -12,7 +12,16 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_NEWS_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_NEWS_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_NEWS_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_NEWS_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_ADMIN_NEWS_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
......
...@@ -12,7 +12,16 @@ use ApiPlatform\Core\Annotation\ApiResource; ...@@ -12,7 +12,16 @@ use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_PAGE_GERER_VIEW')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PAGE_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_ADMIN_PAGE_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PAGE_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_ADMIN_PAGE_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
......
...@@ -18,6 +18,15 @@ use Symfony\Component\Serializer\Annotation\Groups; ...@@ -18,6 +18,15 @@ use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * @ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW') or is_granted('ROLE_API')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_LIST') or is_granted('ROLE_API')"},
* "post"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW') or is_granted('ROLE_API')"},
* "put"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
...@@ -203,6 +212,14 @@ class Prestataire ...@@ -203,6 +212,14 @@ class Prestataire
*/ */
private $etats; private $etats;
/**
* Taux de reconversion propre au prestataire
* @var float
* @ORM\Column(name="tauxreconversion", type="decimal", precision=7, scale=2, nullable=true)
* @Groups({"read", "write"})
*/
protected $tauxreconversion;
public function __construct() public function __construct()
{ {
$this->users = new ArrayCollection(); $this->users = new ArrayCollection();
...@@ -406,10 +423,10 @@ class Prestataire ...@@ -406,10 +423,10 @@ class Prestataire
} }
/** /**
* @param Geoloc $geoloc * @param GeolocPrestataire $geoloc
* @return $this * @return $this
*/ */
public function addGeoloc(Geoloc $geoloc): self public function addGeoloc(GeolocPrestataire $geoloc): self
{ {
if (!$this->geolocs->contains($geoloc)) { if (!$this->geolocs->contains($geoloc)) {
$this->geolocs[] = $geoloc; $this->geolocs[] = $geoloc;
...@@ -419,10 +436,10 @@ class Prestataire ...@@ -419,10 +436,10 @@ class Prestataire
} }
/** /**
* @param Geoloc $geoloc * @param GeolocPrestataire $geoloc
* @return $this * @return $this
*/ */
public function removeGeoloc(Geoloc $geoloc): self public function removeGeoloc(GeolocPrestataire $geoloc): self
{ {
if ($this->geolocs->contains($geoloc)) { if ($this->geolocs->contains($geoloc)) {
$this->geolocs->removeElement($geoloc); $this->geolocs->removeElement($geoloc);
...@@ -738,6 +755,25 @@ class Prestataire ...@@ -738,6 +755,25 @@ class Prestataire
return $this; return $this;
} }
/**
* Get tauxreconversion
* @return
*/
public function getTauxreconversion(): ?float
{
return $this->tauxreconversion;
}
/**
* Set tauxreconversion
* @return $this
*/
public function setTauxreconversion(?float $tauxreconversion): self
{
$this->tauxreconversion = $tauxreconversion;
return $this;
}
public function __toString(): string public function __toString(): string
{ {
return ($this->raison?$this->raison:'Prestataire '.$this->id); return ($this->raison?$this->raison:'Prestataire '.$this->id);
......
...@@ -13,6 +13,15 @@ use Symfony\Component\Serializer\Annotation\Groups; ...@@ -13,6 +13,15 @@ use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * @ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW') or is_granted('ROLE_API')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_LIST') or is_granted('ROLE_API')"},
* "post"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW') or is_granted('ROLE_API')"},
* "put"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
......
...@@ -45,9 +45,4 @@ abstract class Transaction extends Flux ...@@ -45,9 +45,4 @@ abstract class Transaction extends Flux
} }
return []; return [];
} }
public function getUsersToNotify()
{
return [$this->getDestinataire()->getUser(), $this->getExpediteur()->getUser()];
}
} }
...@@ -36,4 +36,9 @@ class TransactionAdherentAdherent extends Transaction ...@@ -36,4 +36,9 @@ class TransactionAdherentAdherent extends Transaction
{ {
return 'adherent_adherent'; return 'adherent_adherent';
} }
public function getUsersToNotify()
{
return [$this->getDestinataire()->getUser(), $this->getExpediteur()->getUser()];
}
} }
...@@ -16,15 +16,15 @@ use Symfony\Component\Validator\Constraints as Assert; ...@@ -16,15 +16,15 @@ use Symfony\Component\Validator\Constraints as Assert;
class TransactionAdherentPrestataire extends Transaction class TransactionAdherentPrestataire extends Transaction
{ {
/** /**
* @ORM\OneToOne(targetEntity="Adherent") * @ORM\ManyToOne(targetEntity="Adherent")
* @ORM\JoinColumn(name="adherent_id", referencedColumnName="id") * @ORM\JoinColumn(name="adherent_id", referencedColumnName="id", nullable=false)
* @Assert\NotBlank * @Assert\NotBlank
*/ */
protected $expediteur; protected $expediteur;
/** /**
* @ORM\OneToOne(targetEntity="Prestataire") * @ORM\ManyToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id") * @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=false)
* @Assert\NotBlank * @Assert\NotBlank
*/ */
protected $destinataire; protected $destinataire;
...@@ -36,4 +36,9 @@ class TransactionAdherentPrestataire extends Transaction ...@@ -36,4 +36,9 @@ class TransactionAdherentPrestataire extends Transaction
{ {
return 'adherent_prestataire'; return 'adherent_prestataire';
} }
public function getUsersToNotify()
{
return array_merge([$this->getExpediteur()->getUser()], $this->getDestinataire()->getUsers()->toArray());
}
} }
...@@ -34,4 +34,9 @@ class TransactionPrestataireAdherent extends Transaction ...@@ -34,4 +34,9 @@ class TransactionPrestataireAdherent extends Transaction
{ {
return 'prestataire_adherent'; return 'prestataire_adherent';
} }
public function getUsersToNotify()
{
return array_merge([$this->getDestinataire()->getUser()], $this->getExpediteur()->getUsers()->toArray());
}
} }
...@@ -34,4 +34,9 @@ class TransactionPrestatairePrestataire extends Transaction ...@@ -34,4 +34,9 @@ class TransactionPrestatairePrestataire extends Transaction
{ {
return 'prestataire_prestataire'; return 'prestataire_prestataire';
} }
public function getUsersToNotify()
{
return array_merge($this->getExpediteur()->getUsers()->toArray(), $this->getDestinataire()->getUsers()->toArray());
}
} }
...@@ -34,7 +34,6 @@ class TransfertGroupeSiege extends Transfert ...@@ -34,7 +34,6 @@ class TransfertGroupeSiege extends Transfert
public function getUsersToNotify() public function getUsersToNotify()
{ {
// @TODO : notify siege ? return array_merge(['siege'], $this->getExpediteur()->getGestionnaires()->toArray());
return $this->getExpediteur()->getGestionnaires()->toArray();
} }
} }
...@@ -36,7 +36,7 @@ class TransfertPrestataireComptoir extends Transfert ...@@ -36,7 +36,7 @@ class TransfertPrestataireComptoir extends Transfert
{ {
$this->getExpediteur()->addEcompte($this->getMontant()); $this->getExpediteur()->addEcompte($this->getMontant());
$this->getDestinataire()->addCompte($this->getMontant()); $this->getDestinataire()->addCompte($this->getMontant());
$this->getDestinataire()->getGroupe()->getSiege()->addCompteNantie($this->getMontant()); $this->getDestinataire()->getGroupe()->getSiege()->removeCompteNantie($this->getMontant());
return [$this->getExpediteur(), $this->getDestinataire()]; return [$this->getExpediteur(), $this->getDestinataire()];
} }
......
...@@ -4,8 +4,11 @@ namespace App\Entity; ...@@ -4,8 +4,11 @@ namespace App\Entity;
use App\Entity\GlobalParameter; use App\Entity\GlobalParameter;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Enum\MoyenEnum;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* TRANSFERT * TRANSFERT
...@@ -31,6 +34,7 @@ class TransfertPrestataireSiege extends Transfert ...@@ -31,6 +34,7 @@ class TransfertPrestataireSiege extends Transfert
* @var boolean * @var boolean
* @Assert\Type("bool") * @Assert\Type("bool")
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
* @Groups({"read", "write"})
*/ */
protected $reconverti = false; protected $reconverti = false;
...@@ -56,25 +60,49 @@ class TransfertPrestataireSiege extends Transfert ...@@ -56,25 +60,49 @@ class TransfertPrestataireSiege extends Transfert
*/ */
public function getType(): string public function getType(): string
{ {
return 'prestataire_siege'; //reconversion return 'reconversion';
} }
public function operate($em) public function operate($em)
{ {
$this->getExpediteur()->removeEcompte($this->getMontant()); $this->getExpediteur()->removeEcompte($this->getMontant());
// @TODO : gérer le taux de reconversion
// $taux = $em->getRepository(Prestataire::class)->val(GlobalParameter::RECONVERSION_PRESTATAIRE); // On récupère le taux de reconversion (du formulaire s'il est précisé sinon par défaut dans la configuration globale)
// $taux = $em->getRepository(GlobalParameter::class)->val(GlobalParameter::RECONVERSION_PRESTATAIRE); $taux = $this->getTauxreconversion();
// $montantAjoute = $this->getMontant() - ($this->getMontant()*($taux/100)); if (empty($taux)) {
$this->getDestinataire()->addCompte($this->getMontant()); $taux = $em->getRepository(GlobalParameter::class)->val(GlobalParameter::RECONVERSION_PRESTATAIRE);
$this->getDestinataire()->removeCompteNantie($this->getMontant()); }
if ($taux > 0) {
// On calcul les montants à virer au prestataire et la commission
$montantAVirer = $this->getMontant() - ($this->getMontant()*($taux/100));
$montantPreleve = $this->getMontant() - $montantAVirer;
$this->setMontant($montantAVirer);
$this->setTauxreconversion($taux);
// On récupère le presta qui reçoit les commissions
$mlcPrestataire = $em->getRepository(Prestataire::class)->findOneBy(array('mlc' => true));
//Création d'un flux supplémentaire pour représenter la commission prise au prestataire et transféré à l'association qui gère la MLC
$fluxCommission = new CommissionPrestataireMLC();
$fluxCommission->setExpediteur($this->getExpediteur());
$fluxCommission->setOperateur($this->getOperateur());
$fluxCommission->setRole($this->getRole());
$fluxCommission->setDestinataire($mlcPrestataire);
$fluxCommission->setMontant($montantPreleve);
$fluxCommission->setReference('Commission de reconversion');
$fluxCommission->setMoyen(MoyenEnum::MOYEN_TRANSFERT);
$fluxCommission->setTauxreconversion($taux);
$mlcPrestataire->addEcompte($montantPreleve);
return [$this->getExpediteur(), $this->getDestinataire(), $fluxCommission, $mlcPrestataire];
}
return [$this->getExpediteur(), $this->getDestinataire()]; return [$this->getExpediteur(), $this->getDestinataire()];
} }
public function getUsersToNotify() public function getUsersToNotify()
{ {
// @TODO : notify siege ?
return $this->getExpediteur()->getUsers()->toArray(); return $this->getExpediteur()->getUsers()->toArray();
} }
} }
...@@ -12,6 +12,15 @@ use Symfony\Component\Serializer\Annotation\Groups; ...@@ -12,6 +12,15 @@ use Symfony\Component\Serializer\Annotation\Groups;
/** /**
* @ApiResource( * @ApiResource(
* attributes={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW') or is_granted('ROLE_API')"},
* collectionOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_LIST') or is_granted('ROLE_API')"},
* "post"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_VIEW') or is_granted('ROLE_API')"},
* "put"={"security"="is_granted('ROLE_ADMIN_PRESTATAIRE_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}}, * normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}} * denormalizationContext={"groups"={"write"}}
* ) * )
......
...@@ -15,16 +15,25 @@ use Symfony\Component\Serializer\Annotation\Groups; ...@@ -15,16 +15,25 @@ use Symfony\Component\Serializer\Annotation\Groups;
use FOS\UserBundle\Model\UserInterface; use FOS\UserBundle\Model\UserInterface;
/** /**
* @ApiResource( * ApiResource(
* normalizationContext={"groups"={"user", "user:read"}}, * attributes={"security"="is_granted('ROLE_SONATA_USER_GERER_VIEW')"},
* denormalizationContext={"groups"={"user", "user:write"}} * collectionOperations={
* "get"={"security"="is_granted('ROLE_SONATA_USER_GERER_LIST')"},
* "post"={"security"="is_granted('ROLE_SONATA_USER_GERER_EDIT')"}
* },
* itemOperations={
* "get"={"security"="is_granted('ROLE_SONATA_USER_GERER_VIEW')"},
* "put"={"security"="is_granted('ROLE_SONATA_USER_GERER_EDIT')"},
* },
* normalizationContext={"groups"={"read"}},
* denormalizationContext={"groups"={"write"}}
* ) * )
* @ORM\Entity(repositoryClass="App\Repository\UserRepository") * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
* @ORM\Table(name="user") * @ORM\Table(name="user")
* @UniqueEntity( * @UniqueEntity(
* fields={"firstname", "lastname", "email"}, * fields={"email"},
* errorPath="email", * errorPath="email",
* message="Ce nom avec cet email est déjà utilisé !" * message="Cet email est déjà utilisé !"
* ) * )
*/ */
class User extends BaseUser class User extends BaseUser
...@@ -252,7 +261,6 @@ class User extends BaseUser ...@@ -252,7 +261,6 @@ class User extends BaseUser
return $this; return $this;
} }
public function isGranted($role) public function isGranted($role)
{ {
return in_array($role, $this->getRoles()); return in_array($role, $this->getRoles());
...@@ -334,7 +342,7 @@ class User extends BaseUser ...@@ -334,7 +342,7 @@ class User extends BaseUser
* @param Prestataire $prestataire * @param Prestataire $prestataire
* @return $this * @return $this
*/ */
public function removePrestataire(Prestataire $prestataires): self public function removePrestataire(Prestataire $prestataire): self
{ {
if ($this->prestataires->contains($prestataire)) { if ($this->prestataires->contains($prestataire)) {
$this->prestataires->removeElement($prestataire); $this->prestataires->removeElement($prestataire);
...@@ -421,7 +429,7 @@ class User extends BaseUser ...@@ -421,7 +429,7 @@ class User extends BaseUser
* @param Groupesgere $groupesgere * @param Groupesgere $groupesgere
* @return $this * @return $this
*/ */
public function removeGroupesgere(Groupe $groupesgeres): self public function removeGroupesgere(Groupe $groupesgere): self
{ {
if ($this->groupesgeres->contains($groupesgere)) { if ($this->groupesgeres->contains($groupesgere)) {
$this->groupesgeres->removeElement($groupesgere); $this->groupesgeres->removeElement($groupesgere);
...@@ -466,7 +474,7 @@ class User extends BaseUser ...@@ -466,7 +474,7 @@ class User extends BaseUser
* @param Comptoirsgere $comptoirsgere * @param Comptoirsgere $comptoirsgere
* @return $this * @return $this
*/ */
public function removeComptoirsgere(Comptoir $comptoirsgeres): self public function removeComptoirsgere(Comptoir $comptoirsgere): self
{ {
if ($this->comptoirsgeres->contains($comptoirsgere)) { if ($this->comptoirsgeres->contains($comptoirsgere)) {
$this->comptoirsgeres->removeElement($comptoirsgere); $this->comptoirsgeres->removeElement($comptoirsgere);
...@@ -509,6 +517,14 @@ class User extends BaseUser ...@@ -509,6 +517,14 @@ class User extends BaseUser
} }
} }
public function __toString()
{
if (empty($this->getFullname())) {
return $this->getEmail();
}
return $this->getFullname();
}
public function getName() public function getName()
{ {
if (empty($this->getFullname())) { if (empty($this->getFullname())) {
......
...@@ -37,6 +37,7 @@ abstract class Vente extends Flux ...@@ -37,6 +37,7 @@ abstract class Vente extends Flux
throw new \Exception("[FLUX] Vente impossible ! Montant supérieur au solde du comptoir !"); throw new \Exception("[FLUX] Vente impossible ! Montant supérieur au solde du comptoir !");
} else { } else {
$this->getExpediteur()->removeCompte($this->getMontant()); $this->getExpediteur()->removeCompte($this->getMontant());
$this->getExpediteur()->setUpdatedAt(new \DateTime());
$this->getExpediteur()->getGroupe()->getSiege()->addCompteNantie($this->getMontant()); $this->getExpediteur()->getGroupe()->getSiege()->addCompteNantie($this->getMontant());
return [$this->getExpediteur(), $this->getExpediteur()->getGroupe()->getSiege()]; return [$this->getExpediteur(), $this->getExpediteur()->getGroupe()->getSiege()];
......
...@@ -29,6 +29,7 @@ class GeolocListener ...@@ -29,6 +29,7 @@ class GeolocListener
if (!$entity instanceof Geoloc) { if (!$entity instanceof Geoloc) {
return; return;
} }
if (empty($entity->getLat()) && empty($entity->getLon())) {
// GEOCODING ADDRESS : // GEOCODING ADDRESS :
$httpClient = new \Http\Adapter\Guzzle6\Client(); $httpClient = new \Http\Adapter\Guzzle6\Client();
$provider = Nominatim::withOpenStreetMapServer($httpClient, 'Mozilla/5.0'); $provider = Nominatim::withOpenStreetMapServer($httpClient, 'Mozilla/5.0');
...@@ -42,4 +43,5 @@ class GeolocListener ...@@ -42,4 +43,5 @@ class GeolocListener
$entity->setLon($coords->getLongitude()); $entity->setLon($coords->getLongitude());
} }
} }
}
} }
...@@ -9,10 +9,16 @@ use App\Entity\User; ...@@ -9,10 +9,16 @@ use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Event\FormEvent; use FOS\UserBundle\Event\FormEvent;
use FOS\UserBundle\Event\UserEvent; use FOS\UserBundle\Event\UserEvent;
use FOS\UserBundle\Mailer\MailerInterface;
use FOS\UserBundle\Model\UserManagerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface;
use Symfony\Component\Templating\EngineInterface; use Symfony\Component\Templating\EngineInterface;
use Symfony\Component\Translation\TranslatorInterface;
/** /**
* Listener responsable des évènements liés aux flux (transfert, transaction, retrait, vente...) * Listener responsable des évènements liés aux flux (transfert, transaction, retrait, vente...)
...@@ -23,18 +29,31 @@ class MLCEventListener implements EventSubscriberInterface ...@@ -23,18 +29,31 @@ class MLCEventListener implements EventSubscriberInterface
protected $mailer; protected $mailer;
protected $params; protected $params;
protected $templating; protected $templating;
protected $translator;
protected $router;
protected $userManager;
protected $tokenGenerator;
public function __construct(EntityManagerInterface $em, \Swift_Mailer $mailer, ParameterBagInterface $params, EngineInterface $templating) public function __construct(EntityManagerInterface $em, \Swift_Mailer $mailer, RouterInterface $router, ParameterBagInterface $params, EngineInterface $templating, TranslatorInterface $translator, UserManagerInterface $userManager, TokenGeneratorInterface $tokenGenerator)
{ {
$this->em = $em; $this->em = $em;
$this->mailer = $mailer; $this->mailer = $mailer;
$this->params = $params; $this->params = $params;
$this->templating = $templating; $this->templating = $templating;
$this->translator = $translator;
$this->router = $router;
$this->userManager = $userManager;
$this->tokenGenerator = $tokenGenerator;
} }
// public function setMailer(TwigSwiftMailer $maileri)
// {
// }
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array( return array(
MLCEvents::REGISTRATION_ADHERENT => 'onRegistrationAdherent',
MLCEvents::FLUX => 'onFlux', MLCEvents::FLUX => 'onFlux',
MLCEvents::COTISATION_COTISATION => 'onCotisation', MLCEvents::COTISATION_COTISATION => 'onCotisation',
MLCEvents::COTISATION_COTISATION_ADHERENT => 'onCotisation', MLCEvents::COTISATION_COTISATION_ADHERENT => 'onCotisation',
...@@ -56,15 +75,45 @@ class MLCEventListener implements EventSubscriberInterface ...@@ -56,15 +75,45 @@ class MLCEventListener implements EventSubscriberInterface
); );
} }
public function onRegistrationAdherent(UserEvent $event)
{
$user = $event->getUser();
//Set confirmation token (alike resetting password)
if (null === $user->getConfirmationToken()) {
$user->setConfirmationToken($this->tokenGenerator->generateToken());
}
// this depends on requirements
$user->setPasswordRequestedAt(new \DateTime());
$this->userManager->updateUser($user);
$subject = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_NAME_SMALL).' : '.$this->translator->trans('Création de votre compte adhérent');
$mail = (new \Swift_Message($subject))
->setFrom($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_NOTIF_EMAIL))
->setTo($user->getEmail())
->setBody(
$this->templating->render(
'email/admin_add_adherent.html.twig',
array(
'subject' => $subject,
'user' => $user,
'confirmationUrl' => $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), UrlGeneratorInterface::ABSOLUTE_URL),
)
),
'text/html'
);
$this->mailer->send($mail);
}
public function onFlux(FluxEvent $event) public function onFlux(FluxEvent $event)
{ {
foreach ($event->getFlux()->getUsersToNotify() as $user) { foreach ($event->getFlux()->getUsersToNotify() as $user) {
if ($user instanceof User && $user->getAlertemailflux()) { if ($user instanceof User && $user->getAlertemailflux()) {
$this->sendMail($user, $event->getFlux()); $this->sendMail($user, $event->getFlux());
} elseif ($user == 'siege') { } elseif ($user == 'siege') {
$users = $this->container->get('doctrine') $userTable = $this->em->getMetadataFactory()->getMetadataFor(User::class)->getTableName();
->getEntityManager() $users = $this->em
->createQuery('SELECT u FROM App:User u WHERE u.roles LIKE :role') ->createQuery("SELECT u FROM $userTable u WHERE u.roles LIKE :role")
->setParameter('role', '%"ROLE_ADMIN_SIEGE"%') ->setParameter('role', '%"ROLE_ADMIN_SIEGE"%')
->getResult(); ->getResult();
foreach ($users as $userAdminSiege) { foreach ($users as $userAdminSiege) {
...@@ -76,7 +125,7 @@ class MLCEventListener implements EventSubscriberInterface ...@@ -76,7 +125,7 @@ class MLCEventListener implements EventSubscriberInterface
private function sendMail(User $user, Flux $flux) private function sendMail(User $user, Flux $flux)
{ {
$subject = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_NAME_SMALL).' : '.ucwords($flux->getParenttype()).' '.ucwords($flux->getType()); $subject = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_NAME_SMALL).' : ';
$mail = (new \Swift_Message($subject)) $mail = (new \Swift_Message($subject))
->setFrom($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_NOTIF_EMAIL)) ->setFrom($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_NOTIF_EMAIL))
->setTo($user->getEmail()) ->setTo($user->getEmail())
...@@ -94,6 +143,7 @@ class MLCEventListener implements EventSubscriberInterface ...@@ -94,6 +143,7 @@ class MLCEventListener implements EventSubscriberInterface
$this->mailer->send($mail); $this->mailer->send($mail);
} }
// @TODO => notifications/emails differents suivant le type d'action
public function onCotisation(FluxEvent $event) public function onCotisation(FluxEvent $event)
{ {
} }
......
...@@ -9,7 +9,10 @@ namespace App\Events; ...@@ -9,7 +9,10 @@ namespace App\Events;
*/ */
final class MLCEvents final class MLCEvents
{ {
/* FLUX */ /* GLOBAL EVENTS*/
const REGISTRATION_ADHERENT = 'mlc.registration_adherent';
/* FLUX EVENTS*/
const FLUX = 'mlc.flux'; const FLUX = 'mlc.flux';
const COTISATION_COTISATION = 'mlc.flux.cotisation'; const COTISATION_COTISATION = 'mlc.flux.cotisation';
const COTISATION_COTISATION_ADHERENT = 'mlc.flux.cotisation.adherent'; const COTISATION_COTISATION_ADHERENT = 'mlc.flux.cotisation.adherent';
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
namespace App\Form; namespace App\Form;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Exception\TransformationFailedException;
class EntityToIdTransformer implements DataTransformerInterface class EntityToIdTransformer implements DataTransformerInterface
{ {
/** /**
* @var ObjectManager * @var EntityManagerInterface
*/ */
protected $objectManager; protected $objectManager;
...@@ -18,7 +18,7 @@ class EntityToIdTransformer implements DataTransformerInterface ...@@ -18,7 +18,7 @@ class EntityToIdTransformer implements DataTransformerInterface
*/ */
protected $class; protected $class;
public function __construct(ObjectManager $objectManager, $class) public function __construct(EntityManagerInterface $objectManager, $class)
{ {
$this->objectManager = $objectManager; $this->objectManager = $objectManager;
$this->class = $class; $this->class = $class;
......
...@@ -46,21 +46,22 @@ class AdherentInfosFormType extends AbstractType ...@@ -46,21 +46,22 @@ class AdherentInfosFormType extends AbstractType
{ {
$builder $builder
->add('user', UserInfosFormType::class, array( ->add('user', UserInfosFormType::class, array(
'label' => false, 'label' => false
'required' => false
)) ))
->add('geoloc', GeolocFormType::class, array( ->add('geoloc', GeolocFormType::class, array(
'label' => false, 'label' => false,
'required' => false 'required' => false,
)) 'with_geoloc' => false,
->add('groupe', ChoiceType::class, array( 'with_latlon' => false
'required' => true,
'disabled' => true,
'label' => 'GROUPE LOCAL',
'choices' => $this->container->get('doctrine')->getRepository(Groupe::class)->findAll(),
'choice_label' => 'name',
'placeholder' => 'Choisir un groupe',
)) ))
// ->add('groupe', ChoiceType::class, array(
// 'required' => true,
// 'disabled' => true,
// 'label' => 'GROUPE LOCAL',
// 'choices' => $this->container->get('doctrine')->getRepository(Groupe::class)->findAll(),
// 'choice_label' => 'name',
// 'placeholder' => 'Choisir un groupe',
// ))
->add('save', SubmitType::class, ['label' => "Modifier"]) ->add('save', SubmitType::class, ['label' => "Modifier"])
; ;
} }
......
...@@ -48,24 +48,27 @@ class AdhererFormType extends AbstractType ...@@ -48,24 +48,27 @@ class AdhererFormType extends AbstractType
'label' => false, 'label' => false,
'required' => false 'required' => false
)) ))
->add('groupe', ChoiceType::class, array( // ->add('groupe', ChoiceType::class, array(
'required' => true, // 'required' => true,
'label' => 'GROUPE LOCAL', // 'label' => 'GROUPE LOCAL',
'choices' => $this->container->get('doctrine')->getRepository(Groupe::class)->findAll(), // 'choices' => $this->container->get('doctrine')->getRepository(Groupe::class)->findAll(),
'choice_label' => 'name', // 'choice_label' => 'name',
'placeholder' => 'Choisir un groupe', // 'placeholder' => 'Choisir un groupe',
)) // ))
->add('geoloc', GeolocFormType::class, array( ->add('geoloc', GeolocFormType::class, array(
'label' => 'ADRESSE',
'required' => false
))
->add('cotisation', AddCotisationFormType::class, array(
'label' => false, 'label' => false,
'required' => false, 'required' => false,
'mapped' => false, 'with_geoloc' => false,
'data' => $adherent->getUser()->getCotisations()->last() 'with_latlon' => false
)) ))
->add('save', SubmitType::class, ['label' => "Valider l'adhésion"]) // ->add('cotisation', AddCotisationFormType::class, array(
// 'label' => false,
// 'required' => false,
// 'mapped' => false,
// 'data' => $adherent->getUser()->getCotisations()->last()
// ))
// ->add('save', SubmitType::class, ['label' => "Valider l'adhésion"])
->add('save', SubmitType::class, ['label' => "Payer en CB"]);
; ;
} }
......
...@@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType; ...@@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
class ContactFormType extends AbstractType class ContactFormType extends AbstractType
...@@ -21,7 +22,7 @@ class ContactFormType extends AbstractType ...@@ -21,7 +22,7 @@ class ContactFormType extends AbstractType
'label' => 'Votre email :', 'label' => 'Votre email :',
'required' => true 'required' => true
)) ))
->add('message', TextType::class, array( ->add('message', TextareaType::class, array(
'label' => 'Votre message :', 'label' => 'Votre message :',
'required' => true 'required' => true
)) ))
......
...@@ -32,9 +32,13 @@ class ContactPrestataireFormType extends AbstractType ...@@ -32,9 +32,13 @@ class ContactPrestataireFormType extends AbstractType
'label' => "Nom du contact / description :", 'label' => "Nom du contact / description :",
'required' => true, 'required' => true,
)) ))
->add('content', TextType::class, array( ->add('tel', TextType::class, array(
'label' => "Téléphone :", 'label' => "Téléphone :",
'required' => true, 'required' => false,
))
->add('email', TextType::class, array(
'label' => "Email :",
'required' => false,
)) ))
->add('enabled', CheckboxType::class, array( ->add('enabled', CheckboxType::class, array(
'label' => 'Public ?', 'label' => 'Public ?',
......
...@@ -22,7 +22,7 @@ class CotisationFormType extends FluxFormType ...@@ -22,7 +22,7 @@ class CotisationFormType extends FluxFormType
$builder $builder
->add('montant', MoneyType::class, array( ->add('montant', MoneyType::class, array(
'label' => 'Montant', 'label' => 'Montant',
'data' => floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_MONTANT)) 'data' => floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_ADHERENT))
)) ))
->add('moyen', ChoiceType::class, array( ->add('moyen', ChoiceType::class, array(
'required' => true, 'required' => true,
......
...@@ -3,59 +3,122 @@ ...@@ -3,59 +3,122 @@
namespace App\Form\Type; namespace App\Form\Type;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\Cotisation;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\User; use App\Entity\User;
use App\Entity\GlobalParameter; use App\Entity\GlobalParameter;
use App\Enum\MoyenEnum; use App\Enum\MoyenEnum;
use App\Tools\RoleCheck;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
class CotiserFormType extends AbstractType class CotiserFormType extends AbstractType
{ {
protected $em; protected $em;
protected $security; protected $security;
protected $rolecheck;
protected $session;
public function __construct(EntityManagerInterface $em, Security $security) public function __construct(EntityManagerInterface $em, Security $security, RoleCheck $rolecheck, SessionInterface $session)
{ {
$this->em = $em; $this->em = $em;
$this->security = $security; $this->security = $security;
$this->rolecheck = $rolecheck;
$this->session = $session;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$now = new \DateTime();
if (empty($this->security) && !empty($this->security->getUser())) { if (empty($this->security) && !empty($this->security->getUser())) {
throw new \Exception("Opération impossible ! Utilisateur non connecté !"); throw new \Exception("Opération impossible ! Utilisateur non connecté !");
} }
$now = new \DateTime();
$montant = 0;
$canPayWithMlc = false;
if ($this->rolecheck->isGranted('ROLE_ADHERENT')) {
$montant = floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_ADHERENT));
$canPayWithMlc = ($this->security->getUser()->getAdherent()->getEcompte() >= $montant);
} elseif ($this->rolecheck->isGranted('ROLE_PRESTATAIRE')) {
$montant = floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_PRESTATAIRE));
$canPayWithMlc = ($this->session->get('_prestagere')->getEcompte() >= $montant);
}
$builder $builder
->add('operateur', HiddenType::class, array( ->add('operateur', HiddenType::class, array(
'entity_class' => User::class, 'entity_class' => User::class,
'em' => $this->em, 'em' => $this->em,
'data_class' => null, 'data_class' => null,
'data' => $this->security->getUser() 'data' => $this->security->getUser()->getId()
))
->add('role', HiddenType::class, array(
'data' => $this->rolecheck->getCurrentRole()->__toString()
))
->add('destinataire', HiddenType::class, array(
'data' => $this->em->getRepository(Prestataire::class)->findOneBy(array('mlc' => true))->getId(),
'data_class' => null,
'entity_class' => Prestataire::class,
'em' => $this->em
)) ))
->add('reference', HiddenType::class, array( ->add('reference', HiddenType::class, array(
'label' => 'Reference :', 'label' => 'Reference :',
'required' => true, 'required' => true,
'data' => 'Cotisation '.$now->format('Y') 'data' => 'Cotisation '.$now->format('Y')
)) ))
->add('montant', HiddenType::class, array( ->add('montant', IntegerType::class, array(
'data' => floatval($this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::COTISATION_MONTANT)), 'data' => $montant,
'constraints' => [
new NotBlank(),
new GreaterThanOrEqual(['value' => $montant]),
],
)) ))
->add('moyen', HiddenType::class, array( ->add('moyen', HiddenType::class, array(
'data' => MoyenEnum::MOYEN_MLC, 'data' => MoyenEnum::MOYEN_MLC,
)) ))
; ;
// ->add('moyen', ChoiceType::class, array(
// 'required' => true,
// 'label' => 'Moyen de paiement :',
// 'choices' => $canPayWithMlc ? [MoyenEnum::getTypeName(MoyenEnum::MOYEN_MLC) => MoyenEnum::MOYEN_MLC, MoyenEnum::getTypeName(MoyenEnum::MOYEN_CB) => MoyenEnum::MOYEN_CB] : [MoyenEnum::getTypeName(MoyenEnum::MOYEN_CB) => MoyenEnum::MOYEN_CB]
// ))
if ($canPayWithMlc) {
$builder->add('payMLC', SubmitType::class, ['label' => "Payer en eMLC"]);
}
$builder->add('payCB', SubmitType::class, ['label' => "Payer en CB"]);
if ($this->rolecheck->isGranted('ROLE_ADHERENT')) {
$builder
->add('expediteur', HiddenType::class, array(
'entity_class' => Adherent::class,
'em' => $this->em,
'data_class' => null,
'data' => $this->security->getUser()->getAdherent()->getId()
))
;
} elseif ($this->rolecheck->isGranted('ROLE_PRESTATAIRE')) {
$builder
->add('expediteur', HiddenType::class, array(
'entity_class' => Prestataire::class,
'em' => $this->em,
'data_class' => null,
'data' => $this->session->get('_prestagere')->getId()
))
; ;
} }
}
/** /**
* {@inheritdoc} * {@inheritdoc}
...@@ -63,7 +126,6 @@ class CotiserFormType extends AbstractType ...@@ -63,7 +126,6 @@ class CotiserFormType extends AbstractType
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults(array(
'data_class' => Cotisation::class,
'cascade_validation' => true 'cascade_validation' => true
)); ));
} }
......
...@@ -18,7 +18,8 @@ class FirstComptoirFormType extends AbstractType ...@@ -18,7 +18,8 @@ class FirstComptoirFormType extends AbstractType
->add('enabled', HiddenType::class, array('data' => true)) ->add('enabled', HiddenType::class, array('data' => true))
->add('name', TextType::class, array( ->add('name', TextType::class, array(
'label' => 'Nom :', 'label' => 'Nom :',
'required' => true 'required' => true,
'help' => "Vous pourrez éditer la description dans l'interface d'administration"
)) ))
->add('geoloc', GeolocFormType::class, array( ->add('geoloc', GeolocFormType::class, array(
'label' => 'Géolocalisation :', 'label' => 'Géolocalisation :',
......
...@@ -73,7 +73,7 @@ class FluxFormType extends AbstractType ...@@ -73,7 +73,7 @@ class FluxFormType extends AbstractType
; ;
} else { } else {
$constraintsMontant = []; $constraintsMontant = [];
if ($flux->getParenttype() == Flux::TYPE_TRANSACTION || $flux->getType() == 'prestataire_siege') { if ($flux->getParenttype() == Flux::TYPE_TRANSACTION || $flux->getType() == 'reconversion') {
$constraintsMontant = [ $constraintsMontant = [
new LessThanOrEqual([ new LessThanOrEqual([
'message' => 'Montant supérieur à votre solde.', 'message' => 'Montant supérieur à votre solde.',
......
...@@ -40,11 +40,15 @@ class GeolocFormType extends AbstractType ...@@ -40,11 +40,15 @@ class GeolocFormType extends AbstractType
'label' => 'Ville :', 'label' => 'Ville :',
'required' => $options['required'] 'required' => $options['required']
)) ))
;
if ($options['with_geoloc'] === true) {
$builder
->add('search', ButtonType::class, [ ->add('search', ButtonType::class, [
'label' => 'Géolocaliser', 'label' => 'Géolocaliser',
'attr' => ['class' => 'searchLatLon btn btn-primary', 'data-url' => $this->router->generate('geolocAdresse')], 'attr' => ['class' => 'searchLatLon btn btn-primary', 'data-url' => $this->router->generate('geolocAdresse')],
]); ])
; ;
}
if ($options['with_latlon'] === true || (!empty($geoloc) && (!empty($geoloc->getLat()) || !empty($geoloc->getLon())))) { if ($options['with_latlon'] === true || (!empty($geoloc) && (!empty($geoloc->getLat()) || !empty($geoloc->getLon())))) {
$builder $builder
->add('lat', null, array( ->add('lat', null, array(
...@@ -64,6 +68,7 @@ class GeolocFormType extends AbstractType ...@@ -64,6 +68,7 @@ class GeolocFormType extends AbstractType
// $resolver->setRequired(['with_latlon']); // $resolver->setRequired(['with_latlon']);
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => Geoloc::class, 'data_class' => Geoloc::class,
'with_geoloc' => true,
'with_latlon' => true 'with_latlon' => true
]); ]);
} }
......
...@@ -40,7 +40,16 @@ class GlobalConfigurationFormType extends AbstractType ...@@ -40,7 +40,16 @@ class GlobalConfigurationFormType extends AbstractType
'label' => "Email utilisé pour l'envoi des notifications :", 'label' => "Email utilisé pour l'envoi des notifications :",
'name_param' => GlobalParameter::MLC_NOTIF_EMAIL, 'name_param' => GlobalParameter::MLC_NOTIF_EMAIL,
'required' => true, 'required' => true,
'_placeholder' => 'notification@mlc.com', '_placeholder' => 'notification@votredomaine.fr',
'constraints_param' => [
new EmailConstraint(['message' => 'Email invalide !'])
],
))
->add('mlccontactemail', GlobalParameterType::class, array(
'label' => "Email de reception des demandes de contact :",
'name_param' => GlobalParameter::MLC_CONTACT_EMAIL,
'required' => true,
'_placeholder' => 'contact@votredomaine.fr',
'constraints_param' => [ 'constraints_param' => [
new EmailConstraint(['message' => 'Email invalide !']) new EmailConstraint(['message' => 'Email invalide !'])
], ],
...@@ -65,16 +74,6 @@ class GlobalConfigurationFormType extends AbstractType ...@@ -65,16 +74,6 @@ class GlobalConfigurationFormType extends AbstractType
new TypeConstraint(['type' => 'numeric', 'message' => "Le montant n'est pas valide !"]) new TypeConstraint(['type' => 'numeric', 'message' => "Le montant n'est pas valide !"])
], ],
)) ))
->add('mlcreconversionadh', GlobalParameterType::class, array(
'label' => 'Taux de reconversion des adhérents :',
'name_param' => GlobalParameter::RECONVERSION_ADHERENT,
'help' => 'Ne pas utiliser de virgule ",", utiliser le point "."',
'required' => true,
'_placeholder' => '0',
'constraints_param' => [
new TypeConstraint(['type' => 'numeric', 'message' => "Le montant n'est pas valide !"])
],
))
->add('mlcreconversionpresta', GlobalParameterType::class, array( ->add('mlcreconversionpresta', GlobalParameterType::class, array(
'label' => 'Taux de reconversion des prestataires :', 'label' => 'Taux de reconversion des prestataires :',
'name_param' => GlobalParameter::RECONVERSION_PRESTATAIRE, 'name_param' => GlobalParameter::RECONVERSION_PRESTATAIRE,
...@@ -85,44 +84,38 @@ class GlobalConfigurationFormType extends AbstractType ...@@ -85,44 +84,38 @@ class GlobalConfigurationFormType extends AbstractType
new TypeConstraint(['type' => 'numeric', 'message' => "Le montant n'est pas valide !"]) new TypeConstraint(['type' => 'numeric', 'message' => "Le montant n'est pas valide !"])
], ],
)) ))
// ->add('mapcenter', GlobalParameterType::class, array( ->add('mapcenter', GlobalParameterType::class, array(
// 'label' => 'Coordonnées du centre de la carte (Format [lat,long], exemple : [45.7,3.2]):', 'label' => 'Coordonnées du centre de la carte (Format [lat,long], exemple : [45.7,3.2]):',
// 'name_param' => GlobalParameter::MAP_CENTER, 'name_param' => GlobalParameter::MAP_CENTER,
// 'required' => true,
// '_placeholder' => '[45.7,3.2]',
// 'constraints_param' => [
// new RegexConstraint(['pattern' => '/^\[[0-9]+\.[0-9]+,[0-9]+\.[0-9]+\]/', 'message' => 'Coordonnées invalide, format attendu : [45.7,3.2]'])
// ],
// ))
// ->add('mapzoom', GlobalParameterType::class, array(
// 'label' => 'Zoom de la carte (nombre entre 1 et 15) :',
// 'name_param' => GlobalParameter::MAP_ZOOM,
// 'required' => true,
// '_placeholder' => '9',
// 'constraints_param' => [
// new RegexConstraint(['pattern' => '/^[0-9]{1,2}$/', 'message' => 'Le zoom doit être un nombre entre 0 et 15 !'])
// ],
// ))
// ->add('mlcfavicon', GlobalParameterType::class, array(
// 'label' => 'Chemin du favicon :',
// '_data' => '/images/favicon.png',
// 'name_param' => GlobalParameter::FAVICON_URL,
// 'required' => true,
// ))
->add('mlctitle', GlobalParameterType::class, array(
'label' => '[SEO] Titre par défaut des pages du site web :',
'name_param' => GlobalParameter::MLC_TITLE,
'required' => true, 'required' => true,
'_placeholder' => '[45.7,3.2]',
'constraints_param' => [
new RegexConstraint(['pattern' => '/^\[[0-9]+\.[0-9]+,[0-9]+\.[0-9]+\]/', 'message' => 'Coordonnées invalide, format attendu : [45.7,3.2]'])
],
'help_html' => true,
'help' => "Pour déterminer le centre et zoom de la carte <a target='_blank' href='https://www.openstreetmap.org/'>Ouvrir OpenStreetMap</a><br/>
Exemple : <em>https://www.openstreetmap.org/search?query=clermont#map=12/45.7811/3.0927</em><br/>
Zoom de la carte : 12<br/>
Centre de la carte : [45.7811,3.0927]"
)) ))
->add('mlcdescription', GlobalParameterType::class, array( ->add('mapzoom', GlobalParameterType::class, array(
'label' => '[SEO] Description par défaut des pages du site web :', 'label' => 'Zoom de la carte (nombre entre 1 et 19) :',
'name_param' => GlobalParameter::MLC_DESCRIPTION, 'name_param' => GlobalParameter::MAP_ZOOM,
'required' => true, 'required' => true,
'_placeholder' => '9',
'constraints_param' => [
new RegexConstraint(['pattern' => '/^[1-9]$|^1[0-9]$/', 'message' => 'Le zoom doit être un nombre entre 1 et 19, généralement entre 9 et 15 pour les MLC !'])
],
)) ))
->add('mlckeywords', GlobalParameterType::class, array( ->add('usewordpress', GlobalParameterType::class, array(
'label' => '[SEO] Mot clés par défaut des pages du site web :', 'label' => "Utiliser Wordpress pour le site web :",
'name_param' => GlobalParameter::MLC_KEYWORDS, 'name_param' => GlobalParameter::USE_WORDPRESS,
'required' => true, 'required' => true,
'_placeholder' => 'false',
'constraints_param' => [
new RegexConstraint(['pattern' => '/^true$|^false$/', 'message' => 'La valeur doit être "true" ou "false"'])
],
'help' => ''
)) ))
; ;
} }
......
...@@ -15,7 +15,7 @@ class GlobalParameterType extends AbstractType ...@@ -15,7 +15,7 @@ class GlobalParameterType extends AbstractType
{ {
$builder $builder
->add('name', HiddenType::class, ['data' => $options['name_param']]) ->add('name', HiddenType::class, ['data' => $options['name_param']])
->add('mandatory', HiddenType::class, ['data' => true]) ->add('mandatory', HiddenType::class, ['data' => $options['_mandatory']])
->add('value', TextType::class, array( ->add('value', TextType::class, array(
'label' => false, 'label' => false,
'constraints' => $options['constraints_param'], 'constraints' => $options['constraints_param'],
...@@ -32,10 +32,10 @@ class GlobalParameterType extends AbstractType ...@@ -32,10 +32,10 @@ class GlobalParameterType extends AbstractType
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => GlobalParameter::class, 'data_class' => GlobalParameter::class,
'required' => true, 'required' => true,
'name_param' => 'MLC', 'name_param' => '',
'_placeholder' => '', '_placeholder' => '',
'_data' => null, '_data' => null,
'default_value' => 'MLC', '_mandatory' => true,
'constraints_param' => [], 'constraints_param' => [],
'error_bubbling' => false, 'error_bubbling' => false,
// 'cascade_validation' => true // 'cascade_validation' => true
......
...@@ -32,14 +32,12 @@ class InstallFormType extends AbstractType ...@@ -32,14 +32,12 @@ class InstallFormType extends AbstractType
$builder $builder
->add('config', GlobalConfigurationFormType::class, array( ->add('config', GlobalConfigurationFormType::class, array(
'label' => 'CONFIGURATIONS GLOBALES :', 'label' => 'CONFIGURATIONS GLOBALES :',
'label_attr' => ['class' => 'font-weight-bold'], 'label_attr' => ['class' => 'font-weight-bold']
'required' => true
)) ))
->add('groupe', FirstGroupeFormType::class, array( ->add('groupe', FirstGroupeFormType::class, array(
'label' => 'PREMIER GROUPE LOCAL', 'label' => 'PREMIER GROUPE LOCAL',
'label_attr' => ['class' => 'font-weight-bold'], 'label_attr' => ['class' => 'font-weight-bold'],
'help' => "Au moins un groupe local est requis pour installer le Kohinos !", 'help' => "Au moins un groupe local est requis pour installer le Kohinos !"
'required' => true,
)) ))
->add('comptoir', FirstComptoirFormType::class, array( ->add('comptoir', FirstComptoirFormType::class, array(
'label' => 'PREMIER COMPTOIR', 'label' => 'PREMIER COMPTOIR',
...@@ -49,8 +47,7 @@ class InstallFormType extends AbstractType ...@@ -49,8 +47,7 @@ class InstallFormType extends AbstractType
)) ))
->add('siege', SiegeFormType::class, array( ->add('siege', SiegeFormType::class, array(
'label' => 'CONFIGURATION DU SIÈGE :', 'label' => 'CONFIGURATION DU SIÈGE :',
'label_attr' => ['class' => 'font-weight-bold'], 'label_attr' => ['class' => 'font-weight-bold']
'required' => true
)) ))
->add('user', RegistrationFormType::class, array( ->add('user', RegistrationFormType::class, array(
'label' => "CRÉATION DE L'UTILISATEUR SUPER ADMIN :", 'label' => "CRÉATION DE L'UTILISATEUR SUPER ADMIN :",
......
...@@ -47,7 +47,7 @@ class RegistrationFormType extends AbstractType ...@@ -47,7 +47,7 @@ class RegistrationFormType extends AbstractType
)) ))
->add('plainPassword', RepeatedType::class, array( ->add('plainPassword', RepeatedType::class, array(
'type' => PasswordType::class, 'type' => PasswordType::class,
'required' => false, 'required' => true,
'options' => array( 'options' => array(
'translation_domain' => 'FOSUserBundle', 'translation_domain' => 'FOSUserBundle',
'attr' => array( 'attr' => array(
......
...@@ -26,7 +26,7 @@ class TransfertGroupeComptoirFormType extends TransfertFormType ...@@ -26,7 +26,7 @@ class TransfertGroupeComptoirFormType extends TransfertFormType
)) ))
->add('destinataire', EntityType::class, array( ->add('destinataire', EntityType::class, array(
'class' => Comptoir::class, 'class' => Comptoir::class,
'choices' => $this->em->getRepository(Comptoir::class)->findBy(array('groupe' => $this->session->get('_groupegere'), 'enabled' => true), array('name' => 'ASC')), 'choices' => $this->em->getRepository(Comptoir::class)->findBy(array('groupe' => $this->session->get('_groupegere')->getId(), 'enabled' => true), array('name' => 'ASC')),
'placeholder' => 'Comptoir', 'placeholder' => 'Comptoir',
'required' => true, 'required' => true,
'label' => 'Comptoir :', 'label' => 'Comptoir :',
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Form\Type; namespace App\Form\Type;
use App\Entity\GlobalParameter;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Siege; use App\Entity\Siege;
use App\Entity\TransfertPrestataireSiege; use App\Entity\TransfertPrestataireSiege;
...@@ -18,6 +19,9 @@ class TransfertPrestataireSiegeFormType extends TransfertFormType ...@@ -18,6 +19,9 @@ class TransfertPrestataireSiegeFormType extends TransfertFormType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('tauxreconversion', HiddenType::class, array(
'data' => (!empty($this->session->get('_prestagere')->getTauxreconversion()) ? $this->session->get('_prestagere')->getTauxreconversion() : $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::RECONVERSION_PRESTATAIRE))
))
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->session->get('_prestagere')->getId(), 'data' => $this->session->get('_prestagere')->getId(),
'data_class' => null, 'data_class' => null,
......
...@@ -53,6 +53,7 @@ class AfterLoginRedirection implements AuthenticationSuccessHandlerInterface ...@@ -53,6 +53,7 @@ class AfterLoginRedirection implements AuthenticationSuccessHandlerInterface
if (count($token->getUser()->getGroups()) > 1) { if (count($token->getUser()->getGroups()) > 1) {
$request->getSession()->set('_choixGroup', 'true'); $request->getSession()->set('_choixGroup', 'true');
} else { } else {
$request->getSession()->remove('_choixGroup');
$groupe = $token->getUser()->getGroups()[0]; $groupe = $token->getUser()->getGroups()[0];
foreach ($rolesTab as $role) { foreach ($rolesTab as $role) {
if ($role == 'ROLE_PRESTATAIRE' && count($token->getUser()->getPrestataires()) >= 1) { if ($role == 'ROLE_PRESTATAIRE' && count($token->getUser()->getPrestataires()) >= 1) {
...@@ -73,7 +74,9 @@ class AfterLoginRedirection implements AuthenticationSuccessHandlerInterface ...@@ -73,7 +74,9 @@ class AfterLoginRedirection implements AuthenticationSuccessHandlerInterface
$redirection = new RedirectResponse($this->getTargetUrlFromSession($request->getSession(), $token)); $redirection = new RedirectResponse($this->getTargetUrlFromSession($request->getSession(), $token));
} else { } else {
// sinon on le redirige vers le dashboard // sinon on le redirige vers le dashboard
$redirection = new RedirectResponse($this->router->generate('sonata_admin_dashboard')); // @TODO : choix du rôle sur la page d'admin sonata OU redirection vers l'index avec modale choix du rôle
// $redirection = new RedirectResponse($this->router->generate('sonata_admin_dashboard'));
$redirection = new RedirectResponse($this->router->generate('index'));
} }
} else { } else {
$redirection = new RedirectResponse($this->router->generate('index')); $redirection = new RedirectResponse($this->router->generate('index'));
......
...@@ -39,8 +39,8 @@ class FluxListener implements EventSubscriber ...@@ -39,8 +39,8 @@ class FluxListener implements EventSubscriber
$em->persist($topersist); $em->persist($topersist);
$em->getUnitOfWork()->computeChangeSet($class, $topersist); $em->getUnitOfWork()->computeChangeSet($class, $topersist);
} }
// @TODO : do something (log, save, email...) on flux persist // @TODO : do something (log, save somewhere else...) on flux persist
// => tag sur un service ? // => @tag sur un service ?
} }
} }
} }
......
...@@ -150,72 +150,4 @@ class UnitOfWorkListener implements EventSubscriber ...@@ -150,72 +150,4 @@ class UnitOfWorkListener implements EventSubscriber
} }
} }
} }
// /**
// * Make a snapshot of insert or update entity link to produit
// * @param Versionable $entity Versionable entity
// * @param string $type 'update' or 'new'
// */
// private function _makeSnapshot($entity, $type = 'update', $productId = null)
// {
// $makeSnapshot = true;
// $entitySerialized = $this->serializer->serialize($entity, 'json', ['groups' => ['default']]);
// if ($entity instanceof Document && $type == 'update') {
// $classes = array('IndustrielVisuel', 'ProduitVisuel', 'ProduitDoc', 'Produit2D', 'Produit3D', 'ProduitTexture', 'ProduitBIM', 'ProduitSavoirFaireDoc', 'ProduitColorieDoc', 'ProduitColorieVignette');
// foreach ($classes as $class) {
// $produitVisuel = $this->em->getRepository('AppBundle:'.$class)->findOneBy(array('img' => $entity));
// if ($produitVisuel) {
// $entity->setProduit($produitVisuel->getProduit());
// $productId = $produitVisuel->getProduit();
// break;
// }
// }
// }
// if ($entity->getId() != null) {
// $currentEntity = $this->em->getRepository(get_class($entity))->find($entity->getId());
// if ($type == 'update' && $productId == null) {
// $change = $this->em->getUnitOfWork()->getEntityChangeSet($entity);
// if (array_key_exists('produit', $change) && count($change['produit']) > 0) {
// $product = $change['produit'][0];
// $this->productid = $product->getId();
// $newProduct = $change['produit'][1];
// if ($newProduct == null or $newProduct->getId() == null) {
// $type = 'delete';
// }
// }
// }
// if (count($this->em->getUnitOfWork()->getEntityChangeSet($entity)) > 0 or $type == 'delete' or $type == 'new') {
// $makeSnapshot = true;
// } else {
// $makeSnapshot = false;
// }
// }
// if ($entity instanceof Document && ($type == 'new' or $type == 'delete')) {
// $makeSnapshot = false;
// }
// if ($makeSnapshot) {
// $changeSets = $this->em->getUnitOfWork()->getEntityChangeSet($entity);
// if ($type == 'new') {
// $resourceVersion = new ResourceVersion($entity, $entitySerialized, $this->security->getUser(), 'new', null, $type, $productId);
// $class = $this->em->getClassMetadata(get_class($resourceVersion));
// $this->em->persist($resourceVersion);
// $this->em->getUnitOfWork()->computeChangeSet($class, $resourceVersion);
// } elseif ($type == 'delete') {
// $resourceVersion = new ResourceVersion($currentEntity, $this->serializer->serialize($currentEntity, 'json', ['groups' => ['default']]), $this->security->getUser(), 'delete', null, $type, $this->productid);
// $class = $this->em->getClassMetadata(get_class($resourceVersion));
// $this->em->persist($resourceVersion);
// $this->em->getUnitOfWork()->computeChangeSet($class, $resourceVersion);
// } else { // update
// foreach ($changeSets as $key => $changeSet) {
// $resourceVersion = new ResourceVersion($entity, $entitySerialized, $this->security->getUser(), (($type == 'delete') ? 'delete' : $key), (($type == 'delete') ? null : $changeSet), $type, $this->productid);
// $class = $this->em->getClassMetadata(get_class($resourceVersion));
// $this->em->persist($resourceVersion);
// $this->em->getUnitOfWork()->computeChangeSet($class, $resourceVersion);
// }
// }
// }
// }
} }
...@@ -22,97 +22,97 @@ final class Version20200309152747 extends AbstractMigration ...@@ -22,97 +22,97 @@ final class Version20200309152747 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE news (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, user_id INT NOT NULL, visible_by_all_groups TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_1DD39950989D9B62 (slug), INDEX IDX_1DD39950EA9FDD75 (media_id), INDEX IDX_1DD39950A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'news (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, user_id INT NOT NULL, visible_by_all_groups TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_1DD39950989D9B62 (slug), INDEX IDX_1DD39950EA9FDD75 (media_id), INDEX IDX_1DD39950A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE flux (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, siege_id INT DEFAULT NULL, cotisationinfos_id INT DEFAULT NULL, adherent_id INT DEFAULT NULL, prestataire_id INT DEFAULT NULL, adherent_dest_id INT DEFAULT NULL, prestataire_dest_id INT DEFAULT NULL, comptoir_id INT DEFAULT NULL, groupe_id INT DEFAULT NULL, type VARCHAR(200) NOT NULL, parenttype VARCHAR(20) NOT NULL, montant NUMERIC(7, 2) NOT NULL, moyen VARCHAR(100) NOT NULL, reference VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, discr VARCHAR(255) NOT NULL, reconverti TINYINT(1) DEFAULT NULL, INDEX IDX_7252313AA76ED395 (user_id), INDEX IDX_7252313ABF006E8B (siege_id), INDEX IDX_7252313A2CB102AD (cotisationinfos_id), INDEX IDX_7252313A25F06C53 (adherent_id), INDEX IDX_7252313ABE3DB2B7 (prestataire_id), INDEX IDX_7252313AFCF2AA19 (adherent_dest_id), INDEX IDX_7252313AECEF536E (prestataire_dest_id), INDEX IDX_7252313AAEB0C1F5 (comptoir_id), INDEX IDX_7252313A7A45358C (groupe_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'flux (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, siege_id INT DEFAULT NULL, cotisationinfos_id INT DEFAULT NULL, adherent_id INT DEFAULT NULL, prestataire_id INT DEFAULT NULL, adherent_dest_id INT DEFAULT NULL, prestataire_dest_id INT DEFAULT NULL, comptoir_id INT DEFAULT NULL, groupe_id INT DEFAULT NULL, type VARCHAR(200) NOT NULL, parenttype VARCHAR(20) NOT NULL, montant NUMERIC(7, 2) NOT NULL, moyen VARCHAR(100) NOT NULL, reference VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, discr VARCHAR(255) NOT NULL, reconverti TINYINT(1) DEFAULT NULL, INDEX IDX_7252313AA76ED395 (user_id), INDEX IDX_7252313ABF006E8B (siege_id), INDEX IDX_7252313A2CB102AD (cotisationinfos_id), INDEX IDX_7252313A25F06C53 (adherent_id), INDEX IDX_7252313ABE3DB2B7 (prestataire_id), INDEX IDX_7252313AFCF2AA19 (adherent_dest_id), INDEX IDX_7252313AECEF536E (prestataire_dest_id), INDEX IDX_7252313AAEB0C1F5 (comptoir_id), INDEX IDX_7252313A7A45358C (groupe_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE rubrique (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_8FA4097C989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_8FA4097C989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE rubrique_prestataire (rubrique_id INT NOT NULL, prestataire_id INT NOT NULL, INDEX IDX_7D4D41BB3BD38833 (rubrique_id), INDEX IDX_7D4D41BBBE3DB2B7 (prestataire_id), PRIMARY KEY(rubrique_id, prestataire_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique_prestataire (rubrique_id INT NOT NULL, prestataire_id INT NOT NULL, INDEX IDX_7D4D41BB3BD38833 (rubrique_id), INDEX IDX_7D4D41BBBE3DB2B7 (prestataire_id), PRIMARY KEY(rubrique_id, prestataire_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE document (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, user_id INT DEFAULT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, UNIQUE INDEX UNIQ_D8698A76989D9B62 (slug), INDEX IDX_D8698A76EA9FDD75 (media_id), INDEX IDX_D8698A76A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'document (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, user_id INT DEFAULT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, UNIQUE INDEX UNIQ_D8698A76989D9B62 (slug), INDEX IDX_D8698A76EA9FDD75 (media_id), INDEX IDX_D8698A76A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE typepresta (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_966F48A2989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'typepresta (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_966F48A2989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE siege (id INT AUTO_INCREMENT NOT NULL, compte_nantie NUMERIC(12, 2) NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, compte NUMERIC(12, 2) NOT NULL, UNIQUE INDEX UNIQ_6706B4F7989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'siege (id INT AUTO_INCREMENT NOT NULL, compte_nantie NUMERIC(12, 2) NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, compte NUMERIC(12, 2) NOT NULL, UNIQUE INDEX UNIQ_6706B4F7989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE cotisationinfos (id INT AUTO_INCREMENT NOT NULL, annee INT NOT NULL, debut DATE NOT NULL, fin DATE NOT NULL, recu TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'cotisationinfos (id INT AUTO_INCREMENT NOT NULL, annee INT NOT NULL, debut DATE NOT NULL, fin DATE NOT NULL, recu TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE import (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, user_id INT DEFAULT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_9D4ECE1DEA9FDD75 (media_id), INDEX IDX_9D4ECE1DA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'import (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, user_id INT DEFAULT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_9D4ECE1DEA9FDD75 (media_id), INDEX IDX_9D4ECE1DA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE adherent (id INT AUTO_INCREMENT NOT NULL, groupe_id INT DEFAULT NULL, geoloc_id INT DEFAULT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, ecompte NUMERIC(12, 2) NOT NULL, INDEX IDX_90D3F0607A45358C (groupe_id), UNIQUE INDEX UNIQ_90D3F060EF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'adherent (id INT AUTO_INCREMENT NOT NULL, groupe_id INT DEFAULT NULL, geoloc_id INT DEFAULT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, ecompte NUMERIC(12, 2) NOT NULL, INDEX IDX_90D3F0607A45358C (groupe_id), UNIQUE INDEX UNIQ_90D3F060EF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE comptoir (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, groupe_id INT DEFAULT NULL, geoloc_id INT DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, tel VARCHAR(20) DEFAULT NULL, email VARCHAR(100) DEFAULT NULL, compte NUMERIC(12, 2) NOT NULL, UNIQUE INDEX UNIQ_A6E2C35E989D9B62 (slug), INDEX IDX_A6E2C35EEA9FDD75 (media_id), INDEX IDX_A6E2C35E7A45358C (groupe_id), UNIQUE INDEX UNIQ_A6E2C35EEF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, groupe_id INT DEFAULT NULL, geoloc_id INT DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, tel VARCHAR(20) DEFAULT NULL, email VARCHAR(100) DEFAULT NULL, compte NUMERIC(12, 2) NOT NULL, UNIQUE INDEX UNIQ_A6E2C35E989D9B62 (slug), INDEX IDX_A6E2C35EEA9FDD75 (media_id), INDEX IDX_A6E2C35E7A45358C (groupe_id), UNIQUE INDEX UNIQ_A6E2C35EEF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE comptoir_user (comptoir_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_615689B1AEB0C1F5 (comptoir_id), INDEX IDX_615689B1A76ED395 (user_id), PRIMARY KEY(comptoir_id, user_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir_user (comptoir_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_615689B1AEB0C1F5 (comptoir_id), INDEX IDX_615689B1A76ED395 (user_id), PRIMARY KEY(comptoir_id, user_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, adherent_id INT DEFAULT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled TINYINT(1) NOT NULL, salt VARCHAR(255) DEFAULT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, confirmation_token VARCHAR(180) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, date_of_birth DATETIME DEFAULT NULL, firstname VARCHAR(64) DEFAULT NULL, lastname VARCHAR(64) DEFAULT NULL, website VARCHAR(64) DEFAULT NULL, biography VARCHAR(1000) DEFAULT NULL, gender VARCHAR(1) DEFAULT NULL, locale VARCHAR(8) DEFAULT NULL, timezone VARCHAR(64) DEFAULT NULL, phone VARCHAR(64) DEFAULT NULL, facebook_uid VARCHAR(255) DEFAULT NULL, facebook_name VARCHAR(255) DEFAULT NULL, facebook_data LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', twitter_uid VARCHAR(255) DEFAULT NULL, twitter_name VARCHAR(255) DEFAULT NULL, twitter_data LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', gplus_uid VARCHAR(255) DEFAULT NULL, gplus_name VARCHAR(255) DEFAULT NULL, gplus_data LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', token VARCHAR(255) DEFAULT NULL, two_step_code VARCHAR(255) DEFAULT NULL, etat VARCHAR(10) DEFAULT NULL, mobile VARCHAR(15) DEFAULT NULL, apiKey VARCHAR(255) DEFAULT NULL, alertemailflux TINYINT(1) DEFAULT \'1\' NOT NULL, UNIQUE INDEX UNIQ_8D93D64992FC23A8 (username_canonical), UNIQUE INDEX UNIQ_8D93D649A0D96FBF (email_canonical), UNIQUE INDEX UNIQ_8D93D649C05FB297 (confirmation_token), UNIQUE INDEX UNIQ_8D93D64925F06C53 (adherent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'user (id INT AUTO_INCREMENT NOT NULL, adherent_id INT DEFAULT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled TINYINT(1) NOT NULL, salt VARCHAR(255) DEFAULT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, confirmation_token VARCHAR(180) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, date_of_birth DATETIME DEFAULT NULL, firstname VARCHAR(64) DEFAULT NULL, lastname VARCHAR(64) DEFAULT NULL, website VARCHAR(64) DEFAULT NULL, biography VARCHAR(1000) DEFAULT NULL, gender VARCHAR(1) DEFAULT NULL, locale VARCHAR(8) DEFAULT NULL, timezone VARCHAR(64) DEFAULT NULL, phone VARCHAR(64) DEFAULT NULL, facebook_uid VARCHAR(255) DEFAULT NULL, facebook_name VARCHAR(255) DEFAULT NULL, facebook_data LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', twitter_uid VARCHAR(255) DEFAULT NULL, twitter_name VARCHAR(255) DEFAULT NULL, twitter_data LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', gplus_uid VARCHAR(255) DEFAULT NULL, gplus_name VARCHAR(255) DEFAULT NULL, gplus_data LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', token VARCHAR(255) DEFAULT NULL, two_step_code VARCHAR(255) DEFAULT NULL, etat VARCHAR(10) DEFAULT NULL, mobile VARCHAR(15) DEFAULT NULL, apiKey VARCHAR(255) DEFAULT NULL, alertemailflux TINYINT(1) DEFAULT \'1\' NOT NULL, UNIQUE INDEX UNIQ_8D93D64992FC23A8 (username_canonical), UNIQUE INDEX UNIQ_8D93D649A0D96FBF (email_canonical), UNIQUE INDEX UNIQ_8D93D649C05FB297 (confirmation_token), UNIQUE INDEX UNIQ_8D93D64925F06C53 (adherent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_usergroup (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_4A84F5F3A76ED395 (user_id), INDEX IDX_4A84F5F3FE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'user_usergroup (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_4A84F5F3A76ED395 (user_id), INDEX IDX_4A84F5F3FE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE lien (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, url VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, UNIQUE INDEX UNIQ_A532B4B5989D9B62 (slug), INDEX IDX_A532B4B5A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'lien (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, url VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, UNIQUE INDEX UNIQ_A532B4B5989D9B62 (slug), INDEX IDX_A532B4B5A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE prestataire (id INT AUTO_INCREMENT NOT NULL, typeprestataire_id INT DEFAULT NULL, media_id INT DEFAULT NULL, groupe_id INT DEFAULT NULL, geoloc_id INT DEFAULT NULL, raison VARCHAR(100) NOT NULL, description LONGTEXT DEFAULT NULL, slug VARCHAR(100) NOT NULL, metier VARCHAR(100) DEFAULT NULL, statut VARCHAR(50) DEFAULT NULL, responsable VARCHAR(200) DEFAULT NULL, iban VARCHAR(100) NOT NULL, siret VARCHAR(50) NOT NULL, web VARCHAR(255) DEFAULT NULL, mlc TINYINT(1) DEFAULT \'0\' NOT NULL, horaires VARCHAR(255) DEFAULT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, compte NUMERIC(12, 2) NOT NULL, ecompte NUMERIC(12, 2) NOT NULL, UNIQUE INDEX UNIQ_60A26480989D9B62 (slug), INDEX IDX_60A26480618045AC (typeprestataire_id), INDEX IDX_60A26480EA9FDD75 (media_id), INDEX IDX_60A264807A45358C (groupe_id), UNIQUE INDEX UNIQ_60A26480EF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire (id INT AUTO_INCREMENT NOT NULL, typeprestataire_id INT DEFAULT NULL, media_id INT DEFAULT NULL, groupe_id INT DEFAULT NULL, geoloc_id INT DEFAULT NULL, raison VARCHAR(100) NOT NULL, description LONGTEXT DEFAULT NULL, slug VARCHAR(100) NOT NULL, metier VARCHAR(100) DEFAULT NULL, statut VARCHAR(50) DEFAULT NULL, responsable VARCHAR(200) DEFAULT NULL, iban VARCHAR(100) NOT NULL, siret VARCHAR(50) NOT NULL, web VARCHAR(255) DEFAULT NULL, mlc TINYINT(1) DEFAULT \'0\' NOT NULL, horaires VARCHAR(255) DEFAULT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, compte NUMERIC(12, 2) NOT NULL, ecompte NUMERIC(12, 2) NOT NULL, UNIQUE INDEX UNIQ_60A26480989D9B62 (slug), INDEX IDX_60A26480618045AC (typeprestataire_id), INDEX IDX_60A26480EA9FDD75 (media_id), INDEX IDX_60A264807A45358C (groupe_id), UNIQUE INDEX UNIQ_60A26480EF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE prestataire_user (prestataire_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_6A15943DBE3DB2B7 (prestataire_id), INDEX IDX_6A15943DA76ED395 (user_id), PRIMARY KEY(prestataire_id, user_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire_user (prestataire_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_6A15943DBE3DB2B7 (prestataire_id), INDEX IDX_6A15943DA76ED395 (user_id), PRIMARY KEY(prestataire_id, user_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE geoloc (id INT AUTO_INCREMENT NOT NULL, adresse VARCHAR(255) DEFAULT NULL, cpostal VARCHAR(10) DEFAULT NULL, ville VARCHAR(100) DEFAULT NULL, lat NUMERIC(10, 8) DEFAULT NULL, lon NUMERIC(10, 8) DEFAULT NULL, enabled TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'geoloc (id INT AUTO_INCREMENT NOT NULL, adresse VARCHAR(255) DEFAULT NULL, cpostal VARCHAR(10) DEFAULT NULL, ville VARCHAR(100) DEFAULT NULL, lat NUMERIC(10, 8) DEFAULT NULL, lon NUMERIC(10, 8) DEFAULT NULL, enabled TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE faq (id INT AUTO_INCREMENT NOT NULL, fichier_id INT DEFAULT NULL, media_id INT DEFAULT NULL, user_id INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, UNIQUE INDEX UNIQ_E8FF75CC989D9B62 (slug), INDEX IDX_E8FF75CCF915CFE (fichier_id), INDEX IDX_E8FF75CCEA9FDD75 (media_id), INDEX IDX_E8FF75CCA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'faq (id INT AUTO_INCREMENT NOT NULL, fichier_id INT DEFAULT NULL, media_id INT DEFAULT NULL, user_id INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, UNIQUE INDEX UNIQ_E8FF75CC989D9B62 (slug), INDEX IDX_E8FF75CCF915CFE (fichier_id), INDEX IDX_E8FF75CCEA9FDD75 (media_id), INDEX IDX_E8FF75CCA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE page (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, js LONGTEXT DEFAULT NULL, css LONGTEXT DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, keywords VARCHAR(255) DEFAULT NULL, template VARCHAR(255) DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_140AB620989D9B62 (slug), INDEX IDX_140AB620A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'page (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, js LONGTEXT DEFAULT NULL, css LONGTEXT DEFAULT NULL, description VARCHAR(255) DEFAULT NULL, keywords VARCHAR(255) DEFAULT NULL, template VARCHAR(255) DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_140AB620989D9B62 (slug), INDEX IDX_140AB620A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE global_parameter (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, value LONGTEXT NOT NULL, mandatory TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'global_parameter (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, value LONGTEXT NOT NULL, mandatory TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE groupe (id INT AUTO_INCREMENT NOT NULL, siege_id INT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, compte NUMERIC(12, 2) NOT NULL, UNIQUE INDEX UNIQ_4B98C21989D9B62 (slug), INDEX IDX_4B98C21BF006E8B (siege_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'groupe (id INT AUTO_INCREMENT NOT NULL, siege_id INT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, compte NUMERIC(12, 2) NOT NULL, UNIQUE INDEX UNIQ_4B98C21989D9B62 (slug), INDEX IDX_4B98C21BF006E8B (siege_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE groupe_user (groupe_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_257BA9FE7A45358C (groupe_id), INDEX IDX_257BA9FEA76ED395 (user_id), PRIMARY KEY(groupe_id, user_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'groupe_user (groupe_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_257BA9FE7A45358C (groupe_id), INDEX IDX_257BA9FEA76ED395 (user_id), PRIMARY KEY(groupe_id, user_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE email_token (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expired_at DATE NOT NULL, INDEX IDX_C27AE0B4A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'email_token (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expired_at DATE NOT NULL, INDEX IDX_C27AE0B4A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE message (id INT AUTO_INCREMENT NOT NULL, expediteur_id INT DEFAULT NULL, destinataire_id INT DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_B6BD307F989D9B62 (slug), INDEX IDX_B6BD307F10335F61 (expediteur_id), INDEX IDX_B6BD307FA4F84F6E (destinataire_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'message (id INT AUTO_INCREMENT NOT NULL, expediteur_id INT DEFAULT NULL, destinataire_id INT DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_B6BD307F989D9B62 (slug), INDEX IDX_B6BD307F10335F61 (expediteur_id), INDEX IDX_B6BD307FA4F84F6E (destinataire_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE usergroup (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(180) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', UNIQUE INDEX UNIQ_4A6478175E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'usergroup (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(180) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', UNIQUE INDEX UNIQ_4A6478175E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE groupeprestaire (id INT AUTO_INCREMENT NOT NULL, groupe_id INT DEFAULT NULL, media_id INT DEFAULT NULL, geoloc_id INT DEFAULT NULL, type VARCHAR(50) NOT NULL, horaires VARCHAR(255) DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, tel VARCHAR(20) DEFAULT NULL, email VARCHAR(100) DEFAULT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_FB9ABBCE989D9B62 (slug), INDEX IDX_FB9ABBCE7A45358C (groupe_id), INDEX IDX_FB9ABBCEEA9FDD75 (media_id), UNIQUE INDEX UNIQ_FB9ABBCEEF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestaire (id INT AUTO_INCREMENT NOT NULL, groupe_id INT DEFAULT NULL, media_id INT DEFAULT NULL, geoloc_id INT DEFAULT NULL, type VARCHAR(50) NOT NULL, horaires VARCHAR(255) DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, tel VARCHAR(20) DEFAULT NULL, email VARCHAR(100) DEFAULT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_FB9ABBCE989D9B62 (slug), INDEX IDX_FB9ABBCE7A45358C (groupe_id), INDEX IDX_FB9ABBCEEA9FDD75 (media_id), UNIQUE INDEX UNIQ_FB9ABBCEEF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE groupeprestataire_prestataire (groupeprestataire_id INT NOT NULL, prestataire_id INT NOT NULL, INDEX IDX_66D8DEC98D18A702 (groupeprestataire_id), INDEX IDX_66D8DEC9BE3DB2B7 (prestataire_id), PRIMARY KEY(groupeprestataire_id, prestataire_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestataire_prestataire (groupeprestataire_id INT NOT NULL, prestataire_id INT NOT NULL, INDEX IDX_66D8DEC98D18A702 (groupeprestataire_id), INDEX IDX_66D8DEC9BE3DB2B7 (prestataire_id), PRIMARY KEY(groupeprestataire_id, prestataire_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE sonata_menu (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, alias VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'sonata_menu (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, alias VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE sonata_menu_item (id INT AUTO_INCREMENT NOT NULL, parent INT DEFAULT NULL, menu INT NOT NULL, name VARCHAR(255) NOT NULL, url VARCHAR(255) DEFAULT NULL, class_attribute VARCHAR(255) DEFAULT NULL, position SMALLINT UNSIGNED DEFAULT NULL, target TINYINT(1) DEFAULT \'0\', enabled TINYINT(1) DEFAULT \'1\', INDEX IDX_57D4FCFA3D8E604F (parent), INDEX IDX_57D4FCFA7D053A93 (menu), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'sonata_menu_item (id INT AUTO_INCREMENT NOT NULL, parent INT DEFAULT NULL, menu INT NOT NULL, name VARCHAR(255) NOT NULL, url VARCHAR(255) DEFAULT NULL, class_attribute VARCHAR(255) DEFAULT NULL, position SMALLINT UNSIGNED DEFAULT NULL, target TINYINT(1) DEFAULT \'0\', enabled TINYINT(1) DEFAULT \'1\', INDEX IDX_57D4FCFA3D8E604F (parent), INDEX IDX_57D4FCFA7D053A93 (menu), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE media__gallery_media (id INT AUTO_INCREMENT NOT NULL, gallery_id INT DEFAULT NULL, media_id INT DEFAULT NULL, position INT NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_80D4C5414E7AF8F (gallery_id), INDEX IDX_80D4C541EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'media__gallery_media (id INT AUTO_INCREMENT NOT NULL, gallery_id INT DEFAULT NULL, media_id INT DEFAULT NULL, position INT NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_80D4C5414E7AF8F (gallery_id), INDEX IDX_80D4C541EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE media__gallery (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, context VARCHAR(64) NOT NULL, default_format VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'media__gallery (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, context VARCHAR(64) NOT NULL, default_format VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE media__media (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, provider_name VARCHAR(255) NOT NULL, provider_status INT NOT NULL, provider_reference VARCHAR(255) NOT NULL, provider_metadata LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', width INT DEFAULT NULL, height INT DEFAULT NULL, length NUMERIC(10, 0) DEFAULT NULL, content_type VARCHAR(255) DEFAULT NULL, content_size INT DEFAULT NULL, copyright VARCHAR(255) DEFAULT NULL, author_name VARCHAR(255) DEFAULT NULL, context VARCHAR(64) DEFAULT NULL, cdn_is_flushable TINYINT(1) DEFAULT NULL, cdn_flush_identifier VARCHAR(64) DEFAULT NULL, cdn_flush_at DATETIME DEFAULT NULL, cdn_status INT DEFAULT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'media__media (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, provider_name VARCHAR(255) NOT NULL, provider_status INT NOT NULL, provider_reference VARCHAR(255) NOT NULL, provider_metadata LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', width INT DEFAULT NULL, height INT DEFAULT NULL, length NUMERIC(10, 0) DEFAULT NULL, content_type VARCHAR(255) DEFAULT NULL, content_size INT DEFAULT NULL, copyright VARCHAR(255) DEFAULT NULL, author_name VARCHAR(255) DEFAULT NULL, context VARCHAR(64) DEFAULT NULL, cdn_is_flushable TINYINT(1) DEFAULT NULL, cdn_flush_identifier VARCHAR(64) DEFAULT NULL, cdn_flush_at DATETIME DEFAULT NULL, cdn_status INT DEFAULT NULL, updated_at DATETIME NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE lexik_trans_unit (id INT AUTO_INCREMENT NOT NULL, key_name VARCHAR(255) NOT NULL, domain VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX key_domain_idx (key_name, domain), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'lexik_trans_unit (id INT AUTO_INCREMENT NOT NULL, key_name VARCHAR(255) NOT NULL, domain VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX key_domain_idx (key_name, domain), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE lexik_translation_file (id INT AUTO_INCREMENT NOT NULL, domain VARCHAR(255) NOT NULL, locale VARCHAR(10) NOT NULL, extention VARCHAR(10) NOT NULL, path VARCHAR(255) NOT NULL, hash VARCHAR(255) NOT NULL, UNIQUE INDEX hash_idx (hash), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'lexik_translation_file (id INT AUTO_INCREMENT NOT NULL, domain VARCHAR(255) NOT NULL, locale VARCHAR(10) NOT NULL, extention VARCHAR(10) NOT NULL, path VARCHAR(255) NOT NULL, hash VARCHAR(255) NOT NULL, UNIQUE INDEX hash_idx (hash), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE lexik_trans_unit_translations (id INT AUTO_INCREMENT NOT NULL, file_id INT DEFAULT NULL, trans_unit_id INT DEFAULT NULL, locale VARCHAR(10) NOT NULL, content LONGTEXT NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, modified_manually TINYINT(1) NOT NULL, INDEX IDX_B0AA394493CB796C (file_id), INDEX IDX_B0AA3944C3C583C9 (trans_unit_id), UNIQUE INDEX trans_unit_locale_idx (trans_unit_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'lexik_trans_unit_translations (id INT AUTO_INCREMENT NOT NULL, file_id INT DEFAULT NULL, trans_unit_id INT DEFAULT NULL, locale VARCHAR(10) NOT NULL, content LONGTEXT NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, modified_manually TINYINT(1) NOT NULL, INDEX IDX_B0AA394493CB796C (file_id), INDEX IDX_B0AA3944C3C583C9 (trans_unit_id), UNIQUE INDEX trans_unit_locale_idx (trans_unit_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'news ADD CONSTRAINT FK_1DD39950EA9FDD75 FOREIGN KEY (media_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id)');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'news ADD CONSTRAINT FK_1DD39950A76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313AA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD CONSTRAINT FK_7252313AA76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313ABF006E8B FOREIGN KEY (siege_id) REFERENCES siege (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD CONSTRAINT FK_7252313ABF006E8B FOREIGN KEY (siege_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'siege (id)');
$this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313A2CB102AD FOREIGN KEY (cotisationinfos_id) REFERENCES cotisationinfos (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD CONSTRAINT FK_7252313A2CB102AD FOREIGN KEY (cotisationinfos_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'cotisationinfos (id)');
$this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313A25F06C53 FOREIGN KEY (adherent_id) REFERENCES adherent (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD CONSTRAINT FK_7252313A25F06C53 FOREIGN KEY (adherent_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'adherent (id)');
$this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313ABE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD CONSTRAINT FK_7252313ABE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'prestataire (id)');
$this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313AFCF2AA19 FOREIGN KEY (adherent_dest_id) REFERENCES adherent (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD CONSTRAINT FK_7252313AFCF2AA19 FOREIGN KEY (adherent_dest_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'adherent (id)');
$this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313AECEF536E FOREIGN KEY (prestataire_dest_id) REFERENCES prestataire (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD CONSTRAINT FK_7252313AECEF536E FOREIGN KEY (prestataire_dest_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'prestataire (id)');
$this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313AAEB0C1F5 FOREIGN KEY (comptoir_id) REFERENCES comptoir (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD CONSTRAINT FK_7252313AAEB0C1F5 FOREIGN KEY (comptoir_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'comptoir (id)');
$this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313A7A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD CONSTRAINT FK_7252313A7A45358C FOREIGN KEY (groupe_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'groupe (id)');
$this->addSql('ALTER TABLE rubrique_prestataire ADD CONSTRAINT FK_7D4D41BB3BD38833 FOREIGN KEY (rubrique_id) REFERENCES rubrique (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique_prestataire ADD CONSTRAINT FK_7D4D41BB3BD38833 FOREIGN KEY (rubrique_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'rubrique (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE rubrique_prestataire ADD CONSTRAINT FK_7D4D41BBBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique_prestataire ADD CONSTRAINT FK_7D4D41BBBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'prestataire (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE document ADD CONSTRAINT FK_D8698A76EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'document ADD CONSTRAINT FK_D8698A76EA9FDD75 FOREIGN KEY (media_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id)');
$this->addSql('ALTER TABLE document ADD CONSTRAINT FK_D8698A76A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'document ADD CONSTRAINT FK_D8698A76A76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE import ADD CONSTRAINT FK_9D4ECE1DEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'import ADD CONSTRAINT FK_9D4ECE1DEA9FDD75 FOREIGN KEY (media_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id)');
$this->addSql('ALTER TABLE import ADD CONSTRAINT FK_9D4ECE1DA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'import ADD CONSTRAINT FK_9D4ECE1DA76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE adherent ADD CONSTRAINT FK_90D3F0607A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'adherent ADD CONSTRAINT FK_90D3F0607A45358C FOREIGN KEY (groupe_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'groupe (id)');
$this->addSql('ALTER TABLE adherent ADD CONSTRAINT FK_90D3F060EF390162 FOREIGN KEY (geoloc_id) REFERENCES geoloc (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'adherent ADD CONSTRAINT FK_90D3F060EF390162 FOREIGN KEY (geoloc_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'geoloc (id)');
$this->addSql('ALTER TABLE comptoir ADD CONSTRAINT FK_A6E2C35EEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir ADD CONSTRAINT FK_A6E2C35EEA9FDD75 FOREIGN KEY (media_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id)');
$this->addSql('ALTER TABLE comptoir ADD CONSTRAINT FK_A6E2C35E7A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir ADD CONSTRAINT FK_A6E2C35E7A45358C FOREIGN KEY (groupe_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'groupe (id)');
$this->addSql('ALTER TABLE comptoir ADD CONSTRAINT FK_A6E2C35EEF390162 FOREIGN KEY (geoloc_id) REFERENCES geoloc (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir ADD CONSTRAINT FK_A6E2C35EEF390162 FOREIGN KEY (geoloc_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'geoloc (id)');
$this->addSql('ALTER TABLE comptoir_user ADD CONSTRAINT FK_615689B1AEB0C1F5 FOREIGN KEY (comptoir_id) REFERENCES comptoir (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir_user ADD CONSTRAINT FK_615689B1AEB0C1F5 FOREIGN KEY (comptoir_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'comptoir (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE comptoir_user ADD CONSTRAINT FK_615689B1A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir_user ADD CONSTRAINT FK_615689B1A76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D64925F06C53 FOREIGN KEY (adherent_id) REFERENCES adherent (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'user ADD CONSTRAINT FK_8D93D64925F06C53 FOREIGN KEY (adherent_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'adherent (id)');
$this->addSql('ALTER TABLE user_usergroup ADD CONSTRAINT FK_4A84F5F3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'user_usergroup ADD CONSTRAINT FK_4A84F5F3A76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE user_usergroup ADD CONSTRAINT FK_4A84F5F3FE54D947 FOREIGN KEY (group_id) REFERENCES usergroup (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'user_usergroup ADD CONSTRAINT FK_4A84F5F3FE54D947 FOREIGN KEY (group_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'usergroup (id)');
$this->addSql('ALTER TABLE lien ADD CONSTRAINT FK_A532B4B5A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'lien ADD CONSTRAINT FK_A532B4B5A76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE prestataire ADD CONSTRAINT FK_60A26480618045AC FOREIGN KEY (typeprestataire_id) REFERENCES typepresta (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire ADD CONSTRAINT FK_60A26480618045AC FOREIGN KEY (typeprestataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'typepresta (id)');
$this->addSql('ALTER TABLE prestataire ADD CONSTRAINT FK_60A26480EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire ADD CONSTRAINT FK_60A26480EA9FDD75 FOREIGN KEY (media_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id)');
$this->addSql('ALTER TABLE prestataire ADD CONSTRAINT FK_60A264807A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire ADD CONSTRAINT FK_60A264807A45358C FOREIGN KEY (groupe_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'groupe (id)');
$this->addSql('ALTER TABLE prestataire ADD CONSTRAINT FK_60A26480EF390162 FOREIGN KEY (geoloc_id) REFERENCES geoloc (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire ADD CONSTRAINT FK_60A26480EF390162 FOREIGN KEY (geoloc_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'geoloc (id)');
$this->addSql('ALTER TABLE prestataire_user ADD CONSTRAINT FK_6A15943DBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire_user ADD CONSTRAINT FK_6A15943DBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'prestataire (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE prestataire_user ADD CONSTRAINT FK_6A15943DA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire_user ADD CONSTRAINT FK_6A15943DA76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE faq ADD CONSTRAINT FK_E8FF75CCF915CFE FOREIGN KEY (fichier_id) REFERENCES media__media (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'faq ADD CONSTRAINT FK_E8FF75CCF915CFE FOREIGN KEY (fichier_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id)');
$this->addSql('ALTER TABLE faq ADD CONSTRAINT FK_E8FF75CCEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'faq ADD CONSTRAINT FK_E8FF75CCEA9FDD75 FOREIGN KEY (media_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id)');
$this->addSql('ALTER TABLE faq ADD CONSTRAINT FK_E8FF75CCA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'faq ADD CONSTRAINT FK_E8FF75CCA76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'page ADD CONSTRAINT FK_140AB620A76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE groupe ADD CONSTRAINT FK_4B98C21BF006E8B FOREIGN KEY (siege_id) REFERENCES siege (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupe ADD CONSTRAINT FK_4B98C21BF006E8B FOREIGN KEY (siege_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'siege (id)');
$this->addSql('ALTER TABLE groupe_user ADD CONSTRAINT FK_257BA9FE7A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupe_user ADD CONSTRAINT FK_257BA9FE7A45358C FOREIGN KEY (groupe_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'groupe (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE groupe_user ADD CONSTRAINT FK_257BA9FEA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupe_user ADD CONSTRAINT FK_257BA9FEA76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE email_token ADD CONSTRAINT FK_C27AE0B4A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'email_token ADD CONSTRAINT FK_C27AE0B4A76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307F10335F61 FOREIGN KEY (expediteur_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'message ADD CONSTRAINT FK_B6BD307F10335F61 FOREIGN KEY (expediteur_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FA4F84F6E FOREIGN KEY (destinataire_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'message ADD CONSTRAINT FK_B6BD307FA4F84F6E FOREIGN KEY (destinataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE groupeprestaire ADD CONSTRAINT FK_FB9ABBCE7A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestaire ADD CONSTRAINT FK_FB9ABBCE7A45358C FOREIGN KEY (groupe_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'groupe (id)');
$this->addSql('ALTER TABLE groupeprestaire ADD CONSTRAINT FK_FB9ABBCEEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestaire ADD CONSTRAINT FK_FB9ABBCEEA9FDD75 FOREIGN KEY (media_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id)');
$this->addSql('ALTER TABLE groupeprestaire ADD CONSTRAINT FK_FB9ABBCEEF390162 FOREIGN KEY (geoloc_id) REFERENCES geoloc (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestaire ADD CONSTRAINT FK_FB9ABBCEEF390162 FOREIGN KEY (geoloc_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'geoloc (id)');
$this->addSql('ALTER TABLE groupeprestataire_prestataire ADD CONSTRAINT FK_66D8DEC98D18A702 FOREIGN KEY (groupeprestataire_id) REFERENCES groupeprestaire (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestataire_prestataire ADD CONSTRAINT FK_66D8DEC98D18A702 FOREIGN KEY (groupeprestataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'groupeprestaire (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE groupeprestataire_prestataire ADD CONSTRAINT FK_66D8DEC9BE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestataire_prestataire ADD CONSTRAINT FK_66D8DEC9BE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'prestataire (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE sonata_menu_item ADD CONSTRAINT FK_57D4FCFA3D8E604F FOREIGN KEY (parent) REFERENCES sonata_menu_item (id) ON DELETE SET NULL'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'sonata_menu_item ADD CONSTRAINT FK_57D4FCFA3D8E604F FOREIGN KEY (parent) REFERENCES '.$_ENV['DATABASE_PREFIX'].'sonata_menu_item (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE sonata_menu_item ADD CONSTRAINT FK_57D4FCFA7D053A93 FOREIGN KEY (menu) REFERENCES sonata_menu (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'sonata_menu_item ADD CONSTRAINT FK_57D4FCFA7D053A93 FOREIGN KEY (menu) REFERENCES '.$_ENV['DATABASE_PREFIX'].'sonata_menu (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C5414E7AF8F FOREIGN KEY (gallery_id) REFERENCES media__gallery (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'media__gallery_media ADD CONSTRAINT FK_80D4C5414E7AF8F FOREIGN KEY (gallery_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__gallery (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE media__gallery_media ADD CONSTRAINT FK_80D4C541EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'media__gallery_media ADD CONSTRAINT FK_80D4C541EA9FDD75 FOREIGN KEY (media_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE lexik_trans_unit_translations ADD CONSTRAINT FK_B0AA394493CB796C FOREIGN KEY (file_id) REFERENCES lexik_translation_file (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'lexik_trans_unit_translations ADD CONSTRAINT FK_B0AA394493CB796C FOREIGN KEY (file_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'lexik_translation_file (id)');
$this->addSql('ALTER TABLE lexik_trans_unit_translations ADD CONSTRAINT FK_B0AA3944C3C583C9 FOREIGN KEY (trans_unit_id) REFERENCES lexik_trans_unit (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'lexik_trans_unit_translations ADD CONSTRAINT FK_B0AA3944C3C583C9 FOREIGN KEY (trans_unit_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'lexik_trans_unit (id)');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
...@@ -120,96 +120,96 @@ final class Version20200309152747 extends AbstractMigration ...@@ -120,96 +120,96 @@ final class Version20200309152747 extends AbstractMigration
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE rubrique_prestataire DROP FOREIGN KEY FK_7D4D41BB3BD38833'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique_prestataire DROP FOREIGN KEY FK_7D4D41BB3BD38833');
$this->addSql('ALTER TABLE prestataire DROP FOREIGN KEY FK_60A26480618045AC'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire DROP FOREIGN KEY FK_60A26480618045AC');
$this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313ABF006E8B'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP FOREIGN KEY FK_7252313ABF006E8B');
$this->addSql('ALTER TABLE groupe DROP FOREIGN KEY FK_4B98C21BF006E8B'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupe DROP FOREIGN KEY FK_4B98C21BF006E8B');
$this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313A2CB102AD'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP FOREIGN KEY FK_7252313A2CB102AD');
$this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313A25F06C53'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP FOREIGN KEY FK_7252313A25F06C53');
$this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313AFCF2AA19'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP FOREIGN KEY FK_7252313AFCF2AA19');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D64925F06C53'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'user DROP FOREIGN KEY FK_8D93D64925F06C53');
$this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313AAEB0C1F5'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP FOREIGN KEY FK_7252313AAEB0C1F5');
$this->addSql('ALTER TABLE comptoir_user DROP FOREIGN KEY FK_615689B1AEB0C1F5'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir_user DROP FOREIGN KEY FK_615689B1AEB0C1F5');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD39950A76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'news DROP FOREIGN KEY FK_1DD39950A76ED395');
$this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313AA76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP FOREIGN KEY FK_7252313AA76ED395');
$this->addSql('ALTER TABLE document DROP FOREIGN KEY FK_D8698A76A76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'document DROP FOREIGN KEY FK_D8698A76A76ED395');
$this->addSql('ALTER TABLE import DROP FOREIGN KEY FK_9D4ECE1DA76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'import DROP FOREIGN KEY FK_9D4ECE1DA76ED395');
$this->addSql('ALTER TABLE comptoir_user DROP FOREIGN KEY FK_615689B1A76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir_user DROP FOREIGN KEY FK_615689B1A76ED395');
$this->addSql('ALTER TABLE user_usergroup DROP FOREIGN KEY FK_4A84F5F3A76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'user_usergroup DROP FOREIGN KEY FK_4A84F5F3A76ED395');
$this->addSql('ALTER TABLE lien DROP FOREIGN KEY FK_A532B4B5A76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'lien DROP FOREIGN KEY FK_A532B4B5A76ED395');
$this->addSql('ALTER TABLE prestataire_user DROP FOREIGN KEY FK_6A15943DA76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire_user DROP FOREIGN KEY FK_6A15943DA76ED395');
$this->addSql('ALTER TABLE faq DROP FOREIGN KEY FK_E8FF75CCA76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'faq DROP FOREIGN KEY FK_E8FF75CCA76ED395');
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620A76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'page DROP FOREIGN KEY FK_140AB620A76ED395');
$this->addSql('ALTER TABLE groupe_user DROP FOREIGN KEY FK_257BA9FEA76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupe_user DROP FOREIGN KEY FK_257BA9FEA76ED395');
$this->addSql('ALTER TABLE email_token DROP FOREIGN KEY FK_C27AE0B4A76ED395'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'email_token DROP FOREIGN KEY FK_C27AE0B4A76ED395');
$this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307F10335F61'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'message DROP FOREIGN KEY FK_B6BD307F10335F61');
$this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FA4F84F6E'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'message DROP FOREIGN KEY FK_B6BD307FA4F84F6E');
$this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313ABE3DB2B7'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP FOREIGN KEY FK_7252313ABE3DB2B7');
$this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313AECEF536E'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP FOREIGN KEY FK_7252313AECEF536E');
$this->addSql('ALTER TABLE rubrique_prestataire DROP FOREIGN KEY FK_7D4D41BBBE3DB2B7'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique_prestataire DROP FOREIGN KEY FK_7D4D41BBBE3DB2B7');
$this->addSql('ALTER TABLE prestataire_user DROP FOREIGN KEY FK_6A15943DBE3DB2B7'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire_user DROP FOREIGN KEY FK_6A15943DBE3DB2B7');
$this->addSql('ALTER TABLE groupeprestataire_prestataire DROP FOREIGN KEY FK_66D8DEC9BE3DB2B7'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestataire_prestataire DROP FOREIGN KEY FK_66D8DEC9BE3DB2B7');
$this->addSql('ALTER TABLE adherent DROP FOREIGN KEY FK_90D3F060EF390162'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'adherent DROP FOREIGN KEY FK_90D3F060EF390162');
$this->addSql('ALTER TABLE comptoir DROP FOREIGN KEY FK_A6E2C35EEF390162'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir DROP FOREIGN KEY FK_A6E2C35EEF390162');
$this->addSql('ALTER TABLE prestataire DROP FOREIGN KEY FK_60A26480EF390162'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire DROP FOREIGN KEY FK_60A26480EF390162');
$this->addSql('ALTER TABLE groupeprestaire DROP FOREIGN KEY FK_FB9ABBCEEF390162'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestaire DROP FOREIGN KEY FK_FB9ABBCEEF390162');
$this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313A7A45358C'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP FOREIGN KEY FK_7252313A7A45358C');
$this->addSql('ALTER TABLE adherent DROP FOREIGN KEY FK_90D3F0607A45358C'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'adherent DROP FOREIGN KEY FK_90D3F0607A45358C');
$this->addSql('ALTER TABLE comptoir DROP FOREIGN KEY FK_A6E2C35E7A45358C'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir DROP FOREIGN KEY FK_A6E2C35E7A45358C');
$this->addSql('ALTER TABLE prestataire DROP FOREIGN KEY FK_60A264807A45358C'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire DROP FOREIGN KEY FK_60A264807A45358C');
$this->addSql('ALTER TABLE groupe_user DROP FOREIGN KEY FK_257BA9FE7A45358C'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupe_user DROP FOREIGN KEY FK_257BA9FE7A45358C');
$this->addSql('ALTER TABLE groupeprestaire DROP FOREIGN KEY FK_FB9ABBCE7A45358C'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestaire DROP FOREIGN KEY FK_FB9ABBCE7A45358C');
$this->addSql('ALTER TABLE user_usergroup DROP FOREIGN KEY FK_4A84F5F3FE54D947'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'user_usergroup DROP FOREIGN KEY FK_4A84F5F3FE54D947');
$this->addSql('ALTER TABLE groupeprestataire_prestataire DROP FOREIGN KEY FK_66D8DEC98D18A702'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestataire_prestataire DROP FOREIGN KEY FK_66D8DEC98D18A702');
$this->addSql('ALTER TABLE sonata_menu_item DROP FOREIGN KEY FK_57D4FCFA7D053A93'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'sonata_menu_item DROP FOREIGN KEY FK_57D4FCFA7D053A93');
$this->addSql('ALTER TABLE sonata_menu_item DROP FOREIGN KEY FK_57D4FCFA3D8E604F'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'sonata_menu_item DROP FOREIGN KEY FK_57D4FCFA3D8E604F');
$this->addSql('ALTER TABLE media__gallery_media DROP FOREIGN KEY FK_80D4C5414E7AF8F'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'media__gallery_media DROP FOREIGN KEY FK_80D4C5414E7AF8F');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD39950EA9FDD75'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'news DROP FOREIGN KEY FK_1DD39950EA9FDD75');
$this->addSql('ALTER TABLE document DROP FOREIGN KEY FK_D8698A76EA9FDD75'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'document DROP FOREIGN KEY FK_D8698A76EA9FDD75');
$this->addSql('ALTER TABLE import DROP FOREIGN KEY FK_9D4ECE1DEA9FDD75'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'import DROP FOREIGN KEY FK_9D4ECE1DEA9FDD75');
$this->addSql('ALTER TABLE comptoir DROP FOREIGN KEY FK_A6E2C35EEA9FDD75'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir DROP FOREIGN KEY FK_A6E2C35EEA9FDD75');
$this->addSql('ALTER TABLE prestataire DROP FOREIGN KEY FK_60A26480EA9FDD75'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire DROP FOREIGN KEY FK_60A26480EA9FDD75');
$this->addSql('ALTER TABLE faq DROP FOREIGN KEY FK_E8FF75CCF915CFE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'faq DROP FOREIGN KEY FK_E8FF75CCF915CFE');
$this->addSql('ALTER TABLE faq DROP FOREIGN KEY FK_E8FF75CCEA9FDD75'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'faq DROP FOREIGN KEY FK_E8FF75CCEA9FDD75');
$this->addSql('ALTER TABLE groupeprestaire DROP FOREIGN KEY FK_FB9ABBCEEA9FDD75'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestaire DROP FOREIGN KEY FK_FB9ABBCEEA9FDD75');
$this->addSql('ALTER TABLE media__gallery_media DROP FOREIGN KEY FK_80D4C541EA9FDD75'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'media__gallery_media DROP FOREIGN KEY FK_80D4C541EA9FDD75');
$this->addSql('ALTER TABLE lexik_trans_unit_translations DROP FOREIGN KEY FK_B0AA3944C3C583C9'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'lexik_trans_unit_translations DROP FOREIGN KEY FK_B0AA3944C3C583C9');
$this->addSql('ALTER TABLE lexik_trans_unit_translations DROP FOREIGN KEY FK_B0AA394493CB796C'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'lexik_trans_unit_translations DROP FOREIGN KEY FK_B0AA394493CB796C');
$this->addSql('DROP TABLE news'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'news');
$this->addSql('DROP TABLE flux'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'flux');
$this->addSql('DROP TABLE rubrique'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique');
$this->addSql('DROP TABLE rubrique_prestataire'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique_prestataire');
$this->addSql('DROP TABLE document'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'document');
$this->addSql('DROP TABLE typepresta'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'typepresta');
$this->addSql('DROP TABLE siege'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'siege');
$this->addSql('DROP TABLE cotisationinfos'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'cotisationinfos');
$this->addSql('DROP TABLE import'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'import');
$this->addSql('DROP TABLE adherent'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'adherent');
$this->addSql('DROP TABLE comptoir'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir');
$this->addSql('DROP TABLE comptoir_user'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'comptoir_user');
$this->addSql('DROP TABLE user'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'user');
$this->addSql('DROP TABLE user_usergroup'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'user_usergroup');
$this->addSql('DROP TABLE lien'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'lien');
$this->addSql('DROP TABLE prestataire'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire');
$this->addSql('DROP TABLE prestataire_user'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire_user');
$this->addSql('DROP TABLE geoloc'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'geoloc');
$this->addSql('DROP TABLE faq'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'faq');
$this->addSql('DROP TABLE page'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'page');
$this->addSql('DROP TABLE global_parameter'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'global_parameter');
$this->addSql('DROP TABLE groupe'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'groupe');
$this->addSql('DROP TABLE groupe_user'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'groupe_user');
$this->addSql('DROP TABLE email_token'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'email_token');
$this->addSql('DROP TABLE message'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'message');
$this->addSql('DROP TABLE usergroup'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'usergroup');
$this->addSql('DROP TABLE groupeprestaire'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestaire');
$this->addSql('DROP TABLE groupeprestataire_prestataire'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'groupeprestataire_prestataire');
$this->addSql('DROP TABLE sonata_menu'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'sonata_menu');
$this->addSql('DROP TABLE sonata_menu_item'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'sonata_menu_item');
$this->addSql('DROP TABLE media__gallery_media'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'media__gallery_media');
$this->addSql('DROP TABLE media__gallery'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'media__gallery');
$this->addSql('DROP TABLE media__media'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'media__media');
$this->addSql('DROP TABLE lexik_trans_unit'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'lexik_trans_unit');
$this->addSql('DROP TABLE lexik_translation_file'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'lexik_translation_file');
$this->addSql('DROP TABLE lexik_trans_unit_translations'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'lexik_trans_unit_translations');
} }
} }
...@@ -22,7 +22,7 @@ final class Version20200325154619 extends AbstractMigration ...@@ -22,7 +22,7 @@ final class Version20200325154619 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban VARCHAR(100) DEFAULT NULL'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire CHANGE iban iban VARCHAR(100) DEFAULT NULL');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
...@@ -30,6 +30,6 @@ final class Version20200325154619 extends AbstractMigration ...@@ -30,6 +30,6 @@ final class Version20200325154619 extends AbstractMigration
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban VARCHAR(100) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire CHANGE iban iban VARCHAR(100) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`');
} }
} }
...@@ -22,7 +22,7 @@ final class Version20200402130346 extends AbstractMigration ...@@ -22,7 +22,7 @@ final class Version20200402130346 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE flux ADD role VARCHAR(200) NOT NULL'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD role VARCHAR(200) NOT NULL');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
...@@ -30,6 +30,6 @@ final class Version20200402130346 extends AbstractMigration ...@@ -30,6 +30,6 @@ final class Version20200402130346 extends AbstractMigration
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE flux DROP role'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP role');
} }
} }
...@@ -22,7 +22,7 @@ final class Version20200402132651 extends AbstractMigration ...@@ -22,7 +22,7 @@ final class Version20200402132651 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE flux ADD hash LONGTEXT NOT NULL'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD hash LONGTEXT NOT NULL');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
...@@ -30,6 +30,6 @@ final class Version20200402132651 extends AbstractMigration ...@@ -30,6 +30,6 @@ final class Version20200402132651 extends AbstractMigration
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE flux DROP hash'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP hash');
} }
} }
...@@ -22,10 +22,10 @@ final class Version20200403104008 extends AbstractMigration ...@@ -22,10 +22,10 @@ final class Version20200403104008 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE etat_prestataire (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_DD6CC57989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'etat_prestataire (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_DD6CC57989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE etats_prestataires (etat_prestataire_id INT NOT NULL, prestataire_id INT NOT NULL, INDEX IDX_5D68706574D12AB (etat_prestataire_id), INDEX IDX_5D687065BE3DB2B7 (prestataire_id), PRIMARY KEY(etat_prestataire_id, prestataire_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'etats_prestataires (etat_prestataire_id INT NOT NULL, prestataire_id INT NOT NULL, INDEX IDX_5D68706574D12AB (etat_prestataire_id), INDEX IDX_5D687065BE3DB2B7 (prestataire_id), PRIMARY KEY(etat_prestataire_id, prestataire_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE etats_prestataires ADD CONSTRAINT FK_5D68706574D12AB FOREIGN KEY (etat_prestataire_id) REFERENCES etat_prestataire (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'etats_prestataires ADD CONSTRAINT FK_5D68706574D12AB FOREIGN KEY (etat_prestataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'etat_prestataire (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE etats_prestataires ADD CONSTRAINT FK_5D687065BE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'etats_prestataires ADD CONSTRAINT FK_5D687065BE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'prestataire (id) ON DELETE CASCADE');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
...@@ -33,8 +33,8 @@ final class Version20200403104008 extends AbstractMigration ...@@ -33,8 +33,8 @@ final class Version20200403104008 extends AbstractMigration
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE etats_prestataires DROP FOREIGN KEY FK_5D68706574D12AB'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'etats_prestataires DROP FOREIGN KEY FK_5D68706574D12AB');
$this->addSql('DROP TABLE etat_prestataire'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'etat_prestataire');
$this->addSql('DROP TABLE etats_prestataires'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'etats_prestataires');
} }
} }
...@@ -22,12 +22,12 @@ final class Version20200406151406 extends AbstractMigration ...@@ -22,12 +22,12 @@ final class Version20200406151406 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE geoloc_prestataire (id INT AUTO_INCREMENT NOT NULL, prestataire_id INT NOT NULL, geoloc_id INT DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_7A6F2D1F989D9B62 (slug), INDEX IDX_7A6F2D1FBE3DB2B7 (prestataire_id), UNIQUE INDEX UNIQ_7A6F2D1FEF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'geoloc_prestataire (id INT AUTO_INCREMENT NOT NULL, prestataire_id INT NOT NULL, geoloc_id INT DEFAULT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_7A6F2D1F989D9B62 (slug), INDEX IDX_7A6F2D1FBE3DB2B7 (prestataire_id), UNIQUE INDEX UNIQ_7A6F2D1FEF390162 (geoloc_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE geoloc_prestataire ADD CONSTRAINT FK_7A6F2D1FBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'geoloc_prestataire ADD CONSTRAINT FK_7A6F2D1FBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'prestataire (id)');
$this->addSql('ALTER TABLE geoloc_prestataire ADD CONSTRAINT FK_7A6F2D1FEF390162 FOREIGN KEY (geoloc_id) REFERENCES geoloc (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'geoloc_prestataire ADD CONSTRAINT FK_7A6F2D1FEF390162 FOREIGN KEY (geoloc_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'geoloc (id)');
$this->addSql('ALTER TABLE prestataire DROP FOREIGN KEY FK_60A26480EF390162'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire DROP FOREIGN KEY FK_60A26480EF390162');
$this->addSql('DROP INDEX UNIQ_60A26480EF390162 ON prestataire'); $this->addSql('DROP INDEX UNIQ_60A26480EF390162 ON '.$_ENV['DATABASE_PREFIX'].'prestataire');
$this->addSql('ALTER TABLE prestataire DROP geoloc_id'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire DROP geoloc_id');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
...@@ -35,9 +35,9 @@ final class Version20200406151406 extends AbstractMigration ...@@ -35,9 +35,9 @@ final class Version20200406151406 extends AbstractMigration
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE geoloc_prestataire'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'geoloc_prestataire');
$this->addSql('ALTER TABLE prestataire ADD geoloc_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire ADD geoloc_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE prestataire ADD CONSTRAINT FK_60A26480EF390162 FOREIGN KEY (geoloc_id) REFERENCES geoloc (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire ADD CONSTRAINT FK_60A26480EF390162 FOREIGN KEY (geoloc_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'geoloc (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_60A26480EF390162 ON prestataire (geoloc_id)'); $this->addSql('CREATE UNIQUE INDEX UNIQ_60A26480EF390162 ON '.$_ENV['DATABASE_PREFIX'].'prestataire (geoloc_id)');
} }
} }
...@@ -22,8 +22,8 @@ final class Version20200406170822 extends AbstractMigration ...@@ -22,8 +22,8 @@ final class Version20200406170822 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE contact_prestataire (id INT AUTO_INCREMENT NOT NULL, prestataire_id INT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_E0EDB3E989D9B62 (slug), INDEX IDX_E0EDB3EBE3DB2B7 (prestataire_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'contact_prestataire (id INT AUTO_INCREMENT NOT NULL, prestataire_id INT NOT NULL, name VARCHAR(150) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_E0EDB3E989D9B62 (slug), INDEX IDX_E0EDB3EBE3DB2B7 (prestataire_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE contact_prestataire ADD CONSTRAINT FK_E0EDB3EBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'contact_prestataire ADD CONSTRAINT FK_E0EDB3EBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'prestataire (id)');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
...@@ -31,6 +31,6 @@ final class Version20200406170822 extends AbstractMigration ...@@ -31,6 +31,6 @@ final class Version20200406170822 extends AbstractMigration
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE contact_prestataire'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'contact_prestataire');
} }
} }
...@@ -22,9 +22,9 @@ final class Version20200408160435 extends AbstractMigration ...@@ -22,9 +22,9 @@ final class Version20200408160435 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE rubrique ADD media_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique ADD media_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE rubrique ADD CONSTRAINT FK_8FA4097CEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique ADD CONSTRAINT FK_8FA4097CEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
$this->addSql('CREATE INDEX IDX_8FA4097CEA9FDD75 ON rubrique (media_id)'); $this->addSql('CREATE INDEX IDX_8FA4097CEA9FDD75 ON '.$_ENV['DATABASE_PREFIX'].'rubrique (media_id)');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
...@@ -32,8 +32,8 @@ final class Version20200408160435 extends AbstractMigration ...@@ -32,8 +32,8 @@ final class Version20200408160435 extends AbstractMigration
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE rubrique DROP FOREIGN KEY FK_8FA4097CEA9FDD75'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique DROP FOREIGN KEY FK_8FA4097CEA9FDD75');
$this->addSql('DROP INDEX IDX_8FA4097CEA9FDD75 ON rubrique'); $this->addSql('DROP INDEX IDX_8FA4097CEA9FDD75 ON '.$_ENV['DATABASE_PREFIX'].'rubrique');
$this->addSql('ALTER TABLE rubrique DROP media_id'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'rubrique DROP media_id');
} }
} }
...@@ -22,19 +22,19 @@ final class Version20200421145001 extends AbstractMigration ...@@ -22,19 +22,19 @@ final class Version20200421145001 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE classification__collection (id INT AUTO_INCREMENT NOT NULL, context VARCHAR(255) DEFAULT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A406B56AE25D857E (context), INDEX IDX_A406B56AEA9FDD75 (media_id), UNIQUE INDEX tag_collection (slug, context), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'classification__collection (id INT AUTO_INCREMENT NOT NULL, context VARCHAR(255) DEFAULT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A406B56AE25D857E (context), INDEX IDX_A406B56AEA9FDD75 (media_id), UNIQUE INDEX tag_collection (slug, context), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE classification__category (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, context VARCHAR(255) DEFAULT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, position INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_43629B36727ACA70 (parent_id), INDEX IDX_43629B36E25D857E (context), INDEX IDX_43629B36EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'classification__category (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, context VARCHAR(255) DEFAULT NULL, media_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, position INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_43629B36727ACA70 (parent_id), INDEX IDX_43629B36E25D857E (context), INDEX IDX_43629B36EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE classification__tag (id INT AUTO_INCREMENT NOT NULL, context VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_CA57A1C7E25D857E (context), UNIQUE INDEX tag_context (slug, context), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'classification__tag (id INT AUTO_INCREMENT NOT NULL, context VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_CA57A1C7E25D857E (context), UNIQUE INDEX tag_context (slug, context), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE classification__context (id VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'classification__context (id VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE classification__collection ADD CONSTRAINT FK_A406B56AE25D857E FOREIGN KEY (context) REFERENCES classification__context (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'classification__collection ADD CONSTRAINT FK_A406B56AE25D857E FOREIGN KEY (context) REFERENCES '.$_ENV['DATABASE_PREFIX'].'classification__context (id)');
$this->addSql('ALTER TABLE classification__collection ADD CONSTRAINT FK_A406B56AEA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE SET NULL'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'classification__collection ADD CONSTRAINT FK_A406B56AEA9FDD75 FOREIGN KEY (media_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36727ACA70 FOREIGN KEY (parent_id) REFERENCES classification__category (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'classification__category ADD CONSTRAINT FK_43629B36727ACA70 FOREIGN KEY (parent_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'classification__category (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36E25D857E FOREIGN KEY (context) REFERENCES classification__context (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'classification__category ADD CONSTRAINT FK_43629B36E25D857E FOREIGN KEY (context) REFERENCES '.$_ENV['DATABASE_PREFIX'].'classification__context (id)');
$this->addSql('ALTER TABLE classification__category ADD CONSTRAINT FK_43629B36EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id) ON DELETE SET NULL'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'classification__category ADD CONSTRAINT FK_43629B36EA9FDD75 FOREIGN KEY (media_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'media__media (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE classification__tag ADD CONSTRAINT FK_CA57A1C7E25D857E FOREIGN KEY (context) REFERENCES classification__context (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'classification__tag ADD CONSTRAINT FK_CA57A1C7E25D857E FOREIGN KEY (context) REFERENCES '.$_ENV['DATABASE_PREFIX'].'classification__context (id)');
$this->addSql('ALTER TABLE media__media ADD category_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'media__media ADD category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE media__media ADD CONSTRAINT FK_5C6DD74E12469DE2 FOREIGN KEY (category_id) REFERENCES classification__category (id) ON DELETE SET NULL'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'media__media ADD CONSTRAINT FK_5C6DD74E12469DE2 FOREIGN KEY (category_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'classification__category (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_5C6DD74E12469DE2 ON media__media (category_id)'); $this->addSql('CREATE INDEX IDX_5C6DD74E12469DE2 ON '.$_ENV['DATABASE_PREFIX'].'media__media (category_id)');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
...@@ -42,16 +42,16 @@ final class Version20200421145001 extends AbstractMigration ...@@ -42,16 +42,16 @@ final class Version20200421145001 extends AbstractMigration
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE classification__category DROP FOREIGN KEY FK_43629B36727ACA70'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'classification__category DROP FOREIGN KEY FK_43629B36727ACA70');
$this->addSql('ALTER TABLE media__media DROP FOREIGN KEY FK_5C6DD74E12469DE2'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'media__media DROP FOREIGN KEY FK_5C6DD74E12469DE2');
$this->addSql('ALTER TABLE classification__collection DROP FOREIGN KEY FK_A406B56AE25D857E'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'classification__collection DROP FOREIGN KEY FK_A406B56AE25D857E');
$this->addSql('ALTER TABLE classification__category DROP FOREIGN KEY FK_43629B36E25D857E'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'classification__category DROP FOREIGN KEY FK_43629B36E25D857E');
$this->addSql('ALTER TABLE classification__tag DROP FOREIGN KEY FK_CA57A1C7E25D857E'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'classification__tag DROP FOREIGN KEY FK_CA57A1C7E25D857E');
$this->addSql('DROP TABLE classification__collection'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'classification__collection');
$this->addSql('DROP TABLE classification__category'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'classification__category');
$this->addSql('DROP TABLE classification__tag'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'classification__tag');
$this->addSql('DROP TABLE classification__context'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'classification__context');
$this->addSql('DROP INDEX IDX_5C6DD74E12469DE2 ON media__media'); $this->addSql('DROP INDEX IDX_5C6DD74E12469DE2 ON '.$_ENV['DATABASE_PREFIX'].'media__media');
$this->addSql('ALTER TABLE media__media DROP category_id'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'media__media DROP category_id');
} }
} }
...@@ -22,7 +22,7 @@ final class Version20200422111240 extends AbstractMigration ...@@ -22,7 +22,7 @@ final class Version20200422111240 extends AbstractMigration
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE lien'); $this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'lien');
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void
...@@ -30,7 +30,7 @@ final class Version20200422111240 extends AbstractMigration ...@@ -30,7 +30,7 @@ final class Version20200422111240 extends AbstractMigration
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE lien (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, url VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, name VARCHAR(150) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, slug VARCHAR(150) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, content LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci`, UNIQUE INDEX UNIQ_A532B4B5989D9B62 (slug), INDEX IDX_A532B4B5A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); $this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'lien (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, url VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, enabled TINYINT(1) NOT NULL, name VARCHAR(150) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, slug VARCHAR(150) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, content LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci`, UNIQUE INDEX UNIQ_A532B4B5989D9B62 (slug), INDEX IDX_A532B4B5A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE lien ADD CONSTRAINT FK_A532B4B5A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'lien ADD CONSTRAINT FK_A532B4B5A76ED395 FOREIGN KEY (user_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
} }
} }
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200428113803 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'contact_prestataire ADD tel VARCHAR(20) DEFAULT NULL, ADD email VARCHAR(100) DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'contact_prestataire DROP tel, DROP email');
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200428133534 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE '.$_ENV['DATABASE_PREFIX'].'message');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE '.$_ENV['DATABASE_PREFIX'].'message (id INT AUTO_INCREMENT NOT NULL, expediteur_id INT DEFAULT NULL, destinataire_id INT DEFAULT NULL, name VARCHAR(150) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, slug VARCHAR(150) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, content LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci`, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_B6BD307FA4F84F6E (destinataire_id), UNIQUE INDEX UNIQ_B6BD307F989D9B62 (slug), INDEX IDX_B6BD307F10335F61 (expediteur_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'message ADD CONSTRAINT FK_B6BD307F10335F61 FOREIGN KEY (expediteur_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
$this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'message ADD CONSTRAINT FK_B6BD307FA4F84F6E FOREIGN KEY (destinataire_id) REFERENCES '.$_ENV['DATABASE_PREFIX'].'user (id)');
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200505124505 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux ADD tauxreconversion NUMERIC(7, 2) DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'flux DROP tauxreconversion');
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200520130916 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire ADD tauxreconversion NUMERIC(7, 2) DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE '.$_ENV['DATABASE_PREFIX'].'prestataire DROP tauxreconversion');
}
}
...@@ -4,7 +4,7 @@ namespace App\Repository; ...@@ -4,7 +4,7 @@ namespace App\Repository;
use App\Entity\Adherent; use App\Entity\Adherent;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface; use Doctrine\Common\Persistence\ManagerRegistry;
/** /**
* @method Adherent|null find($id, $lockMode = null, $lockVersion = null) * @method Adherent|null find($id, $lockMode = null, $lockVersion = null)
...@@ -14,7 +14,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface; ...@@ -14,7 +14,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface;
*/ */
class AdherentRepository extends ServiceEntityRepository class AdherentRepository extends ServiceEntityRepository
{ {
public function __construct(RegistryInterface $registry) public function __construct(ManagerRegistry $registry)
{ {
parent::__construct($registry, Adherent::class); parent::__construct($registry, Adherent::class);
} }
......
<?php
namespace App\Repository;
use App\Entity\Comptoir;
use App\Entity\Rubrique;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
/**
* @method Comptoir|null find($id, $lockMode = null, $lockVersion = null)
* @method Comptoir|null findOneBy(array $criteria, array $orderBy = null)
* @method Comptoir[] findAll()
* @method Comptoir[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ComptoirRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Comptoir::class);
}
/**
* @return Comptoir[] Returns an array of Comptoir objects
*/
public function findByGeoloc($lat, $lon, $distance)
{
$sqlDistance = '(6373000 * acos(cos(radians(' . $lat . ')) * cos(radians(g.lat)) * cos(radians(g.lon) - radians(' . $lon . ')) + sin(radians(' . $lat . ')) * sin(radians(g.lat))))';
$qb = $this->createQueryBuilder('p');
return $qb
->leftJoin('p.geoloc', 'g')
->andWhere('p.enabled = :enabled')
->setParameter('enabled', true)
->andWhere("" . $sqlDistance . " < :distance")
->setParameter('distance', $distance)
->orderBy('p.name', 'ASC')
->getQuery()
->getResult()
;
}
}
...@@ -8,7 +8,7 @@ use App\Entity\Flux; ...@@ -8,7 +8,7 @@ use App\Entity\Flux;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface; use Doctrine\Common\Persistence\ManagerRegistry;
/** /**
* @method Flux|null find($id, $lockMode = null, $lockVersion = null) * @method Flux|null find($id, $lockMode = null, $lockVersion = null)
...@@ -18,7 +18,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface; ...@@ -18,7 +18,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface;
*/ */
class FluxRepository extends ServiceEntityRepository class FluxRepository extends ServiceEntityRepository
{ {
public function __construct(RegistryInterface $registry) public function __construct(ManagerRegistry $registry)
{ {
parent::__construct($registry, Flux::class); parent::__construct($registry, Flux::class);
$em = $this->getEntityManager(); $em = $this->getEntityManager();
......
<?php
namespace App\Repository;
use App\Entity\Groupeprestataire;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
/**
* @method Groupeprestataire|null find($id, $lockMode = null, $lockVersion = null)
* @method Groupeprestataire|null findOneBy(array $criteria, array $orderBy = null)
* @method Groupeprestataire[] findAll()
* @method Groupeprestataire[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class GroupeprestataireRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Groupeprestataire::class);
}
/**
* @return Groupeprestataire[] Returns an array of Groupeprestataire objects
*/
public function findByGeoloc($lat, $lon, $distance)
{
$sqlDistance = '(6373000 * acos(cos(radians(' . $lat . ')) * cos(radians(g.lat)) * cos(radians(g.lon) - radians(' . $lon . ')) + sin(radians(' . $lat . ')) * sin(radians(g.lat))))';
$qb = $this->createQueryBuilder('p');
return $qb
->leftJoin('p.geoloc', 'g')
->andWhere('p.enabled = :enabled')
->setParameter('enabled', true)
->andWhere("" . $sqlDistance . " < :distance")
->setParameter('distance', $distance)
->orderBy('p.name', 'ASC')
->getQuery()
->getResult()
;
}
}
...@@ -4,7 +4,7 @@ namespace App\Repository; ...@@ -4,7 +4,7 @@ namespace App\Repository;
use App\Entity\Import; use App\Entity\Import;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface; use Doctrine\Common\Persistence\ManagerRegistry;
/** /**
* @method Import|null find($id, $lockMode = null, $lockVersion = null) * @method Import|null find($id, $lockMode = null, $lockVersion = null)
...@@ -14,7 +14,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface; ...@@ -14,7 +14,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface;
*/ */
class ImportRepository extends ServiceEntityRepository class ImportRepository extends ServiceEntityRepository
{ {
public function __construct(RegistryInterface $registry) public function __construct(ManagerRegistry $registry)
{ {
parent::__construct($registry, Import::class); parent::__construct($registry, Import::class);
} }
......
...@@ -4,7 +4,7 @@ namespace App\Repository; ...@@ -4,7 +4,7 @@ namespace App\Repository;
use App\Entity\News; use App\Entity\News;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface; use Doctrine\Common\Persistence\ManagerRegistry;
/** /**
* @method News|null find($id, $lockMode = null, $lockVersion = null) * @method News|null find($id, $lockMode = null, $lockVersion = null)
...@@ -14,7 +14,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface; ...@@ -14,7 +14,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface;
*/ */
class NewsRepository extends ServiceEntityRepository class NewsRepository extends ServiceEntityRepository
{ {
public function __construct(RegistryInterface $registry) public function __construct(ManagerRegistry $registry)
{ {
parent::__construct($registry, News::class); parent::__construct($registry, News::class);
} }
......
...@@ -7,7 +7,7 @@ use App\Entity\Groupeprestataire; ...@@ -7,7 +7,7 @@ use App\Entity\Groupeprestataire;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Rubrique; use App\Entity\Rubrique;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface; use Doctrine\Common\Persistence\ManagerRegistry;
/** /**
* @method Prestataire|null find($id, $lockMode = null, $lockVersion = null) * @method Prestataire|null find($id, $lockMode = null, $lockVersion = null)
...@@ -17,12 +17,38 @@ use Symfony\Bridge\Doctrine\RegistryInterface; ...@@ -17,12 +17,38 @@ use Symfony\Bridge\Doctrine\RegistryInterface;
*/ */
class PrestataireRepository extends ServiceEntityRepository class PrestataireRepository extends ServiceEntityRepository
{ {
public function __construct(RegistryInterface $registry) public function __construct(ManagerRegistry $registry)
{ {
parent::__construct($registry, Prestataire::class); parent::__construct($registry, Prestataire::class);
} }
/** /**
* Find prestataire from geoloc lat/lon and distance in meters
* @return Prestataire[] Returns an array of Prestataire objects
*/
public function findByGeoloc($lat, $lon, $distance)
{
// @TODO : optimize geoloc (better SQL search, bundles ???)
// https://numa-bord.com/miniblog/doctrine-recherche-table-contenant-latitudes-longitudes-celle-situes-a-de-xx-km/
// https://stackoverflow.com/questions/24370975/find-distance-between-two-points-using-latitude-and-longitude-in-mysql
$sqlDistance = '(6373000 * acos(cos(radians(' . $lat . ')) * cos(radians(g.lat)) * cos(radians(g.lon) - radians(' . $lon . ')) + sin(radians(' . $lat . ')) * sin(radians(g.lat))))';
$qb = $this->createQueryBuilder('p');
return $qb
->leftJoin('p.geolocs', 'gs')
->leftJoin('gs.geoloc', 'g')
->andWhere('p.enabled = :enabled')
->setParameter('enabled', true)
->andWhere('p.mlc = :mlc')
->setParameter('mlc', false)
->andWhere("" . $sqlDistance . " < :distance")
->setParameter('distance', $distance)
->orderBy('p.raison', 'ASC')
->getQuery()
->getResult()
;
}
/**
* @return Prestataire[] Returns an array of Prestataire objects * @return Prestataire[] Returns an array of Prestataire objects
*/ */
public function findByRubrique(Rubrique $rubrique) public function findByRubrique(Rubrique $rubrique)
......
...@@ -4,7 +4,7 @@ namespace App\Repository; ...@@ -4,7 +4,7 @@ namespace App\Repository;
use App\Entity\User; use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface; use Doctrine\Common\Persistence\ManagerRegistry;
/** /**
* @method User|null find($id, $lockMode = null, $lockVersion = null) * @method User|null find($id, $lockMode = null, $lockVersion = null)
...@@ -14,7 +14,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface; ...@@ -14,7 +14,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface;
*/ */
class UserRepository extends ServiceEntityRepository class UserRepository extends ServiceEntityRepository
{ {
public function __construct(RegistryInterface $registry) public function __construct(ManagerRegistry $registry)
{ {
parent::__construct($registry, User::class); parent::__construct($registry, User::class);
} }
......
...@@ -2,78 +2,95 @@ ...@@ -2,78 +2,95 @@
namespace App\Security; namespace App\Security;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface; use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
class ApiKeyAuthenticator implements SimplePreAuthenticatorInterface class ApiKeyAuthenticator extends AbstractGuardAuthenticator
{ {
public function createToken(Request $request, $providerKey) private $em;
public function __construct(EntityManagerInterface $em)
{ {
// look for an apikey query parameter $this->em = $em;
$apiKey = $request->query->get('apikey'); }
if (!$apiKey) { /**
$apiKey = $request->get('apiKey'); * Called on every request to decide if this authenticator should be
* used for the request. Returning false will cause this authenticator
* to be skipped.
*/
public function supports(Request $request)
{
return $request->headers->has('API-AUTH-TOKEN');
} }
// or if you want to use an "apikey" header, then do something like this: /**
if (!$apiKey) { * Called on every request. Return whatever credentials you want to
$apiKey = $request->headers->get('apikey'); * be passed to getUser() as $credentials.
*/
public function getCredentials(Request $request)
{
return $request->headers->get('API-AUTH-TOKEN');
} }
if (!$apiKey) { public function getUser($credentials, UserProviderInterface $userProvider)
throw new BadCredentialsException('No API key found'); {
// or to just skip api key authentication $user = $this->em->getRepository(User::class)
//return null; ->findOneByApiKey($credentials);
return $user;
} }
return new PreAuthenticatedToken( public function checkCredentials($credentials, UserInterface $user)
'anon.', {
$apiKey, $user = $this->em->getRepository(User::class)
$providerKey ->findOneByApiKey($credentials);
);
return $user != null;
} }
public function authenticateToken(TokenInterface $token, UserProviderInterface $userProvider, $providerKey) public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
{ {
if (!$userProvider instanceof ApiKeyUserProvider) { return null;
throw new \InvalidArgumentException(
sprintf(
'The user provider must be an instance of ApiKeyUserProvider (%s was given).',
get_class($userProvider)
)
);
} }
$apiKey = $token->getCredentials(); public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
$username = $userProvider->getUsernameForApiKey($apiKey); {
$data = [
// you may want to customize or obfuscate the message first
'message' => strtr($exception->getMessageKey(), $exception->getMessageData())
if (!$username) { // or to translate this message
// CAUTION: this message will be returned to the client // $this->translator->trans($exception->getMessageKey(), $exception->getMessageData())
// (so don't put any un-trusted messages / error strings here) ];
throw new \Exception(
sprintf('API Key "%s" does not exist.', $apiKey) return new JsonResponse($data, Response::HTTP_UNAUTHORIZED);
);
} }
$user = $userProvider->loadUserByUsername($username); /**
* Called when authentication is needed, but it's not sent
*/
public function start(Request $request, AuthenticationException $authException = null)
{
$data = [
// you might translate this message
'message' => 'Authentication Required'
];
return new PreAuthenticatedToken( return new JsonResponse($data, Response::HTTP_UNAUTHORIZED);
$user,
$apiKey,
$providerKey,
$user->getRoles()
);
} }
public function supportsToken(TokenInterface $token, $providerKey) public function supportsRememberMe()
{ {
return $token instanceof PreAuthenticatedToken && $token->getProviderKey() === $providerKey; return false;
} }
} }
...@@ -2,22 +2,22 @@ ...@@ -2,22 +2,22 @@
namespace App\Security; namespace App\Security;
use Doctrine\Common\Persistence\ObjectManager; use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException; use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\User;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Core\User\UserProviderInterface;
class ApiKeyUserProvider implements UserProviderInterface class ApiKeyUserProvider implements UserProviderInterface
{ {
public function __construct(ObjectManager $manager) public function __construct(EntityManagerInterface $manager)
{ {
$this->manager = $manager; $this->manager = $manager;
} }
public function getUsernameForApiKey($apiKey) public function getUsernameForApiKey($apiKey)
{ {
$user = $this->manager->getRepository('App\Entity\User') $user = $this->manager->getRepository(User::class)
->findOneByApiKey($apiKey); ->findOneByApiKey($apiKey);
if (!$user) { if (!$user) {
...@@ -29,7 +29,7 @@ class ApiKeyUserProvider implements UserProviderInterface ...@@ -29,7 +29,7 @@ class ApiKeyUserProvider implements UserProviderInterface
public function loadUserByUsername($username) public function loadUserByUsername($username)
{ {
return $this->manager->getRepository('App\Entity\User') return $this->manager->getRepository(User::class)
->findOneByUsername($username); ->findOneByUsername($username);
} }
...@@ -44,6 +44,6 @@ class ApiKeyUserProvider implements UserProviderInterface ...@@ -44,6 +44,6 @@ class ApiKeyUserProvider implements UserProviderInterface
public function supportsClass($class) public function supportsClass($class)
{ {
return 'Symfony\Component\Security\Core\User\User' === $class; return User::class === $class;
} }
} }
...@@ -2,21 +2,23 @@ ...@@ -2,21 +2,23 @@
namespace App\Security\Handler; namespace App\Security\Handler;
use App\Entity\GlobalParameter;
use App\Tools\RoleCheck;
use Doctrine\ORM\EntityManagerInterface;
use Sonata\AdminBundle\Admin\AdminInterface; use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Security\Handler\RoleSecurityHandler; use Sonata\AdminBundle\Security\Handler\RoleSecurityHandler;
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException; use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
class VoterSecurityHandler extends RoleSecurityHandler class VoterSecurityHandler extends RoleSecurityHandler
{ {
protected $manager;
protected $rolecheck;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function isGranted(AdminInterface $admin, $attributes, $object = null) public function isGranted(AdminInterface $admin, $attributes, $object = null)
{ {
// dump($admin);
// dump($attributes);
// dump($object);
if (!\is_array($attributes)) { if (!\is_array($attributes)) {
$attributes = [$attributes]; $attributes = [$attributes];
} }
...@@ -26,14 +28,47 @@ class VoterSecurityHandler extends RoleSecurityHandler ...@@ -26,14 +28,47 @@ class VoterSecurityHandler extends RoleSecurityHandler
} }
$allRole = sprintf($this->getBaseRole($admin), 'ALL'); $allRole = sprintf($this->getBaseRole($admin), 'ALL');
// dump($attributes);
// exit(); $isWordpress = $this->manager->getRepository(GlobalParameter::class)->val(GlobalParameter::USE_WORDPRESS) != 'false';
if ($isWordpress) {
foreach ($attributes as $attribute) {
if (strpos($attribute, 'ROLE_ADMIN_FAQ') !== false
|| strpos($attribute, 'ROLE_ADMIN_PAGE') !== false
|| strpos($attribute, 'ROLE_ADMIN_DOCUMENT') !== false
|| strpos($attribute, 'ROLE_PRODIGIOUS_SONATA_MENU') !== false
|| strpos($attribute, 'ROLE_ADMIN_NEWS') !== false) {
return false;
}
}
}
try { try {
return $this->authorizationChecker->isGranted($this->superAdminRoles) return $this->isAnyGranted($this->superAdminRoles)
|| $this->authorizationChecker->isGranted($attributes, $object) || $this->isAnyGranted($attributes, $object)
|| $this->authorizationChecker->isGranted([$allRole], $object); || $this->isAnyGranted([$allRole], $object);
} catch (AuthenticationCredentialsNotFoundException $e) { } catch (AuthenticationCredentialsNotFoundException $e) {
return false; return false;
} }
} }
public function setManager(EntityManagerInterface $manager)
{
$this->manager = $manager;
}
public function setRolecheck(RoleCheck $rolecheck)
{
$this->rolecheck = $rolecheck;
}
private function isAnyGranted(array $attributes, $subject = null): bool
{
// $user = $this->tokenStorageInterface->getToken()->getUser();
foreach ($attributes as $attribute) {
if ($this->authorizationChecker->isGranted($attribute, $subject)) {
return true;
}
}
return false;
}
} }
<?php
namespace App\Security\Voter;
use App\Entity\User;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
abstract class AbstractVoter extends Voter
{
const LIST = 'list'; // view the list of objects
const VIEW = 'view'; // view the detail of one object
const CREATE = 'create'; // create a new object
const EDIT = 'edit'; // update an existing object
const DELETE = 'delete'; // delete an existing object
const EXPORT = 'export'; // (for the native Sonata export links)
const ALL = 'all'; // grants LIST, VIEW, CREATE, EDIT, DELETE and EXPORT
private $decisionManager;
public function __construct(AccessDecisionManagerInterface $decisionManager)
{
$this->decisionManager = $decisionManager;
}
protected static function supportsAttribute($attribute)
{
// Est-ce que l'action demandée existe
if (!in_array($attribute, array(self::LIST, self::VIEW, self::CREATE, self::EDIT, self::DELETE, self::EXPORT, self::ALL))) {
return false;
}
return true;
}
abstract protected function voteOnAttribute($attribute, $subject, TokenInterface $token);
}
<?php
namespace App\Security\Voter;
use App\Entity\User;
use App\Security\Voter\AbstractVoter;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
class UserVoter extends AbstractVoter
{
protected function supports($attribute, $subject)
{
// Est-ce que l'action demandée existe
if (!parent::supportsAttribute($attribute)) {
return false;
}
// On ne vote que pour des objets de type User
if (!$subject instanceof User) {
return false;
}
return true;
}
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
{
$user = $token->getUser();
if (!$user instanceof User) {
// L'utilisateur doit être loggué
return false;
}
// Les admins peuvent tout faire !
if ($this->decisionManager->decide($token, array('ROLE_SUPER_ADMIN', 'ROLE_ADMIN', 'ROLE_ADMIN_SIEGE'))) {
return true;
}
switch ($attribute) {
case 'add_tr_sie_grp':
return true;
case self::LIST:
return $this->canList($subject, $user);
case self::VIEW:
return $this->canView($subject, $user);
case self::CREATE:
return $this->canCreate($subject, $user);
case self::EDIT:
return $this->canEdit($subject, $user);
case self::DELETE:
return $this->canDelete($subject, $user);
case self::EXPORT:
return $this->canExport($subject, $user);
case self::ALL:
return $this->canAll($subject, $user);
}
throw new \LogicException('This code should not be reached!');
}
private function canList(User $subject, User $user)
{
// Only ADMIN can list users so already return true before
return false;
}
private function canView(User $subject, User $user)
{
// if ($this->decisionManager->decide($token, array('ROLE_ADHERENT'))) {
}
private function canCreate(User $subject, User $user)
{
}
private function canEdit(User $subject, User $user)
{
}
private function canDelete(User $subject, User $user)
{
}
private function canExport(User $subject, User $user)
{
}
private function canAll(User $subject, User $user)
{
}
}
<?php
// src/Swagger/SwaggerDecorator.php
namespace App\Swagger;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
final class SwaggerDecorator implements NormalizerInterface
{
private $decorated;
public function __construct(NormalizerInterface $decorated)
{
$this->decorated = $decorated;
}
public function normalize($object, $format = null, array $context = [])
{
$docs = $this->decorated->normalize($object, $format, $context);
// If a prefix is configured on API Platform's routes, it must appear here.
unset($docs['paths']['/api/maps']);
unset($docs['paths']['/api/maps/{id}']);
return $docs;
}
public function supportsNormalization($data, $format = null)
{
return $this->decorated->supportsNormalization($data, $format);
}
}
...@@ -4,6 +4,7 @@ namespace App\Tools; ...@@ -4,6 +4,7 @@ namespace App\Tools;
use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Core\Role\Role;
class RoleCheck class RoleCheck
{ {
...@@ -26,7 +27,7 @@ class RoleCheck ...@@ -26,7 +27,7 @@ class RoleCheck
{ {
if ($this->session->has('_groupId')) { if ($this->session->has('_groupId')) {
$group = $this->session->get('_groupId'); $group = $this->session->get('_groupId');
return in_array($role, $group->getRoles()); return (in_array($role, $group->getRoles()) && ($this->security->getUser() && $this->security->getUser()->isGranted($role)));
} else { } else {
return ($this->security->getUser() && $this->security->getUser()->isGranted($role)); return ($this->security->getUser() && $this->security->getUser()->isGranted($role));
} }
...@@ -41,7 +42,18 @@ class RoleCheck ...@@ -41,7 +42,18 @@ class RoleCheck
return $this->security->getUser()->getRoles()[0]; return $this->security->getUser()->getRoles()[0];
} elseif (count($this->security->getUser()->getRoles()) <= 0) { } elseif (count($this->security->getUser()->getRoles()) <= 0) {
throw new \Exception('Utilisateur sans rôle => Impossible de faire une transaction ! '); throw new \Exception('Utilisateur sans rôle => Impossible de faire une transaction ! ');
} elseif (count($this->security->getUser()->getGroups()) == 1) {
return $this->security->getUser()->getGroups()[0];
} else { } else {
// $roles = $this->security->getUser()->getRoles();
// if (in_array('ROLE_USER', $roles)) {
// unset($roles[array_search('ROLE_USER', $roles)]);
// }
// if (count($this->security->getUser()->getRoles()) == 1) {
// return $this->security->getUser()->getRoles()[0];
// } else {
// return new Role('ROLE_USER');
// }
throw new \Exception('Utilisateur avec plusieurs rôles devant choisir le rôle avant de faire une transaction ! '); throw new \Exception('Utilisateur avec plusieurs rôles devant choisir le rôle avant de faire une transaction ! ');
} }
} }
......
...@@ -27,14 +27,16 @@ use Twig\TwigTest; ...@@ -27,14 +27,16 @@ use Twig\TwigTest;
class AppExtension extends AbstractExtension class AppExtension extends AbstractExtension
{ {
public $em; public $em;
public $security;
public $container; public $container;
public $paginator; public $paginator;
public $session; public $session;
public $rolecheck; public $rolecheck;
public function __construct(ContainerInterface $container, EntityManagerInterface $em, PaginatorInterface $paginator, SessionInterface $session, RoleCheck $rolecheck) public function __construct(ContainerInterface $container, Security $security, EntityManagerInterface $em, PaginatorInterface $paginator, SessionInterface $session, RoleCheck $rolecheck)
{ {
$this->em = $em; $this->em = $em;
$this->security = $security;
$this->container = $container; $this->container = $container;
$this->paginator = $paginator; $this->paginator = $paginator;
$this->session = $session; $this->session = $session;
...@@ -44,6 +46,10 @@ class AppExtension extends AbstractExtension ...@@ -44,6 +46,10 @@ class AppExtension extends AbstractExtension
public function getFunctions() public function getFunctions()
{ {
return [ return [
new \Twig_SimpleFunction('getCurrentComptoir', array($this, 'getCurrentComptoir')),
new \Twig_SimpleFunction('getCurrentGroupe', array($this, 'getCurrentGroupe')),
new \Twig_SimpleFunction('getCurrentPrestataire', array($this, 'getCurrentPrestataire')),
new \Twig_SimpleFunction('isCotisationValid', array($this, 'isCotisationValid')),
new \Twig_SimpleFunction('isCurrentRoleGranted', array($this, 'isCurrentRoleGranted')), new \Twig_SimpleFunction('isCurrentRoleGranted', array($this, 'isCurrentRoleGranted')),
new \Twig_SimpleFunction('getSiege', array($this, 'getSiege')), new \Twig_SimpleFunction('getSiege', array($this, 'getSiege')),
new \Twig_SimpleFunction('isDevFixture', array($this, 'isDevFixture')), new \Twig_SimpleFunction('isDevFixture', array($this, 'isDevFixture')),
...@@ -61,6 +67,48 @@ class AppExtension extends AbstractExtension ...@@ -61,6 +67,48 @@ class AppExtension extends AbstractExtension
]; ];
} }
public function getCurrentComptoir()
{
if (!$this->session->has('_comptoirgere')) {
return null;
}
return $this->em->getRepository(Comptoir::class)->findOneById($this->session->get('_comptoirgere')->getId());
}
public function getCurrentGroupe()
{
if (!$this->session->has('_groupegere')) {
return null;
}
return $this->em->getRepository(Groupe::class)->findOneById($this->session->get('_groupegere')->getId());
}
public function getCurrentPrestataire()
{
if (!$this->session->has('_prestagere')) {
return null;
}
return $this->em->getRepository(Prestataire::class)->findOneById($this->session->get('_prestagere')->getId());
}
public function isCotisationValid(): bool
{
if ($this->security->getUser() != null) {
if ($this->isCurrentRoleGranted('ROLE_ADHERENT') && $this->security->getUser()->getAdherent() != null) {
$query = $this->em->getRepository(Flux::class)->getQueryByAdherent($this->security->getUser()->getAdherent(), 'cotisation');
} elseif ($this->isCurrentRoleGranted('ROLE_PRESTATAIRE') && $this->session->get('_prestagere') != null) {
$query = $this->em->getRepository(Flux::class)->getQueryByPrestataire($this->session->get('_prestagere'));
}
$cotisations = $query->getResult();
foreach ($cotisations as $cotisation) {
if ($cotisation->getCotisationInfos()->getFin() > new \DateTime("now")) {
return true;
}
}
}
return false;
}
public function isCurrentRoleGranted($role) public function isCurrentRoleGranted($role)
{ {
return $this->rolecheck->isGranted($role); return $this->rolecheck->isGranted($role);
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
"ref": "18727d8f229306860b46955f438e1897421da689" "ref": "18727d8f229306860b46955f438e1897421da689"
} }
}, },
"beberlei/doctrineextensions": {
"version": "v1.2.6"
},
"behat/transliterator": { "behat/transliterator": {
"version": "v1.2.0" "version": "v1.2.0"
}, },
...@@ -56,9 +59,6 @@ ...@@ -56,9 +59,6 @@
"ref": "ae205d5114e719deb64d2110f56ef910787d1e04" "ref": "ae205d5114e719deb64d2110f56ef910787d1e04"
} }
}, },
"doctrine/doctrine-cache-bundle": {
"version": "1.3.5"
},
"doctrine/doctrine-fixtures-bundle": { "doctrine/doctrine-fixtures-bundle": {
"version": "3.0", "version": "3.0",
"recipe": { "recipe": {
......
{% extends 'common/layout.html.twig' %} {% extends 'common/layout.html.twig' %}
{% block content %} {% block content %}
<div class='container'> <div class='container' style='max-width:800px;'>
<h4 class='mt-3'>{{'Adhérer'|trans }} :</h4> <h4 class='mt-3'>{{'Adhérer'|trans }} :</h4>
<p> <p>
{{form_start(form)}} {{form_start(form)}}
{{ form_row(form.user) }} {{ form_row(form.user) }}
{% if form.groupe is defined %}
{{ form_row(form.groupe) }} {{ form_row(form.groupe) }}
{% endif %}
{{ form_row(form.geoloc) }} {{ form_row(form.geoloc) }}
<div class='text-center mb-5 mt-2'>
<h5>{{ 'Montant de la cotisation'|trans }} : <b>{{ KOH_COTISATION_ADHERENT }}</b></h5>
{{ form_row(form.save) }} {{ form_row(form.save) }}
</div>
{{form_end(form)}} {{form_end(form)}}
</p> </p>
</div> </div>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
{{ form_start(form) }} {{ form_start(form) }}
{{ form_row(form.user) }} {{ form_row(form.user) }}
{{ form_row(form.geoloc) }} {{ form_row(form.geoloc) }}
{{ form_row(form.groupe) }} {# {{ form_row(form.groupe) }} #}
{{ form_row(form.save) }} {{ form_row(form.save) }}
{{ form_end(form) }} {{ form_end(form) }}
{% endblock blockcontent %} {% endblock blockcontent %}
\ No newline at end of file
...@@ -25,16 +25,17 @@ ...@@ -25,16 +25,17 @@
</ul> </ul>
</div> </div>
{% endif %} {% endif %}
{% if app.user.cotisations|length > 0 %} {# @TODO : afficher les cotisations #}
{# {% if app.user.adherent.cotisations|length > 0 %}
<div class='cotisations mt-4'> <div class='cotisations mt-4'>
<h4>{{ "Mes cotisations"|trans }} :</h4> <h4>{{ "Mes cotisations"|trans }} :</h4>
<ul class='list-group'> <ul class='list-group'>
{% for cotisation in app.user.cotisations %} {% for cotisation in app.user.adherent.cotisations %}
<li class="list-group-item">{{cotisation.annee|upper}} : {{cotisation.montant}}&euro; ({{ 'payée le'|trans }} {{cotisation.createdAt|date('d-m-Y')}})</li> <li class="list-group-item">{{cotisation.annee|upper}} : {{cotisation.montant}}&euro; ({{ 'payée le'|trans }} {{cotisation.createdAt|date('d-m-Y')}})</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
{% endif %} {% endif %} #}
{% if app.user.flux|length > 0 %} {% if app.user.flux|length > 0 %}
<div class='flux mt-4'> <div class='flux mt-4'>
<h4>{{ "Mes transactions"|trans }} :</h4> <h4>{{ "Mes transactions"|trans }} :</h4>
......
{% if app.user.cotisations|length > 0 %} {% set cotisations = getAllFlux(app.user, app.request, 'cotisation') %}
{% if cotisations|length > 0 %}
{% set idcard = 'cotisationspresta' %} {% set idcard = 'cotisationspresta' %}
{% extends 'block/block_collapse.html.twig' %} {% extends 'block/block_collapse.html.twig' %}
...@@ -8,8 +9,14 @@ ...@@ -8,8 +9,14 @@
{% block blocksubtitle %} {% block blocksubtitle %}
{% endblock blocksubtitle %} {% endblock blocksubtitle %}
{% block blockcontent %} {% block blockcontent %}
{# {% if not isCotisationValid() %}
{% if cotisations|length > 0 %}
<div class='text-danger mb-3'>{{ 'Votre dernière cotisation est arrivée à expiration, veuillez cotiser de nouveau pour accéder aux fonctionnalités de votre compte !'|trans }}</div>
{% else %}
<div class='text-danger mb-3'>{{ 'Si vous souhaitez utiliser le fonctionnalités de votre compte, vous devez cotiser !'|trans }}</div>
{% endif %}
{% endif %} #}
<ul class='list-group'> <ul class='list-group'>
{% set cotisations = getAllFlux(app.user, app.request, 'cotisation') %}
{% for cotisation in cotisations %} {% for cotisation in cotisations %}
<li class="list-group-item"><span class='btn btn-xs btn-primary disabled'>{{cotisation.annee|upper}}</span> <b>{{cotisation.montant}}&euro;</b> <em> {{ 'payée le'|trans }} {{cotisation.createdAt|date('d/m/Y')}} en {{cotisation.moyen}}</em></li> <li class="list-group-item"><span class='btn btn-xs btn-primary disabled'>{{cotisation.annee|upper}}</span> <b>{{cotisation.montant}}&euro;</b> <em> {{ 'payée le'|trans }} {{cotisation.createdAt|date('d/m/Y')}} en {{cotisation.moyen}}</em></li>
{% endfor %} {% endfor %}
...@@ -17,7 +24,7 @@ ...@@ -17,7 +24,7 @@
{% if (isCurrentRoleGranted('ROLE_ADHERENT') and app.user.adherent or (isCurrentRoleGranted('ROLE_PRESTATAIRE') and app.session.has('_prestagere'))) %} {% if (isCurrentRoleGranted('ROLE_ADHERENT') and app.user.adherent or (isCurrentRoleGranted('ROLE_PRESTATAIRE') and app.session.has('_prestagere'))) %}
<a class='btn btn-xs btn-primary' href='{{ path('cotiser') }}'> <a class='btn btn-xs btn-primary' href='{{ path('cotiser') }}'>
Cotiser en MLC {{ 'Cotiser en MLC'|trans }}
</a> </a>
{% endif %} {% endif %}
{% endblock blockcontent %} {% endblock blockcontent %}
......
...@@ -22,44 +22,46 @@ ...@@ -22,44 +22,46 @@
</thead> </thead>
<tbody> <tbody>
{% for flux in fluxs %} {% for flux in fluxs %}
{{flux.toHtmlArray()|raw}} <tr>
<td>{{flux.createdAt|date('d/m/Y H:i')}}</td>
{% if flux.type == 'reconversion' %}
<td>Demande de reconversion</td>
{% else %}
<td>{{flux.parenttype|capitalize}} de {{ flux.type|capitalize|replace({'_' : ' à '}) }}</td>
{% endif %}
<td>{{flux.expediteur}}</td>
<td>{{flux.destinataire}}</td>
<td>{{flux.montant}}</td>
</tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
<br/> <br/>
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" id="dropdownMenuLink">
<i class="fa fa-share-square-o" aria-hidden="true"></i> <i class="fa fa-share-square-o" aria-hidden="true"></i>
Export Exporter
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<li> <a class="dropdown-item" href="{{ path('exportPrestaFlux', {'format' : 'json'}) }}">
<a href="{{ path('exportPrestaFlux', {'format' : 'json'}) }}">
<i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i> <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
JSON JSON
</a> </a>
</li> <a class="dropdown-item" href="{{ path('exportPrestaFlux', {'format' : 'xml'}) }}">
<li>
<a href="{{ path('exportPrestaFlux', {'format' : 'xml'}) }}">
<i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i> <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
XML XML
</a> </a>
</li> <a class="dropdown-item" href="{{ path('exportPrestaFlux', {'format' : 'csv'}) }}">
<li>
<a href="{{ path('exportPrestaFlux', {'format' : 'csv'}) }}">
<i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i> <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
CSV CSV
</a> </a>
</li> <a class="dropdown-item" href="{{ path('exportPrestaFlux', {'format' : 'xls'}) }}">
<li>
<a href="{{ path('exportPrestaFlux', {'format' : 'xls'}) }}">
<i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i> <i class="fa fa-arrow-circle-o-down" aria-hidden="true"></i>
XLS XLS
</a> </a>
</li> </div>
</ul>
</div> </div>
{% endblock blockcontent %} {% endblock blockcontent %}
{% endif %} {% endif %}
\ No newline at end of file
...@@ -94,8 +94,8 @@ ...@@ -94,8 +94,8 @@
{% elseif isCurrentRoleGranted('ROLE_GESTION_GROUPE') %} {% elseif isCurrentRoleGranted('ROLE_GESTION_GROUPE') %}
{% if app.session.get('_groupegere') != null %} {% if getCurrentGroupe() != null %}
{% set compte = app.session.get('_groupegere').compte %} {% set compte = getCurrentGroupe().compte %}
{% set soldelabel = 'Solde du groupe'|trans %} {% set soldelabel = 'Solde du groupe'|trans %}
{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %} {% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
{% endif %} {% endif %}
...@@ -108,9 +108,9 @@ ...@@ -108,9 +108,9 @@
{% elseif isCurrentRoleGranted('ROLE_COMPTOIR') %} {% elseif isCurrentRoleGranted('ROLE_COMPTOIR') %}
{% if app.session.get('_comptoirgere') != null %} {% if getCurrentComptoir() != null %}
{% set compte = app.session.get('_comptoirgere').compte %} {% set compte = getCurrentComptoir().compte %}
{% set soldelabel = 'Solde du comptoir "'|trans ~ app.session.get('_comptoirgere') ~ '"' %} {% set soldelabel = 'Solde du comptoir "'|trans ~ getCurrentComptoir() ~ '"' %}
{% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %} {% include 'block/solde.html.twig' with {'compte': compte, 'soldelabel': soldelabel} %}
{% endif %} {% endif %}
{% include 'comptoir/block/infos.html.twig' %} {% include 'comptoir/block/infos.html.twig' %}
...@@ -139,19 +139,23 @@ ...@@ -139,19 +139,23 @@
{% include 'block/userinfos.html.twig' %} {% include 'block/userinfos.html.twig' %}
{% include 'block/userpassword.html.twig' %} {% include 'block/userpassword.html.twig' %}
{% elseif isCurrentRoleGranted('ROLE_PRESTATAIRE') and app.user and app.session.has('_prestagere') %} {% elseif isCurrentRoleGranted('ROLE_PRESTATAIRE') and app.user and getCurrentPrestataire() != null %}
{% set esoldelabel = 'Solde e-mlc'|trans %} {% set esoldelabel = 'Solde e-mlc'|trans %}
{% include 'block/solde.html.twig' with {'compte': app.session.get('_prestagere').ecompte, 'soldelabel': esoldelabel} %} {% include 'block/solde.html.twig' with {'compte': getCurrentPrestataire().ecompte, 'soldelabel': esoldelabel} %}
{% if getCurrentPrestataire().mlc == false %}
{% include 'presta/block/infos.html.twig' %} {% include 'presta/block/infos.html.twig' %}
{% endif %}
{% include 'block/userinfos.html.twig' %} {% include 'block/userinfos.html.twig' %}
{% include 'block/userpassword.html.twig' %} {% include 'block/userpassword.html.twig' %}
{% include 'block/cotisations.html.twig' %}
{% include 'block/transactions.html.twig' %} {% include 'block/transactions.html.twig' %}
{% if getCurrentPrestataire().mlc == false %}
{% include 'block/cotisations.html.twig' %}
{% include 'groupepresta/block/inscription.html.twig' %} {% include 'groupepresta/block/inscription.html.twig' %}
{% endif %}
{% include 'presta/block/transaction_presta.html.twig' %} {% include 'presta/block/transaction_presta.html.twig' %}
{% include 'presta/block/transaction_adherent.html.twig' %} {% include 'presta/block/transaction_adherent.html.twig' %}
{% if app.session.get('_prestagere').ecompte > 0 %} {% if getCurrentPrestataire().mlc == false and getCurrentPrestataire().ecompte > 0 %}
{% include 'presta/block/reconversion.html.twig' %} {% include 'presta/block/reconversion.html.twig' %}
{% endif %} {% endif %}
......
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% if admin.hasAccess('show', object) and admin.hasRoute('show') %}
<a
href="{{ admin.getRouteShowOnFront(object) }}"
target='_blank'
class="btn btn-sm btn-default view_link"
title="{{ 'action_show'|trans({}, 'SonataAdminBundle') }}"
>
<i class="fa fa-eye" aria-hidden="true"></i>
{{ 'action_show'|trans({}, 'SonataAdminBundle') }}
</a>
{% endif %}
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
<li>
<a class="sonata-action-element" href="{{ admin.getRouteShowMap }}">
<i class="fa fa-map"></i> {{ 'Voir sur la carte'|trans() }}
</a>
</li>
...@@ -22,6 +22,10 @@ Modified for MLC from Sonata package. ...@@ -22,6 +22,10 @@ Modified for MLC from Sonata package.
<!DOCTYPE html> <!DOCTYPE html>
<html {% block html_attributes %}class="no-js"{% endblock %}> <html {% block html_attributes %}class="no-js"{% endblock %}>
<head> <head>
<title>{{title|default('Kohinos') }}</title>
<meta name="description" content="{{ description|default('Kohinos : Outil de gestion de monnaie locale complémentaire') }}" />
<meta name="keywords" content="{{ keywords|default('Kohinos, mlc, mlcc, monnaie locale, monnaies locales') }}" />
{% block meta_tags %} {% block meta_tags %}
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8"> <meta charset="UTF-8">
...@@ -31,9 +35,6 @@ Modified for MLC from Sonata package. ...@@ -31,9 +35,6 @@ Modified for MLC from Sonata package.
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png">
<link rel="manifest" href="/images/favicon/site.webmanifest"> <link rel="manifest" href="/images/favicon/site.webmanifest">
{% endblock favicon %} {% endblock favicon %}
{# {% if KOH_FAVICON_URL is defined %}
<link rel="shortcut icon" href="{{KOH_FAVICON_URL}}" type="image/x-icon" />
{% endif %} #}
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
{% endblock meta_tags %} {% endblock meta_tags %}
...@@ -363,7 +364,9 @@ Modified for MLC from Sonata package. ...@@ -363,7 +364,9 @@ Modified for MLC from Sonata package.
{% block sonata_admin_content_actions_wrappers %} {% block sonata_admin_content_actions_wrappers %}
{% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %} {% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
{% if _actions|split('</a>')|length > 2 %} {# MODIF MLC : #}
{# {% if _actions|split('</a>')|length > 2 %} #}
{% if _actions|split('</a>')|length > 3 %}
<li class="dropdown sonata-actions"> <li class="dropdown sonata-actions">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a>
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
......
<footer class="container clearfix footer"> <footer class="container clearfix footer">
{# TODO : ajouter crédit et lien vers la solution de gestion de la monnaie locale complémentaire libre de droits #} {# TODO : ajouter crédit et lien vers la solution de gestion de la monnaie locale complémentaire libre de droits #}
<a href='http://www.kohinos.com' target='_blank'>© Kohinos 2020</a> <a href='http://www.kohinos.com' target='_blank'>© Kohinos 2020</a>
<div class='float-right'>
<a href="{{ path('contact') }}">Nous contacter</a>
</div>
</footer> </footer>
\ No newline at end of file
<header class="container header"> <header class="container header">
<nav class="menu navbar navbar-expand-md navbar-light bg-light">
<a class="navbar-brand" href="{{ url('index') }}">
<img src="/images/logo.png" height="45" class="d-inline-block align-top" alt="{{KOH_MLC_NAME is defined ? KOH_MLC_NAME : ''}}">
</a>
{% block menu %} {% block menu %}
{% include 'common/menu.html.twig' %} {% include 'common/menu.html.twig' %}
{% endblock menu %} {% endblock menu %}
</nav>
</header> </header>
\ No newline at end of file
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{title|default(KOH_MLC_TITLE is defined ? KOH_MLC_TITLE : '') }}</title> <title>{{title|default('Kohinos') }}</title>
<meta name="description" content="{{ description|default(KOH_MLC_DESCRIPTION is defined ? KOH_MLC_DESCRIPTION : '') }}" /> <meta name="description" content="{{ description|default('Kohinos : Outil de gestion de monnaie locale complémentaire') }}" />
<meta name="keywords" content="{{ keywords|default(KOH_MLC_KEYWORDS is defined ? KOH_MLC_KEYWORDS : '') }}" /> <meta name="keywords" content="{{ keywords|default('Kohinos, mlc, mlcc, monnaie locale, monnaies locales') }}" />
{# FAVICON #} {# FAVICON #}
{% block favicon %} {% block favicon %}
...@@ -19,13 +19,6 @@ ...@@ -19,13 +19,6 @@
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png">
<link rel="manifest" href="/images/favicon/site.webmanifest"> <link rel="manifest" href="/images/favicon/site.webmanifest">
{% endblock favicon %} {% endblock favicon %}
{# {% if KOH_FAVICON_URL is defined %}
<link rel="shortcut icon" href="{{KOH_FAVICON_URL}}" type="image/x-icon" />
{% endif %} #}
{# UTILISER LES FONT AWESOME POUR L'ICONOGRAPHIE #}
<link rel="stylesheet" href="/fontawesome/css/all.min.css">
{# UTILISER LEAFLET POUR LA CARTE #}
<link rel="stylesheet" href="/leaflet/leaflet.css">
{# POUR AJOUTER DES META ( like og: ) #} {# POUR AJOUTER DES META ( like og: ) #}
{% block meta %} {% endblock meta %} {% block meta %} {% endblock meta %}
......
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
;
{% if menuItems is not defined %} {% if menuItems is not defined %}
{% set menuItems = getMenuItemsFromAlias('main') %} {% set menuItems = getMenuItemsFromAlias('main') %}
{% endif %} {% endif %}
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<nav class="menu navbar navbar-expand-md navbar-light bg-light">
<a class="navbar-brand" href="{{ url('index') }}">
<img src="/images/logo.png" height="45" class="d-inline-block align-top" alt="{{KOH_MLC_NAME is defined ? KOH_MLC_NAME : ''}}">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
{% if menuItems is not null and menuItems|length > 0 %}
{% import 'common/menu_tree_macro.html.twig' as tree %}
{% set currentPath = app.request.requestUri %}
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
{% if app.user is null %} {% if app.user is null %}
<li class="nav-item dropdownmenu-item has-child dropdown" role="menu-item"> <li class="nav-item dropdownmenu-item has-child dropdown" role="menu-item">
...@@ -25,7 +16,11 @@ ...@@ -25,7 +16,11 @@
</div> </div>
</li> </li>
{% endif %} {% endif %}
{% if KOH_USE_WORDPRESS == 'false' and menuItems is not null and menuItems|length > 0 %}
{% import 'common/menu_tree_macro.html.twig' as tree %}
{% set currentPath = app.request.requestUri %}
{{ tree.menu(menuItems, currentPath) }} {{ tree.menu(menuItems, currentPath) }}
{% endif %}
{# MENU UTILISATEUR AYANT ACCES A L'ADMIN CONNECTE #} {# MENU UTILISATEUR AYANT ACCES A L'ADMIN CONNECTE #}
{% if app.user and (isCurrentRoleGranted('ROLE_ADMIN_SIEGE') or {% if app.user and (isCurrentRoleGranted('ROLE_ADMIN_SIEGE') or
isCurrentRoleGranted('ROLE_SUPER_ADMIN') or isCurrentRoleGranted('ROLE_SUPER_ADMIN') or
...@@ -38,7 +33,7 @@ ...@@ -38,7 +33,7 @@
) %} ) %}
<li class="nav-item" role="menu-item"> <li class="nav-item" role="menu-item">
<a href="{{ path('sonata_admin_dashboard') }}" class="nav-link" data-toggle="tooltip" data-placement="bottom" title="{{ 'Administration'|trans }}"> <a href="{{ path('sonata_admin_dashboard') }}" class="nav-link" data-toggle="tooltip" data-placement="bottom" title="{{ 'Administration'|trans }}">
<i class="fas fa-cog text-primary"></i> <i class="fas fa-cog text-primary"></i>{% if KOH_USE_WORDPRESS != 'false' %}<span class='ml-1 text-primary'>Administration</span>{% endif %}
</a> </a>
</li> </li>
{% endif %} {% endif %}
...@@ -52,22 +47,36 @@ ...@@ -52,22 +47,36 @@
{% if app.session.has('_groupId') %} {% if app.session.has('_groupId') %}
{% set groupeUser = app.session.get('_groupId') %} {% set groupeUser = app.session.get('_groupId') %}
{{groupeUser.name}} {{groupeUser.name}}
{% else %} {% elseif app.user.groups|length > 0 %}
{{app.user.groups[0].name}} {{app.user.groups[0].name}}
{% elseif app.user.roles|length > 0 %}
{{app.user.roles[0]}}
{% else %}
{{app.user.name}}
{% endif %} {% endif %}
{% if app.session.has('_groupegere') %} {% if getCurrentGroupe() != null %}
- {{app.session.get('_groupegere')}} - {{ getCurrentGroupe() }}
{% endif %} {% endif %}
{% if app.session.has('_comptoirgere') %} {% if getCurrentComptoir() != null %}
- {{app.session.get('_comptoirgere')}} - {{ getCurrentComptoir() }}
{% endif %} {% endif %}
{% if app.session.has('_prestagere') %} {% if getCurrentPrestataire() != null %}
- {{app.session.get('_prestagere')}} - {{ getCurrentPrestataire() }}
{% endif %} {% endif %}
</span> </span>
</span> </span>
</a> </a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownUC"> <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownUC">
{# COMPTE ou ECOMPTE : @TODO : mettre plutôt dans le header en visible tout le temps ? #}
{% if isCurrentRoleGranted('ROLE_ADHERENT') %}
<b class="dropdown-item bg-primary text-white"> Ecompte : {{app.user.adherent.ecompte }}</b>
{% elseif isCurrentRoleGranted('ROLE_PRESTATAIRE') and getCurrentPrestataire() != null %}
<b class="dropdown-item bg-primary text-white"> Ecompte : {{getCurrentPrestataire().ecompte }}</b>
{% elseif getCurrentGroupe() != null %}
<b class="dropdown-item bg-primary text-white"> Compte : {{getCurrentGroupe().compte }}</b>
{% elseif getCurrentComptoir() != null %}
<b class="dropdown-item bg-primary text-white"> Compte : {{getCurrentComptoir().compte }}</b>
{% endif %}
{% if app.user.groups|length > 1 %} {% if app.user.groups|length > 1 %}
<a href="#" class="viewChoiceGroup dropdown-item">{{ 'Choix du rôle'|trans }}</a> <a href="#" class="viewChoiceGroup dropdown-item">{{ 'Choix du rôle'|trans }}</a>
{% endif %} {% endif %}
...@@ -79,7 +88,4 @@ ...@@ -79,7 +88,4 @@
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
{% endif %}
</nav>
...@@ -4,22 +4,23 @@ ...@@ -4,22 +4,23 @@
<i class="fas fa-check"> </i> {{ showMlcStats('user') }} {{ 'utilisateurs'|trans }}<br> <i class="fas fa-check"> </i> {{ showMlcStats('user') }} {{ 'utilisateurs'|trans }}<br>
</p> </p>
<p> <p>
<i class="fa fa-check"> </i> {{ showMlcStats('prestataire') }} <a href="{{ path('liste_prestataire') }}" title="{{ 'Les prestataires de la doume'|trans }}">{{'prestataires'|trans}}</a> {{'et'|trans}} {{ showMlcStats('partenaire') }} <a href="{{ path('liste_partenaire') }}" title="{{'Les partenaires de la doume'|trans}}">{{ 'partenaires'|trans }}</a> <i class="fa fa-check"> </i> {{ showMlcStats('prestataire') }} <a href="{{ path('liste_prestataire') }}" title="{{ 'Nombre de prestataires'|trans }}">{{'prestataires'|trans}}</a> {{'et'|trans}} {{ showMlcStats('partenaire') }} <a href="{{ path('liste_partenaire') }}" title="{{'Nombre de partenaires'|trans}}">{{ 'partenaires'|trans }}</a>
</p> </p>
<p> <p>
<i class="fa fa-check"> </i> {{ showMlcStats('groupe') }} <a href="{#{ path('groupe_liste') }#}" title="{{ 'Les groupes locaux de la doume'|trans }}">{{ 'groupes locaux'|trans }}</a> <i class="fa fa-check"> </i> {{ showMlcStats('groupe') }} <a href="{#{ path('groupe_liste') }#}" title="{{ 'Nombre de groupes locaux'|trans }}">{{ 'groupes locaux'|trans }}</a>
</p> </p>
<p> <p>
<i class="fa fa-check"> </i> {{ showMlcStats('comptoir') }} <a href="{{ path('comptoirs_liste') }}" title="{{ 'Les comptoirs de la doume'|trans }}">{{ 'comptoirs'|trans }}</a> <i class="fa fa-check"> </i> {{ showMlcStats('comptoir') }} <a href="{{ path('comptoirs_liste') }}" title="{{ 'Nombre de comptoirs'|trans }}">{{ 'comptoirs'|trans }}</a>
</p> </p>
{# <p> {# @TODO (pas prioritaire) : Statistiques avancées :
<i class="fa fa-check"> </i> 527029 Doumes émises <p>
<i class="fa fa-check"> </i> 527029 {{ KOH_MLC_NAME_SMALL }} émises
</p> </p>
<p> <p>
<i class="fa fa-check"> </i> 350304 Doumes reconverties <i class="fa fa-check"> </i> 350304 {{ KOH_MLC_NAME_SMALL }} reconverties
</p> </p>
<p> <p>
<i class="fa fa-check"> </i> 174778 Doumes en circulation <i class="fa fa-check"> </i> 174778 {{ KOH_MLC_NAME_SMALL }} en circulation
</p> </p>
<p> <p>
<i class="fa fa-check"> </i> 192923 d'échanges numériques <i class="fa fa-check"> </i> 192923 d'échanges numériques
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
</div> </div>
<div class="card-body"> <div class="card-body">
{% if comptoir.groupe != null %} {% if comptoir.groupe != null %}
<h4 class="card-subtitle mb-3">{{'Groupe local'|trans}} : <a href='{{ path('show_groupe', {'slug': comptoir.groupe.slug}) }}'>{{comptoir.groupe.__toString()}}</a></h4> <h5 class="card-subtitle mb-4">{{'Groupe local'|trans}} : <a href='{{ path('show_groupe', {'slug': comptoir.groupe.slug}) }}'>{{comptoir.groupe.__toString()}}</a></h5>
{% endif %} {% endif %}
{% if comptoir.tel != null %} {% if comptoir.tel != null %}
<h5 class="card-subtitle mb-3">{{ 'Téléphone'|trans }} : {{comptoir.tel}}</h5> <h5 class="card-subtitle mb-1">{{ 'Téléphone'|trans }} : {{comptoir.tel}}</h5>
{% endif %} {% endif %}
{% if comptoir.email != null %} {% if comptoir.email != null %}
<h6 class="card-subtitle mb-3">{{ 'Email'|trans }} : {{ comptoir.email|safe_email|raw }}</h6> <h6 class="card-subtitle mb-3">{{ 'Email'|trans }} : {{ comptoir.email|safe_email|raw }}</h6>
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
{% if comptoir.getFullAddresse() != null %} {% if comptoir.getFullAddresse() != null %}
<h6 class="card-title text-muted mb-3">{{comptoir.getFullAddresse()}}</h6> <h6 class="card-title text-muted mb-3">{{comptoir.getFullAddresse()}}</h6>
{% endif %} {% endif %}
{# {% if comptoir.content != null %}
<div class="card-text"> <div class="card-text">
{{comptoir.content|raw}} {{comptoir.content|raw}}
</div> </div>
{% endif %} #}
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
<div class="my-2 p-3 bg-white rounded box-shadow"> <div class="my-2 p-3 bg-white rounded box-shadow">
<div class="contentcomptoir p-4 mt-2"> <div class="contentcomptoir p-4 mt-2">
<div class="card mb-2"> <div class="card mb-2">
<div class="card-header"><h1>{{comptoir.name}}</h1></div> <div class="card-header">
<h1>{{comptoir.name}}</h1>
{# @TODO : ajouter le lien d'édition uniquement quand l'utilisateur peut l'éditer (Voter?) #}
{% if app.user and is_granted('ROLE_SUPER_ADMIN') %}
<a class='btn btn-primary float-right' href="{{ path('comptoir_edit', {'id': comptoir.id}) }}">Edit</a>
{% endif %}
</div>
<div class="card-body"> <div class="card-body">
{% if comptoir.groupe != null %} {% if comptoir.groupe != null %}
<h4 class="card-subtitle mb-3">{{ 'Groupe local'|trans }} : <a href='{{ path('show_groupe', {'slug': comptoir.groupe.slug}) }}'>{{comptoir.groupe.__toString()}}</a></h4> <h4 class="card-subtitle mb-3">{{ 'Groupe local'|trans }} : <a href='{{ path('show_groupe', {'slug': comptoir.groupe.slug}) }}'>{{comptoir.groupe.__toString()}}</a></h4>
...@@ -19,16 +25,21 @@ ...@@ -19,16 +25,21 @@
{% if comptoir.getFullAddresse() != null %} {% if comptoir.getFullAddresse() != null %}
<h6 class="card-title text-muted mb-3">{{comptoir.getFullAddresse()}}</h6> <h6 class="card-title text-muted mb-3">{{comptoir.getFullAddresse()}}</h6>
{% endif %} {% endif %}
{% if comptoir.content != null %}
<div class="card-text"> <div class="card-text">
{{comptoir.content|raw}} {{comptoir.content|raw}}
</div> </div>
{% endif %}
</div> </div>
<div class="card-header"><h2>{{ comptoir.groupe.prestataires|length }} {{ 'prestataires'|trans }} :</h2></div> <div class="card-header"><h2>{{ 'Prestataires du groupe'|trans }} ({{ comptoir.groupe.prestataires|length }}) :</h2></div>
<ul class="list-group list-group-flush"> <div class="row m-2">
{% for presta in comptoir.groupe.prestataires %} {% for presta in comptoir.groupe.prestataires %}
<li class="list-group-item"> <div class="col-6 mb-2">
{% include 'presta/onepresta.html.twig' %}
</div>
{# <li class="list-group-item">
<a href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>{{presta.raison}}</a> <a href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>{{presta.raison}}</a>
</li> </li> #}
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
......
{% extends 'common/layout.html.twig' %}
{% block content %}
<div class='container' style='max-width: 800px;'>
<h2 class='text-center w-100 mt-3'>{{ "Cotiser pour l'année"|trans }} {{ "now"|date('Y') }}</h2>
<div class='text-center mb-5'>
{% if isCurrentRoleGranted('ROLE_ADHERENT') %}
<h4>{{ 'Solde de eMLC'|trans }} : <b>{{ app.user.adherent.ecompte }}</b></h4>
<h5>{{ 'Montant minimum de la cotisation'|trans }} : <b>{{ KOH_COTISATION_ADHERENT }}</b></h5>
{% elseif isCurrentRoleGranted('ROLE_PRESTATAIRE') %}
<h4>{{ 'Solde de eMLC'|trans }} : <b>{{ app.session.get('_prestagere').ecompte }}</b></h4>
<h5>{{ 'Montant minimum de la cotisation'|trans }} : <b>{{ KOH_COTISATION_PRESTATAIRE }}</b></h5>
{% endif %}
</h5>
{{ form_start(form) }}
{{ form_row(form.operateur) }}
{{ form_row(form.role) }}
{{ form_row(form.reference) }}
{{ form_row(form.montant) }}
<div class='row mt-4'>
{% if form.payMLC is defined %}
<div class='col-6'>
{{ form_widget(form.payMLC) }}
</div>
<div class='col-6'>
{% else %}
<div class='col-12'>
{% endif %}
{{ form_widget(form.payCB) }}
</div>
</div>
{{ form_end(form) }}
</div>
</div>
{% endblock %}
{% extends 'email/email_layout.html.twig' %}
{% set title %}{% spaceless %}
{{ subject }}
{% endspaceless %}
{% endset %}
{% block content %}
<h2 style="font-size: 18px; color: #111111; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: bold; line-height: 1.2em; margin: 40px 0 10px;">{{ 'Valider la création de votre compte'|trans }}</h2><br/>
<p>
{{ 'Un administreur a crée votre nouveau compte MLC'|trans }}
{{ user.commonname|title }}
</p>
<p>
{{ 'Pour valider votre nouveau compte, cliquez '|trans }}<a href='{{confirmationUrl}}'>{{ 'ICI'|trans }}</a>
</p>
{% endblock %}
\ No newline at end of file
{% extends 'email/email_layout.html.twig' %}
{% set title %}{% spaceless %}
{{ subject }}
{% endspaceless %}
{% endset %}
{% block content %}
<h2 style="font-size: 18px; color: #111111; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: bold; line-height: 1.2em; margin: 40px 0 10px;">{{ 'Formulaire de contact'|trans }}</h2><br/>
<p>
{{ 'Nom : '|trans }} : {{name}}<br/>
{{ 'Email : '|trans }} : {{from}}<br/>
{{ 'Message : '|trans }}<br/>
{{ message|nl2br }}
</p>
{% endblock %}
\ No newline at end of file
<table style="padding: 20px;width: 100%;" bgcolor="#f6f6f6"> <!DOCTYPE html>
<html lang="it">
<head>
<title>{{title}}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<style type="text/css">
{% block css %}
{% endblock css %}
</style>
</head>
<body style="margin: 0; padding: 0;" bgcolor="#ffffff" align="center">
<table style="padding: 20px;width: 100%;" bgcolor="#f6f6f6">
<tr> <tr>
<td></td> <td></td>
<td style="border: 1px solid #f0f0f0;clear: both !important;display: block !important;Margin: 0 auto !important;max-width: 600px !important;padding: 20px;" bgcolor="#FFFFFF"> <td style="border: 1px solid #f0f0f0;clear: both !important;display: block !important;Margin: 0 auto !important;max-width: 600px !important;padding: 20px;" bgcolor="#FFFFFF">
...@@ -11,7 +25,7 @@ ...@@ -11,7 +25,7 @@
<td> <td>
{% block main %} {% block main %}
{% block title%} {% block title%}
<h2 style="font-size: 18px; color: #111111; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: bold; line-height: 1.2em; margin: 40px 0 10px;"> <h2 style="font-size: 18px; color: #3c8dbc; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: bold; line-height: 1.2em; margin: 40px 0 10px;">
{{title}} {{title}}
</h2> </h2>
{% endblock title%} {% endblock title%}
...@@ -32,6 +46,9 @@ ...@@ -32,6 +46,9 @@
<!-- /content --> <!-- /content -->
</td> </td>
<td>© Kohinos</td> <td></td>
</tr> </tr>
</table> </table>
© Kohinos
</body>
</html>
\ No newline at end of file
...@@ -6,10 +6,17 @@ ...@@ -6,10 +6,17 @@
{% endset %} {% endset %}
{% block content %} {% block content %}
<h2 style="font-size: 18px; color: #111111; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: bold; line-height: 1.2em; margin: 40px 0 10px;">{{ user.name|title }},</h2><br/> <h2 style="font-size: 18px; color: #111111; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: bold; line-height: 1.2em; margin: 40px 0 10px;">{{ user.commonname|title }}</h2><br/>
{# @TODO #} {# @TODO : peaufiner le mail des flux + revoir la liste des utilisateurs à notifier dans les entités getUsersToNotify() ! #}
<h3>Nouveau flux {{flux.parenttype}} : {{flux.type}} :</h3> <h3>
<p>Référence : {{flux.reference}}</p> {% if flux.type == 'reconversion' %}
{{ 'Demande de reconversion' }}
{% else %}
{{flux.parenttype|capitalize}} : {{flux.type|replace({'_' : ' => '})}}
{% endif %}
</h3>
<p>De {{flux.expediteur}} à {{flux.destinataire}}</p>
<p>Montant de {{flux.montant}} (Moyen : {{flux.moyen}})</p> <p>Montant de {{flux.montant}} (Moyen : {{flux.moyen}})</p>
<p>Référence : {{flux.reference}}</p>
<p>Opérateur : {{flux.operateur.name}}</p> <p>Opérateur : {{flux.operateur.name}}</p>
{% endblock %} {% endblock %}
\ No newline at end of file
{% extends 'common/layout.html.twig' %} {% extends 'common/layout.html.twig' %}
{% block content %} {% block content %}
<div class='container groupeshow mt-5'> <div class='container groupeshow mt-5 mb-5' style='max-width:800px;'>
<h4>{{ title }} :</h4> <h4>{{ title }} :</h4>
{# <h5>{{ 'Mon compte'|trans }} : {{compte}}</h5> #} {# <h5>{{ 'Mon compte'|trans }} : {{compte}}</h5> #}
{{form_start(form)}} {{form_start(form)}}
......
{% extends 'common/layout.html.twig' %}
{% block content %}
<div class='container homepage' style='max-width: 800px;'>
<div class='row mt-3'>
<div class='col-12 text-center'>
{% block colonne_centre %}
{% include 'block/useradmin.html.twig' %}
{% endblock colonne_centre %}
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends 'common/layout.html.twig' %} {% extends 'common/layout.html.twig' %}
{% form_theme form _self %}
{% block content %} {% block content %}
<div class='container homepage'> <div class='container homepage'>
<div class="card mx-auto mt-5" style="max-width: 600px;"> <div class="card mx-auto mt-5" style="max-width: 600px;">
...@@ -14,7 +16,7 @@ ...@@ -14,7 +16,7 @@
{{ form_row(form.siege) }} {{ form_row(form.siege) }}
{{ form_row(form.user) }} {{ form_row(form.user) }}
<p><em> <p><em>
{{ "A la suite de l'installation du système, un prestataire est crée (Monnaie locale) permettant de recevoir les adhésions."|trans }} {{ "A la suite de l'installation du système, un prestataire (un peu particulier : non public, non affiché sur la carte) est crée, avec comme nom 'Monnaie locale', permettant de recevoir les adhésions/cotisations et frais de reconversions."|trans }}
</em></p> </em></p>
<div class='text-center'>{{ form_row(form.save) }}</div> <div class='text-center'>{{ form_row(form.save) }}</div>
{{form_end(form)}} {{form_end(form)}}
......
{% extends '@SonataAdmin/CRUD/base_edit.html.twig' %} {% extends '@SonataAdmin/CRUD/base_edit.html.twig' %}
{#
{% block form %}
<a href="{{path('cotisation_prestataire_list', {'filter': {'expediteur': {'value': admin.id(object) }}}) }}">{{ 'Voir les cotisations'}}</a>
{{ block('parentForm') }}
{% endblock %}
http://www.doume.test/admin/cotisation_prestataire/list?filter%5BcotisationInfos__annee%5D%5Btype%5D=&filter%5BcotisationInfos__annee%5D%5Bvalue%5D=&filter%5Bmontant%5D%5Btype%5D=&filter%5Bmontant%5D%5Bvalue%5D=&filter%5BcotisationInfos__recu%5D%5Btype%5D=&filter%5BcotisationInfos__recu%5D%5Bvalue%5D=&filter%5Bexpediteur%5D%5Btype%5D=&filter%5Bexpediteur%5D%5Bvalue%5D=19&filter%5B_page%5D=1&filter%5B_sort_by%5D=createdAt&filter%5B_sort_order%5D=DESC&filter%5B_per_page%5D=32 #}
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
{% else %} {% else %}
var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}]).addTo(mymap); var marker_{{count}} = L.marker([{{geolocp.geoloc.lat}}, {{geolocp.geoloc.lon}}]).addTo(mymap);
{% endif %} {% endif %}
marker_{{count}}.bindPopup("{% spaceless %}{% if presta.media != null %}{% thumbnail presta.media, 'small' %}<br/><br/>{% endif %} marker_{{count}}.bindPopup("{% spaceless %}{% if presta.media != null %}{#% thumbnail presta.media, 'small' %#}<br/><br/>{% endif %}
<a target='_blank' href='{{ path('show_prestataire', {'slug': presta.slug}) }}'> <a target='_blank' href='{{ path('show_prestataire', {'slug': presta.slug}) }}'>
<strong style='font-size:16px;'>{{presta.__toString()}}</strong> <strong style='font-size:16px;'>{{presta.__toString()}}</strong>
</a> </a>
......
...@@ -4,6 +4,18 @@ ...@@ -4,6 +4,18 @@
<i class="fa fa-external-link-alt mr-4"></i> {{ 'Reconversion'|trans }} <i class="fa fa-external-link-alt mr-4"></i> {{ 'Reconversion'|trans }}
{% endblock blocktitle %} {% endblock blocktitle %}
{% block blockcontent %} {% block blockcontent %}
<p>{{'Solde de votre compte'|trans}} : {{ app.session.get('_prestagere').ecompte }}<br/>
{% if KOH_RECONVERSION_PRESTATAIRE != '0' and KOH_RECONVERSION_PRESTATAIRE is not empty %}
<em>{{'Taux de reconversion'|trans}} : {{app.session.get('_prestagere').tauxreconversion ? app.session.get('_prestagere').tauxreconversion : KOH_RECONVERSION_PRESTATAIRE}}%</em>
{% endif %}
</p>
{% set form = getTransfertPrestataireSiegeForm(app.user) %} {% set form = getTransfertPrestataireSiegeForm(app.user) %}
{{ parent() }} {{ form_start(form) }}
{% if form.montant is defined %}
{{ form_row(form.montant, { 'label': 'Montant à reconvertir : ' }) }}
{% endif %}
{% if form.reference is defined %}
{{ form_row(form.reference) }}
{% endif %}
{{ form_end(form) }}
{% endblock blockcontent %} {% endblock blockcontent %}
\ No newline at end of file
...@@ -6,40 +6,7 @@ ...@@ -6,40 +6,7 @@
<div class="row"> <div class="row">
{% for presta in prestas %} {% for presta in prestas %}
<div class="col-12 col-md-6 mb-2"> <div class="col-12 col-md-6 mb-2">
<div class='card'> {% include 'presta/onepresta.html.twig' %}
<div class="card-header"><h2><a href="{{ path('show_prestataire', {'slug': presta.slug}) }}">{{presta.raison}}</a></h2></div>
<div class="card-body">
<h4 class="card-title">{{presta.statut}}</h4>
<h6 class="card-title">{{ 'Responsable'|trans }} : {{presta.responsable}} ({{presta.metier}})</h6>
<div class="card-text">
{% if presta.media %}
<p class='mb-4'>
{% set pathMedia = mediaurl(presta.media, 'reference') %}
{% if pathMedia ends with '.jpg' or pathMedia ends with '.png' or pathMedia ends with '.bmp' or pathMedia ends with '.gif' %}
<img src="{% path presta.media, 'reference' %}" style="max-width: 100%;"/>
{% else %}
<a href="{% path presta.media, 'reference' %}">{{'Télécharger'|trans}}</a>
{% endif %}
</p>
{% endif %}
{% if presta.description != null %}
<p class='mb-4'>
{{presta.description|raw}}
</p>
{% endif %}
{% if presta.horaires != null %}
<em class='mb-4'>
{{ 'Horaires'|trans }} : {{presta.horaires|raw}}
</em>
{% endif %}
{% if presta.web != null %}
<p>
<a href='{{presta.web}}'>{{ 'Site web'|trans }}</a>
</p>
{% endif %}
</div>
</div>
</div>
</div> </div>
{% if loop.index%2 == 0 %} {% if loop.index%2 == 0 %}
</div> </div>
......
<div class='card'>
<div class="card-header"><h2><a href="{{ path('show_prestataire', {'slug': presta.slug}) }}">{{presta.raison}}</a></h2></div>
<div class="card-body">
<h4 class="card-title">{{presta.statut}}</h4>
<h6 class="card-title">{{ 'Responsable'|trans }} : {{presta.responsable}} ({{presta.metier}})</h6>
<div class="card-text">
{% if presta.media %}
<p class='mb-4'>
{% set pathMedia = mediaurl(presta.media, 'reference') %}
{% if pathMedia ends with '.jpg' or pathMedia ends with '.png' or pathMedia ends with '.bmp' or pathMedia ends with '.gif' %}
<img src="{% path presta.media, 'reference' %}" style="max-width: 100%;"/>
{% else %}
<a href="{% path presta.media, 'reference' %}">{{'Télécharger'|trans}}</a>
{% endif %}
</p>
{% endif %}
{% if presta.description != null %}
<p class='mb-4'>
{{presta.description|raw}}
</p>
{% endif %}
{% if presta.horaires != null %}
<em class='mb-4'>
{{ 'Horaires'|trans }} : {{presta.horaires|raw}}
</em>
{% endif %}
{% if presta.web != null %}
<p>
<a href='{{presta.web}}'>{{ 'Site web'|trans }}</a>
</p>
{% endif %}
</div>
</div>
</div>
\ No newline at end of file
...@@ -5,8 +5,25 @@ ...@@ -5,8 +5,25 @@
<div class="my-2 p-3 bg-white rounded box-shadow"> <div class="my-2 p-3 bg-white rounded box-shadow">
<div class="contentpresta p-4 mt-2"> <div class="contentpresta p-4 mt-2">
<div class="card mb-2"> <div class="card mb-2">
<div class="card-header"><h1>{{presta.raison}}</h1></div> <div class="card-header">
<h1>{{presta.raison}}</h1>
{% if presta.rubriques|length > 0%}
{% for rubrique in presta.rubriques %}
<a class='rubrique ml-2' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name}}</a>
<a class='rubrique ml-2' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name}}</a>
{% endfor %}
{# @TODO : ajouter le lien d'édition uniquement quand l'utilisateur peut l'éditer (Voter?) #}
{% if app.user and is_granted('ROLE_SUPER_ADMIN') %}
<a class='btn btn-primary float-right' href="{{ path('prestataire_edit', {'id': presta.id}) }}">Edit</a>
{% endif %}
{% endif %}
</div>
<div class="card-body"> <div class="card-body">
{% if presta.media != null %}
<div class='w-25 float-right'>
<img class="w-100"src="{% path presta.media, 'big' %}" alt="{{presta.raison}}">
</div>
{% endif %}
{% if presta.statut != null %} {% if presta.statut != null %}
<h6 class="card-title text-muted mb-3">{{presta.statut}}</h6> <h6 class="card-title text-muted mb-3">{{presta.statut}}</h6>
{% endif %} {% endif %}
...@@ -43,19 +60,11 @@ ...@@ -43,19 +60,11 @@
<div class="card-header"><h2>{{ 'Contact(s)'|trans }} :</h2></div> <div class="card-header"><h2>{{ 'Contact(s)'|trans }} :</h2></div>
<ul class="list-group list-group-flush"> <ul class="list-group list-group-flush">
{% for contact in presta.contacts %} {% for contact in presta.contacts %}
{% if contact.enabled %}
<li class="list-group-item"> <li class="list-group-item">
{{contact.name}} : {{contact.content}} {{contact.name}} : {% if contact.tel != null %}{{contact.tel}}{% endif %}{% if contact.email != null %}{{contact.email}}{% endif %}
</li> </li>
{% endfor %}
</ul>
{% endif %} {% endif %}
{% if presta.rubriques|length > 0%}
<div class="card-header"><h2>{{ 'Rubrique(s)'|trans }} :</h2></div>
<ul class="list-group list-group-flush">
{% for rubrique in presta.rubriques %}
<li class="list-group-item">
<a class='rubrique' href='{{ path('show_rubrique', {'slug': rubrique.slug}) }}'>{{rubrique.name}}</a>
</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
......
...@@ -49,6 +49,10 @@ ...@@ -49,6 +49,10 @@
<source>title_dashboard</source> <source>title_dashboard</source>
<target>title_dashboard</target> <target>title_dashboard</target>
</trans-unit> </trans-unit>
<trans-unit id="U6OJ_DJ" resname="action_show">
<source>action_show</source>
<target>action_show</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
...@@ -61,6 +61,10 @@ ...@@ -61,6 +61,10 @@
<source>title_dashboard</source> <source>title_dashboard</source>
<target>title_dashboard</target> <target>title_dashboard</target>
</trans-unit> </trans-unit>
<trans-unit id="U6OJ_DJ" resname="action_show">
<source>action_show</source>
<target>action_show</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
...@@ -621,6 +621,90 @@ ...@@ -621,6 +621,90 @@
<source>COTISATIONS</source> <source>COTISATIONS</source>
<target>COTISATIONS</target> <target>COTISATIONS</target>
</trans-unit> </trans-unit>
<trans-unit id="Oz7B4Is" resname="A la suite de l'installation du système, un prestataire (un peu particulier : non public, non affiché sur la carte) est crée, avec comme nom 'Monnaie locale', permettant de recevoir les adhésions/cotisations et frais de reconversions.">
<source>A la suite de l'installation du système, un prestataire (un peu particulier : non public, non affiché sur la carte) est crée, avec comme nom 'Monnaie locale', permettant de recevoir les adhésions/cotisations et frais de reconversions.</source>
<target>A la suite de l'installation du système, un prestataire (un peu particulier : non public, non affiché sur la carte) est crée, avec comme nom 'Monnaie locale', permettant de recevoir les adhésions/cotisations et frais de reconversions.</target>
</trans-unit>
<trans-unit id="SXv7upP" resname="Cotisation bien reçue. Merci !">
<source>Cotisation bien reçue. Merci !</source>
<target>Cotisation bien reçue. Merci !</target>
</trans-unit>
<trans-unit id="xmHo2hJ" resname="Problème avec la cotisation !">
<source>Problème avec la cotisation !</source>
<target>Problème avec la cotisation !</target>
</trans-unit>
<trans-unit id="bdxv64W" resname="Création de votre compte adhérent">
<source>Création de votre compte adhérent</source>
<target>Création de votre compte adhérent</target>
</trans-unit>
<trans-unit id="gnDd9YB" resname="Prestataires du groupe">
<source>Prestataires du groupe</source>
<target>Prestataires du groupe</target>
</trans-unit>
<trans-unit id="V7y1CE4" resname="Solde de votre compte">
<source>Solde de votre compte</source>
<target>Solde de votre compte</target>
</trans-unit>
<trans-unit id="CODc.dD" resname="Taux de reconversion">
<source>Taux de reconversion</source>
<target>Taux de reconversion</target>
</trans-unit>
<trans-unit id="i05c_4k" resname="Cotiser pour l'année">
<source>Cotiser pour l'année</source>
<target>Cotiser pour l'année</target>
</trans-unit>
<trans-unit id="KwABLy_" resname="Solde de eMLC">
<source>Solde de eMLC</source>
<target>Solde de eMLC</target>
</trans-unit>
<trans-unit id="WlSOCvM" resname="Montant minimum de la cotisation">
<source>Montant minimum de la cotisation</source>
<target>Montant minimum de la cotisation</target>
</trans-unit>
<trans-unit id="HC4nySe" resname="Nombre de prestataires">
<source>Nombre de prestataires</source>
<target>Nombre de prestataires</target>
</trans-unit>
<trans-unit id="cPM2uNv" resname="Nombre de partenaires">
<source>Nombre de partenaires</source>
<target>Nombre de partenaires</target>
</trans-unit>
<trans-unit id="7ikmdr1" resname="Nombre de groupes locaux">
<source>Nombre de groupes locaux</source>
<target>Nombre de groupes locaux</target>
</trans-unit>
<trans-unit id="6WrLEjb" resname="Nombre de comptoirs">
<source>Nombre de comptoirs</source>
<target>Nombre de comptoirs</target>
</trans-unit>
<trans-unit id="EQNxKHP" resname="Montant de la cotisation">
<source>Montant de la cotisation</source>
<target>Montant de la cotisation</target>
</trans-unit>
<trans-unit id="0FRZlef" resname="Valider la création de votre compte">
<source>Valider la création de votre compte</source>
<target>Valider la création de votre compte</target>
</trans-unit>
<trans-unit id="OOfGiXO" resname="Un administreur a crée votre nouveau compte MLC">
<source>Un administreur a crée votre nouveau compte MLC</source>
<target>Un administreur a crée votre nouveau compte MLC</target>
</trans-unit>
<trans-unit id="g4_aLE2" resname="Pour valider votre nouveau compte, cliquez">
<source>Pour valider votre nouveau compte, cliquez</source>
<target>Pour valider votre nouveau compte, cliquez</target>
</trans-unit>
<trans-unit id="TK7ZWvP" resname="ICI">
<source>ICI</source>
<target>ICI</target>
</trans-unit>
<trans-unit id="i69TG5r" resname="Voir sur la carte">
<source>Voir sur la carte</source>
<target>Voir sur la carte</target>
</trans-unit>
<trans-unit id="9lULPYy" resname="Cotiser en MLC">
<source>Cotiser en MLC</source>
<target>Cotiser en MLC</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
...@@ -637,6 +637,90 @@ ...@@ -637,6 +637,90 @@
<source>COTISATIONS</source> <source>COTISATIONS</source>
<target>COTISATIONS</target> <target>COTISATIONS</target>
</trans-unit> </trans-unit>
<trans-unit id="Oz7B4Is" resname="A la suite de l'installation du système, un prestataire (un peu particulier : non public, non affiché sur la carte) est crée, avec comme nom 'Monnaie locale', permettant de recevoir les adhésions/cotisations et frais de reconversions.">
<source>A la suite de l'installation du système, un prestataire (un peu particulier : non public, non affiché sur la carte) est crée, avec comme nom 'Monnaie locale', permettant de recevoir les adhésions/cotisations et frais de reconversions.</source>
<target>A la suite de l'installation du système, un prestataire (un peu particulier : non public, non affiché sur la carte) est crée, avec comme nom 'Monnaie locale', permettant de recevoir les adhésions/cotisations et frais de reconversions.</target>
</trans-unit>
<trans-unit id="SXv7upP" resname="Cotisation bien reçue. Merci !">
<source>Cotisation bien reçue. Merci !</source>
<target>Cotisation bien reçue. Merci !</target>
</trans-unit>
<trans-unit id="xmHo2hJ" resname="Problème avec la cotisation !">
<source>Problème avec la cotisation !</source>
<target>Problème avec la cotisation !</target>
</trans-unit>
<trans-unit id="bdxv64W" resname="Création de votre compte adhérent">
<source>Création de votre compte adhérent</source>
<target>Création de votre compte adhérent</target>
</trans-unit>
<trans-unit id="gnDd9YB" resname="Prestataires du groupe">
<source>Prestataires du groupe</source>
<target>Prestataires du groupe</target>
</trans-unit>
<trans-unit id="V7y1CE4" resname="Solde de votre compte">
<source>Solde de votre compte</source>
<target>Solde de votre compte</target>
</trans-unit>
<trans-unit id="CODc.dD" resname="Taux de reconversion">
<source>Taux de reconversion</source>
<target>Taux de reconversion</target>
</trans-unit>
<trans-unit id="i05c_4k" resname="Cotiser pour l'année">
<source>Cotiser pour l'année</source>
<target>Cotiser pour l'année</target>
</trans-unit>
<trans-unit id="KwABLy_" resname="Solde de eMLC">
<source>Solde de eMLC</source>
<target>Solde de eMLC</target>
</trans-unit>
<trans-unit id="WlSOCvM" resname="Montant minimum de la cotisation">
<source>Montant minimum de la cotisation</source>
<target>Montant minimum de la cotisation</target>
</trans-unit>
<trans-unit id="HC4nySe" resname="Nombre de prestataires">
<source>Nombre de prestataires</source>
<target>Nombre de prestataires</target>
</trans-unit>
<trans-unit id="cPM2uNv" resname="Nombre de partenaires">
<source>Nombre de partenaires</source>
<target>Nombre de partenaires</target>
</trans-unit>
<trans-unit id="7ikmdr1" resname="Nombre de groupes locaux">
<source>Nombre de groupes locaux</source>
<target>Nombre de groupes locaux</target>
</trans-unit>
<trans-unit id="6WrLEjb" resname="Nombre de comptoirs">
<source>Nombre de comptoirs</source>
<target>Nombre de comptoirs</target>
</trans-unit>
<trans-unit id="EQNxKHP" resname="Montant de la cotisation">
<source>Montant de la cotisation</source>
<target>Montant de la cotisation</target>
</trans-unit>
<trans-unit id="0FRZlef" resname="Valider la création de votre compte">
<source>Valider la création de votre compte</source>
<target>Valider la création de votre compte</target>
</trans-unit>
<trans-unit id="OOfGiXO" resname="Un administreur a crée votre nouveau compte MLC">
<source>Un administreur a crée votre nouveau compte MLC</source>
<target>Un administreur a crée votre nouveau compte MLC</target>
</trans-unit>
<trans-unit id="g4_aLE2" resname="Pour valider votre nouveau compte, cliquez">
<source>Pour valider votre nouveau compte, cliquez</source>
<target>Pour valider votre nouveau compte, cliquez</target>
</trans-unit>
<trans-unit id="TK7ZWvP" resname="ICI">
<source>ICI</source>
<target>ICI</target>
</trans-unit>
<trans-unit id="i69TG5r" resname="Voir sur la carte">
<source>Voir sur la carte</source>
<target>Voir sur la carte</target>
</trans-unit>
<trans-unit id="9lULPYy" resname="Cotiser en MLC">
<source>Cotiser en MLC</source>
<target>Cotiser en MLC</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
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