Mise à niveau classe Métier
This commit is contained in:
parent
52abcbbbbb
commit
4a92b1b7e8
@ -1520,7 +1520,7 @@ public function rechercheDirOld($nom, $prenom='', $fonction='', $dateNaiss='', $
|
||||
$sqlInfo="'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, e.siren, e.nic, e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, e.adr_cp, e.adr_ville, e.tel, e.fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab, ".
|
||||
"CONCAT(e.siren, e.nic) as siret, e.actif, e.identite_pre";
|
||||
"CONCAT(e.siren, e.nic) as siret, e.actif, e.identite_pre, IF(e.siege=2,0.5,e.siege) AS triSiege";
|
||||
|
||||
$strActif='';
|
||||
if (intval($actif)==1) $strActif=' AND e.actif=1 ';
|
||||
@ -1528,38 +1528,45 @@ public function rechercheDirOld($nom, $prenom='', $fonction='', $dateNaiss='', $
|
||||
|
||||
$strSiege='';
|
||||
if ($siege===null) $strSiege='';
|
||||
elseif ($siege==1) $strSiege=' AND e.siege=1 ';
|
||||
elseif ($siege==0) $strSiege=' AND e.siege=0 ';
|
||||
elseif ($siege==1) $strSiege=' e.siege=1 ';
|
||||
elseif ($siege==0) $strSiege=' e.siege IN(0,2) ';
|
||||
|
||||
//Search with "departement"
|
||||
if ($dep>0 && $dep<99999) {
|
||||
|
||||
if ($dep<96) $strDep='AND adr_cp BETWEEN '.$dep.'000 AND '.$dep.'999';
|
||||
if ($dep<96) $strDep='AND adr_cp BETWEEN '.$dep.'000 AND '.$dep.'999';
|
||||
elseif ($dep>9999) $strDep="AND adr_cp BETWEEN $dep AND $dep";
|
||||
else $strDep='AND adr_cp BETWEEN '.$dep.'00 AND '.$dep.'99';
|
||||
else $strDep='AND adr_cp BETWEEN '.$dep.'00 AND '.$dep.'99';
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements e', 'count(*)', "siren=$siren $strDep $strActif $strSiege");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
"siren=$siren $strDep $strActif $strSiege ORDER BY e.siege , e.actif DESC $limit", false, MYSQL_ASSOC);
|
||||
"siren=$siren $strDep $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC,e.nic DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
} elseif ($nic=='') {
|
||||
}
|
||||
//Search without NIC
|
||||
elseif ($nic=='') {
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements e', 'count(*)', "siren=$siren $strActif $strSiege");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
"e.siren=$siren $strActif $strSiege ORDER BY e.siege DESC, e.actif DESC $limit", false, MYSQL_ASSOC);
|
||||
"e.siren=$siren $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
} else {
|
||||
}
|
||||
//Search with NIC
|
||||
else {
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements e', 'count(*)', "siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
"siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege ORDER BY e.siege , e.actif DESC $limit", false, MYSQL_ASSOC);
|
||||
"siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
if ($nbTot==0 && $actif==-1) {
|
||||
|
||||
require_once 'Metier/sphinx/rechercheFonc.php';
|
||||
@ -1991,12 +1998,12 @@ public function rechercheDirOld($nom, $prenom='', $fonction='', $dateNaiss='', $
|
||||
elseif ($nic<>0) $where=" siren=$siren AND nic=$nic ";
|
||||
elseif ($siren<>0) $where=" siren=$siren ";//AND siege=1 ";
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
"e.id, e.source, e.source_id, e.triCode, e.autre_id, e.siren, e.nic, e.siege, e.autre_id, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, e.adr_cp, e.adr_ville, e.tel, e.fax, e.cj, e.ape_etab, e.ape_entrep, ".
|
||||
"e.capital, e.capitalDev, e.capitalSrc, CONCAT(e.siren, e.nic) as siret, e.actif, ".
|
||||
"e.age_entrep, e.age_etab, e.tca, e.tcaexp, e.teff_entrep, e.teff_etab",
|
||||
"$where ORDER BY siege DESC, actif DESC, nic DESC $limit", false, MYSQL_ASSOC);
|
||||
"e.id, e.source, e.source_id, e.triCode, e.autre_id, e.siren, e.nic, e.siege, e.autre_id, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, e.adr_cp, e.adr_ville, e.tel, e.fax, e.cj, e.ape_etab, e.ape_entrep, ".
|
||||
"e.capital, e.capitalDev, e.capitalSrc, CONCAT(e.siren, e.nic) as siret, e.actif, ".
|
||||
"e.age_entrep, e.age_etab, e.tca, e.tcaexp, e.teff_entrep, e.teff_etab",
|
||||
"$where ORDER BY siege DESC, actif DESC, nic DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
$etab=@$listeEtab[0];
|
||||
$nic=@$etab['nic'];
|
||||
@ -3260,7 +3267,7 @@ print_r($tmp, true));
|
||||
|
||||
/** Eléments Financiers en provenance du dernier Bilan
|
||||
**/
|
||||
$rep=$this->iDb->select('bilans', 'siren, dateExercice, dureeExercice, monnaie, typeBilan, unite, postes, dateProvPartenaire, dateInsert', "siren=$siren AND typeBilan IN ('N','S') ORDER BY dateExercice DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('bilans', 'siren, dateExercice, dureeExercice, monnaie, typeBilan, unite, postes, dateProvPartenaire, dateInsert', "siren=$siren AND typeBilan IN ('N','S') ORDER BY dateExercice DESC LIMIT 0,1", true, MYSQL_ASSOC);
|
||||
$entrep=$rep[0];
|
||||
if (isset($entrep['dateExercice'])) {
|
||||
$tabRet['bilanAnnee'] = substr($entrep['dateExercice'],0,4);
|
||||
@ -3847,7 +3854,7 @@ TOTAL : $dureeTot s\n";
|
||||
* @param bool $forceVerif
|
||||
* @return array
|
||||
*/
|
||||
function getAnnoncesLegales($siren, $idAnnonce=0, $rubrique='', $forceVerif=false, $allTextes=false)
|
||||
function getAnnoncesLegales($siren, $idAnnonce=0, $rubrique='', $forceVerif=false, $allTextes=false, $deleted=false)
|
||||
{
|
||||
$siren=$siren*1;
|
||||
$strIdAnn='';
|
||||
@ -3915,70 +3922,91 @@ TOTAL : $dureeTot s\n";
|
||||
&& $rubrique<>'BODA' && $rubrique<>'BODB' && $rubrique<>'BODC' && !is_array($rubrique))
|
||||
return false;
|
||||
|
||||
if ($idAnnonce==0 || $idAnnonce>=1) { /** On recherche dans les annonces récentes **/
|
||||
$groupBy=' ';
|
||||
/** On recherche dans les annonces récentes **/
|
||||
if ($idAnnonce==0 || $idAnnonce>=1)
|
||||
{
|
||||
$strDeleted = "AND d.dateSuppr=0 ";
|
||||
if ($deleted===true) {
|
||||
$strDeleted = "AND (d.dateSuppr=0 OR d.dateSuppr!='0000-00-00 00:00:00' AND d.idSuppr=0) ";
|
||||
}
|
||||
|
||||
$groupBy=' ';
|
||||
$strCle='1 ';
|
||||
if ($siren<>0) $strCle ="d.siren=$siren ";
|
||||
else $groupBy=' GROUP BY d.id ';
|
||||
$bodacc=$this->iDb->select(
|
||||
'bodacc_detail d, bodacc b, tribunaux t',//.codEven Code évènement du mouvement Bodacc libEven ',
|
||||
"b.id, b.Bodacc_Code, b.Bodacc_Annee_Parution, b.Bodacc_Num, b.Num_Annonce, b.Bodacc_Date_Parution, b.Tribunal_Dept, b.Tribunal_Code, d.Rubrique, b.typeAnnonce, b.corrNum_Annonce, b.corrBodacc_Date_Parution, b.corrPage, b.corrNumParution, b.corrTexteRectificatif, b.annonce, b.dateInsert, t.triCode, t.triNom, t.triSiret, d.typeEven, d.dateEffet, d.dateDebutActivite, d.dateCessationActivite, d.dateJugement, d.dateFinObservation, d.VenteMt, d.VenteDev, d.FJ, d.Capital, d.CapitalDev, CONCAT(d.commentaires,' ',d.fusion) as complement, d.raisonSociale, d.nomCommercial, d.enseigne, d.sigle, d.adresse, d.codePostal, d.ville, d.adresseSiege, d.codePostalSiege, d.villeSiege",
|
||||
"$strCle AND d.id=b.id AND b.Tribunal_Code=t.triCode AND d.dateSuppr=0 $strIdAnn $groupBy ORDER BY b.Bodacc_Date_Parution DESC", false, MYSQL_ASSOC);
|
||||
'bodacc_detail d, bodacc b, tribunaux t',//.codEven Code évènement du mouvement Bodacc libEven ',
|
||||
"b.id, b.Bodacc_Code, b.Bodacc_Annee_Parution, b.Bodacc_Num, b.Num_Annonce, b.Bodacc_Date_Parution, b.Tribunal_Dept, b.Tribunal_Code, d.Rubrique, b.typeAnnonce, b.corrNum_Annonce, b.corrBodacc_Date_Parution, b.corrPage, b.corrNumParution, b.corrTexteRectificatif, b.annonce, b.dateInsert, t.triCode, t.triNom, t.triSiret, d.typeEven, d.dateEffet, d.dateDebutActivite, d.dateCessationActivite, d.dateJugement, d.dateFinObservation, d.VenteMt, d.VenteDev, d.FJ, d.Capital, d.CapitalDev, CONCAT(d.commentaires,' ',d.fusion) as complement, d.raisonSociale, d.nomCommercial, d.enseigne, d.sigle, d.adresse, d.codePostal, d.ville, d.adresseSiege, d.codePostalSiege, d.villeSiege, IF(d.dateSuppr=0,'',d.dateSuppr) AS deleted",
|
||||
"$strCle AND d.id=b.id AND b.Tribunal_Code=t.triCode $strDeleted $strIdAnn $groupBy ORDER BY b.Bodacc_Date_Parution DESC", false, MYSQL_ASSOC);
|
||||
$k=0;
|
||||
if (count($bodacc)>0) {
|
||||
foreach ($bodacc as $k=>$ann) {
|
||||
if (count($bodacc)>0)
|
||||
{
|
||||
foreach ($bodacc as $k=>$ann)
|
||||
{
|
||||
$tabEven=explode(';', $ann['typeEven']);
|
||||
$tabRetEven=array();
|
||||
if ($ann['typeAnnonce']<>'Insertion')//BODACC n°002 A du 04/01/2006.
|
||||
$tabRetEven[]=array('CodeEven'=>'0000',
|
||||
'LibEven'=> $ann['typeAnnonce'].' de l\'annonce './*n°'.
|
||||
$ann['corrNum_Annonce'].' BODACC n°'.
|
||||
$ann['corrNumParution'].*/' du '.
|
||||
WDate::dateT('Y-m-d','d/m/Y',$ann['corrBodacc_Date_Parution'])/*.' (page '.
|
||||
$ann['corrPage'].')'*/);
|
||||
else {
|
||||
if (trim($ann['typeEven'])<>'') {
|
||||
foreach ($tabEven as $even) {
|
||||
$tabRetEven[]=array('CodeEven'=>$even,'LibEven'=>$this->iBodacc->getEvenement($even));
|
||||
if (($this->dureePlan==0 || $this->dureePlan==120) &&
|
||||
( $even==1407 || // Modification de plan
|
||||
$even==1409 || // Modification du plan de continuation
|
||||
$even==1413 || // Arrêt du plan de continuation
|
||||
$even==1414) ) // Arrêt du plan de redressement
|
||||
{
|
||||
$this->debutPlan=str_replace('-','',$ann['dateJugement']); // SSAAMMJJ
|
||||
if (preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uis', $ann['annonce'], $matches)) {
|
||||
$this->dureePlan=$matches[1]*12; // 10 ans = 120 mois
|
||||
}
|
||||
if ($this->dureePlan<1 || $this->dureePlan>120) {
|
||||
if (($fj==16 || $fj==1600 || // Exploitant agricole
|
||||
$fj==63 || $fj==6316 || $fj==6317 || $fj==6318 || // Société coopérative agricole
|
||||
$fj==5431 || $fj==5432 || $fj==5531 || $fj==5532 || // SMIA, SICA
|
||||
$fj==5631 || $fj==5632 || $fj==6532 ||
|
||||
$fj==6533 || $fj==6534 || $fj==6535 || // GAEC, GFA, Gpt Agricole Foncier
|
||||
$fj==6597 || $fj==6598) /*&& $this->dureePlan>180*/)
|
||||
$this->dureePlan=180; // 15 ans
|
||||
else
|
||||
$this->dureePlan=120; // 10 ans = 120 mois
|
||||
//sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Annonce de Plan Récent sur $siren sans durée", print_r($ann, true).EOL.print_r($matches, true));
|
||||
}
|
||||
$this->finPlan=WDate::period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
// sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "MInsee::getAnnoncesLegales($siren, idAn=$idAnnonce, rubrique=$rubrique, verif=$forceVerif, txt=$allTextes) Annonce de Plan", print_r($ann, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ($ann['Rubrique']) {
|
||||
case 'mmd': $codeEven='2313'; $libEven='Modification(s) diverse(s)'; break;
|
||||
case 'comptes': $codeEven='3999'; $libEven='Dépôt des comptes'; break;
|
||||
case 'creations': $codeEven='4999'; $libEven='Création d\'entreprise'; break;
|
||||
case 'procol': $codeEven='1999'; $libEven='Procédure collective'; break;
|
||||
case 'radiations': $codeEven='6700'; $libEven='Radiation'; break;
|
||||
case 'ventes': $codeEven='5999'; $libEven='Vente/Cession'; break;
|
||||
default: $codeEven='0000'; $libEven=$ann['Rubrique']; break;
|
||||
}
|
||||
$tabRetEven[]=array('CodeEven'=>$codeEven,'LibEven'=>$libEven);
|
||||
if ($ann['typeAnnonce']<>'Insertion') {
|
||||
//Sélection des événements
|
||||
foreach ($tabEven as $even) {
|
||||
if ($even!=0) {
|
||||
$tabRetEven[]=array(
|
||||
'CodeEven' => $even,
|
||||
'LibEven' => $this->iBodacc->getEvenement($even)
|
||||
);
|
||||
}
|
||||
}
|
||||
//Libellé générique
|
||||
$tabRetEven[] = array(
|
||||
'CodeEven' => '0000',
|
||||
'LibEven' => $ann['typeAnnonce']." de l'annonce du ".WDate::dateT('Y-m-d','d/m/Y',$ann['corrBodacc_Date_Parution'])
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (trim($ann['typeEven'])<>'') {
|
||||
foreach ($tabEven as $even) {
|
||||
if ( $even!=0 ) {
|
||||
$tabRetEven[]=array('CodeEven'=>$even,'LibEven'=>$this->iBodacc->getEvenement($even));
|
||||
if (($this->dureePlan==0 || $this->dureePlan==120) &&
|
||||
( $even==1407 || // Modification de plan
|
||||
$even==1409 || // Modification du plan de continuation
|
||||
$even==1413 || // Arrêt du plan de continuation
|
||||
$even==1414) ) // Arrêt du plan de redressement
|
||||
{
|
||||
$this->debutPlan=str_replace('-','',$ann['dateJugement']); // SSAAMMJJ
|
||||
if (preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uis', $ann['annonce'], $matches)) {
|
||||
$this->dureePlan=$matches[1]*12; // 10 ans = 120 mois
|
||||
}
|
||||
if ($this->dureePlan<1 || $this->dureePlan>120) {
|
||||
if (($fj==16 || $fj==1600 || // Exploitant agricole
|
||||
$fj==63 || $fj==6316 || $fj==6317 || $fj==6318 || // Société coopérative agricole
|
||||
$fj==5431 || $fj==5432 || $fj==5531 || $fj==5532 || // SMIA, SICA
|
||||
$fj==5631 || $fj==5632 || $fj==6532 ||
|
||||
$fj==6533 || $fj==6534 || $fj==6535 || // GAEC, GFA, Gpt Agricole Foncier
|
||||
$fj==6597 || $fj==6598) /*&& $this->dureePlan>180*/)
|
||||
$this->dureePlan=180; // 15 ans
|
||||
else
|
||||
$this->dureePlan=120; // 10 ans = 120 mois
|
||||
//sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Annonce de Plan Récent sur $siren sans durée", print_r($ann, true).EOL.print_r($matches, true));
|
||||
}
|
||||
$this->finPlan=WDate::period2Days($this->debutPlan, $this->dureePlan.' mois');
|
||||
// sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "MInsee::getAnnoncesLegales($siren, idAn=$idAnnonce, rubrique=$rubrique, verif=$forceVerif, txt=$allTextes) Annonce de Plan", print_r($ann, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch ($ann['Rubrique']) {
|
||||
case 'mmd': $codeEven='2313'; $libEven='Modification(s) diverse(s)'; break;
|
||||
case 'comptes': $codeEven='3999'; $libEven='Dépôt des comptes'; break;
|
||||
case 'creations': $codeEven='4999'; $libEven='Création d\'entreprise'; break;
|
||||
case 'procol': $codeEven='1999'; $libEven='Procédure collective'; break;
|
||||
case 'radiations': $codeEven='6700'; $libEven='Radiation'; break;
|
||||
case 'ventes': $codeEven='5999'; $libEven='Vente/Cession'; break;
|
||||
default: $codeEven='0000'; $libEven=$ann['Rubrique']; break;
|
||||
}
|
||||
$tabRetEven[]=array('CodeEven'=>$codeEven,'LibEven'=>$libEven);
|
||||
}
|
||||
}
|
||||
|
||||
if ($ann['Rubrique']=='procol') $procol=true;
|
||||
@ -3995,45 +4023,52 @@ TOTAL : $dureeTot s\n";
|
||||
else
|
||||
$dateEffet=$ann['dateEffet'];
|
||||
$adresseAnn=trim(preg_replace('/ +/',' ', $ann['adresseSiege'].' '.$ann['codePostalSiege'].' '.$ann['villeSiege']));
|
||||
|
||||
if (strlen($adresse)<8)
|
||||
$adresseAnn=trim(preg_replace('/ +/',' ', $ann['adresse'].' '.$ann['codePostal'].' '.$ann['ville']));
|
||||
$tabRet[$k]=array( 'id'=>$ann['id'],
|
||||
'BodaccCode'=>'BOD'.$ann['Bodacc_Code'],
|
||||
'BodaccNum'=>$ann['Bodacc_Num'],
|
||||
'NumAnnonce'=>$ann['Num_Annonce'],
|
||||
'DateParution'=>$ann['Bodacc_Date_Parution'],
|
||||
'Departement'=>$ann['Tribunal_Dept'],
|
||||
'Tribunal'=>$ann['triNom'],
|
||||
'TribunalCode'=>$ann['triCode'],
|
||||
'TribunalSiret'=>$ann['triSiret'],
|
||||
'Rubrique'=>$ann['Rubrique'],
|
||||
'typeAnnonce'=>$ann['typeAnnonce'],
|
||||
'texteRectificatif'=>$ann['corrTexteRectificatif'],
|
||||
// 'texteAnnonce'=>$ann['annonce'],
|
||||
'dateEffet'=>$dateEffet,
|
||||
'dateJugement'=>$ann['dateJugement'],
|
||||
/// d.dateDebutActivite, d.dateCessationActivite, d.dateJugement',
|
||||
'dateFin'=>$ann['dateFinObservation'],
|
||||
'montantVente'=>trim($ann['VenteMt'].' '.$ann['VenteDev']),
|
||||
'libFJ'=>$ann['FJ'],
|
||||
'codFJ'=>$this->iBodacc->getCodeFormeJur($ann['FJ']),
|
||||
'capital'=>$ann['Capital'],
|
||||
'capitalDev'=>$ann['CapitalDev'],
|
||||
'raisonSociale'=>$ann['raisonSociale'],
|
||||
'nomCommercial'=>$ann['nomCommercial'],
|
||||
'sigle'=>$ann['sigle'],
|
||||
'adresse'=>$adresseAnn,
|
||||
'dateInsertionSD'=>$ann['dateInsert'],
|
||||
'evenements'=>$tabRetEven,
|
||||
'complement'=>$ann['complement'],
|
||||
);
|
||||
|
||||
$tabRet[$k]=array(
|
||||
'id'=>$ann['id'],
|
||||
'BodaccCode'=>'BOD'.$ann['Bodacc_Code'],
|
||||
'BodaccNum'=>$ann['Bodacc_Num'],
|
||||
'NumAnnonce'=>$ann['Num_Annonce'],
|
||||
'DateParution'=>$ann['Bodacc_Date_Parution'],
|
||||
'Departement'=>$ann['Tribunal_Dept'],
|
||||
'Tribunal'=>$ann['triNom'],
|
||||
'TribunalCode'=>$ann['triCode'],
|
||||
'TribunalSiret'=>$ann['triSiret'],
|
||||
'Rubrique'=>$ann['Rubrique'],
|
||||
'typeAnnonce'=>$ann['typeAnnonce'],
|
||||
'texteRectificatif'=>$ann['corrTexteRectificatif'],
|
||||
//'texteAnnonce'=>$ann['annonce'],
|
||||
'dateEffet'=>$dateEffet,
|
||||
'dateJugement'=>$ann['dateJugement'],
|
||||
/// d.dateDebutActivite, d.dateCessationActivite, d.dateJugement',
|
||||
'dateFin'=>$ann['dateFinObservation'],
|
||||
'montantVente'=>trim($ann['VenteMt'].' '.$ann['VenteDev']),
|
||||
'libFJ'=>$ann['FJ'],
|
||||
'codFJ'=>$this->iBodacc->getCodeFormeJur($ann['FJ']),
|
||||
'capital'=>$ann['Capital'],
|
||||
'capitalDev'=>$ann['CapitalDev'],
|
||||
'raisonSociale'=>$ann['raisonSociale'],
|
||||
'nomCommercial'=>$ann['nomCommercial'],
|
||||
'sigle'=>$ann['sigle'],
|
||||
'adresse'=>$adresseAnn,
|
||||
'dateInsertionSD'=>$ann['dateInsert'],
|
||||
'evenements'=>$tabRetEven,
|
||||
'complement'=>$ann['complement'],
|
||||
'deleted' => $ann['deleted'],
|
||||
);
|
||||
|
||||
if ($idAnnonce<>0 || $allTextes)
|
||||
$tabRet[$k]['texteAnnonce']=$ann['annonce'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($idAnnonce==0 || $idAnnonce<0) { /** On recherche dans les annonces passées **/
|
||||
/** On recherche dans les annonces passées **/
|
||||
if ($idAnnonce==0 || $idAnnonce<0)
|
||||
{
|
||||
$iDbHisto=new WDB('historiques');
|
||||
$tabTmp=array( 10=>'4000', // Création d'entreprise
|
||||
11=>'4000',
|
||||
@ -4236,7 +4271,8 @@ TOTAL : $dureeTot s\n";
|
||||
}
|
||||
}
|
||||
|
||||
$tabRet[$k]=array( 'id'=>-$ann['ANBASE'],
|
||||
$tabRet[$k]=array(
|
||||
'id'=>-$ann['ANBASE'],
|
||||
'BodaccCode'=>$Bodacc_Code,
|
||||
'BodaccNum'=>$ann['NOBOD'],
|
||||
'NumAnnonce'=>$ann['NOANN'],
|
||||
|
@ -1688,31 +1688,32 @@ class MGreffes {
|
||||
$numRC2=$numRC;
|
||||
|
||||
/** Insertion en base de données **/
|
||||
$tabInsert=array( 'siren' => $siren,
|
||||
'nom' => $nom,
|
||||
'nomCommercial' => $nomCom,
|
||||
'adresse' => $adr,
|
||||
'adresse2' => $adr2,
|
||||
'cp' => $cp,
|
||||
'ville' => $ville,
|
||||
'enseigne' => $ens,
|
||||
'siege' => $siege,
|
||||
'fj' => $cj,
|
||||
'fjLib' => $cjLib,
|
||||
'naf' => $naf,
|
||||
'nafLib' => $nafLib,
|
||||
'numGreffe' => $greffe_num,
|
||||
'typeRCS' => $typeRCS,
|
||||
'libGreffe' => $greffe_lib,
|
||||
'numRC' => $numRC,
|
||||
'numRC2' => $numRC2,
|
||||
'dateCreation' => $dateCre,
|
||||
'dateRadiation' => $dateRad,
|
||||
'dateCloture' => $dateCloture,
|
||||
'ca' => $ca,
|
||||
'res' => $res,
|
||||
'eff' => $eff,
|
||||
);
|
||||
$tabInsert=array(
|
||||
'siren' => $siren,
|
||||
'nom' => $nom,
|
||||
'nomCommercial' => $nomCom,
|
||||
'adresse' => $adr,
|
||||
'adresse2' => $adr2,
|
||||
'cp' => $cp,
|
||||
'ville' => $ville,
|
||||
'enseigne' => $ens,
|
||||
'siege' => $siege,
|
||||
'fj' => $cj,
|
||||
'fjLib' => utf8_encode($cjLib),
|
||||
'naf' => $naf,
|
||||
'nafLib' => utf8_encode($nafLib),
|
||||
'numGreffe' => $greffe_num,
|
||||
'typeRCS' => $typeRCS,
|
||||
'libGreffe' => $greffe_lib,
|
||||
'numRC' => $numRC,
|
||||
'numRC2' => $numRC2,
|
||||
'dateCreation' => $dateCre,
|
||||
'dateRadiation' => $dateRad,
|
||||
'dateCloture' => $dateCloture,
|
||||
'ca' => $ca,
|
||||
'res' => $res,
|
||||
'eff' => $eff,
|
||||
);
|
||||
$dateInsert=date('Y-m-d H:i:s');
|
||||
$id=$this->iDb->insert('greffes_identite', $tabInsert, true);
|
||||
//sendMail('debug@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes.php : Debug identite $siren", $this->body);
|
||||
|
@ -6,24 +6,24 @@ class MLiens2
|
||||
* @var int
|
||||
*/
|
||||
protected $idRef = null;
|
||||
|
||||
|
||||
/**
|
||||
* Company SIREN
|
||||
* @var string
|
||||
*/
|
||||
protected $siren = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var Zend_Db
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
|
||||
/**
|
||||
* Array to list id find during list of childrens
|
||||
* @var array
|
||||
*/
|
||||
protected $findId = array();
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $id
|
||||
@ -38,17 +38,17 @@ class MLiens2
|
||||
} else {
|
||||
$c = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini');
|
||||
}
|
||||
|
||||
|
||||
//Connect to the database
|
||||
try {
|
||||
$this->db = Zend_Db::factory($c->profil->db->jo);
|
||||
$this->db->getConnection();
|
||||
} catch (Zend_Db_Adapter_Exception $e) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
throw new Exception($e->getMessage(), 'ERR');
|
||||
} catch (Zend_Exception $e) {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
throw new Exception("Application error", 'ERR');
|
||||
}
|
||||
|
||||
|
||||
if ( $type == 'siren' ) {
|
||||
$this->siren = $id;
|
||||
$refM = new Application_Model_JoLiensRef($this->db);
|
||||
@ -61,7 +61,7 @@ class MLiens2
|
||||
$this->idRef = $id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne les actionnaires
|
||||
* @param int $id
|
||||
@ -70,17 +70,17 @@ class MLiens2
|
||||
*/
|
||||
public function getActionnaires($id = null, $actif = null)
|
||||
{
|
||||
|
||||
|
||||
if ( null === $id ) {
|
||||
$id = $this->idRef;
|
||||
}
|
||||
|
||||
|
||||
$liens = array();
|
||||
|
||||
|
||||
if ( null === $id ) {
|
||||
return $liens;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$sql = $this->db->select()
|
||||
->from(array('l'=>'liens2'),
|
||||
@ -94,7 +94,7 @@ class MLiens2
|
||||
'adresse_comp', 'adresse_cp', 'adresse_ville', 'adresse_pays'
|
||||
))
|
||||
->order('PDetention DESC');
|
||||
|
||||
|
||||
//Actif / Inactif
|
||||
if ( null !== $actif ) {
|
||||
if ( false === $actif ) {
|
||||
@ -103,12 +103,12 @@ class MLiens2
|
||||
$sql->where('l.actif=?',1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$liens = $this->db->fetchAll($sql, null, Zend_Db::FETCH_OBJ);
|
||||
} catch (Zend_Exception $e) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
throw new Exception($e->getMessage(), 'ERR');
|
||||
}
|
||||
|
||||
|
||||
return $liens;
|
||||
}
|
||||
|
||||
@ -123,19 +123,19 @@ class MLiens2
|
||||
if ( null === $id ) {
|
||||
$id = $this->idRef;
|
||||
}
|
||||
|
||||
|
||||
if ( false === $actif ) {
|
||||
$actif = 0;
|
||||
} else {
|
||||
$actif = 1;
|
||||
}
|
||||
|
||||
|
||||
$liens = array();
|
||||
|
||||
|
||||
if ( null === $id ) {
|
||||
return $liens;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$sql = $this->db->select()
|
||||
->from(array('l'=>'liens2'),
|
||||
@ -149,7 +149,7 @@ class MLiens2
|
||||
'adresse_comp', 'adresse_cp', 'adresse_ville', 'adresse_pays'
|
||||
))
|
||||
->order('PDetention DESC');
|
||||
|
||||
|
||||
//Actif / Inactif
|
||||
if ( null !== $actif ) {
|
||||
if ( false === $actif ) {
|
||||
@ -158,15 +158,15 @@ class MLiens2
|
||||
$sql->where('l.actif=?',1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$liens = $this->db->fetchAll($sql, null, Zend_Db::FETCH_OBJ);
|
||||
} catch (Zend_Exception $e) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
} catch (Zend_Db_Exception $e) {
|
||||
throw new Exception($e->getMessage(), 'ERR');
|
||||
}
|
||||
|
||||
|
||||
return $liens;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fonctions de direction
|
||||
* @param boolean $actif
|
||||
@ -181,9 +181,9 @@ class MLiens2
|
||||
} else {
|
||||
$siren = $this->siren;
|
||||
}
|
||||
|
||||
|
||||
$result = array();
|
||||
|
||||
|
||||
if ( null !== $siren && intval($siren) != 0 )
|
||||
{
|
||||
$directionsM = new Application_Model_JoRncsDirigeants($this->db);
|
||||
@ -191,7 +191,7 @@ class MLiens2
|
||||
'siren','raisonSociale', 'dirSiren', 'dirRS', 'civilite', 'nom',
|
||||
'prenom', 'naissance_date', 'naissance_lieu', 'fonction_code', 'fonction_lib'
|
||||
))->where("typeDir IN ('PM', 'PP')")->where('dirSiren=?', $siren);
|
||||
|
||||
|
||||
//Actif / Inactif
|
||||
if ( null !== $actif ) {
|
||||
if ( false === $actif ) {
|
||||
@ -202,13 +202,13 @@ class MLiens2
|
||||
}
|
||||
$sql->order('fonction_code DESC');
|
||||
$sql->order('raisonSociale ASC');
|
||||
|
||||
|
||||
$result = $directionsM->fetchAll($sql);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retourne la maison mère
|
||||
@ -220,13 +220,13 @@ class MLiens2
|
||||
if ( null === $id ) {
|
||||
$id = $this->idRef;
|
||||
}
|
||||
|
||||
|
||||
//Add ID to the list of known
|
||||
$this->findId[] = $id;
|
||||
|
||||
|
||||
//Through the list
|
||||
$liens = $this->getActionnaires($id, true);
|
||||
|
||||
|
||||
//Find the following up entity
|
||||
if ( count($liens)>0 ) {
|
||||
foreach ( $liens as $item ) {
|
||||
@ -234,7 +234,7 @@ class MLiens2
|
||||
if ( in_array($item->idAct, $this->findId) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Remove Special
|
||||
if ( $item->idAct <= 1000 ) {
|
||||
return $id;
|
||||
@ -257,7 +257,7 @@ class MLiens2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
@ -271,14 +271,14 @@ class MLiens2
|
||||
if ( null === $id ) {
|
||||
$id = $this->idRef;
|
||||
}
|
||||
|
||||
|
||||
$refM = new Application_Model_JoLiensRef($this->db);
|
||||
$row = $refM->find($id);
|
||||
if (null !== row) {
|
||||
return $row->current();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne l'arborescence pour les groupes
|
||||
* @param int $pctMin
|
||||
@ -295,12 +295,12 @@ class MLiens2
|
||||
|
||||
$this->findId = array();
|
||||
$this->findId[] = $identity->id;
|
||||
|
||||
|
||||
$nom = $identity->RS;
|
||||
if ( $identity->nom != '') {
|
||||
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
|
||||
}
|
||||
|
||||
|
||||
//Retour
|
||||
$tabRet = array (
|
||||
'id' => $identity->id,
|
||||
@ -310,7 +310,7 @@ class MLiens2
|
||||
'pays' => $identity->adresse_pays,
|
||||
'children' => $this->getTreeRecursive($identity->id, $pctMin, 1, $nbNiveaux),
|
||||
);
|
||||
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
@ -333,12 +333,12 @@ class MLiens2
|
||||
foreach ( $participations as $item ) {
|
||||
if ( $item->PDetention > $pctMin ) {
|
||||
$identity = $this->getIdentity($item->idPar);
|
||||
|
||||
|
||||
$nom = $identity->RS;
|
||||
if ( $identity->nom != '') {
|
||||
$nom = $identity->civilite.' '.$identity->nom.' '.$identity->prenom;
|
||||
}
|
||||
|
||||
|
||||
$data = array (
|
||||
'id' => $identity->id,
|
||||
'name' => $nom,
|
||||
|
@ -65,27 +65,23 @@ class MTva {
|
||||
|
||||
private $siren;
|
||||
|
||||
function __construct($siren, $accesDist=true) {
|
||||
|
||||
function __construct($siren, $accesDist=true)
|
||||
{
|
||||
$sirenIn=$siren*1;
|
||||
if ($sirenIn<000001000) {
|
||||
/* $this->errnum=0;
|
||||
$this->errmsg=$O->error->errmsg;
|
||||
return false;
|
||||
} else {
|
||||
$val=$O->result;
|
||||
$this->vatNumber=$val->vatNumber;
|
||||
$this->vatDefined=$val->vatDefined;*/
|
||||
$this->vatNumber='FR00000000000';
|
||||
$this->vatDefined=false;
|
||||
return false;
|
||||
}elseif($sirenIn<000010000) $siren='00000'.$sirenIn;
|
||||
if ($sirenIn<000001000) {
|
||||
$this->vatNumber='FR00000000000';
|
||||
$this->vatDefined=false;
|
||||
return false;
|
||||
}
|
||||
elseif($sirenIn<000010000) $siren='00000'.$sirenIn;
|
||||
elseif ($sirenIn<000100000) $siren='0000'.$sirenIn;
|
||||
elseif ($sirenIn<001000000) $siren='000'.$sirenIn;
|
||||
elseif ($sirenIn<010000000) $siren='00'.$sirenIn;
|
||||
elseif ($sirenIn<100000000) $siren='0'.$sirenIn;
|
||||
else $siren=''.$sirenIn;
|
||||
|
||||
$siren = str_pad($siren, 9, '0', STR_PAD_LEFT);
|
||||
|
||||
$this->siren=$siren;
|
||||
$cleAlgo=$this->genereCleFr();
|
||||
|
||||
@ -121,10 +117,12 @@ class MTva {
|
||||
'iso'=>'FR',
|
||||
'vat'=>$cle.$siren,
|
||||
'BtnSubmitVat'=>'Verify');
|
||||
/* $postData=array( 'Lang'=>'FR',
|
||||
'VAT'=>$cle.$siren,
|
||||
'ISO'=>'FR',
|
||||
'MS'=>'FR');*/
|
||||
/*$postData=array(
|
||||
* 'Lang'=>'FR',
|
||||
'VAT'=>$cle.$siren,
|
||||
'ISO'=>'FR',
|
||||
'MS'=>'FR'
|
||||
);*/
|
||||
$tdeb = microtime_float();
|
||||
// $url='http://ec.europa.eu/taxation_customs/vies/cgi-bin/viesquer';
|
||||
// $referer='http://ec.europa.eu/taxation_customs/vies/fr/vieshome.htm';
|
||||
@ -133,8 +131,7 @@ class MTva {
|
||||
|
||||
$page=getUrl($url, '', $postData, $referer, false, 'ec.europa.eu', '', 15);
|
||||
$duree = round(microtime_float()-$tdeb, 3);
|
||||
//sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMTva sur $siren en $duree", print_r($page, true));
|
||||
|
||||
//sendMail('production@scores-decisions.com', 'mricois@scores-decisions.com', "classMTva sur $siren en $duree", print_r($page, true));
|
||||
if ($page['err_num']<>0) {
|
||||
debugLog('W', 'TVA Erreur CURL n°'. $page['err_num'] .', '. $page['err_msg'] ." sur le Siren $siren, numéro de TVA = FR $cle $siren. Durée = $duree s !", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
$this->vatNumber="FR$cle$siren";
|
||||
|
@ -867,8 +867,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$tabDepotCpt=$iInsee->getAnnoncesLegales($siren, 0, array(2303), false);
|
||||
if (count($tabDepotCpt)>0) $ANNONCEBODCREGUL=2;
|
||||
} else {
|
||||
if($genereComment && ENV<>'PRD' && $mailDebug)
|
||||
/*@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Bilans réguliers", "
|
||||
/*if($genereComment && ENV<>'PRD' && $mailDebug)
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Bilans réguliers", "
|
||||
Nb mois de bilans entre le début et la fin : $nbMoisBilDate
|
||||
Nb mois cumulé des exercices : $nbMoisBilCumul
|
||||
ANNONCEBODCREGUL=$ANNONCEBODCREGUL
|
||||
@ -1366,6 +1366,7 @@ Liste des dates de clotures :
|
||||
elseif ($depcomen>96000) $DEPSIE=substr($depcomen,0,3);
|
||||
elseif ($depcomen<10000) $DEPSIE=substr($depcomen,0,1);
|
||||
else $DEPSIE=substr($depcomen,0,2);
|
||||
$DEPSIE_DE=$iInsee->getDepartement($DEPSIE,true);
|
||||
|
||||
$tabStructure['activite']= $isolv->getPtActivite();
|
||||
$tabStructure['naf4']= $isolv->getNaf4($naf);
|
||||
@ -1799,7 +1800,7 @@ AltmanCote=$scoreAltmanB".EOL.print_r($tabInfosNotation,true);
|
||||
$DIR_NB=$NBDIRLIENS=$NBDIRSCI=$NBDIRSCIADR=0;
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Dirigeants", print_r($dirs, true));
|
||||
foreach ($dirs as $nb=>$dir) {
|
||||
if ($dir['Ancien']==0 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uis', $dir['Titre'])) {
|
||||
if ($dir['Ancien']==0 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uisu', $dir['Titre'])) {
|
||||
$DIR_NB++;
|
||||
if ($DIR_NB==1) {
|
||||
$DIR1_NOM=preg_replace('/ +/',' ',$dir['Civilite'].' '.$dir['Nom'].' '.$dir['Prenom']);
|
||||
@ -1869,11 +1870,11 @@ AltmanCote=$scoreAltmanB".EOL.print_r($tabInfosNotation,true);
|
||||
break(2);
|
||||
case 15:
|
||||
case 16: // Procédure collective dans l'historique du dirigeant
|
||||
if ($dir['Ancien']==0 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uis', $dir['Titre'])) {
|
||||
if ($dir['Ancien']==0 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uisu', $dir['Titre'])) {
|
||||
$SCORECONF-=20;
|
||||
$SCOREDIRI-=60;
|
||||
if ($noteSolvabilite>45) $noteSolvabilite=45;
|
||||
} elseif ($dir['Ancien']==1 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uis', $dir['Titre'])) {
|
||||
} elseif ($dir['Ancien']==1 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uisu', $dir['Titre'])) {
|
||||
$SCORECONF-=10;
|
||||
$SCOREDIRI-=30;
|
||||
if ($noteSolvabilite>55) $noteSolvabilite=55;
|
||||
@ -1883,11 +1884,11 @@ AltmanCote=$scoreAltmanB".EOL.print_r($tabInfosNotation,true);
|
||||
}
|
||||
break(2);
|
||||
case 19:
|
||||
if ($dir['Ancien']==0 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uis', $dir['Titre'])) {
|
||||
if ($dir['Ancien']==0 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uisu', $dir['Titre'])) {
|
||||
$SCOREDIRI-=50;
|
||||
if ($noteSolvabilite>40) $noteSolvabilite=40;
|
||||
}
|
||||
elseif ($dir['Ancien']==1 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uis', $dir['Titre'])) {
|
||||
elseif ($dir['Ancien']==1 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uisu', $dir['Titre'])) {
|
||||
$SCOREDIRI-=20;
|
||||
if ($noteSolvabilite>52) $noteSolvabilite=52;
|
||||
} else {
|
||||
@ -2479,6 +2480,8 @@ AltmanCote=$scoreAltmanB".EOL.print_r($tabInfosNotation,true);
|
||||
$caTmp=round($CABIOUES,0);
|
||||
$tabTmp=$iDb->select('etablissements_act', 'count(*) AS nb', "/*siren=$siren AND */siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp", true, MYSQL_ASSOC);
|
||||
$MARCHEPLACE=@$tabTmp[0]['nb']*1;
|
||||
$tabTmp=$iDb->select('etablissements_act', 'count(*) AS nb', "/*siren=$siren AND */siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp AND adr_dep='".$tabIdentite['Dept']."'", true, MYSQL_ASSOC);
|
||||
$MARCHEPLACE_DEP=@$tabTmp[0]['nb']*1;
|
||||
$tabTmp=$iDb->select('etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."' AND adr_com=".$tabIdentite['codeCommune'], true, MYSQL_ASSOC);
|
||||
$MARCHENBENT_VILLE=@$tabTmp[0]['nb']*1;
|
||||
$tabTmp=$iDb->select('etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."'", true, MYSQL_ASSOC);
|
||||
@ -2724,6 +2727,7 @@ AltmanCote=$scoreAltmanB".EOL.print_r($tabInfosNotation,true);
|
||||
}
|
||||
// Par département
|
||||
$DEPARTEMENT=$iInsee->getDepartement($tabIdentite['Dept']);
|
||||
$DEPARTEMENT_DE=$iInsee->getDepartement($tabIdentite['Dept'], true);
|
||||
$ret=$iDb->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
|
||||
FROM (
|
||||
SELECT v.id, v.VenteMt
|
||||
|
@ -49,7 +49,11 @@ if (DEBUG) {
|
||||
} else {
|
||||
function debugln($ln = '')
|
||||
{
|
||||
//file_put_contents(LOG_PATH.'/recherchesDebug.log', $ln."\n", FILE_APPEND);
|
||||
/*
|
||||
$fp = fopen(LOG_PATH.'/recherchesDebug.log', 'a');
|
||||
fwrite($fp, $ln.'\n');
|
||||
fclose($fp);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +101,7 @@ function filtreAdresse(&$formR, &$criteres, &$sphinx)
|
||||
if (empty($formR['cpVille']) == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$adressePostale = $formR['cpVille'];
|
||||
//If we have a CEDEX
|
||||
if (preg_match('/^[0-9]{5}\s(.*)\sCEDEX/i', $adressePostale, $codePostaux)) {
|
||||
@ -125,7 +129,7 @@ function filtreAdresse(&$formR, &$criteres, &$sphinx)
|
||||
|
||||
$formR['ville'] = str_replace($codePostaux[0], '', $adressePostale);
|
||||
$dep = intval(substr($codePostaux[0], 0, 2));
|
||||
|
||||
|
||||
//Monaco
|
||||
if ($codePostaux[0] == '98000') {
|
||||
$formR['departement'] = 99;
|
||||
@ -144,14 +148,14 @@ function filtreAdresse(&$formR, &$criteres, &$sphinx)
|
||||
|| preg_match('/([0-9]{3})/', $adressePostale, $departements))
|
||||
{
|
||||
$departement = $departements[1];
|
||||
|
||||
|
||||
if ($departement == '2A'){
|
||||
$departement = 201;
|
||||
}
|
||||
if ($departement == '2B' ) {
|
||||
$departement = 202;
|
||||
}
|
||||
|
||||
|
||||
if (strstr($criteres, 'D') != false) {
|
||||
debugln("filtre adr_dep='$departement'");
|
||||
$sphinx->SetFilter('adr_dep', array($departement));
|
||||
@ -268,7 +272,7 @@ function filtreActif(&$formR, &$criteres, &$sphinx)
|
||||
//Filtre sur les sieges
|
||||
function filtreSiege(&$formR, &$criteres, &$sphinx)
|
||||
{
|
||||
if ( array_key_exists('siege', $formR) && $formR['siege']===true ) {
|
||||
if ( array_key_exists('siege', $formR) && $formR['siege']==1 ) {
|
||||
$sphinx->setFilter('siege', array(1));
|
||||
}
|
||||
}
|
||||
@ -730,16 +734,16 @@ function reponse(&$resSphinx, &$resDB, $criteres, $time, $formR, $form2crit,
|
||||
$pertinence_generale = intval($pertinence_generale);
|
||||
//print 'Pertinence generale: '.$pertinence_generale.'<br/>';
|
||||
}
|
||||
|
||||
|
||||
if ( is_object($resDB) ) {
|
||||
|
||||
|
||||
$resDB->data_seek(0);
|
||||
|
||||
|
||||
for ($i = 0; $i < $resDB->num_rows; $i++) {
|
||||
$ligne = $resDB->fetch_assoc();
|
||||
|
||||
|
||||
//file_put_contents('test.log', "\n".'i = '.$i.print_r($ligne,1), FILE_APPEND);
|
||||
|
||||
|
||||
$ret['reponses'][$i]['id'] = $ligne['id'];
|
||||
$pertinence = $pertinence_generale;
|
||||
if ($formR['type'] == 'ent') {
|
||||
@ -775,7 +779,7 @@ function reponse(&$resSphinx, &$resDB, $criteres, $time, $formR, $form2crit,
|
||||
$ret['reponses'][$i]['Actif'] = $ligne['actif'];
|
||||
$ret['reponses'][$i]['NafEtab'] = $ligne['ape_etab'];
|
||||
$ret['reponses'][$i]['NafEnt'] = $ligne['ape_entrep'];
|
||||
|
||||
|
||||
if ($formR['type']=='dir') {
|
||||
// Dirigeant
|
||||
$ret['reponses'][$i]['DirRs'] = '';
|
||||
@ -797,7 +801,7 @@ function reponse(&$resSphinx, &$resDB, $criteres, $time, $formR, $form2crit,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($formR['type'] == 'ent') {
|
||||
$ret['pass'] = $resSphinx['pass'];
|
||||
}
|
||||
@ -933,17 +937,17 @@ function rechercheDir(&$formR, $deb, $nbRep, $max)
|
||||
$requeteDB .= ")";
|
||||
|
||||
//file_put_contents('test.log', $requeteDB);
|
||||
|
||||
|
||||
debugln();
|
||||
debugln("requeteDB='$requeteDB'");
|
||||
$resDB = $gDatabaseJO->query($requeteDB);
|
||||
|
||||
// Reponse
|
||||
$ligneDir = array();
|
||||
|
||||
|
||||
for ($i = 0; $i < $resDB->num_rows; $i++) {
|
||||
$ligne = $resDB->fetch_assoc();
|
||||
|
||||
|
||||
$nom = $ligne['nom'];
|
||||
if ( $ligne['naissance_nom']!='' ) {
|
||||
$nom.= " nom d'usage ".$ligne['naissance_nom'];
|
||||
@ -958,7 +962,7 @@ function rechercheDir(&$formR, $deb, $nbRep, $max)
|
||||
'naissance_lieu'=> $ligne['naissance_lieu']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
debugln();
|
||||
debugln("requeteDB='$requeteDB'");
|
||||
|
||||
@ -1088,7 +1092,7 @@ function rechercheAct($formR, $deb, $nbRep, $max)
|
||||
|
||||
$req = $gDatabaseJO->query($requette);
|
||||
|
||||
|
||||
|
||||
/*$requette2 ='SELECT id, CONCAT(siren,nic) AS siret, siren, nic, siege, '.
|
||||
'raisonSociale, sigle, enseigne, adr_num, adr_typeVoie, adr_libVoie, '.
|
||||
'adr_comp, adr_cp, adr_ville, tel, fax, cj, actif, ape_etab, '.
|
||||
@ -1224,8 +1228,8 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
$criteres = 'ITSEPDLVNR';
|
||||
}
|
||||
$total_premiere_requete = $resSphinx['total'];
|
||||
|
||||
|
||||
|
||||
|
||||
if ($total_premiere_requete == 0 ||
|
||||
$total_premiere_requete > 500) { // "huit a huit" donne 414
|
||||
$index = 'ent_mns';
|
||||
@ -1278,6 +1282,8 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
}
|
||||
|
||||
while ($pass > 0) {
|
||||
filtreSiege($formR, $criteres, $sphinx);
|
||||
filtreActif($formR, $criteres, $sphinx);
|
||||
// Requete Sphinx
|
||||
$resSphinx = requeteSphinx($sphinx, $index, $formR, $criteres,
|
||||
$criteresSphinx, $form2crit,
|
||||
|
Loading…
Reference in New Issue
Block a user