Commit b87e8ca2 by Damien Moulard

merge conflicts

parents f90fb86f 924cdf01
...@@ -47,6 +47,10 @@ PAYZEN_DEBUG=false ...@@ -47,6 +47,10 @@ PAYZEN_DEBUG=false
### TAV ### ### TAV ###
TAV_ENV=0 TAV_ENV=0
PRESTA_SELF_INIT_AND_EVAL=0 PRESTA_SELF_INIT_AND_EVAL=0
AUTOMATISATION_RECONVERSION=0
PRESTA_EXTRA_DATA=0
HOUSEHOLD_BASED_ALLOWANCE=0
SSA_FRIENDLY_FLUX_TYPE_NAMES=0
EMAIL_ERROR=technique@kohinos.net EMAIL_ERROR=technique@kohinos.net
EMAIL_USER_FROM=noreply@kohinos.fr EMAIL_USER_FROM=noreply@kohinos.fr
......
...@@ -66,3 +66,7 @@ templates/themes/custom/ ...@@ -66,3 +66,7 @@ templates/themes/custom/
#INTELLIJ #INTELLIJ
.idea/ .idea/
#dir containg exported reconversions xml
reconversions/*
!reconversions/.versionme
...@@ -15,6 +15,7 @@ Extensions PHP : ...@@ -15,6 +15,7 @@ Extensions PHP :
iconv iconv
mariadb (ou mysql > 8.0) mariadb (ou mysql > 8.0)
gd gd
bcmath (en environnement tav/ssa)
Installer composer si besoin Installer composer si besoin
...@@ -54,6 +55,10 @@ Copier le fichier .env.dist en .env et configurer : ...@@ -54,6 +55,10 @@ Copier le fichier .env.dist en .env et configurer :
- la variable APP_SECRET (variable secrète que vous pouvez générer à partir de cette url : http://nux.net/secret - la variable APP_SECRET (variable secrète que vous pouvez générer à partir de cette url : http://nux.net/secret
- s'il s'agit d'une instance TAV, mettre la variable TAV_ENV à 1 (sinon la laisser à zéro) - s'il s'agit d'une instance TAV, mettre la variable TAV_ENV à 1 (sinon la laisser à zéro)
- en environnement TAV, pour activer le parcours d'inscription autonomisé qui intègre la réponse à une questionnaire d'auto-évaluation pour les points de vente, passer PRESTA_SELF_INIT_AND_EVAL à 1 - en environnement TAV, pour activer le parcours d'inscription autonomisé qui intègre la réponse à une questionnaire d'auto-évaluation pour les points de vente, passer PRESTA_SELF_INIT_AND_EVAL à 1
- en environnement TAV, la variable AUTOMATISATION_RECONVERSION permet d'activer l'automatisation des reconversions
- en environnement TAV, la variable PRESTA_EXTRA_DATA permet d'indiquer puis d'afficher publiquement plus de données concernant les prestataires (e.g. familles de produits)
- en environnement TAV, la variable HOUSEHOLD_BASED_ALLOWANCE permet d'activer un mode de cotisations libres et d'allocations basées sur la composition du foyer
- en environnement TAV, la variable SSA_FRIENDLY_FLUX_TYPE_NAMES permet d'adapter le nommage des types de flux à un projet de type ssa
Si vous utilisez Payzen comme moyen de paiement par CB : Si vous utilisez Payzen comme moyen de paiement par CB :
...@@ -82,13 +87,12 @@ Création des tables et des contraintes : ...@@ -82,13 +87,12 @@ Création des tables et des contraintes :
Charger les fixtures standards : Charger les fixtures standards :
Pour une instance non TAV : Pour une instance non SSA :
**$ php bin/console hautelook:fixtures:load --purge-with-truncate --env=pro**
**$ php bin/console hautelook:fixtures:load --purge-with-truncate --env=pro** Pour une instance TAV, ou bien :
**$ php bin/console hautelook:fixtures:load --purge-with-truncate --env=tavpro**
Pour une instance TAV : ou bien :
**$ php bin/console hautelook:fixtures:load --purge-with-truncate --env=ssagirondepro**
**$ php bin/console hautelook:fixtures:load --purge-with-truncate --env=tavpro**
Vous obtiendrez cette erreur ci dessous, c'est normal ! Vous obtiendrez cette erreur ci dessous, c'est normal !
...@@ -97,13 +101,13 @@ There is no main category related to context: rubrique ...@@ -97,13 +101,13 @@ There is no main category related to context: rubrique
**$ php bin/console sonata:media:fix-media-context** **$ php bin/console sonata:media:fix-media-context**
Pour une instance non TAV : Pour une instance non SSA :
**$ php bin/console hautelook:fixtures:load --append --env=pro**
**$ php bin/console hautelook:fixtures:load --append --env=pro** Pour une instance TAV, ou bien :
**$ php bin/console hautelook:fixtures:load --append --env=tavpro**
Pour une instance TAV : ou bien :
**$ php bin/console hautelook:fixtures:load --append --env=ssagirondepro**
**$ php bin/console hautelook:fixtures:load --append --env=tavpro**
Supprimer le cache (si besoin) Supprimer le cache (si besoin)
...@@ -145,7 +149,9 @@ Une fois tout installé, éventuellement changer le logo et favicon situés dans ...@@ -145,7 +149,9 @@ Une fois tout installé, éventuellement changer le logo et favicon situés dans
Une fois Payzen configuré sur le Kohinos, il faut le configurer sur le Back Office de Payzen : Une fois Payzen configuré sur le Kohinos, il faut le configurer sur le Back Office de Payzen :
Paramétrage -> Boutique : configurer les 2 "URL de retour de la boutique" avec la page d'accueil du site. Paramétrage -> Boutique : configurer les 2 "URL de retour de la boutique" avec la page d'accueil du site.
Paramétrage -> Règles de notification -> URL de notification à la fin du paiement : dans le 2ème encadré, renseigner les 2 champs avec [url_du_site]/payment/done Paramétrage -> Règles de notification -> URL de notification à la fin du paiement : dans le 2ème encadré, renseigner les 2 champs avec [url_du_site]/payment/notify
Paramétrage -> Règles de notification -> URL de notification à la création d'un abonnement (mal nommé à mon avis car utilisé à chaque échéance) : dans le 2ème encadré, renseigner les 2 champs avec [url_du_site]/payment/notify
Remarque : les URLS de notification sont réécrites par Payum à la même valeur dans le cadre de sa configuration par défaut
Une fois l'installation et la configuration du Kohinos terminées, il est conseillé de réaliser un premier paiement afin de tester le bon fonctionnement de la communication avec Payzen en environnement de production. Une fois l'installation et la configuration du Kohinos terminées, il est conseillé de réaliser un premier paiement afin de tester le bon fonctionnement de la communication avec Payzen en environnement de production.
......
...@@ -2154,4 +2154,14 @@ https://github.com/sonata-project/SonataAdminBundle/issues/4022 ...@@ -2154,4 +2154,14 @@ https://github.com/sonata-project/SonataAdminBundle/issues/4022
width: 0.1px !important; width: 0.1px !important;
height: 0.1px !important; height: 0.1px !important;
opacity: 0.01 !important; opacity: 0.01 !important;
}
.prestataire-products-families-row {
display: flex;
gap: 10px;
}
.prestataire-products-families-row .form-group {
flex-basis: 50%;
margin-bottom: 5px;
} }
\ No newline at end of file
...@@ -111,7 +111,7 @@ legend.required:after { ...@@ -111,7 +111,7 @@ legend.required:after {
margin-bottom: 20px; margin-bottom: 20px;
} }
.formEncaisserCotisationAdherent-no-profile { .formEncaisserCotisationAdherent-no-cotisation-amount {
font-style: italic; font-style: italic;
color: #ff4136; color: #ff4136;
} }
...@@ -291,6 +291,17 @@ form[name="formEncaissement"] label { ...@@ -291,6 +291,17 @@ form[name="formEncaissement"] label {
} }
} }
/**
* END Success check animation.
*/
#display-balance-text-container {
display: flex;
justify-content: center;
align-items: center;
gap: 10px;
}
#login-password-container { #login-password-container {
position: relative; position: relative;
} }
...@@ -330,6 +341,96 @@ form[name="formEncaissement"] label { ...@@ -330,6 +341,96 @@ form[name="formEncaissement"] label {
border-color: transparent transparent black transparent; border-color: transparent transparent black transparent;
} }
.global-evaluation-container {
background-color:powderblue;
border-radius:10px;
border: 5px solid powderblue;
}
.review-container {
background-color:#CBC3E3;
border-radius:10px;
border: 5px solid #CBC3E3;
}
/** /**
* END Success check animation. * END Success check animation.
*/ */
\ No newline at end of file
.prestaquizz_temporary_save_container {
position: fixed;
bottom: 0;
right: 1rem;
z-index: 2;
}
.presta-products-family {
display: flex;
margin-bottom: 1rem;
}
.presta-products-family-fields {
width: 95%;
}
.presta-products-family-delete {
width: 5%;
text-align: end;
}
.presta-products-family-form-group {
display: flex;
gap: 5px;
align-items: center;
margin-bottom: 0.25rem !important;
}
.presta-products-family-form-group label {
width: 40%;
margin-bottom: 0;
}
.delete-icon {
color: #ff4136;
}
.delete-icon:hover {
cursor: pointer;
color: #a02923;
}
.presta-products-family-duplicate-warning {
display: none;
color: #ff4136;
margin-top: -0.25rem;
text-align: right;
font-style: italic;
}
.presta-conventionnement-applied-text {
margin-top: -0.75rem !important;
margin-bottom: 1rem;
font-size: 100%;
}
.montant-panier-error {
margin-top: -0.75rem !important;
margin-bottom: 1rem;
font-size: 100%;
color: #ff4136;
}
.input-error {
border-color: #ff4136 !important;
}
.input-error:focus {
box-shadow: 0 0 0 0.2rem #ff403667 !important;
}
.text-error {
color: #ff4136;
}
.tav-cotisation-payment-form {
display: none;
margin-top: 1rem;
}
\ No newline at end of file
...@@ -70,7 +70,7 @@ $(document).ready(function() { ...@@ -70,7 +70,7 @@ $(document).ready(function() {
}); });
}); });
// Hide or display Cotisation or Profils de Cotisation submenu depending on TAV env // Hide or display Cotisation, Profils de Cotisation and Products Families submenu depending on TAV env
const tav_env = document.getElementsByName('is-tav-env')[0].getAttribute('content'); const tav_env = document.getElementsByName('is-tav-env')[0].getAttribute('content');
let linksToCotisationAdherent = $('a[href="/admin/cotisation_adherent/list"]'); let linksToCotisationAdherent = $('a[href="/admin/cotisation_adherent/list"]');
...@@ -91,6 +91,12 @@ $(document).ready(function() { ...@@ -91,6 +91,12 @@ $(document).ready(function() {
linksToProfilDeCotisation[i].parentNode.style.display = (tav_env === "1") ? "" : "none"; linksToProfilDeCotisation[i].parentNode.style.display = (tav_env === "1") ? "" : "none";
} }
} }
let linksToProductsFamily = $('a[href="/admin/app/productfamily/list"]');
for(let i = 0 ; i < linksToProductsFamily.length ; i++) {
if(linksToProductsFamily[i].innerText === "Familles de produits") {
linksToProductsFamily[i].parentNode.style.display = (tav_env === "1") ? "" : "none";
}
}
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
"ext-intl": "*", "ext-intl": "*",
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"andrew-svirin/ebics-client-php": "^2.1",
"api-platform/core": "^2.6", "api-platform/core": "^2.6",
"beberlei/doctrineextensions": "^1.3", "beberlei/doctrineextensions": "^1.3",
"composer/package-versions-deprecated": "1.*", "composer/package-versions-deprecated": "1.*",
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
"doctrine/doctrine-migrations-bundle": "^3.0", "doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/migrations": "^3.1", "doctrine/migrations": "^3.1",
"doctrine/orm": "^2.7", "doctrine/orm": "^2.7",
"ekyna/payum-payzen": "@dev",
"friendsofsymfony/user-bundle": "^2.1", "friendsofsymfony/user-bundle": "^2.1",
"gamez/ramsey-uuid-normalizer": "^2.1", "gamez/ramsey-uuid-normalizer": "^2.1",
"geocoder-php/cache-provider": "^4.3", "geocoder-php/cache-provider": "^4.3",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a59b75dfa4cd00a3ccefd4cda875dd52", "content-hash": "9f1667eb8d3defce6dc7895876f07cd5",
"packages": [ "packages": [
{ {
"name": "alcohol/iso4217", "name": "alcohol/iso4217",
...@@ -60,6 +60,82 @@ ...@@ -60,6 +60,82 @@
"time": "2019-10-30T10:03:42+00:00" "time": "2019-10-30T10:03:42+00:00"
}, },
{ {
"name": "andrew-svirin/ebics-client-php",
"version": "v2.1.2",
"source": {
"type": "git",
"url": "https://github.com/andrew-svirin/ebics-client-php.git",
"reference": "1692d4d5f2daab29c62bef6c54a0258d6fc927d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/andrew-svirin/ebics-client-php/zipball/1692d4d5f2daab29c62bef6c54a0258d6fc927d6",
"reference": "1692d4d5f2daab29c62bef6c54a0258d6fc927d6",
"shasum": ""
},
"require": {
"ext-bcmath": "*",
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-openssl": "*",
"ext-zip": "*",
"ext-zlib": "*",
"php": "^7.4 || ^8"
},
"require-dev": {
"andrew-svirin/cfonb-php": "dev-master",
"andrew-svirin/mt942-php": "dev-master",
"mpdf/mpdf": "~8.0.17",
"phpseclib/phpseclib": "~2.0.35",
"phpstan/phpstan": "~1.9.17",
"phpunit/phpunit": "~9.6.3",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"squizlabs/php_codesniffer": "~3.7.1"
},
"suggest": {
"andrew-svirin/cfonb-php": "If you need to parse format CFONB from FDL requests.",
"andrew-svirin/mt942-php": "If you need to parse format MT942 from VMK, STA requests.",
"mpdf/mpdf": "If you need to generate PDF file letter for Bank.",
"psr/http-client": "If you want use the PsrHttpClient",
"psr/http-factory": "If you want use the PsrHttpClient"
},
"type": "library",
"autoload": {
"psr-4": {
"AndrewSvirin\\Ebics\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andrew Svirin"
}
],
"description": "PHP library to communicate with bank through EBICS protocol.",
"keywords": [
"cfonb.120",
"cfonb.240",
"client",
"ebics",
"mt940",
"mt942",
"openssl",
"php",
"rsa",
"x509"
],
"support": {
"issues": "https://github.com/andrew-svirin/ebics-client-php/issues",
"source": "https://github.com/andrew-svirin/ebics-client-php/tree/v2.1.2"
},
"time": "2023-08-16T18:19:58+00:00"
},
{
"name": "api-platform/core", "name": "api-platform/core",
"version": "v2.6.8", "version": "v2.6.8",
"source": { "source": {
...@@ -2450,7 +2526,7 @@ ...@@ -2450,7 +2526,7 @@
}, },
{ {
"name": "ekyna/payum-payzen", "name": "ekyna/payum-payzen",
"version": "dev-master", "version": "dev-5691-paiement-reccurent-payzen",
"dist": { "dist": {
"type": "path", "type": "path",
"url": "./lib/ekyna/payum-payzen", "url": "./lib/ekyna/payum-payzen",
......
...@@ -19,6 +19,7 @@ framework: ...@@ -19,6 +19,7 @@ framework:
cookie_secure: 'auto' cookie_secure: 'auto'
cookie_samesite: 'lax' cookie_samesite: 'lax'
# name: Kohinossessid # name: Kohinossessid
gc_probability: null
#esi: true #esi: true
#fragments: true #fragments: true
......
...@@ -331,6 +331,14 @@ sonata_admin: ...@@ -331,6 +331,14 @@ sonata_admin:
icon: '<i class="fa fa-upload"></i>' icon: '<i class="fa fa-upload"></i>'
items: items:
- admin.import - admin.import
sonata.admin.productsFamily:
keep_open: false
on_top: true
label: "Familles de produits"
label_catalogue: SonataAdminBundle
icon: '<i class="fa fa-shopping-basket"></i>'
items:
- admin.productsFamily
sonata.admin.group.globalparameter: sonata.admin.group.globalparameter:
keep_open: false keep_open: false
on_top: true on_top: true
......
...@@ -12,4 +12,8 @@ twig: ...@@ -12,4 +12,8 @@ twig:
'%kernel.project_dir%/templates/themes/kohinos': kohinos '%kernel.project_dir%/templates/themes/kohinos': kohinos
globals: globals:
tav_env: '%env(TAV_ENV)%' tav_env: '%env(TAV_ENV)%'
presta_self_init_and_eval: '%env(PRESTA_SELF_INIT_AND_EVAL)%' presta_self_init_and_eval: '%env(PRESTA_SELF_INIT_AND_EVAL)%'
\ No newline at end of file presta_extra_data: '%env(PRESTA_EXTRA_DATA)%'
household_based_allowance: '%env(HOUSEHOLD_BASED_ALLOWANCE)%'
automatisation_reconversion: '%env(AUTOMATISATION_RECONVERSION)%'
ssa_friendly_flux_type_names: '%env(SSA_FRIENDLY_FLUX_TYPE_NAMES)%'
\ No newline at end of file
...@@ -14,6 +14,11 @@ parameters: ...@@ -14,6 +14,11 @@ parameters:
sonata.media.admin.gallery.class: 'App\Admin\GalleryAdmin' sonata.media.admin.gallery.class: 'App\Admin\GalleryAdmin'
tav_env: '%env(TAV_ENV)%' tav_env: '%env(TAV_ENV)%'
presta_self_init_and_eval: '%env(PRESTA_SELF_INIT_AND_EVAL)%' presta_self_init_and_eval: '%env(PRESTA_SELF_INIT_AND_EVAL)%'
automatisation_reconversion: '%env(AUTOMATISATION_RECONVERSION)%'
presta_extra_data: '%env(PRESTA_EXTRA_DATA)%'
household_based_allowance: '%env(HOUSEHOLD_BASED_ALLOWANCE)%'
ssa_friendly_flux_type_names: '%env(SSA_FRIENDLY_FLUX_TYPE_NAMES)%'
# PARAMETRES DES IMPORTS POSSIBLE POUR L'APPLICATION DE GESTION DE MONNAIE LOCALE COMPLEMENTAIRE # PARAMETRES DES IMPORTS POSSIBLE POUR L'APPLICATION DE GESTION DE MONNAIE LOCALE COMPLEMENTAIRE
app.import.separator: ';' app.import.separator: ';'
...@@ -125,6 +130,10 @@ services: ...@@ -125,6 +130,10 @@ services:
public: true public: true
arguments: ['@app.utils.custom_entity_manager', '@security.helper', '@app.utils.operations'] arguments: ['@app.utils.custom_entity_manager', '@security.helper', '@app.utils.operations']
app.utils.payment:
class: App\Utils\PaymentUtils
autowire: true
app.twig.main.extension: app.twig.main.extension:
class: App\Twig\AppExtension class: App\Twig\AppExtension
autowire: false autowire: false
...@@ -249,7 +258,7 @@ services: ...@@ -249,7 +258,7 @@ services:
admin.adherent.gerer: admin.adherent.gerer:
class: App\Admin\AdherentAdmin class: App\Admin\AdherentAdmin
# arguments: [~, App\Entity\OBJECT, 'PixSortableBehaviorBundle:SortableAdmin'] # arguments: [~, App\Entity\OBJECT, 'PixSortableBehaviorBundle:SortableAdmin']
arguments: [~, App\Entity\Adherent, 'App\Controller\CRUD\CRUDController'] arguments: [~, App\Entity\Adherent, 'App\Controller\AdherentAdminController']
tags: tags:
- name: sonata.admin - name: sonata.admin
manager_type: orm manager_type: orm
...@@ -263,6 +272,7 @@ services: ...@@ -263,6 +272,7 @@ services:
- [ setUserManager, ['@fos_user.user_manager']] - [ setUserManager, ['@fos_user.user_manager']]
- [ setSecurity, ['@security.helper']] - [ setSecurity, ['@security.helper']]
- [ setEventDispatcher, ['@event_dispatcher']] - [ setEventDispatcher, ['@event_dispatcher']]
- [ setTavCotisationUtils, ['@app.utils.tav_cotisations']]
admin.all.cotisations: admin.all.cotisations:
class: App\Admin\CotisationAdmin class: App\Admin\CotisationAdmin
...@@ -658,6 +668,16 @@ services: ...@@ -658,6 +668,16 @@ services:
show_mosaic_button: false show_mosaic_button: false
public: true public: true
admin.productsFamily:
class: App\Admin\ProductFamilyAdmin
arguments: [~, App\Entity\ProductFamily, ~]
tags:
- name: sonata.admin
manager_type: orm
group: "Familles de Produits"
label: "Familles de Produits"
public: true
sonata.media.provider.csv: sonata.media.provider.csv:
class: App\Admin\ImportProvider class: App\Admin\ImportProvider
tags: tags:
......
...@@ -61,6 +61,20 @@ class CaptureAction implements ActionInterface, GatewayAwareInterface, GenericTo ...@@ -61,6 +61,20 @@ class CaptureAction implements ActionInterface, GatewayAwareInterface, GenericTo
); );
$model['vads_url_check'] = $notifyToken->getTargetUrl(); $model['vads_url_check'] = $notifyToken->getTargetUrl();
} }
// Set recurrent payment data if needed
$payment = $request->getFirstModel();
if (true == $payment->getIsRecurrent()) {
$model['vads_page_action'] = 'REGISTER_PAY_SUBSCRIBE';
$model['vads_sub_amount'] = strval($payment->getRecurrenceAmount()); // 1000 for 10.00 EUR
$model['vads_sub_currency'] = $model['vads_currency'];
$model['vads_sub_effect_date'] = (new \DateTime('tomorrow', new \DateTimeZone('UTC')))->format('Ymd'); // tomorrow, to avoid duplicate payment this day
//FOR TEST : $model['vads_sub_desc'] = 'RRULE:FREQ=DAILY;INTERVAL=1;COUNT=2';
$count = $payment->getRecurrenceMonthsCount() - 1; //initial payment is not considered by payzen as the first occurence
$monthDay = $payment->getRecurrenceMonthDay();
$model['vads_sub_desc'] = "RRULE:FREQ=MONTHLY;COUNT={$count};BYMONTHDAY={$monthDay}";
}
} }
if (false == $model['vads_trans_id']) { if (false == $model['vads_trans_id']) {
......
...@@ -126,7 +126,6 @@ class Api ...@@ -126,7 +126,6 @@ class Api
$data = $this $data = $this
->getRequestOptionsResolver() ->getRequestOptionsResolver()
->resolve(array_replace($data, [ ->resolve(array_replace($data, [
'vads_page_action' => 'PAYMENT',
'vads_version' => 'V2', 'vads_version' => 'V2',
])); ]));
...@@ -353,6 +352,10 @@ class Api ...@@ -353,6 +352,10 @@ class Api
'vads_url_return' => null, // Obligatoire si acquisition de la carte par commerçant 'vads_url_return' => null, // Obligatoire si acquisition de la carte par commerçant
'vads_user_info' => null, 'vads_user_info' => null,
'vads_version' => 'V2', 'vads_version' => 'V2',
'vads_sub_amount' => null,
'vads_sub_currency' => null,
'vads_sub_effect_date' => null,
'vads_sub_desc' => null,
]) ])
->setRequired([ ->setRequired([
'vads_amount', 'vads_amount',
...@@ -365,7 +368,7 @@ class Api ...@@ -365,7 +368,7 @@ class Api
->setAllowedValues('vads_action_mode', ['SILENT', 'INTERACTIVE']) ->setAllowedValues('vads_action_mode', ['SILENT', 'INTERACTIVE'])
->setAllowedValues('vads_currency', $this->getCurrencyCodes()) ->setAllowedValues('vads_currency', $this->getCurrencyCodes())
->setAllowedValues('vads_language', $this->getLanguageCodes()) ->setAllowedValues('vads_language', $this->getLanguageCodes())
->setAllowedValues('vads_page_action', 'PAYMENT') ->setAllowedValues('vads_page_action', ['PAYMENT', 'REGISTER_PAY_SUBSCRIBE'])
->setAllowedValues('vads_payment_cards', $this->getCardsCodes()) ->setAllowedValues('vads_payment_cards', $this->getCardsCodes())
->setAllowedValues('vads_payment_config', function ($value) { ->setAllowedValues('vads_payment_config', function ($value) {
if ($value === 'SINGLE') { if ($value === 'SINGLE') {
......
...@@ -3359,9 +3359,9 @@ ...@@ -3359,9 +3359,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001491", "version": "1.0.30001589",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001491.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001589.tgz",
"integrity": "sha512-17EYIi4TLnPiTzVKMveIxU5ETlxbSO3B6iPvMbprqnKh4qJsQGk5Nh1Lp4jIMAE0XfrujsJuWZAM3oJdMHaKBA==", "integrity": "sha512-vNQWS6kI+q6sBlHbh71IIeC+sRwK2N3EDySc/updIGhIee2x5z00J4c1242/5/d6EpEMdOnk/m+6tuk4/tcsqg==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
...@@ -12880,9 +12880,9 @@ ...@@ -12880,9 +12880,9 @@
} }
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30001491", "version": "1.0.30001589",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001491.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001589.tgz",
"integrity": "sha512-17EYIi4TLnPiTzVKMveIxU5ETlxbSO3B6iPvMbprqnKh4qJsQGk5Nh1Lp4jIMAE0XfrujsJuWZAM3oJdMHaKBA==", "integrity": "sha512-vNQWS6kI+q6sBlHbh71IIeC+sRwK2N3EDySc/updIGhIee2x5z00J4c1242/5/d6EpEMdOnk/m+6tuk4/tcsqg==",
"dev": true "dev": true
}, },
"chalk": { "chalk": {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/> <server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
<server name="SYMFONY_PHPUNIT_VERSION" value="7.5"/> <server name="SYMFONY_PHPUNIT_VERSION" value="7.5"/>
<server name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" /> <server name="SYMFONY_DEPRECATIONS_HELPER" value="disabled" />
<env name="KERNEL_CLASS" value="App\Kernel"/>
</php> </php>
<testsuites> <testsuites>
<testsuite name="Project Test Suite"> <testsuite name="Project Test Suite">
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3,19 +3,19 @@ ...@@ -3,19 +3,19 @@
"app": { "app": {
"js": [ "js": [
"/build/runtime.6ad5c9da.js", "/build/runtime.6ad5c9da.js",
"/build/app.a8f5cd0d.js" "/build/app.3644f7b2.js"
], ],
"css": [ "css": [
"/build/app.9c351632.css" "/build/app.8a3f698b.css"
] ]
}, },
"admin": { "admin": {
"js": [ "js": [
"/build/runtime.6ad5c9da.js", "/build/runtime.6ad5c9da.js",
"/build/admin.cee4d78d.js" "/build/admin.86a2d986.js"
], ],
"css": [ "css": [
"/build/admin.5dc0eea7.css" "/build/admin.4de55830.css"
] ]
} }
} }
......
{ {
"build/app.css": "/build/app.9c351632.css", "build/app.css": "/build/app.8a3f698b.css",
"build/app.js": "/build/app.a8f5cd0d.js", "build/app.js": "/build/app.3644f7b2.js",
"build/admin.css": "/build/admin.5dc0eea7.css", "build/admin.css": "/build/admin.4de55830.css",
"build/admin.js": "/build/admin.cee4d78d.js", "build/admin.js": "/build/admin.86a2d986.js",
"build/runtime.js": "/build/runtime.6ad5c9da.js", "build/runtime.js": "/build/runtime.6ad5c9da.js",
"build/images/fa-solid-900.svg": "/build/images/fa-solid-900.a838c42a.svg", "build/images/fa-solid-900.svg": "/build/images/fa-solid-900.a838c42a.svg",
"build/images/fa-brands-400.svg": "/build/images/fa-brands-400.05d20183.svg", "build/images/fa-brands-400.svg": "/build/images/fa-brands-400.05d20183.svg",
......
...@@ -27,9 +27,17 @@ class AchatMonnaieAdmin extends FluxAdmin ...@@ -27,9 +27,17 @@ class AchatMonnaieAdmin extends FluxAdmin
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$query = parent::createQuery($context); $query = parent::createQuery($context);
$query->andWhere($query->getRootAliases()[0] . '.parenttype = :parenttype') //In mode ssa_friendly_flux_type_names, we display on this page all cotisation
//initial operation (i.e. we display vente_emlc operations in addition to achat_monnaie)
if($this->getConfigurationPool()->getContainer()->getParameter('tav_env')
&& $this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names')) {
$query->andWhere($query->getRootAliases()[0] . '.parenttype = :parenttype' . ' OR ' . $query->getRootAliases()[0] . '.parenttype = :parenttype2')
->setParameter('parenttype', Flux::TYPE_ACHAT)
->setParameter('parenttype2', Flux::TYPE_VENTE_EMLC);
} else {
$query->andWhere($query->getRootAliases()[0] . '.parenttype = :parenttype')
->setParameter('parenttype', Flux::TYPE_ACHAT); ->setParameter('parenttype', Flux::TYPE_ACHAT);
}
return $query; return $query;
} }
...@@ -43,17 +51,24 @@ class AchatMonnaieAdmin extends FluxAdmin ...@@ -43,17 +51,24 @@ class AchatMonnaieAdmin extends FluxAdmin
*/ */
protected function configureDatagridFilters(DatagridMapper $datagridMapper): void protected function configureDatagridFilters(DatagridMapper $datagridMapper): void
{ {
$datagridMapper->add('type', null, [ //In mode ssa_friendly_flux_type_names, we display on this page all cotisation
'advanced_filter' => false, //initial operation (i.e. we display vente_emlc operations in addition to achat_monnaie)
'show_filter' => true, //therefore filtering by type achat_monnaie_adherent VS achat_monnaie_prestataire
'field_type' => ChoiceType::class, //would be confusing (selecting one of them would hide all vente_emlc operations)
'field_options' => [ if(!$this->getConfigurationPool()->getContainer()->getParameter('tav_env')
'choices' => ['Adhérent' => 'achat_monnaie_adherent', 'Prestataire' => 'achat_monnaie_prestataire'], || !$this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names')) {
'placeholder' => 'Indifférent', $datagridMapper->add('type', null, [
'expanded' => true, 'advanced_filter' => false,
'multiple' => false, 'show_filter' => true,
], 'field_type' => ChoiceType::class,
]); 'field_options' => [
'choices' => ['Adhérent' => 'achat_monnaie_adherent', 'Prestataire' => 'achat_monnaie_prestataire'],
'placeholder' => 'Indifférent',
'expanded' => true,
'multiple' => false,
],
]);
}
} }
/** /**
...@@ -81,12 +96,24 @@ class AchatMonnaieAdmin extends FluxAdmin ...@@ -81,12 +96,24 @@ class AchatMonnaieAdmin extends FluxAdmin
$datagrid->buildPager(); $datagrid->buildPager();
$query = clone $datagrid->getQuery(); $query = clone $datagrid->getQuery();
$query if($this->getConfigurationPool()->getContainer()->getParameter('tav_env')
->select('SUM( ' . $query->getRootAlias() . '.montant) as total') && $this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names')) {
->andWhere($query->getRootAlias() . '.parenttype = :parenttype') $query
->setParameter('parenttype', Flux::TYPE_ACHAT) ->select('SUM( ' . $query->getRootAlias() . '.montant) as total')
->setFirstResult(null) ->andWhere($query->getRootAlias() . '.parenttype = :parenttype' . ' OR ' . $query->getRootAliases()[0] . '.parenttype = :parenttype2')
->setMaxResults(null); ->setParameter('parenttype', Flux::TYPE_ACHAT)
->setParameter('parenttype2', Flux::TYPE_VENTE_EMLC)
->setFirstResult(null)
->setMaxResults(null);
} else {
$query
->select('SUM( ' . $query->getRootAlias() . '.montant) as total')
->andWhere($query->getRootAlias() . '.parenttype = :parenttype')
->setParameter('parenttype', Flux::TYPE_ACHAT)
->setFirstResult(null)
->setMaxResults(null);
}
$result = $query->execute([], \Doctrine\ORM\Query::HYDRATE_SINGLE_SCALAR); $result = $query->execute([], \Doctrine\ORM\Query::HYDRATE_SINGLE_SCALAR);
......
...@@ -64,6 +64,8 @@ class FluxAdmin extends AbstractAdmin ...@@ -64,6 +64,8 @@ class FluxAdmin extends AbstractAdmin
protected function configureExportFields(): array protected function configureExportFields(): array
{ {
$ssaFriendlyTypeNames = $this->getConfigurationPool()->getContainer()->getParameter('tav_env')
&& $this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names');
return [ return [
$this->trans('Date') => 'createdAt', $this->trans('Date') => 'createdAt',
$this->trans('Expediteur') => 'expediteur', $this->trans('Expediteur') => 'expediteur',
...@@ -91,10 +93,12 @@ class FluxAdmin extends AbstractAdmin ...@@ -91,10 +93,12 @@ class FluxAdmin extends AbstractAdmin
*/ */
protected function configureListFields(ListMapper $listMapper) protected function configureListFields(ListMapper $listMapper)
{ {
$ssaFriendlyTypeNames = $this->getConfigurationPool()->getContainer()->getParameter('tav_env')
&& $this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names');
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->add('createdAt', 'datetime', ['label' => 'Date']) ->add('createdAt', 'datetime', ['label' => 'Date'])
->add('type', 'text', ['label' => 'Type', 'template' => '@kohinos/bundles/SonataAdminBundle/Block/translated_value.html.twig']) ->add($ssaFriendlyTypeNames ? 'ssaFriendlyTypeName' : 'type', 'text', ['label' => 'Type', 'template' => '@kohinos/bundles/SonataAdminBundle/Block/translated_value.html.twig'])
->add('montant', 'decimal', ['label' => 'Montant', 'attributes' => ['fraction_digits' => 2]]) ->add('montant', 'decimal', ['label' => 'Montant', 'attributes' => ['fraction_digits' => 2]])
->add('expediteur', null, ['label' => 'Expediteur']) ->add('expediteur', null, ['label' => 'Expediteur'])
->add('destinataire', null, ['label' => 'Destinataire']) ->add('destinataire', null, ['label' => 'Destinataire'])
...@@ -110,6 +114,11 @@ class FluxAdmin extends AbstractAdmin ...@@ -110,6 +114,11 @@ class FluxAdmin extends AbstractAdmin
*/ */
protected function configureDatagridFilters(DatagridMapper $datagridMapper): void protected function configureDatagridFilters(DatagridMapper $datagridMapper): void
{ {
$ssaFriendlyTypeNames = $this->getConfigurationPool()->getContainer()->getParameter('tav_env')
&& $this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names');
$choices = $ssaFriendlyTypeNames ? //in ssa mode, remove flux types that are irrelevant or confusing
['Transactions' => Flux::TYPE_TRANSACTION]
: ['Cotisations' => Flux::TYPE_COTISATION, 'Achat de monnaie' => Flux::TYPE_ACHAT, 'Dépôt de billets' => Flux::TYPE_CHANGE, 'Retrait' => Flux::TYPE_RETRAIT, 'Transactions' => Flux::TYPE_TRANSACTION, 'Transferts' => Flux::TYPE_TRANSFERT, 'Vente' => Flux::TYPE_VENTE];
$datagridMapper $datagridMapper
->add('transfert_or_transaction', 'doctrine_orm_callback', [ ->add('transfert_or_transaction', 'doctrine_orm_callback', [
'label' => 'Type', 'label' => 'Type',
...@@ -127,17 +136,32 @@ class FluxAdmin extends AbstractAdmin ...@@ -127,17 +136,32 @@ class FluxAdmin extends AbstractAdmin
'show_filter' => true, 'show_filter' => true,
'field_type' => SChoiceType::class, 'field_type' => SChoiceType::class,
'field_options' => [ 'field_options' => [
'choices' => ['Cotisations' => Flux::TYPE_COTISATION, 'Achat de monnaie' => Flux::TYPE_ACHAT, 'Dépôt de billets' => Flux::TYPE_CHANGE, 'Retrait' => Flux::TYPE_RETRAIT, 'Transactions' => Flux::TYPE_TRANSACTION, 'Transferts' => Flux::TYPE_TRANSFERT, 'Vente' => Flux::TYPE_VENTE], 'choices' => $choices,
'placeholder' => 'Indifférent', 'placeholder' => 'Indifférent',
'expanded' => true, 'expanded' => true,
'multiple' => false, 'multiple' => false,
], ],
]) ]);
->add('type', null, [ if ($ssaFriendlyTypeNames) {
'label' => 'Type plus précis', $datagridMapper
'advanced_filter' => false, ->add('type', null, [
'show_filter' => true, 'label' => 'Type plus précis',
]) 'advanced_filter' => false,
'show_filter' => true,
'field_type' => SChoiceType::class,
'field_options' => [
'choices' => array_flip(Flux::ssaUsefulFriendlyTypeNames(true))
]
]);
} else {
$datagridMapper
->add('type', null, [
'label' => 'Type plus précis',
'advanced_filter' => false,
'show_filter' => true,
]);
}
$datagridMapper
->add('operateur', null, [ ->add('operateur', null, [
'label' => 'Operateur', 'label' => 'Operateur',
'advanced_filter' => false, 'advanced_filter' => false,
...@@ -182,9 +206,11 @@ class FluxAdmin extends AbstractAdmin ...@@ -182,9 +206,11 @@ class FluxAdmin extends AbstractAdmin
public function getExportFields() public function getExportFields()
{ {
$ssaFriendlyTypeNames = $this->getConfigurationPool()->getContainer()->getParameter('tav_env')
&& $this->getConfigurationPool()->getContainer()->getParameter('ssa_friendly_flux_type_names');
return [ return [
'Date' => 'created_at', 'Date' => 'created_at',
'Type' => 'type', 'Type' => $ssaFriendlyTypeNames ? 'ssaFriendlyTypeName' : 'type',
'Montant' => 'montant', 'Montant' => 'montant',
'Expediteur' => 'expediteur', 'Expediteur' => 'expediteur',
'Destinataire' => 'destinataire', 'Destinataire' => 'destinataire',
......
...@@ -21,6 +21,7 @@ use App\Exporter\CustomDoctrineORMQuerySourceIterator; ...@@ -21,6 +21,7 @@ use App\Exporter\CustomDoctrineORMQuerySourceIterator;
use App\Form\Type\ContactEntityFormType; use App\Form\Type\ContactEntityFormType;
use App\Form\Type\GeolocPrestataireFormType; use App\Form\Type\GeolocPrestataireFormType;
use App\Form\Type\UserFormType; use App\Form\Type\UserFormType;
use App\Form\Type\PrestataireProductFamilyFormType;
use Doctrine\ORM\Query; use Doctrine\ORM\Query;
use FOS\CKEditorBundle\Form\Type\CKEditorType; use FOS\CKEditorBundle\Form\Type\CKEditorType;
use FOS\UserBundle\Event\UserEvent; use FOS\UserBundle\Event\UserEvent;
...@@ -205,6 +206,11 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -205,6 +206,11 @@ class PrestataireAdmin extends AbstractAdmin
'label' => 'SIRET :', 'label' => 'SIRET :',
'required' => false, 'required' => false,
]) ])
//bic is new field in kohinos-ssa (I think it's OK to add it for non-tav env as well)
->add('bic', TextType::class, [
'label' => 'BIC :',
'required' => false,
])
->add('iban', PersonalDataType::class, [ ->add('iban', PersonalDataType::class, [
'label' => 'IBAN :', 'label' => 'IBAN :',
'required' => false, 'required' => false,
...@@ -352,6 +358,52 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -352,6 +358,52 @@ class PrestataireAdmin extends AbstractAdmin
->end() ->end()
->end() ->end()
; ;
/**
* In case of prestataire self init and evaluation use case activated,
* set prestataire disabled by default & add 'conventionnement' field.
*/
if ($this->getConfigurationPool()->getContainer()->getParameter('presta_self_init_and_eval')) {
$formMapper
->tab('Prestataire')
->with('Prestataire', ['class' => 'col-md-6'])
->remove('enabled')
->add('enabled', null, [
'label' => 'Activé ?',
'required' => false,
'data' => $presta && $presta->getRaison() ? $presta->isEnabled() : false, //force false at create time only
'attr' => ['autocomplete' => 'off']
])
->add('conventionnement', ChoiceType::class, [
'choices' => [
'50 %' => '0.50', //using strings (and not floats) seems required
'75 %' => '0.75', //to make display work fine
'100 %' => '1.00',
],
'required' => false,
'attr' => ['autocomplete' => 'off'] //avoid non-saved value to be displayed
])
->end()
->end();
}
if ($this->getConfigurationPool()->getContainer()->getParameter('presta_extra_data')) {
$formMapper
->tab('Prestataire')
->with('Prestataire', ['class' => 'col-md-6'])
->add('prestataireProductFamilies', CollectionType::class, [
'label' => 'Produits que le prestataire a renseigné',
'entry_type' => PrestataireProductFamilyFormType::class,
'required' => false,
'disabled' => true,
'entry_options' => [
'attr' => ['class' => 'prestataire-products-families-row'],
],
])
->end()
->end();
}
// @TODO : add tags model transformer if add new from text // @TODO : add tags model transformer if add new from text
// ->get('etats') // ->get('etats')
// ->addModelTransformer(new CallbackTransformer( // ->addModelTransformer(new CallbackTransformer(
...@@ -670,6 +722,11 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -670,6 +722,11 @@ class PrestataireAdmin extends AbstractAdmin
], ],
], ],
]; ];
if (($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_SUPER_ADMIN')) && $this->getConfigurationPool()->getContainer()->getParameter('presta_self_init_and_eval')) {
$actions['reviewPrestaQuiz'] = [
'template' => '@kohinos/tav/prestaquiz/review.html.twig'
];
}
if (null != $this->security->getUser() && ($this->security->isGranted('ROLE_SUPER_ADMIN') || $this->security->isGranted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_ALL') || $this->security->isGranted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_CREATE'))) { if (null != $this->security->getUser() && ($this->security->isGranted('ROLE_SUPER_ADMIN') || $this->security->isGranted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_ALL') || $this->security->isGranted('ROLE_ADMIN_PRESTATAIRE_COTISATIONS_CREATE'))) {
$actions['addfreecotisationpresta'] = [ $actions['addfreecotisationpresta'] = [
'template' => '@kohinos/bundles/SonataAdminBundle/CRUD/list__action_addfreecotisationpresta.html.twig', 'template' => '@kohinos/bundles/SonataAdminBundle/CRUD/list__action_addfreecotisationpresta.html.twig',
...@@ -725,7 +782,6 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -725,7 +782,6 @@ class PrestataireAdmin extends AbstractAdmin
'label' => 'Cotisation à jour', 'label' => 'Cotisation à jour',
'template' => '@kohinos/bundles/SonataAdminBundle/CRUD/list_presta_cotisation.html.twig', 'template' => '@kohinos/bundles/SonataAdminBundle/CRUD/list_presta_cotisation.html.twig',
] ]
) )
->add('users', null, [ ->add('users', null, [
'label' => 'Gestionnaires [Cotisation à jour]', 'label' => 'Gestionnaires [Cotisation à jour]',
...@@ -765,6 +821,7 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -765,6 +821,7 @@ class PrestataireAdmin extends AbstractAdmin
$collection $collection
->add('addfreecotisationpresta', $this->getRouterIdParameter() . '/addfreecotisationpresta') ->add('addfreecotisationpresta', $this->getRouterIdParameter() . '/addfreecotisationpresta')
->add('addfreecotisationadh', $this->getRouterIdParameter() . '/addfreecotisationadh') ->add('addfreecotisationadh', $this->getRouterIdParameter() . '/addfreecotisationadh')
->add('reviewprestaquiz', $this->getRouterIdParameter() . '/reviewprestaquiz')
; ;
} }
......
<?php
namespace App\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\TextType;
/**
* Administration des familles de produits.
*
* KOHINOS : Outil de gestion de Monnaie Locale Complémentaire
*/
class ProductFamilyAdmin extends AbstractAdmin
{
protected function configureFormFields(FormMapper $form): void
{
$form->add('name', TextType::class, [
'label' => 'Nom'
]);
}
protected function configureDatagridFilters(DatagridMapper $datagrid): void
{
$datagrid->add('name', null, [
'label' => 'Nom'
]);
}
protected function configureListFields(ListMapper $list): void
{
$list->addIdentifier('name', null, [
'label' => 'Nom'
]);
}
}
\ No newline at end of file
...@@ -96,4 +96,8 @@ class ReconversionAdmin extends FluxAdmin ...@@ -96,4 +96,8 @@ class ReconversionAdmin extends FluxAdmin
'Reconverti ?' => 'reconverti', 'Reconverti ?' => 'reconverti',
]; ];
} }
public function isReconversionAdmin() {
return true;
}
} }
<?php
declare(strict_types=1);
namespace App\Command;
use App\Entity\GlobalParameter;
use App\Entity\Prestataire;
use App\Entity\Reconversion;
use App\Entity\Siege;
use App\Enum\MoyenEnum;
use App\Enum\ReconversionFrequencyEnum;
use App\Utils\CustomEntityManager;
use App\Utils\OperationUtils;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Twig\Environment;
/**
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
class ReconversionMonaPrestatairesCommand extends Command
{
//Les reconversions doivent avoir lieu les dimanches soir qui précèdent les 14 et 28.
// On utilise les crons suivants :
//15 23 * * 0 [ "$(date +\%d)" -ge 08 -a "$(date +\%d)" -le 14 ] && kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:reconversion-prestataires twice_a_month
//15 23 * * 0 [ "$(date +\%d)" -ge 22 -a "$(date +\%d)" -le 28 ] && kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:reconversion-prestataires twice_a_month
//17 23 * * 0 [ "$(date +\%d)" -ge 22 -a "$(date +\%d)" -le 28 ] && kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:reconversion-prestataires once_a_month
//19 23 * 1,3,5,7,9,11 0 [ "$(date +\%d)" -ge 22 -a "$(date +\%d)" -le 28 ] && kohinos php /home/kohinos/kohinos/bin/console kohinos:ssa:reconversion-prestataires once_every_two_month
protected static $defaultName = 'kohinos:ssa:reconversion-prestataires';
protected $em;
protected $mailer;
protected $templating;
protected $io;
protected $param;
protected $operationUtils;
public function __construct(
CustomEntityManager $em,
\Swift_Mailer $mailer,
Environment $templating,
OperationUtils $operationUtils
) {
$this->em = $em;
$this->mailer = $mailer;
$this->templating = $templating;
$this->operationUtils = $operationUtils;
parent::__construct();
}
protected function configure()
{
$this
->setDescription('SSA : générer des flux de reconversion conformément à la fréquence configurée par les prestataires')
->addArgument('reconvmode', InputArgument::REQUIRED, 'Restriction aux seuls prestataires ayant opté pour la fréquence choisie.');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = new SymfonyStyle($input, $output);
$reconvmode = $input->getArgument('reconvmode');
if (!in_array($reconvmode, ReconversionFrequencyEnum::getAvailableTypes())) {
$this->io->error("L'argument " . $reconvmode . ' est invalide. Choix possibles : '
. implode(', ', ReconversionFrequencyEnum::getAvailableTypes()));
return 1;
}
$this->io->title('START. Reconversion pour les prestataires de compte positif ayant choisi la fréquence : ' . $reconvmode);
$prestas = $this->em->getRepository(Prestataire::class)->findBy(['reconversionFrequency' => $reconvmode]);
foreach ($prestas as $p) {
$balance = $p->getEmlcAccount()->getBalance();
if ($balance <= 0) {
continue;
}
/* @var Prestataire $p */
$flux = new Reconversion();
//do not fill operator as it is automated process $entity->setOperateur();
$flux->setExpediteur($p);
$flux->setMontant($balance); //montant maximal
$flux->setDestinataire($this->em->getRepository(Siege::class)->getTheOne());
$flux->setMoyen(MoyenEnum::MOYEN_AUTRE);
$flux->setTauxreconversion(
!empty($p->getTauxreconversion()) ?
$p->getTauxreconversion()
: floatval(
$this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::RECONVERSION_PRESTATAIRE)
)
);
$now = new \DateTime();
$flux->setReference(
'Reconversion automatique du ' . $now->format('d/m/Y')
. " pour le mode de reconversion " . $reconvmode
);
$this->operationUtils->executeOperations($flux);
}
$this->io->success('End');
$memoryUsage = memory_get_usage(true) / 1024 / 1024;
$this->io->text("Batch finished with memory: ${memoryUsage}M");
return 0;
}
}
<?php
namespace App\Controller;
use App\Utils\CustomEntityManager;
use App\Utils\TAVCotisationUtils;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sonata\AdminBundle\Controller\CRUDController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Security;
class AdherentAdminController extends CRUDController
{
protected $em;
protected $security;
protected $tavCotisationUtils;
public function __construct(CustomEntityManager $em, Security $security, TAVCotisationUtils $tavCotisationUtils)
{
$this->em = $em;
$this->security = $security;
$this->tavCotisationUtils = $tavCotisationUtils;
}
/**
* Prélèvement d'un adhérent pour ramener son solde sous son plafond.
*
* @param Request $request
* @param Uuid $id Id du prestataire
* @IsGranted({"ROLE_SUPER_ADMIN", "ROLE_ADMIN_SIEGE", "ROLE_TRESORIER"})
* @return Response
*/
public function withdrawDownToTheCeilingAction(Request $request, $id): Response
{
$adherent = $this->admin->getSubject();
if (!$adherent) {
throw new NotFoundHttpException(sprintf('Impossible de trouver l\'adhérent avec l\'id: %s', $id));
}
$amountDiff = $this->tavCotisationUtils->withdrawDownToTheCeiling($adherent);
$this->em->flush();
$this->addFlash(
'sonata_flash_success',
'Prélèvement de ' . -$amountDiff . ' MonA' . ' effectué.'
);
return new RedirectResponse(
$this->admin->generateUrl('list', ['filter' => $this->admin->getFilterParameters()])
);
}
}
...@@ -2,11 +2,14 @@ ...@@ -2,11 +2,14 @@
namespace App\Controller; namespace App\Controller;
use AndrewSvirin\Ebics\Builders\CustomerCreditTransfer\CustomerCreditTransferBuilder;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\Don; use App\Entity\Don;
use App\Entity\Flux; use App\Entity\Flux;
use App\Entity\GlobalParameter;
use App\Entity\Groupe; use App\Entity\Groupe;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Reconversion;
use App\Entity\User; use App\Entity\User;
use App\Enum\CurrencyEnum; use App\Enum\CurrencyEnum;
use App\Flux\FluxInterface; use App\Flux\FluxInterface;
...@@ -16,6 +19,7 @@ use App\Utils\TAVCotisationUtils; ...@@ -16,6 +19,7 @@ use App\Utils\TAVCotisationUtils;
use FOS\UserBundle\Model\UserManagerInterface; use FOS\UserBundle\Model\UserManagerInterface;
use FOS\UserBundle\Util\TokenGeneratorInterface; use FOS\UserBundle\Util\TokenGeneratorInterface;
use Gamez\Symfony\Component\Serializer\Normalizer\UuidNormalizer; use Gamez\Symfony\Component\Serializer\Normalizer\UuidNormalizer;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Sonata\Exporter\Handler; use Sonata\Exporter\Handler;
use Sonata\Exporter\Source\DoctrineORMQuerySourceIterator; use Sonata\Exporter\Source\DoctrineORMQuerySourceIterator;
use Sonata\Exporter\Writer\CsvWriter; use Sonata\Exporter\Writer\CsvWriter;
...@@ -30,6 +34,7 @@ use Symfony\Component\HttpFoundation\Response; ...@@ -30,6 +34,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Serializer\Encoder\JsonEncoder; use Symfony\Component\Serializer\Encoder\JsonEncoder;
...@@ -74,6 +79,8 @@ class FluxController extends AbstractController ...@@ -74,6 +79,8 @@ class FluxController extends AbstractController
protected $operationUtils; protected $operationUtils;
protected $tokenGenerator; protected $tokenGenerator;
protected $validator; protected $validator;
protected $userManager;
protected $router;
public function __construct( public function __construct(
Security $security, Security $security,
...@@ -86,7 +93,9 @@ class FluxController extends AbstractController ...@@ -86,7 +93,9 @@ class FluxController extends AbstractController
TAVCotisationUtils $tavCotisationsUtils, TAVCotisationUtils $tavCotisationsUtils,
TokenGeneratorInterface $tokenGenerator, TokenGeneratorInterface $tokenGenerator,
ValidatorInterface $validator, ValidatorInterface $validator,
CsrfTokenManagerInterface $tokenManager CsrfTokenManagerInterface $tokenManager,
UserManagerInterface $userManager,
RouterInterface $router
) { ) {
$this->security = $security; $this->security = $security;
$this->em = $em; $this->em = $em;
...@@ -99,6 +108,8 @@ class FluxController extends AbstractController ...@@ -99,6 +108,8 @@ class FluxController extends AbstractController
$this->validator = $validator; $this->validator = $validator;
$this->tokenManager = $tokenManager; $this->tokenManager = $tokenManager;
$this->tavCotisationsUtils = $tavCotisationsUtils; $this->tavCotisationsUtils = $tavCotisationsUtils;
$this->userManager = $userManager;
$this->router = $router;
} }
protected function manageFluxForm(Request $request, Form $form, $template = '@kohinos/flux/transaction.html.twig', $params = []) protected function manageFluxForm(Request $request, Form $form, $template = '@kohinos/flux/transaction.html.twig', $params = [])
...@@ -168,6 +179,101 @@ class FluxController extends AbstractController ...@@ -168,6 +179,101 @@ class FluxController extends AbstractController
} }
/** /**
* @param Request $request
* @Route("/credit-transfer-file", name="credit_transfer_file")
* @IsGranted({"ROLE_TRESORIER", "ROLE_SUPER_ADMIN"})
* @return Response
*/
public function creditTransferFileAction(Request $request)
{
//raison, bic and iban from debitor are fetched in global parameters
$globalParametersRepository = $this->em->getRepository(GlobalParameter::class);
$raison = $globalParametersRepository->val(GlobalParameter::VIREMENT_RECONVERSION_RAISON_GESTIONNAIRE);
$bic = $globalParametersRepository->val(GlobalParameter::VIREMENT_RECONVERSION_BIC_GESTIONNAIRE);
$iban = $globalParametersRepository->val(GlobalParameter::VIREMENT_RECONVERSION_IBAN_GESTIONNAIRE);
//make sure raison, bic and iban are not empty
if(!$raison || !$bic || !$iban) {
$this->addFlash(
'sonata_flash_error',
"Opération annulée car la raison, l'IBAN ou le BIC du gestionnaire pour les virements de reconversions est vide."
);
return $this->redirect($this->router->generate('index') . 'admin/app/reconversion/list');
}
//SEPA
$builder = new CustomerCreditTransferBuilder();
$customerCreditTransfer = $builder
->createInstance(
$bic,
$iban,
$raison
);
$reconversions = $this->em->getRepository(Reconversion::class)->findBy(["reconverti" => false]);
if(!$reconversions) {
$this->addFlash(
'sonata_flash_error',
"Aucune reconversion à traiter."
);
return $this->redirect($this->router->generate('index') . 'admin/app/reconversion/list');
}
foreach($reconversions as $r) {
/* @var Reconversion $r */
/* @var Prestataire $presta */
$presta = $r->getExpediteur();
if(!$presta || !$presta->isEnabled()) {
//fail ; do not flush : we don't want to toggle reconverti when file can't be generated
$this->addFlash(
'sonata_flash_error',
"Opération annulée car le prestataire " . $presta->getRaison() . " est désactivé ou introuvable."
);
return $this->redirect($this->router->generate('index') . 'admin/app/reconversion/list');
}
if(!$presta->getIban() || !$presta->getBic()) {
//fail ; do not flush : we don't want to toggle reconverti when file can't be generated
$this->addFlash(
'sonata_flash_error',
"Opération annulée car l'IBAN ou le BIC du prestataire " . $presta->getRaison() . " est vide."
);
return $this->redirect($this->router->generate('index') . 'admin/app/reconversion/list');
}
$customerCreditTransfer
->addTransaction(
$presta->getBic(),
$presta->getIban(),
$presta->getRaison(),
$r->getMontant(),
'EUR',
'Reconversion MonA vers EUR'
);
$r->setReconverti(true);
}
$filename = sprintf(
'credit_transfer_file_%s.%s',
date('Y_m_d_H_i_s', strtotime('now')),
'xml'
);
//projectDir is composer.json
$dir = $this->getParameter('kernel.project_dir') . "/reconversions";
if (!is_dir($dir)) {
mkdir($dir, 0755, true);
}
$path = $dir . "/" . $filename;
$customerCreditTransfer->popInstance()->save($path);
$this->em->flush();
return $this->file($path);
}
/**
* Export all operations for a user role. * Export all operations for a user role.
* *
* @param Request $request Request * @param Request $request Request
......
...@@ -6,10 +6,14 @@ use App\Entity\CotisationAdherent; ...@@ -6,10 +6,14 @@ use App\Entity\CotisationAdherent;
use App\Entity\CotisationPrestataire; use App\Entity\CotisationPrestataire;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Enum\MoyenEnum; use App\Enum\MoyenEnum;
use App\Form\Type\DistributorSelfEvalPrestaQuizType;
use App\Form\Type\ProducerSelfEvalPrestaQuizType;
use App\Form\Type\SelfEvalPrestaQuizType;
use App\Utils\CustomEntityManager; use App\Utils\CustomEntityManager;
use DateTime; use DateTime;
use Sonata\AdminBundle\Controller\CRUDController; use Sonata\AdminBundle\Controller\CRUDController;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
...@@ -115,4 +119,44 @@ class PrestataireAdminController extends CRUDController ...@@ -115,4 +119,44 @@ class PrestataireAdminController extends CRUDController
$this->admin->generateUrl('list', ['filter' => $this->admin->getFilterParameters()]) $this->admin->generateUrl('list', ['filter' => $this->admin->getFilterParameters()])
); );
} }
/**
* Visualisation et complétion de la partie réservée à l'admin sur un questionnaire prestataire
*
* @param Request $request
* @param Uuid $id Id du prestataire
*
* @return Response
*/
public function reviewprestaquizAction(Request $request, $id): Response
{
$prestataire = $this->admin->getSubject();
if (!$prestataire) {
throw new NotFoundHttpException(sprintf('Impossible de trouver le prestataire avec l\'id: %s', $id));
}
$quiz = $prestataire->getSelfEvalPrestaQuiz();
$formClass = Prestataire::DISTRIBUTOR === $prestataire->getMarketChannelFunction() ?
DistributorSelfEvalPrestaQuizType::class : ProducerSelfEvalPrestaQuizType::class;
$form = $this->createForm($formClass, $quiz, ["mode" => SelfEvalPrestaQuizType::ADMIN_EDIT]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->em->flush();
return new RedirectResponse(
$this->admin->generateUrl('list', ['filter' => $this->admin->getFilterParameters()])
);
}
$tmpl = Prestataire::DISTRIBUTOR === $prestataire->getMarketChannelFunction() ?
'@kohinos/tav/prestaquiz/distributor.html.twig'
: '@kohinos/tav/prestaquiz/producer.html.twig';
return $this->render($tmpl, [
'form' => $form->createView(),
'prestataire' => $prestataire
]);
}
} }
...@@ -6,6 +6,10 @@ use App\Entity\Groupe; ...@@ -6,6 +6,10 @@ use App\Entity\Groupe;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\Rubrique; use App\Entity\Rubrique;
use App\Entity\Flux; use App\Entity\Flux;
use App\Entity\SelfEvalPrestaQuiz;
use App\Form\Type\DistributorSelfEvalPrestaQuizType;
use App\Form\Type\ProducerSelfEvalPrestaQuizType;
use App\Form\Type\SelfEvalPrestaQuizType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
...@@ -39,9 +43,22 @@ class PrestatairesController extends FrontController ...@@ -39,9 +43,22 @@ class PrestatairesController extends FrontController
return new RedirectResponse($this->router->generate('index')); return new RedirectResponse($this->router->generate('index'));
} }
return $this->render('@kohinos/presta/show.html.twig', [ $templateData = ['presta' => $prestataire];
'presta' => $prestataire,
]); // If feature activated, display self evaluation form
if ($this->getParameter('presta_self_init_and_eval') == true) {
$quiz = $prestataire->getSelfEvalPrestaQuiz();
if ($quiz->isSubmitted) {
$formClass = Prestataire::DISTRIBUTOR === $prestataire->getMarketChannelFunction() ?
DistributorSelfEvalPrestaQuizType::class : ProducerSelfEvalPrestaQuizType::class;
$form = $this->createForm($formClass, $quiz, ["mode" => SelfEvalPrestaQuizType::READONLY]);
$templateData['form'] = $form->createView();
}
}
return $this->render('@kohinos/presta/show.html.twig', $templateData);
} }
/** /**
......
...@@ -11,6 +11,7 @@ use App\Entity\TransactionAdherentAdherent; ...@@ -11,6 +11,7 @@ use App\Entity\TransactionAdherentAdherent;
use App\Entity\TransactionAdherentPrestataire; use App\Entity\TransactionAdherentPrestataire;
use App\Form\Type\AchatMonnaieAConfirmerAdherentFormType; use App\Form\Type\AchatMonnaieAConfirmerAdherentFormType;
use App\Form\Type\AchatMonnaieAdherentFormType; use App\Form\Type\AchatMonnaieAdherentFormType;
use App\Form\Type\AchatMonnaieAdherentRecurrentFormType;
use App\Form\Type\AdherentInfosFormType; use App\Form\Type\AdherentInfosFormType;
use App\Form\Type\TransactionAdherentAdherentFormType; use App\Form\Type\TransactionAdherentAdherentFormType;
use App\Form\Type\TransactionAdherentPrestataireFormType; use App\Form\Type\TransactionAdherentPrestataireFormType;
...@@ -122,6 +123,42 @@ class UserAdherentController extends FluxController ...@@ -122,6 +123,42 @@ class UserAdherentController extends FluxController
} }
/** /**
* Validations before proceeding to payment.
*
* Returns error message or null if no error.
*/
private function paiementCotisTavValidation($flux) {
//Look for existing recurring payment
if($reason = $this->tavCotisationsUtils->checkExistingRecurringPayment($flux)) {
return $reason;
}
// Look for existing cotisation
if ($this->tavCotisationsUtils->checkExistingCotisation($flux)) {
return "Cotisation déjà payée ce mois-ci.";
}
$destinataire = $flux->getDestinataire();
// Look for cotisation data depending on active process
if (true == $this->getParameter('household_based_allowance')) {
$cotisationAmount = $destinataire->getCotisationAmount();
if (is_null($cotisationAmount) || is_null($destinataire->getHouseholdAdultCount())) {
return "Opération impossible : votre profil est incomplet, informations de cotisation manquantes. Veuillez contacter un administrateur.";
}
} else {
$profile = $destinataire->getProfilDeCotisation();
if (is_null($profile)) {
return "Opération impossible : vous n'avez pas de profil de cotisation associé. Veuillez contacter un administrateur.";
}
}
return null;
}
/**
* @Route("/adherent/paiement-cotis-tav/", name="paiementCotisTav") * @Route("/adherent/paiement-cotis-tav/", name="paiementCotisTav")
* @IsGranted("ROLE_ADHERENT") * @IsGranted("ROLE_ADHERENT")
*/ */
...@@ -136,27 +173,13 @@ class UserAdherentController extends FluxController ...@@ -136,27 +173,13 @@ class UserAdherentController extends FluxController
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
// TODO: set CB payment when the functionality is validated
$flux = $form->getData(); $flux = $form->getData();
// Look for existing cotisation $validationError = $this->paiementCotisTavValidation($flux);
if ($this->tavCotisationsUtils->checkExistingCotisation($flux)) { if (!is_null($validationError)) {
$this->addFlash( $this->addFlash(
'error', 'error',
$this->translator->trans('Cotisation déjà payée ce mois-ci.') $this->translator->trans($validationError)
);
return $this->redirectToRoute('index');
}
$destinataire = $flux->getDestinataire();
$profile = $destinataire->getProfilDeCotisation();
if (is_null($profile)) {
$this->addFlash(
'error',
$this->translator->trans('Opération impossible : vous n\'avez pas de profil de cotisation associé. Veuillez contacter un administrateur.')
); );
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
...@@ -166,12 +189,13 @@ class UserAdherentController extends FluxController ...@@ -166,12 +189,13 @@ class UserAdherentController extends FluxController
$flux->setDon(null); $flux->setDon(null);
} }
// TODO redirect to paiement // Redirect to payment
return $this->forward('App\Controller\PaymentController::preparePaymentAction', [ return $this->forward('App\Controller\PaymentController::preparePaymentAction', [
'form' => $form, 'form' => $form,
'type' => Payment::TYPE_PAIEMENT_COTISATION_TAV // TODO 'type' => Payment::TYPE_PAIEMENT_COTISATION_TAV
]); ]);
/* For test purposes, comment redirection and uncomment following part to skip payment */
// $this->em->persist($flux); // $this->em->persist($flux);
// $this->operationUtils->executeOperations($flux); // $this->operationUtils->executeOperations($flux);
...@@ -194,6 +218,57 @@ class UserAdherentController extends FluxController ...@@ -194,6 +218,57 @@ class UserAdherentController extends FluxController
} }
/** /**
* @Route("/adherent/paiement-reccurent-cotis-tav/", name="paiementRecurrentCotisTav")
* @IsGranted("ROLE_ADHERENT")
*/
public function paiementRecurrentCotisTavAction(Request $request)
{
if (empty($this->getUser()) || empty($this->getUser()->getAdherent())) {
return $this->redirectToRoute('index');
}
$entity = new AchatMonnaieAdherent();
$form = $this->createForm(AchatMonnaieAdherentRecurrentFormType::class, $entity);
$form->handleRequest($request);
if (!$form->isValid()) {
foreach($form->getErrors(true) as $error) {
$this->addFlash('error', $error->getMessage());
}
return $this->redirectToRoute('index');
}
if ($form->isSubmitted() && $form->isValid()) {
$flux = $form->getData();
$validationError = $this->paiementCotisTavValidation($flux);
if (!is_null($validationError)) {
$this->addFlash(
'error',
$this->translator->trans($validationError)
);
return $this->redirectToRoute('index');
}
if (null == $flux->getDon() || 0 == $flux->getDon()->getMontant()) {
$flux->setDon(null);
}
// Redirect to payment
return $this->forward('App\Controller\PaymentController::preparePaymentAction', [
'form' => $form,
'type' => Payment::TYPE_PAIEMENT_RECURRENT_COTISATION_TAV
]);
}
return $this->render('@kohinos/flux/transaction.html.twig', [
'form' => $form->createView(),
'title' => $this->translator->trans('Payer sa cotisation'),
]);
}
/**
* @Route("/adherent/demande/achat-monnaie/", name="achatMonnaieAConfirmerAdherent") * @Route("/adherent/demande/achat-monnaie/", name="achatMonnaieAConfirmerAdherent")
* @IsGranted("ROLE_ADHERENT") * @IsGranted("ROLE_ADHERENT")
*/ */
......
...@@ -215,25 +215,54 @@ class UserComptoirController extends FluxController ...@@ -215,25 +215,54 @@ class UserComptoirController extends FluxController
} }
$destinataire = $flux->getDestinataire(); $destinataire = $flux->getDestinataire();
$profile = $destinataire->getProfilDeCotisation();
if (is_null($profile)) { if ($this->getParameter('household_based_allowance') == true) {
$this->addFlash( /* Process: allowance based on household */
'error', $cotisationAmount = $destinataire->getCotisationAmount();
$this->translator->trans('Opération impossible : l\'habitant.e n\'a pas de profil de cotisation associé.')
);
return $this->redirectToRoute('index'); // Verifications
} if (is_null($cotisationAmount) || is_null($destinataire->getHouseholdAdultCount())) {
$this->addFlash(
'error',
$this->translator->trans("Opération impossible : le profil de l'habitant.e est incomplet, veuillez le compléter dans l'interface d'administration.")
);
$cotisationAmount = $profile->getMontant(); // Amount in € paid by the user return $this->redirectToRoute('index');
$flux->setMontant($cotisationAmount); }
$this->em->persist($flux); if (is_null($destinataire->getAllocationAmount())) {
$this->operationUtils->executeOperations($flux); $this->tavCotisationUtils->calculateAllowanceAccordingToHousehold($destinataire);
$this->em->persist($destinataire);
}
$flux->setMontant($cotisationAmount);
$this->em->persist($flux);
$this->operationUtils->executeOperations($flux);
// Apply cotisation rate, create new flux
$this->tavCotisationsUtils->applyHouseholdAllowance($flux);
} else {
/* Process: allowance based on cotisation profile with cotisation rate */
$profile = $destinataire->getProfilDeCotisation();
if (is_null($profile)) {
$this->addFlash(
'error',
$this->translator->trans('Opération impossible : l\'habitant.e n\'a pas de profil de cotisation associé.')
);
return $this->redirectToRoute('index');
}
// Apply cotisation rate, create new flux $cotisationAmount = $profile->getMontant(); // Amount in € paid by the user
$this->tavCotisationsUtils->applyTauxCotisation($flux); $flux->setMontant($cotisationAmount);
$this->em->persist($flux);
$this->operationUtils->executeOperations($flux);
// Apply cotisation rate, create new flux
$this->tavCotisationsUtils->applyTauxCotisation($flux);
}
$this->em->flush(); $this->em->flush();
......
...@@ -49,6 +49,8 @@ class UserPrestataireController extends FluxController ...@@ -49,6 +49,8 @@ class UserPrestataireController extends FluxController
} }
$this->em->persist($adresse); $this->em->persist($adresse);
} }
// caissiers validations
if (!empty($form->get('newcaissiers')->getData())) { if (!empty($form->get('newcaissiers')->getData())) {
$caissiers = explode(';', $form->get('newcaissiers')->getData()); $caissiers = explode(';', $form->get('newcaissiers')->getData());
$errors = []; $errors = [];
...@@ -102,6 +104,17 @@ class UserPrestataireController extends FluxController ...@@ -102,6 +104,17 @@ class UserPrestataireController extends FluxController
} elseif (!$request->isXmlHttpRequest()) { } elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST); return new Response('', Response::HTTP_BAD_REQUEST);
} }
} else {
foreach ($form->getErrors(true, true) as $error) {
// Add flash error message in case of error with the embedded form
if (str_contains($error->getCause()->getPropertyPath(), 'productFamily')) {
$this->addFlash(
'error',
$error->getMessage()
);
break;
}
}
} }
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
......
...@@ -10,6 +10,7 @@ use App\Entity\EntityTrait\HasEcompteEntity; ...@@ -10,6 +10,7 @@ use App\Entity\EntityTrait\HasEcompteEntity;
use App\Flux\AccountableInterface; use App\Flux\AccountableInterface;
use App\Flux\AccountableObject; use App\Flux\AccountableObject;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity; use Gedmo\Timestampable\Traits\TimestampableEntity;
use Ramsey\Uuid\Doctrine\UuidGenerator; use Ramsey\Uuid\Doctrine\UuidGenerator;
...@@ -113,9 +114,41 @@ class Adherent extends AccountableObject implements AccountableInterface ...@@ -113,9 +114,41 @@ class Adherent extends AccountableObject implements AccountableInterface
*/ */
private $jourMailRappelCotisation; private $jourMailRappelCotisation;
/**
* @ORM\OneToMany(targetEntity=DependentChild::class, mappedBy="adherent", orphanRemoval=true, cascade={"persist"})
*/
private $dependentChildren;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $householdComposition;
/**
* @ORM\Column(type="integer", length=255, nullable=true)
*/
private $householdAdultCount;
/**
* On household based allowance process, define a cotisation amount for each adherent.
*
* @ORM\Column(type="float", nullable=true)
*/
private $cotisationAmount;
/**
* On household based allowance process, the allowance amountis calculated based on household data.
* Calculate and save the allocation amount when the household data is updated.
*
* @ORM\Column(type="float", nullable=true)
*/
private $allocationAmount;
public function __construct() public function __construct()
{ {
$this->accounts = new ArrayCollection(); $this->accounts = new ArrayCollection();
$this->dependentChildren = new ArrayCollection();
} }
public function getId() public function getId()
...@@ -299,6 +332,18 @@ class Adherent extends AccountableObject implements AccountableInterface ...@@ -299,6 +332,18 @@ class Adherent extends AccountableObject implements AccountableInterface
return $this; return $this;
} }
public function getHouseholdComposition(): ?string
{
return $this->householdComposition;
}
public function setHouseholdComposition(?string $householdComposition): self
{
$this->householdComposition = $householdComposition;
return $this;
}
public function getJourPrelevement(): ?int public function getJourPrelevement(): ?int
{ {
...@@ -311,6 +356,18 @@ class Adherent extends AccountableObject implements AccountableInterface ...@@ -311,6 +356,18 @@ class Adherent extends AccountableObject implements AccountableInterface
return $this; return $this;
} }
public function getHouseholdAdultCount(): ?int
{
return $this->householdAdultCount;
}
public function setHouseholdAdultCount(?int $householdAdultCount): self
{
$this->householdAdultCount = $householdAdultCount;
return $this;
}
public function getMailRappelCotisation(): ?bool public function getMailRappelCotisation(): ?bool
{ {
...@@ -335,4 +392,64 @@ class Adherent extends AccountableObject implements AccountableInterface ...@@ -335,4 +392,64 @@ class Adherent extends AccountableObject implements AccountableInterface
return $this; return $this;
} }
/**
* @return Collection<int, DependentChild>
*/
public function getDependentChildren(): Collection
{
return $this->dependentChildren;
}
public function addDependentChild(DependentChild $dependentChild): self
{
if (!$this->dependentChildren->contains($dependentChild)) {
$this->dependentChildren[] = $dependentChild;
$dependentChild->setAdherent($this);
}
return $this;
}
public function removeDependentChild(DependentChild $dependentChild): self
{
if ($this->dependentChildren->removeElement($dependentChild)) {
// set the owning side to null (unless already changed)
if ($dependentChild->getAdherent() === $this) {
$dependentChild->setAdherent(null);
}
}
return $this;
}
public function getCotisationAmount(): ?float
{
return $this->cotisationAmount;
}
public function setCotisationAmount(?float $cotisationAmount): self
{
$this->cotisationAmount = $cotisationAmount;
return $this;
}
public function getAllocationAmount(): ?float
{
return $this->allocationAmount;
}
public function setAllocationAmount(?float $allocationAmount): self
{
$this->allocationAmount = $allocationAmount;
return $this;
}
public function getCeiling()
{
//This formula has been configured for ssa gironde project
return 2 * $this->allocationAmount;
}
} }
...@@ -7,16 +7,19 @@ use App\Utils\OperationFactory; ...@@ -7,16 +7,19 @@ use App\Utils\OperationFactory;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Application du taux de cotisation lors du paiement d'une cotisation (au sens TAV). * Application du calcul de l'allocation (emlc reçues) lors du paiement d'une cotisation (au sens TAV).
* *
* Au paiement d'une cotisation: * Au paiement d'une cotisation:
* - Un premier Flux est enregistré, correspondant à l'achat/vente d'emlc. * - Un premier Flux est enregistré, correspondant à l'achat/vente d'emlc.
* - Puis on applique le taux défini dans le ProfilDeCotisation de l'adhérent, * - On crée un nouveau flux pour compléter la cotisation, en fonction du système de calcul choisi.
* on crée un nouveau flux pour compléter la cositsation. *
* Systèmes de calculs possibles :
* - On applique le taux défini dans le ProfilDeCotisation de l'adhérent
* - On calcule le montant à recevoir en fonction du foyer de l'adhérent
* *
* @ORM\Entity * @ORM\Entity
*/ */
class TauxCotisationApplication extends Flux class CotisationTavApplication extends Flux
{ {
const TYPE_REVERSEMENT_COTISATION_ADHERENT = 'reversement_cotisation_adherent'; const TYPE_REVERSEMENT_COTISATION_ADHERENT = 'reversement_cotisation_adherent';
const TYPE_PRELEVEMENT_COTISATION_ADHERENT = 'prelevement_cotisation_adherent'; const TYPE_PRELEVEMENT_COTISATION_ADHERENT = 'prelevement_cotisation_adherent';
...@@ -26,7 +29,7 @@ class TauxCotisationApplication extends Flux ...@@ -26,7 +29,7 @@ class TauxCotisationApplication extends Flux
*/ */
public function getParenttype(): string public function getParenttype(): string
{ {
return parent::TYPE_APPLICATION_TAUX_COTISATION; return parent::TYPE_APPLICATION_COTISATION_TAV;
} }
public function getAllOperations($em) public function getAllOperations($em)
......
...@@ -7,12 +7,18 @@ use App\Utils\OperationFactory; ...@@ -7,12 +7,18 @@ use App\Utils\OperationFactory;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* En cas de taux < 1, l'adhérent•e reçoit moins d'emlc que ce qu'elle•il paye en € : * Dans les cas suivants :
* - [Profil de Cotisation] La taux est inférieur à 1
* - [Allocation selon foyer] Le montant reçu calculé est inférieur au montant payé
* - [Allocation selon foyer] Un administrateur effectue une opération manuelle de prélèvement de l'adhérent
* pour ramener son solde au niveau de son plafond.
*
* L'adhérent•e reçoit moins d'emlc que ce qu'elle•il paye en €,
* un second flux est créé pour prélever le complément de la cotisation. * un second flux est créé pour prélever le complément de la cotisation.
* *
* @ORM\Entity * @ORM\Entity
*/ */
class TauxCotisationPrelevement extends TauxCotisationApplication class CotisationTavPrelevement extends CotisationTavApplication
{ {
/** /**
* @ORM\OneToOne(targetEntity="Adherent") * @ORM\OneToOne(targetEntity="Adherent")
......
...@@ -7,12 +7,16 @@ use App\Utils\OperationFactory; ...@@ -7,12 +7,16 @@ use App\Utils\OperationFactory;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* En cas de taux > 1, l'adhérent•e reçoit plus d'emlc que ce qu'elle•il paye en € : * * Dans les cas suivants :
* - [Profil de Cotisation] La taux est supérieur à 1
* - [Allocation selon foyer] Le montant reçu calculé est supérieur au montant payé
*
* L'adhérent•e reçoit plus d'emlc que ce qu'elle•il paye en €,
* un second flux est créé pour reverser le complément de la cotisation. * un second flux est créé pour reverser le complément de la cotisation.
* *
* @ORM\Entity * @ORM\Entity
*/ */
class TauxCotisationReversement extends TauxCotisationApplication class CotisationTavReversement extends CotisationTavApplication
{ {
/** /**
* @ORM\OneToOne(targetEntity="Siege") * @ORM\OneToOne(targetEntity="Siege")
......
<?php
namespace App\Entity;
use App\Repository\PrestataireProductFamilyRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=DependentChildRepository::class)
* @ORM\Table(name="dependent_child")
*/
class DependentChild
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Adherent::class, inversedBy="adherentDependentChildren")
* @ORM\JoinColumn(nullable=false)
*/
private $adherent;
/**
* @ORM\Column(type="boolean")
*/
private $olderThanFourteen;
/**
* @var float
*
* @ORM\Column(name="sharedcustodypercentage", type="decimal", scale=2, nullable=true)
* @Assert\Type("numeric")
*/
protected $sharedCustodyPercentage;
public function getId(): ?int
{
return $this->id;
}
public function getAdherent(): ?Adherent
{
return $this->adherent;
}
public function setAdherent(?Adherent $adherent): self
{
$this->adherent = $adherent;
return $this;
}
public function getOlderThanFourteen()
{
return $this->olderThanFourteen;
}
public function setOlderThanFourteen($olderThanFourteen)
{
$this->olderThanFourteen = $olderThanFourteen;
return $this;
}
public function getSharedCustodyPercentage()
{
return $this->sharedCustodyPercentage;
}
public function setSharedCustodyPercentage($sharedCustodyPercentage)
{
$this->sharedCustodyPercentage = $sharedCustodyPercentage;
return $this;
}
}
...@@ -54,9 +54,9 @@ use Symfony\Component\Validator\Constraints as Assert; ...@@ -54,9 +54,9 @@ use Symfony\Component\Validator\Constraints as Assert;
* "ticket_fix" = "TicketFix", * "ticket_fix" = "TicketFix",
* "ticket_fix_print" = "TicketFixPrint", * "ticket_fix_print" = "TicketFixPrint",
* "ticket_fix_destroy" = "TicketFixDestroy", * "ticket_fix_destroy" = "TicketFixDestroy",
* "application_taux_cotisation" = "TauxCotisationApplication", * "application_cotisation_tav" = "CotisationTavApplication",
* "reversement_cotisation_adherent" = "TauxCotisationReversement", * "reversement_cotisation_adherent" = "CotisationTavReversement",
* "prelevement_cotisation_adherent" = "TauxCotisationPrelevement", * "prelevement_cotisation_adherent" = "CotisationTavPrelevement",
* }) * })
*/ */
abstract class Flux implements FluxInterface abstract class Flux implements FluxInterface
...@@ -74,7 +74,7 @@ abstract class Flux implements FluxInterface ...@@ -74,7 +74,7 @@ abstract class Flux implements FluxInterface
const TYPE_VENTE = 'vente'; const TYPE_VENTE = 'vente';
const TYPE_VENTE_EMLC = 'vente_emlc'; const TYPE_VENTE_EMLC = 'vente_emlc';
const TYPE_TICKET_FIX = 'ticket_fix'; const TYPE_TICKET_FIX = 'ticket_fix';
const TYPE_APPLICATION_TAUX_COTISATION = 'application_taux_cotisation'; const TYPE_APPLICATION_COTISATION_TAV = 'application_cotisation_tav';
/** /**
* @var \Ramsey\Uuid\UuidInterface * @var \Ramsey\Uuid\UuidInterface
...@@ -649,4 +649,27 @@ abstract class Flux implements FluxInterface ...@@ -649,4 +649,27 @@ abstract class Flux implements FluxInterface
return ($this->getCreatedAt() ? $this->getCreatedAt()->format('d/m/Y H:i') . ' | ' : '') . ucwords($this->getParenttype()) . ' : ' . $this->getExpediteur() . ' => ' . $this->getDestinataire() . ' : ' . $this->getMontant() . '€'; return ($this->getCreatedAt() ? $this->getCreatedAt()->format('d/m/Y H:i') . ' | ' : '') . ucwords($this->getParenttype()) . ' : ' . $this->getExpediteur() . ' => ' . $this->getDestinataire() . ' : ' . $this->getMontant() . '€';
} }
public function ssaFriendlyTypeName()
{
$friendlyTypeNames = Flux::ssaUsefulFriendlyTypeNames();
return array_key_exists($this->type,$friendlyTypeNames) ?
$friendlyTypeNames[$this->type]
: $this->type;
}
public static function ssaUsefulFriendlyTypeNames($differentiateAchatsDeMonaPayzenOrComptoir = false)
{
return [
VenteEmlc::TYPE_VENTE_EMLC_ADHERENT => "Achat de MonA via cotisation" . ($differentiateAchatsDeMonaPayzenOrComptoir ? " (au comptoir)" : ""),
AchatMonnaie::TYPE_ACHAT_ADHERENT => "Achat de MonA via cotisation" . ($differentiateAchatsDeMonaPayzenOrComptoir ? " (via Payzen)" : ""),
CotisationTavApplication::TYPE_REVERSEMENT_COTISATION_ADHERENT => "Allocation complémentaire de la caisse",
CotisationTavApplication::TYPE_PRELEVEMENT_COTISATION_ADHERENT => "Réduction de l'allocation",
Don::TYPE_DON_ADHERENT => Don::TYPE_DON_ADHERENT,
Don::TYPE_DON_PRESTATAIRE => Don::TYPE_DON_PRESTATAIRE,
Reconversion::TYPE_RECONVERSION_PRESTATAIRE => Reconversion::TYPE_RECONVERSION_PRESTATAIRE,
Transaction::TYPE_TRANSACTION_PRESTATAIRE_ADHERENT => Transaction::TYPE_TRANSACTION_PRESTATAIRE_ADHERENT,
Transaction::TYPE_TRANSACTION_ADHERENT_PRESTATAIRE => Transaction::TYPE_TRANSACTION_ADHERENT_PRESTATAIRE
];
}
} }
...@@ -66,6 +66,23 @@ class Geoloc ...@@ -66,6 +66,23 @@ class Geoloc
*/ */
private $lon; private $lon;
/**
* @var Subterritory
*
* @ORM\ManyToOne(targetEntity="Subterritory")
* @ORM\JoinColumn(name="subterritory_id", referencedColumnName="id", nullable=true)
*/
private $subterritory;
/**
* @var string|null
*
* @ORM\Column(name="quartier", type="string", length=255, nullable=true)
* @Groups({"read", "write"})
*/
private $quartier;
public function getId() public function getId()
{ {
return $this->id; return $this->id;
...@@ -171,6 +188,46 @@ class Geoloc ...@@ -171,6 +188,46 @@ class Geoloc
return $this; return $this;
} }
/**
* @return Subterritory|null
*/
public function getSubterritory(): ?Subterritory
{
return $this->subterritory;
}
/**
* @param Subterritory|null $subterritory
*
* @return Geoloc
*/
public function setSubterritory(?Subterritory $subterritory): Geoloc
{
$this->subterritory = $subterritory;
return $this;
}
/**
* @return string|null
*/
public function getQuartier(): ?string
{
return $this->quartier;
}
/**
* @param string|null $quartier
*
* @return Geoloc
*/
public function setQuartier(?string $quartier)
{
$this->quartier = $quartier;
return $this;
}
public function __toString(): string public function __toString(): string
{ {
return (!empty($this->adresse) ? $this->adresse : '') . ' ' . (!empty($this->cpostal) ? $this->cpostal : '') . ' ' . (!empty($this->ville) ? $this->ville : ''); return (!empty($this->adresse) ? $this->adresse : '') . ' ' . (!empty($this->cpostal) ? $this->cpostal : '') . ' ' . (!empty($this->ville) ? $this->ville : '');
......
...@@ -51,6 +51,9 @@ class GlobalParameter ...@@ -51,6 +51,9 @@ class GlobalParameter
const HELLOASSO_URL_COTISATION_ADHERENT = 'HELLOASSO_URL_COTISATION_ADHERENT'; const HELLOASSO_URL_COTISATION_ADHERENT = 'HELLOASSO_URL_COTISATION_ADHERENT';
const HELLOASSO_URL_COTISATION_PRESTATAIRE = 'HELLOASSO_URL_COTISATION_PRESTATAIRE'; const HELLOASSO_URL_COTISATION_PRESTATAIRE = 'HELLOASSO_URL_COTISATION_PRESTATAIRE';
const CONTACT_FORM_PHONE_NUMBER = 'CONTACT_FORM_PHONE_NUMBER'; const CONTACT_FORM_PHONE_NUMBER = 'CONTACT_FORM_PHONE_NUMBER';
const VIREMENT_RECONVERSION_RAISON_GESTIONNAIRE = 'VIREMENT_RECONVERSION_RAISON_GESTIONNAIRE';
const VIREMENT_RECONVERSION_BIC_GESTIONNAIRE = 'VIREMENT_RECONVERSION_BIC_GESTIONNAIRE';
const VIREMENT_RECONVERSION_IBAN_GESTIONNAIRE = 'VIREMENT_RECONVERSION_IBAN_GESTIONNAIRE';
/** /**
* @var \Ramsey\Uuid\UuidInterface * @var \Ramsey\Uuid\UuidInterface
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Entity; namespace App\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Payum\Core\Model\Payment as BasePayment; use Payum\Core\Model\Payment as BasePayment;
use Ramsey\Uuid\Doctrine\UuidGenerator; use Ramsey\Uuid\Doctrine\UuidGenerator;
...@@ -18,6 +19,7 @@ class Payment extends BasePayment ...@@ -18,6 +19,7 @@ class Payment extends BasePayment
const TYPE_COTISATION_PRESTA = 'cotisation_presta'; const TYPE_COTISATION_PRESTA = 'cotisation_presta';
const TYPE_ADHESION = 'adhesion'; const TYPE_ADHESION = 'adhesion';
const TYPE_PAIEMENT_COTISATION_TAV = 'paiement_cotisation_tav'; const TYPE_PAIEMENT_COTISATION_TAV = 'paiement_cotisation_tav';
const TYPE_PAIEMENT_RECURRENT_COTISATION_TAV = 'paiement_recurrent_cotisation_tav';
/** /**
* @var \Ramsey\Uuid\UuidInterface * @var \Ramsey\Uuid\UuidInterface
...@@ -53,6 +55,26 @@ class Payment extends BasePayment ...@@ -53,6 +55,26 @@ class Payment extends BasePayment
protected $extra_data; protected $extra_data;
/** /**
* @ORM\Column(type="boolean", nullable=True)
*/
private $isRecurrent;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $recurrenceMonthsCount;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $recurrenceMonthDay;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $recurrenceAmount;
/**
* @return string * @return string
*/ */
public function getStatus(): ?string public function getStatus(): ?string
...@@ -111,4 +133,104 @@ class Payment extends BasePayment ...@@ -111,4 +133,104 @@ class Payment extends BasePayment
return $this; return $this;
} }
public function getIsRecurrent(): ?bool
{
return $this->isRecurrent;
}
public function setIsRecurrent(bool $isRecurrent): self
{
$this->isRecurrent = $isRecurrent;
return $this;
}
public function getRecurrenceMonthsCount(): ?int
{
return $this->recurrenceMonthsCount;
}
public function setRecurrenceMonthsCount(?int $recurrenceMonthsCount): self
{
$this->recurrenceMonthsCount = $recurrenceMonthsCount;
return $this;
}
public function getRecurrenceMonthDay(): ?int
{
return $this->recurrenceMonthDay;
}
public function setRecurrenceMonthDay(?int $recurrenceMonthDay): self
{
$this->recurrenceMonthDay = $recurrenceMonthDay;
return $this;
}
public function getRecurrenceAmount(): ?int
{
return $this->recurrenceAmount;
}
public function setRecurrenceAmount(?int $recurrenceAmount): self
{
$this->recurrenceAmount = $recurrenceAmount;
return $this;
}
/**
* Return null in case of error
* Returns true if payment is already ended or CB expired
* Returns false otherwise
*
* @param $reason
* @return bool|null
*/
public function isRecurringPaymentEndedOrExpired(&$reason)
{
if(!$this->details
|| !array_key_exists('vads_effective_creation_date',$this->details)
|| !array_key_exists('vads_expiry_year',$this->details)
|| !array_key_exists('vads_effective_creation_date',$this->details)
) {
$reason = "Attribut détails vide ou clés absentes.";
return null;
}
$firstDayOfCreationMonth = DateTime::createFromFormat(
'Ymd',substr($this->details['vads_effective_creation_date'],0,6) . "01"
);
if(!$firstDayOfCreationMonth) {
$reason = "Error parsing vads_effective_creation_date : " . $this->details['vads_effective_creation_date'];
return null;
}
$day = $this->getRecurrenceMonthDay() ? $this->getRecurrenceMonthDay() - 1 : 0; //if not set assume first day of month (not a big deal anyway)
$dateOfFirstOccurenceAfterInitialPayment = $firstDayOfCreationMonth->modify(
"+" . $day . " days next month"
);
$paymentEndDate = $this->getRecurrenceMonthsCount() ?
$dateOfFirstOccurenceAfterInitialPayment->modify(
"+" . ($this->getRecurrenceMonthsCount() - 1) . " months" //minus one because initial payment is not considered by payzen as the first occurence
)
: null; //assume no end date if recurrenceMonthsCount not set
//Now check expiry date
$paymentEndDateDueToExpiry = new DateTime();
$paymentEndDateDueToExpiry->setDate($this->details['vads_expiry_year'],$this->details['vads_expiry_month'],$day+1);
$now = new DateTime();
if($paymentEndDate && $paymentEndDate < $paymentEndDateDueToExpiry) {
//Compare now with payment end date
$reason = "Paiement récurrent en cours jusqu'à dernière échéance le " . $paymentEndDate->format('d/m/Y') . ".";
return $now >= $paymentEndDate;
} else {
//Compare now with expiry date
$reason = "Paiement récurrent en cours jusqu'à dernière échéance le " . $paymentEndDateDueToExpiry->format('d/m/Y') . " en raison de l'expiration du moyen de paiement.";
return $now >= $paymentEndDateDueToExpiry;
}
}
} }
...@@ -9,6 +9,7 @@ use App\Entity\EntityTrait\HasEcompteEntity; ...@@ -9,6 +9,7 @@ use App\Entity\EntityTrait\HasEcompteEntity;
use App\Flux\AccountableInterface; use App\Flux\AccountableInterface;
use App\Flux\AccountableObject; use App\Flux\AccountableObject;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; 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;
...@@ -44,6 +45,9 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -44,6 +45,9 @@ class Prestataire extends AccountableObject implements AccountableInterface
use HasEcompteEntity; use HasEcompteEntity;
use HasAccountsTrait; use HasAccountsTrait;
const DISTRIBUTOR = 'distributor';
const PRODUCER = 'producer';
/** /**
* @var \Ramsey\Uuid\UuidInterface * @var \Ramsey\Uuid\UuidInterface
* *
...@@ -142,6 +146,19 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -142,6 +146,19 @@ class Prestataire extends AccountableObject implements AccountableInterface
private $iban; private $iban;
/** /**
* Bank Identifier Code.
*
* @var string
*
* @ORM\Column(name="bic", type="string", nullable=true)
*
* @Assert\Bic(
* ibanPropertyPath="iban"
* )
*/
private $bic;
/**
* @var string * @var string
* *
* @ORM\Column(name="siret", type="string", length=50, nullable=true) * @ORM\Column(name="siret", type="string", length=50, nullable=true)
...@@ -198,6 +215,22 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -198,6 +215,22 @@ class Prestataire extends AccountableObject implements AccountableInterface
private $horaires; private $horaires;
/** /**
* @var string|null (champ libre)
*
* @ORM\Column(name="marketchannelfunction", type="text", nullable=true)
* @Groups({"read", "write"})
*/
private $marketchannelfunction;
public function setMarketChannelFunction($var)
{
$this->marketchannelfunction = $var;
}
public function getMarketChannelFunction()
{
return $this->marketchannelfunction;
}
/**
* @var TypePrestataire * @var TypePrestataire
* *
* @ORM\ManyToOne(targetEntity="TypePrestataire", cascade={"persist"}, inversedBy="prestataires") * @ORM\ManyToOne(targetEntity="TypePrestataire", cascade={"persist"}, inversedBy="prestataires")
...@@ -206,6 +239,21 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -206,6 +239,21 @@ class Prestataire extends AccountableObject implements AccountableInterface
private $typeprestataire; private $typeprestataire;
/** /**
* @var SelfEvalPrestaQuiz
* @ORM\OneToOne(targetEntity="SelfEvalPrestaQuiz", cascade={"persist"})
* @ORM\JoinColumn(name="selfevalprestaquiz_id", referencedColumnName="id", nullable=true)
*/
protected $selfevalprestaquiz;
public function setSelfEvalPrestaQuiz($var)
{
$this->selfevalprestaquiz = $var;
}
public function getSelfEvalPrestaQuiz()
{
return $this->selfevalprestaquiz;
}
/**
* @var ArrayCollection|Rubrique[] * @var ArrayCollection|Rubrique[]
* @ORM\ManyToMany(targetEntity="Rubrique", mappedBy="prestataires", cascade={"persist"}, fetch="EXTRA_LAZY") * @ORM\ManyToMany(targetEntity="Rubrique", mappedBy="prestataires", cascade={"persist"}, fetch="EXTRA_LAZY")
* @Groups({"read", "write"}) * @Groups({"read", "write"})
...@@ -291,6 +339,15 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -291,6 +339,15 @@ class Prestataire extends AccountableObject implements AccountableInterface
protected $tauxreconversion; protected $tauxreconversion;
/** /**
* Fréquence de reconversion en cas d'automatisation des reconversions.
*
* @var string
* @ORM\Column(name="reconversionFrequency", type="string", length=50, nullable=true)
* @Groups({"read", "write"})
*/
protected $reconversionFrequency;
/**
* @var ArrayCollection|AccountPrestataire[] * @var ArrayCollection|AccountPrestataire[]
* @ORM\OneToMany(targetEntity="AccountPrestataire", mappedBy="prestataire") * @ORM\OneToMany(targetEntity="AccountPrestataire", mappedBy="prestataire")
*/ */
...@@ -303,11 +360,25 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -303,11 +360,25 @@ class Prestataire extends AccountableObject implements AccountableInterface
/** /**
* Caissiers can export all the transactions since the last export. * Caissiers can export all the transactions since the last export.
* *
* @ORM\Column(type="datetime", nullable=true) * @ORM\Column(type="datetime", nullable=true)
*/ */
private $lastTransactionsExportDatetime; private $lastTransactionsExportDatetime;
/**
* @ORM\OneToMany(targetEntity=PrestataireProductFamily::class, mappedBy="prestataire", orphanRemoval=true, cascade={"persist"})
*/
private $prestataireProductFamilies;
/**
* @var float
*
* @ORM\Column(name="conventionnement", type="decimal", scale=2, nullable=true)
* @Assert\Type("numeric")
*/
protected $conventionnement;
public function __construct() public function __construct()
{ {
$this->users = new ArrayCollection(); $this->users = new ArrayCollection();
...@@ -318,6 +389,7 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -318,6 +389,7 @@ class Prestataire extends AccountableObject implements AccountableInterface
$this->rubriques = new ArrayCollection(); $this->rubriques = new ArrayCollection();
$this->contacts = new ArrayCollection(); $this->contacts = new ArrayCollection();
$this->accounts = new ArrayCollection(); $this->accounts = new ArrayCollection();
$this->prestataireProductFamilies = new ArrayCollection();
} }
public function getId() public function getId()
...@@ -478,6 +550,26 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -478,6 +550,26 @@ class Prestataire extends AccountableObject implements AccountableInterface
return $this; return $this;
} }
/**
* @return string
*/
public function getBic(): ?string
{
return $this->bic;
}
/**
* @param string $bic
*
* @return Prestataire
*/
public function setBic(?string $bic): self
{
$this->bic = $bic;
return $this;
}
/** /**
* @return string * @return string
...@@ -712,7 +804,7 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -712,7 +804,7 @@ class Prestataire extends AccountableObject implements AccountableInterface
return $return; return $return;
}, $this->users->getValues())); }, $this->users->getValues()));
} }
public function getGestionnairesEmailsString() public function getGestionnairesEmailsString()
{ {
...@@ -748,7 +840,7 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -748,7 +840,7 @@ class Prestataire extends AccountableObject implements AccountableInterface
* *
* @return $this * @return $this
*/ */
public function removeUser(User $users) public function removeUser(User $user)
{ {
if ($this->users->contains($user)) { if ($this->users->contains($user)) {
$this->users->removeElement($user); $this->users->removeElement($user);
...@@ -790,7 +882,7 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -790,7 +882,7 @@ class Prestataire extends AccountableObject implements AccountableInterface
* *
* @return $this * @return $this
*/ */
public function removeCaissier(User $caissiers) public function removeCaissier(User $caissier)
{ {
if ($this->caissiers->contains($caissier)) { if ($this->caissiers->contains($caissier)) {
$this->caissiers->removeElement($caissier); $this->caissiers->removeElement($caissier);
...@@ -1073,6 +1165,28 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -1073,6 +1165,28 @@ class Prestataire extends AccountableObject implements AccountableInterface
} }
/** /**
* Get reconversionFrequency.
*
* @return
*/
public function getReconversionFrequency(): ?string
{
return $this->reconversionFrequency;
}
/**
* Set reconversionFrequency.
*
* @return $this
*/
public function setReconversionFrequency(?string $reconversionFrequency): self
{
$this->reconversionFrequency = $reconversionFrequency;
return $this;
}
/**
* Get comments. * Get comments.
* *
* @return string comments * @return string comments
...@@ -1120,4 +1234,54 @@ class Prestataire extends AccountableObject implements AccountableInterface ...@@ -1120,4 +1234,54 @@ class Prestataire extends AccountableObject implements AccountableInterface
return $this; return $this;
} }
/**
* @return Collection<int, PrestataireProductFamily>
*/
public function getPrestataireProductFamilies(): Collection
{
return $this->prestataireProductFamilies;
}
public function addPrestataireProductFamily(PrestataireProductFamily $prestataireProductFamily): self
{
if (!$this->prestataireProductFamilies->contains($prestataireProductFamily)) {
$this->prestataireProductFamilies[] = $prestataireProductFamily;
$prestataireProductFamily->setPrestataire($this);
}
return $this;
}
public function removePrestataireProductFamily(PrestataireProductFamily $prestataireProductFamily): self
{
if ($this->prestataireProductFamilies->removeElement($prestataireProductFamily)) {
// set the owning side to null (unless already changed)
if ($prestataireProductFamily->getPrestataire() === $this) {
$prestataireProductFamily->setPrestataire(null);
}
}
return $this;
}
/**
* @return mixed
*/
public function getConventionnement()
{
return $this->conventionnement !== null ? number_format($this->conventionnement, 2) : null;
}
/**
* @param mixed $conventionnement
*
* @return Prestataire
*/
public function setConventionnement($conventionnement)
{
$this->conventionnement = $conventionnement;
return $this;
}
} }
<?php
namespace App\Entity;
use App\Repository\PrestataireProductFamilyRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass=PrestataireProductFamilyRepository::class)
* @ORM\Table(name="prestataire_product_family", uniqueConstraints={@ORM\UniqueConstraint(name="prestataireproductfamily", columns={"prestataire_id", "product_family_id"})}) )
* @UniqueEntity(
* fields={"prestataire", "productFamily"},
* errorPath="productFamily",
* message="Famille de produits déjà renseignée, les modifications n'ont pas été enregistrées."
* )
*/
class PrestataireProductFamily
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Prestataire::class, inversedBy="prestataireProductFamilies")
* @ORM\JoinColumn(nullable=false)
*/
private $prestataire;
/**
* @ORM\ManyToOne(targetEntity=ProductFamily::class)
* @ORM\JoinColumn(nullable=false)
*/
private $productFamily;
/**
* Products list as a string. Not related to any kind of product entity.
*
* @ORM\Column(type="text")
*/
private $products;
public function getId(): ?int
{
return $this->id;
}
public function getPrestataire(): ?Prestataire
{
return $this->prestataire;
}
public function setPrestataire(?Prestataire $prestataire): self
{
$this->prestataire = $prestataire;
return $this;
}
public function getProductFamily(): ?ProductFamily
{
return $this->productFamily;
}
public function setProductFamily(?ProductFamily $productFamily): self
{
$this->productFamily = $productFamily;
return $this;
}
public function getProducts(): ?string
{
return $this->products;
}
public function setProducts(string $products): self
{
$this->products = $products;
return $this;
}
}
<?php
namespace App\Entity;
use App\Repository\ProductFamilyRepository;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Doctrine\UuidGenerator;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass=ProductFamilyRepository::class)
* @UniqueEntity(fields="name", message="Une famille de produits portant ce nom existe déjà.")
*/
class ProductFamily
{
/**
* @var \Ramsey\Uuid\UuidInterface
*
* @ORM\Id
* @ORM\Column(type="uuid", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
private $id;
/**
* @ORM\Column(type="string", length=100, unique=true)
*/
private $name;
public function getId()
{
return $this->id;
}
/**
* Get name.
*
* @return string name
*/
public function getName(): ?string
{
return $this->name;
}
/**
* Set name.
*
* @return $this
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
}
...@@ -125,7 +125,7 @@ class ProfilDeCotisation ...@@ -125,7 +125,7 @@ class ProfilDeCotisation
} }
/** /**
* setContacts. * setBeneficiaires.
* *
* @param [type] $beneficiaires [description] * @param [type] $beneficiaires [description]
*/ */
......
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Doctrine\UuidGenerator;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity
* @ORM\Table(name="selfevalprestaquiz")
*/
class SelfEvalPrestaQuiz
{
/*
* This class is really just about storing results of a form in a database.
* Attributes are not going to be part of any logic code.
* I opt to set all attributes public to save coding time.
*/
/**
* @var \Ramsey\Uuid\UuidInterface
*
* @ORM\Id
* @ORM\Column(type="uuid", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
* @Groups({"read"})
*/
protected $id;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $accessib_geophy;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $accessib_tempor;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $accessib_edupop;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $accessib_divers;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $accessib_vulner;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $accessib_geophy_comment;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $accessib_tempor_comment;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $accessib_edupop_comment;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $accessib_divers_comment;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $accessib_vulner_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $bienetre_format;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $bienetre_format_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $bienetre_impgou;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $bienetre_impgou_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $bienetre_bienet;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $bienetre_bienet_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $bienetre_recben;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $bienetre_recben_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $transpar_jusrem;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $transpar_jusrem_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $transpar_transp;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $transpar_transp_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $transpar_relpro;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $transpar_relpro_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $disagdur_labels;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $disagdur_labels_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $disagdur_condur;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $disagdur_condur_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $proagdur_labels;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $proagdur_labels_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $proagdur_valbio;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $proagdur_valbio_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $proagdur_ecorec;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $proagdur_ecorec_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $proagdur_pertes;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $proagdur_pertes_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $proagdur_climat;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $proagdur_climat_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $proagdur_geneti;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $proagdur_geneti_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $proagdur_prosol;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $proagdur_prosol_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $localite_probru;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $localite_probru_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $localite_protra;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $localite_protra_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $accessib_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $accessib_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $bienetre_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $bienetre_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $transpar_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $transpar_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $disagdur_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $disagdur_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $proagdur_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $proagdur_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $localite_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $localite_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $review_accessib_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $review_accessib_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $review_bienetre_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $review_bienetre_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $review_transpar_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $review_transpar_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $review_disagdur_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $review_disagdur_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $review_proagdur_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $review_proagdur_global_comment;
/**
* @var int|null
* @ORM\Column(type="integer", nullable=true)
*/
public $review_localite_global;
/**
* @var string|null
* @ORM\Column(type="text", nullable=true)
*/
public $review_localite_global_comment;
/**
* As the form been fully submitted?
* @var bool
* @ORM\Column(type="boolean", nullable=false, options={"default" : false})
*/
public $isSubmitted;
}
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Doctrine\UuidGenerator;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="subterritory")
*/
class Subterritory
{
/**
* @var \Ramsey\Uuid\UuidInterface
*
* @ORM\Id
* @ORM\Column(type="uuid", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
protected $id;
/**
* @var string|null
*
* @ORM\Column(type="string", unique=true)
* @Assert\NotBlank
*/
protected $name;
public function getId()
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name)
{
$this->name = $name;
return $this;
}
}
...@@ -29,6 +29,15 @@ class TransactionAdherentPrestataire extends Transaction ...@@ -29,6 +29,15 @@ class TransactionAdherentPrestataire extends Transaction
protected $destinataire; protected $destinataire;
/** /**
* If the transaction is cancelled, cancellerFlux is the
* opposite TransactionPrestataireAdherent flux.
*
* @ORM\ManyToOne(targetEntity="Flux")
* @ORM\JoinColumn(name="cancellerflux_id", referencedColumnName="id", nullable=true)
*/
protected $cancellerFlux;
/**
* @return string * @return string
*/ */
public function getType(): string public function getType(): string
...@@ -43,4 +52,7 @@ class TransactionAdherentPrestataire extends Transaction ...@@ -43,4 +52,7 @@ class TransactionAdherentPrestataire extends Transaction
'destinataires' => $this->getDestinataire()->getUsers()->toArray(), 'destinataires' => $this->getDestinataire()->getUsers()->toArray(),
]; ];
} }
public function setCancellerFlux($var) {$this->cancellerFlux = $var;}
public function getCancellerFlux() {return $this->cancellerFlux;}
} }
...@@ -207,6 +207,14 @@ class User extends BaseUser ...@@ -207,6 +207,14 @@ class User extends BaseUser
*/ */
private $comment; private $comment;
/**
* This flag is set to false as soon as a user with an enabled prestataire logs in.
*
* @var bool
* @ORM\Column(type="boolean", nullable=false, options={"default" : true})
*/
private bool $beforeFirstLoginWithPrestaEnabled;
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
...@@ -225,6 +233,7 @@ class User extends BaseUser ...@@ -225,6 +233,7 @@ class User extends BaseUser
$this->possiblegroups = new ArrayCollection(); $this->possiblegroups = new ArrayCollection();
$this->alertemailflux = true; $this->alertemailflux = true;
$this->canValidateAchat = false; $this->canValidateAchat = false;
$this->beforeFirstLoginWithPrestaEnabled = true;
$this->createApiKey(); $this->createApiKey();
$this->createEmailToken(); $this->createEmailToken();
} }
...@@ -826,4 +835,13 @@ class User extends BaseUser ...@@ -826,4 +835,13 @@ class User extends BaseUser
return $this; return $this;
} }
public function getBeforeFirstLoginWithPrestaEnabled(): bool
{
return $this->beforeFirstLoginWithPrestaEnabled;
}
public function setBeforeFirstLoginWithPrestaEnabled($var)
{
$this->beforeFirstLoginWithPrestaEnabled = $var;
}
} }
<?php
namespace App\Enum;
abstract class ReconversionFrequencyEnum
{
const MOYEN_ONCE_A_MONTH = 'once_a_month';
const MOYEN_TWICE_A_MONTH = 'twice_a_month';
const MOYEN_ONCE_TWO_MONTHS = 'once_every_two_month';
/** @var array user friendly named type */
protected static $typeName = [
self::MOYEN_ONCE_A_MONTH => '1 fois par mois',
self::MOYEN_TWICE_A_MONTH => '2 fois par mois',
self::MOYEN_ONCE_TWO_MONTHS => '1 fois tous les deux mois',
];
/**
* @param string $typeShortName
*
* @return string
*/
public static function getTypeName($typeShortName)
{
if (!isset(static::$typeName[$typeShortName])) {
return "Unknown type ($typeShortName)";
}
return static::$typeName[$typeShortName];
}
/**
* @return array<string>
*/
public static function getAvailableTypes()
{
return [
self::MOYEN_ONCE_A_MONTH,
self::MOYEN_TWICE_A_MONTH,
self::MOYEN_ONCE_TWO_MONTHS,
];
}
}
...@@ -28,6 +28,7 @@ use App\Entity\User; ...@@ -28,6 +28,7 @@ use App\Entity\User;
use App\Form\Type\AchatMonnaieAConfirmerAdherentFormType; use App\Form\Type\AchatMonnaieAConfirmerAdherentFormType;
use App\Form\Type\AchatMonnaieAConfirmerPrestataireFormType; use App\Form\Type\AchatMonnaieAConfirmerPrestataireFormType;
use App\Form\Type\AchatMonnaieAdherentFormType; use App\Form\Type\AchatMonnaieAdherentFormType;
use App\Form\Type\AchatMonnaieAdherentRecurrentFormType;
use App\Form\Type\AchatMonnaiePrestataireFormType; use App\Form\Type\AchatMonnaiePrestataireFormType;
use App\Form\Type\AdherentInfosFormType; use App\Form\Type\AdherentInfosFormType;
use App\Form\Type\ChangeAdherentComptoirFormType; use App\Form\Type\ChangeAdherentComptoirFormType;
...@@ -474,6 +475,19 @@ class FormFactory ...@@ -474,6 +475,19 @@ class FormFactory
return $form->createView(); return $form->createView();
} }
public function getPaiementRecurrentCotisationTAVForm(User $user)
{
if (empty($user) || !$user->isGranted('ROLE_ADHERENT')) {
throw new \Exception('[FORM 25] Opération impossible !');
}
$entity = new AchatMonnaieAdherent();
$entity->setOperateur($user);
$form = $this->ff->create(AchatMonnaieAdherentRecurrentFormType::class, $entity, ['action' => $this->router->generate('paiementRecurrentCotisTav')]);
return $form->createView();
}
public function getComptoirEncaisserDonAdherentForm(User $user) public function getComptoirEncaisserDonAdherentForm(User $user)
{ {
if (empty($user) || empty($this->session->get('_comptoirgere'))) { if (empty($user) || empty($this->session->get('_comptoirgere'))) {
......
<?php
namespace App\Form\Type;
use App\Entity\AchatMonnaieAdherent;
use App\Entity\Adherent;
use App\Entity\DonAdherent;
use App\Entity\GlobalParameter;
use App\Entity\Prestataire;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
class AchatMonnaieAdherentRecurrentFormType extends AchatMonnaieAdherentFormType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$now = new \DateTime();
//force prelevement to occur on same day as today to make sure next prelevement occurs next month
//if today is after the 28th, use the 28th so that prelevement always occurs on same date
$jourPrelevement = min($now->format('d'),28);
$builder
->add('nombreMois', IntegerType::class, [
'label' => 'Nombre d\'échéances désirées : ',
'required' => true,
'mapped' => false,
'constraints' => [
new GreaterThanOrEqual(['value' => 2, 'message' => "Le nombre d'échéances doit être au moins égal à 2."]),
],
'help' => "Une échéance par mois.
Le premier paiement est inclus dans le nombre d'échéances.
Le nombre d'échéance réel pourra être diminué selon la date d'expiration du moyen de paiement utilisé.
Pour demander une interruption anticipée, merci de contacter la caisse.",
'attr' => ['autocomplete' => 'off']
])
->add('jourPrelevement', ChoiceType::class, [
'label' => 'Jour du prélèvement dans le mois : ',
'choices' => [strval($jourPrelevement) => $jourPrelevement],
'data' => $jourPrelevement,
'required' => true,
'mapped' => false,
'attr' => ['autocomplete' => 'off', 'readonly' => true],
'help' => "Pour simplifier le traitement de l'information, le jour de prélèvement est fixé au jour du premier paiement ou au plus tard le 28 du mois."
])
->remove('saveHelloAsso')
->remove('save')
->add('save', SubmitType::class, [
'label' => 'Payer en CB mon premier paiement et créer un paiement récurrent',
'translation_domain' => 'messages',
'attr' => [
'class' => 'btn-primary btn achatCBSubmit',
],
])
->remove('reference')
->add('reference', HiddenType::class, [
'data' => 'Achat monnaie en CB (récurrent) Adhérent',
])
;
$builder
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'class' => AchatMonnaieAdherent::class,
]);
}
public function getParent()
{
return AchatMonnaieAdherentFormType::class;
}
public function getBlockPrefix()
{
return 'formAchatMonnaieAdherentRecurrent';
}
}
...@@ -36,11 +36,22 @@ class AchatMonnaieFormType extends FluxFormType ...@@ -36,11 +36,22 @@ class AchatMonnaieFormType extends FluxFormType
if ($this->container->getParameter('tav_env')) { if ($this->container->getParameter('tav_env')) {
$montant = 0; $montant = 0;
$profilDeCotisation = $this->security->getUser()->getAdherent()->getProfilDeCotisation();
if (null != $profilDeCotisation) { if ($this->container->getParameter('household_based_allowance')) {
$montant = $profilDeCotisation->getMontant(); $cosisationMontant = $this->security->getUser()->getAdherent()->getCotisationAmount();
if (null != $cosisationMontant) {
$montant = $cosisationMontant;
} else {
$montant = false;
}
} else { } else {
$montant = false; $profilDeCotisation = $this->security->getUser()->getAdherent()->getProfilDeCotisation();
if (null != $profilDeCotisation) {
$montant = $profilDeCotisation->getMontant();
} else {
$montant = false;
}
} }
$builder $builder
......
<?php
namespace App\Form\Type;
use App\Entity\DependentChild;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DependentChildFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('olderThanFourteen', ChoiceType::class, array(
'choices' => [
'oui' => true,
'non' => false
],
'label' => "A-t-il plus de 14 ans ?",
'required' => true,
'expanded' => true
))
->add('sharedCustodyPercentage', ChoiceType::class, [
'label' => "Est-il en garde partagée ?",
'required' => true,
'choices' => [
'non' => null,
'oui : je le garde 25 % du temps' => '0.25',//using strings as values (and not floats) seems required
'oui : je le garde 50 % du temps' => '0.50',//to make display work fine
'oui : je le garde 75 % du temps' => '0.75',
],
'required' => false,
'attr' => ['autocomplete' => 'off'] //avoid non-saved value to be displayed
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => DependentChild::class,
]);
}
public function getBlockPrefix()
{
return 'formDependentChild';
}
}
<?php
namespace App\Form\Type;
use App\Entity\Prestataire;
use App\Entity\SelfEvalPrestaQuiz;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
class DistributorSelfEvalPrestaQuizType extends SelfEvalPrestaQuizType
{
public function __construct(Security $security, array $options = [])
{
parent::__construct($security, $options);
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
/* PARTIE 3 : TRANSPARENCE ET JUSTE REMUNERATION */
$this->opts['label'] = "Juste rémunération : les prix d'achats aux producteurs correspondent-ils au coût de la production (y compris la rémunération) ?";
$this->opts['choices'] = [
$this->frown . " pas connaissance du coût de production des produits achetés" => 0,
$this->meh . " ne correspondent pas toujours mais connaissance du coût de production" => 1,
$this->smile . " oui" => 2,
];
$builder->add('transpar_jusrem', ChoiceType::class, $this->opts);
$builder->add('transpar_jusrem_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Transparence : les consommateurs peuvent-ils accéder à des informations leur permettant de comprendre
comment les prix des produits sont construits ?";
$this->opts['choices'] = [
$this->frown . " aucun moyen d'avoir accès aux informations" => 0,
$this->meh . " au moins via l'équipe en discutant" => 1,
$this->smile . " affichages et en discutant" => 2,
];
$builder->add('transpar_transp', ChoiceType::class, $this->opts);
$builder->add('transpar_transp_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Relation au producteur : sur l'offre alimentaire globale, quels sont les circuits de commercialisation majoritaires ?";
$this->opts['choices'] = [
$this->frown . " plus de 2 intermédiaires connus ou intraçable" => 0,
$this->meh . " 2 intermédiaires connus" => 1,
$this->smile . " 0 ou 1 intermédiaire connu" => 2,
];
$builder->add('transpar_relpro', ChoiceType::class, $this->opts);
$builder->add('transpar_relpro_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Transparence et juste rémunération : " . $this->labelEvalGlob;
$this->opts['choices'] = $this->stdGlobalChoices;
$builder->add('transpar_global', ChoiceType::class, $this->opts);
$builder->add('transpar_global_comment', TextareaType::class, $this->globalCmtOpts);
/* PARTIE 4 : PRATIQUES AGRICOLES DURABLES */
$this->opts['label'] = "Détenez-vous des labels ou des certifications (AB, Bio, Nature et Progrès, système de garantie
participatif ou équivalent minimum ?";
$this->opts['choices'] = [
$this->frown . " moins de 50 % des produits" => 0,
$this->meh . " entre 50 et 70% des produits" => 1,
$this->smile . " plus de 70 % des produits" => 2,
];
$builder->add('disagdur_labels', ChoiceType::class, $this->opts);
$builder->add('disagdur_labels_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Le point de vente s'assure-t-il que ses produits alimentaires non labellisés mais conventionnables sont issus
de pratiques agricoles durables ?";
$this->opts['choices'] = [
$this->frown . " non" => 0,
$this->meh . " oui par des échanges avec le producteur ou le revendeur qui connaît les pratiques agricoles du secteur" => 1,
$this->smile . " oui" => 2,
];
$builder->add('disagdur_condur', ChoiceType::class, $this->opts);
$builder->add('disagdur_condur_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Pratiques agricoles durables : " . $this->labelEvalGlob;
$this->opts['choices'] = $this->stdGlobalChoices;
$builder->add('disagdur_global', ChoiceType::class, $this->opts);
$builder->add('disagdur_global_comment', TextareaType::class, $this->globalCmtOpts);
/* PARTIE 5 : LOCALITE DES PRODUITS */
$this->opts['label'] = "Quelle est la provenance de l'offre alimentaire globale en produits bruts ?";
$this->opts['choices'] = [
$this->frown . " 0 à 49 % de produits locaux (moins de 250 km à la ronde)" => 0,
$this->meh . " 50 à 79 % de produits locaux (moins de 250 km à la ronde)" => 1,
$this->smile . " plus de 80 % de produits locaux (moins de 250 km à la ronde)" => 2,
];
$builder->add('localite_probru', ChoiceType::class, $this->opts);
$builder->add('localite_probru_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Quelle est la provenance de l'offre alimentaire globale en produits transformés ?";
$this->opts['choices'] = [
$this->frown . " 0 à 24 % de produits locaux (moins de 250 km à la ronde)" => 0,
$this->meh . " 25 à 49 % de produits locaux (moins de 250 km à la ronde)" => 1,
$this->smile . " plus de 50 % de produits locaux (moins de 250 km à la ronde)" => 2,
];
$builder->add('localite_protra', ChoiceType::class, $this->opts);
$builder->add('localite_protra_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Localité des produits : " . $this->labelEvalGlob;
$this->opts['choices'] = $this->stdGlobalChoices;
$builder->add('localite_global', ChoiceType::class, $this->opts);
$builder->add('localite_global_comment', TextareaType::class, $this->globalCmtOpts);
//Review
if($options['mode'] !== self::PRESTA_EDIT) {
$this->reviewOpts['label'] = "Transparence et juste rémunération : " . $this->reviewLabel;
$this->reviewOpts['choices'] = $this->stdGlobalChoices;
$builder->add('review_transpar_global', ChoiceType::class, $this->reviewOpts);
$builder->add('review_transpar_global_comment', TextareaType::class, $this->reviewCmtOpts);
$this->reviewOpts['label'] = "Pratiques agricoles durables : " . $this->reviewLabel;
$this->reviewOpts['choices'] = $this->stdGlobalChoices;
$builder->add('review_disagdur_global', ChoiceType::class, $this->reviewOpts);
$builder->add('review_disagdur_global_comment', TextareaType::class, $this->reviewCmtOpts);
$this->reviewOpts['label'] = "Localité des produits : " . $this->reviewLabel;
$this->reviewOpts['choices'] = $this->stdGlobalChoices;
$builder->add('review_localite_global', ChoiceType::class, $this->reviewOpts);
$builder->add('review_localite_global_comment', TextareaType::class, $this->reviewCmtOpts);
}
}
public function getBlockPrefix(): string
{
return 'formDistributorSelfEvalPrestaQuiz';
}
}
...@@ -10,23 +10,29 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType; ...@@ -10,23 +10,29 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\DependencyInjection\ContainerInterface;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\GlobalParameter;
class EncaissementFormType extends AbstractType class EncaissementFormType extends AbstractType
{ {
protected $em; protected $em;
protected $security; protected $security;
protected $container;
public function __construct( public function __construct(
EntityManagerInterface $em, EntityManagerInterface $em,
Security $security Security $security,
ContainerInterface $container
) { ) {
$this->em = $em; $this->em = $em;
$this->security = $security; $this->security = $security;
$this->container = $container;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$mlcName = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_NAME_SMALL);
$builder $builder
->add('adherent', EntityType::class, [ ->add('adherent', EntityType::class, [
'class' => Adherent::class, 'class' => Adherent::class,
...@@ -40,7 +46,7 @@ class EncaissementFormType extends AbstractType ...@@ -40,7 +46,7 @@ class EncaissementFormType extends AbstractType
'choice_label' => 'name' 'choice_label' => 'name'
]) ])
->add('montant', NumberType::class, [ ->add('montant', NumberType::class, [
'label' => 'Montant : ', 'label' => "Montant à payer en {$mlcName} : ",
'required' => true, 'required' => true,
'attr' => ['autocomplete' => 'off'] 'attr' => ['autocomplete' => 'off']
]) ])
...@@ -51,6 +57,20 @@ class EncaissementFormType extends AbstractType ...@@ -51,6 +57,20 @@ class EncaissementFormType extends AbstractType
]) ])
->add('save', SubmitType::class, ['label' => 'Valider']) ->add('save', SubmitType::class, ['label' => 'Valider'])
; ;
if ($this->container->getParameter('presta_self_init_and_eval')) {
$builder
->add('montantPanier', NumberType::class, [
'label' => 'Montant total du panier : ',
'required' => true,
'attr' => ['autocomplete' => 'off'],
'mapped' => false,
'help' => ''
])
;
}
} }
public function getBlockPrefix() public function getBlockPrefix()
......
...@@ -20,13 +20,17 @@ class EncaisserCotisationAdherentFormType extends VenteEmlcAdherentFormType ...@@ -20,13 +20,17 @@ class EncaisserCotisationAdherentFormType extends VenteEmlcAdherentFormType
// Get the cotisation amount for each adherent. Used for display purposes on the front end. // Get the cotisation amount for each adherent. Used for display purposes on the front end.
$adherents = $this->em->getRepository(Adherent::class)->findOrderByName(); $adherents = $this->em->getRepository(Adherent::class)->findOrderByName();
$adherentsProfiles = []; $adherentsCotisationAmounts = [];
foreach ($adherents as $adh) { foreach ($adherents as $adh) {
$montant = null; $montant = null;
if (!is_null($adh->getProfilDeCotisation()) ) {
if ($this->container->getParameter('household_based_allowance') && !is_null($adh->getCotisationAmount())) {
$montant = $adh->getCotisationAmount();
} else if (!$this->container->getParameter('household_based_allowance') && !is_null($adh->getProfilDeCotisation())) {
$montant = $adh->getProfilDeCotisation()->getMontant(); $montant = $adh->getProfilDeCotisation()->getMontant();
} }
$adherentsProfiles[strval($adh->getId())] = $montant;
$adherentsCotisationAmounts[strval($adh->getId())] = $montant;
} }
$builder $builder
...@@ -37,7 +41,7 @@ class EncaisserCotisationAdherentFormType extends VenteEmlcAdherentFormType ...@@ -37,7 +41,7 @@ class EncaisserCotisationAdherentFormType extends VenteEmlcAdherentFormType
'data' => 0 'data' => 0
]) ])
->add('cotisationMontants', HiddenType::class, [ ->add('cotisationMontants', HiddenType::class, [
'data' => json_encode($adherentsProfiles), 'data' => json_encode($adherentsCotisationAmounts),
'mapped' => false 'mapped' => false
]) ])
; ;
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
namespace App\Form\Type; namespace App\Form\Type;
use App\Entity\Geoloc; use App\Entity\Geoloc;
use App\Entity\Subterritory;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ButtonType; use Symfony\Component\Form\Extension\Core\Type\ButtonType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
...@@ -71,6 +73,25 @@ class GeolocFormType extends AbstractType ...@@ -71,6 +73,25 @@ class GeolocFormType extends AbstractType
]) ])
; ;
} }
if (true === $options['with_quartier']) {
$builder
->add('quartier', TextType::class, [
'required' => false,
])
;
}
if (true === $options['with_subterritory']) {
$builder
->add('subterritory', EntityType::class, [
'class' => Subterritory::class,
'label' => 'Territoire',
'required' => true,
'choice_label' => 'name',
'placeholder' => "Choix du territoire",
'attr' => ['autocomplete' => 'off']
])
;
}
} }
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
...@@ -80,6 +101,8 @@ class GeolocFormType extends AbstractType ...@@ -80,6 +101,8 @@ class GeolocFormType extends AbstractType
'data_class' => Geoloc::class, 'data_class' => Geoloc::class,
'with_geoloc' => true, 'with_geoloc' => true,
'with_latlon' => true, 'with_latlon' => true,
'with_subterritory' => false,
'with_quartier' => false
]); ]);
} }
......
...@@ -331,6 +331,27 @@ class GlobalConfigurationFormType extends AbstractType ...@@ -331,6 +331,27 @@ class GlobalConfigurationFormType extends AbstractType
'required' => false, 'required' => false,
'_placeholder' => '', '_placeholder' => '',
]) ])
->add('raisongestionnairevirementreconversion', GlobalParameterType::class, [
'label' => 'Raison du gestionnaire pour les virements de reconversion automatisés',
'_description' => 'Raison du gestionnaire pour les virements de reconversion automatisés',
'name_param' => GlobalParameter::VIREMENT_RECONVERSION_RAISON_GESTIONNAIRE,
'required' => false,
'_placeholder' => '',
])
->add('bicgestionnairevirementreconversion', GlobalParameterType::class, [
'label' => 'BIC du gestionnaire pour les virements de reconversion automatisés',
'_description' => 'BIC du gestionnaire pour les virements de reconversion automatisés',
'name_param' => GlobalParameter::VIREMENT_RECONVERSION_BIC_GESTIONNAIRE,
'required' => false,
'_placeholder' => '',
])
->add('ibangestionnairevirementreconversion', GlobalParameterType::class, [
'label' => 'IBAN du gestionnaire pour les virements de reconversion automatisés',
'_description' => 'IBAN du gestionnaire pour les virements de reconversion automatisés',
'name_param' => GlobalParameter::VIREMENT_RECONVERSION_IBAN_GESTIONNAIRE,
'required' => false,
'_placeholder' => '',
])
; ;
} }
......
<?php
namespace App\Form\Type;
use App\Entity\Prestataire;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotNull;
/**
* Identification questionnaire for prestataire.
*/
class InfosPrestaQuizType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('userFirstName', TextType::class, [
'mapped' => false, //store it into the user
'label' => 'Prénom',
'required' => true,
'constraints' => [new NotNull()],
])
->add('userLastName', TextType::class, [
'mapped' => false, //store it into the user
'label' => 'Nom',
'required' => true,
'constraints' => [new NotNull()],
])
->add('raison', TextType::class, [
'required' => true,
'constraints' => [new NotNull()],
])
->add('responsable', TextType::class, [
'required' => true,
'constraints' => [new NotNull()],
'label' => 'Nom du responsable'
])
->add('metier', TextType::class, [
'label' => 'Fonction du responsable',
'required' => true,
'constraints' => [new NotNull()],
])
->add('horaires', TextType::class, [
'label' => "Jours et horaires d'ouverture :",
'required' => true,
'constraints' => [new NotNull()],
])
->add('geolocs', CollectionType::class, [
'entry_type' => GeolocPrestataireFormType::class,
'entry_options' => ['label' => false, 'with_latlon' => false],
'required' => true,
'allow_add' => false,
'allow_delete' => false,
'by_reference' => false,
'label' => false,
])
->add('marketchannelfunction', ChoiceType::class, [
'label' => 'Fonction dans le circuit de distribution',
'choices' => [
'Distributeur/distributrice' => Prestataire::DISTRIBUTOR,
'Producteur/productrice' => Prestataire::PRODUCER,
],
'required' => true,
'constraints' => [new NotNull()],
])
->add('save', SubmitType::class, ['label' => 'Envoyer'])
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Prestataire::class,
]);
}
public function getBlockPrefix(): string
{
return 'formInfosPrestaQuiz';
}
}
...@@ -4,7 +4,10 @@ namespace App\Form\Type; ...@@ -4,7 +4,10 @@ namespace App\Form\Type;
use App\Application\Sonata\MediaBundle\Entity\Media; use App\Application\Sonata\MediaBundle\Entity\Media;
use App\Entity\Prestataire; use App\Entity\Prestataire;
use App\Entity\PrestataireProductFamily;
use App\Form\Type\PrestataireProductFamilyFormType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use FOS\CKEditorBundle\Form\Type\CKEditorType; use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\MediaBundle\Form\Type\MediaType; use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
...@@ -13,16 +16,21 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType; ...@@ -13,16 +16,21 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType;
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\UrlType; use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use App\Enum\ReconversionFrequencyEnum;
use App\Entity\GlobalParameter;
class PrestataireInfosFormType extends AbstractType class PrestataireInfosFormType extends AbstractType
{ {
protected $em; protected $em;
protected $container;
public function __construct(EntityManagerInterface $em) public function __construct(EntityManagerInterface $em, ContainerInterface $container)
{ {
$this->em = $em; $this->em = $em;
$this->container = $container;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
...@@ -58,6 +66,11 @@ class PrestataireInfosFormType extends AbstractType ...@@ -58,6 +66,11 @@ class PrestataireInfosFormType extends AbstractType
'label' => 'SIRET :', 'label' => 'SIRET :',
'required' => false, 'required' => false,
]) ])
//bic is new field in kohinos-ssa (I think it's OK to add it for non-tav env as well)
->add('bic', TextType::class, [
'label' => 'BIC :',
'required' => false,
])
->add('iban', TextType::class, [ ->add('iban', TextType::class, [
'label' => 'IBAN :', 'label' => 'IBAN :',
'required' => false, 'required' => false,
...@@ -77,7 +90,47 @@ class PrestataireInfosFormType extends AbstractType ...@@ -77,7 +90,47 @@ class PrestataireInfosFormType extends AbstractType
->add('web', UrlType::class, [ ->add('web', UrlType::class, [
'label' => 'Site web :', 'label' => 'Site web :',
'required' => false, 'required' => false,
]) ]);
if ($this->container->getParameter('tav_env') && $this->container->getParameter('automatisation_reconversion')) {
$mlcName = $this->em->getRepository(GlobalParameter::class)->val(GlobalParameter::MLC_NAME_SMALL);
$helpMsqg = "Fréquence à laquelle je souhaite que la caisse commune de l'alimentation (via l'association Acclimat'action)"
. " me verse en euros la somme des {$mlcName} encaissées dans mon point de vente "
. "(1 {$mlcName} = 1 euro). Le versement se fait via un virement bancaire.";
$builder
->add('reconversionFrequency', ChoiceType::class, [
'choices' => ReconversionFrequencyEnum::getAvailableTypes(),
'choice_label' => function ($choice) {
return ReconversionFrequencyEnum::getTypeName($choice);
},
'expanded' => false,
'multiple' => false,
'label' => 'Fréquence de reconversion :',
'placeholder' => 'Choisir une option',
'required' => false,
'help' => $helpMsqg
]);
}
if ($this->container->getParameter('tav_env') && $this->container->getParameter('presta_extra_data')) {
$builder
->add('prestataireProductFamilies', CollectionType::class, [
'entry_type' => PrestataireProductFamilyFormType::class,
'required' => true,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'constraints' => new \Symfony\Component\Validator\Constraints\Valid(),
'label' => "Produits vendus, regroupés par famille ",
'error_mapping' => [
'productFamily' => 'prestataireProductFamilies',
],
]);
}
$builder
->add('description', CKEditorType::class, [ ->add('description', CKEditorType::class, [
'label' => 'Description :', 'label' => 'Description :',
'required' => false, 'required' => false,
......
<?php
namespace App\Form\Type;
use App\Entity\PrestataireProductFamily;
use App\Entity\ProductFamily;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
class PrestataireProductFamilyFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('productFamily', EntityType::class, array(
'class' => ProductFamily::class,
'choice_label' => 'name',
'label' => false,
'required' => true,
'placeholder' => 'Choisissez une famille de produits',
'attr' => ['class' => 'prestataire-product-families-select']
))
->add('products', TextareaType::class, [
'label' => false,
'required' => true,
'attr' => [
'class' => 'prestataire-product-families-products',
'placeholder' => 'Renseignez des produits correspondant à cette famille'
],
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => PrestataireProductFamily::class,
]);
}
public function getBlockPrefix()
{
return 'formPrestataireProductFamily';
}
}
<?php
namespace App\Form\Type;
use App\Entity\Prestataire;
use App\Entity\SelfEvalPrestaQuiz;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
class ProducerSelfEvalPrestaQuizType extends SelfEvalPrestaQuizType
{
public function __construct(Security $security, array $options = [])
{
parent::__construct($security, $options);
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
/* PARTIE 4 : PRATIQUES AGRICOLES DURABLES */
$this->opts['label'] = "Détenez-vous des labels ou des certifications (AB Bio, Nature et Progrès, système de garantie participatif ou équivalent minimum) ?";
$this->opts['choices'] = [
$this->frown . " non" => 0,
$this->smile . " oui" => 2,
];
$builder->add('proagdur_labels', ChoiceType::class, $this->opts);
$builder->add('proagdur_labels_comment', TextareaType::class, $this->cmtOpts);
//Jusqu'à la fin
$this->opts['choices'] = $this->stdChoices;
$this->opts['label'] = "Les pratiques agricoles permettent-elles de valoriser la biodiversité ?";
$builder->add('proagdur_valbio', ChoiceType::class, $this->opts);
$builder->add('proagdur_valbio_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Les pratiques agricoles permettent-elles l'économie ou le recyclage de l'énergie, de l'eau, de la matière organique, des nutriments ?";
$builder->add('proagdur_ecorec', ChoiceType::class, $this->opts);
$builder->add('proagdur_ecorec_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Les pratiques agricoles réduisent-elles les pertes agricoles (au champ ou post-récolte) ?";
$builder->add('proagdur_pertes', ChoiceType::class, $this->opts);
$builder->add('proagdur_pertes_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Les pratiques agricoles contribuent-elles à l'atténuation ou à l'adaptation au changement climatique ?";
$builder->add('proagdur_climat', ChoiceType::class, $this->opts);
$builder->add('proagdur_climat_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Les pratiques agricoles permettent-elles de renforcer l'autonomie de la ferme en ressources génétiques (végétales ou animales), en eau, en intrants, en énergie ?";
$builder->add('proagdur_geneti', ChoiceType::class, $this->opts);
$builder->add('proagdur_geneti_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Les pratiques agricoles permettent-elles la protection des sols ?";
$builder->add('proagdur_prosol', ChoiceType::class, $this->opts);
$builder->add('proagdur_prosol_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Pratiques agricoles durables : " . $this->labelEvalGlob . " (cochez vert si vous détenez un label ou une certification)";
$this->opts['choices'] = $this->stdGlobalChoices;
$builder->add('proagdur_global', ChoiceType::class, $this->opts);
$builder->add('proagdur_global_comment', TextareaType::class, $this->globalCmtOpts);
//Review
if($options['mode'] !== self::PRESTA_EDIT) {
$this->reviewOpts['label'] = "Pratiques agricoles durables : " . $this->reviewLabel;
$this->reviewOpts['choices'] = $this->stdGlobalChoices;
$builder->add('review_proagdur_global', ChoiceType::class, $this->reviewOpts);
$builder->add('review_proagdur_global_comment', TextareaType::class, $this->reviewCmtOpts);
}
}
public function getBlockPrefix(): string
{
return 'formProducerSelfEvalPrestaQuiz';
}
}
<?php
namespace App\Form\Type;
use App\Entity\SelfEvalPrestaQuiz;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
/**
*
* Self-eval prestataire questionnaire base class
* containing useful attributes and buildForm for
* sections that are common to distributors and producers
*/
class SelfEvalPrestaQuizType extends AbstractType
{
const PRESTA_EDIT = 'presta_edit';
const ADMIN_EDIT = 'admin_edit';
const READONLY = 'readonly';
const PRESTA_EDIT_AFTER_DEFINITIVE_SUBMISSION = 'presta_edit_after_definitive_submission';
protected $security;
protected array $stdChoices;
protected array $opts;
protected array $reviewOpts;
protected array $cmtOpts;
protected array $globalCmtOpts;
protected array $reviewCmtOpts;
protected string $labelEvalGlob;
protected string $reviewLabel;
protected string $frown;
protected string $meh;
protected string $smile;
public function __construct(Security $security, array $options = [])
{
$this->security = $security;
$this->frown = '<i class="fas fa-frown text-danger"></i>';
$this->meh = '<i class="fas fa-meh text-warning"></i>';
$this->smile = '<i class="fas fa-smile text-success"></i>';
$this->stdChoices = [
$this->frown . ' non' => 0,
$this->meh . ' peut être amélioré' => 1,
$this->smile . ' oui' => 2,
];
$this->stdGlobalChoices = [
$this->frown => 0,
$this->meh => 1,
$this->smile => 2,
];
$this->labelEvalGlob = "évaluation globale";
$this->reviewLabel = "évaluation du gestionnaire";
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
//options are moved to buildForm as 'mode' option is required to set them up
$this->reviewOpts = [
'label' => '',
'choices' => $this->stdChoices,
'expanded' => true,
"multiple" => false,
'disabled' => $options['mode'] !== self::ADMIN_EDIT
];
$this->opts = $this->reviewOpts;
$this->opts['disabled'] = $options['mode'] !== self::PRESTA_EDIT && $options['mode'] !== self::PRESTA_EDIT_AFTER_DEFINITIVE_SUBMISSION;
$this->reviewCmtOpts = [
'attr' => [
'placeholder' => $options['mode'] !== self::ADMIN_EDIT ? '' : 'Commentaires'
],
'label' => false,
'required' => false,
'disabled' => $options['mode'] !== self::ADMIN_EDIT
];
$this->cmtOpts = $this->reviewCmtOpts;
$this->cmtOpts['disabled'] = $options['mode'] !== self::PRESTA_EDIT && $options['mode'] !== self::PRESTA_EDIT_AFTER_DEFINITIVE_SUBMISSION;
$this->cmtOpts['attr']['placeholder'] = $options['mode'] !== self::PRESTA_EDIT ? '' : 'Commentaires';
$this->globalCmtOpts = $this->cmtOpts;
$this->globalCmtOpts['required'] = true;
$this->globalCmtOpts['attr']['placeholder'] = $options['mode'] !== self::PRESTA_EDIT && $options['mode'] !== self::PRESTA_EDIT_AFTER_DEFINITIVE_SUBMISSION ? '' : 'Commentaires (obligatoire)';
$builder->add($options["mode"],HiddenType::class,['mapped' => false]); //ease conditionnal display in twig
/* PARTIE 1 : ACCESSIBILITE ET INCLUSIVITE */
$this->opts['label'] = "Géographique et physique : le point de vente est-il accessible par différents modes de transport ?";
$this->opts['choices'] = [
$this->frown . " 0 mode de transport" => 0,
$this->meh . " 1 mode de transport" => 1,
$this->smile . " plus d'1 mode de transport" => 2,
];
$builder->add('accessib_geophy', ChoiceType::class, $this->opts);
$builder->add('accessib_geophy_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Temporelle : le point de vente communique-t-il sur ses plages d'ouvertures ?";
$this->opts['choices'] = [
$this->frown . " 0 mode de communication" => 0,
$this->meh . " 1 mode de communication" => 1,
$this->smile . " plus d'1 mode de communication" => 2,
];
$builder->add('accessib_tempor', ChoiceType::class, $this->opts);
$builder->add('accessib_tempor_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Sociale et inclusivité (1/3) : le point de vente mène-t-il des actions de sensibilisation et d'éducation populaire à l'alimentation ?";
$this->opts['choices'] = $this->stdChoices;
$builder->add('accessib_edupop', ChoiceType::class, $this->opts);
$builder->add('accessib_edupop_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Sociale et inclusivité (2/3) : le point de vente propose-t-il des services spécifiques pour faciliter son accessibilité à une diversité
de profils (pour les personnes agées, les personnes en situation de handicap, les familles ...) ?";
$this->opts['choices'] = $this->stdChoices;
$builder->add('accessib_divers', ChoiceType::class, $this->opts);
$builder->add('accessib_divers_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Sociale et inclusivité (3/3) : le point de vente mène-t-il des actions spécifiques pour lutter contre la vulnérabilité alimentaire ?";
$this->opts['choices'] = $this->stdChoices;
$builder->add('accessib_vulner', ChoiceType::class, $this->opts);
$builder->add('accessib_vulner_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Accessibilité et inclusivité : " . $this->labelEvalGlob;
$this->opts['choices'] = $this->stdGlobalChoices;
$builder->add('accessib_global', ChoiceType::class, $this->opts);
$builder->add('accessib_global_comment', TextareaType::class, $this->globalCmtOpts);
/* PARTIE 2 : BIEN-ETRE AU TRAVAIL */
$this->opts['label'] = "Le point de vente met-il en place des actions pour faciliter l'accueil, l'intégration et la formation des personnes qui y travaillent ?";
$this->opts['choices'] = $this->stdChoices;
$builder->add('bienetre_format', ChoiceType::class, $this->opts);
$builder->add('bienetre_format_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Les travailleurs sont-ils impliqués dans la gouvernance ?";
$this->opts['choices'] = $this->stdChoices;
$builder->add('bienetre_impgou', ChoiceType::class, $this->opts);
$builder->add('bienetre_impgou_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Le point de vente met-il en place des actions pour améliorer le bien-être des personnes qui y travaillent ?";
$this->opts['choices'] = $this->stdChoices;
$builder->add('bienetre_bienet', ChoiceType::class, $this->opts);
$builder->add('bienetre_bienet_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Le point de vente met-il en place des actions pour valoriser et reconnaître le travail fourni par les bénévoles ?";
$this->opts['choices'] = $this->stdChoices;
$builder->add('bienetre_recben', ChoiceType::class, $this->opts);
$builder->add('bienetre_recben_comment', TextareaType::class, $this->cmtOpts);
$this->opts['label'] = "Bien-être au travail : " . $this->labelEvalGlob;
$this->opts['choices'] = $this->stdGlobalChoices;
$builder->add('bienetre_global', ChoiceType::class, $this->opts);
$builder->add('bienetre_global_comment', TextareaType::class, $this->globalCmtOpts);
//Review
if($options['mode'] !== self::PRESTA_EDIT) {
$this->reviewOpts['label'] = "Accessibilité et inclusivité : " . $this->reviewLabel;
$this->reviewOpts['choices'] = $this->stdGlobalChoices;
$builder->add('review_accessib_global', ChoiceType::class, $this->reviewOpts);
$builder->add('review_accessib_global_comment', TextareaType::class, $this->reviewCmtOpts);
$this->reviewOpts['label'] = "Bien-être au travail : " . $this->reviewLabel;
$this->reviewOpts['choices'] = $this->stdGlobalChoices;
$builder->add('review_bienetre_global', ChoiceType::class, $this->reviewOpts);
$builder->add('review_bienetre_global_comment', TextareaType::class, $this->reviewCmtOpts);
}
if($options['mode'] !== self::READONLY) {
$builder->add('submit_presta_quizz', HiddenType::class, [
"mapped" => false,
"data" => 1,
"empty_data" => 1
]);
$builder->add('save', SubmitType::class, ['label' => $options['mode'] === self::PRESTA_EDIT ? 'Envoyer' : 'Enregistrer']);
}
if($options['mode'] == self::PRESTA_EDIT) {
$builder->add('temporary_save', SubmitType::class, ['label' => 'Sauvegarder afin de revenir plus tard']);
}
}
/**
*
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => SelfEvalPrestaQuiz::class,
'mode' => self::PRESTA_EDIT
]);
}
public function getBlockPrefix(): string
{
return 'formSelfEvalPrestaQuiz';
}
}
<?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 Version20240214104305 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE selfevalprestaquiz (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', accessib_geophy INT NOT NULL, accessib_tempor INT NOT NULL, accessib_edupop INT NOT NULL, accessib_divers INT NOT NULL, accessib_vulner INT NOT NULL, accessib_geophy_comment LONGTEXT NOT NULL, accessib_tempor_comment LONGTEXT NOT NULL, accessib_edupop_comment LONGTEXT NOT NULL, accessib_divers_comment LONGTEXT NOT NULL, accessib_vulner_comment LONGTEXT NOT NULL, bienetre_format INT NOT NULL, bienetre_format_comment LONGTEXT NOT NULL, bienetre_impgou INT NOT NULL, bienetre_impgou_comment LONGTEXT NOT NULL, bienetre_bienet INT NOT NULL, bienetre_bienet_comment LONGTEXT NOT NULL, bienetre_recben INT NOT NULL, bienetre_recben_comment LONGTEXT NOT NULL, transpar_jusrem INT NOT NULL, transpar_jusrem_comment LONGTEXT NOT NULL, transpar_transp INT NOT NULL, transpar_transp_comment LONGTEXT NOT NULL, transpar_relpro INT NOT NULL, transpar_relpro_comment LONGTEXT NOT NULL, disagdur_labels INT NOT NULL, disagdur_labels_comment LONGTEXT NOT NULL, disagdur_condur INT NOT NULL, disagdur_condur_comment LONGTEXT NOT NULL, proagdur_labels INT NOT NULL, proagdur_labels_comment LONGTEXT NOT NULL, proagdur_valbio INT NOT NULL, proagdur_valbio_comment LONGTEXT NOT NULL, proagdur_ecorec INT NOT NULL, proagdur_ecorec_comment LONGTEXT NOT NULL, proagdur_pertes INT NOT NULL, proagdur_pertes_comment LONGTEXT NOT NULL, proagdur_climat INT NOT NULL, proagdur_climat_comment LONGTEXT NOT NULL, proagdur_geneti INT NOT NULL, proagdur_geneti_comment LONGTEXT NOT NULL, proagdur_prosol INT NOT NULL, proagdur_prosol_comment LONGTEXT NOT NULL, localite_probru INT NOT NULL, localite_probru_comment LONGTEXT NOT NULL, localite_protra INT NOT NULL, localite_protra_comment LONGTEXT NOT NULL, accessib_global INT NOT NULL, accessib_global_comment LONGTEXT NOT NULL, bienetre_global INT NOT NULL, bienetre_global_comment LONGTEXT NOT NULL, transpar_global INT NOT NULL, transpar_global_comment LONGTEXT NOT NULL, disagdur_global INT NOT NULL, disagdur_global_comment LONGTEXT NOT NULL, proagdur_global INT NOT NULL, proagdur_global_comment LONGTEXT NOT NULL, localite_global INT NOT NULL, localite_global_comment LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE prestataire ADD selfevalprestaquiz_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD marketchannelfunction LONGTEXT DEFAULT NULL, CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('ALTER TABLE prestataire ADD CONSTRAINT FK_60A26480C5DC59A8 FOREIGN KEY (selfevalprestaquiz_id) REFERENCES selfevalprestaquiz (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_60A26480C5DC59A8 ON prestataire (selfevalprestaquiz_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire DROP FOREIGN KEY FK_60A26480C5DC59A8');
$this->addSql('DROP TABLE selfevalprestaquiz');
$this->addSql('DROP INDEX UNIQ_60A26480C5DC59A8 ON prestataire');
$this->addSql('ALTER TABLE prestataire DROP selfevalprestaquiz_id, DROP marketchannelfunction, CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
<?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 Version20240214152548 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('ALTER TABLE selfevalprestaquiz CHANGE accessib_geophy_comment accessib_geophy_comment LONGTEXT DEFAULT NULL, CHANGE accessib_tempor_comment accessib_tempor_comment LONGTEXT DEFAULT NULL, CHANGE accessib_edupop_comment accessib_edupop_comment LONGTEXT DEFAULT NULL, CHANGE accessib_divers_comment accessib_divers_comment LONGTEXT DEFAULT NULL, CHANGE accessib_vulner_comment accessib_vulner_comment LONGTEXT DEFAULT NULL, CHANGE bienetre_format_comment bienetre_format_comment LONGTEXT DEFAULT NULL, CHANGE bienetre_impgou_comment bienetre_impgou_comment LONGTEXT DEFAULT NULL, CHANGE bienetre_bienet_comment bienetre_bienet_comment LONGTEXT DEFAULT NULL, CHANGE bienetre_recben_comment bienetre_recben_comment LONGTEXT DEFAULT NULL, CHANGE transpar_jusrem_comment transpar_jusrem_comment LONGTEXT DEFAULT NULL, CHANGE transpar_transp_comment transpar_transp_comment LONGTEXT DEFAULT NULL, CHANGE transpar_relpro_comment transpar_relpro_comment LONGTEXT DEFAULT NULL, CHANGE disagdur_labels_comment disagdur_labels_comment LONGTEXT DEFAULT NULL, CHANGE disagdur_condur_comment disagdur_condur_comment LONGTEXT DEFAULT NULL, CHANGE proagdur_labels_comment proagdur_labels_comment LONGTEXT DEFAULT NULL, CHANGE proagdur_valbio_comment proagdur_valbio_comment LONGTEXT DEFAULT NULL, CHANGE proagdur_ecorec_comment proagdur_ecorec_comment LONGTEXT DEFAULT NULL, CHANGE proagdur_pertes_comment proagdur_pertes_comment LONGTEXT DEFAULT NULL, CHANGE proagdur_climat_comment proagdur_climat_comment LONGTEXT DEFAULT NULL, CHANGE proagdur_geneti_comment proagdur_geneti_comment LONGTEXT DEFAULT NULL, CHANGE proagdur_prosol_comment proagdur_prosol_comment LONGTEXT DEFAULT NULL, CHANGE localite_probru_comment localite_probru_comment LONGTEXT DEFAULT NULL, CHANGE localite_protra_comment localite_protra_comment LONGTEXT DEFAULT NULL, CHANGE accessib_global_comment accessib_global_comment LONGTEXT DEFAULT NULL, CHANGE bienetre_global_comment bienetre_global_comment LONGTEXT DEFAULT NULL, CHANGE transpar_global_comment transpar_global_comment LONGTEXT DEFAULT NULL, CHANGE disagdur_global_comment disagdur_global_comment LONGTEXT DEFAULT NULL, CHANGE proagdur_global_comment proagdur_global_comment LONGTEXT DEFAULT NULL, CHANGE localite_global_comment localite_global_comment LONGTEXT DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('ALTER TABLE selfevalprestaquiz CHANGE accessib_geophy_comment accessib_geophy_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE accessib_tempor_comment accessib_tempor_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE accessib_edupop_comment accessib_edupop_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE accessib_divers_comment accessib_divers_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE accessib_vulner_comment accessib_vulner_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE bienetre_format_comment bienetre_format_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE bienetre_impgou_comment bienetre_impgou_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE bienetre_bienet_comment bienetre_bienet_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE bienetre_recben_comment bienetre_recben_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE transpar_jusrem_comment transpar_jusrem_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE transpar_transp_comment transpar_transp_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE transpar_relpro_comment transpar_relpro_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE disagdur_labels_comment disagdur_labels_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE disagdur_condur_comment disagdur_condur_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE proagdur_labels_comment proagdur_labels_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE proagdur_valbio_comment proagdur_valbio_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE proagdur_ecorec_comment proagdur_ecorec_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE proagdur_pertes_comment proagdur_pertes_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE proagdur_climat_comment proagdur_climat_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE proagdur_geneti_comment proagdur_geneti_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE proagdur_prosol_comment proagdur_prosol_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE localite_probru_comment localite_probru_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE localite_protra_comment localite_protra_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE accessib_global_comment accessib_global_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE bienetre_global_comment bienetre_global_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE transpar_global_comment transpar_global_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE disagdur_global_comment disagdur_global_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE proagdur_global_comment proagdur_global_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, CHANGE localite_global_comment localite_global_comment LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`');
}
}
<?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 Version20240214152700 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('ALTER TABLE selfevalprestaquiz CHANGE accessib_geophy accessib_geophy INT DEFAULT NULL, CHANGE accessib_tempor accessib_tempor INT DEFAULT NULL, CHANGE accessib_edupop accessib_edupop INT DEFAULT NULL, CHANGE accessib_divers accessib_divers INT DEFAULT NULL, CHANGE accessib_vulner accessib_vulner INT DEFAULT NULL, CHANGE bienetre_format bienetre_format INT DEFAULT NULL, CHANGE bienetre_impgou bienetre_impgou INT DEFAULT NULL, CHANGE bienetre_bienet bienetre_bienet INT DEFAULT NULL, CHANGE bienetre_recben bienetre_recben INT DEFAULT NULL, CHANGE transpar_jusrem transpar_jusrem INT DEFAULT NULL, CHANGE transpar_transp transpar_transp INT DEFAULT NULL, CHANGE transpar_relpro transpar_relpro INT DEFAULT NULL, CHANGE disagdur_labels disagdur_labels INT DEFAULT NULL, CHANGE disagdur_condur disagdur_condur INT DEFAULT NULL, CHANGE proagdur_labels proagdur_labels INT DEFAULT NULL, CHANGE proagdur_valbio proagdur_valbio INT DEFAULT NULL, CHANGE proagdur_ecorec proagdur_ecorec INT DEFAULT NULL, CHANGE proagdur_pertes proagdur_pertes INT DEFAULT NULL, CHANGE proagdur_climat proagdur_climat INT DEFAULT NULL, CHANGE proagdur_geneti proagdur_geneti INT DEFAULT NULL, CHANGE proagdur_prosol proagdur_prosol INT DEFAULT NULL, CHANGE localite_probru localite_probru INT DEFAULT NULL, CHANGE localite_protra localite_protra INT DEFAULT NULL, CHANGE accessib_global accessib_global INT DEFAULT NULL, CHANGE bienetre_global bienetre_global INT DEFAULT NULL, CHANGE transpar_global transpar_global INT DEFAULT NULL, CHANGE disagdur_global disagdur_global INT DEFAULT NULL, CHANGE proagdur_global proagdur_global INT DEFAULT NULL, CHANGE localite_global localite_global INT DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('ALTER TABLE selfevalprestaquiz CHANGE accessib_geophy accessib_geophy INT NOT NULL, CHANGE accessib_tempor accessib_tempor INT NOT NULL, CHANGE accessib_edupop accessib_edupop INT NOT NULL, CHANGE accessib_divers accessib_divers INT NOT NULL, CHANGE accessib_vulner accessib_vulner INT NOT NULL, CHANGE bienetre_format bienetre_format INT NOT NULL, CHANGE bienetre_impgou bienetre_impgou INT NOT NULL, CHANGE bienetre_bienet bienetre_bienet INT NOT NULL, CHANGE bienetre_recben bienetre_recben INT NOT NULL, CHANGE transpar_jusrem transpar_jusrem INT NOT NULL, CHANGE transpar_transp transpar_transp INT NOT NULL, CHANGE transpar_relpro transpar_relpro INT NOT NULL, CHANGE disagdur_labels disagdur_labels INT NOT NULL, CHANGE disagdur_condur disagdur_condur INT NOT NULL, CHANGE proagdur_labels proagdur_labels INT NOT NULL, CHANGE proagdur_valbio proagdur_valbio INT NOT NULL, CHANGE proagdur_ecorec proagdur_ecorec INT NOT NULL, CHANGE proagdur_pertes proagdur_pertes INT NOT NULL, CHANGE proagdur_climat proagdur_climat INT NOT NULL, CHANGE proagdur_geneti proagdur_geneti INT NOT NULL, CHANGE proagdur_prosol proagdur_prosol INT NOT NULL, CHANGE localite_probru localite_probru INT NOT NULL, CHANGE localite_protra localite_protra INT NOT NULL, CHANGE accessib_global accessib_global INT NOT NULL, CHANGE bienetre_global bienetre_global INT NOT NULL, CHANGE transpar_global transpar_global INT NOT NULL, CHANGE disagdur_global disagdur_global INT NOT NULL, CHANGE proagdur_global proagdur_global INT NOT NULL, CHANGE localite_global localite_global INT NOT NULL');
}
}
<?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 Version20240215192514 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('ALTER TABLE selfevalprestaquiz ADD review_accessib_global INT DEFAULT NULL, ADD review_accessib_global_comment LONGTEXT DEFAULT NULL, ADD review_bienetre_global INT DEFAULT NULL, ADD review_bienetre_global_comment LONGTEXT DEFAULT NULL, ADD review_transpar_global INT DEFAULT NULL, ADD review_transpar_global_comment LONGTEXT DEFAULT NULL, ADD review_disagdur_global INT DEFAULT NULL, ADD review_disagdur_global_comment LONGTEXT DEFAULT NULL, ADD review_proagdur_global INT DEFAULT NULL, ADD review_proagdur_global_comment LONGTEXT DEFAULT NULL, ADD review_localite_global INT DEFAULT NULL, ADD review_localite_global_comment LONGTEXT DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('ALTER TABLE selfevalprestaquiz DROP review_accessib_global, DROP review_accessib_global_comment, DROP review_bienetre_global, DROP review_bienetre_global_comment, DROP review_transpar_global, DROP review_transpar_global_comment, DROP review_disagdur_global, DROP review_disagdur_global_comment, DROP review_proagdur_global, DROP review_proagdur_global_comment, DROP review_localite_global, DROP review_localite_global_comment');
}
}
<?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 Version20240216095500 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire ADD reconversionFrequency VARCHAR(50) DEFAULT NULL, CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire DROP reconversionFrequency, CHANGE iban iban LONGTEXT CHARACTER SET utf8mb3 DEFAULT NULL COLLATE `utf8mb3_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
<?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 Version20240216140320 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE product_family (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(100) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE product_family');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8mb3 DEFAULT NULL COLLATE `utf8mb3_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
<?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 Version20240219140409 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('CREATE UNIQUE INDEX UNIQ_C79A60FF5E237E06 ON product_family (name)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8mb3 DEFAULT NULL COLLATE `utf8mb3_general_ci` COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('DROP INDEX UNIQ_C79A60FF5E237E06 ON product_family');
}
}
<?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 Version20240220094817 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire ADD conventionnement NUMERIC(10, 2) NOT NULL, CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire DROP conventionnement, CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
<?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 Version20240220101222 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE prestataire_product_family (id INT AUTO_INCREMENT NOT NULL, prestataire_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', product_family_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', products LONGTEXT NOT NULL, INDEX IDX_9B0F7A58BE3DB2B7 (prestataire_id), INDEX IDX_9B0F7A58ADFEE0E7 (product_family_id), UNIQUE INDEX prestataireproductfamily (prestataire_id, product_family_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE prestataire_product_family ADD CONSTRAINT FK_9B0F7A58BE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id)');
$this->addSql('ALTER TABLE prestataire_product_family ADD CONSTRAINT FK_9B0F7A58ADFEE0E7 FOREIGN KEY (product_family_id) REFERENCES product_family (id)');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE prestataire_product_family');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8mb3 DEFAULT NULL COLLATE `utf8mb3_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
<?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 Version20240221094604 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\', CHANGE conventionnement conventionnement NUMERIC(10, 2) DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\', CHANGE conventionnement conventionnement NUMERIC(10, 2) NOT NULL');
}
}
<?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 Version20240227100023 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE selfevalprestaquiz ADD is_submitted TINYINT(1) DEFAULT \'0\' NOT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE selfevalprestaquiz DROP is_submitted');
}
}
<?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 Version20240302095543 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('ALTER TABLE user ADD before_first_login_with_presta_enabled TINYINT(1) DEFAULT \'1\' NOT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
$this->addSql('ALTER TABLE user DROP before_first_login_with_presta_enabled');
}
}
<?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 Version20240306164256 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE dependent_child (id INT AUTO_INCREMENT NOT NULL, adherent_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', older_than_fourteen TINYINT(1) NOT NULL, conventionnement NUMERIC(10, 2) DEFAULT NULL, INDEX IDX_15BF27C725F06C53 (adherent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE dependent_child ADD CONSTRAINT FK_15BF27C725F06C53 FOREIGN KEY (adherent_id) REFERENCES adherent (id)');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:personal_data)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE dependent_child');
$this->addSql('ALTER TABLE prestataire CHANGE iban iban LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_general_ci` COMMENT \'(DC2Type:personal_data)\'');
}
}
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