Adresse RNVP : Récupération correcte du companyId

This commit is contained in:
Michael RICOIS 2016-03-15 15:10:17 +00:00
parent d5fe4957b9
commit 4d4aa64e8d

View File

@ -1280,6 +1280,11 @@ function AdresseNormaliseEntete($values)
function AdresseNormaliseData($siren, $nic, $values = false)
{
$output = array();
$head = AdresseNormaliseEntete('');
foreach($head as $item) {
$output[$item] = '';
}
try {
$etabM = new Application_Model_JoEtablissements();
$sql = $etabM->select(true)->columns(array('LPAD(source,3,0)', 'LPAD(source_id,20,0)'))
@ -1288,22 +1293,16 @@ function AdresseNormaliseData($siren, $nic, $values = false)
$etabResult = $etabM->fetchRow($sql);
$source = $etabResult->source;
$sourceId = $etabResult->source_id;
} catch (Zend_Db_Exception $e) {}
$infoRNVP = null;
try {
$rnvp = new SdMetier_Rnvp_Adresse();
$rnvp->setCompanyId($companyId);
$rnvp->setCompanyId($source . $sourceId);
$infoRNVP = $rnvp->format();
} catch (Exception $e) {}
$head = AdresseNormaliseEntete('');
foreach($head as $item) {
$output[$item] = '';
}
if ($infoRNVP !== null) {
foreach ($head as $item) {
$output[$item] = $infoRNVP->{$item};