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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
118 additions
and
44 deletions
+118
-44
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
+0
-0
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:
admin.adherent.cotisations
:
class
:
App\Admin\CotisationAdherentAdmin
arguments
:
[
~
,
App\Entity\Cotisation
,
~
]
arguments
:
[
~
,
App\Entity\Cotisation
Adherent
,
~
]
tags
:
-
name
:
sonata.admin
manager_type
:
orm
...
...
@@ -167,7 +167,7 @@ services:
admin.prestataire.cotisations
:
class
:
App\Admin\CotisationPrestataireAdmin
arguments
:
[
~
,
App\Entity\Cotisation
,
~
]
arguments
:
[
~
,
App\Entity\Cotisation
Prestataire
,
~
]
tags
:
-
name
:
sonata.admin
manager_type
:
orm
...
...
src/Admin/AdherentAdmin.php
View file @
94c2f465
...
...
@@ -117,6 +117,8 @@ class AdherentAdmin extends AbstractAdmin
}
if
(
count
(
$adherent
->
getUser
()
->
getCotisations
())
<=
0
)
{
$cotisation
=
new
Cotisation
();
$cotisation
->
setOperateur
(
$adherent
->
getUser
());
$cotisation
->
setExpediteur
(
$adherent
);
$cotisation
->
setDebut
(
$now
);
$cotisation
->
setFin
(
new
\DateTime
(
'+ 1 year'
));
$adherent
->
getUser
()
->
addCotisation
(
$cotisation
);
...
...
src/Admin/CotisationAdherentAdmin.php
View file @
94c2f465
...
...
@@ -2,11 +2,15 @@
namespace
App\Admin
;
use
App\Entity\Adherent
;
use
App\Entity\User
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
use
Sonata\AdminBundle\Datagrid\ListMapper
;
use
Sonata\AdminBundle\Form\FormMapper
;
use
Sonata\AdminBundle\Route\RouteCollection
;
use
Sonata\AdminBundle\Show\ShowMapper
;
use
Symfony\Bridge\Doctrine\Form\Type\EntityType
;
use
Symfony\Component\Form\Extension\Core\Type\HiddenType
;
class
CotisationAdherentAdmin
extends
CotisationAdmin
{
...
...
@@ -26,7 +30,8 @@ class CotisationAdherentAdmin extends CotisationAdmin
$user
=
$this
->
security
->
getUser
();
$query
=
parent
::
createQuery
(
$context
);
$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
(
empty
(
$user
->
getGroupesgere
()))
{
...
...
@@ -70,11 +75,23 @@ class CotisationAdherentAdmin extends CotisationAdmin
{
$formMapper
->
with
(
'Cotisation'
,
[
'class'
=>
'col-md-8'
])
->
add
(
'operateur'
,
null
,
array
(
'label'
=>
'Adhérent'
,
'disabled'
=>
true
),
array
(
'admin_code'
=>
'admin.adherent.gerer'
->
add
(
'reference'
,
HiddenType
::
class
,
array
(
'data'
=>
'cotisation_adherent'
))
->
add
(
'type'
,
HiddenType
::
class
,
array
(
'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
()
;
...
...
@@ -96,8 +113,13 @@ class CotisationAdherentAdmin extends CotisationAdmin
{
unset
(
$this
->
listModes
[
'mosaic'
]);
$listMapper
->
addIdentifier
(
'operateur.username'
,
null
,
array
(
'label'
=>
'Login'
))
->
addIdentifier
(
'operateur.email'
,
null
,
array
(
'label'
=>
'Email'
));
->
addIdentifier
(
'expediteur'
,
null
,
array
(
'label'
=>
'Adherent'
))
->
addIdentifier
(
'expediteur.user.email'
,
null
,
array
(
'label'
=>
'Email'
))
;
parent
::
configureListFields
(
$listMapper
);
}
}
src/Admin/CotisationAdmin.php
View file @
94c2f465
...
...
@@ -4,6 +4,7 @@ namespace App\Admin;
use
App\Entity\Adherent
;
use
App\Entity\Prestataire
;
use
App\Entity\Siege
;
use
App\Enum\MoyenEnum
;
use
Sonata\AdminBundle\Admin\AbstractAdmin
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
...
...
@@ -11,9 +12,12 @@ use Sonata\AdminBundle\Datagrid\ListMapper;
use
Sonata\AdminBundle\Form\FormMapper
;
use
Sonata\AdminBundle\Route\RouteCollection
;
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\ChoiceType
;
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
;
class
CotisationAdmin
extends
AbstractAdmin
...
...
@@ -21,6 +25,7 @@ class CotisationAdmin extends AbstractAdmin
protected
$baseRouteName
=
'cotisation'
;
protected
$baseRoutePattern
=
'cotisation'
;
protected
$security
;
protected
$container
;
protected
$translator
;
protected
$datagridValues
=
[
...
...
@@ -28,9 +33,10 @@ class CotisationAdmin extends AbstractAdmin
'_sort_by'
=>
'createdAt'
,
];
public
function
setSecurity
(
Security
$security
)
public
function
setSecurity
(
Security
$security
,
ContainerInterface
$container
)
{
$this
->
security
=
$security
;
$this
->
container
=
$container
;
}
/**
...
...
@@ -56,8 +62,20 @@ class CotisationAdmin extends AbstractAdmin
$now
=
new
\DateTime
();
$formMapper
->
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
(
'montant'
,
null
,
array
(
'label'
=>
'Montant'
))
->
add
(
'montant'
,
MoneyType
::
class
,
array
(
'label'
=>
'Montant'
,
'data'
=>
$this
->
container
->
getParameter
(
'cotisation_montant'
)
))
->
add
(
'moyen'
,
ChoiceType
::
class
,
array
(
'required'
=>
true
,
'choices'
=>
MoyenEnum
::
getAvailableTypes
(),
...
...
@@ -93,7 +111,7 @@ class CotisationAdmin extends AbstractAdmin
protected
function
configureRoutes
(
RouteCollection
$collection
)
{
$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'
);
}
}
...
...
@@ -105,14 +123,22 @@ class CotisationAdmin extends AbstractAdmin
{
unset
(
$this
->
listModes
[
'mosaic'
]);
$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
(
'label'
=>
'Opérateur'
,
'disabled'
=>
true
))
->
addIdentifier
(
'cotisationInfos.annee'
)
->
addIdentifier
(
'montant'
)
->
addIdentifier
(
'moyen'
)
->
addIdentifier
(
'createdAt'
)
;
}
}
src/Admin/CotisationPrestataireAdmin.php
View file @
94c2f465
...
...
@@ -2,17 +2,27 @@
namespace
App\Admin
;
use
App\Entity\Prestataire
;
use
App\Entity\User
;
use
Sonata\AdminBundle\Datagrid\DatagridMapper
;
use
Sonata\AdminBundle\Datagrid\ListMapper
;
use
Sonata\AdminBundle\Form\FormMapper
;
use
Sonata\AdminBundle\Route\RouteCollection
;
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
{
protected
$baseRouteName
=
'cotisation_prestataire'
;
protected
$baseRoutePattern
=
'cotisation_prestataire'
;
public
function
configure
()
{
parent
::
configure
();
}
/**
* {@inheritdoc}
*/
...
...
@@ -21,7 +31,8 @@ class CotisationPrestataireAdmin extends CotisationAdmin
$user
=
$this
->
security
->
getUser
();
$query
=
parent
::
createQuery
(
$context
);
$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
(
empty
(
$user
->
getGroupesgere
()))
{
...
...
@@ -58,6 +69,7 @@ class CotisationPrestataireAdmin extends CotisationAdmin
parent
::
configureDatagridFilters
(
$datagridMapper
);
}
/**
* {@inheritdoc}
*/
...
...
@@ -65,11 +77,23 @@ class CotisationPrestataireAdmin extends CotisationAdmin
{
$formMapper
->
with
(
'Cotisation'
,
[
'class'
=>
'col-md-8'
])
->
add
(
'operateur'
,
null
,
array
(
'label'
=>
'Prestataire'
,
'disabled'
=>
true
),
array
(
'admin_code'
=>
'admin.prestataire.gerer'
->
add
(
'reference'
,
HiddenType
::
class
,
array
(
'data'
=>
'cotisation_prestataire'
))
->
add
(
'type'
,
HiddenType
::
class
,
array
(
'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
()
;
...
...
@@ -91,8 +115,8 @@ class CotisationPrestataireAdmin extends CotisationAdmin
{
unset
(
$this
->
listModes
[
'mosaic'
]);
$listMapper
->
addIdentifier
(
'
operateur.username'
,
null
,
array
(
'label'
=>
'Login
'
))
->
addIdentifier
(
'
operateu
r.email'
,
null
,
array
(
'label'
=>
'Email'
));
->
addIdentifier
(
'
expediteur'
,
null
,
array
(
'label'
=>
'Prestataire
'
))
->
addIdentifier
(
'
expediteur.use
r.email'
,
null
,
array
(
'label'
=>
'Email'
));
parent
::
configureListFields
(
$listMapper
);
}
}
src/Admin/PrestataireAdmin.php
View file @
94c2f465
This diff is collapsed.
Click to expand it.
src/Entity/Flux.php
View file @
94c2f465
...
...
@@ -122,7 +122,7 @@ abstract class Flux
/**
* @return User operateur
*/
public
function
getOperateur
()
:
User
public
function
getOperateur
()
:
?
User
{
return
$this
->
operateur
;
}
...
...
src/Form/Type/AdherentInfosFormType.php
View file @
94c2f465
...
...
@@ -7,7 +7,6 @@ use App\Entity\Groupe;
use
App\Entity\Prestataire
;
use
App\Entity\User
;
use
App\Enum\MoyenEnum
;
use
App\Form\Type\CotisationFormType
;
use
App\Form\Type\GeolocFormType
;
use
App\Form\Type\RegistrationFormType
;
use
Doctrine\DBAL\Types\FloatType
;
...
...
src/Form/Type/AdhererFormType.php
View file @
94c2f465
...
...
@@ -7,8 +7,6 @@ use App\Entity\Groupe;
use
App\Entity\Prestataire
;
use
App\Entity\User
;
use
App\Enum\MoyenEnum
;
use
App\Form\Type\AddCotisationFormType
;
use
App\Form\Type\CotisationFormType
;
use
App\Form\Type\GeolocFormType
;
use
App\Form\Type\RegistrationFormType
;
use
Doctrine\DBAL\Types\FloatType
;
...
...
src/Form/Type/CotisationFormType.php
View file @
94c2f465
...
...
@@ -5,8 +5,10 @@ namespace App\Form\Type;
use
App\Entity\Cotisation
;
use
App\Enum\MoyenEnum
;
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\HiddenType
;
use
Symfony\Component\Form\Extension\Core\Type\MoneyType
;
use
Symfony\Component\Form\FormBuilderInterface
;
use
Symfony\Component\Form\FormEvent
;
use
Symfony\Component\Form\FormEvents
;
...
...
@@ -17,6 +19,13 @@ class CotisationFormType extends FluxFormType
public
function
buildForm
(
FormBuilderInterface
$builder
,
array
$options
)
{
$builder
->
add
(
'type'
,
HiddenType
::
class
,
array
(
'data'
=>
'cotisation'
,
'data_class'
=>
null
))
->
add
(
'montant'
,
MoneyType
::
class
,
array
(
'label'
=>
'Montant'
,
))
->
add
(
'moyen'
,
ChoiceType
::
class
,
array
(
'required'
=>
true
,
'choices'
=>
MoyenEnum
::
getAvailableTypes
(),
...
...
@@ -24,16 +33,12 @@ class CotisationFormType extends FluxFormType
return
MoyenEnum
::
getTypeName
(
$choice
);
},
))
->
add
(
'montant'
,
HiddenType
::
class
,
array
(
'data'
=>
$this
->
getParameter
(
'cotisation_montant'
),
->
add
(
'recu'
,
CheckboxType
::
class
,
array
(
'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
}
public
function
getParent
()
{
return
FluxFormType
::
class
;
}
//
public function getParent()
//
{
//
return FluxFormType::class;
//
}
public
function
getBlockPrefix
()
{
...
...
src/Form/Type/CotisationInfosFormType.php
View file @
94c2f465
...
...
@@ -4,7 +4,6 @@ namespace App\Form\Type;
use
App\Entity\CotisationInfos
;
use
App\Entity\User
;
use
App\Form\Type\CotisationFormType
;
use
Doctrine\DBAL\Types\FloatType
;
use
Doctrine\ORM\EntityManager
;
use
Doctrine\ORM\EntityRepository
;
...
...
src/Form/Type/PrestataireInfosFormType.php
View file @
94c2f465
...
...
@@ -7,7 +7,6 @@ use App\Entity\Groupe;
use
App\Entity\Prestataire
;
use
App\Entity\User
;
use
App\Enum\MoyenEnum
;
use
App\Form\Type\CotisationFormType
;
use
App\Form\Type\GeolocFormType
;
use
App\Form\Type\RegistrationFormType
;
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