-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: develop
Are you sure you want to change the base?
Conversation
Il faudrait modifier la récupération de l'adresse dans l'export de la recherche pour prendre en compte l'API Adresse. |
|
||
if (getenv('PREVARISC_API_ADRESSE_MODAL')) { | ||
$DB_adresse_api->delete('ID_ETABLISSEMENT = '.$etablissement->ID_ETABLISSEMENT); | ||
} else { | ||
$DB_adresse->delete('ID_ETABLISSEMENT = '.$etablissement->ID_ETABLISSEMENT); | ||
} |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
<?php | ||
|
||
interface Service_Interface_EtablissementAdresse | ||
{ | ||
public function get($id_etablissement); | ||
|
||
public function save($adresse, $etablissementID); | ||
} |
There was a problem hiding this comment.
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() ?
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']) | ||
; | ||
} |
There was a problem hiding this comment.
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=""/> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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
fixes #183