diff --git a/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/ApiWrapper.php b/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/ApiWrapper.php index a293b7712..513050a2a 100644 --- a/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/ApiWrapper.php +++ b/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/ApiWrapper.php @@ -49,7 +49,6 @@ class ApiWrapper return $data->access_token; } - try { $response = $this->client->post('', [ 'query' => ['realm' => '/partenaire'], diff --git a/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php b/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php index 8711a5028..533e8d274 100644 --- a/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php +++ b/src/Bundle/ChillFranceTravailApiBundle/src/ApiHelper/PartenaireRomeAppellation.php @@ -75,17 +75,15 @@ class PartenaireRomeAppellation ], ]; try { - $response = $this->handleRequest( - $request, - $parameters, - $this->client, - $this->logger - ); - - } catch (ClientException $e) { - dump($e->getResponse()->getBody()->getContents()); - } - + $response = $this->handleRequest( + $request, + $parameters, + $this->client, + $this->logger + ); + } catch (ClientException $e) { + dump($e->getResponse()->getBody()->getContents()); + } return Utils::jsonDecode((string) $response->getBody()); } diff --git a/src/Bundle/ChillJobBundle/src/Entity/Immersion.php b/src/Bundle/ChillJobBundle/src/Entity/Immersion.php index 1e3b9879e..225c4c1a1 100644 --- a/src/Bundle/ChillJobBundle/src/Entity/Immersion.php +++ b/src/Bundle/ChillJobBundle/src/Entity/Immersion.php @@ -43,7 +43,7 @@ class Immersion implements \Stringable * @Assert\NotNull() */ #[ORM\ManyToOne(targetEntity: Person::class)] - private ?\Chill\PersonBundle\Entity\Person $person = null; + private ?Person $person = null; /** * @Assert\NotNull() @@ -523,12 +523,11 @@ class Immersion implements \Stringable /** * Get duration. - * */ public function getDuration() { return $this->duration; -// return new \DateInterval($this->duration ?? 'P7D'); + // return new \DateInterval($this->duration ?? 'P7D'); } public function getDateEndComputed() diff --git a/src/Bundle/ChillJobBundle/src/Entity/ProjetProfessionnel.php b/src/Bundle/ChillJobBundle/src/Entity/ProjetProfessionnel.php index 44dd6b412..58a1fca41 100644 --- a/src/Bundle/ChillJobBundle/src/Entity/ProjetProfessionnel.php +++ b/src/Bundle/ChillJobBundle/src/Entity/ProjetProfessionnel.php @@ -36,7 +36,7 @@ class ProjetProfessionnel implements \Stringable * @Assert\NotNull() */ #[ORM\ManyToOne(targetEntity: Person::class)] - private ?\Chill\PersonBundle\Entity\Person $person = null; + private ?Person $person = null; /** * @Assert\NotNull() diff --git a/src/Bundle/ChillJobBundle/src/Export/AddCSPersonToPersonListHelper.php b/src/Bundle/ChillJobBundle/src/Export/AddCSPersonToPersonListHelper.php index b05b22be4..5436158f6 100644 --- a/src/Bundle/ChillJobBundle/src/Export/AddCSPersonToPersonListHelper.php +++ b/src/Bundle/ChillJobBundle/src/Export/AddCSPersonToPersonListHelper.php @@ -24,37 +24,35 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterface { - public function __construct(private readonly TranslatorInterface $translator) - { - } + public function __construct(private readonly TranslatorInterface $translator) {} private const CSPERSON_FIELDS = [ - 'dateFinDernierEmploi', -/* 'prescripteur__name', + 'dateFinDernierEmploi', + /* 'prescripteur__name', 'prescripteur__email', 'prescripteur__phone',*/ - 'poleEmploiId', - 'cafId', - 'cafInscriptionDate', - 'dateContratIEJ', - 'cERInscriptionDate', - 'pPAEInscriptionDate', - 'pPAESignataire', - 'cERSignataire', - 'nEETCommissionDate', - 'fSEMaDemarcheCode', - 'enfantACharge', - 'nEETEligibilite', - 'situationProfessionnelle', + 'poleEmploiId', + 'cafId', + 'cafInscriptionDate', + 'dateContratIEJ', + 'cERInscriptionDate', + 'pPAEInscriptionDate', + 'pPAESignataire', + 'cERSignataire', + 'nEETCommissionDate', + 'fSEMaDemarcheCode', + 'enfantACharge', + 'nEETEligibilite', + 'situationProfessionnelle', ]; public function alterKeys(array $existing): array { - $ressources = array_map(static fn ($key) => 'ressources__' . $key, CSPerson::RESSOURCES); - $moyenTransport = array_map(static fn ($key) => 'moyen_transport__' . $key, CSPerson::MOBILITE_MOYEN_TRANSPORT); - $accompagnements = array_map(static fn ($key) => 'accompagnements__' . $key, CSPerson::ACCOMPAGNEMENTS); - $permisConduire = array_map(static fn ($key) => 'permis_conduire__' . $key, CSPerson::PERMIS_CONDUIRE); - $typeContrat = array_map(static fn ($key) => 'type_contrat__' . $key, CSPerson::TYPE_CONTRAT); + $ressources = array_map(static fn ($key) => 'ressources__'.$key, CSPerson::RESSOURCES); + $moyenTransport = array_map(static fn ($key) => 'moyen_transport__'.$key, CSPerson::MOBILITE_MOYEN_TRANSPORT); + $accompagnements = array_map(static fn ($key) => 'accompagnements__'.$key, CSPerson::ACCOMPAGNEMENTS); + $permisConduire = array_map(static fn ($key) => 'permis_conduire__'.$key, CSPerson::PERMIS_CONDUIRE); + $typeContrat = array_map(static fn ($key) => 'type_contrat__'.$key, CSPerson::TYPE_CONTRAT); return [ ...$existing, @@ -76,129 +74,124 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac $qb->addSelect(sprintf('cs_person.%s as %s', $f, $f)); } -/* $qb->addSelect('cs_person.situationProfessionnelle as situation_prof'); + /* $qb->addSelect('cs_person.situationProfessionnelle as situation_prof'); - $qb->addSelect('cs_person.nEETEligibilite as nEETEligibilite');*/ + $qb->addSelect('cs_person.nEETEligibilite as nEETEligibilite');*/ $i = 0; - foreach (CSPerson::RESSOURCES as $key) - { - $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.ressources, :param_$i) AS ressources__" . $key) + foreach (CSPerson::RESSOURCES as $key) { + $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.ressources, :param_{$i}) AS ressources__".$key) ->setParameter('param_'.$i, $key); ++$i; } - foreach(CSPerson::MOBILITE_MOYEN_TRANSPORT as $key) - { - $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.mobiliteMoyenDeTransport, :param_$i) AS moyen_transport__" . $key) + foreach (CSPerson::MOBILITE_MOYEN_TRANSPORT as $key) { + $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.mobiliteMoyenDeTransport, :param_{$i}) AS moyen_transport__".$key) ->setParameter('param_'.$i, $key); ++$i; } - foreach(CSPerson::TYPE_CONTRAT as $key) - { - $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.typeContrat, :param_$i) AS type_contrat__" . $key) + foreach (CSPerson::TYPE_CONTRAT as $key) { + $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.typeContrat, :param_{$i}) AS type_contrat__".$key) ->setParameter('param_'.$i, $key); ++$i; } - foreach (CSPerson::ACCOMPAGNEMENTS as $key) - { - $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.accompagnement, :param_$i) AS accompagnements__" . $key) + foreach (CSPerson::ACCOMPAGNEMENTS as $key) { + $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.accompagnement, :param_{$i}) AS accompagnements__".$key) ->setParameter('param_'.$i, $key); ++$i; } - foreach (CSPerson::PERMIS_CONDUIRE as $key) - { - $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.permisConduire, :param_$i) AS permis_conduire__" . $key) + foreach (CSPerson::PERMIS_CONDUIRE as $key) { + $qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.permisConduire, :param_{$i}) AS permis_conduire__".$key) ->setParameter('param_'.$i, $key); ++$i; } - } public function getLabels(string $key, array $values, array $data): ?callable { - switch ($key) { - case str_contains($key, '__'): - return function (string|bool|null $value) use ($key): string { - if ('_header' === $value) { - [$domain, $v] = explode('__', $key); - return 'export.list.cs_person.' . $domain . '.' . $v; - } + switch ($key) { + case str_contains($key, '__'): + return function (string|bool|null $value) use ($key): string { + if ('_header' === $value) { + [$domain, $v] = explode('__', $key); - if ('1' === $value || true === $value || 1 === $value || 't' === $value) { - return 'x'; - } + return 'export.list.cs_person.'.$domain.'.'.$v; + } + if ('1' === $value || true === $value || 1 === $value || 't' === $value) { + return 'x'; + } + + return ''; + }; + case 'nEETEligibilite': + return function (string|bool|null $value): string { + if ('_header' === $value) { + return 'export.list.cs_person.neet_eligibility'; + } + + if ('1' === $value || true === $value || 1 === $value || 't' === $value) { + return 'x'; + } + + return ''; + }; + case 'situationProfessionnelle': + return function ($value) { + if ('_header' === $value) { + return 'export.list.cs_person.situation_professionelle'; + } + + return $value; + }; + case 'cerinscriptiondate': + case 'ppaeinscriptiondate': + case 'neetcommissiondate': + case 'findernieremploidate': + case 'cafinscriptiondate': + case 'contratiejdate': + return function ($value) use ($key) { + if ('_header' === $value) { + return $this->translator->trans($key); + } + + if (null === $value) { return ''; - }; - case 'nEETEligibilite': - return function (string|bool|null $value) use ($key): string { - if ('_header' === $value) { - return 'export.list.cs_person.neet_eligibility'; - } + } + // warning: won't work with DateTimeImmutable as we reset time a few lines later + $date = \DateTime::createFromFormat('Y-m-d', $value); + $hasTime = false; - if ('1' === $value || true === $value || 1 === $value || 't' === $value) { - return 'x'; - } + if (false === $date) { + $date = \DateTime::createFromFormat('Y-m-d H:i:s', $value); + $hasTime = true; + } - return ''; - }; - case 'situationProfessionnelle': - return function ($value) use ($key) { - if ('_header' === $value) { - return 'export.list.cs_person.situation_professionelle'; - } + // check that the creation could occur. + if (false === $date) { + throw new \Exception(sprintf('The value %s could not be converted to %s', $value, \DateTime::class)); + } - return $value; - }; - case 'cerinscriptiondate': - case 'ppaeinscriptiondate': - case 'neetcommissiondate': - case 'findernieremploidate': - case 'cafinscriptiondate': - case 'contratiejdate': - return function ($value) use ($key) { - if ('_header' === $value) { - return $this->translator->trans($key); - } + if (!$hasTime) { + $date->setTime(0, 0, 0); + } - if (null === $value) { - return ''; - } - // warning: won't work with DateTimeImmutable as we reset time a few lines later - $date = \DateTime::createFromFormat('Y-m-d', $value); - $hasTime = false; + return $date; + }; - if (false === $date) { - $date = \DateTime::createFromFormat('Y-m-d H:i:s', $value); - $hasTime = true; - } + default: + // for fields which are associated with person + return function ($value) use ($key) { + if ('_header' === $value) { + return $this->translator->trans($key); + } - // check that the creation could occur. - if (false === $date) { - throw new \Exception(sprintf('The value %s could not be converted to %s', $value, \DateTime::class)); - } - - if (!$hasTime) { - $date->setTime(0, 0, 0); - } - - return $date; - }; - - default: - // for fields which are associated with person - return function ($value) use ($key) { - if ('_header' === $value) { - return $this->translator->trans($key); - } - - return $value; - }; - } + return $value; + }; + } } } diff --git a/src/Bundle/ChillJobBundle/src/Export/ListCV.php b/src/Bundle/ChillJobBundle/src/Export/ListCV.php index aea1c7217..896c7db01 100644 --- a/src/Bundle/ChillJobBundle/src/Export/ListCV.php +++ b/src/Bundle/ChillJobBundle/src/Export/ListCV.php @@ -92,7 +92,7 @@ class ListCV implements ListInterface, ExportElementValidatedInterface ->add('fields', ChoiceType::class, [ 'multiple' => true, 'expanded' => true, -// 'choices_as_values' => true, + // 'choices_as_values' => true, 'label' => 'Fields to include in export', 'choices' => array_combine($this->getFields(), $this->getFields()), 'data' => array_combine($this->getFields(), $this->getFields()), diff --git a/src/Bundle/ChillJobBundle/src/Export/ListFrein.php b/src/Bundle/ChillJobBundle/src/Export/ListFrein.php index 51354e1fb..8e3a64294 100644 --- a/src/Bundle/ChillJobBundle/src/Export/ListFrein.php +++ b/src/Bundle/ChillJobBundle/src/Export/ListFrein.php @@ -105,7 +105,7 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface ->add('fields', ChoiceType::class, [ 'multiple' => true, 'expanded' => true, -// 'choices_as_values' => true, + // 'choices_as_values' => true, 'label' => 'Fields to include in export', 'choices' => array_combine($this->getFields(), $this->getFields()), 'data' => array_combine($this->getFields(), $this->getFields()), diff --git a/src/Bundle/ChillJobBundle/src/Export/ListProjetProfessionnel.php b/src/Bundle/ChillJobBundle/src/Export/ListProjetProfessionnel.php index 54cd2b3a5..0a1eeb753 100644 --- a/src/Bundle/ChillJobBundle/src/Export/ListProjetProfessionnel.php +++ b/src/Bundle/ChillJobBundle/src/Export/ListProjetProfessionnel.php @@ -110,7 +110,7 @@ class ListProjetProfessionnel implements ListInterface, ExportElementValidatedIn ->add('fields', ChoiceType::class, [ 'multiple' => true, 'expanded' => true, -// 'choices_as_values' => true, + // 'choices_as_values' => true, 'label' => 'Fields to include in export', 'choice_label' => fn ($key) => str_replace('__', '.', (string) $key), 'choices' => array_combine($this->getFields(), $this->getFields()),