diff --git a/library/WsScore/WsEntreprise.php b/library/WsScore/WsEntreprise.php index 6b99a019..55c6b59b 100644 --- a/library/WsScore/WsEntreprise.php +++ b/library/WsScore/WsEntreprise.php @@ -777,78 +777,135 @@ class WsEntreprise extends WsScore $error->errmsg = 'Siren incorrect'; } else { $tDeb = microtime(true); - global $tva, $tabFormules, $tabFormulesRatios, $mBil, $tabBilan, $efftr, $tabRatiosInfos, $tabInfla; - global $R, $Rp, $Rp2, $Rp3, $Rp4; - global $Rs, $Rsp, $Rsp2, $Rsp3, $Rsp4; - global $Revol, $Revolp, $Revolp2, $Revolp3; - global $regR, $regRs; - global $Ra, $Rap, $Rdiff; - require_once 'Metier/tmp/configMRatios.php'; require_once 'Metier/scores/classMScores.php'; $tabRet = calculIndiScore($siren, $nic, $accesDist, $niveau); $duree = round(microtime(true)-$tDeb,3); debugLog('W', "indiscore DUREE = $duree s", __LINE__, __FILE__, __FUNCTION__, __CLASS__); wsLog('indiscore',$siren); } - Zend_Registry::get('WsLogger')->info("INDISCORE : ".print_r($tabRet,1)); - //array('paiements', 'Bilans', 'Notes_Structure', 'paiements', 'tabBilans', 'tabBilan', 'tabInfosNotation', 'tabImportExport', 'tabCommentaires', 'tabVariables') $result = new Indiscore(); - foreach($tabRet as $key => $value){ - if (!is_array($value)){ - $result->$key = $value; - } - } - /* foreach($tabRet as $key => $value){ if ($key=='paiements'){ - $parMont = $tabRet[$key]['parMont']; - $parTrim = $tabRet[$key]['parTrim']; + $parMont = $value['parMont']; + $parTrim = $value['parTrim']; $tabMont = array(); foreach($parMont as $parMontK => $parMontV){ - $paiementMont = new IndiscorePaiementMont(); + $paiementMont = new IndiscorePaiementDetail(); $paiementMont->id = $parMontK; - $paiementMont->val = $parMontV; + $paiementMont->nb = $parMontV['nb']; + if (array_key_exists('d=180', $parMontV)){ + $paiementMont->d180 = $parMontV['d=180']; + } + if (array_key_exists('d=150', $parMontV)){ + $paiementMont->d150 = $parMontV['d=150']; + } + if (array_key_exists('d=120', $parMontV)){ + $paiementMont->d120 = $parMontV['d=120']; + } + if (array_key_exists('d=90', $parMontV)){ + $paiementMont->d90 = $parMontV['d=90']; + } + if (array_key_exists('d=60', $parMontV)){ + $paiementMont->d60 = $parMontV['d=60']; + } + if (array_key_exists('d=30', $parMontV)){ + $paiementMont->d30 = $parMontV['d=30']; + } $tabMont[] = $paiementMont; } $tabTrim = array(); foreach($parTrim as $parTrimK => $parTrimV){ - $paiementTrim = new IndiscorePaiementTrim(); + $paiementTrim = new IndiscorePaiementDetail(); $paiementTrim->id = $parTrimK; - $paiementTrim->val = $parTrimV; + $paiementTrim->nb = $parTrimV['nb']; + if (array_key_exists('d=180', $parTrimV)){ + $paiementTrim->d180 = $parTrimV['d=180']; + } + if (array_key_exists('d=150', $parTrimV)){ + $paiementTrim->d150 = $parTrimV['d=150']; + } + if (array_key_exists('d=120', $parTrimV)){ + $paiementTrim->d120 = $parTrimV['d=120']; + } + if (array_key_exists('d=90', $parTrimV)){ + $paiementTrim->d90 = $parTrimV['d=90']; + } + if (array_key_exists('d=60', $parTrimV)){ + $paiementTrim->d60 = $parTrimV['d=60']; + } + if (array_key_exists('d=30', $parTrimV)){ + $paiementTrim->d30 = $parTrimV['d=30']; + } $tabTrim[] = $paiementTrim; } $paiement = new IndiscorePaiement(); $paiement->parMont = $tabMont; $paiement->parTrim = $tabTrim; $result->paiements = $paiement; + } elseif ($key=='Bilans') { + + } elseif ($key=='Notes_Structure') { + $notesStructure = new IndiscoreNotesStructure(); + $notesStructure->activite = $value['activite']; + $notesStructure->naf4 = $value['naf4']; + $notesStructure->age = $value['age']; + $notesStructure->capital = $value['capital']; + $notesStructure->effectif = $value['effectif']; + $notesStructure->fj = $value['fj']; + $notesStructure->localite = $value['localite']; + $notesStructure->singulier = $value['singulier']; + $result->Notes_Structure = $notesStructure; + } elseif ($key=='tabBilans') { + $tabRet = array(); + foreach($value as $bilan) + { + $element = new ListeBilans(); + $element->dateProvPartenaire = $bilan['dateProvPartenaire']; + $element->dateInsert = $bilan['dateInsert']; + $element->typeBilan = $bilan['typeBilan']; + $element->dureeExercice = $bilan['dureeExercice']; + $element->dateExercice = $bilan['dateExercice']; + $element->millesime = $bilan['millesime']; + $element->dateExercicePre = $bilan['dateExercicePre']; + $element->dureeExercicePre = $bilan['dureeExercicePre']; + $element->monnaie = $bilan['monnaie']; + $element->source = $bilan['source']; + $tabRet[] = $element; + } + $result->tabBilans = $tabRet; + } elseif ($key=='tabBilan') { + } elseif ($key=='tabInfosNotation') { - $tab = $tabRet[$key]; $infosNotation = new IndiscoreInfosNotation(); - $infosNotation->SituationFinanciere = $tabRet[$key]['SituationFinanciere']; - $infosNotation->Notation = $tabRet[$key]['Notation']; - $infosNotation->ProbabiliteDefaut = $tabRet[$key]['ProbabiliteDefaut']; + $infosNotation->SituationFinanciere = $value['SituationFinanciere']; + $infosNotation->Notation = $value['Notation']; + $infosNotation->ProbabiliteDefaut = $value['ProbabiliteDefaut']; $result->tabInfosNotations = $infosNotation; } elseif ($key=='tabImportExport') { - $importExport = new IndiscoreImportExport(); - $importExport->importExport = $tabRet[$key]['importExport']; - $importExport->annee = $tabRet[$key]['annee']; - $importExport->rangNational = $tabRet[$key]['rangNational']; - $importExport->deptSiege = $tabRet[$key]['deptSiege']; - $result->tabImportExport = $importExport; + $tabRet = array(); + foreach($value as $element){ + $importExport = new IndiscoreImportExport(); + $importExport->importExport = $element['importExport']; + $importExport->annee = $element['annee']; + $importExport->rangNational = $element['rangNational']; + $importExport->deptSiege = $element['deptSiege']; + $tabRet[] = $importExport; + } + $result->tabImportExport = $tabRet; } elseif ($key=='tabCommentaires') { $tab = array(); - foreach($tabRet[$key] as $comment) { + foreach($value as $comment) { $tab[] = $comment; } $result->tabCommentaires = $tab; } elseif ($key=='tabVariables') { - $tab = $tabRet[$key]['CA_Y']; + $tab = $value['CA_Y']; $tabVar = array(); - foreach($tab as $key => $value){ + foreach($tab as $varName => $varVal){ $var = new CA_Y(); - $var->id = $key; - $var->val = $value; + $var->id = $varName; + $var->val = $varVal; $tabVar[] = $var; } $variables = new IndiscoreVariables(); @@ -857,9 +914,9 @@ class WsEntreprise extends WsScore } else { - //$result->$key = $value; + $result->$key = $value; } - }*/ + } $output = new IndiscoreReturn(); $output->error = $error; $output->result = $result;