mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-26 16:45:01 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
4091efc72e | |||
b577bd7123 | |||
dbb9feb129 | |||
e8b95f8491 | |||
8de37a9ef3 | |||
8fd6986c47
|
|||
807f1b4aa1
|
3
.changes/v2.18.1.md
Normal file
3
.changes/v2.18.1.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## v2.18.1 - 2024-03-26
|
||||||
|
### Fixed
|
||||||
|
* Fix layout issue in document generation for admin (minor)
|
3
.changes/v2.18.2.md
Normal file
3
.changes/v2.18.2.md
Normal 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
|
@@ -6,6 +6,14 @@ 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
|
||||||
|
### Fixed
|
||||||
|
* Fix layout issue in document generation for admin (minor)
|
||||||
|
|
||||||
## v2.18.0 - 2024-03-26
|
## v2.18.0 - 2024-03-26
|
||||||
### Feature
|
### Feature
|
||||||
* ([#268](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/268)) Improve admin UX to configure document templates for document generation
|
* ([#268](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/268)) Improve admin UX to configure document templates for document generation
|
||||||
|
@@ -14,11 +14,6 @@
|
|||||||
{% block admin_content %}
|
{% block admin_content %}
|
||||||
{% embed '@ChillMain/CRUD/_index.html.twig' %}
|
{% embed '@ChillMain/CRUD/_index.html.twig' %}
|
||||||
{% block table_entities_thead_tr %}
|
{% block table_entities_thead_tr %}
|
||||||
<th></th>
|
|
||||||
<th>{{ 'Title'|trans }}</th>
|
|
||||||
<th>{{ 'docgen.Context'|trans }}</th>
|
|
||||||
<th>{{ 'docgen.test generate'|trans }}</th>
|
|
||||||
<th>{{ 'Edit'|trans }}</th>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block table_entities_tbody %}
|
{% block table_entities_tbody %}
|
||||||
@@ -62,34 +57,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% for entity in entities %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ entity.id }}</td>
|
|
||||||
<td>{{ entity.name|localize_translatable_string}}</td>
|
|
||||||
<td>{{ contextManager.getContextByKey(entity.context).name|trans }}</td>
|
|
||||||
<td>
|
|
||||||
<form method="get" action="{{ path('chill_docgenerator_test_generate_redirect') }}">
|
|
||||||
<input type="hidden" name="returnPath" value="{{ app.request.query.get('returnPath', app.request.uri)|e('html_attr') }}" />
|
|
||||||
<input type="hidden" name="template" value="{{ entity.id|e('html_attr') }}" />
|
|
||||||
<input type="hidden" name="entityClassName" value="{{ contextManager.getContextByKey(entity.context).entityClass|e('html_attr') }}" />
|
|
||||||
<input type="text" name="entityId" />
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-mini btn-misc"><i class="fa fa-cog"></i>{{ 'docgen.test generate'|trans }}</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
{{ entity.file|chill_document_button_group('Template file', true, {small: true}) }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ chill_path_add_return_path('chill_crud_docgen_template_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'Edit'|trans }}"></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block actions_before %}
|
{% block actions_before %}
|
||||||
|
@@ -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)
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,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) {
|
||||||
@@ -65,23 +65,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,
|
||||||
|
Reference in New Issue
Block a user