Merge branch chill-bundles:master into ticket-app-master

This commit is contained in:
Boris Waaub 2024-04-19 15:54:24 +00:00
commit 0bd6038160
6 changed files with 34 additions and 8 deletions

View File

@ -0,0 +1,6 @@
kind: Fixed
body: Fix broken link in homepage when a evaluation from a closed acc period was present
in the homepage widget
time: 2024-04-16T16:18:17.888645172+02:00
custom:
Issue: "270"

3
.changes/v2.18.2.md Normal file
View File

@ -0,0 +1,3 @@
## v2.18.2 - 2024-04-12
### Fixed
* ([#250](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/250)) Postal codes import : fix the source URL and the keys to handle each record

View File

@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie). and is generated by [Changie](https://github.com/miniscruff/changie).
## v2.18.2 - 2024-04-12
### Fixed
* ([#250](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/250)) Postal codes import : fix the source URL and the keys to handle each record
## v2.18.1 - 2024-03-26 ## v2.18.1 - 2024-03-26
### Fixed ### Fixed
* Fix layout issue in document generation for admin (minor) * Fix layout issue in document generation for admin (minor)

View File

@ -8,6 +8,16 @@ Chill can store a list of geolocated address references, which are used to sugge
Those addresses may be load from a dedicated source. Those addresses may be load from a dedicated source.
Countries
=========
In order to load addresses into the chill application we first have to make sure that a list of countries is present.
To import the countries run the following command.
.. code-block:: bash
bin/console chill:main:countries:populate
In France In France
========= =========

View File

@ -23,7 +23,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
*/ */
class PostalCodeFRFromOpenData class PostalCodeFRFromOpenData
{ {
private const CSV = 'https://datanova.laposte.fr/data-fair/api/v1/datasets/laposte-hexasmal/data-files/019HexaSmal.csv'; private const CSV = 'https://datanova.laposte.fr/data-fair/api/v1/datasets/laposte-hexasmal/metadata-attachments/base-officielle-codes-postaux.csv';
public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) {} public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger) {}
@ -48,7 +48,7 @@ class PostalCodeFRFromOpenData
fseek($tmpfile, 0); fseek($tmpfile, 0);
$csv = Reader::createFromStream($tmpfile); $csv = Reader::createFromStream($tmpfile);
$csv->setDelimiter(';'); $csv->setDelimiter(',');
$csv->setHeaderOffset(0); $csv->setHeaderOffset(0);
foreach ($csv as $offset => $record) { foreach ($csv as $offset => $record) {
@ -63,23 +63,23 @@ class PostalCodeFRFromOpenData
private function handleRecord(array $record): void private function handleRecord(array $record): void
{ {
if ('' !== trim($record['coordonnees_geographiques'] ?? $record['coordonnees_gps'])) { if ('' !== trim((string) $record['_geopoint'])) {
[$lat, $lon] = array_map(static fn ($el) => (float) trim($el), explode(',', $record['coordonnees_geographiques'] ?? $record['coordonnees_gps'])); [$lat, $lon] = array_map(static fn ($el) => (float) trim($el), explode(',', (string) $record['_geopoint']));
} else { } else {
$lat = $lon = 0.0; $lat = $lon = 0.0;
} }
$ref = trim((string) $record['Code_commune_INSEE']); $ref = trim((string) $record['code_commune_insee']);
if (str_starts_with($ref, '987')) { if (str_starts_with($ref, '987')) {
// some differences in French Polynesia // some differences in French Polynesia
$ref .= '.'.trim((string) $record['Libellé_d_acheminement']); $ref .= '.'.trim((string) $record['libelle_d_acheminement']);
} }
$this->baseImporter->importCode( $this->baseImporter->importCode(
'FR', 'FR',
trim((string) $record['Libellé_d_acheminement']), trim((string) $record['libelle_d_acheminement']),
trim((string) $record['Code_postal']), trim((string) $record['code_postal']),
$ref, $ref,
'INSEE', 'INSEE',
$lat, $lat,

View File

@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Repository\AccompanyingPeriod; namespace Chill\PersonBundle\Repository\AccompanyingPeriod;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
@ -88,6 +89,7 @@ class AccompanyingPeriodWorkEvaluationRepository implements ObjectRepository
->where( ->where(
$qb->expr()->andX( $qb->expr()->andX(
$qb->expr()->isNull('e.endDate'), $qb->expr()->isNull('e.endDate'),
$qb->expr()->neq('period.step', ':closed'),
$qb->expr()->gte(':now', $qb->expr()->diff('e.maxDate', 'e.warningInterval')), $qb->expr()->gte(':now', $qb->expr()->diff('e.maxDate', 'e.warningInterval')),
$qb->expr()->orX( $qb->expr()->orX(
$qb->expr()->eq('period.user', ':user'), $qb->expr()->eq('period.user', ':user'),
@ -100,6 +102,7 @@ class AccompanyingPeriodWorkEvaluationRepository implements ObjectRepository
->setParameters([ ->setParameters([
'user' => $user, 'user' => $user,
'now' => new \DateTimeImmutable('now'), 'now' => new \DateTimeImmutable('now'),
'closed' => AccompanyingPeriod::STEP_CLOSED,
]); ]);
return $qb; return $qb;