Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: intégration de l'api adresse #212

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

NazihAsmaa
Copy link
Contributor

@NazihAsmaa NazihAsmaa commented Jan 14, 2025

fixes #183

@NazihAsmaa NazihAsmaa requested a review from A709197 January 14, 2025 15:44
@NazihAsmaa NazihAsmaa self-assigned this Jan 14, 2025
@NazihAsmaa NazihAsmaa added etablissement Ce qui concerne les établissements enhancement New feature or request labels Jan 14, 2025
@NazihAsmaa NazihAsmaa changed the title Feature/Intégration API Adresse feat: intégration de l'api adresse Jan 14, 2025
@A709197
Copy link
Collaborator

A709197 commented Jan 20, 2025

Il faudrait modifier la récupération de l'adresse dans l'export de la recherche pour prendre en compte l'API Adresse.

Comment on lines +925 to +930

if (getenv('PREVARISC_API_ADRESSE_MODAL')) {
$DB_adresse_api->delete('ID_ETABLISSEMENT = '.$etablissement->ID_ETABLISSEMENT);
} else {
$DB_adresse->delete('ID_ETABLISSEMENT = '.$etablissement->ID_ETABLISSEMENT);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je suggère de mettre cette partie dans le Manager

@@ -1,5 +1,6 @@
<?php

require_once __DIR__.'/EtablissementManager.php';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pas normal d'avoir ça là, voir pour l'enlever

@@ -57,6 +57,7 @@ public function get($id_etablissement)
$DB_commission_type = new Model_DbTable_CommissionType();
$DB_statut = new Model_DbTable_Statut();
$DB_dossier = new Model_DbTable_Dossier();
$etablissementManager = new Service_EtablissementManager();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si on utilise plusieurs fois le service, on peut envisager de l'instancier dans un __construct() pour simplifier

Comment on lines +1 to +8
<?php

interface Service_Interface_EtablissementAdresse
{
public function get($id_etablissement);

public function save($adresse, $etablissementID);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajouter la méthode delete() ?

Comment on lines +75 to +103
if ($environnement) {
$select->joinLeft('etablissementadresseapi', 'e.ID_ETABLISSEMENT = etablissementadresseapi.ID_ETABLISSEMENT', ['NUMINSEE_COMMUNE', 'LON_ETABLISSEMENTADRESSE', 'LAT_ETABLISSEMENTADRESSE', 'ID_ADRESSE', 'LIBELLE_RUE', 'ADRESSE']);
} else {
$select->joinLeft('etablissementadresse', 'e.ID_ETABLISSEMENT = etablissementadresse.ID_ETABLISSEMENT', ['NUMINSEE_COMMUNE', 'LON_ETABLISSEMENTADRESSE', 'LAT_ETABLISSEMENTADRESSE', 'ID_ADRESSE', 'ID_RUE', 'NUMERO_ADRESSE'])
->joinLeft('adressecommune', 'etablissementadresse.NUMINSEE_COMMUNE = adressecommune.NUMINSEE_COMMUNE', 'LIBELLE_COMMUNE AS LIBELLE_COMMUNE_ADRESSE_DEFAULT')
;
}

if (!$environnement) {
$select->joinLeft('groupementcommune', 'groupementcommune.NUMINSEE_COMMUNE = adressecommune.NUMINSEE_COMMUNE');
} else {
$select->joinLeft('groupementcommune', 'groupementcommune.NUMINSEE_COMMUNE = etablissementadresseapi.NUMINSEE_COMMUNE');
}

$select->joinLeft('groupement', 'groupement.ID_GROUPEMENT = groupementcommune.ID_GROUPEMENT AND groupement.ID_GROUPEMENTTYPE = 5', 'LIBELLE_GROUPEMENT');
if (!$environnement) {
$select->joinLeft('adresserue', 'adresserue.ID_RUE = etablissementadresse.ID_RUE', 'LIBELLE_RUE')
->joinLeft(['etablissementadressesite' => 'etablissementadresse'], 'etablissementadressesite.ID_ETABLISSEMENT = (SELECT ID_FILS_ETABLISSEMENT FROM etablissementlie WHERE ID_ETABLISSEMENT = e.ID_ETABLISSEMENT LIMIT 1)', 'ID_RUE AS ID_RUE_SITE')
->joinLeft(['adressecommunesite' => 'adressecommune'], 'etablissementadressesite.NUMINSEE_COMMUNE = adressecommunesite.NUMINSEE_COMMUNE', 'LIBELLE_COMMUNE AS LIBELLE_COMMUNE_ADRESSE_SITE')
->joinLeft(['etablissementadressecell' => 'etablissementadresse'], 'etablissementadressecell.ID_ETABLISSEMENT = (SELECT ID_ETABLISSEMENT FROM etablissementlie WHERE ID_FILS_ETABLISSEMENT = e.ID_ETABLISSEMENT LIMIT 1)', 'ID_RUE AS ID_RUE_CELL')
->joinLeft(['adressecommunecell' => 'adressecommune'], 'etablissementadressecell.NUMINSEE_COMMUNE = adressecommunecell.NUMINSEE_COMMUNE', 'LIBELLE_COMMUNE AS LIBELLE_COMMUNE_ADRESSE_CELLULE')
;
} else {
$select->joinLeft(['etablissementadressesite' => 'etablissementadresseapi'], 'etablissementadressesite.ID_ETABLISSEMENT = (SELECT ID_FILS_ETABLISSEMENT FROM etablissementlie WHERE ID_ETABLISSEMENT = e.ID_ETABLISSEMENT LIMIT 1)', [])
->columns(['LIBELLE_COMMUNE_ADRESSE_SITE' => 'etablissementadressesite.LIBELLE_COMMUNE'])
->joinLeft(['etablissementadressecell' => 'etablissementadresseapi'], 'etablissementadressecell.ID_ETABLISSEMENT = (SELECT ID_ETABLISSEMENT FROM etablissementlie WHERE ID_FILS_ETABLISSEMENT = e.ID_ETABLISSEMENT LIMIT 1)', [])
->columns(['LIBELLE_COMMUNE_ADRESSE_CELLULE' => 'etablissementadressecell.LIBELLE_COMMUNE'])
;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Voir pour regrouper les conditions, éventuellement déporter dans une méthode privée pour simplifier la lecture

@@ -1,3 +1,4 @@
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" crossorigin=""/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besoin de ça ?


<?= $this->partial('etablissement/partials/partial-modal-edit-adresse.phtml', ['key_ign' => $this->key_ign]) ?>
<script src="/js/etablissement/edit/geolocaliseIGN.js"></script>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Déjà ajouté dans le controller


<?= $this->partial('etablissement/partials/partial-modal-edit-adresse.phtml', ['key_ign' => $this->key_ign]) ?>
<script src="/js/etablissement/edit/geolocaliseIGN.js"></script>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" crossorigin=""></script>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem, besoin de ça ?

@@ -1,4 +1,4 @@
<form id="adresse-modal-edit" class="modal hide adresse fade adresse-modal-edit" method='post'>
<form id="adresse-modal-edit" class="modal hide adresse fade adresse-modal-edit" method="post">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peut-être faire des sous-templates

@@ -0,0 +1,4 @@
SET NAMES 'utf8';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mettre ça dans le même SQL que le reste

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request etablissement Ce qui concerne les établissements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Utiliser l'API Adresse
2 participants