Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-mlc
kohinos
Commits
94c2f465
Commit
94c2f465
authored
Mar 05, 2019
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug cotisations BO + front
parent
23cd4354
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
243 additions
and
106 deletions
+243
-106
services.yaml
config/services.yaml
+2
-2
AdherentAdmin.php
src/Admin/AdherentAdmin.php
+2
-0
CotisationAdherentAdmin.php
src/Admin/CotisationAdherentAdmin.php
+30
-8
CotisationAdmin.php
src/Admin/CotisationAdmin.php
+33
-7
CotisationPrestataireAdmin.php
src/Admin/CotisationPrestataireAdmin.php
+32
-8
PrestataireAdmin.php
src/Admin/PrestataireAdmin.php
+125
-62
Flux.php
src/Entity/Flux.php
+1
-1
AdherentInfosFormType.php
src/Form/Type/AdherentInfosFormType.php
+0
-1
AdhererFormType.php
src/Form/Type/AdhererFormType.php
+0
-2
CotisationFormType.php
src/Form/Type/CotisationFormType.php
+18
-13
CotisationInfosFormType.php
src/Form/Type/CotisationInfosFormType.php
+0
-1
PrestataireInfosFormType.php
src/Form/Type/PrestataireInfosFormType.php
+0
-1
No files found.
config/services.yaml
View file @
94c2f465
...
@@ -129,7 +129,7 @@ services:
...
@@ -129,7 +129,7 @@ services:
admin.adherent.cotisations
:
admin.adherent.cotisations
:
class
:
App\Admin\CotisationAdherentAdmin
class
:
App\Admin\CotisationAdherentAdmin
arguments
:
[
~
,
App\Entity\Cotisation
,
~
]
arguments
:
[
~
,
App\Entity\Cotisation
Adherent
,
~
]
tags
:
tags
:
-
name
:
sonata.admin
-
name
:
sonata.admin
manager_type
:
orm
manager_type
:
orm
...
@@ -167,7 +167,7 @@ services:
...
@@ -167,7 +167,7 @@ services:
admin.prestataire.cotisations
:
admin.prestataire.cotisations
:
class
:
App\Admin\CotisationPrestataireAdmin
class
:
App\Admin\CotisationPrestataireAdmin
arguments
:
[
~
,
App\Entity\Cotisation
,
~
]
arguments
:
[
~
,
App\Entity\Cotisation
Prestataire
,
~
]
tags
:
tags
:
-
name
:
sonata.admin
-
name
:
sonata.admin
manager_type
:
orm
manager_type
:
orm
...
...
src/Admin/AdherentAdmin.php
View file @
94c2f465
...
@@ -117,6 +117,8 @@ class AdherentAdmin extends AbstractAdmin
...
@@ -117,6 +117,8 @@ class AdherentAdmin extends AbstractAdmin
}
}
if
(
count
(
$adherent
->
getUser
()
->
getCotisations
())
<=
0
)
{
if
(
count
(
$adherent
->
getUser
()
->
getCotisations
())
<=
0
)
{
$cotisation
=
new
Cotisation
();
$cotisation
=
new
Cotisation
();
$cotisation
->
setOperateur
(
$adherent
->
getUser
());
$cotisation
->
setExpediteur
(
$adherent
);
$cotisation
->
setDebut
(
$now
);
$cotisation
->
setDebut
(
$now
);
$cotisation
->
setFin
(
new
\DateTime
(
'+ 1 year'
));
$cotisation
->
setFin
(
new
\DateTime
(
'+ 1 year'
));
$adherent
->
getUser
()
->
addCotisation
(
$cotisation
);
$adherent
->
getUser
()
->
addCotisation
(
$cotisation
);
...
...
src/Admin/CotisationAdherentAdmin.php
View file @
94c2f465
...
@@ -2,11 +2,15 @@
...
@@ -2,11 +2,15 @@
namespace
App\Admin
;
namespace
App\Admin
;
use
App\Entity\Adherent
;
use
App\Entity\User
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
use
Sonata\AdminBundle\Datagrid\ListMapper
;
use
Sonata\AdminBundle\Datagrid\ListMapper
;
use
Sonata\AdminBundle\Form\FormMapper
;
use
Sonata\AdminBundle\Form\FormMapper
;
use
Sonata\AdminBundle\Route\RouteCollection
;
use
Sonata\AdminBundle\Route\RouteCollection
;
use
Sonata\AdminBundle\Show\ShowMapper
;
use
Sonata\AdminBundle\Show\ShowMapper
;
use
Symfony\Bridge\Doctrine\Form\Type\EntityType
;
use
Symfony\Component\Form\Extension\Core\Type\HiddenType
;
class
CotisationAdherentAdmin
extends
CotisationAdmin
class
CotisationAdherentAdmin
extends
CotisationAdmin
{
{
...
@@ -26,7 +30,8 @@ class CotisationAdherentAdmin extends CotisationAdmin
...
@@ -26,7 +30,8 @@ class CotisationAdherentAdmin extends CotisationAdmin
$user
=
$this
->
security
->
getUser
();
$user
=
$this
->
security
->
getUser
();
$query
=
parent
::
createQuery
(
$context
);
$query
=
parent
::
createQuery
(
$context
);
$query
->
leftJoin
(
$query
->
getRootAliases
()[
0
]
.
'.operateur'
,
'u'
)
$query
->
leftJoin
(
$query
->
getRootAliases
()[
0
]
.
'.operateur'
,
'u'
)
->
andWhere
(
'u.adherent IS NOT NULL'
)
->
andWhere
(
$query
->
getRootAliases
()[
0
]
.
".type='cotisation_adherent'"
)
// ->andWhere('u.adherent IS NOT NULL')
;
;
if
(
$user
->
isGranted
(
'ROLE_GESTION_GROUPE'
)
||
$user
->
isGranted
(
'ROLE_CONTACT'
))
{
if
(
$user
->
isGranted
(
'ROLE_GESTION_GROUPE'
)
||
$user
->
isGranted
(
'ROLE_CONTACT'
))
{
if
(
empty
(
$user
->
getGroupesgere
()))
{
if
(
empty
(
$user
->
getGroupesgere
()))
{
...
@@ -70,11 +75,23 @@ class CotisationAdherentAdmin extends CotisationAdmin
...
@@ -70,11 +75,23 @@ class CotisationAdherentAdmin extends CotisationAdmin
{
{
$formMapper
$formMapper
->
with
(
'Cotisation'
,
[
'class'
=>
'col-md-8'
])
->
with
(
'Cotisation'
,
[
'class'
=>
'col-md-8'
])
->
add
(
'operateur'
,
null
,
array
(
->
add
(
'reference'
,
HiddenType
::
class
,
array
(
'label'
=>
'Adhérent'
,
'data'
=>
'cotisation_adherent'
'disabled'
=>
true
))
),
array
(
->
add
(
'type'
,
HiddenType
::
class
,
array
(
'admin_code'
=>
'admin.adherent.gerer'
'data'
=>
'cotisation_adherent'
))
->
add
(
'expediteur'
,
EntityType
::
class
,
array
(
'label'
=>
'Expéditeur'
,
'class'
=>
Adherent
::
class
,
'choices'
=>
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getRepository
(
Adherent
::
class
)
->
findBy
(
array
(
'enabled'
=>
true
)),
'placeholder'
=>
'Choisir un adhérent'
,
'required'
=>
true
,
))
->
add
(
'operateur'
,
HiddenType
::
class
,
array
(
'data'
=>
$this
->
security
->
getUser
()
->
getId
(),
'entity_class'
=>
User
::
class
,
'em'
=>
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getManager
()
))
))
->
end
()
->
end
()
;
;
...
@@ -96,8 +113,13 @@ class CotisationAdherentAdmin extends CotisationAdmin
...
@@ -96,8 +113,13 @@ class CotisationAdherentAdmin extends CotisationAdmin
{
{
unset
(
$this
->
listModes
[
'mosaic'
]);
unset
(
$this
->
listModes
[
'mosaic'
]);
$listMapper
$listMapper
->
addIdentifier
(
'operateur.username'
,
null
,
array
(
'label'
=>
'Login'
))
->
addIdentifier
(
'expediteur'
,
null
,
array
(
->
addIdentifier
(
'operateur.email'
,
null
,
array
(
'label'
=>
'Email'
));
'label'
=>
'Adherent'
))
->
addIdentifier
(
'expediteur.user.email'
,
null
,
array
(
'label'
=>
'Email'
))
;
parent
::
configureListFields
(
$listMapper
);
parent
::
configureListFields
(
$listMapper
);
}
}
}
}
src/Admin/CotisationAdmin.php
View file @
94c2f465
...
@@ -4,6 +4,7 @@ namespace App\Admin;
...
@@ -4,6 +4,7 @@ namespace App\Admin;
use
App\Entity\Adherent
;
use
App\Entity\Adherent
;
use
App\Entity\Prestataire
;
use
App\Entity\Prestataire
;
use
App\Entity\Siege
;
use
App\Enum\MoyenEnum
;
use
App\Enum\MoyenEnum
;
use
Sonata\AdminBundle\Admin\AbstractAdmin
;
use
Sonata\AdminBundle\Admin\AbstractAdmin
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
...
@@ -11,9 +12,12 @@ use Sonata\AdminBundle\Datagrid\ListMapper;
...
@@ -11,9 +12,12 @@ use Sonata\AdminBundle\Datagrid\ListMapper;
use
Sonata\AdminBundle\Form\FormMapper
;
use
Sonata\AdminBundle\Form\FormMapper
;
use
Sonata\AdminBundle\Route\RouteCollection
;
use
Sonata\AdminBundle\Route\RouteCollection
;
use
Sonata\AdminBundle\Show\ShowMapper
;
use
Sonata\AdminBundle\Show\ShowMapper
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\Form\Extension\Core\Type\CheckboxType
;
use
Symfony\Component\Form\Extension\Core\Type\CheckboxType
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
use
Symfony\Component\Form\Extension\Core\Type\DateType
;
use
Symfony\Component\Form\Extension\Core\Type\DateType
;
use
Symfony\Component\Form\Extension\Core\Type\HiddenType
;
use
Symfony\Component\Form\Extension\Core\Type\MoneyType
;
use
Symfony\Component\Security\Core\Security
;
use
Symfony\Component\Security\Core\Security
;
class
CotisationAdmin
extends
AbstractAdmin
class
CotisationAdmin
extends
AbstractAdmin
...
@@ -21,6 +25,7 @@ class CotisationAdmin extends AbstractAdmin
...
@@ -21,6 +25,7 @@ class CotisationAdmin extends AbstractAdmin
protected
$baseRouteName
=
'cotisation'
;
protected
$baseRouteName
=
'cotisation'
;
protected
$baseRoutePattern
=
'cotisation'
;
protected
$baseRoutePattern
=
'cotisation'
;
protected
$security
;
protected
$security
;
protected
$container
;
protected
$translator
;
protected
$translator
;
protected
$datagridValues
=
[
protected
$datagridValues
=
[
...
@@ -28,9 +33,10 @@ class CotisationAdmin extends AbstractAdmin
...
@@ -28,9 +33,10 @@ class CotisationAdmin extends AbstractAdmin
'_sort_by'
=>
'createdAt'
,
'_sort_by'
=>
'createdAt'
,
];
];
public
function
setSecurity
(
Security
$security
)
public
function
setSecurity
(
Security
$security
,
ContainerInterface
$container
)
{
{
$this
->
security
=
$security
;
$this
->
security
=
$security
;
$this
->
container
=
$container
;
}
}
/**
/**
...
@@ -56,8 +62,20 @@ class CotisationAdmin extends AbstractAdmin
...
@@ -56,8 +62,20 @@ class CotisationAdmin extends AbstractAdmin
$now
=
new
\DateTime
();
$now
=
new
\DateTime
();
$formMapper
$formMapper
->
with
(
'Cotisation'
,
[
'class'
=>
'col-md-8'
])
->
with
(
'Cotisation'
,
[
'class'
=>
'col-md-8'
])
->
add
(
'parenttype'
,
HiddenType
::
class
,
array
(
'data'
=>
'cotisation'
))
->
add
(
'destinataire'
,
HiddenType
::
class
,
array
(
'data'
=>
1
,
'data_class'
=>
null
,
'entity_class'
=>
Siege
::
class
,
'em'
=>
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getManager
()
))
->
add
(
'cotisationInfos.annee'
,
null
,
array
(
'label'
=>
'Année'
,
'data'
=>
$now
->
format
(
'Y'
)))
->
add
(
'cotisationInfos.annee'
,
null
,
array
(
'label'
=>
'Année'
,
'data'
=>
$now
->
format
(
'Y'
)))
->
add
(
'montant'
,
null
,
array
(
'label'
=>
'Montant'
))
->
add
(
'montant'
,
MoneyType
::
class
,
array
(
'label'
=>
'Montant'
,
'data'
=>
$this
->
container
->
getParameter
(
'cotisation_montant'
)
))
->
add
(
'moyen'
,
ChoiceType
::
class
,
array
(
->
add
(
'moyen'
,
ChoiceType
::
class
,
array
(
'required'
=>
true
,
'required'
=>
true
,
'choices'
=>
MoyenEnum
::
getAvailableTypes
(),
'choices'
=>
MoyenEnum
::
getAvailableTypes
(),
...
@@ -93,7 +111,7 @@ class CotisationAdmin extends AbstractAdmin
...
@@ -93,7 +111,7 @@ class CotisationAdmin extends AbstractAdmin
protected
function
configureRoutes
(
RouteCollection
$collection
)
protected
function
configureRoutes
(
RouteCollection
$collection
)
{
{
$collection
->
remove
(
'delete'
);
$collection
->
remove
(
'delete'
);
if
(
$this
->
security
->
getUser
()
!=
null
&&
!
$this
->
security
->
getUser
()
->
isGranted
(
'ROLE_TRESORIER'
))
{
if
(
$this
->
security
->
getUser
()
!=
null
&&
!
(
$this
->
security
->
getUser
()
->
isGranted
(
'ROLE_TRESORIER'
)
||
$this
->
security
->
getUser
()
->
isGranted
(
'ROLE_SUPER_ADMIN'
)
))
{
$collection
->
clearExcept
(
'list'
);
$collection
->
clearExcept
(
'list'
);
}
}
}
}
...
@@ -105,14 +123,22 @@ class CotisationAdmin extends AbstractAdmin
...
@@ -105,14 +123,22 @@ class CotisationAdmin extends AbstractAdmin
{
{
unset
(
$this
->
listModes
[
'mosaic'
]);
unset
(
$this
->
listModes
[
'mosaic'
]);
$listMapper
$listMapper
->
addIdentifier
(
'cotisationInfos.annee'
,
null
,
array
(
'label'
=>
'Année'
))
->
addIdentifier
(
'montant'
,
null
,
array
(
'label'
=>
'Montant'
))
->
addIdentifier
(
'moyen'
,
null
,
array
(
'label'
=>
'Moyen'
))
->
addIdentifier
(
'createdAt'
,
null
,
array
(
'label'
=>
'Crée le'
))
->
addIdentifier
(
'operateur'
,
null
,
array
(
->
addIdentifier
(
'operateur'
,
null
,
array
(
'label'
=>
'Opérateur'
,
'label'
=>
'Opérateur'
,
'disabled'
=>
true
'disabled'
=>
true
))
))
->
addIdentifier
(
'cotisationInfos.annee'
)
->
addIdentifier
(
'montant'
)
->
addIdentifier
(
'moyen'
)
->
addIdentifier
(
'createdAt'
)
;
;
}
}
}
}
src/Admin/CotisationPrestataireAdmin.php
View file @
94c2f465
...
@@ -2,17 +2,27 @@
...
@@ -2,17 +2,27 @@
namespace
App\Admin
;
namespace
App\Admin
;
use
App\Entity\Prestataire
;
use
App\Entity\User
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
use
Sonata\AdminBundle\Datagrid\ListMapper
;
use
Sonata\AdminBundle\Datagrid\ListMapper
;
use
Sonata\AdminBundle\Form\FormMapper
;
use
Sonata\AdminBundle\Form\FormMapper
;
use
Sonata\AdminBundle\Route\RouteCollection
;
use
Sonata\AdminBundle\Route\RouteCollection
;
use
Sonata\AdminBundle\Show\ShowMapper
;
use
Sonata\AdminBundle\Show\ShowMapper
;
use
Symfony\Bridge\Doctrine\Form\Type\EntityType
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
use
Symfony\Component\Form\Extension\Core\Type\HiddenType
;
class
CotisationPrestataireAdmin
extends
CotisationAdmin
class
CotisationPrestataireAdmin
extends
CotisationAdmin
{
{
protected
$baseRouteName
=
'cotisation_prestataire'
;
protected
$baseRouteName
=
'cotisation_prestataire'
;
protected
$baseRoutePattern
=
'cotisation_prestataire'
;
protected
$baseRoutePattern
=
'cotisation_prestataire'
;
public
function
configure
()
{
parent
::
configure
();
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
...
@@ -21,7 +31,8 @@ class CotisationPrestataireAdmin extends CotisationAdmin
...
@@ -21,7 +31,8 @@ class CotisationPrestataireAdmin extends CotisationAdmin
$user
=
$this
->
security
->
getUser
();
$user
=
$this
->
security
->
getUser
();
$query
=
parent
::
createQuery
(
$context
);
$query
=
parent
::
createQuery
(
$context
);
$query
->
leftJoin
(
$query
->
getRootAliases
()[
0
]
.
'.operateur'
,
'u'
)
$query
->
leftJoin
(
$query
->
getRootAliases
()[
0
]
.
'.operateur'
,
'u'
)
->
andWhere
(
'u.prestataire IS NOT NULL'
)
->
andWhere
(
$query
->
getRootAliases
()[
0
]
.
".type='cotisation_prestataire'"
)
// ->andWhere('u.prestataire IS NOT NULL')
;
;
if
(
$user
->
isGranted
(
'ROLE_GESTION_GROUPE'
)
||
$user
->
isGranted
(
'ROLE_CONTACT'
))
{
if
(
$user
->
isGranted
(
'ROLE_GESTION_GROUPE'
)
||
$user
->
isGranted
(
'ROLE_CONTACT'
))
{
if
(
empty
(
$user
->
getGroupesgere
()))
{
if
(
empty
(
$user
->
getGroupesgere
()))
{
...
@@ -58,6 +69,7 @@ class CotisationPrestataireAdmin extends CotisationAdmin
...
@@ -58,6 +69,7 @@ class CotisationPrestataireAdmin extends CotisationAdmin
parent
::
configureDatagridFilters
(
$datagridMapper
);
parent
::
configureDatagridFilters
(
$datagridMapper
);
}
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
...
@@ -65,11 +77,23 @@ class CotisationPrestataireAdmin extends CotisationAdmin
...
@@ -65,11 +77,23 @@ class CotisationPrestataireAdmin extends CotisationAdmin
{
{
$formMapper
$formMapper
->
with
(
'Cotisation'
,
[
'class'
=>
'col-md-8'
])
->
with
(
'Cotisation'
,
[
'class'
=>
'col-md-8'
])
->
add
(
'operateur'
,
null
,
array
(
->
add
(
'reference'
,
HiddenType
::
class
,
array
(
'label'
=>
'Prestataire'
,
'data'
=>
'cotisation_prestataire'
'disabled'
=>
true
))
),
array
(
->
add
(
'type'
,
HiddenType
::
class
,
array
(
'admin_code'
=>
'admin.prestataire.gerer'
'data'
=>
'cotisation_prestataire'
))
->
add
(
'expediteur'
,
EntityType
::
class
,
array
(
'label'
=>
'Expéditeur'
,
'class'
=>
Prestataire
::
class
,
'choices'
=>
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getRepository
(
Prestataire
::
class
)
->
findBy
(
array
(
'enabled'
=>
true
)),
'placeholder'
=>
'Choisir un prestataire'
,
'required'
=>
true
,
))
->
add
(
'operateur'
,
HiddenType
::
class
,
array
(
'data'
=>
$this
->
security
->
getUser
()
->
getId
(),
'entity_class'
=>
User
::
class
,
'em'
=>
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getManager
()
))
))
->
end
()
->
end
()
;
;
...
@@ -91,8 +115,8 @@ class CotisationPrestataireAdmin extends CotisationAdmin
...
@@ -91,8 +115,8 @@ class CotisationPrestataireAdmin extends CotisationAdmin
{
{
unset
(
$this
->
listModes
[
'mosaic'
]);
unset
(
$this
->
listModes
[
'mosaic'
]);
$listMapper
$listMapper
->
addIdentifier
(
'
operateur.username'
,
null
,
array
(
'label'
=>
'Login
'
))
->
addIdentifier
(
'
expediteur'
,
null
,
array
(
'label'
=>
'Prestataire
'
))
->
addIdentifier
(
'
operateu
r.email'
,
null
,
array
(
'label'
=>
'Email'
));
->
addIdentifier
(
'
expediteur.use
r.email'
,
null
,
array
(
'label'
=>
'Email'
));
parent
::
configureListFields
(
$listMapper
);
parent
::
configureListFields
(
$listMapper
);
}
}
}
}
src/Admin/PrestataireAdmin.php
View file @
94c2f465
...
@@ -4,12 +4,14 @@ namespace App\Admin;
...
@@ -4,12 +4,14 @@ namespace App\Admin;
use
App\Admin\UserAdmin
;
use
App\Admin\UserAdmin
;
use
App\Entity\Cotisation
;
use
App\Entity\Cotisation
;
use
App\Entity\CotisationPrestataire
;
use
App\Entity\Geoloc
;
use
App\Entity\Geoloc
;
use
App\Entity\Groupe
;
use
App\Entity\Groupe
;
use
App\Entity\Prestataire
;
use
App\Entity\Prestataire
;
use
App\Entity\User
;
use
App\Entity\User
;
use
App\Entity\Usergroup
;
use
App\Entity\Usergroup
;
use
App\Enum\MoyenEnum
;
use
App\Enum\MoyenEnum
;
use
App\Form\Type\CotisationFormType
;
use
Doctrine\ORM\Query
;
use
Doctrine\ORM\Query
;
use
FOS\CKEditorBundle\Form\Type\CKEditorType
;
use
FOS\CKEditorBundle\Form\Type\CKEditorType
;
use
FOS\UserBundle\Model\UserManagerInterface
;
use
FOS\UserBundle\Model\UserManagerInterface
;
...
@@ -25,6 +27,7 @@ use Sonata\MediaBundle\Form\Type\MediaType;
...
@@ -25,6 +27,7 @@ use Sonata\MediaBundle\Form\Type\MediaType;
use
Symfony\Bridge\Doctrine\Form\Type\EntityType
;
use
Symfony\Bridge\Doctrine\Form\Type\EntityType
;
use
Symfony\Component\Form\Extension\Core\Type\CheckboxType
;
use
Symfony\Component\Form\Extension\Core\Type\CheckboxType
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
use
Symfony\Component\Form\Extension\Core\Type\CollectionType
;
use
Symfony\Component\Form\Extension\Core\Type\DateType
;
use
Symfony\Component\Form\Extension\Core\Type\DateType
;
use
Symfony\Component\Form\Extension\Core\Type\TextType
;
use
Symfony\Component\Form\Extension\Core\Type\TextType
;
use
Symfony\Component\Form\FormEvent
;
use
Symfony\Component\Form\FormEvent
;
...
@@ -81,6 +84,7 @@ class PrestataireAdmin extends AbstractAdmin
...
@@ -81,6 +84,7 @@ class PrestataireAdmin extends AbstractAdmin
// Initialize prestataire
// Initialize prestataire
$presta
=
$this
->
getSubject
();
$presta
=
$this
->
getSubject
();
$now
=
new
\DateTime
();
$now
=
new
\DateTime
();
$cotisation
=
null
;
if
(
$this
->
isCurrentRoute
(
'create'
))
{
if
(
$this
->
isCurrentRoute
(
'create'
))
{
$user
=
$this
->
userManager
->
createUser
();
$user
=
$this
->
userManager
->
createUser
();
$groupe
=
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getRepository
(
Usergroup
::
class
)
->
findOneByName
(
'Prestataire'
);
$groupe
=
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getRepository
(
Usergroup
::
class
)
->
findOneByName
(
'Prestataire'
);
...
@@ -92,6 +96,8 @@ class PrestataireAdmin extends AbstractAdmin
...
@@ -92,6 +96,8 @@ class PrestataireAdmin extends AbstractAdmin
}
}
if
(
count
(
$presta
->
getUser
()
->
getCotisations
())
<=
0
)
{
if
(
count
(
$presta
->
getUser
()
->
getCotisations
())
<=
0
)
{
$cotisation
=
new
Cotisation
();
$cotisation
=
new
Cotisation
();
$cotisation
->
setOperateur
(
$presta
->
getUser
());
$cotisation
->
setExpediteur
(
$presta
);
$cotisation
->
setDebut
(
$now
);
$cotisation
->
setDebut
(
$now
);
$cotisation
->
setFin
(
new
\DateTime
(
'+ 1 year'
));
$cotisation
->
setFin
(
new
\DateTime
(
'+ 1 year'
));
$user
->
addCotisation
(
$cotisation
);
$user
->
addCotisation
(
$cotisation
);
...
@@ -154,40 +160,36 @@ class PrestataireAdmin extends AbstractAdmin
...
@@ -154,40 +160,36 @@ class PrestataireAdmin extends AbstractAdmin
'placeholder'
=>
'Choisir un groupe'
,
'placeholder'
=>
'Choisir un groupe'
,
))
))
->
end
()
->
end
()
//@TODO : cotisationS
->
with
(
'Addresse'
,
[
'class'
=>
'col-md-5'
])
->
with
(
'Cotisation'
,
[
'class'
=>
'col-md-5'
])
->
add
(
'geoloc.adresse'
,
TextType
::
class
,
array
(
->
add
(
'user.cotisations.first.cotisationInfos.annee'
,
TextType
::
class
,
array
(
'label'
=>
'Année'
,
'data'
=>
$now
->
format
(
'Y'
)))
'label'
=>
'Addresse :'
,
->
add
(
'user.cotisations.first.montant'
,
TextType
::
class
,
array
(
'label'
=>
'Montant'
))
'required'
=>
false
->
add
(
'user.cotisations.first.moyen'
,
ChoiceType
::
class
,
array
(
'required'
=>
true
,
'label'
=>
'Moyen :'
,
'choices'
=>
MoyenEnum
::
getAvailableTypes
(),
'choice_label'
=>
function
(
$choice
)
{
return
MoyenEnum
::
getTypeName
(
$choice
);
},
))
))
->
add
(
'user.cotisations.first.cotisationInfos.recu'
,
CheckboxType
::
class
,
array
(
'label'
=>
'Reçu'
))
->
add
(
'geoloc.cpostal'
,
TextType
::
class
,
array
(
->
end
();
'label'
=>
'Code postal :'
,
if
(
!
$this
->
isCurrentRoute
(
'create'
))
{
'required'
=>
false
$formMapper
->
with
(
'Date'
,
[
'class'
=>
'col-md-5'
])
->
add
(
'user.cotisations.first.cotisationInfos.debut'
,
DateType
::
class
,
array
(
'label'
=>
'Date de début'
,
'data'
=>
new
\DateTime
(),
'widget'
=>
'single_text'
,
'html5'
=>
false
,
'attr'
=>
[
'class'
=>
'js-datepicker'
],
))
))
->
add
(
'user.cotisations.first.cotisationInfos.fin'
,
DateType
::
class
,
array
(
->
add
(
'geoloc.ville'
,
TextType
::
class
,
array
(
'label'
=>
'Date de fin'
,
'label'
=>
'Ville :'
,
'data'
=>
new
\DateTime
(
'+ 1 year'
),
'required'
=>
false
'widget'
=>
'single_text'
,
'html5'
=>
false
,
'attr'
=>
[
'class'
=>
'js-datepicker'
],
))
))
->
end
();
// ->add('geoloc.lat', TextType::class, array(
}
// 'label' => 'Latitude :',
$formMapper
// 'required' => false
// ))
// ->add('geoloc.lon', TextType::class, array(
// 'label' => 'Longitude :',
// 'required' => false
// ))
->
end
()
->
with
(
'Image'
,
[
'class'
=>
'col-md-5'
])
->
add
(
'media'
,
MediaType
::
class
,
array
(
'provider'
=>
'sonata.media.provider.image'
,
'context'
=>
'prestataire'
,
'help'
=>
$imageHelp
,
'required'
=>
false
))
->
end
()
->
with
(
'Société'
,
[
'class'
=>
'col-md-7'
])
->
with
(
'Société'
,
[
'class'
=>
'col-md-7'
])
->
add
(
'raison'
,
TextType
::
class
,
array
(
->
add
(
'raison'
,
TextType
::
class
,
array
(
'label'
=>
'Raison :'
,
'label'
=>
'Raison :'
,
...
@@ -199,11 +201,11 @@ class PrestataireAdmin extends AbstractAdmin
...
@@ -199,11 +201,11 @@ class PrestataireAdmin extends AbstractAdmin
))
))
->
add
(
'siret'
,
TextType
::
class
,
array
(
->
add
(
'siret'
,
TextType
::
class
,
array
(
'label'
=>
'SIRET :'
,
'label'
=>
'SIRET :'
,
'required'
=>
tru
e
'required'
=>
fals
e
))
))
->
add
(
'iban'
,
TextType
::
class
,
array
(
->
add
(
'iban'
,
TextType
::
class
,
array
(
'label'
=>
'IBAN :'
,
'label'
=>
'IBAN :'
,
'required'
=>
tru
e
'required'
=>
fals
e
))
))
->
add
(
'responsable'
,
TextType
::
class
,
array
(
->
add
(
'responsable'
,
TextType
::
class
,
array
(
'label'
=>
'Responsable :'
,
'label'
=>
'Responsable :'
,
...
@@ -211,49 +213,110 @@ class PrestataireAdmin extends AbstractAdmin
...
@@ -211,49 +213,110 @@ class PrestataireAdmin extends AbstractAdmin
))
))
->
add
(
'metier'
,
TextType
::
class
,
array
(
->
add
(
'metier'
,
TextType
::
class
,
array
(
'label'
=>
'Métier responsable :'
,
'label'
=>
'Métier responsable :'
,
'required'
=>
true
))
->
add
(
'description'
,
CKEditorType
::
class
,
array
(
'label'
=>
'Description'
,
'required'
=>
false
'required'
=>
false
))
))
->
add
(
'horaires'
,
TextType
::
class
,
array
(
->
add
(
'horaires'
,
TextType
::
class
,
array
(
'label'
=>
'Horaires'
,
'label'
=>
'Horaires'
,
'required'
=>
false
'required'
=>
false
))
))
->
end
()
->
add
(
'description'
,
CKEditorType
::
class
,
array
(
->
with
(
'Addresse'
,
[
'class'
=>
'col-md-5'
])
'label'
=>
'Description'
,
->
add
(
'geoloc.adresse'
,
TextType
::
class
,
array
(
'label'
=>
'Addresse :'
,
'required'
=>
false
'required'
=>
false
))
))
->
add
(
'geoloc.cpostal'
,
TextType
::
class
,
array
(
->
end
();
'label'
=>
'Code postal :'
,
if
(
$cotisation
!=
null
)
{
'required'
=>
false
//@TODO : cotisationS
$formMapper
->
with
(
'Cotisation'
,
[
'class'
=>
'col-md-5'
])
->
add
(
'user.cotisations.last.cotisationInfos.annee'
,
TextType
::
class
,
array
(
'label'
=>
'Année'
,
'data'
=>
$now
->
format
(
'Y'
)))
->
add
(
'user.cotisations.last.montant'
,
TextType
::
class
,
array
(
'label'
=>
'Montant'
))
->
add
(
'user.cotisations.last.moyen'
,
ChoiceType
::
class
,
array
(
'required'
=>
true
,
'label'
=>
'Moyen :'
,
'choices'
=>
MoyenEnum
::
getAvailableTypes
(),
'choice_label'
=>
function
(
$choice
)
{
return
MoyenEnum
::
getTypeName
(
$choice
);
},
))
))
->
add
(
'geoloc.ville'
,
TextType
::
class
,
array
(
->
add
(
'user.cotisations.last.cotisationInfos.recu'
,
CheckboxType
::
class
,
array
(
'label'
=>
'Reçu'
))
'label'
=>
'Ville :'
,
->
end
();
'required'
=>
false
if
(
!
$this
->
isCurrentRoute
(
'create'
))
{
$formMapper
->
with
(
'Date'
,
[
'class'
=>
'col-md-5'
])
->
add
(
'user.cotisations.last.cotisationInfos.debut'
,
DateType
::
class
,
array
(
'label'
=>
'Date de début'
,
'data'
=>
new
\DateTime
(),
'widget'
=>
'single_text'
,
'html5'
=>
false
,
'attr'
=>
[
'class'
=>
'js-datepicker'
],
))
))
// ->add('geoloc.lat', TextType::class, array(
->
add
(
'user.cotisations.last.cotisationInfos.fin'
,
DateType
::
class
,
array
(
// 'label' => 'Latitude :',
'label'
=>
'Date de fin'
,
// 'required' => false
'data'
=>
new
\DateTime
(
'+ 1 year'
),
// ))
'widget'
=>
'single_text'
,
// ->add('geoloc.lon', TextType::class, array(
'html5'
=>
false
,
// 'label' => 'Longitude :',
'attr'
=>
[
'class'
=>
'js-datepicker'
],
// 'required' => false
// ))
->
end
()
->
with
(
'Image'
,
[
'class'
=>
'col-md-5'
])
->
add
(
'media'
,
MediaType
::
class
,
array
(
'provider'
=>
'sonata.media.provider.image'
,
'context'
=>
'prestataire'
,
'help'
=>
$imageHelp
,
'required'
=>
false
))
))
->
end
();
}
}
else
{
$formMapper
->
end
()
->
end
()
->
tab
(
'Cotisation'
)
->
with
(
'Cotisations'
,
[
'class'
=>
'col-md-12'
])
->
add
(
'user.cotisations'
,
CollectionType
::
class
,
array
(
'entry_type'
=>
CotisationFormType
::
class
,
'data'
=>
$presta
->
getUser
()
->
getCotisations
(),
'entry_options'
=>
array
(
// 'class' => Cotisation::class,
// 'choices' => $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(CotisationPrestataire::class)->findBy(array('expediteur' => $presta)),
// 'choice_label' => 'reference',
// 'placeholder' => 'Cotisation',
// 'required' => false,
'label'
=>
false
),
'by_reference'
=>
false
,
'allow_add'
=>
false
,
'allow_delete'
=>
false
,
),
array
(
'admin_code'
=>
'admin.prestataire.cotisations'
))
->
end
()
->
end
()
;
;
// $formMapper
// ->tab('Cotisation '.$cotisation->getAnnee())
// ->with('Cotisation', ['class' => 'col-md-5'])
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y')))
// ->add('user.cotisations.get('.$cnt.').montant', TextType::class, array('label' => 'Montant'))
// ->add('user.cotisations.get('.$cnt.').moyen', ChoiceType::class, array(
// 'required' => true,
// 'label' => 'Moyen :',
// 'choices' => MoyenEnum::getAvailableTypes(),
// 'choice_label' => function ($choice) {
// return MoyenEnum::getTypeName($choice);
// },
// ))
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu'))
// ->end()
// ->with('Date', ['class' => 'col-md-5'])
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.debut', DateType::class, array(
// 'label' => 'Date de début',
// 'data' => new \DateTime(),
// 'widget' => 'single_text',
// 'html5' => false,
// 'attr' => ['class' => 'js-datepicker'],
// ))
// ->add('user.cotisations.get('.$cnt.').cotisationInfos.fin', DateType::class, array(
// 'label' => 'Date de fin',
// 'data' => new \DateTime('+ 1 year'),
// 'widget' => 'single_text',
// 'html5' => false,
// 'attr' => ['class' => 'js-datepicker'],
// ))
// ->end()
// ;
}
$formMapper
->
end
();
parent
::
configureFormFields
(
$formMapper
);
parent
::
configureFormFields
(
$formMapper
);
}
}
...
...
src/Entity/Flux.php
View file @
94c2f465
...
@@ -122,7 +122,7 @@ abstract class Flux
...
@@ -122,7 +122,7 @@ abstract class Flux
/**
/**
* @return User operateur
* @return User operateur
*/
*/
public
function
getOperateur
()
:
User
public
function
getOperateur
()
:
?
User
{
{
return
$this
->
operateur
;
return
$this
->
operateur
;
}
}
...
...
src/Form/Type/AdherentInfosFormType.php
View file @
94c2f465
...
@@ -7,7 +7,6 @@ use App\Entity\Groupe;
...
@@ -7,7 +7,6 @@ use App\Entity\Groupe;
use
App\Entity\Prestataire
;
use
App\Entity\Prestataire
;
use
App\Entity\User
;
use
App\Entity\User
;
use
App\Enum\MoyenEnum
;
use
App\Enum\MoyenEnum
;
use
App\Form\Type\CotisationFormType
;
use
App\Form\Type\GeolocFormType
;
use
App\Form\Type\GeolocFormType
;
use
App\Form\Type\RegistrationFormType
;
use
App\Form\Type\RegistrationFormType
;
use
Doctrine\DBAL\Types\FloatType
;
use
Doctrine\DBAL\Types\FloatType
;
...
...
src/Form/Type/AdhererFormType.php
View file @
94c2f465
...
@@ -7,8 +7,6 @@ use App\Entity\Groupe;
...
@@ -7,8 +7,6 @@ use App\Entity\Groupe;
use
App\Entity\Prestataire
;
use
App\Entity\Prestataire
;
use
App\Entity\User
;
use
App\Entity\User
;
use
App\Enum\MoyenEnum
;
use
App\Enum\MoyenEnum
;
use
App\Form\Type\AddCotisationFormType
;
use
App\Form\Type\CotisationFormType
;
use
App\Form\Type\GeolocFormType
;
use
App\Form\Type\GeolocFormType
;
use
App\Form\Type\RegistrationFormType
;
use
App\Form\Type\RegistrationFormType
;
use
Doctrine\DBAL\Types\FloatType
;
use
Doctrine\DBAL\Types\FloatType
;
...
...
src/Form/Type/CotisationFormType.php
View file @
94c2f465
...
@@ -5,8 +5,10 @@ namespace App\Form\Type;
...
@@ -5,8 +5,10 @@ namespace App\Form\Type;
use
App\Entity\Cotisation
;
use
App\Entity\Cotisation
;
use
App\Enum\MoyenEnum
;
use
App\Enum\MoyenEnum
;
use
App\Form\Type\CotisationInfosFormType
;
use
App\Form\Type\CotisationInfosFormType
;
use
Symfony\Component\Form\Extension\Core\Type\CheckboxType
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
use
Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
use
Symfony\Component\Form\Extension\Core\Type\HiddenType
;
use
Symfony\Component\Form\Extension\Core\Type\HiddenType
;
use
Symfony\Component\Form\Extension\Core\Type\MoneyType
;
use
Symfony\Component\Form\FormBuilderInterface
;
use
Symfony\Component\Form\FormBuilderInterface
;
use
Symfony\Component\Form\FormEvent
;
use
Symfony\Component\Form\FormEvent
;
use
Symfony\Component\Form\FormEvents
;
use
Symfony\Component\Form\FormEvents
;
...
@@ -17,6 +19,13 @@ class CotisationFormType extends FluxFormType
...
@@ -17,6 +19,13 @@ class CotisationFormType extends FluxFormType
public
function
buildForm
(
FormBuilderInterface
$builder
,
array
$options
)
public
function
buildForm
(
FormBuilderInterface
$builder
,
array
$options
)
{
{
$builder
$builder
->
add
(
'type'
,
HiddenType
::
class
,
array
(
'data'
=>
'cotisation'
,
'data_class'
=>
null
))
->
add
(
'montant'
,
MoneyType
::
class
,
array
(
'label'
=>
'Montant'
,
))
->
add
(
'moyen'
,
ChoiceType
::
class
,
array
(
->
add
(
'moyen'
,
ChoiceType
::
class
,
array
(
'required'
=>
true
,
'required'
=>
true
,
'choices'
=>
MoyenEnum
::
getAvailableTypes
(),
'choices'
=>
MoyenEnum
::
getAvailableTypes
(),
...
@@ -24,16 +33,12 @@ class CotisationFormType extends FluxFormType
...
@@ -24,16 +33,12 @@ class CotisationFormType extends FluxFormType
return
MoyenEnum
::
getTypeName
(
$choice
);
return
MoyenEnum
::
getTypeName
(
$choice
);
},
},
))
))
->
add
(
'montant'
,
HiddenType
::
class
,
array
(
->
add
(
'recu'
,
CheckboxType
::
class
,
array
(
'data'
=>
$this
->
getParameter
(
'cotisation_montant'
),
'label'
=>
'Reçu'
))
->
add
(
'cotisationInfos'
,
CotisationInfosFormType
::
class
,
array
(
'label'
=>
'Infos'
))
))
->
add
(
'type'
,
HiddenType
::
class
,
array
(
'data'
=>
'cotisation'
,
'data_class'
=>
null
));
// ->add('cotisationInfos', CotisationInfosFormType::class, array(
// 'label' => 'Infos'
// ))
;
;
}
}
...
@@ -49,10 +54,10 @@ class CotisationFormType extends FluxFormType
...
@@ -49,10 +54,10 @@ class CotisationFormType extends FluxFormType
}
}
public
function
getParent
()
//
public function getParent()
{
//
{
return
FluxFormType
::
class
;
//
return FluxFormType::class;
}
//
}
public
function
getBlockPrefix
()
public
function
getBlockPrefix
()
{
{
...
...
src/Form/Type/CotisationInfosFormType.php
View file @
94c2f465
...
@@ -4,7 +4,6 @@ namespace App\Form\Type;
...
@@ -4,7 +4,6 @@ namespace App\Form\Type;
use
App\Entity\CotisationInfos
;
use
App\Entity\CotisationInfos
;
use
App\Entity\User
;
use
App\Entity\User
;
use
App\Form\Type\CotisationFormType
;
use
Doctrine\DBAL\Types\FloatType
;
use
Doctrine\DBAL\Types\FloatType
;
use
Doctrine\ORM\EntityManager
;
use
Doctrine\ORM\EntityManager
;
use
Doctrine\ORM\EntityRepository
;
use
Doctrine\ORM\EntityRepository
;
...
...
src/Form/Type/PrestataireInfosFormType.php
View file @
94c2f465
...
@@ -7,7 +7,6 @@ use App\Entity\Groupe;
...
@@ -7,7 +7,6 @@ use App\Entity\Groupe;
use
App\Entity\Prestataire
;
use
App\Entity\Prestataire
;
use
App\Entity\User
;
use
App\Entity\User
;
use
App\Enum\MoyenEnum
;
use
App\Enum\MoyenEnum
;
use
App\Form\Type\CotisationFormType
;
use
App\Form\Type\GeolocFormType
;
use
App\Form\Type\GeolocFormType
;
use
App\Form\Type\RegistrationFormType
;
use
App\Form\Type\RegistrationFormType
;
use
Doctrine\DBAL\Types\FloatType
;
use
Doctrine\DBAL\Types\FloatType
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment