Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
agplv3
kohinos-tav
Commits
d3ac2456
Commit
d3ac2456
authored
Jan 04, 2022
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #134 - Liste déroulante pour gestionnaire de prestataire ordonné avec nom prenom (email)
parent
a85f7cfd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
PrestataireAdmin.php
src/Admin/PrestataireAdmin.php
+8
-4
UserRepository.php
src/Repository/UserRepository.php
+6
-2
No files found.
src/Admin/PrestataireAdmin.php
View file @
d3ac2456
...
...
@@ -293,8 +293,10 @@ class PrestataireAdmin extends AbstractAdmin
'multiple'
=>
true
,
'required'
=>
false
,
'label'
=>
'Associer à un(des) utilisateur(s) existant :'
,
'choices'
=>
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getRepository
(
User
::
class
)
->
findAll
(),
'choice_label'
=>
'username'
,
'choices'
=>
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getRepository
(
User
::
class
)
->
findOrderByName
(),
'choice_label'
=>
function
(
$user
)
{
return
$user
->
getLastname
()
.
' '
.
$user
->
getFirstname
()
.
' ('
.
$user
->
getEmail
()
.
')'
;
},
'placeholder'
=>
'Choisir un utilisateur'
,
])
->
add
(
'newusers'
,
CollectionType
::
class
,
[
...
...
@@ -317,8 +319,10 @@ class PrestataireAdmin extends AbstractAdmin
'multiple'
=>
true
,
'required'
=>
false
,
'label'
=>
'Associer à un(des) utilisateur(s) existant :'
,
'choices'
=>
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getRepository
(
User
::
class
)
->
findAll
(),
'choice_label'
=>
'username'
,
'choices'
=>
$this
->
getConfigurationPool
()
->
getContainer
()
->
get
(
'doctrine'
)
->
getRepository
(
User
::
class
)
->
findOrderByName
(),
'choice_label'
=>
function
(
$user
)
{
return
$user
->
getLastname
()
.
' '
.
$user
->
getFirstname
()
.
' ('
.
$user
->
getEmail
()
.
')'
;
},
'placeholder'
=>
'Choisir un utilisateur'
,
])
->
add
(
'newcaissiers'
,
CollectionType
::
class
,
[
...
...
src/Repository/UserRepository.php
View file @
d3ac2456
...
...
@@ -24,12 +24,16 @@ class UserRepository extends ServiceEntityRepository
*/
public
function
findOrderByName
()
{
$qb
=
$this
->
createQueryBuilder
(
'
p
'
);
$qb
=
$this
->
createQueryBuilder
(
'
u
'
);
return
$qb
->
where
(
'u.enabled = :enabled'
)
->
addSelect
(
'CASE WHEN (u.lastname IS NULL OR u.lastname = \'\') THEN 1 ELSE 0 END AS HIDDEN nameIsNull'
)
->
addSelect
(
'CASE WHEN (u.firstname IS NULL OR u.firstname = \'\') THEN 1 ELSE 0 END AS HIDDEN fnameIsNull'
)
->
setParameter
(
'enabled'
,
true
)
->
orderBy
(
'u.lastname'
,
'ASC'
)
->
orderBy
(
'nameIsNull'
,
'ASC'
)
->
addOrderBy
(
'fnameIsNull'
,
'ASC'
)
->
addOrderBy
(
'u.lastname'
,
'ASC'
)
->
addOrderBy
(
'u.firstname'
,
'ASC'
)
->
addOrderBy
(
'u.username'
,
'ASC'
)
->
getQuery
()
...
...
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