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
2c1beaf3
Commit
2c1beaf3
authored
Mar 28, 2024
by
Yvon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6048 : show all achats de monnaie in achats de monnaie tab
parent
dbfbae89
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
19 deletions
+46
-19
AchatMonnaieAdmin.php
src/Admin/AchatMonnaieAdmin.php
+46
-19
No files found.
src/Admin/AchatMonnaieAdmin.php
View file @
2c1beaf3
...
...
@@ -27,9 +27,17 @@ class AchatMonnaieAdmin extends FluxAdmin
public
function
createQuery
(
$context
=
'list'
)
{
$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
);
}
return
$query
;
}
...
...
@@ -43,17 +51,24 @@ class AchatMonnaieAdmin extends FluxAdmin
*/
protected
function
configureDatagridFilters
(
DatagridMapper
$datagridMapper
)
:
void
{
$datagridMapper
->
add
(
'type'
,
null
,
[
'advanced_filter'
=>
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
,
],
]);
//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)
//therefore filtering by type achat_monnaie_adherent VS achat_monnaie_prestataire
//would be confusing (selecting one of them would hide all vente_emlc operations)
if
(
!
$this
->
getConfigurationPool
()
->
getContainer
()
->
getParameter
(
'tav_env'
)
||
!
$this
->
getConfigurationPool
()
->
getContainer
()
->
getParameter
(
'ssa_friendly_flux_type_names'
))
{
$datagridMapper
->
add
(
'type'
,
null
,
[
'advanced_filter'
=>
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
$datagrid
->
buildPager
();
$query
=
clone
$datagrid
->
getQuery
();
$query
->
select
(
'SUM( '
.
$query
->
getRootAlias
()
.
'.montant) as total'
)
->
andWhere
(
$query
->
getRootAlias
()
.
'.parenttype = :parenttype'
)
->
setParameter
(
'parenttype'
,
Flux
::
TYPE_ACHAT
)
->
setFirstResult
(
null
)
->
setMaxResults
(
null
);
if
(
$this
->
getConfigurationPool
()
->
getContainer
()
->
getParameter
(
'tav_env'
)
&&
$this
->
getConfigurationPool
()
->
getContainer
()
->
getParameter
(
'ssa_friendly_flux_type_names'
))
{
$query
->
select
(
'SUM( '
.
$query
->
getRootAlias
()
.
'.montant) as total'
)
->
andWhere
(
$query
->
getRootAlias
()
.
'.parenttype = :parenttype'
.
' OR '
.
$query
->
getRootAliases
()[
0
]
.
'.parenttype = :parenttype2'
)
->
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
);
...
...
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