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
2
Merge Requests
2
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
1d7dc9dc
Commit
1d7dc9dc
authored
Jan 21, 2026
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adherent admin export: separate external dated data in columns
parent
2f379ae2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
7 deletions
+77
-7
AdherentAdmin.php
src/Admin/AdherentAdmin.php
+0
-6
ExternalAdherentDatedData.php
src/Entity/ExternalAdherentDatedData.php
+1
-1
CustomDoctrineORMQuerySourceIterator.php
src/Exporter/CustomDoctrineORMQuerySourceIterator.php
+29
-0
ExternalAdherentDatedDataRepository.php
src/Repository/ExternalAdherentDatedDataRepository.php
+47
-0
No files found.
src/Admin/AdherentAdmin.php
View file @
1d7dc9dc
...
@@ -1047,12 +1047,6 @@ class AdherentAdmin extends AbstractAdmin
...
@@ -1047,12 +1047,6 @@ class AdherentAdmin extends AbstractAdmin
$fields
[
"Montant d'allocation"
]
=
'allocationAmount'
;
$fields
[
"Montant d'allocation"
]
=
'allocationAmount'
;
$fields
[
"Solde e-MonA"
]
=
'emlcAccount.balance'
;
$fields
[
"Solde e-MonA"
]
=
'emlcAccount.balance'
;
}
}
if
(
$this
->
getConfigurationPool
()
->
getContainer
()
->
getParameter
(
'use_external_data'
))
{
$fields
[
"Cohorte"
]
=
'externalData.cohort'
;
$fields
[
"ID externe"
]
=
'externalData.external_id'
;
$fields
[
"Données datées"
]
=
'externalDatedDataCollection'
;
}
return
$fields
;
return
$fields
;
}
}
...
...
src/Entity/ExternalAdherentDatedData.php
View file @
1d7dc9dc
...
@@ -7,7 +7,7 @@ use Ramsey\Uuid\Doctrine\UuidGenerator;
...
@@ -7,7 +7,7 @@ use Ramsey\Uuid\Doctrine\UuidGenerator;
use
Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity
;
use
Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity
;
/**
/**
* @ORM\Entity
* @ORM\Entity
(repositoryClass="App\Repository\ExternalAdherentDatedDataRepository")
* @ORM\Table(name="external_adherent_dated_data", uniqueConstraints={@ORM\UniqueConstraint(name="adherentyear", columns={"adherent_id", "year"})})
* @ORM\Table(name="external_adherent_dated_data", uniqueConstraints={@ORM\UniqueConstraint(name="adherentyear", columns={"adherent_id", "year"})})
* @UniqueEntity(
* @UniqueEntity(
* fields={"adherent", "year"},
* fields={"adherent", "year"},
...
...
src/Exporter/CustomDoctrineORMQuerySourceIterator.php
View file @
1d7dc9dc
...
@@ -16,6 +16,7 @@ namespace App\Exporter;
...
@@ -16,6 +16,7 @@ namespace App\Exporter;
use
App\Entity\Adherent
;
use
App\Entity\Adherent
;
use
App\Entity\Prestataire
;
use
App\Entity\Prestataire
;
use
App\Entity\Flux
;
use
App\Entity\Flux
;
use
App\Entity\ExternalAdherentDatedData
;
use
App\Entity\GlobalParameter
;
use
App\Entity\GlobalParameter
;
use
App\Utils\CotisationUtils
;
use
App\Utils\CotisationUtils
;
use
Doctrine\ORM\EntityManagerInterface
;
use
Doctrine\ORM\EntityManagerInterface
;
...
@@ -119,6 +120,34 @@ class CustomDoctrineORMQuerySourceIterator extends AbstractPropertySourceIterato
...
@@ -119,6 +120,34 @@ class CustomDoctrineORMQuerySourceIterator extends AbstractPropertySourceIterato
$data
[
'Numéro d\'anonymisation'
]
=
$adherent
->
getAnonymousToken
();
$data
[
'Numéro d\'anonymisation'
]
=
$adherent
->
getAnonymousToken
();
}
}
$data
[
"Adresse"
]
=
(
string
)
(
$adherent
->
getGeoloc
()
?:
''
);
$data
[
"Adresse"
]
=
(
string
)
(
$adherent
->
getGeoloc
()
?:
''
);
if
(
$this
->
container
->
getParameter
(
'use_external_data'
))
{
// Add external data if exists
$ext_data
=
$adherent
->
getExternalData
();
$data
[
"Cohorte"
]
=
$ext_data
?
$ext_data
->
getCohort
()
:
""
;
$data
[
"ID externe"
]
=
$ext_data
?
$ext_data
->
getExternalId
()
:
""
;
// Add external dated data if exists
$ext_dated_data
=
$adherent
->
getExternalDatedDataCollection
();
/**
* If some line have an attribute and others don't, it won't be displayed.
* So we need to make sure every line in the file as [maxDatedDataCount] columns of dated data
*/
$maxDatedDataCount
=
$this
->
em
->
getRepository
(
ExternalAdherentDatedData
::
class
)
->
getMaxDatedDataCount
();
for
(
$i
=
0
;
$i
<
$maxDatedDataCount
;
$i
++
)
{
$yearCount
=
$i
+
1
;
if
(
$ext_dated_data
[
$i
])
{
$data
[
"Année
$yearCount
"
]
=
$ext_dated_data
[
$i
]
->
getYear
();
$data
[
"Revenu mensuel
$yearCount
"
]
=
$ext_dated_data
[
$i
]
->
getMonthlyIncome
();
$data
[
"Revenu annuel
$yearCount
"
]
=
$ext_dated_data
[
$i
]
->
getAnnualIncome
();
}
else
{
$data
[
"Année
$yearCount
"
]
=
""
;
$data
[
"Revenu mensuel
$yearCount
"
]
=
""
;
$data
[
"Revenu annuel
$yearCount
"
]
=
""
;
}
}
}
}
else
{
}
else
{
$cotisEnd
=
$this
->
cotisationUtils
->
isCotisationValidForAdherent
(
$adherent
);
$cotisEnd
=
$this
->
cotisationUtils
->
isCotisationValidForAdherent
(
$adherent
);
$cotisEnd
=
is_string
(
$cotisEnd
)
?
new
\DateTime
(
$cotisEnd
)
:
$cotisEnd
;
$cotisEnd
=
is_string
(
$cotisEnd
)
?
new
\DateTime
(
$cotisEnd
)
:
$cotisEnd
;
...
...
src/Repository/ExternalAdherentDatedDataRepository.php
0 → 100644
View file @
1d7dc9dc
<?php
namespace
App\Repository
;
use
App\Entity\ExternalAdherentDatedData
;
use
Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository
;
use
Doctrine\ORM\ORMException
;
use
Doctrine\Persistence\ManagerRegistry
;
/**
* @extends ServiceEntityRepository<ExternalAdherentDatedData>
*
* @method ExternalAdherentDatedData|null find($id, $lockMode = null, $lockVersion = null)
* @method ExternalAdherentDatedData|null findOneBy(array $criteria, array $orderBy = null)
* @method ExternalAdherentDatedData[] findAll()
* @method ExternalAdherentDatedData[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
* @method null removeAll()
*/
class
ExternalAdherentDatedDataRepository
extends
ServiceEntityRepository
{
public
function
__construct
(
ManagerRegistry
$registry
)
{
parent
::
__construct
(
$registry
,
ExternalAdherentDatedData
::
class
);
$em
=
$this
->
getEntityManager
();
$this
->
connection
=
$em
->
getConnection
();
}
/**
* @throws ORMException
* @return int|Null Returns the max number of ExternalAdherentDatedData an adherent can have
*/
public
function
getMaxDatedDataCount
()
{
$sqlQuery
=
"SELECT MAX(dated_data_count.count) AS max_dated_data_count
FROM (
SELECT COUNT(*) AS count
FROM external_adherent_dated_data
GROUP BY adherent_id
) AS dated_data_count;"
;
$statement
=
$this
->
connection
->
prepare
(
$sqlQuery
);
$statement
->
execute
();
$result
=
$statement
->
fetchAll
()[
0
][
"max_dated_data_count"
];
return
$result
;
}
}
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