Fix code pays
This commit is contained in:
parent
76a6fe2729
commit
c5186ab16d
@ -70,7 +70,7 @@ class Entreprise extends Scores_Ws_Server
|
||||
$result->result = $tabRet;
|
||||
return $result;
|
||||
}
|
||||
$siren=substr(''.$siret,0,9)*1;
|
||||
$siren = substr(''.$siret,0,9)*1;
|
||||
if ($siren == 0 && $id == 0) {
|
||||
Metier_Util_Log::write('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$error = new ErrorElement();
|
||||
@ -135,19 +135,19 @@ class Entreprise extends Scores_Ws_Server
|
||||
$sql = "SELECT j.codPays, j.numPays, j.codPays3, j.codePaysInpi, j.libPays, i.LIBCOG, i.ACTUAL
|
||||
FROM jo.tabPays j, insee.insee_tabPays i
|
||||
WHERE j.codePaysInsee=:codePays AND j.codePaysInsee=substring(i.COG, 3, 3) AND i.ACTUAL IN (1,4) AND j.numPays is NOT NULL";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('codePays', $codePaysInsee);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() == 1) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$codePaysIso2 = $result['codPays'];
|
||||
$paysStmt = $this->conn->prepare($sql);
|
||||
$paysStmt->bindValue('codePays', $codePaysInsee);
|
||||
$paysStmt->execute();
|
||||
if ($paysStmt->rowCount() == 1) {
|
||||
$paysResult = $paysStmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$codePaysIso2 = $paysResult['codPays'];
|
||||
} else {
|
||||
$codePaysIso2 = '';
|
||||
while ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (trim(strtoupper(strtr($result['libPays'],
|
||||
while ($paysResult = $paysStmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (trim(strtoupper(strtr($paysResult['libPays'],
|
||||
'àáâãäåæçèéêëìíîïðñòóôõöùúûüýÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝ',
|
||||
"aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUY")))==trim(strtoupper($result['LIBCOG']))) {
|
||||
$codePaysIso2 = $result['codPays'];
|
||||
"aaaaaaaceeeeiiiionooooouuuuyyAAAAAAACEEEEIIIIONOOOOOUUUUY")))==trim(strtoupper($paysResult['LIBCOG']))) {
|
||||
$codePaysIso2 = $paysResult['codPays'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -160,18 +160,30 @@ class Entreprise extends Scores_Ws_Server
|
||||
}
|
||||
|
||||
// Source RNCS prioritaire pour les infos entreprises
|
||||
$nom=$entrep['nomLong'];
|
||||
if ($nom=='') $nom=$entrep['Nom'];
|
||||
$sigle=$entrep['sigleLong'];
|
||||
if ($sigle=='') $sigle=$entrep['Sigle'];
|
||||
$nom = $entrep['nomLong'];
|
||||
if ($nom == '') {
|
||||
$nom = $entrep['Nom'];
|
||||
}
|
||||
$sigle = $entrep['sigleLong'];
|
||||
if ($sigle == '') {
|
||||
$sigle = $entrep['Sigle'];
|
||||
}
|
||||
|
||||
// Actif RNCS
|
||||
if ($entrep['EntActiveRCS']) $actif=1;
|
||||
if ($entrep['EntActiveRCS']) {
|
||||
$actif = 1;
|
||||
}
|
||||
// Inactif RNCS
|
||||
elseif (isset($entrep['EntActiveRCS']) && $entrep['EntActiveRCS']==0) $actif=0;
|
||||
elseif (isset($entrep['EntActiveRCS']) && $entrep['EntActiveRCS']==0) {
|
||||
$actif = 0;
|
||||
}
|
||||
// Actif Insee et périmètre Insee
|
||||
elseif ($entrep['Actif'] || $entrep['NbEtab']) $actif=1;
|
||||
else $actif=0;
|
||||
elseif ($entrep['Actif'] || $entrep['NbEtab']) {
|
||||
$actif = 1;
|
||||
}
|
||||
else {
|
||||
$actif =0;
|
||||
}
|
||||
|
||||
// Source INSEE prioritaire sur l'établissement
|
||||
$enseigne = $entrep['Enseigne'];
|
||||
@ -247,7 +259,9 @@ class Entreprise extends Scores_Ws_Server
|
||||
$error = new ErrorElement();
|
||||
$error->errmsg = '';
|
||||
$error->errnum = 0;
|
||||
|
||||
$result->result = $item;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user