mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Wip: add jsonb fields to export
This commit is contained in:
parent
97846a5877
commit
c07a728f1d
@ -113,7 +113,7 @@ class CSPerson
|
||||
'ASS',
|
||||
'RSA',
|
||||
'AAH',
|
||||
'autre',
|
||||
// 'autre',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -140,7 +140,7 @@ class CSPerson
|
||||
'referent_RSA',
|
||||
'mission_locale',
|
||||
'rqth',
|
||||
'autre',
|
||||
// 'autre',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -226,7 +226,7 @@ class CSPerson
|
||||
'scooter',
|
||||
'velo',
|
||||
'voiture',
|
||||
'autre',
|
||||
// 'autre',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -28,33 +28,37 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
|
||||
{
|
||||
}
|
||||
|
||||
private const CSPERSON_JSON_FIELDS = [
|
||||
...CSPerson::RESSOURCES,
|
||||
...CSPerson::MOBILITE_MOYEN_TRANSPORT,
|
||||
...CSPerson::TYPE_CONTRAT,
|
||||
...CSPerson::PERMIS_CONDUIRE,
|
||||
...CSPerson::ACCOMPAGNEMENTS,
|
||||
...CSPerson::SITUATION_PROFESSIONNELLE,
|
||||
...CSPerson::NEET_ELIGIBILITY,
|
||||
];
|
||||
|
||||
private const CSPERSON_FIELDS = [
|
||||
/* CSPerson::RESSOURCES,
|
||||
CSPerson::MOBILITE_MOYEN_TRANSPORT,
|
||||
CSPerson::TYPE_CONTRAT,
|
||||
CSPerson::PERMIS_CONDUIRE,
|
||||
CSPerson::ACCOMPAGNEMENTS,
|
||||
CSPerson::SITUATION_PROFESSIONNELLE,
|
||||
CSPerson::NEET_ELIGIBILITY,*/
|
||||
'findernieremploidate',
|
||||
'dateFinDernierEmploi',
|
||||
/* 'prescripteur__name',
|
||||
'prescripteur__email',
|
||||
'prescripteur__phone',*/
|
||||
'poleemploiid',
|
||||
'cafid',
|
||||
'cafinscriptiondate',
|
||||
'contratiejdate',
|
||||
'cerinscriptiondate',
|
||||
'ppaeinscriptiondate',
|
||||
'ppaesignataire',
|
||||
'cersignataire',
|
||||
'neetcommissiondate',
|
||||
'fsemademarchecode',
|
||||
'poleEmploiId',
|
||||
'cafId',
|
||||
'cafInscriptionDate',
|
||||
'dateContratIEJ',
|
||||
'cERInscriptionDate',
|
||||
'pPAEInscriptionDate',
|
||||
'pPAESignataire',
|
||||
'cERSignataire',
|
||||
'nEETCommissionDate',
|
||||
'fSEMaDemarcheCode',
|
||||
'enfantACharge'
|
||||
];
|
||||
|
||||
public function alterKeys(array $existing): array
|
||||
{
|
||||
return [...$existing, ...self::CSPERSON_FIELDS];
|
||||
return [...$existing, ...self::CSPERSON_FIELDS, ...self::CSPERSON_JSON_FIELDS];
|
||||
}
|
||||
|
||||
public function alterSelect(QueryBuilder $qb, \DateTimeImmutable $computedDate): void
|
||||
@ -63,72 +67,60 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
|
||||
->leftJoin(CSPerson::class, 'cs_person', Query\Expr\Join::WITH, 'cs_person.person = person');
|
||||
|
||||
foreach (self::CSPERSON_FIELDS as $f) {
|
||||
switch ($f) {
|
||||
case 'findernieremploidate':
|
||||
$qb->addSelect('cs_person.dateFinDernierEmploi AS findernieremploidate');
|
||||
$qb->addSelect(sprintf('cs_person.%s as %s', $f, $f));
|
||||
}
|
||||
|
||||
foreach (self::CSPERSON_JSON_FIELDS as $jf)
|
||||
{
|
||||
switch ($jf) {
|
||||
case in_array($jf, CSPerson::MOBILITE_MOYEN_TRANSPORT):
|
||||
$qb->addSelect('JSONB_EXISTS_IN_ARRAY(cs_person.mobiliteMoyenDeTransport, :param) AS mobilite_' . $jf)
|
||||
->setParameter('param', $jf);
|
||||
|
||||
break;
|
||||
|
||||
case 'poleemploiid':
|
||||
$qb->addSelect('cs_person.poleEmploiId AS poleemploiid');
|
||||
case in_array($jf, CSPerson::TYPE_CONTRAT):
|
||||
$qb->addSelect('JSONB_EXISTS_IN_ARRAY(cs_person.typeContrat, :param) AS ' . $jf)
|
||||
->setParameter('param', $jf);
|
||||
|
||||
break;
|
||||
|
||||
case 'cafid':
|
||||
$qb->addSelect('cs_person.cafId AS cafid');
|
||||
case in_array($jf, CSPerson::ACCOMPAGNEMENTS):
|
||||
$qb->addSelect('JSONB_EXISTS_IN_ARRAY(cs_person.accompagnement, :param) AS accompagnements_' . $jf)
|
||||
->setParameter('param', $jf);
|
||||
|
||||
break;
|
||||
|
||||
case 'cafinscriptiondate':
|
||||
$qb->addSelect('cs_person.cafInscriptionDate AS cafinscriptiondate');
|
||||
case in_array($jf, CSPerson::SITUATION_PROFESSIONNELLE):
|
||||
$qb->addSelect('JSONB_EXISTS_IN_ARRAY(cs_person.situationProfessionnelle, :param) AS ' . $jf)
|
||||
->setParameter('param', $jf);
|
||||
|
||||
break;
|
||||
|
||||
case 'contratiejdate':
|
||||
$qb->addSelect('cs_person.dateContratIEJ AS contratiejdate');
|
||||
case in_array($jf, CSPerson::NEET_ELIGIBILITY):
|
||||
$qb->addSelect('JSONB_EXISTS_IN_ARRAY(cs_person.nEETEligibilite, :param) AS ' . $jf)
|
||||
->setParameter('param', $jf);
|
||||
|
||||
break;
|
||||
|
||||
case 'cerinscriptiondate':
|
||||
$qb->addSelect('cs_person.cERInscriptionDate AS cerinscriptiondate');
|
||||
case in_array($jf, CSPerson::PERMIS_CONDUIRE):
|
||||
$qb->addSelect('JSONB_EXISTS_IN_ARRAY(cs_person.permisConduire, :param) AS ' . $jf)
|
||||
->setParameter('param', $jf);
|
||||
|
||||
break;
|
||||
|
||||
case 'ppaeinscriptiondate':
|
||||
$qb->addSelect('cs_person.pPAEInscriptionDate AS ppaeinscriptiondate');
|
||||
case in_array($jf, CSPerson::RESSOURCES):
|
||||
$qb->addSelect('JSONB_EXISTS_IN_ARRAY(cs_person.ressources, :param) AS ressources_' . $jf)
|
||||
->setParameter('param', $jf);
|
||||
|
||||
break;
|
||||
|
||||
case 'ppaesignataire':
|
||||
$qb->addSelect('cs_person.pPAESignataire AS ppaesignataire');
|
||||
|
||||
break;
|
||||
|
||||
case 'cersignataire':
|
||||
$qb->addSelect('cs_person.cERSignataire AS cersignataire');
|
||||
|
||||
break;
|
||||
|
||||
case 'neetcommissiondate':
|
||||
$qb->addSelect('cs_person.nEETCommissionDate AS neetcommissiondate');
|
||||
|
||||
break;
|
||||
|
||||
case 'fsemademarchecode':
|
||||
$qb->addSelect('cs_person.fSEMaDemarcheCode AS fsemademarchecode');
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$qb->addSelect(sprintf('person.%s as %s', $f, $f));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function getLabels(string $key, array $values, array $data): ?callable
|
||||
{
|
||||
// dump('im here');
|
||||
switch ($key) {
|
||||
case 'cerinscriptiondate':
|
||||
case 'ppaeinscriptiondate':
|
||||
@ -166,10 +158,6 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
|
||||
};
|
||||
|
||||
default:
|
||||
/* if (!\in_array($key, $this->getAllKeys(), true)) {
|
||||
throw new \RuntimeException("this key is not supported by this helper: {$key}");
|
||||
}*/
|
||||
|
||||
// for fields which are associated with person
|
||||
return function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user