New WDB
This commit is contained in:
commit
c2c827ceb3
@ -846,7 +846,7 @@ class MInsee
|
||||
$siren=$siren_siret;
|
||||
else
|
||||
return false;
|
||||
$rep=$this->iDb->select('identite', 'CJ', "SIREN='$siren'");
|
||||
$rep=$this->iDb->select('insee.identite', 'CJ', "SIREN='$siren'");
|
||||
return $rep[0][0];
|
||||
}
|
||||
|
||||
@ -1183,12 +1183,12 @@ class MInsee
|
||||
$this->tabCodesNace = include $cacheNace;
|
||||
} else {
|
||||
$tabNafs = $tabNace = array();
|
||||
$tabTmp = $this->iDb->select('tabNaf4', 'codNaf700 AS naf, libNaf700 AS LibNaf', 1, false, MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('jo.tabNaf4', 'codNaf700 AS naf, libNaf700 AS LibNaf', 1, false, MYSQL_ASSOC);
|
||||
foreach ($tabTmp as $i=>$tabNaf) {
|
||||
$tabNafs[$tabNaf['naf']]=$tabNaf['LibNaf'];
|
||||
}
|
||||
|
||||
$tabTmp = $this->iDb->select('tabNaf5', 'codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1', 1, false, MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('jo.tabNaf5', 'codNaf5 AS naf, libNaf5 AS LibNaf, codNaf1', 1, false, MYSQL_ASSOC);
|
||||
foreach ($tabTmp as $i=>$tabNaf) {
|
||||
$tabNafs[$tabNaf['naf']]=$tabNaf['LibNaf'];
|
||||
$tabNace[$tabNaf['naf']]=$tabNaf['codNaf1'].preg_replace('/^0/','',substr($tabNaf['naf'],0,4));
|
||||
@ -1234,7 +1234,7 @@ class MInsee
|
||||
$this->tabCodesNafa = include $cache;
|
||||
} else {
|
||||
$tabNafs=array();
|
||||
$tabTmp=$this->iDb->select( 'tabNafa', 'codNafa AS nafa, libNafa', 1, true, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.tabNafa', 'codNafa AS nafa, libNafa', 1, true, MYSQL_ASSOC);
|
||||
foreach ($tabTmp as $i=>$tabNaf)
|
||||
$tabNafs[$tabNaf['nafa']]=$tabNaf['libNafa'];
|
||||
$this->tabCodesNafa=$tabNafs;
|
||||
@ -1527,7 +1527,7 @@ class MInsee
|
||||
{
|
||||
$fj=$code_forme_juridique*1;
|
||||
if ($fj>0 && $fj<10000) {
|
||||
$tmp=$this->iDb->select('tabFJur', 'libelle AS LibFJ, libelleCourt AS LibCourt', "code=$fj", false, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tabFJur', 'libelle AS LibFJ, libelleCourt AS LibCourt', "code=$fj", false, MYSQL_ASSOC);
|
||||
$libLong =@$tmp[0]['LibFJ'];
|
||||
$libCourt=@$tmp[0]['LibCourt'];
|
||||
if ($court) {
|
||||
@ -1555,7 +1555,7 @@ class MInsee
|
||||
if ( file_exists($cache) ) {
|
||||
$tabFJ = include $cache;
|
||||
} else {
|
||||
$tabTmp=$this->iDb->select('tabFJur', 'code AS FJ, libelle AS libFJ', 'code>=1000', false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.tabFJur', 'code AS FJ, libelle AS libFJ', 'code>=1000', false, MYSQL_ASSOC);
|
||||
foreach ($tabTmp as $i=>$tabCJ)
|
||||
$tabFJ[$tabCJ['FJ']]=str_replace('"','\"',$tabCJ['libFJ']);
|
||||
}
|
||||
@ -1666,7 +1666,7 @@ class MInsee
|
||||
|
||||
$limit="LIMIT $deb, $nbRep";
|
||||
|
||||
$sqlInfo="e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) as siren, LPAD(e.nic, 5, 0) as nic, e.siege, ".
|
||||
$sqlInfo="e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) AS siren, LPAD(e.nic, 5, 0) AS nic, e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab, ".
|
||||
"CONCAT(siren, nic) as siret, e.actif, e.identite_pre, IF(e.siege=2,0.5,e.siege) AS triSiege";
|
||||
@ -1687,29 +1687,29 @@ class MInsee
|
||||
elseif ($dep>9999) $strDep="AND adr_cp BETWEEN $dep AND $dep";
|
||||
else $strDep='AND adr_cp BETWEEN '.$dep.'00 AND '.$dep.'99';
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements e', 'count(*)', "siren=$siren $strDep $strActif $strSiege");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements e', 'count(*)', "siren=$siren $strDep $strActif $strSiege");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
||||
"siren=$siren $strDep $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
}
|
||||
//Search without NIC
|
||||
elseif ($nic=='') {
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements e', 'count(*)', "siren=$siren $strActif $strSiege");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements e', 'count(*)', "siren=$siren $strActif $strSiege");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
||||
"e.siren=$siren $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
}
|
||||
//Search with NIC
|
||||
else {
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements e', 'count(*)', "siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements e', 'count(*)', "siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
||||
"siren=$siren AND (nic=$nic OR siege=1) $strActif $strSiege ORDER BY triSiege DESC, e.actif DESC, e.nic DESC $limit", false, MYSQL_ASSOC);
|
||||
|
||||
}
|
||||
@ -1730,9 +1730,9 @@ class MInsee
|
||||
}
|
||||
}
|
||||
$strSiren=implode(',',$listeSiren);
|
||||
$tabTmp=$this->iDb->select('etablissements', 'count(*)', "siren IN ($strSiren) AND siege=1");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements', 'count(*)', "siren IN ($strSiren) AND siege=1");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
$listeEtab=$this->iDb->select('etablissements e', $sqlInfo,
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e', $sqlInfo,
|
||||
"siren IN ($strSiren) AND siege=1 ORDER BY e.rang DESC, e.actif DESC, e.nic ASC $limit", true, MYSQL_ASSOC);
|
||||
$strInfo='Siren saisi invalide';
|
||||
}
|
||||
@ -1755,7 +1755,7 @@ class MInsee
|
||||
|
||||
$pays = 'France';
|
||||
if ( $etab['adr_dep']==99 ) {
|
||||
$resultPays = $this->iDb->select("tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$resultPays = $this->iDb->select("jo.tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
if ( count($resultPays)>0 ) {
|
||||
$pays = $resultPays[0]['libPays'];
|
||||
}
|
||||
@ -1833,11 +1833,11 @@ class MInsee
|
||||
if ($typeId=='TEL') {
|
||||
debugLog('I',"Recherche par TEL de $id avec un maximum de $nbRep réponses",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
$tabTmp=$this->iDb->select('etablissements', 'count(*)', "TEL=$id OR FAX=$id $filtreActif");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements', 'count(*)', "TEL=$id OR FAX=$id $filtreActif");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) as siren, LPAD(e.nic, 5, 0), e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) AS siren, LPAD(e.nic, 5, 0) AS nic, e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep,".
|
||||
"CONCAT(e.siren, e.nic) as siret, e.actif",
|
||||
"TEL=$id OR FAX=$id $filtreActif ORDER BY e.siege DESC, e.actif DESC $limit", false, MYSQL_ASSOC);
|
||||
@ -1867,11 +1867,11 @@ class MInsee
|
||||
elseif ($dep>9999) $strDep="AND adr_cp BETWEEN $dep AND $dep";
|
||||
else $strDep='AND adr_cp BETWEEN '.$dep.'00 AND '.$dep.'99';
|
||||
}
|
||||
$tabTmp=$this->iDb->select('etablissements', 'count(*)', "autre_id IN ('$strId') $filtreActif $strDep");
|
||||
$tabTmp=$this->iDb->select('jo.etablissements', 'count(*)', "autre_id IN ('$strId') $filtreActif $strDep");
|
||||
$nbTot=$tabTmp[0][0];
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
"'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, ".
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e',
|
||||
"'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) AS siren, LPAD(e.nic, 5, 0) AS nic, e.siege, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab, ".
|
||||
"CONCAT(e.siren, e.nic) as siret, e.actif",
|
||||
"autre_id IN ('$strId') $filtreActif $strDep ORDER BY siege DESC $limit", false, MYSQL_ASSOC);
|
||||
@ -1881,7 +1881,7 @@ class MInsee
|
||||
{
|
||||
$pays = 'France';
|
||||
if ( $etab['adr_dep']==99 ) {
|
||||
$resultPays = $this->iDb->select("tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$resultPays = $this->iDb->select("jo.tabPays", "libPays", "codePaysInsee = ".$etab['adr_com'], false, MYSQL_ASSOC);
|
||||
$pays = $resultPays[0]['libPays'];
|
||||
}
|
||||
|
||||
@ -1934,7 +1934,7 @@ class MInsee
|
||||
function sirenExiste($siren)
|
||||
{
|
||||
$siren=$siren*1;
|
||||
$listeEtab=$this->iDb->select('etablissements', 'id', "siren=$siren LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$listeEtab=$this->iDb->select('jo.etablissements', 'id', "siren=$siren LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
if (@count($listeEtab)>0)
|
||||
return true;
|
||||
return false;
|
||||
@ -1959,7 +1959,7 @@ class MInsee
|
||||
|
||||
$tabRet = array();
|
||||
|
||||
$listeEtab=$this->iDb->select('etablissements e',
|
||||
$listeEtab=$this->iDb->select('jo.etablissements e',
|
||||
"e.id, e.source, e.source_id, e.autre_id, LPAD(e.siren, 9, 0) as siren, LPAD(e.nic, 5, 0), e.siege, e.autre_id, e.triCode, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, e.adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, ".
|
||||
@ -2036,7 +2036,7 @@ class MInsee
|
||||
{
|
||||
if (trim($codeIso)<>'') $strWhere="devIso='$codeIso'";
|
||||
else $strWhere='1';
|
||||
$liste=$this->iDb->select('tabDevises', 'devIso, devNom', $strWhere, false, MYSQL_ASSOC);
|
||||
$liste=$this->iDb->select('jo.tabDevises', 'devIso, devNom', $strWhere, false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
foreach ($liste as $ligne)
|
||||
$tabRet[$ligne['devIso']]=$ligne['devNom'];
|
||||
@ -2065,7 +2065,7 @@ class MInsee
|
||||
else
|
||||
$fields="id, CONCAT(Nom,' ',Prenom,' ',adresse,' ',adresseComp,' ',cp,' ',ville) as Mand";
|
||||
|
||||
$liste=$this->iDb->select('tabMandataires', $fields, "1 $strIdCA $strType ORDER BY sirenGrp", true, MYSQL_ASSOC);
|
||||
$liste=$this->iDb->select('jo.tabMandataires', $fields, "1 $strIdCA $strType ORDER BY sirenGrp", true, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
if (!$condense) foreach ($liste as $ligne) $tabRet[]=$ligne;
|
||||
else foreach ($liste as $ligne) $tabRet[$ligne['id']]=preg_replace('/ +/',' ',$ligne['Mand']);
|
||||
@ -2098,7 +2098,7 @@ class MInsee
|
||||
else
|
||||
$fields="id, CONCAT(Nom,' ',Prenom,' ',adresse,' ',adresseComp,' ',cp,' ',ville) as Mand";
|
||||
|
||||
$liste=$this->iDb->select('tabMandataires', $fields, "1 $strIdCA $strType $strCp ORDER BY sirenGrp", false, MYSQL_ASSOC);
|
||||
$liste=$this->iDb->select('jo.tabMandataires', $fields, "1 $strIdCA $strType $strCp ORDER BY sirenGrp", false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
if (!$condense) foreach ($liste as $ligne) $tabRet[]=$ligne;
|
||||
else foreach ($liste as $ligne) $tabRet[$ligne['id']]=preg_replace('/ +/',' ',$ligne['Mand']);
|
||||
@ -2114,7 +2114,7 @@ class MInsee
|
||||
public function getMandataire($idMand)
|
||||
{
|
||||
$fields='id,sirenGrp,sirenMand,Nom,Prenom,type,coursAppel,coursAppel2,tribunal,Statut,stagiaire,adresse,adresseComp,cp,ville,tel,fax,email,web,contact';
|
||||
$liste=$this->iDb->select('tabMandataires', $fields, "id=$idMand", true, MYSQL_ASSOC);
|
||||
$liste=$this->iDb->select('jo.tabMandataires', $fields, "id=$idMand", true, MYSQL_ASSOC);
|
||||
return @$liste[0];
|
||||
}
|
||||
|
||||
@ -2129,7 +2129,7 @@ class MInsee
|
||||
else
|
||||
$fields="id, CONCAT(Nom,' ',Prenom,' ',adresse,' ',adresseComp,' ',cp,' ',ville) as Mand";
|
||||
|
||||
$liste=$this->iDb->select('tabMandataires', $fields, "1 AND type='H' $strIdCA ORDER BY sirenGrp", false, MYSQL_ASSOC);
|
||||
$liste=$this->iDb->select('jo.tabMandataires', $fields, "1 AND type='H' $strIdCA ORDER BY sirenGrp", false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
if (!$condense) foreach ($liste as $ligne) $tabRet[]=$ligne;
|
||||
else foreach ($liste as $ligne) $tabRet[$ligne['id']]=preg_replace('/ +/',' ',$ligne['Mand']);
|
||||
@ -2144,7 +2144,7 @@ class MInsee
|
||||
**/
|
||||
public function getMandatairesParId($idMand) {
|
||||
if ($idMand>0) {
|
||||
$liste=$this->iDb->select('tabMandataires', "CONCAT(Nom,' ',Prenom,' ',adresse,' ',adresseComp,' ',cp,' ',ville) as Mand", "id=$idMand", false);
|
||||
$liste=$this->iDb->select('jo.tabMandataires', "CONCAT(Nom,' ',Prenom,' ',adresse,' ',adresseComp,' ',cp,' ',ville) as Mand", "id=$idMand", false);
|
||||
return $liste[0][0];
|
||||
}
|
||||
return '';
|
||||
@ -2208,7 +2208,7 @@ class MInsee
|
||||
if ($id>0 && $siren<1000) $where=" id=$id ";
|
||||
elseif ($nic<>0) $where=" siren=$siren AND nic=$nic ";
|
||||
elseif ($siren<>0) $where=" siren=$siren ";//AND siege=1 ";
|
||||
$listeEtab = $this->iDb->select('etablissements e',
|
||||
$listeEtab = $this->iDb->select('jo.etablissements e',
|
||||
"e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren,9,0) as siren, LPAD(e.nic,5,0) as nic, e.siege, e.autre_id, ".
|
||||
"e.raisonSociale, e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
|
||||
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, ".
|
||||
@ -2267,21 +2267,21 @@ class MInsee
|
||||
/** Informations locales issues de la table infos_entrep **/
|
||||
if ($siren>100) {
|
||||
$info = $this->iDb->select(
|
||||
'infos_entrep',
|
||||
'jo.infos_entrep',
|
||||
"raisonSociale, isin, nscrl, tel, fax, web, mail, latitude, longitude, precis, dateCreation, dateFermeture, naf, naf_lib, ca, effectif, nbEtab, activite, LPAD(sirenDoublon,9,'0') AS sirenDoublon, waldec",
|
||||
"siren=$siren", false, MYSQL_ASSOC);
|
||||
if ( count($info)>0 ) {
|
||||
$tab=$info[0];
|
||||
$waldec = $tab['waldec'];
|
||||
if ( !array_key_exists('sirenDoublon', $tab) ) {
|
||||
$info = $this->iDb->select('infos_entrep', 'siren AS sirenDoublon', "sirenDoublon=$siren", false, MYSQL_ASSOC);
|
||||
$info = $this->iDb->select('jo.infos_entrep', 'siren AS sirenDoublon', "sirenDoublon=$siren", false, MYSQL_ASSOC);
|
||||
if ( count($info)>0 ) {
|
||||
$tab['sirenDoublon']=$info[0]['sirenDoublon'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$insee=$this->iDb->select('etablissements', 'CONCAT(SIREN,NIC) AS siret', "SIREN=$siren AND SIEGE=1 ORDER BY ACTIF%10 DESC, NIC DESC",false,MYSQL_ASSOC);
|
||||
$insee=$this->iDb->select('jo.etablissements', 'CONCAT(SIREN,NIC) AS siret', "SIREN=$siren AND SIEGE=1 ORDER BY ACTIF%10 DESC, NIC DESC",false,MYSQL_ASSOC);
|
||||
if ( count($insee)>0 ) {
|
||||
$siretSiege = $insee[0]['siret'];
|
||||
}
|
||||
@ -2340,7 +2340,7 @@ class MInsee
|
||||
);
|
||||
}
|
||||
|
||||
$tabTmp = $this->iDb->select('etablissements', 'count(*) AS nbEtabs', "siren=$siren AND NIC<100000 AND ACTIF%10=1",false,MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('jo.etablissements', 'count(*) AS nbEtabs', "siren=$siren AND NIC<100000 AND ACTIF%10=1",false,MYSQL_ASSOC);
|
||||
$nbEtab = 0;
|
||||
if ( count($tabTmp)>0 ) {
|
||||
$nbEtab = $tabTmp[0]['nbEtabs'];
|
||||
@ -2837,7 +2837,7 @@ class MInsee
|
||||
);
|
||||
if (in_array($tabInsee['APE_ENT'], $tabNafTourisme) ||
|
||||
in_array($tabInsee['APE_ETAB'], $tabNafTourisme) ) {
|
||||
$ret=$this->iDb->select('tourisme', 'id, nom, adresse, adrCp, adrVille, nbEtoiles, typeClasse, categorie, dateClasse, tel, fax, mail, web, typeChambres, capacite', "siren=$siren AND nic=$nic", false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('jo.tourisme', 'id, nom, adresse, adrCp, adrVille, nbEtoiles, typeClasse, categorie, dateClasse, tel, fax, mail, web, typeChambres, capacite', "siren=$siren AND nic=$nic", false, MYSQL_ASSOC);
|
||||
if (isset($ret[0])) {
|
||||
$tabRet['NafEtabLib'].=' ('.$ret[0]['nbEtoiles'].' étoiles le '.
|
||||
$classWDate->dateT('Y-m-d','d/m/Y',$ret[0]['dateClasse']).')';
|
||||
@ -2959,7 +2959,7 @@ class MInsee
|
||||
$tabRet['SituationJuridique']='P';
|
||||
}
|
||||
//file_put_contents('test.log', $this->dureePlan."-".$this->finPlan." Situtation Juridique : ".$tabRet['SituationJuridique']);
|
||||
$tabTmp = $this->iDb->select('scores_cutoff', 'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$tabTmp = $this->iDb->select('jo.scores_cutoff', 'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
if( count($tabTmp) > 0 ) {
|
||||
if ($tabTmp[0]['scoreSolv']>0) {
|
||||
//Tri des dates de procol
|
||||
@ -3042,7 +3042,7 @@ class MInsee
|
||||
if ($siren>100) {
|
||||
if ($tabRet['CapitalSrc']<>5) {
|
||||
/** Recherche du n° RC, de la Forme Juridique et du Capital au Bodacc **/
|
||||
$bodacc=$this->iDb->select( 'bodacc_detail', 'Capital, CapitalDev',
|
||||
$bodacc=$this->iDb->select( 'jo.bodacc_detail', 'Capital, CapitalDev',
|
||||
"siren=$siren AND capital<>0 $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$annCap=@$bodacc[0];
|
||||
if ($tabRet['Capital']==0 || $tabRet['CapitalDev']=='' || $tabRet['Capital']<>$annCap['Capital']*1) {
|
||||
@ -3082,7 +3082,7 @@ class MInsee
|
||||
}
|
||||
if ($tabRet['CapitalDev']<>'' && $tabRet['CapitalDev']<>'EUR') {
|
||||
$dev=$tabRet['CapitalDev'];
|
||||
$devise=$this->iDb->select('sdv1.devise_liste l, devise_cours c', 'c.devise, c.valeur, c.date, l.devNom, l.devNomPays, l.devPaysIso', "c.devise='$dev' and l.devIso='$dev' ORDER BY c.date DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$devise=$this->iDb->select('sdv1.devise_liste l, sdv1.devise_cours c', 'c.devise, c.valeur, c.date, l.devNom, l.devNomPays, l.devPaysIso', "c.devise='$dev' and l.devIso='$dev' ORDER BY c.date DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$dev=@$devise[0];
|
||||
//die(print_r($dev));
|
||||
$devise=$tabRet['Capital']*$dev['valeur']*1;
|
||||
@ -3092,19 +3092,19 @@ class MInsee
|
||||
|
||||
/** Recherche du code Tribunal du siège **/
|
||||
if ($tabRet['CapitalSrc']<>5) {
|
||||
$bodacc=$this->iDb->select( 'bodacc_detail', 'RC, FJ, Tribunal_Code',
|
||||
$bodacc=$this->iDb->select( 'jo.bodacc_detail', 'RC, FJ, Tribunal_Code',
|
||||
"siren=$siren AND RC<>'' $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
if ($tabRet['AutreId']=='') $tabRet['AutreId']=@$bodacc[0]['RC'];
|
||||
if ($tabRet['Tribunal']=='') $tabRet['Tribunal']=@$bodacc[0]['Tribunal_Code'];
|
||||
}
|
||||
|
||||
if ($tabRet['FJ_lib']=='') {
|
||||
$bodacc=$this->iDb->select( 'bodacc_detail', 'FJ',
|
||||
$bodacc=$this->iDb->select( 'jo.bodacc_detail', 'FJ',
|
||||
"siren=$siren AND FJ<>'' $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tabRet['FJ_lib']=@$bodacc[0]['FJ'];
|
||||
}
|
||||
/** Recherche de l'activité réelle **/
|
||||
$bodacc=$this->iDb->select( 'bodacc_detail', 'Activite', "siren=$siren AND Activite<>'' AND Activite NOT LIKE 'non precis%' $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'jo.bodacc_detail', 'Activite', "siren=$siren AND Activite<>'' AND Activite NOT LIKE 'non precis%' $strEvenVtLg ORDER BY Bodacc_Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$annCap=$bodacc[0];
|
||||
if ($tabInsee['CJ']<7000 || $tabInsee['CJ']>7999)
|
||||
$tabRet['Activite']=trim(/*preg_replace("/Adjonction.{1,7}activit(?:e|é)(?:.|)\:", '', */$annCap['Activite']);//);
|
||||
@ -3116,7 +3116,7 @@ class MInsee
|
||||
$siretMin=(''.$siren.'00000')*1;
|
||||
$siretMax=(''.$siren.'99999')*1;
|
||||
//$bodacc=$this->iDb->select( 'asso', 'Assoc_Web, Assoc_Mail, Assoc_Objet, Assoc_NObjet', "Siret BETWEEN $siretMin AND $siretMax AND (Assoc_Objet<>'' OR Assoc_NObjet<>'') ORDER BY Date_Parution DESC LIMIT 0,1", true, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'asso', 'Assoc_Web, Assoc_Mail, Assoc_Objet, Assoc_NObjet, Assoc_Nom, typeAsso, Waldec', "siren=$siren AND dateSuppr=0 AND (Assoc_Objet<>'' OR Assoc_NObjet<>'') ORDER BY Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'jo.asso', 'Assoc_Web, Assoc_Mail, Assoc_Objet, Assoc_NObjet, Assoc_Nom, typeAsso, Waldec', "siren=$siren AND dateSuppr=0 AND (Assoc_Objet<>'' OR Assoc_NObjet<>'') ORDER BY Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$annCap=@$bodacc[0];
|
||||
$tabRet['Activite'] = trim($annCap['Assoc_NObjet']);
|
||||
if (trim($tabRet['AutreId'])=='')
|
||||
@ -3165,11 +3165,11 @@ class MInsee
|
||||
}
|
||||
$timer['activiteReelle']=microtime(true);
|
||||
|
||||
$bodacc=$this->iDb->select('rncs_dirigeants',
|
||||
$bodacc=$this->iDb->select('jo.rncs_dirigeants',
|
||||
"nom, prenom, naissance_nom, civilite, fonction_code as code, fonction_lib as libelle, naissance_date AS dateNaiss, naissance_lieu AS lieuNaiss, dirRS as rs, '' as dateEffet",
|
||||
"siren=$siren AND actif%10=1 AND fonction_lib NOT LIKE '%Administrateur%' ORDER BY actif DESC, fonction_lib DESC", false, MYSQL_ASSOC);
|
||||
if (count($bodacc)==0)
|
||||
$bodacc=$this->iDb->select('rncs_dirigeants',
|
||||
$bodacc=$this->iDb->select('jo.rncs_dirigeants',
|
||||
"nom, prenom, naissance_nom, civilite, fonction_code as code, fonction_lib as libelle, naissance_date AS dateNaiss, naissance_lieu AS lieuNaiss, dirRS as rs, '' as dateEffet",
|
||||
"siren=$siren AND actif%10=0 AND fonction_lib NOT LIKE '%Administrateur%' ORDER BY actif DESC, fonction_lib DESC", false, MYSQL_ASSOC);
|
||||
|
||||
@ -3216,7 +3216,7 @@ class MInsee
|
||||
}
|
||||
}
|
||||
else {
|
||||
$bodacc=$this->iDb->select('bodacc_dirigeants d, bodacc_detail b, bodacc_fonctions f',
|
||||
$bodacc=$this->iDb->select('jo.bodacc_dirigeants d, jo.bodacc_detail b, jo.bodacc_fonctions f',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
"b.SIREN=$siren AND b.id=d.id AND b.typeEven NOT BETWEEN 5000 AND 5700 AND b.typeEven NOT BETWEEN 2700 AND 2900 AND d.fonction=f.codeFct AND d.depart<>1 AND f.triCode IN ('ASS','COG','DID','DIR','GER','PCS','PDG','PRD','PRE','PRT','VIC') GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateEffet DESC", false, MYSQL_ASSOC);
|
||||
//$annCap=@$bodacc[0];
|
||||
@ -3245,7 +3245,7 @@ class MInsee
|
||||
$siretMin=(''.$siren.'00000')*1;
|
||||
$siretMax=(''.$siren.'99999')*1;
|
||||
//$bodacc=$this->iDb->select( 'asso', 'Assoc_Web, Assoc_Mail', "Siret BETWEEN $siretMin AND $siretMax AND (Assoc_Web<>'' OR Assoc_Mail<>'') ORDER BY Date_Parution DESC LIMIT 0,1", true, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'asso', 'Assoc_Web, Assoc_Mail', "siren=$siren AND dateSuppr=0 AND (Assoc_Web<>'' OR Assoc_Mail<>'') ORDER BY Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'jo.asso', 'Assoc_Web, Assoc_Mail', "siren=$siren AND dateSuppr=0 AND (Assoc_Web<>'' OR Assoc_Mail<>'') ORDER BY Date_Parution DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$annCap=@$bodacc[0];
|
||||
if ($tabRet['Web']=='') $tabRet['Web']=trim($annCap['Assoc_Web']);
|
||||
if ($tabRet['Mail']=='') $tabRet['Mail']=trim($annCap['Assoc_Mail']);
|
||||
@ -3254,7 +3254,7 @@ class MInsee
|
||||
} else {
|
||||
if ($etab['source']==3) {
|
||||
$id=$etab['source_id'];
|
||||
$bodacc=$this->iDb->select( 'asso', 'Activite, Sous_Prefecture, Assoc_Web, Assoc_Mail, Assoc_Objet, Assoc_Fusion, Assoc_Date_Declaration2', "id=$id AND dateSuppr=0", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select( 'jo.asso', 'Activite, Sous_Prefecture, Assoc_Web, Assoc_Mail, Assoc_Objet, Assoc_Fusion, Assoc_Date_Declaration2', "id=$id AND dateSuppr=0", false, MYSQL_ASSOC);
|
||||
$annCap=@$bodacc[0];
|
||||
$tabRet['Activite'] = $annCap['Assoc_Objet'];
|
||||
$tabRet['Web'] = $annCap['Assoc_Web'];
|
||||
@ -3312,7 +3312,7 @@ class MInsee
|
||||
if ($tabRet['Siege']==1 && $tabRet['Actif'] && $tabRet['Tribunal']=='')
|
||||
$tabRet['Tribunal']=$tabCodeTri;
|
||||
|
||||
$rep = $this->iDb->select('rncs_entrep', 'siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, dateRad*1 AS dateRadNum, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$rep = $this->iDb->select('jo.rncs_entrep', 'siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, dateRad*1 AS dateRadNum, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$entrep=$rep[0];
|
||||
if (isset($entrep['numGreffe'])) { //ETRANGER//
|
||||
$tabRet['numGreffe'] = $entrep['numGreffe'];
|
||||
@ -3371,7 +3371,7 @@ class MInsee
|
||||
|
||||
/** Spécificité EIRL **/
|
||||
if ($fjInpi==1000) {
|
||||
$rep=$this->iDb->select('rncs_eirl',
|
||||
$rep=$this->iDb->select('jo.rncs_eirl',
|
||||
'denomination, activite',
|
||||
"siren=$siren", false, MYSQL_ASSOC);
|
||||
$entrep=$rep[0];
|
||||
@ -3379,7 +3379,7 @@ class MInsee
|
||||
}
|
||||
|
||||
/** Informations sur l'établissement au RNCS **/
|
||||
$rep=$this->iDb->select('rncs_etab',
|
||||
$rep=$this->iDb->select('jo.rncs_etab',
|
||||
'id, siege, actif, enseigne, nomCommercial,
|
||||
adrNumVoie, adrIndRep, adrLibVoie, adrTypeVoie, adrVoie,
|
||||
cp, commune, adrComp, adresse1, adresse2, adresse3,
|
||||
@ -3416,7 +3416,7 @@ class MInsee
|
||||
/**
|
||||
** Recherche au RM
|
||||
**/
|
||||
$rep=$this->iDb->select('artisanat', 'siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nom,prenom,nomUsage,dateNaiss,lieuNaiss,qualite,qualif,dateQualif,dateFctDeb,dateFctFin,DATE(dateUpdate) AS jourUpdate, DATE(dateInsert) AS dateInsert', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.artisanat', 'siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nom,prenom,nomUsage,dateNaiss,lieuNaiss,qualite,qualif,dateQualif,dateFctDeb,dateFctFin,DATE(dateUpdate) AS jourUpdate, DATE(dateInsert) AS dateInsert', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$entrep=$rep[0];
|
||||
if (isset($entrep['numRM'])) {
|
||||
$tabRet['AutreId'] = $entrep['numRM'];
|
||||
@ -3579,7 +3579,7 @@ class MInsee
|
||||
/**
|
||||
* 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", true, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.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);
|
||||
if ( count($rep)>0 ) {
|
||||
$entrep=$rep[0];
|
||||
$tabRet['bilanAnnee'] = substr($entrep['dateExercice'],0,4);
|
||||
@ -3765,7 +3765,7 @@ class MInsee
|
||||
if ($histo)
|
||||
{
|
||||
$bodacc=$this->iDb->select(
|
||||
'bodacc_dirigeants d, bodacc_detail b, bodacc_fonctions f',
|
||||
'jo.bodacc_dirigeants d, jo.bodacc_detail b, jo.bodacc_fonctions f',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.dirSiren, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
"b.SIREN=$siren AND b.id=d.id AND b.typeEven NOT BETWEEN 5000 AND 5700 AND b.typeEven NOT BETWEEN 2700 AND 2900 AND d.fonction=f.codeFct GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateInsert DESC, d.dateEffet DESC, d.fonction DESC", true, MYSQL_ASSOC);
|
||||
if (count($bodacc)>0) {
|
||||
@ -3832,18 +3832,18 @@ class MInsee
|
||||
'Ancien' => $tabDir['depart'],
|
||||
'DateFct' => $classWDate->dateT('Ymd','Y-m-d', $ann['DATE']),
|
||||
);
|
||||
$this->iDb->insert('bodacc_dirigeants_histo', array(
|
||||
'siren' => $siren,
|
||||
'id' => $ann['ANBASE'],
|
||||
'num' => $iDir,
|
||||
'dateEffet' => $classWDate->dateT('Ymd','Y-m-d', $ann['DATE']),
|
||||
'fonction' => $tabDir['fonction'],
|
||||
'rs' => $tabDir['rs'],
|
||||
'nom' => $nom,
|
||||
'prenom' => $tabDir['prenom'],
|
||||
'nomUsage' => $tabDir['nomUsage'],
|
||||
'depart' => $tabDir['depart'],
|
||||
), true);
|
||||
$this->iDb->insert('jo.bodacc_dirigeants_histo', array(
|
||||
'siren' => $siren,
|
||||
'id' => $ann['ANBASE'],
|
||||
'num' => $iDir,
|
||||
'dateEffet' => $classWDate->dateT('Ymd','Y-m-d', $ann['DATE']),
|
||||
'fonction' => $tabDir['fonction'],
|
||||
'rs' => $tabDir['rs'],
|
||||
'nom' => $nom,
|
||||
'prenom' => $tabDir['prenom'],
|
||||
'nomUsage' => $tabDir['nomUsage'],
|
||||
'depart' => $tabDir['depart'],
|
||||
), true);
|
||||
|
||||
$iDir++;
|
||||
}
|
||||
@ -3857,9 +3857,9 @@ class MInsee
|
||||
if (!$histo || ($histo && count($tabRet)==0) )
|
||||
{
|
||||
$dirs=$this->iDb->select(
|
||||
'rncs_dirigeants/* d, bodacc_fonctions f*/',
|
||||
'siren, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert/*f.libelle*/',
|
||||
"siren=$siren /*AND d.fonction_code=f.codeFct*/ AND actif%10=1", false, MYSQL_ASSOC);
|
||||
'jo.rncs_dirigeants',
|
||||
'siren, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert',
|
||||
"siren=$siren AND actif%10=1", false, MYSQL_ASSOC);
|
||||
|
||||
foreach ($dirs as $k=>$dir) {
|
||||
if ($dir['naissance_date']<>'0000-00-00') {
|
||||
@ -3902,7 +3902,7 @@ class MInsee
|
||||
/** Recherche de CAC si liste des dirigeants actifs **/
|
||||
if (!$histo) {
|
||||
$bodacc=$this->iDb->select(
|
||||
'bodacc_dirigeants d, bodacc_detail b, bodacc_fonctions f',
|
||||
'jo.bodacc_dirigeants d, jo.bodacc_detail b, jo.bodacc_fonctions f',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.dirSiren, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
"b.SIREN=$siren AND b.id=d.id AND b.typeEven NOT BETWEEN 5000 AND 5700 AND b.typeEven NOT BETWEEN 2700 AND 2900 AND d.fonction=f.codeFct AND d.fonction BETWEEN 300 AND 304 GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateEffet DESC, d.fonction DESC", false, MYSQL_ASSOC);
|
||||
if (count($bodacc)>0) {
|
||||
@ -3941,9 +3941,9 @@ class MInsee
|
||||
/** Si on ne trouve absolument rien, on regarde quand même dans l'histroique RNCS **/
|
||||
if (count($tabRet)==0) {
|
||||
$dirs=$this->iDb->select(
|
||||
'rncs_dirigeants/* d, bodacc_fonctions f*/',
|
||||
'siren, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert, /*f.libelle*/ date(dateUpdate)*1 as dateUpdate',
|
||||
"siren=$siren /*AND d.fonction_code=f.codeFct*/ AND actif%10=0 ORDER BY dateUpdate DESC", false, MYSQL_ASSOC);
|
||||
'jo.rncs_dirigeants',
|
||||
'siren, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert, date(dateUpdate)*1 as dateUpdate',
|
||||
"siren=$siren AND actif%10=0 ORDER BY dateUpdate DESC", false, MYSQL_ASSOC);
|
||||
|
||||
$dateUpdatePre=$dirs[0]['dateUpdate'];
|
||||
foreach ($dirs as $k=>$dir) {
|
||||
@ -4009,7 +4009,7 @@ class MInsee
|
||||
'Ancien' =>0,
|
||||
'DateFct' =>$tabIdentite['DateCrea'],//$tabIdentite['DateImma'],
|
||||
);
|
||||
$this->iDb->insert('rncs_dirigeants', array(
|
||||
$this->iDb->insert('jo.rncs_dirigeants', array(
|
||||
'siren' => $siren,
|
||||
'raisonSociale' => $etab['Nom'],
|
||||
'civilite' => $civilite,
|
||||
@ -4187,7 +4187,7 @@ class MInsee
|
||||
|| $this->AnnoncesInMemory === false ) {
|
||||
|
||||
$bodacc = $this->iDb->select(
|
||||
'bodacc_detail d, bodacc b, tribunaux t',//.codEven Code évènement du mouvement Bodacc libEven ',
|
||||
'jo.bodacc_detail d, jo.bodacc b, jo.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);
|
||||
|
||||
@ -4421,7 +4421,7 @@ class MInsee
|
||||
reset($tabJugements);
|
||||
|
||||
$tabNoProcol=array();
|
||||
$tmp=$this->iDb->select('tabEvenements', 'codEven,affProcol', 'affProcol>0', false, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tabEvenements', 'codEven,affProcol', 'affProcol>0', false, MYSQL_ASSOC);
|
||||
foreach ($tmp as $tmp2)
|
||||
$tabNoProcol[$tmp2['codEven']]=$tmp2['affProcol'];
|
||||
|
||||
@ -4814,7 +4814,7 @@ class MInsee
|
||||
|
||||
$mBalo=new MBalo();
|
||||
|
||||
$bodacc=$this->iDb->select('balo', "Societe_Rcs, Categorie, Num_Affaire, Date_Parution, Num_Parution, Url_Annonce_Html, Url_Annonce_Pdf, Annonce_Html, dateInsert", "Societe_Rcs='$siren' AND Date_Parution>='2004-01-01' $strIdAnn ORDER BY Date_Parution DESC, Num_Affaire LIMIT $offset, $lignes", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select('jo.balo', "Societe_Rcs, Categorie, Num_Affaire, Date_Parution, Num_Parution, Url_Annonce_Html, Url_Annonce_Pdf, Annonce_Html, dateInsert", "Societe_Rcs='$siren' AND Date_Parution>='2004-01-01' $strIdAnn ORDER BY Date_Parution DESC, Num_Affaire LIMIT $offset, $lignes", false, MYSQL_ASSOC);
|
||||
// $RP=mysql_select('balo', " ", "Societe_Rcs='$rcs' ");
|
||||
$k=0;
|
||||
if (count($bodacc)>0) {
|
||||
@ -4851,7 +4851,7 @@ class MInsee
|
||||
*/
|
||||
function getAnnoncesBaloCount($siren)
|
||||
{
|
||||
$bodacc = $this->iDb->select('balo', "count(*) AS nb", "Societe_Rcs='$siren' AND Date_Parution>='2004-01-01' ORDER BY Date_Parution DESC, Num_Affaire", false, MYSQL_ASSOC);
|
||||
$bodacc = $this->iDb->select('jo.balo', "count(*) AS nb", "Societe_Rcs='$siren' AND Date_Parution>='2004-01-01' ORDER BY Date_Parution DESC, Num_Affaire", false, MYSQL_ASSOC);
|
||||
$nb = 0;
|
||||
if (count($bodacc)>0) {
|
||||
$nb = $bodacc[0]['nb'];
|
||||
@ -4894,7 +4894,7 @@ class MInsee
|
||||
}
|
||||
|
||||
$bodacc = $this->iDb->select(
|
||||
'boamp_lots l, boamp b, boamp_detail d',
|
||||
'jo.boamp_lots l, jo.boamp b, jo.boamp_detail d',
|
||||
"l.id, l.idAnn, l.Boamp_Code, l.Boamp_Rubrique, b.Boamp_Rubrique_Lib, b.typeAnnonce, l.Boamp_Date_Parution, b.Boamp_Num, b.Boamp_Annee_Parution, b.Num_AnnoncePre, b.Num_Annonce, b.Boamp_Dept, b.annonce, l.num, l.`desc` AS description, l.nom, d.raisonSociale, l.montantTxt, sum(l.montant) AS montant, l.montantAnMin, l.montantAnMax, l.trancheCond, l.trancheFerme, l.dateAttrib, l.intitule, l.nomenclature, l.objets, l.cpv, l.cpvComp, l.volume, l.execution, l.livraison, l.dureeJours, l.dureeMois, l.dateDeb, l.dateFin, l.dateInsert, d.titre, d.objet, d.titreMarche, d.typeObjetMarche, d.objetAutre, d.autres",
|
||||
"l.siren='$siren' AND l.idAnn=b.id AND l.idAnn=d.id $strIdAnn GROUP BY b.id ORDER BY l.Boamp_Date_Parution DESC LIMIT $offset,$lignes", false, MYSQL_ASSOC
|
||||
);
|
||||
@ -5081,17 +5081,15 @@ class MInsee
|
||||
|
||||
/** Recherche dans les avis d'attribution **/
|
||||
$bodaccA=$this->iDb->select(
|
||||
'boamp_lots l, boamp b, boamp_detail d',
|
||||
'jo.boamp_lots l, jo.boamp b, jo.boamp_detail d',
|
||||
"l.id",
|
||||
"l.siren='$siren' AND l.idAnn=b.id AND l.idAnn=d.id GROUP BY b.id ORDER BY l.Boamp_Date_Parution",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
}
|
||||
if ( $type=='' || $type=='M') {
|
||||
|
||||
/** Recherche dans les avis de marchés **/
|
||||
$bodaccM=$this->iDb->select( 'boamp b, boamp_detail d',
|
||||
"d.id",
|
||||
$bodaccM = $this->iDb->select( 'jo.boamp b, jo.boamp_detail d', "d.id",
|
||||
"d.siren='$siren' AND d.id=b.id GROUP BY b.id ORDER BY d.Boamp_Date_Parution DESC",
|
||||
false, MYSQL_ASSOC
|
||||
);
|
||||
@ -5120,7 +5118,7 @@ class MInsee
|
||||
|
||||
$classWDate = new WDate();
|
||||
|
||||
$bodacc=$this->iDb->select('asso', "id, Assoc_Nom, siren, nic, Waldec, Activite, Num_Annonce, Date_Parution, Num_Parution, Departement, Sous_Prefecture, Type_Annonce, Annonce_Html, Assoc_Objet, Assoc_Adresse, Assoc_NObjet, Assoc_AObjet, Assoc_NAdresse, Assoc_Fusion, Assoc_Annulation, Assoc_ANom, Assoc_NNom, Assoc_Date_Declaration, Assoc_Date_Declaration2, typeAnnonce, codEven, dateInsert", "$strIdAnn AND dateSuppr=0 ORDER BY Date_Parution DESC LIMIT $offset,$lignes", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select('jo.asso', "id, Assoc_Nom, siren, nic, Waldec, Activite, Num_Annonce, Date_Parution, Num_Parution, Departement, Sous_Prefecture, Type_Annonce, Annonce_Html, Assoc_Objet, Assoc_Adresse, Assoc_NObjet, Assoc_AObjet, Assoc_NAdresse, Assoc_Fusion, Assoc_Annulation, Assoc_ANom, Assoc_NNom, Assoc_Date_Declaration, Assoc_Date_Declaration2, typeAnnonce, codEven, dateInsert", "$strIdAnn AND dateSuppr=0 ORDER BY Date_Parution DESC LIMIT $offset,$lignes", false, MYSQL_ASSOC);
|
||||
|
||||
$k=0;
|
||||
if (count($bodacc)>0) {
|
||||
@ -5214,7 +5212,7 @@ class MInsee
|
||||
$strIdAnn = "siren=$siren";
|
||||
}
|
||||
|
||||
$bodacc=$this->iDb->select('asso', "COUNT(*) AS nb", "$strIdAnn AND dateSuppr=0", false, MYSQL_ASSOC);
|
||||
$bodacc=$this->iDb->select('jo.asso', "COUNT(*) AS nb", "$strIdAnn AND dateSuppr=0", false, MYSQL_ASSOC);
|
||||
$nb = 0;
|
||||
if (count($bodacc)>0) {
|
||||
$nb = $bodacc[0]['nb'];
|
||||
@ -5230,7 +5228,7 @@ class MInsee
|
||||
$tabRet=array();
|
||||
|
||||
/** Chargement initial au cas ou la requête Coface plante **/
|
||||
$tabTmp=$this->iDb->select('infos_entrep', 'raisonSociale, isin, nscrl, tel, fax, web, mail, DATE(dateUpdate)*1 as dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.infos_entrep', 'raisonSociale, isin, nscrl, tel, fax, web, mail, DATE(dateUpdate)*1 as dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$idComp=@$tabTmp[0];
|
||||
if (isset($idComp['raisonSociale'])) {
|
||||
// L'entrep est en base infos_entrep
|
||||
@ -5346,8 +5344,8 @@ class MInsee
|
||||
// 'effectif'=>$idComp['effectif'],
|
||||
);
|
||||
$tabInsert=array_merge($tabUpdate,array('siren'=>$siren));
|
||||
if (!$this->iDb->insert('infos_entrep', $tabInsert))
|
||||
$this->iDb->update('infos_entrep', $tabUpdate, "siren=$siren");
|
||||
if (!$this->iDb->insert('jo.infos_entrep', $tabInsert))
|
||||
$this->iDb->update('jo.infos_entrep', $tabUpdate, "siren=$siren");
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "MInsee::getIdentitePart sur $siren après accès Distant", print_r($tabRet, true));
|
||||
}
|
||||
@ -5411,7 +5409,7 @@ class MInsee
|
||||
if ($idAnnonce<>0) $strIdAnn.= " AND a.id=".preg_replace('/^0\./','', $idAnnonce);
|
||||
|
||||
/** Recherche des jugements enregistrés en base S&D **/
|
||||
$collecte = $this->iDb->select('annonces a, tribunaux t',
|
||||
$collecte = $this->iDb->select('jo.annonces a, jo.tribunaux t',
|
||||
'a.id, a.siren, a.typeEven, a.strEven, a.dateJugement, a.dateCessationPaiement, a.dateEffetFinP, a.numero, a.inter1type, a.inter1id, a.inter1nom, a.inter2type, a.inter2id, a.inter2nom, a.inter3type, a.inter3id, a.inter3nom, a.inter4type, a.inter4id, a.inter4nom, a.tribunal, a.montant, a.actionsNb, a.complement, a.nouvActivite, a.nouvDir, a.nouvAdr, a.nouvFJ, a.source, a.parutionIdJal, a.parutionNum, a.dateSource, a.annonce, a.dateInsert, t.triNom, t.triSiret, t.triCP, a.raisonSociale, a.adresse, a.codePostal, a.ville',
|
||||
"a.siren=$siren AND a.tribunal=t.triCode $strIdAnn AND a.dateSuppr=0 GROUP BY a.siren, a.dateJugement, typeEven ORDER BY a.dateJugement DESC", true, MYSQL_ASSOC);
|
||||
if (count($collecte)>0) {
|
||||
@ -5450,7 +5448,7 @@ class MInsee
|
||||
if (trim($ann['inter1type'])<>'' && ($ann['inter1id']>0 || trim($ann['inter1nom'])<>'') ) {
|
||||
$texteAnnonce.=$tabInter[$ann['inter1type']].' : '.$ann['inter1nom'];
|
||||
if ($ann['inter1id']<>0) {
|
||||
$tabTmp=$this->iDb->select( 'tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter1id'], false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter1id'], false, MYSQL_ASSOC);
|
||||
$mand=$tabTmp[0];
|
||||
if ($mand['sirenGrp']<>0) $texteAnnonce.=', Siren SCP '.$mand['sirenGrp'];
|
||||
if ($mand['sirenMand']<>0) $texteAnnonce.=', Siren '.$mand['sirenMand'];
|
||||
@ -5463,7 +5461,7 @@ class MInsee
|
||||
if (trim($ann['inter2type'])<>'' && ($ann['inter2id']>0 || trim($ann['inter2nom'])<>'') ) {
|
||||
$texteAnnonce.=$tabInter[$ann['inter2type']].' : '.$ann['inter2nom'];
|
||||
if ($ann['inter2id']<>0) {
|
||||
$tabTmp=$this->iDb->select( 'tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter2id'], false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter2id'], false, MYSQL_ASSOC);
|
||||
$mand=$tabTmp[0];
|
||||
if ($mand['sirenGrp']<>0) $texteAnnonce.=', Siren SCP '.$mand['sirenGrp'];
|
||||
if ($mand['sirenMand']<>0) $texteAnnonce.=', Siren '.$mand['sirenMand'];
|
||||
@ -5476,7 +5474,7 @@ class MInsee
|
||||
if (trim($ann['inter3type'])<>'' && ($ann['inter3id']>0 || trim($ann['inter3nom'])<>'') ) {
|
||||
$texteAnnonce.=$tabInter[$ann['inter3type']].' : '.$ann['inter3nom'];
|
||||
if ($ann['inter3id']<>0) {
|
||||
$tabTmp=$this->iDb->select( 'tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter3id'], false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter3id'], false, MYSQL_ASSOC);
|
||||
$mand=$tabTmp[0];
|
||||
if ($mand['sirenGrp']<>0) $texteAnnonce.=', Siren SCP '.$mand['sirenGrp'];
|
||||
if ($mand['sirenMand']<>0) $texteAnnonce.=', Siren '.$mand['sirenMand'];
|
||||
@ -5489,7 +5487,7 @@ class MInsee
|
||||
if (trim($ann['inter4type'])<>'' && ($ann['inter4id']>0 || trim($ann['inter4nom'])<>'') ) {
|
||||
$texteAnnonce.=$tabInter[$ann['inter4type']].' : '.$ann['inter4nom'];
|
||||
if ($ann['inter4id']<>0) {
|
||||
$tabTmp=$this->iDb->select( 'tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter4id'], false, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires', 'sirenGrp, sirenMand, tel, fax, email', 'id='.$ann['inter4id'], false, MYSQL_ASSOC);
|
||||
$mand=$tabTmp[0];
|
||||
if ($mand['sirenGrp']<>0) $texteAnnonce.=', Siren SCP '.$mand['sirenGrp'];
|
||||
if ($mand['sirenMand']<>0) $texteAnnonce.=', Siren '.$mand['sirenMand'];
|
||||
@ -5643,7 +5641,7 @@ class MInsee
|
||||
else $dep='Dep'.$dep;
|
||||
$strDep="AND (n.territoire='' OR n.territoire LIKE '%$dep%')";
|
||||
}
|
||||
$listeCC=$this->iDb->select('conv_naf n, conventions c',
|
||||
$listeCC=$this->iDb->select('jo.conv_naf n, jo.conventions c',
|
||||
'n.`id CC`, n.`nom CC`, n.`editeur CC`, n.`nb page CC`, n.`isbn CC`, n.`date edition CC`, c.infoCC, joCCmaj',
|
||||
"n.naf='$naf4' AND substring(n.`id CC`,1,4)=c.numBrochure $strDep GROUP BY n.`id CC`", false, MYSQL_ASSOC);
|
||||
return $listeCC;
|
||||
@ -5707,7 +5705,7 @@ class MInsee
|
||||
$tabAnnees[]=$an;
|
||||
$strAnnees.=implode(',', $tabAnnees).')';
|
||||
}
|
||||
$tabImportExport=$this->iDb->select('importExport', 'importExport, annee, /*siren, raisonSociale, naf, categorie, adresse,*/ rangNational, deptSiege', "1 $strImportExport $strAnnees AND siren=$siren ORDER BY annee DESC, importExport ASC",false, MYSQL_ASSOC);
|
||||
$tabImportExport=$this->iDb->select('jo.importExport', 'importExport, annee, rangNational, deptSiege', "1 $strImportExport $strAnnees AND siren=$siren ORDER BY annee DESC, importExport ASC",false, MYSQL_ASSOC);
|
||||
return $tabImportExport;
|
||||
}
|
||||
|
||||
@ -5756,7 +5754,7 @@ class MInsee
|
||||
if ($active) {
|
||||
$strAdrActive.=" AND (enActif=1 OR etActif=1) AND nbEntrep>30 AND pasEntrepDom=0 AND siren>1000 ";
|
||||
}
|
||||
$tabTmp=$this->iDb->select('tabAdrDom',
|
||||
$tabTmp=$this->iDb->select('jo.tabAdrDom',
|
||||
'id, siren, nic, enActif, etActif, procol, nom, nom2, sigle, enseigne, adrNum, adrBtq, adrTypVoie, adrLibVoie, ville, cp, adrComp, adrDistSp, cj, apen, apet, nbEntrep, dateInsert, dateUpdate',
|
||||
"adrNum=$num AND adrBtq='$indRep' AND adrTypVoie LIKE '%$typeVoie%' AND adrLibVoie LIKE '%$libVoie%' AND cp=$cp $strAdrActive GROUP BY siren ORDER BY enActif DESC, nbEntrep DESC", false, MYSQL_ASSOC);
|
||||
if (count($tabTmp)>0) {
|
||||
@ -6220,7 +6218,7 @@ class MInsee
|
||||
{
|
||||
$tabRet=array();
|
||||
$ret=$this->iDb->select('insee.tabCpf', 'codCpf, libCpf',
|
||||
"codCpf IN (SELECT cpf FROM tabNafCpf WHERE naf='$naf')", false, MYSQL_ASSOC);
|
||||
"codCpf IN (SELECT cpf FROM insee.tabNafCpf WHERE naf='$naf')", false, MYSQL_ASSOC);
|
||||
foreach ($ret as $iRet=>$tabCpf) {
|
||||
$tabRet[$tabCpf['codCpf']]=$tabCpf['libCpf'];
|
||||
}
|
||||
@ -6341,7 +6339,7 @@ class MInsee
|
||||
{
|
||||
$tabRet=array();
|
||||
$ret=$this->iDb->select('insee.insee_even',
|
||||
'insSIREN, insNIC, insDATEVE, insEVE, insAPET700, insSIEGE, insLIBCOM, insL1_NOMEN, insL2_COMP, insL4_VOIE, insL3_CADR, insL5_DISP, insL6_POST, insCODPOS, insL7_ETRG, insDEPCOM, insCODEVOIE, insNICTRAN, insSIRETPS, insDATEMAJ, idFlux, insSIRETASS, insDESTINAT, insTYPETAB, insORIGINE, insTRAN, insNOMEN, insENSEIGNE, insNUMVOIE, insINDREP, insTYPVOIE, insLIBVOIE, sirVersion',
|
||||
'LPAD(insSIREN,9,0) AS insSIREN, LPAD(insNIC,5,0) AS insNIC, insDATEVE, insEVE, insAPET700, insSIEGE, insLIBCOM, insL1_NOMEN, insL2_COMP, insL4_VOIE, insL3_CADR, insL5_DISP, insL6_POST, insCODPOS, insL7_ETRG, insDEPCOM, insCODEVOIE, insNICTRAN, insSIRETPS, insDATEMAJ, idFlux, insSIRETASS, insDESTINAT, insTYPETAB, insORIGINE, insTRAN, insNOMEN, insENSEIGNE, insNUMVOIE, insINDREP, insTYPVOIE, insLIBVOIE, sirVersion',
|
||||
"insSIREN=$siren AND insNIC<>$nic AND (insEVE IN ('510','520','530','540', 'CTS','CTE','STS','STE','MTDS','MTDE','MTAS','MTAE') OR insEVE LIKE 'T%') AND insDATEMAJ IN (
|
||||
SELECT insDATEMAJ FROM insee.insee_even WHERE insSIREN=$siren AND insNIC=$nic AND (insEVE IN ('510','520','530','540', 'CTS','CTE','STS','STE','MTDS','MTDE','MTAS','MTAE') OR insEVE LIKE 'T%')
|
||||
)", false, MYSQL_ASSOC);
|
||||
@ -6533,15 +6531,6 @@ class MInsee
|
||||
'grdQuartier'=>$ret[0]['GRD_QUART'],
|
||||
'rivoli'=>$codeRivoli,
|
||||
);
|
||||
/*
|
||||
@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMInsee::getInfosIris sur $codeCommune/$codeRivoli", "Debug IRIS sur $adrNum, $adrTypVoie, $adrLibVoie".EOL."SELECT codeInsee, codeIris, rivoli, codeInseeIris
|
||||
FROM iris
|
||||
WHERE codeInsee='$codeCommune' AND rivoli LIKE '$codeRivoli%' $strAdr GROUP BY codeInseeIris;
|
||||
|
||||
SELECT CODE_IRIS AS codeInseeIris, SUBSTRING(CODE_IRIS,6,4) AS codeIris, LIB_IRIS, TYP_IRIS, MODIF_IRIS, TRIRIS, GRD_QUART
|
||||
FROM insee_tabIris
|
||||
WHERE DEPCOM='$codeCommune' AND (TYP_IRIS='Z' OR CODE_IRIS='$codeComIris');".EOL.print_r($tabRet, true));
|
||||
*/
|
||||
} else {
|
||||
//typVoie, libVoie, rivoli, typeNum 1:chiffres impaires, 2:chiffres paires
|
||||
//numd, indd, numf, indf
|
||||
@ -6589,7 +6578,7 @@ class MInsee
|
||||
*/
|
||||
public function getCAnafEffectif($naf, $effectif=0)
|
||||
{
|
||||
$tabTmp=$this->iDb->select('ratios_secteurs', 'id, naf5, annee, SUM(montant), SUM(nombre), SUM(montant)/SUM(nombre) AS moyenne', "naf5='$naf' AND id=267 AND ANNEE>(SELECT MAX(annee) FROM ratios_secteurs WHERE naf5='$naf' AND id=267)-2 GROUP BY id, naf5", true, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.ratios_secteurs', 'id, naf5, annee, SUM(montant), SUM(nombre), SUM(montant)/SUM(nombre) AS moyenne', "naf5='$naf' AND id=267 AND ANNEE>(SELECT MAX(annee) FROM jo.ratios_secteurs WHERE naf5='$naf' AND id=267)-2 GROUP BY id, naf5", false, MYSQL_ASSOC);
|
||||
if (count($tabTmp)>0) {
|
||||
$caSecteur=round($tabTmp[0]['moyenne']*1000);
|
||||
// Encours moyen secteur * nb salariés
|
||||
@ -6601,48 +6590,50 @@ class MInsee
|
||||
|
||||
/**
|
||||
* Code Voie Rivoli
|
||||
* @param unknown $codeCommune
|
||||
* @param unknown $adrTypVoie
|
||||
* @param unknown $adrLibVoie
|
||||
* @return string|Ambigous <string, unknown>
|
||||
* @param string $codeCommune
|
||||
* @param string $adrTypVoie
|
||||
* @param string $adrLibVoie
|
||||
* @return string
|
||||
*/
|
||||
public function getCodeVoieRivoli($codeCommune, $adrTypVoie, $adrLibVoie)
|
||||
{
|
||||
$codeVoie='';
|
||||
$adrTypVoie=strtoupper($adrTypVoie);
|
||||
$adrLibVoie=strtoupper($adrLibVoie);
|
||||
$adrLibVoie2=addslashes($adrLibVoie);
|
||||
$tDeb=microtime(1);
|
||||
$tabVoiesNoff=array(
|
||||
'LD'=> '',
|
||||
'R'=> 'RUE',
|
||||
'CITE'=>'CTE',
|
||||
'FG'=> 'FBG',
|
||||
'PL'=> 'PCE',
|
||||
'QU'=> 'QUAI',
|
||||
'QUA'=> 'QRT',
|
||||
//'QUA'=>'QUR',
|
||||
'SQ'=> 'SQR',
|
||||
'VLGE'=>'VGE',
|
||||
'VOI'=>'VOIE'
|
||||
$codeVoie = '';
|
||||
$adrTypVoie = strtoupper($adrTypVoie);
|
||||
$adrLibVoie = strtoupper($adrLibVoie);
|
||||
$adrLibVoie2 = addslashes($adrLibVoie);
|
||||
|
||||
$tabVoiesNoff = array(
|
||||
'LD' => '',
|
||||
'R' => 'RUE',
|
||||
'CITE' => 'CTE',
|
||||
'FG' => 'FBG',
|
||||
'PL' => 'PCE',
|
||||
'QU' => 'QUAI',
|
||||
'QUA' => 'QRT',
|
||||
'SQ' => 'SQR',
|
||||
'VLGE' => 'VGE',
|
||||
'VOI' => 'VOIE'
|
||||
);
|
||||
|
||||
if (array_key_exists($adrTypVoie, $tabVoiesNoff) || in_array($adrTypVoie, $tabVoiesNoff)) {
|
||||
$typeVoieNoff=$adrTypVoie;
|
||||
$typeVoieOff=@$tabVoiesNoff[$adrTypVoie];
|
||||
if ($typeVoieOff=='QUA')
|
||||
$strTypesVoies=" AND voieNature IN('QUA','QRT','QUR') ";
|
||||
else
|
||||
$strTypesVoies=" AND voieNature IN('$typeVoieNoff','$typeVoieOff') ";
|
||||
$typeVoieNoff = $adrTypVoie;
|
||||
$typeVoieOff = $tabVoiesNoff[$adrTypVoie];
|
||||
if ($typeVoieOff == 'QUA') {
|
||||
$strTypesVoies = " AND voieNature IN('QUA','QRT','QUR') ";
|
||||
} else {
|
||||
$strTypesVoies = " AND voieNature IN('$typeVoieNoff','$typeVoieOff') ";
|
||||
}
|
||||
} else {
|
||||
$typeVoieOff=$typeVoieNoff=$adrTypVoie;
|
||||
$strTypesVoies=" AND voieNature='$typeVoieOff' ";
|
||||
$typeVoieOff = $typeVoieNoff = $adrTypVoie;
|
||||
$strTypesVoies =" AND voieNature='$typeVoieOff' ";
|
||||
}
|
||||
$ret=$this->iDb->select(
|
||||
'insee.fantoirVoi', "codComInsee, idVoieCom, cleRivoli, voieNature, voieLib, 1 AS score",
|
||||
"codComInsee='$codeCommune' $strTypesVoies AND voieLib='$adrLibVoie2'",false, MYSQL_ASSOC);
|
||||
$nbRet=count($ret);
|
||||
if ($nbRet==0) return '';//'Aucune correspondance Rivoli'.EOL;
|
||||
else {
|
||||
|
||||
$ret = $this->iDb->select('insee.fantoirVoi', "codComInsee, idVoieCom, cleRivoli, voieNature, voieLib, 1 AS score",
|
||||
"codComInsee='$codeCommune' $strTypesVoies AND voieLib='$adrLibVoie2'", false, MYSQL_ASSOC);
|
||||
$nbRet = count($ret);
|
||||
if ($nbRet==0) {
|
||||
return '';//'Aucune correspondance Rivoli'.EOL;
|
||||
} else {
|
||||
foreach($ret as $i=>$iRet) {
|
||||
if (($iRet['voieNature']==$typeVoieOff || $iRet['voieNature']==$typeVoieNoff) && $iRet['voieLib']==$adrLibVoie) {
|
||||
$codeVoie=$iRet['idVoieCom'];
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?
|
||||
define ('ARTISANAT_DISPO_WEB', 1);
|
||||
define ('ARTISANAT_DISPO_WEB', 1);
|
||||
include_once(FWK_PATH.'common/curl.php');
|
||||
|
||||
class MArtisanat {
|
||||
@ -19,7 +19,7 @@ class MArtisanat {
|
||||
|
||||
function getIdentite($siren, $refresh=false) {
|
||||
$siren=$siren*1;
|
||||
$res=$this->iDb->select('artisanat', 'id, siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nbInscriptions, nom, prenom, nomUsage, dateNaiss, lieuNaiss, natio, qualite, qualif, dateQualif, dateFctDeb, dateFctFin, IF(dateInsert>dateUpdate,dateInsert,dateUpdate) AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$res=$this->iDb->select('jo.artisanat', 'id, siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nbInscriptions, nom, prenom, nomUsage, dateNaiss, lieuNaiss, natio, qualite, qualif, dateQualif, dateFctDeb, dateFctFin, IF(dateInsert>dateUpdate,dateInsert,dateUpdate) AS dateUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
if (count($res)>0 && !$refresh) {
|
||||
$this->enCache=true;
|
||||
$tabInsert=$res[0];
|
||||
@ -93,7 +93,7 @@ class MArtisanat {
|
||||
}
|
||||
|
||||
/** Gestion des multi-inscriptions au RM **/
|
||||
if (preg_match('/<b class="gris">(.*)entreprises.correspondent(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis', $this->body, $matches))
|
||||
if (preg_match('/<b class="gris">(.*)entreprises.correspondent(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis', $this->body, $matches))
|
||||
{
|
||||
$nbRep=trim($matches[1])*1;
|
||||
$iRadMax=-1;
|
||||
@ -150,11 +150,11 @@ class MArtisanat {
|
||||
$actif=null;
|
||||
if (preg_match("/Renseignements.relatif(?:.*)entreprise(.*)<\/b>/Uis", $this->body, $matches)) {
|
||||
switch (trim(strtr($matches[1],array(chr(160)=>'')))) {
|
||||
case 'en activité': $actif=1; break;
|
||||
case 'en activité': $actif=1; break;
|
||||
case 'radiée': $actif=0; break;
|
||||
default: print_r($matches);die(); break;
|
||||
}
|
||||
//die(EOL.'$actif='.$actif.EOL.print_r($matches));
|
||||
//die(EOL.'$actif='.$actif.EOL.print_r($matches));
|
||||
}
|
||||
$tabInsert['actif']=$actif;
|
||||
if ($actif===null) {
|
||||
@ -174,7 +174,7 @@ class MArtisanat {
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">enseigne<\/span><\/td>(?:.*)<td align="left" colspan="4">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['enseigne']=$matches[1];
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">forme juridique<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['fj']=$matches[1];
|
||||
$tabInsert['fj']=$matches[1];
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">effectif<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['effectif']=$matches[1];
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">code APRM<\/span><\/td>(?:.*)<td align="left">(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
@ -195,7 +195,7 @@ class MArtisanat {
|
||||
$tabInsert['radiation']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabEtabs=array();
|
||||
if (preg_match('/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Aucune inscription complémentaire<\/b>(?:.*)<!--fin Etablissements secondaires-->/Uis', $this->body, $matches))
|
||||
$tabInsert['nbInscriptions']=0;
|
||||
$tabInsert['nbInscriptions']=0;
|
||||
elseif (preg_match('/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Inscription complémentaire<\/b>(.*)<!--fin Etablissements secondaires-->/Uis', $this->body, $matches)) {
|
||||
$tabInsert['nbInscriptions']=0;
|
||||
if (preg_match_all('/<tr>(?:.*)<td><img alt="" src="inter\/pixtrans\.gif" width="30" height="1"><\/td>(?:.*)<td nowrap>(?:.*)<!-- adresse -->(.*)<\/td>(?:.*)<td nowrap>(?:.*)<!-- code postal et ville -->(.*)<\/td>(?:.*)<td nowrap>(?:.*)<!-- enseigne -->(.*)<\/td>(?:.*)<td>(?:.*)<!-- debut activite -->(.*)<\/td>(?:.*)<td>(?:.*)<!-- fin activite -->(.*)<\/td>(?:.*)<\/tr>/Uis', $matches[1], $matches2)) {
|
||||
@ -233,7 +233,7 @@ class MArtisanat {
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nom d\'usage<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['nomUsage']=trim(strtr(html_entity_decode($matches[1]),chr(160),' '));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"(?:.*)<span class="turquoise"> date de naissance<\/span><\/td>(?:.*)-->(?:.*)<td(?: +)align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
$tabInsert['dateNaiss']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
$tabInsert['dateNaiss']=WDate::dateT('d/m/Y', 'Y-m-d', trim(strtr(html_entity_decode($matches[1]),chr(160),' ')));
|
||||
// if (preg_match('/date de naissance(.*)<td background="inter\/pix3_turquoise\.gif" align="right"/Uis', $this->body, $matches))
|
||||
// die(print_r($matches));
|
||||
if (preg_match('/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise"> lieu de naissance<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis', $this->body, $matches))
|
||||
@ -256,11 +256,11 @@ class MArtisanat {
|
||||
|
||||
// Insertion en base de données
|
||||
$tabInsert['dateInsert']=date('Y-m-d H:i:s');
|
||||
$id=$this->iDb->insert('artisanat', $tabInsert, true);
|
||||
$id=$this->iDb->insert('jo.artisanat', $tabInsert, true);
|
||||
$tabInsert['id']=$id;
|
||||
foreach ($tabEtabs as $tabInsert2) {
|
||||
$tabInsert2['dateInsert']=$tabInsert['dateInsert'];
|
||||
$id2=$this->iDb->insert('artisanat_etab', $tabInsert2, true);
|
||||
$id2=$this->iDb->insert('jo.artisanat_etab', $tabInsert2, true);
|
||||
}
|
||||
|
||||
$tabInsert['dateUpdate']=substr($tabInsert['dateInsert'],0,10);
|
||||
|
@ -1,176 +1,8 @@
|
||||
<?php
|
||||
require_once 'framework/common/curl.php';
|
||||
require_once 'framework/common/dates.php';
|
||||
//require_once 'Metier/partenaires/classMEuridile.php';
|
||||
//require_once 'Metier/partenaires/classMRncsFlux.php';
|
||||
require_once 'Metier/partenaires/classMGreffes.php';
|
||||
|
||||
define ('ECART_CTRL_MAX', 5); // Ecart maximal acceptable dans la saisie +/-5 entre les calculs et la saisie !
|
||||
|
||||
global $tabCtrl;
|
||||
$tabCtrl=array(
|
||||
/** Bilans Réel Normal **/
|
||||
'S'=>array(
|
||||
// Actif Simplifié
|
||||
'010-012=013'=>'Fonds commercial (Brut,Amor/Prov et Net incohérents)',
|
||||
'014-016=017'=>'Immos incorpo. autres (Brut,Amor/Prov et Net incohérents)',
|
||||
'028-030=031'=>'Immos corpo. (Brut,Amor/Prov et Net incohérents)',
|
||||
'040-042=043'=>'Immos finan. (Brut,Amor/Prov et Net incohérents)',
|
||||
'044-048=049'=>'Total (I) Actif Immos (Brut,Amor/Prov et Net incohérents)',
|
||||
'010+014+028+040=044'=>'Total Actif immobilisé Brut',
|
||||
'012+016+030+042=048'=>'Total Actif immobilisé Amor/Prov',
|
||||
'013+017+031+043=049'=>'Total Actif immobilisé Net',
|
||||
'050-052=053'=>'Stocks MP (Brut,Amor/Prov et Net incohérents)',
|
||||
'060-062=063'=>'Stocks Marchandises (Brut,Amor/Prov et Net incohérents)',
|
||||
'064-066=067'=>'Avances et acomptes/cmds (Brut,Amor/Prov et Net incohérents)',
|
||||
'068-070=071'=>'Créances clients et CR (Brut,Amor/Prov et Net incohérents)',
|
||||
'072-074=075'=>'Autres créances (Brut,Amor/Prov et Net incohérents)',
|
||||
'080-082=083'=>'VMP (Brut,Amor/Prov et Net incohérents)',
|
||||
'084-086=087'=>'Disponibilités (Brut,Amor/Prov et Net incohérents)',
|
||||
'088-090=091'=>' (Brut,Amor/Prov et Net incohérents)',
|
||||
'092-094=095'=>'Ch. constatées d\'avance (Brut,Amor/Prov et Net incohérents)',
|
||||
'096-098=099'=>'Total (II) Actif Circulant (Brut,Amor/Prov et Net incohérents)',
|
||||
'110-112=113'=>'Total ACTIF (Brut,Amor/Prov et Net incohérents)',
|
||||
'050+060+064+068+072+080+084+088+092=096'=>'Total Actif circulant Brut',
|
||||
'052+062+066+070+074+082+086+090+094=098'=>'Total Actif circulant Amor/Prov',
|
||||
'053+063+067+071+075+083+087+091+092=099'=>'Total Actif circulant Net',
|
||||
'044+096=110'=>'Total ACTIF Brut',
|
||||
'048+098=112'=>'Total ACTIF Amor/Prov',
|
||||
'049+099=113'=>'Total ACTIF Net',
|
||||
// Passif Simplifié
|
||||
'120+124+126+130+132+134+136+140=142'=>'Total Capitaux Propres',
|
||||
'156+164+166+172+174=176'=>'Total Dettes',
|
||||
'142+154+176=180'=>'Total Passif',
|
||||
'113=180'=>'Actif=Passif',
|
||||
// CDR Simplifié
|
||||
'210+214+218+222+224+226+230=232'=>'Total des produits d\'exploitation',
|
||||
'234+236+238+240+242+244+250+252+254+256+262=264'=>'Total des charges d\'exploitation',
|
||||
'210+214+218+222+224+226+230=232'=>'Total des produits d\'exploitation',
|
||||
'232-264=270'=>'Résultat d\'exploitation',
|
||||
'232+280+290-264-294-300-306=310'=>'Résultat d\'exploitation',
|
||||
),
|
||||
'N'=>array(
|
||||
// Actif immobilisé
|
||||
'AA=AA2'=>'Capital souscrit non appelé',
|
||||
'AB-AC=AC1'=>'Frais d\'étab. (Brut,Amor/Prov et Net incohérents)',
|
||||
'AD-AE=AE1'=>'Frais de R&D (Brut,Amor/Prov et Net incohérents)',
|
||||
'AF-AG=AG1'=>'Brevets (Brut,Amor/Prov et Net incohérents)',
|
||||
'AH-AI=AI1'=>'Fonds commercial (Brut,Amor/Prov et Net incohérents)',
|
||||
'AJ-AK=AK1'=>'Autres immo inc. (Brut,Amor/Prov et Net incohérents)',
|
||||
'AL-AM=AM1'=>'Acomptes immo inc. (Brut,Amor/Prov et Net incohérents)',
|
||||
'AN-AO=AO1'=>'Terrains (Brut,Amor/Prov et Net incohérents)',
|
||||
'AP-AQ=AQ1'=>'Constructions (Brut,Amor/Prov et Net incohérents)',
|
||||
'AR-AS=AS1'=>'Installations (Brut,Amor/Prov et Net incohérents)',
|
||||
'AT-AU=AU1'=>'Autres immo corp. (Brut,Amor/Prov et Net incohérents)',
|
||||
'AV-AW=AW1'=>'Immos en cours (Brut,Amor/Prov et Net incohérents)',
|
||||
'AX-AY=AY1'=>'Acomptes immo corp. (Brut,Amor/Prov et Net incohérents)',
|
||||
'CS-CT=CT1'=>'Immo Fi participations/équiv. (Brut,Amor/Prov et Net incohérents)',
|
||||
'CU-CV=CV1'=>'Autres participations (Brut,Amor/Prov et Net incohérents)',
|
||||
'BB-BC=BC1'=>'Créances rattachées à des particip. (Brut,Amor/Prov et Net incohérents)',
|
||||
'BD-BE=BE1'=>'Autres titres immo. (Brut,Amor/Prov et Net incohérents)',
|
||||
'BF-BG=BG1'=>'Prêts (Brut,Amor/Prov et Net incohérents)',
|
||||
'BH-BI=BI1'=>'Autres Immo Financières (Brut,Amor/Prov et Net incohérents)',
|
||||
'BJ-BK=BK1'=>'Total de l\'Actif Immobilisé (Brut,Amor/Prov et Net incohérents)',
|
||||
'AB+AD+AF+AH+AJ+AL+AN+AP+AR+AT+AV+AX+CS+CU+BB+BD+BF+BH=BJ'=>'Total des Immobilisations (Brut)',
|
||||
'AC+AE+AG+AI+AK+AM+AO+AQ+AS+AU+AW+AY+CT+CV+BC+BE+BG+BI=BK'=>'Total des Immobilisations (Amor.)',
|
||||
'AC1+AE1+AG1+AI1+AK1+AM1+AO1+AQ1+AS1+AU1+AW1+AY1+CT1+CV1+BC1+BE1+BG1+BI1=BK1'=>'Total des Immobilisations (Net)',
|
||||
// Actif circulant
|
||||
'BL-BM=BM1'=>'Stocks de MP (Brut,Amor/Prov et Net incohérents)',
|
||||
'BN-BO=BO1'=>'Stocks en cours de prod. biens (Brut,Amor/Prov et Net incohérents)',
|
||||
'BP-BQ=BQ1'=>'Stocks en cours de prod. services (Brut,Amor/Prov et Net incohérents)',
|
||||
'BR-BS=BS1'=>'Stocks produits finis (Brut,Amor/Prov et Net incohérents)',
|
||||
'BT-BU=BU1'=>'Stocks de marchandises (Brut,Amor/Prov et Net incohérents)',
|
||||
'BV-BW=BW1'=>'Avances et acomptes/cmds (Brut,Amor/Prov et Net incohérents)',
|
||||
'BX-BY=BY1'=>'Créances clients (Brut,Amor/Prov et Net incohérents)',
|
||||
'BZ-CA=CA1'=>'Autres créances (Brut,Amor/Prov et Net incohérents)',
|
||||
'CB-CC=CC1'=>'Capital souscrit appelé non versé (Brut,Amor/Prov et Net incohérents)',
|
||||
'CD-CE=CE1'=>'VMP (Brut,Amor/Prov et Net incohérents)',
|
||||
'CF-CG=CG1'=>'Disponibilités (Brut,Amor/Prov et Net incohérents)',
|
||||
'CH-CI=CI1'=>'Charges Const. d\'avance(Brut,Amor/Prov et Net incohérents)',
|
||||
'CJ-CK=CK1'=>'Total de l\'Actif Circulant (Brut,Amor/Prov et Net incohérents)',
|
||||
'BL+BN+BP+BR+BT+BV+BX+BZ+CB+CD+CF+CH=CJ'=>'Total l\'Actif Circulant (Brut)',
|
||||
'BM+BO+BQ+BS+BU+BW+BY+CA+CC+CE+CG+CI=CK'=>'Total l\'Actif Circulant (Amor.)',
|
||||
'BM1+BO1+BQ1+BS1+BU1+BW1+BY1+CA1+CC1+CE1+CG1+CI1=CK1'=>'Total l\'Actif Circulant (Net)',
|
||||
'CL=CL2'=>'Charges / plus. ex. (Brut<>Net)',
|
||||
'CM=CM2'=>'Primes de Rbt obligations (Brut<>Net)',
|
||||
'CN=CN2'=>'Ecarts de conversion d\'actif (Brut<>Net)',
|
||||
'CO-1A=1A1'=>'Total Actif (Brut,Amor/Prov et Net incohérents)',
|
||||
'AA+BJ+CJ+CL+CM+CN=CO'=>'Total Actif Brut',
|
||||
'BK+CK=1A'=>'Total Actif (Amor.)',
|
||||
'AA2+BK1+CK1+CL2+CM2+CN2=1A1'=>'Total Actif Net',
|
||||
// PASSIF
|
||||
'DA+DB+DC+DD+DE+DF+DG+DH+DI+DJ+DK=DL'=>'Passif : s/total I (Capitaux Propres)',
|
||||
'DM+DN=DO'=>'Passif : s/total II (Autres fonds propres)',
|
||||
'DP+DQ=DR'=>'Passif : s/total III (Provisions)',
|
||||
'DS+DT+DU+DV+DW+DX+DY+DZ+EA+EB=EC'=>'Passif : s/total IV (Dettes+Cpt régul. PCA)',
|
||||
'DL+DO+DR+EC+ED=EE'=>'Total Passif',
|
||||
'EE=1A1'=>'Total Actif=Total Passif',
|
||||
// CDR
|
||||
'FA+FB=FC'=>'Total Ventes de marchandises',
|
||||
'FD+FE=FF'=>'Total Production vendue de biens',
|
||||
'FG+FH=FI'=>'Total Production vendue de services',
|
||||
'FJ+FK=FL'=>'Total Chiffe d\'Affaires France+Export',
|
||||
'FA+FD+FG=FJ'=>'Total C.A. France',
|
||||
'FB+FE+FH=FK'=>'Total C.A. Export',
|
||||
'FC+FF+FI=FL'=>'Total C.A. Total (Vtes+Biens+Services)',
|
||||
'FL+FM+FN+FO+FP+FQ=FR'=>'Total I : Produits d\'Exploitation',
|
||||
'FS+FT+FU+FV+FW+FX+FY+FZ+GA+GB+GC+GD+GE=GF'=>'Total II :Charges d\'Exploitation',
|
||||
'FR-GF=GG'=>'1 - Résultat d\'Exploitation',
|
||||
'GJ+GK+GL+GM+GN+GO=GP'=>'Total V : Produits Financiers',
|
||||
'GQ+GR+GS+GT=GU'=>'Total VI : Charges Financières',
|
||||
'GP-GU=GV'=>'2 - Résultat Financier',
|
||||
'GG+GH-GI+GV=GW'=>'3 - R.C.A.I.',
|
||||
'HA+HB+HC=HD'=>'Total VII : Produits Exceptionnels',
|
||||
'HE+HF+HG=HH'=>'Total VIII : Charges Exceptionnels',
|
||||
'HD-HH=HI'=>'4 - Résultat Exceptionnel',
|
||||
'FR+GH+GP+HD=HL'=>'CDR : Total des Produits',
|
||||
'GF+GI+GU+HH+HJ+HK=HM'=>'CDR : Total des Charges',
|
||||
'HL-HM=HN'=>'5 - Résultat de l\'exercice',
|
||||
// Immobilisations
|
||||
/* 'LY+MB+ME+MH+MK+MN+MQ+MT+MW+NA+NE=NH'=>'2054: Immos Total III Brut fin ex. incohérent',
|
||||
'0V+0Y+2C+2F=NK'=>'2054: Immos Total IV Brut fin ex. incohérent',
|
||||
'LU+LW+NH+NK=0L'=>'2054: Immos Total Général Brut fin ex. incohérent',
|
||||
'0L=BJ'=>'Immos Total Général Brut du 2054 <> BJ du 2050',*/
|
||||
),
|
||||
);
|
||||
|
||||
$tabLibCodeCtrl=array(
|
||||
'_0'=>'-',
|
||||
'_1'=>'Corrigé',
|
||||
'_3'=>'Capital',
|
||||
'_5'=>'Calculs', // Anciennement 2 mais maintenant >=5 correspond à une erreur grave
|
||||
'_7'=>'Effectif',
|
||||
'_9'=>'Unité',
|
||||
);
|
||||
|
||||
$tabLibCodeSaisie=array(
|
||||
// Code Saisie Bilans par Infogreffe
|
||||
'_00'=>'Bilan saisi sans anomalie',
|
||||
'_01'=>'Bilan saisi avec des incohérences comptables à la source du document (issues du remettant)',
|
||||
'_02'=>'Bilan avec Actif, Passif ou Compte de Résultat nul',
|
||||
'_03'=>'Bilan incomplet (des pages manquent)',
|
||||
'_04'=>'Bilan complet non détaillé (seuls les totaux et sous totaux sont renseignés)',
|
||||
'_05'=>'Bilan reçu en double exemplaire',
|
||||
'_06'=>'Bilan intermédiaire - Situation provisoire',
|
||||
'_07'=>'Bilan illisible',
|
||||
'_A7'=>'Bilan illisible, présentant un cadre gris très foncés (dans lesquels sont inscrits en général les totaux)',
|
||||
'_B7'=>'Bilan manuscrits',
|
||||
'_C7'=>'Bilan illisible, présentant des caractères trop gras',
|
||||
'_D7'=>'Bilan scanné en biais ou qui présentent des pages rognées',
|
||||
'_E7'=>'Bilan numérisés trop clairement (comme une imprimante dont la cartouche est presque vide)',
|
||||
'_F7'=>'Bilan illisible',
|
||||
'_08'=>'Bilan consolidé',
|
||||
'_09'=>'Déclaration d\'impôts',
|
||||
'_10'=>'Document autre que bilan',
|
||||
'_11'=>'Bilan de clôture de liquidation',
|
||||
'_12'=>'Bilan de Société financière',
|
||||
'_13'=>'Bilan de Société d\'assurance',
|
||||
'_14'=>'Bilan de Société immobilière',
|
||||
'_15'=>'Bilan de Société étrangère',
|
||||
// Codes saisie de Bilans spécifique às S&D
|
||||
'_70'=>'Document relatif à une autre société',
|
||||
);
|
||||
|
||||
class MBilans
|
||||
{
|
||||
/**
|
||||
@ -189,7 +21,11 @@ class MBilans
|
||||
*/
|
||||
protected $Bilans = array();
|
||||
|
||||
private $tabBS2BN = array(
|
||||
/**
|
||||
* Tableau de conversion basique pour la méthode bilanSimplifie2Normal
|
||||
* @var array
|
||||
*/
|
||||
protected $tabBS2BN = array(
|
||||
//2033 ACTIF PASSIF
|
||||
'AH' => '010',
|
||||
'AI' => '012',
|
||||
@ -216,11 +52,6 @@ class MBilans
|
||||
'BK1' => '049',
|
||||
'BK2' => 'N04',
|
||||
|
||||
'BL' => '050',
|
||||
'BM' => '052',
|
||||
'BM1' => '053',
|
||||
'BM2' => 'N05',
|
||||
|
||||
'BT' => '060',
|
||||
'BU' => '062',
|
||||
'BU1' => '063',
|
||||
@ -449,6 +280,24 @@ class MBilans
|
||||
$this->siren = $siren;
|
||||
}
|
||||
|
||||
/**
|
||||
* Défini la date du dernier exercice
|
||||
* @param string $accesPartenaire
|
||||
*/
|
||||
public function listeBilansDepose($accesPartenaire = false)
|
||||
{
|
||||
$result = $this->iDb->select('jo.bodacc_detail', 'Bodacc_Date_Parution, dateEffet, typeEven',
|
||||
"siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC",false, MYSQL_ASSOC);
|
||||
$dateDerDepot = 0;
|
||||
if ( count($result) > 0 ) {
|
||||
$dateDerDepot=$classWDate->dateT('Y-m-d','Ymd',$result[0]['dateEffet'])*1;
|
||||
if ($dateDerDepot<>0) {
|
||||
$this->dernierExerciceDepose = $classWDate->dateT('Y-m-d','d/m/Y',$result[0]['dateEffet']);
|
||||
$this->dernierExerciceDeposeLe = $classWDate->dateT('Y-m-d','d/m/Y',$result[0]['Bodacc_Date_Parution']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste les bilans disponibles au format numérique (et non PDF image) pour une entreprise
|
||||
* @param boolean $accesPartenaire
|
||||
@ -457,58 +306,37 @@ class MBilans
|
||||
* Nombre de bilans maximums retournés
|
||||
* @return array
|
||||
*/
|
||||
public function listeBilans($accesPartenaire=false, $nbMaxBilans=0)
|
||||
public function listeBilans($accesPartenaire = false, $nbMaxBilans = 0)
|
||||
{
|
||||
$classWDate = new WDate();
|
||||
$dateDerDepot = 0;
|
||||
$tabRet = $tabRet3 = array();
|
||||
$tabRet = $tabRet2 = $tabRet3 = array();
|
||||
|
||||
if ($nbMaxBilans>0) $limit="LIMIT 0, $nbMaxBilans";
|
||||
else $limit='';
|
||||
|
||||
$ret = $this->iDb->select(
|
||||
'bilans',
|
||||
'typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine, dateInsert, partenaire',
|
||||
"siren='$this->siren' ORDER BY dateExercice DESC $limit",false, MYSQL_ASSOC);
|
||||
if ( count($ret)>0 ) {
|
||||
$dateDerExercice=$ret[0]['dateExercice']*1;
|
||||
}
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren en base", print_r($ret, true));
|
||||
|
||||
$ret2 = $this->iDb->select(
|
||||
'bodacc_detail',
|
||||
'Bodacc_Date_Parution, dateEffet, typeEven',
|
||||
"siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC",false, MYSQL_ASSOC);
|
||||
if ( count($ret2)>0 ) {
|
||||
$dateDerDepot=$classWDate->dateT('Y-m-d','Ymd',$ret2[0]['dateEffet'])*1;
|
||||
if ($dateDerDepot<>0) {
|
||||
$this->dernierExerciceDepose = $classWDate->dateT('Y-m-d','d/m/Y',$ret2[0]['dateEffet']);
|
||||
$this->dernierExerciceDeposeLe = $classWDate->dateT('Y-m-d','d/m/Y',$ret2[0]['Bodacc_Date_Parution']);
|
||||
}
|
||||
}
|
||||
$ret = $this->iDb->select('jo.bilans',
|
||||
'typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine, dateInsert, partenaire',
|
||||
"siren='$this->siren' ORDER BY dateExercice DESC, CASE typeBilan WHEN 'N' THEN 1 WHEN 'S' THEN 2 ELSE 3 END $limit",false, MYSQL_ASSOC);
|
||||
|
||||
if ($accesPartenaire) {
|
||||
$iGreffe = new MGreffes($this->iDb);
|
||||
$tabRet=$tabRet2=$iGreffe->getListeBilans($this->siren);
|
||||
} else {
|
||||
$tabRet=$tabRet2=array();
|
||||
$tabRet = $tabRet2 = $iGreffe->getListeBilans($this->siren);
|
||||
}
|
||||
|
||||
$tabTri=array();
|
||||
$tabTri = array();
|
||||
|
||||
if ( count($tabRet)>0 ) {
|
||||
foreach ($tabRet as $millesime=>$bil) {
|
||||
foreach ($tabRet as $millesime => $bil) {
|
||||
$typeBilan = substr($millesime,0,1);
|
||||
$dateExercice = $classWDate->dateT('d/m/Y','Ymd',substr($millesime,1,10));
|
||||
$tabTri[''.$dateExercice.'-'.$typeBilan]=$millesime;
|
||||
$dateExercice = $classWDate->dateT('d/m/Y','Ymd', substr($millesime,1,10));
|
||||
$tabTri[''.$dateExercice.'-'.$typeBilan] = $millesime;
|
||||
}
|
||||
}
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren après accès partenaire", print_r($tabRet2, true));
|
||||
if ( count($ret)>0 ) {
|
||||
foreach ($ret as $i=>$bil) {
|
||||
$millesime=$classWDate->dateT('Ymd','d/m/Y',$bil['dateExercice']);
|
||||
if ( count($ret) > 0 ) {
|
||||
foreach ($ret as $i => $bil) {
|
||||
$millesime = $classWDate->dateT('Ymd','d/m/Y',$bil['dateExercice']);
|
||||
$tabRet[''.$bil['typeBilan'].$millesime] = array(
|
||||
'dateProvPartenaire' => $bil['dateProvPartenaire'],
|
||||
'dateInsert' => strtr($bil['dateInsert'], array(' '=>'',':'=>'','-'=>'')),
|
||||
@ -521,44 +349,37 @@ class MBilans
|
||||
'monnaie' => $bil['monnaieOrigine'],
|
||||
'source' => $bil['partenaire'],
|
||||
);
|
||||
$tabTri[''.$bil['dateExercice'].'-'.$bil['typeBilan']]=$bil['typeBilan'].$millesime;
|
||||
$tabTri[''.$bil['dateExercice'].'-'.$bil['typeBilan']] = $bil['typeBilan'].$millesime;
|
||||
}
|
||||
krsort($tabTri);
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren avant le tri", print_r($tabTri, true));
|
||||
|
||||
$exercicePre=$typePre=$tmpPre=false;
|
||||
$exercicePre = $typePre = $tmpPre = false;
|
||||
$refPre='';
|
||||
$strInfos='';
|
||||
foreach ($tabTri as $tmp=>$typeMillesime) {
|
||||
$exercice=substr($tmp,0,8);
|
||||
$type=substr($tmp,9,1);
|
||||
$ref=$tabRet[''.$typeMillesime]['ref'];
|
||||
foreach ($tabTri as $tmp => $typeMillesime) {
|
||||
$exercice = substr($tmp,0,8);
|
||||
$type = substr($tmp,9,1);
|
||||
$ref = $tabRet[''.$typeMillesime]['ref'];
|
||||
if ($exercice==$exercicePre && $type=='N' && $typePre=='S' && $refPre=='') {
|
||||
// Suppression du bilan RN de la liste si Réel Normal et Réel Simplifiés présents en base
|
||||
unset($tabTri[$tmp]);
|
||||
$strInfos.="Suppression de '$tmp'".EOL;
|
||||
}
|
||||
elseif ($exercice==$exercicePre && $type=='N' && $typePre=='S' && $refPre<>'') {
|
||||
// Suppression du bilan RS de la liste si Réel Normal Présent en base et réel simplifié non encore en base
|
||||
if ($tmpPre<>false) {
|
||||
unset($tabTri[$tmpPre]);
|
||||
$strInfos.="Suppression de '$tmpPre'".EOL;
|
||||
}
|
||||
}
|
||||
$exercicePre=$exercice;
|
||||
$typePre=$type;
|
||||
$refPre=@trim($ref);
|
||||
$tmpPre=$tmp;
|
||||
$typePre = $type;
|
||||
$refPre = @trim($ref);
|
||||
$tmpPre = $tmp;
|
||||
}
|
||||
krsort($tabTri);
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren après le tri", print_r($tabTri, true).EOL.$strInfos.EOL);
|
||||
$tabRet3=array();
|
||||
foreach ($tabTri as $tmp=>$typeMillesime)
|
||||
$tabRet3[''.$typeMillesime]=$tabRet[''.$typeMillesime];
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren après le tri / retour", print_r($tabRet3, true));
|
||||
foreach ($tabTri as $tmp => $typeMillesime) {
|
||||
$tabRet3[''.$typeMillesime] = $tabRet[''.$typeMillesime];
|
||||
}
|
||||
}
|
||||
|
||||
return $tabRet3;
|
||||
@ -586,74 +407,74 @@ class MBilans
|
||||
|
||||
$classWDate = new WDate();
|
||||
$millesimeDB = $classWDate->dateT('d/m/Y', 'Ymd', $millesime);
|
||||
if ($accesPartenaire)
|
||||
{
|
||||
if ($accesPartenaire) {
|
||||
// On ne veut pas de bilans "Téléchargés" directement sur Internet
|
||||
$strSansBilansWeb=' AND partenaire<>7 ';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$strSansBilansWeb='';
|
||||
}
|
||||
|
||||
$bilan = null;
|
||||
|
||||
$iGreffe = new MGreffes($this->iDb);
|
||||
$ret = $this->iDb->select('bilans',
|
||||
$ret = $this->iDb->select('jo.bilans',
|
||||
'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert',
|
||||
"siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB' $strSansBilansWeb", false, MYSQL_ASSOC);
|
||||
if (count($ret)==0 && $accesPartenaire)
|
||||
{
|
||||
if ($refPart=='' || $refPart==0)
|
||||
{
|
||||
$tabTmp = $iGreffe->getListeBilans($this->siren);
|
||||
foreach ($tabTmp as $idx=>$bil)
|
||||
{
|
||||
$typeBil=substr($idx,0,1);
|
||||
$millBil=substr($idx,1,10);
|
||||
if ($typeBil==$typeBilan && $millBil==$millesime)
|
||||
|
||||
if ( $accesPartenaire ) {
|
||||
$iGreffe = new MGreffes($this->iDb);
|
||||
if ( count($ret) == 0 ) {
|
||||
if ($refPart=='' || $refPart==0) {
|
||||
$tabTmp = $iGreffe->getListeBilans($this->siren);
|
||||
foreach ($tabTmp as $idx=>$bil)
|
||||
{
|
||||
$refPart=$bil['ref'];
|
||||
break;
|
||||
$typeBil=substr($idx,0,1);
|
||||
$millBil=substr($idx,1,10);
|
||||
if ($typeBil==$typeBilan && $millBil==$millesime)
|
||||
{
|
||||
$refPart=$bil['ref'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$tabBilan = $iGreffe->getBilan($this->siren, $refPart);
|
||||
|
||||
if ($tabBilan)
|
||||
{
|
||||
$strPostes='';
|
||||
foreach ($tabBilan['POSTES'] as $poste=>$valeur) {
|
||||
$strPostes.="$poste=$valeur;";
|
||||
}
|
||||
|
||||
$tabInsert=array(
|
||||
'siren' => $this->siren,
|
||||
'dateProvPartenaire'=> $tabBilan['DATE_FRAICHE_BILAN'],
|
||||
'dateExercice' => $classWDate->dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE']),
|
||||
'dateExercicePre' => $classWDate->dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE_PRE']),
|
||||
'dureeExercice' => $tabBilan['DUREE_MOIS'],
|
||||
'dureeExercicePre' => $tabBilan['DUREE_MOIS_PRE'],
|
||||
'monnaie' => $tabBilan['MONNAIE'],
|
||||
'typeBilan' => $tabBilan['TYPE_BILAN'],
|
||||
'monnaieOrigine' => $tabBilan['MONNAIE_ORI'],
|
||||
'unite' => $tabBilan['MONNAIE_LIV_UNITE'],
|
||||
'postes' => $strPostes,
|
||||
'partenaire' => $tabBilan['SOURCE'],
|
||||
);
|
||||
if (!$this->iDb->insert('jo.bilans', $tabInsert, true)) {
|
||||
$this->iDb->update('jo.bilans', $tabInsert, "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'");
|
||||
}
|
||||
|
||||
$ret = $this->iDb->select('jo.bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'", true);
|
||||
if (count($ret) > 0) {
|
||||
$bilan = $ret[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
$tabBilan = $iGreffe->getBilan($this->siren, $refPart);
|
||||
|
||||
if ($tabBilan)
|
||||
{
|
||||
$strPostes='';
|
||||
foreach ($tabBilan['POSTES'] as $poste=>$valeur) {
|
||||
$strPostes.="$poste=$valeur;";
|
||||
}
|
||||
|
||||
$tabInsert=array(
|
||||
'siren' => $this->siren,
|
||||
'dateProvPartenaire'=> $tabBilan['DATE_FRAICHE_BILAN'],
|
||||
'dateExercice' => $classWDate->dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE']),
|
||||
'dateExercicePre' => $classWDate->dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE_PRE']),
|
||||
'dureeExercice' => $tabBilan['DUREE_MOIS'],
|
||||
'dureeExercicePre' => $tabBilan['DUREE_MOIS_PRE'],
|
||||
'monnaie' => $tabBilan['MONNAIE'],
|
||||
'typeBilan' => $tabBilan['TYPE_BILAN'],
|
||||
'monnaieOrigine' => $tabBilan['MONNAIE_ORI'],
|
||||
'unite' => $tabBilan['MONNAIE_LIV_UNITE'],
|
||||
'postes' => $strPostes,
|
||||
'partenaire' => $tabBilan['SOURCE'],
|
||||
);
|
||||
if (!$this->iDb->insert('bilans', $tabInsert, true)) {
|
||||
$this->iDb->update('bilans', $tabInsert, "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'");
|
||||
}
|
||||
|
||||
$ret = $this->iDb->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'", true);
|
||||
if (count($ret) > 0) {
|
||||
$bilan = $ret[0];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$bilan = $ret[0];
|
||||
}
|
||||
|
||||
|
||||
if (count($ret) > 0) {
|
||||
$bilan = $ret[0];
|
||||
}
|
||||
|
||||
$tabBilan = $tabBilanPre = $bilanPre = array();
|
||||
|
||||
if ($bilan !== null)
|
||||
@ -780,7 +601,7 @@ class MBilans
|
||||
) {
|
||||
|
||||
/** Il n'y a aucune information sur le bilan précédent **/
|
||||
$ret=$this->iDb->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice<'$millesimeDB' ORDER BY dateExercice DESC LIMIT 0,1", true);
|
||||
$ret=$this->iDb->select('jo.bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice<'$millesimeDB' ORDER BY dateExercice DESC LIMIT 0,1", true);
|
||||
$bilanPre=$ret[0];
|
||||
$tabBilan['DATE_CLOTURE_PRE'] = $bilanPre['dateExercice']; // SSAAMMJJ
|
||||
$tabBilan['DUREE_MOIS_PRE'] = $bilanPre['dureeExercice'];
|
||||
@ -1137,7 +958,7 @@ class MBilans
|
||||
$bilanRN=array();
|
||||
foreach ($this->tabBS2BN as $posteRN => $formule) {
|
||||
if (preg_match('/\+|\-/', $formule)) {
|
||||
$tabTmp=preg_split('/\+|\-/', $formule, -1, PREG_SPLIT_OFFSET_CAPTURE);
|
||||
$tabTmp = preg_split('/\+|\-/', $formule, -1, PREG_SPLIT_OFFSET_CAPTURE);
|
||||
//$bilanRN[$posteRN]=0;
|
||||
$scalc='';
|
||||
foreach ($tabTmp as $i=>$tab) {
|
||||
@ -1157,35 +978,55 @@ class MBilans
|
||||
}
|
||||
else $bilanRN[$posteRN]=$bilanRS[$formule];
|
||||
}
|
||||
if ( $bilanRS['240']<>0 ) {
|
||||
$bilanRN['BL']=$bilanRS['050'];
|
||||
$bilanRN['BM']=$bilanRS['052'];
|
||||
|
||||
//Variation de stock (matières premières et approvisionnement)
|
||||
if ( is_numeric($bilanRS['240']) && $bilanRS['240'] != 0 ) {
|
||||
$bilanRN['BL'] = $bilanRS['050'];
|
||||
$bilanRN['BM'] = $bilanRS['052'];
|
||||
$bilanRN['BM1'] = $bilanRS['053'];
|
||||
$bilanRN['BM2'] = $bilanRS['N05'];
|
||||
unset($bilanRN['BN']);
|
||||
unset($bilanRN['BO']);
|
||||
unset($bilanRN['BO1']);
|
||||
unset($bilanRN['BO2']);
|
||||
} else {
|
||||
$bilanRN['BN']=$bilanRS['050'];
|
||||
$bilanRN['BO']=$bilanRS['052'];
|
||||
unset($bilanRN['BL']);
|
||||
unset($bilanRN['BM']);
|
||||
unset($bilanRN['BM1']);
|
||||
unset($bilanRN['BM2']);
|
||||
$bilanRN['BN'] = $bilanRS['050'];
|
||||
$bilanRN['BO'] = $bilanRS['052'];
|
||||
$bilanRN['BO1'] = $bilanRS['053'];
|
||||
$bilanRN['BO2'] = $bilanRS['N05'];
|
||||
}
|
||||
|
||||
if ( $bilanRS['070']<>0 || $bilanRS['074']<>0 || $bilanRS['052']<>0 || $bilanRS['062']<>0 ) {
|
||||
$bilanRN['GC']=$bilanRS['256'];
|
||||
} elseif ($bilanRS['070']==0 && $bilanRS['074']==0 && $bilanRS['052']==0 && $bilanRS['062']==0 && $bilanRS['254']<>0 ) {
|
||||
$bilanRN['GD']=$bilanRS['256'];
|
||||
if ( is_numeric($bilanRS['070']) && $bilanRS['070'] != 0
|
||||
|| is_numeric($bilanRS['074']) && $bilanRS['074'] != 0
|
||||
|| is_numeric($bilanRS['052']) && $bilanRS['052'] != 0
|
||||
|| is_numeric($bilanRS['062']) && $bilanRS['062'] != 0 ) {
|
||||
$bilanRN['GC'] = $bilanRS['256'];
|
||||
} elseif ( $bilanRS['070'] == 0
|
||||
&& $bilanRS['074'] == 0
|
||||
&& $bilanRS['052'] == 0
|
||||
&& $bilanRS['062'] == 0
|
||||
&& intval($bilanRS['254']) > 0 ) {
|
||||
$bilanRN['GD'] = $bilanRS['256'];
|
||||
}
|
||||
|
||||
if ( $bilanRS['584']<>0 ) {
|
||||
$bilanRN['HB']=$bilanRS['584'];
|
||||
$bilanRN['HA']=$bilanRS['290']-$bilanRS['584'];
|
||||
if ( is_numeric($bilanRS['584']) && $bilanRS['584'] != 0 ) {
|
||||
$bilanRN['HB'] = $bilanRS['584'];
|
||||
$bilanRN['HA'] = $bilanRS['290'] - $bilanRS['584'];
|
||||
} else {
|
||||
$bilanRN['HA']=$bilanRS['290'];
|
||||
$bilanRN['HA'] = $bilanRS['290'];
|
||||
}
|
||||
|
||||
if ( $bilanRS['582']<>0 ) {
|
||||
$bilanRN['HF']=$bilanRS['582'];
|
||||
$bilanRN['HE']=$bilanRS['582']-$bilanRS['300'];
|
||||
if ( is_numeric($bilanRS['582']) && $bilanRS['582'] != 0 ) {
|
||||
$bilanRN['HF'] = $bilanRS['582'];
|
||||
$bilanRN['HE'] = $bilanRS['582'] - $bilanRS['300'];
|
||||
} else {
|
||||
$bilanRN['HE']=$bilanRS['300'];
|
||||
$bilanRN['HE'] = $bilanRS['300'];
|
||||
}
|
||||
|
||||
return $bilanRN;
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
@ -29,15 +29,14 @@ class MBilans {
|
||||
|
||||
function listeBilans($uniquementEnBase=true) {
|
||||
//if ($siren<>0) $this->siren=$siren;
|
||||
$iDb2=new WDB('insee');
|
||||
$ret=$iDb2->select( 'bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine',
|
||||
$iDb=new WDB();
|
||||
$ret=$iDb->select( 'jo.bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine',
|
||||
"siren='$this->siren' ORDER BY dateExercice DESC");
|
||||
// if (count($ret)==0) return array(); // Pas de bilan disponible !
|
||||
// else {
|
||||
$tabRet=array();
|
||||
if (!$uniquementEnBase) {
|
||||
$iDb=new WDB('jo');
|
||||
$ret2=$iDb->select( 'bodacc_detail', 'Bodacc_Date_Parution, dateEffet, Bodacc_Num, Bodacc_Date_Parution, Num_Annonce, RC, raisonSociale, FJ, adrSiegeNum, adrSiegeIndRep, adrSiegeTypVoie, adrSiegeLibVoie, adrSiegeComp1, adrSiegeComp2, codePostalSiege, villeSiege', "siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC");
|
||||
$ret2=$iDb->select( 'jo.bodacc_detail', 'Bodacc_Date_Parution, dateEffet, Bodacc_Num, Bodacc_Date_Parution, Num_Annonce, RC, raisonSociale, FJ, adrSiegeNum, adrSiegeIndRep, adrSiegeTypVoie, adrSiegeLibVoie, adrSiegeComp1, adrSiegeComp2, codePostalSiege, villeSiege', "siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC");
|
||||
$dateDerDepot=WDate::dateT('Y-m-d','Ymd',@$ret2[0]['dateEffet'])*1;
|
||||
$dateDerExercice=$ret[0]['dateExercice']*1;
|
||||
if ($dateDerDepot<>0) {
|
||||
@ -65,8 +64,8 @@ class MBilans {
|
||||
|
||||
function getBilan($millesime='', $source=1) {
|
||||
|
||||
$iDb2=new WDB('insee');
|
||||
$ret=$iDb2->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND dateExercice='$millesime'", true);
|
||||
$iDb2=new WDB();
|
||||
$ret=$iDb2->select('jo.bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND dateExercice='$millesime'", true);
|
||||
/*echo $this->siren.'<br/>';
|
||||
echo $millesime.'<br/>';
|
||||
print_r($ret[0]);die();*/
|
||||
@ -87,8 +86,8 @@ class MBilans {
|
||||
'postes' =>$tabBilan['POSTES'],
|
||||
'partenaire' =>1,
|
||||
);
|
||||
$iDb2->insert('bilans', $tabInsert);
|
||||
$ret=$iDb2->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND dateExercice='$millesime'");
|
||||
$iDb2->insert('jo.bilans', $tabInsert);
|
||||
$ret=$iDb2->select('jo.bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND dateExercice='$millesime'");
|
||||
$bilan=$ret[0];
|
||||
}
|
||||
}
|
||||
|
255
library/Metier/partenaires/classMBilansInput.php
Normal file
255
library/Metier/partenaires/classMBilansInput.php
Normal file
@ -0,0 +1,255 @@
|
||||
<?php
|
||||
class MBilansInput
|
||||
{
|
||||
public $CtrlEcartMax = 10;
|
||||
|
||||
public $Ctrl = array (
|
||||
// --- Bilan Simplifié
|
||||
'S' => array(
|
||||
// Actif Simplifié
|
||||
'010-012=013'=>'Fonds commercial (Brut,Amor/Prov et Net incohérents)',
|
||||
'014-016=017'=>'Immos incorpo. autres (Brut,Amor/Prov et Net incohérents)',
|
||||
'028-030=031'=>'Immos corpo. (Brut,Amor/Prov et Net incohérents)',
|
||||
'040-042=043'=>'Immos finan. (Brut,Amor/Prov et Net incohérents)',
|
||||
'044-048=049'=>'Total (I) Actif Immos (Brut,Amor/Prov et Net incohérents)',
|
||||
'010+014+028+040=044'=>'Total Actif immobilisé Brut',
|
||||
'012+016+030+042=048'=>'Total Actif immobilisé Amor/Prov',
|
||||
'013+017+031+043=049'=>'Total Actif immobilisé Net',
|
||||
'050-052=053'=>'Stocks MP (Brut,Amor/Prov et Net incohérents)',
|
||||
'060-062=063'=>'Stocks Marchandises (Brut,Amor/Prov et Net incohérents)',
|
||||
'064-066=067'=>'Avances et acomptes/cmds (Brut,Amor/Prov et Net incohérents)',
|
||||
'068-070=071'=>'Créances clients et CR (Brut,Amor/Prov et Net incohérents)',
|
||||
'072-074=075'=>'Autres créances (Brut,Amor/Prov et Net incohérents)',
|
||||
'080-082=083'=>'VMP (Brut,Amor/Prov et Net incohérents)',
|
||||
'084-086=087'=>'Disponibilités (Brut,Amor/Prov et Net incohérents)',
|
||||
'088-090=091'=>' (Brut,Amor/Prov et Net incohérents)',
|
||||
'092-094=095'=>'Ch. constatées d\'avance (Brut,Amor/Prov et Net incohérents)',
|
||||
'096-098=099'=>'Total (II) Actif Circulant (Brut,Amor/Prov et Net incohérents)',
|
||||
'110-112=113'=>'Total ACTIF (Brut,Amor/Prov et Net incohérents)',
|
||||
'050+060+064+068+072+080+084+088+092=096'=>'Total Actif circulant Brut',
|
||||
'052+062+066+070+074+082+086+090+094=098'=>'Total Actif circulant Amor/Prov',
|
||||
'053+063+067+071+075+083+087+091+092=099'=>'Total Actif circulant Net',
|
||||
'044+096=110'=>'Total ACTIF Brut',
|
||||
'048+098=112'=>'Total ACTIF Amor/Prov',
|
||||
'049+099=113'=>'Total ACTIF Net',
|
||||
// Passif Simplifié
|
||||
'120+124+126+130+132+134+136+140=142'=>'Total Capitaux Propres',
|
||||
'156+164+166+172+174=176'=>'Total Dettes',
|
||||
'142+154+176=180'=>'Total Passif',
|
||||
'113=180'=>'Actif=Passif',
|
||||
// CDR Simplifié
|
||||
'210+214+218+222+224+226+230=232'=>'Total des produits d\'exploitation',
|
||||
'234+236+238+240+242+244+250+252+254+256+262=264'=>'Total des charges d\'exploitation',
|
||||
'210+214+218+222+224+226+230=232'=>'Total des produits d\'exploitation',
|
||||
'232-264=270'=>'Résultat d\'exploitation',
|
||||
'232+280+290-264-294-300-306=310'=>'Résultat d\'exploitation',
|
||||
),
|
||||
// --- Bilan Réel Normal
|
||||
'N' => array(
|
||||
// Actif immobilisé
|
||||
'AA=AA2'=>'Capital souscrit non appelé',
|
||||
'AB-AC=AC1'=>'Frais d\'étab. (Brut,Amor/Prov et Net incohérents)',
|
||||
'AD-AE=AE1'=>'Frais de R&D (Brut,Amor/Prov et Net incohérents)',
|
||||
'AF-AG=AG1'=>'Brevets (Brut,Amor/Prov et Net incohérents)',
|
||||
'AH-AI=AI1'=>'Fonds commercial (Brut,Amor/Prov et Net incohérents)',
|
||||
'AJ-AK=AK1'=>'Autres immo inc. (Brut,Amor/Prov et Net incohérents)',
|
||||
'AL-AM=AM1'=>'Acomptes immo inc. (Brut,Amor/Prov et Net incohérents)',
|
||||
'AN-AO=AO1'=>'Terrains (Brut,Amor/Prov et Net incohérents)',
|
||||
'AP-AQ=AQ1'=>'Constructions (Brut,Amor/Prov et Net incohérents)',
|
||||
'AR-AS=AS1'=>'Installations (Brut,Amor/Prov et Net incohérents)',
|
||||
'AT-AU=AU1'=>'Autres immo corp. (Brut,Amor/Prov et Net incohérents)',
|
||||
'AV-AW=AW1'=>'Immos en cours (Brut,Amor/Prov et Net incohérents)',
|
||||
'AX-AY=AY1'=>'Acomptes immo corp. (Brut,Amor/Prov et Net incohérents)',
|
||||
'CS-CT=CT1'=>'Immo Fi participations/équiv. (Brut,Amor/Prov et Net incohérents)',
|
||||
'CU-CV=CV1'=>'Autres participations (Brut,Amor/Prov et Net incohérents)',
|
||||
'BB-BC=BC1'=>'Créances rattachées à des particip. (Brut,Amor/Prov et Net incohérents)',
|
||||
'BD-BE=BE1'=>'Autres titres immo. (Brut,Amor/Prov et Net incohérents)',
|
||||
'BF-BG=BG1'=>'Prêts (Brut,Amor/Prov et Net incohérents)',
|
||||
'BH-BI=BI1'=>'Autres Immo Financières (Brut,Amor/Prov et Net incohérents)',
|
||||
'BJ-BK=BK1'=>'Total de l\'Actif Immobilisé (Brut,Amor/Prov et Net incohérents)',
|
||||
'AB+AD+AF+AH+AJ+AL+AN+AP+AR+AT+AV+AX+CS+CU+BB+BD+BF+BH=BJ'=>'Total des Immobilisations (Brut)',
|
||||
'AC+AE+AG+AI+AK+AM+AO+AQ+AS+AU+AW+AY+CT+CV+BC+BE+BG+BI=BK'=>'Total des Immobilisations (Amor.)',
|
||||
'AC1+AE1+AG1+AI1+AK1+AM1+AO1+AQ1+AS1+AU1+AW1+AY1+CT1+CV1+BC1+BE1+BG1+BI1=BK1'=>'Total des Immobilisations (Net)',
|
||||
// Actif circulant
|
||||
'BL-BM=BM1'=>'Stocks de MP (Brut,Amor/Prov et Net incohérents)',
|
||||
'BN-BO=BO1'=>'Stocks en cours de prod. biens (Brut,Amor/Prov et Net incohérents)',
|
||||
'BP-BQ=BQ1'=>'Stocks en cours de prod. services (Brut,Amor/Prov et Net incohérents)',
|
||||
'BR-BS=BS1'=>'Stocks produits finis (Brut,Amor/Prov et Net incohérents)',
|
||||
'BT-BU=BU1'=>'Stocks de marchandises (Brut,Amor/Prov et Net incohérents)',
|
||||
'BV-BW=BW1'=>'Avances et acomptes/cmds (Brut,Amor/Prov et Net incohérents)',
|
||||
'BX-BY=BY1'=>'Créances clients (Brut,Amor/Prov et Net incohérents)',
|
||||
'BZ-CA=CA1'=>'Autres créances (Brut,Amor/Prov et Net incohérents)',
|
||||
'CB-CC=CC1'=>'Capital souscrit appelé non versé (Brut,Amor/Prov et Net incohérents)',
|
||||
'CD-CE=CE1'=>'VMP (Brut,Amor/Prov et Net incohérents)',
|
||||
'CF-CG=CG1'=>'Disponibilités (Brut,Amor/Prov et Net incohérents)',
|
||||
'CH-CI=CI1'=>'Charges Const. d\'avance(Brut,Amor/Prov et Net incohérents)',
|
||||
'CJ-CK=CK1'=>'Total de l\'Actif Circulant (Brut,Amor/Prov et Net incohérents)',
|
||||
'BL+BN+BP+BR+BT+BV+BX+BZ+CB+CD+CF+CH=CJ'=>'Total l\'Actif Circulant (Brut)',
|
||||
'BM+BO+BQ+BS+BU+BW+BY+CA+CC+CE+CG+CI=CK'=>'Total l\'Actif Circulant (Amor.)',
|
||||
'BM1+BO1+BQ1+BS1+BU1+BW1+BY1+CA1+CC1+CE1+CG1+CI1=CK1'=>'Total l\'Actif Circulant (Net)',
|
||||
'CL=CL2'=>'Charges / plus. ex. (Brut<>Net)',
|
||||
'CM=CM2'=>'Primes de Rbt obligations (Brut<>Net)',
|
||||
'CN=CN2'=>'Ecarts de conversion d\'actif (Brut<>Net)',
|
||||
'CO-1A=1A1'=>'Total Actif (Brut,Amor/Prov et Net incohérents)',
|
||||
'AA+BJ+CJ+CL+CM+CN=CO'=>'Total Actif Brut',
|
||||
'BK+CK=1A'=>'Total Actif (Amor.)',
|
||||
'AA2+BK1+CK1+CL2+CM2+CN2=1A1'=>'Total Actif Net',
|
||||
// PASSIF
|
||||
'DA+DB+DC+DD+DE+DF+DG+DH+DI+DJ+DK=DL'=>'Passif : s/total I (Capitaux Propres)',
|
||||
'DM+DN=DO'=>'Passif : s/total II (Autres fonds propres)',
|
||||
'DP+DQ=DR'=>'Passif : s/total III (Provisions)',
|
||||
'DS+DT+DU+DV+DW+DX+DY+DZ+EA+EB=EC'=>'Passif : s/total IV (Dettes+Cpt régul. PCA)',
|
||||
'DL+DO+DR+EC+ED=EE'=>'Total Passif',
|
||||
'EE=1A1'=>'Total Actif=Total Passif',
|
||||
// CDR
|
||||
'FA+FB=FC'=>'Total Ventes de marchandises',
|
||||
'FD+FE=FF'=>'Total Production vendue de biens',
|
||||
'FG+FH=FI'=>'Total Production vendue de services',
|
||||
'FJ+FK=FL'=>'Total Chiffe d\'Affaires France+Export',
|
||||
'FA+FD+FG=FJ'=>'Total C.A. France',
|
||||
'FB+FE+FH=FK'=>'Total C.A. Export',
|
||||
'FC+FF+FI=FL'=>'Total C.A. Total (Vtes+Biens+Services)',
|
||||
'FL+FM+FN+FO+FP+FQ=FR'=>'Total I : Produits d\'Exploitation',
|
||||
'FS+FT+FU+FV+FW+FX+FY+FZ+GA+GB+GC+GD+GE=GF'=>'Total II :Charges d\'Exploitation',
|
||||
'FR-GF=GG'=>'1 - Résultat d\'Exploitation',
|
||||
'GJ+GK+GL+GM+GN+GO=GP'=>'Total V : Produits Financiers',
|
||||
'GQ+GR+GS+GT=GU'=>'Total VI : Charges Financières',
|
||||
'GP-GU=GV'=>'2 - Résultat Financier',
|
||||
'GG+GH-GI+GV=GW'=>'3 - R.C.A.I.',
|
||||
'HA+HB+HC=HD'=>'Total VII : Produits Exceptionnels',
|
||||
'HE+HF+HG=HH'=>'Total VIII : Charges Exceptionnels',
|
||||
'HD-HH=HI'=>'4 - Résultat Exceptionnel',
|
||||
'FR+GH+GP+HD=HL'=>'CDR : Total des Produits',
|
||||
'GF+GI+GU+HH+HJ+HK=HM'=>'CDR : Total des Charges',
|
||||
'HL-HM=HN'=>'5 - Résultat de l\'exercice',
|
||||
),
|
||||
);
|
||||
|
||||
public $LibCodeCtrl = array(
|
||||
'_0' => '-',
|
||||
'_1' => 'Corrigé',
|
||||
'_3' => 'Capital',
|
||||
'_5' => 'Calculs', // Anciennement 2 mais maintenant >=5 correspond à une erreur grave
|
||||
'_7' => 'Effectif',
|
||||
'_9' => 'Unité',
|
||||
);
|
||||
|
||||
public $LibCodeSaisie = array(
|
||||
// Code Saisie Bilans par Infogreffe
|
||||
'_00' => 'Bilan saisi sans anomalie',
|
||||
'_01' => 'Bilan saisi avec des incohérences comptables à la source du document (issues du remettant)',
|
||||
'_02' => 'Bilan avec Actif, Passif ou Compte de Résultat nul',
|
||||
'_03' => 'Bilan incomplet (des pages manquent)',
|
||||
'_04' => 'Bilan complet non détaillé (seuls les totaux et sous totaux sont renseignés)',
|
||||
'_05' => 'Bilan reçu en double exemplaire',
|
||||
'_06' => 'Bilan intermédiaire - Situation provisoire',
|
||||
'_07' => 'Bilan illisible',
|
||||
'_A7' => 'Bilan illisible, présentant un cadre gris très foncés (dans lesquels sont inscrits en général les totaux)',
|
||||
'_B7' => 'Bilan manuscrits',
|
||||
'_C7' => 'Bilan illisible, présentant des caractères trop gras',
|
||||
'_D7' => 'Bilan scanné en biais ou qui présentent des pages rognées',
|
||||
'_E7' => 'Bilan numérisés trop clairement (comme une imprimante dont la cartouche est presque vide)',
|
||||
'_F7' => 'Bilan illisible',
|
||||
'_08' => 'Bilan consolidé',
|
||||
'_09' => 'Déclaration d\'impôts',
|
||||
'_10' => 'Document autre que bilan',
|
||||
'_11' => 'Bilan de clôture de liquidation',
|
||||
'_12' => 'Bilan de Société financière',
|
||||
'_13' => 'Bilan de Société d\'assurance',
|
||||
'_14' => 'Bilan de Société immobilière',
|
||||
'_15' => 'Bilan de Société étrangère',
|
||||
// Codes saisie de Bilans spécifique às S&D
|
||||
'_70' => 'Document relatif à une autre société',
|
||||
);
|
||||
|
||||
/**
|
||||
* Décompose le tableau de controle
|
||||
* @param string $type (S | N)
|
||||
* Type du bilan
|
||||
* @return array
|
||||
* Retourne un tableau
|
||||
* [
|
||||
* operation => Chaine de caractère contenant l'operation à effectuer sur les postes
|
||||
* total => Code du poste résultant de l'operation pour comparaison
|
||||
* ]
|
||||
*/
|
||||
protected function formules($type)
|
||||
{
|
||||
$formules = array();
|
||||
if ( array_key_exists($type, $this->Ctrl) ) {
|
||||
foreach ( $this->Ctrl[$type] as $formule => $lib ) {
|
||||
$posEgal = strpos($formule, '=');
|
||||
$partLeft = substr($formule, 0, $posEgal);
|
||||
preg_match_all('/([A-Z0-9]+|(\+|\-))/', $partLeft, $matches);
|
||||
$total = substr($formule, $posEgal+1);
|
||||
$formules[] = array(
|
||||
'operation' => $matches[0],
|
||||
'total' => $total,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $formules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Control les postes
|
||||
* @param string $type (S | N)
|
||||
* Type du bilan
|
||||
* @param array $postes
|
||||
* Tableau des postes d'un bilan Code => Valeur
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
public function control($type, $postes = array() )
|
||||
{
|
||||
$formules = $this->formules($type);
|
||||
|
||||
if ( count($formules) > 0 ) {
|
||||
foreach ( $formules as $formule ) {
|
||||
$checkPostes = array();
|
||||
|
||||
// --- Réaliser le calcul
|
||||
$calc = 0;
|
||||
$signe = null;
|
||||
foreach ( $formule['operation'] as $operation ) {
|
||||
if ( $operation == '-' ) {
|
||||
$signe = '-';
|
||||
} elseif ( $operation == '+' ) {
|
||||
$signe = '+';
|
||||
} else {
|
||||
$checkPostes[] = $operation;
|
||||
// --- Vérification valeur poste
|
||||
if ( !array_key_exists($operation, $postes) ) {
|
||||
$postes[$operation] = 0;
|
||||
}
|
||||
// --- Calcul
|
||||
if ( empty($signe) ) {
|
||||
$calc = $postes[$operation];
|
||||
} elseif ( $signe == '+' ) {
|
||||
$calc+= $postes[$operation];
|
||||
} elseif ( $signe == '-' ) {
|
||||
$calc-= $postes[$operation];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$checkPostes[] = $formule['total'];
|
||||
// --- Effecteur la vérification avec le total
|
||||
if ( !array_key_exists($formule['total'], $postes) ) {
|
||||
$total = 0;
|
||||
} else {
|
||||
$total = $postes[$formule['total']];
|
||||
}
|
||||
if ($calc != $total && !( ($calc - $this->CtrlEcartMax < $total) && ($calc + $this->CtrlEcartMax > $total) ) ) {
|
||||
throw new Exception(join(';',$checkPostes));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -295,22 +295,7 @@ class MEuridile {
|
||||
if ($this->curPage<>'recherche')
|
||||
$this->partInitRecherche();
|
||||
|
||||
$iDb=new WDB('jo');
|
||||
/* $ret=$iDb->select( 'rncs_vitrine',
|
||||
'siren, erreur, rcs, nom, adresse1, cp, ville, fj_lib, naf_code, naf_lib, bilans, dateUpdate',
|
||||
"siren=$this->siren", false, MYSQL_ASSOC);
|
||||
if (count($ret)) {
|
||||
/** On vérifie qu'aucune annonce n'a été publié depuis au bodacc
|
||||
**
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['bilans']=unserialize($tabRet['bilans']);
|
||||
return $tabRet;
|
||||
}
|
||||
}*/
|
||||
|
||||
$iDb=new WDB();
|
||||
$tabRet=$tabBilan=array();
|
||||
$tabRet['siren']=$this->siren;
|
||||
$tabRet['erreur']='';
|
||||
@ -409,8 +394,8 @@ class MEuridile {
|
||||
fclose($fp);
|
||||
$tabInsert=$tabRet;
|
||||
$tabInsert['bilans']=serialize($tabRet['bilans']);
|
||||
if (!$iDb->insert( 'rncs_vitrine', $tabInsert))
|
||||
$iDb->update( 'rncs_vitrine', $tabInsert, "siren=$this->siren");
|
||||
if (!$iDb->insert( 'jo.rncs_vitrine', $tabInsert))
|
||||
$iDb->update( 'jo.rncs_vitrine', $tabInsert, "siren=$this->siren");
|
||||
/** @todo S'il y a un enregistrement, prévoir son update
|
||||
**/
|
||||
|
||||
@ -781,8 +766,8 @@ class MEuridile {
|
||||
if ($this->curPage<>'vitrine')
|
||||
$this->partVitrine();
|
||||
|
||||
$iDb=new WDB('jo');
|
||||
$ret=$iDb->select( 'rncs_entrep',
|
||||
$iDb=new WDB();
|
||||
$ret=$iDb->select( 'jo.rncs_entrep',
|
||||
'siren, rcs, nom, adresse1, adresse2, adresse3, cp, ville, naiss_date, naiss_lieu, sexe, enseigne, sigle, '.
|
||||
'fj_lib, naf_code, naf_lib, date_crea, date_imma, greffe, num_gestion, capital_mnt, capital_dev, nationalite, '.
|
||||
'nb_etab, indRadiation, date_radiation, indProcol, dateUpdate, procedures, dirigeants, etablissements',
|
||||
@ -791,7 +776,7 @@ class MEuridile {
|
||||
/** On vérifie qu'aucune annonce n'a été publié depuis au bodacc
|
||||
**/
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'bodacc_detail', 'count(*)',
|
||||
$ret=$iDb->select( 'jo.bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['procedures']=unserialize($tabRet['procedures']);
|
||||
@ -1005,7 +990,7 @@ class MEuridile {
|
||||
$tabInsert['dirigeants']=serialize($tabRet['dirigeants']);
|
||||
$tabInsert['etablissements']=serialize($tabRet['etablissements']);
|
||||
|
||||
$iDb->insert( 'rncs_entrep', $tabInsert);
|
||||
$iDb->insert( 'jo.rncs_entrep', $tabInsert);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
@ -238,18 +238,6 @@ class MFacto
|
||||
'devise' => $tabPai['CODDEV'],
|
||||
);
|
||||
}
|
||||
//$this->tabPaiements=$tabRet;
|
||||
/*@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Paiements", "SELECT p.NUMACH, DATE_FORMAT(p.DATPIE, '%Y-%m') AS mois,
|
||||
CONCAT(DATE_FORMAT(p.DATPIE,'%Y'),'-',IF(DATE_FORMAT(p.DATPIE,'%m')<4,1,IF(DATE_FORMAT(p.DATPIE,'%m')<7,2,IF(DATE_FORMAT(p.DATPIE,'%m')<10,3,4)))) AS trimestre,
|
||||
count(*) AS nbPieces,
|
||||
AVG(DATEDIFF(NOW(), p.DATECH)) AS nbJourRetard, AVG(DATEDIFF(p.DATPAI, p.DATECH)) AS nbJourPaiement,
|
||||
ROUND(AVG(DATEDIFF(NOW(), p.DATECH) - DATEDIFF(p.DATPAI, p.DATECH))) AS nbJourMoyens,
|
||||
IF(AVG(DATEDIFF(NOW(), p.DATECH) - DATEDIFF( p.DATPAI, p.DATECH ) ) <6, 0, if( AVG( DATEDIFF( NOW( ) , p.DATECH ) - DATEDIFF( p.DATPAI, p.DATECH ) ) <36, 30, if( AVG( DATEDIFF( NOW( ) , p.DATECH ) - DATEDIFF( p.DATPAI, p.DATECH ) ) <66, 60, if( AVG( DATEDIFF( NOW( ) , p.DATECH ) - DATEDIFF( p.DATPAI, p.DATECH ) ) <96, 90, 120 ) ) ) ) AS nbJours,
|
||||
SUM(p.MNTPIE) AS mtPieces, SUM(p.MNTFRF) AS mtPaiements, SUM(p.MNTLIT) AS mtLitiges,
|
||||
p.CODDEV, a.SIRENE, a.RAISOC, a.CODPOS, a.VILLE
|
||||
FROM ge_paiements p LEFT JOIN ge_acheteurs a ON a.NUMACH=p.NUMACH
|
||||
WHERE a.SIRENE=$siren AND DATEDIFF(NOW(),p.DATECH)<736 AND p.DATECH<NOW() $strGroupBy ORDER BY p.DATPIE DESC".EOL.EOL.print_r($tabRet, true).EOL);
|
||||
*/
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
@ -1780,12 +1780,10 @@ class MGreffes
|
||||
"VILLE DE" => "7210",
|
||||
);
|
||||
|
||||
require_once 'i18n/cleanchar.php';
|
||||
|
||||
$search = strtoupper(cleanutf8($txt));
|
||||
|
||||
require_once 'Scores/Locale/String.php';
|
||||
$search = strtoupper(Scores_Locale_String::cleanutf8($txt));
|
||||
foreach ( $list as $item => $code ) {
|
||||
if ( $search == strtoupper(cleanutf8($item)) ) {
|
||||
if ( $search == strtoupper(Scores_Locale_String::cleanutf8($item)) ) {
|
||||
return $code;
|
||||
break;
|
||||
}
|
||||
@ -2110,7 +2108,7 @@ class MGreffes
|
||||
'res' => $return->BilanResultat,
|
||||
'eff' => $return->BilanDateEffectif,
|
||||
);
|
||||
if (!$this->iDb->insert('greffes_identite', $tabInsert, true) ){
|
||||
if (!$this->iDb->insert('jo.greffes_identite', $tabInsert, true) ){
|
||||
//
|
||||
}
|
||||
|
||||
@ -2170,15 +2168,12 @@ class MGreffes
|
||||
|
||||
$label = $xpath->query("span[@class='label']", $n);
|
||||
|
||||
require_once 'i18n/cleanchar.php';
|
||||
switch ( strtoupper(cleanutf8( trim($label) )) ) {
|
||||
require_once 'Scores/Locale/String.php';
|
||||
switch ( strtoupper(Scores_Locale_String::cleanutf8( trim($label) )) ) {
|
||||
case 'CATEGORIE JURIDIQUE :':
|
||||
//Catégorie juridique
|
||||
//<p> <span class="label">Catégorie juridique :</span> <span class="data">Artisan</span> </p>
|
||||
$data = $xpath->query("span[@class='data']", $n);
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case 'ADRESSE :':
|
||||
//Adresse
|
||||
@ -2230,7 +2225,7 @@ class MGreffes
|
||||
'res' => $return->BilanResultat,
|
||||
'eff' => $return->BilanDateEffectif,
|
||||
);
|
||||
if (!$this->iDb->insert('greffes_identite', $tabInsert, true) ){
|
||||
if (!$this->iDb->insert('jo.greffes_identite', $tabInsert, true) ){
|
||||
//
|
||||
}
|
||||
|
||||
@ -2252,7 +2247,7 @@ class MGreffes
|
||||
*/
|
||||
function getIdentite($siren, $refresh=false)
|
||||
{
|
||||
$res=$this->iDb->select('greffes_identite', 'id, siren, nom, nomCommercial, adresse, adresse2, cp, ville, enseigne, siege, fj, fjLib, naf, nafLib, numRC, numRC2, typeRCS, numGreffe, libGreffe, dateCreation, dateRadiation, dateCloture, ca, res, eff, dateInsert', "siren=$siren");
|
||||
$res=$this->iDb->select('jo.greffes_identite', 'id, siren, nom, nomCommercial, adresse, adresse2, cp, ville, enseigne, siege, fj, fjLib, naf, nafLib, numRC, numRC2, typeRCS, numGreffe, libGreffe, dateCreation, dateRadiation, dateCloture, ca, res, eff, dateInsert', "siren=$siren");
|
||||
if (count($res)>0 && !$refresh) {
|
||||
$ent=$res[0];
|
||||
$id=$ent['id'];
|
||||
@ -2786,7 +2781,7 @@ class MGreffes
|
||||
'eff' => $eff,
|
||||
);
|
||||
$dateInsert=date('Y-m-d H:i:s');
|
||||
$id=$this->iDb->insert('greffes_identite', $tabInsert, true);
|
||||
$id=$this->iDb->insert('jo.greffes_identite', $tabInsert, true);
|
||||
//sendMail('debug@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes.php : Debug identite $siren", $this->body);
|
||||
// 997536917
|
||||
}
|
||||
@ -3005,7 +3000,7 @@ class MGreffes
|
||||
$perisable=false;
|
||||
/*`siren` , `dateRequete` , `strXml` , `type` , , `codeErreur`
|
||||
FROM ``*/
|
||||
$res=$this->iDb->select('greffes_requetes', 'dateRequete*1 as dateReq, strXml, codeErreur', "siren=$siren AND type='$type' AND `option`='$option' ORDER BY dateRequete DESC", false, MYSQL_ASSOC);
|
||||
$res=$this->iDb->select('jo.greffes_requetes', 'dateRequete*1 as dateReq, strXml, codeErreur', "siren=$siren AND type='$type' AND `option`='$option' ORDER BY dateRequete DESC", false, MYSQL_ASSOC);
|
||||
//print_r($res);
|
||||
//echo mysql_errno().' : '.mysql_error().EOL;
|
||||
|
||||
@ -3071,7 +3066,7 @@ $xml");
|
||||
'option' => $option,
|
||||
'codeErreur' => $errNum,
|
||||
);
|
||||
$this->iDb->insert('greffes_requetes', $tabInsert, true);
|
||||
$this->iDb->insert('jo.greffes_requetes', $tabInsert, true);
|
||||
//echo EOL.'Insertion réponse Infogreffe'.EOL;
|
||||
}
|
||||
}
|
||||
@ -3697,7 +3692,7 @@ function getListeActes($siren) {
|
||||
'actif' => 1,
|
||||
'dateInsert' => date('YmdHis'),
|
||||
);
|
||||
@$iDb->insert('greffes_actes', $tabInsert);
|
||||
@$iDb->insert('jo.greffes_actes', $tabInsert);
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes::Debug getListeActes($siren)", print_r($tabInsert,true).mysql_error()) ;
|
||||
}
|
||||
}
|
||||
@ -3889,9 +3884,9 @@ function getBilansImages($siren, $ref='') {
|
||||
'type_comptes' => $typeCpt,
|
||||
'mode_diffusion' => implode(',',$tabVecteurs),
|
||||
);
|
||||
if (!$iDb->insert('greffes_bilans', $tabInsert))
|
||||
if (!$iDb->update('greffes_bilans', $tabInsert, "siren='$siren' AND num_depot='$num_depot' AND date_cloture='$dateClotureIso' AND type_comptes='$typeCpt'"))
|
||||
$iDb->update('greffes_bilans', $tabInsert, "siren='$siren' AND num_depot='$num_depot' AND date_cloture='$dateClotureIso' AND type_comptes=''");
|
||||
if (!$iDb->insert('jo.greffes_bilans', $tabInsert))
|
||||
if (!$iDb->update('jo.greffes_bilans', $tabInsert, "siren='$siren' AND num_depot='$num_depot' AND date_cloture='$dateClotureIso' AND type_comptes='$typeCpt'"))
|
||||
$iDb->update('jo.greffes_bilans', $tabInsert, "siren='$siren' AND num_depot='$num_depot' AND date_cloture='$dateClotureIso' AND type_comptes=''");
|
||||
}
|
||||
|
||||
}
|
||||
@ -3901,7 +3896,7 @@ function getBilansImages($siren, $ref='') {
|
||||
|
||||
|
||||
function getInfosCessions($siren) {
|
||||
$ret=$this->iDb->select('greffes_cessions', 'id, siren, nom, libGreffe, inscrit, etat, dateImmat, dateJuge, dateConv, dateLJS, dateInventaire, dateBodacc, caDeclare, effectif, descriptif, pdfLink, pdfSize, pdfVer, pdfPage, descDateDepot, dateLimite, mandataire, dateInsert', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('jo.greffes_cessions', 'id, siren, nom, libGreffe, inscrit, etat, dateImmat, dateJuge, dateConv, dateLJS, dateInventaire, dateBodacc, caDeclare, effectif, descriptif, pdfLink, pdfSize, pdfVer, pdfPage, descDateDepot, dateLimite, mandataire, dateInsert', "siren=$siren", false, MYSQL_ASSOC);
|
||||
if (count($ret)>0) {
|
||||
$tabCes=$ret[0];
|
||||
if (count($ret)>1)
|
||||
@ -4135,7 +4130,7 @@ function getListeCessions($typeProcedure='rj') {
|
||||
$tabInfo['effectif']=trim($matches[1]);
|
||||
|
||||
$tabCessions[]=$tabInfo;
|
||||
$id=$this->iDb->insert('greffes_cessions', $tabInfo, true);
|
||||
$id=$this->iDb->insert('jo.greffes_cessions', $tabInfo, true);
|
||||
if ($id) $nbInsert++;
|
||||
else $nbDeja++;
|
||||
//echo "$k (".$tabInfo['siren'].') : '.$tabInfo['nom']." ($id)".EOL;
|
||||
|
@ -104,8 +104,8 @@ class MIntersud {
|
||||
if ($this->curPage<>'vitrine')
|
||||
$this->partVitrine();
|
||||
|
||||
$iDb=new WDB('jo');
|
||||
$ret=$iDb->select( 'rncs_entrep',
|
||||
$iDb=new WDB();
|
||||
$ret=$iDb->select( 'jo.rncs_entrep',
|
||||
'siren, rcs, nom, adresse1, adresse2, adresse3, cp, ville, naiss_date, naiss_lieu, sexe, enseigne, sigle, '.
|
||||
'fj_lib, naf_code, naf_lib, date_crea, date_imma, greffe, num_gestion, capital_mnt, capital_dev, nationalite, '.
|
||||
'nb_etab, indRadiation, date_radiation, indProcol, dateUpdate, procedures, dirigeants, etablissements',
|
||||
@ -114,7 +114,7 @@ class MIntersud {
|
||||
/** On v<EFBFBD>rifie qu'aucune annonce n'a <EFBFBD>t<EFBFBD> publi<EFBFBD> depuis au bodacc
|
||||
**/
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'bodacc_detail', 'count(*)',
|
||||
$ret=$iDb->select( 'jo.bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['procedures']=unserialize($tabRet['procedures']);
|
||||
@ -328,7 +328,7 @@ class MIntersud {
|
||||
$tabInsert['dirigeants']=serialize($tabRet['dirigeants']);
|
||||
$tabInsert['etablissements']=serialize($tabRet['etablissements']);
|
||||
|
||||
$iDb->insert( 'rncs_entrep', $tabInsert);
|
||||
$iDb->insert( 'jo.rncs_entrep', $tabInsert);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class MLiens {
|
||||
//echo $siren;
|
||||
//print_r($tabIdentite);
|
||||
$nic=$tabIdentite['Nic'];
|
||||
$tab=$this->iDb->select('liens',
|
||||
$tab=$this->iDb->select('jo.liens',
|
||||
'Siren1, ActionPart, Pmin, Pmax, MajMin, PpPm, Siren2, RaisonSociale, Pays, actif, source, dateLien*1 AS dateLien, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate',
|
||||
"Siren1='$siren' AND ActionPart=1 ORDER BY source DESC, actif DESC, Pmin DESC", true, MYSQL_ASSOC);
|
||||
//$tabActiDB=mysql_select('dbo_liens_fi', 'SirenEntite, NomAdresse, PourcentageDetenu, Ville, Lien, MAJLien, MAJImport', "Siren='$siren' AND CodeLien='AC' ORDER BY PourcentageDetenu DESC");
|
||||
@ -77,7 +77,7 @@ class MLiens {
|
||||
$codPays=strtoupper($lien['Pays']);
|
||||
$libPays='';
|
||||
if ($codPays<>'' && $codPays<>'FRA') {
|
||||
$tmp=$this->iDb->select('tabPays', 'libPays', "codPays3='$codPays'", true, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tabPays', 'libPays', "codPays3='$codPays'", true, MYSQL_ASSOC);
|
||||
$libPays=$tmp[0]['libPays'];
|
||||
}
|
||||
if ($lien['MajMin']=='F') $majMin='A';
|
||||
@ -127,7 +127,7 @@ class MLiens {
|
||||
case 7179: // (Autre) Service déconcentré de l'État à compétence territoriale
|
||||
case 7381: // Organisme consulaire
|
||||
/** Ces établissements sont dans le fichier des tribunaux **/
|
||||
$tmp=$this->iDb->select('tribunaux', 'triSiret, triNom, dateUpdate', "triId=(SELECT triIdSup FROM tribunaux WHERE triSiret LIKE '$siren%' LIMIT 1)", true, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tribunaux', 'triSiret, triNom, dateUpdate', "triId=(SELECT triIdSup FROM tribunaux WHERE triSiret LIKE '$siren%' LIMIT 1)", true, MYSQL_ASSOC);
|
||||
$tabCC=$tmp[0];
|
||||
//$sirenCC=substr(,0,9);
|
||||
//if ($siren*1<>$sirenCC*1)
|
||||
@ -293,7 +293,7 @@ class MLiens {
|
||||
else $strFonctions='';
|
||||
$adresse=end(explode(' ', $tabIdentite['AdresseVoie']));
|
||||
$codePostal=$tabIdentite['CP'];
|
||||
$tab=$this->iDb->select('rncs_dirigeants', 'typeDir, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, actif, naissance_nom, naissance_date, naissance_lieu, nat, adresse, fonction_code, fonction_lib, source, cinf, dateInsert, dateUpdate',
|
||||
$tab=$this->iDb->select('jo.rncs_dirigeants', 'typeDir, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, actif, naissance_nom, naissance_date, naissance_lieu, nat, adresse, fonction_code, fonction_lib, source, cinf, dateInsert, dateUpdate',
|
||||
"siren='$siren' AND fonction_lib IN ('Associé-gérant' $strFonctions)", true, MYSQL_ASSOC);
|
||||
$majMin='+';
|
||||
if (count($tab)>1) $majMin='-';
|
||||
@ -364,12 +364,12 @@ class MLiens {
|
||||
'actif'=> 1,
|
||||
'source'=> 1600,
|
||||
'dateInsert'=> date('YmdHis')));
|
||||
$res=$this->iDb->select('liens', 'count(*)', "Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='".addslashes($nom)."' AND Pays='$pays'))");
|
||||
$res=$this->iDb->select('jo.liens', 'count(*)', "Siren1=$siren AND (Siren2=$siren2 OR (RaisonSociale='".addslashes($nom)."' AND Pays='$pays'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$this->iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='".addslashes($nom)."' AND Pays='$pays'))", true))
|
||||
if (!$this->iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>1)), "siren=$siren AND (Siren2=$siren2 OR (RaisonSociale='".addslashes($nom)."' AND Pays='$pays'))", true))
|
||||
$errMaj=1016166;
|
||||
} else {
|
||||
if (!$this->iDb->insert('liens', $tabInsert1, true))
|
||||
if (!$this->iDb->insert('jo.liens', $tabInsert1, true))
|
||||
$errMaj=1016167;
|
||||
}
|
||||
|
||||
@ -382,19 +382,19 @@ class MLiens {
|
||||
'actif'=> 1,
|
||||
'source'=> 1600,
|
||||
'dateInsert'=> date('YmdHis')));
|
||||
$res=$this->iDb->select('liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
$res=$this->iDb->select('jo.liens', 'count(*)', "Siren1=$siren2 AND (Siren2=$siren OR (RaisonSociale='$nom2' AND Pays='$pays2'))");
|
||||
if ($res[0][0]>0) {
|
||||
if (!$this->iDb->update('liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='".addslashes($nom2)."' AND Pays='$pays2'))", true))
|
||||
if (!$this->iDb->update('jo.liens', array_merge($tabUpdate,array('ActionPart'=>2)), "siren=$siren2 AND (Siren2=$siren OR (RaisonSociale='".addslashes($nom2)."' AND Pays='$pays2'))", true))
|
||||
$errMaj=1016168;
|
||||
} else {
|
||||
if (!$this->iDb->insert('liens', $tabInsert2, true))
|
||||
if (!$this->iDb->insert('jo.liens', $tabInsert2, true))
|
||||
$errMaj=1016169;
|
||||
}
|
||||
|
||||
/** Insertion du dirigeant pour l'actionnaire en base **/
|
||||
$dirs=$this->iDb->select('rncs_dirigeants','siren', "siren=$siren2", true, MYSQL_ASSOC);
|
||||
$dirs=$this->iDb->select('jo.rncs_dirigeants','siren', "siren=$siren2", true, MYSQL_ASSOC);
|
||||
if (count($dirs)==0) {
|
||||
$this->iDb->insert('rncs_dirigeants', array( 'siren' => $siren2,
|
||||
$this->iDb->insert('jo.rncs_dirigeants', array( 'siren' => $siren2,
|
||||
'raisonSociale' => $nom,
|
||||
'civilite' => $lien['civilite'],
|
||||
'typeDir' => $lien['typeDir'],
|
||||
@ -468,7 +468,7 @@ class MLiens {
|
||||
public function getParticipations($siren=false, $actifsUniquement=true) {
|
||||
if (!$siren) $siren=$this->siren;
|
||||
$tab=$this->iDb->select(
|
||||
'liens l LEFT JOIN tabPays ON codPays3=Pays',
|
||||
'jo.liens l LEFT JOIN jo.tabPays ON codPays3=Pays',
|
||||
'Siren1, ActionPart, Pmin, Pmax, MajMin, PpPm, Siren2, RaisonSociale, Pays, libPays, actif, source, dateLien*1 AS dateLien, DATE(l.dateInsert)*1 AS dateInsert, DATE(l.dateUpdate)*1 AS dateUpdate',
|
||||
"Siren1='$siren' AND ActionPart=2 ORDER BY source DESC, actif DESC, Pmin DESC", true, MYSQL_ASSOC); // OR Siren2='$siren
|
||||
$tabRet=array();
|
||||
@ -514,7 +514,7 @@ class MLiens {
|
||||
case 7179: // (Autre) Service déconcentré de l'État à compétence territoriale
|
||||
case 7381: // Organisme consulaire
|
||||
/** Ces établissements sont dans le fichier des tribunaux **/
|
||||
$tmp=$this->iDb->select('tribunaux t1', 't1.triSiret, t1.triNom', "t1.triIdSup=(SELECT t2.triId FROM tribunaux t2 WHERE t2.triSiret LIKE '$siren%' AND t2.triId<>t1.triId LIMIT 1)", true, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tribunaux t1', 't1.triSiret, t1.triNom', "t1.triIdSup=(SELECT t2.triId FROM tribunaux t2 WHERE t2.triSiret LIKE '$siren%' AND t2.triId<>t1.triId LIMIT 1)", true, MYSQL_ASSOC);
|
||||
foreach ($tmp as $tabCC) {
|
||||
// $sirenCC=substr($tabCC['triSiret'],0,9);
|
||||
if ($tabCC['triSiret']*1<>0) //$siren*1<>$sirenCC*1)
|
||||
@ -612,7 +612,7 @@ class MLiens {
|
||||
|
||||
public function getEvenements($siren=false) {
|
||||
if (!$siren) $siren=$this->siren;
|
||||
$tab=$this->iDb->select('rncs_even_info', 'siren, dateDepot, codeEven, depot_num, depot_date, acte_num, acte_date, acte_type, acte_lib, acte_pages, acte_nature, acte_decision, collecte, flux, dateInsert',
|
||||
$tab=$this->iDb->select('jo.rncs_even_info', 'siren, dateDepot, codeEven, depot_num, depot_date, acte_num, acte_date, acte_type, acte_lib, acte_pages, acte_nature, acte_decision, collecte, flux, dateInsert',
|
||||
"siren='$siren' AND codeEven IN(2,5,6,7,8,9,10,13,31,32,63)", true, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
foreach ($tab as $i=>$lien) {
|
||||
@ -879,15 +879,15 @@ class MLiens {
|
||||
**/
|
||||
public function getInfoGroupe($siren) {
|
||||
if ($siren<1000) return false;
|
||||
$tmp=$this->iDb->select('etablissements_act',
|
||||
$tmp=$this->iDb->select('jo.etablissements_act',
|
||||
'raisonSociale, enseigne, sigle, identite_pre, adr_num, adr_btq, adr_typeVoie, adr_libVoie, adr_comp, adr_cp, adr_ville, adr_dep, adr_com, tel, fax, siren, sirenGrp',
|
||||
"siren=(SELECT distinct sirenGrp FROM etablissements_act WHERE siren=$siren AND siege=1) LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
"siren=(SELECT distinct sirenGrp FROM jo.etablissements_act WHERE siren=$siren AND siege=1) LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tabEnt=$tmp[0];
|
||||
$sirenGrp=$tabEnt['siren'];
|
||||
|
||||
if ($sirenGrp<1000) return false;
|
||||
/** Table des Nafs5 => Secteurs **/
|
||||
$tmp=$this->iDb->select('tabNaf5', 'codNaf2, codNaf1', '1 GROUP BY codNAf2', false, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('jo.tabNaf5', 'codNaf2, codNaf1', '1 GROUP BY codNAf2', false, MYSQL_ASSOC);
|
||||
$tabNAf2=array();
|
||||
foreach ($tmp as $tmp2) {
|
||||
$tabNAf2[$tmp2['codNaf2']]=$tmp2['codNaf1'];
|
||||
|
@ -420,7 +420,7 @@ class MLiens2
|
||||
*/
|
||||
public function getCAC40()
|
||||
{
|
||||
$sql = "SELECT isin, nom, MAX(`date`) AS dateMAJ FROM sdv1.bourse_listes WHERE lstCode='xcac40p' GROUP BY lstCode, isin HAVING MAX(`date`) ORDER BY dateMAJ DESC;";
|
||||
$sql = "SELECT isin, nom, MAX(`date`) AS dateMAJ FROM sdv1.bourse_listes WHERE lstCode='xcac40p' GROUP BY lstCode, isin HAVING MAX(`date`) ORDER BY dateMAJ DESC;";
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
$output = array();
|
||||
|
@ -950,13 +950,13 @@ class MMap {
|
||||
**/
|
||||
public function geoCodeAdresse($adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville='', $pays='France', $codeRivoli='')
|
||||
{
|
||||
$tabRep=array();
|
||||
$adresse=addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie")));
|
||||
$ville=addslashes($ville);
|
||||
$ret = $this->iDb->select('zonageXY',
|
||||
'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, dateInsert',
|
||||
$tabRep = array();
|
||||
$adrNum = str_pad($adrNum, 4, 0, STR_PAD_LEFT);
|
||||
$adresse = addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie")));
|
||||
$ville = addslashes($ville);
|
||||
$ret = $this->iDb->select('jo.zonageXY', 'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, dateInsert',
|
||||
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'", false, MYSQL_ASSOC);
|
||||
|
||||
|
||||
//Existe dans la base
|
||||
if (count($ret)>0) {
|
||||
$zonage=$ret[0];
|
||||
@ -984,7 +984,7 @@ class MMap {
|
||||
'l93_x'=>$this->l93x,
|
||||
'l93_y'=>$this->l93y
|
||||
);
|
||||
$this->iDb->update('zonageXY', $tabUpdate, "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'");
|
||||
$this->iDb->update('jo.zonageXY', $tabUpdate, "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'");
|
||||
}
|
||||
|
||||
$this->latitudeDeg = dec2dms($this->latitudeDec);
|
||||
@ -1061,7 +1061,7 @@ class MMap {
|
||||
if ($this->latitudeDec<>0 && $this->longitudeDec<>0 && $this->precision>0) {
|
||||
// print_r($tabInsert);
|
||||
//echo ($this->latitudeDec.EOL.$this->longitudeDec.EOL);
|
||||
$this->iDb->insert('zonageXY', $tabInsert);
|
||||
$this->iDb->insert('jo.zonageXY', $tabInsert);
|
||||
/*if (mysql_errno()>0) echo mysql_error().die(EOL);*/
|
||||
} else {
|
||||
$this->precision=$this->latitudeDec=$this->longitudeDec=0;
|
||||
|
@ -839,22 +839,6 @@ Une marque figurative
|
||||
if ($this->curPage<>'recherche')
|
||||
$this->partInitRecherche();
|
||||
|
||||
$iDb=new WDB('jo');
|
||||
/* $ret=$iDb->select( 'rncs_vitrine',
|
||||
'siren, erreur, rcs, nom, adresse1, cp, ville, fj_lib, naf_code, naf_lib, bilans, dateUpdate',
|
||||
"siren=$this->siren", false, MYSQL_ASSOC);
|
||||
if (count($ret)) {
|
||||
/** On vérifie qu'aucune annonce n'a été publié depuis au bodacc
|
||||
**
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['bilans']=unserialize($tabRet['bilans']);
|
||||
return $tabRet;
|
||||
}
|
||||
}*/
|
||||
|
||||
$tabRet=$tabBilan=array();
|
||||
$tabRet['siren']=$this->siren;
|
||||
$tabRet['erreur']='';
|
||||
@ -953,8 +937,8 @@ Une marque figurative
|
||||
fclose($fp);
|
||||
$tabInsert=$tabRet;
|
||||
$tabInsert['bilans']=serialize($tabRet['bilans']);
|
||||
if (!$iDb->insert( 'rncs_vitrine', $tabInsert))
|
||||
$iDb->update( 'rncs_vitrine', $tabInsert, "siren=$this->siren");
|
||||
if (!$this->iDb->insert( 'jo.rncs_vitrine', $tabInsert))
|
||||
$this->iDb->update( 'jo.rncs_vitrine', $tabInsert, "siren=$this->siren");
|
||||
/** @todo S'il y a un enregistrement, prévoir son update
|
||||
**/
|
||||
|
||||
@ -1325,8 +1309,7 @@ Une marque figurative
|
||||
if ($this->curPage<>'vitrine')
|
||||
$this->partVitrine();
|
||||
|
||||
$iDb=new WDB('jo');
|
||||
$ret=$iDb->select( 'rncs_entrep',
|
||||
$ret=$this->iDb->select( 'jo.rncs_entrep',
|
||||
'siren, rcs, nom, adresse1, adresse2, adresse3, cp, ville, naiss_date, naiss_lieu, sexe, enseigne, sigle, '.
|
||||
'fj_lib, naf_code, naf_lib, date_crea, date_imma, greffe, num_gestion, capital_mnt, capital_dev, nationalite, '.
|
||||
'nb_etab, indRadiation, date_radiation, indProcol, dateUpdate, procedures, dirigeants, etablissements',
|
||||
@ -1335,7 +1318,7 @@ Une marque figurative
|
||||
/** On vérifie qu'aucune annonce n'a été publié depuis au bodacc
|
||||
**/
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'bodacc_detail', 'count(*)',
|
||||
$ret=$iDb->select( 'jo.bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['procedures']=unserialize($tabRet['procedures']);
|
||||
@ -1549,7 +1532,7 @@ Une marque figurative
|
||||
$tabInsert['dirigeants']=serialize($tabRet['dirigeants']);
|
||||
$tabInsert['etablissements']=serialize($tabRet['etablissements']);
|
||||
|
||||
$iDb->insert( 'rncs_entrep', $tabInsert);
|
||||
$iDb->insert( 'jo.rncs_entrep', $tabInsert);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class MPrivileges
|
||||
$fields = "i.id, i.dateEven, i.greffe , i.numDebiteur, i.sirenage, i.typeEven, i.dateFraiche, i.codeRev , i.debRaisonSociale , i.debSigle , i.debCiv , i.debNom , i.debPrenom , i.debConjoint , i.debUsage , i.debEnseigne , i.debActivite , i.debFj , i.debFjLib , i.debResidence , i.debNumVoie , i.debTypVoie , i.debLibVoie , i.debAdrComp , i.debCP , i.debVille , i.debPays , i.insType , i.insLib , i.insNum , i.insDate , i.insObjet , i.insMontant , i.insDev , i.insDateEch , i.insDateFin , i.insNanTx , i.insNanTitre , i.insNanOppo , i.insProNat , i.insProHui , i.insProRep , i.insNSCA , i.insNSCParts , i.insNSCSigni , i.creNom , i.creNumVoi, i.creTypVoi, i.creLibVoi, i.creAdrComp1, i.creAdrComp2, i.creCP, i.creVille, i.crePays, i.creAutres, i.radDate, i.radMention, i.radPartiel, i.radPartMt, i.radDev, i.radDiv, i.idFichier, i.dateInsert";
|
||||
$where = "i.siren=$siren $strTypes AND ( (i.insType='03' AND DATEDIFF(NOW(),i.insDate)<=900) /** Durée de vie PRIV Sécu **/ OR (i.insType='04' AND DATEDIFF(NOW(),i.insDate)<=1460) /** Durée de vie PRIV Trésor **/ )";
|
||||
$where.= " ORDER BY i.dateFraiche DESC, i.insType ASC, i.insDate ASC;";
|
||||
$tables = "greffes_privileges i";
|
||||
$tables = "jo.greffes_privileges i";
|
||||
|
||||
$iRncs = new MRncs($this->iDb);
|
||||
$tabRet = array();
|
||||
|
@ -18,7 +18,7 @@ class MQualibat {
|
||||
|
||||
function __construct($accesDist=true) {// $adresse, $cp, $ville, $pays='France') {
|
||||
$this->accesDist=$accesDist;
|
||||
$this->iDb=new WDb('sdv1');
|
||||
$this->iDb=new WDB();
|
||||
$this->iBodacc=new MBodacc();
|
||||
$this->$iInsee=new MInsee();
|
||||
}
|
||||
@ -112,7 +112,7 @@ Gérer en fonction du code CJ
|
||||
}
|
||||
|
||||
public function getMaxQualibat() {
|
||||
$ret=$this->iDb->select('qualibat','MAX(id) AS id', '1', false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('sdv1.qualibat','MAX(id) AS id', '1', false, MYSQL_ASSOC);
|
||||
return $ret[0]['id'];
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ Gérer en fonction du code CJ
|
||||
$tabQualibatCalc[]=$i;
|
||||
|
||||
// Liste des Qualibat en base
|
||||
$ret=$this->iDb->select('qualibat','id', '1 ORDER BY id ASC', false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('sdv1.qualibat','id', '1 ORDER BY id ASC', false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$res)
|
||||
$tabQualibatBase[]=$res['id'];
|
||||
|
||||
@ -138,19 +138,19 @@ Gérer en fonction du code CJ
|
||||
$strWhere="id=$idQualibat";
|
||||
} else return false;
|
||||
|
||||
$ret=$this->iDb->select('qualibat','siren, actif, id, nom, adresse, cp, ville, tel, fax, email, web,
|
||||
$ret=$this->iDb->select('sdv1.qualibat','siren, actif, id, nom, adresse, cp, ville, tel, fax, email, web,
|
||||
eff, teff, ca, tca, libFJ, nace, dateFondation, dateDeb, dateFin, dateInsert', $strWhere, false, MYSQL_ASSOC);
|
||||
if (!$this->force && count($ret)>0) {
|
||||
$this->enCache=true;
|
||||
$tabRet=$ret[0];//array();
|
||||
|
||||
// Ajout des qualifications
|
||||
$ret=$this->iDb->select('qualibatqualif','code, periodQualif, niveauQualif, mentions, nomQualif, dateAttrib, dateEch', $strWhere, false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('sdv1.qualibatqualif','code, periodQualif, niveauQualif, mentions, nomQualif, dateAttrib, dateEch', $strWhere, false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$tabTmp)
|
||||
$tabRet['qualifications'][]=$tabTmp;
|
||||
|
||||
// Ajout des dirigeants
|
||||
$ret=$this->iDb->select('qualibatdir','civNomPrenom, civilite, nom, prenom, fonction', $strWhere, false, MYSQL_ASSOC);
|
||||
$ret=$this->iDb->select('sdv1.qualibatdir','civNomPrenom, civilite, nom, prenom, fonction', $strWhere, false, MYSQL_ASSOC);
|
||||
foreach ($ret as $i=>$tabTmp)
|
||||
$tabRet['dirigeants'][]=$tabTmp;
|
||||
} elseif ($this->accesDist==true) {
|
||||
@ -168,7 +168,7 @@ Gérer en fonction du code CJ
|
||||
$this->erreur='Numéro Qualibat inexistant';
|
||||
// On enregistre ce numéro comme non attribué si < au dernier numéro attribué
|
||||
if ($idQualibat<$this->getMaxQualibat())
|
||||
$this->iDb->insert('qualibat', $tabInsert);
|
||||
$this->iDb->insert('sdv1.qualibat', $tabInsert);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -306,8 +306,8 @@ Gérer en fonction du code CJ
|
||||
'dateDeb'=>@$tabDateAttrib[0],
|
||||
'dateFin'=>@$tabDateFin[0]));
|
||||
unset($tabInsert['qualifications']);
|
||||
if (!$this->iDb->insert('qualibat', $tabInsert)) {
|
||||
$this->iDb->update('qualibat', $tabInsert, "id=$idQualibat");
|
||||
if (!$this->iDb->insert('sdv1.qualibat', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibat', $tabInsert, "id=$idQualibat");
|
||||
}
|
||||
|
||||
|
||||
@ -318,8 +318,8 @@ Gérer en fonction du code CJ
|
||||
$tabInsert['id']=$idQualibat;
|
||||
$tabInsert['siren']=$siren;
|
||||
$tabInsert['dateInsert']=date('YmdHis');
|
||||
if (!$this->iDb->insert('qualibatqualif', $tabInsert)) {
|
||||
$this->iDb->update('qualibatqualif', $tabInsert, "id=$idQualibat AND code='".$tabInsert['code']."' AND periodQualif='".$tabInsert['periodQualif']."'");
|
||||
if (!$this->iDb->insert('sdv1.qualibatqualif', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibatqualif', $tabInsert, "id=$idQualibat AND code='".$tabInsert['code']."' AND periodQualif='".$tabInsert['periodQualif']."'");
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,8 +330,8 @@ Gérer en fonction du code CJ
|
||||
$tabInsert['id']=$idQualibat;
|
||||
$tabInsert['siren']=$siren;
|
||||
$tabInsert['dateInsert']=date('YmdHis');
|
||||
if (!$this->iDb->insert('qualibatdir', $tabInsert)) {
|
||||
$this->iDb->update('qualibatdir', $tabInsert, "id=$idQualibat AND civNomPrenom='".addslashes($tabInsert['civNomPrenom'])."' AND fonction='".addslashes($tabInsert['fonction'])."'");
|
||||
if (!$this->iDb->insert('sdv1.qualibatdir', $tabInsert)) {
|
||||
$this->iDb->update('sdv1.qualibatdir', $tabInsert, "id=$idQualibat AND civNomPrenom='".addslashes($tabInsert['civNomPrenom'])."' AND fonction='".addslashes($tabInsert['fonction'])."'");
|
||||
}
|
||||
unset($tabRet['dirigeants'][$i]['civNomPrenom']);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class MRncs
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$tabDevises=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabDevises[$dev['devInpi']*1]=$dev['devIso'];
|
||||
@ -120,7 +120,7 @@ class MRncs
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('tabJugeRncs', 'codJugement, codEven', '1', false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.tabJugeRncs', 'codJugement, codEven', '1', false, MYSQL_ASSOC);
|
||||
$tabJug=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabJug[$dev['codJugement']*1]=$dev['codEven'];
|
||||
@ -146,7 +146,7 @@ class MRncs
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('tabPays', 'codePaysInpi, codPays', 'codePaysInpi>0', false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.tabPays', 'codePaysInpi, codPays', 'codePaysInpi>0', false, MYSQL_ASSOC);
|
||||
$tabPays=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabPays[$dev['codePaysInpi']*1]=$dev['codPays'];
|
||||
@ -158,7 +158,7 @@ class MRncs
|
||||
/** Tableau des mandataires suceptibles d'être tranmis par l'INPI
|
||||
**/
|
||||
private function getTabMandataires() {
|
||||
$tabTmp=$this->iDb->select('tabMandataires', "UPPER(CONCAT(SUBSTRING(Nom,1,4),'-',SUBSTRING(Prenom,1,3))) AS NomPre, SUBSTRING(cp,1,2) AS dep, COUNT(*) AS Nb, sirenMand, id, sirenGrp, Nom, Prenom, type, coursAppel, tribunal, Statut, adresse, adresseComp, cp, ville, tel, fax, email, web, contact", "TYPE IN ('A', 'M') GROUP BY NomPre, dep, sirenMand ORDER BY NomPre ASC", true, MYSQL_ASSOC);
|
||||
$tabTmp=$this->iDb->select('jo.tabMandataires', "UPPER(CONCAT(SUBSTRING(Nom,1,4),'-',SUBSTRING(Prenom,1,3))) AS NomPre, SUBSTRING(cp,1,2) AS dep, COUNT(*) AS Nb, sirenMand, id, sirenGrp, Nom, Prenom, type, coursAppel, tribunal, Statut, adresse, adresseComp, cp, ville, tel, fax, email, web, contact", "TYPE IN ('A', 'M') GROUP BY NomPre, dep, sirenMand ORDER BY NomPre ASC", true, MYSQL_ASSOC);
|
||||
$tabMandSD=array();
|
||||
foreach ($tabTmp as $mand) {
|
||||
$tabMandSD[]=array( 'id' => $mand['id'],
|
||||
@ -196,7 +196,7 @@ class MRncs
|
||||
|
||||
//echo "Recherche de '$strNomPrenom, $adresse, $cp $ville' dans les mandataires S&D :".EOL;
|
||||
|
||||
$tabTmp=$this->iDb->select( 'tabMandataires',
|
||||
$tabTmp=$this->iDb->select( 'jo.tabMandataires',
|
||||
"id, Nom, Prenom, adresse, adresseComp, cp, ville, MATCH (Nom, Prenom, adresse, adresseComp, ville) AGAINST ('$strNomPrenom $adresse $ville' IN NATURAL LANGUAGE MODE) AS score",
|
||||
"TYPE IN ('A', 'M') AND (Nom<>'' OR Prenom <>'') AND MATCH (Nom, Prenom, adresse, adresseComp, ville) AGAINST ('$strNomPrenom $adresse $ville' IN NATURAL LANGUAGE MODE) ORDER BY score DESC LIMIT 0,10",false, MYSQL_ASSOC);
|
||||
$nbRet=count($tabTmp);
|
||||
@ -244,7 +244,7 @@ class MRncs
|
||||
if ( file_exists($cache) ) {
|
||||
return include $cache;
|
||||
} else {
|
||||
$rep=$this->iDb->select('tribunaux', 'triNumGreffe, triNom, triId, triCode', 'triNumGreffe IS NOT NULL', false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.tribunaux', 'triNumGreffe, triNom, triId, triCode', 'triNumGreffe IS NOT NULL', false, MYSQL_ASSOC);
|
||||
$tabTribunaux=array();
|
||||
foreach($rep as $k=>$dev) {
|
||||
$tabTribunaux[$dev['triNumGreffe']*1]['Id']=$dev['triId'];
|
||||
@ -264,7 +264,7 @@ class MRncs
|
||||
{
|
||||
$fj=$code_forme_juridique*1;
|
||||
if ($fj>0 && $fj<10000) {
|
||||
$tmp=$this->iDb->select('tabFJur', 'libelle AS LibFJ', "code=$fj");
|
||||
$tmp=$this->iDb->select('jo.tabFJur', 'libelle AS LibFJ', "code=$fj");
|
||||
return @$tmp[0][0];
|
||||
} else
|
||||
return 'En instance de chiffrement';
|
||||
@ -277,9 +277,9 @@ class MRncs
|
||||
*/
|
||||
private function getLibelleNaf($codeNaf)
|
||||
{
|
||||
$ret=$this->iDb->query("SELECT libNaf700 AS LibNaf FROM tabNaf4 WHERE codNaf700='$codeNaf' UNION
|
||||
SELECT libNaf5 AS LibNaf FROM tabNaf5 WHERE codNaf5='$codeNaf'");
|
||||
$res=$this->iDb->fetch(MYSQL_ASSOC);
|
||||
$ret = $this->iDb->query("SELECT libNaf700 AS LibNaf FROM jo.tabNaf4 WHERE codNaf700='$codeNaf'
|
||||
UNION SELECT libNaf5 AS LibNaf FROM jo.tabNaf5 WHERE codNaf5='$codeNaf'");
|
||||
$res = $this->iDb->fetch(MYSQL_ASSOC);
|
||||
return $res['LibNaf'];
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ class MRncs
|
||||
if ($nic>0) $strSql=" AND nic=$nic";
|
||||
else $strSql=" AND siege=1 ORDER BY actif DESC, nic DESC";
|
||||
|
||||
$rep=$this->iDb->select('rncs_etab', 'siren, nic, siege, actif, enseigne, nomCommercial, adrNumVoie, adrIndRep, adrLibVoie, adrTypeVoie, adrVoie, cp, commune, adrComp, adresse1, adresse2, adresse3, naf, dateFermeture, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren $strSql", false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.rncs_etab', 'siren, nic, siege, actif, enseigne, nomCommercial, adrNumVoie, adrIndRep, adrLibVoie, adrTypeVoie, adrVoie, cp, commune, adrComp, adresse1, adresse2, adresse3, naf, dateFermeture, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren $strSql", false, MYSQL_ASSOC);
|
||||
if ( count($rep)==0 ) {
|
||||
return false;
|
||||
}
|
||||
@ -384,7 +384,7 @@ class MRncs
|
||||
public function getInfosEntrep($siren)
|
||||
{
|
||||
$siren=$siren*1;
|
||||
$rep=$this->iDb->select('rncs_entrep', 'siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.rncs_entrep', 'siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
|
||||
if (count($rep)>0) {
|
||||
$entrep=$rep[0];
|
||||
@ -443,7 +443,7 @@ class MRncs
|
||||
}
|
||||
|
||||
$rep=$this->iDb->select(
|
||||
'rncs_even e LEFT JOIN tabEvenRncs l ON e.codeEven=l.codeEven',
|
||||
'jo.rncs_even e LEFT JOIN jo.tabEvenRncs l ON e.codeEven=l.codeEven',
|
||||
'e.siren, e.codeInterne, e.dateDepot, e.codeEven, l.libEven, e.flux, DATE(e.dateInsert) AS dateInsert',
|
||||
$where, false, MYSQL_ASSOC);
|
||||
|
||||
@ -472,7 +472,7 @@ class MRncs
|
||||
{
|
||||
$siren=$siren*1;
|
||||
$rep=$this->iDb->select(
|
||||
'rncs_jugements j, tabJugeRncs l, tabEvenements e',
|
||||
'jo.rncs_jugements j, jo.tabJugeRncs l, jo.tabEvenements e',
|
||||
'siren, j.dateEffet, j.codeJugement, j.flux, l.libJugement, e.codEven, e.libEven,
|
||||
adm1id, adm1codeFct, adm1type, adm1nom, adm1adrNum, adm1adrInd, adm1adrType, adm1adrLibVoie, adm1adrVoie, adm1adr1, adm1adr2, adm1adr3, adm1adrCP, adm1adrVille,
|
||||
adm2id, adm2codeFct, adm2type, adm2nom, adm2adrNum, adm2adrInd, adm2adrType, adm2adrLibVoie, adm2adrVoie, adm2adr1, adm2adr2, adm2adr3, adm2adrCP, adm2adrVille',
|
||||
@ -534,7 +534,7 @@ class MRncs
|
||||
if ($dateFin<>'') $strDateFin=" AND flux<='$dateFin' ";
|
||||
|
||||
$rep=$this->iDb->select(
|
||||
'rncs_modifs',
|
||||
'jo.rncs_modifs',
|
||||
'siren, nic, `table`, champs, valeur, flux, dateInsert',
|
||||
"siren=$siren $strNic $strType $strDateDeb $strDateFin AND `table`='rncs_entrep' ORDER BY flux DESC", false, MYSQL_ASSOC);
|
||||
foreach ($rep as $iModif=>$modif) {
|
||||
@ -639,7 +639,7 @@ class MRncs
|
||||
$strDates='';
|
||||
}
|
||||
|
||||
$tabTmp=$this->iDb->select('annonces', 'id, siren, typeEven, dateJugement, dateCessationPaiement, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom,
|
||||
$tabTmp=$this->iDb->select('jo.annonces', 'id, siren, typeEven, dateJugement, dateCessationPaiement, inter1type, inter1id, inter1nom, inter2type, inter2id, inter2nom, inter3type, inter3id, inter3nom, inter4type, inter4id, inter4nom,
|
||||
dateSource, dateInsert, source, tribunal, raisonSociale',"siren=$siren $strDates AND ( inter1type $strTypes OR inter2type $strTypes OR inter3type $strTypes OR inter4type $strTypes ) AND typeEven BETWEEN 1000 AND 2000 ORDER BY dateJugement DESC", false, MYSQL_ASSOC);
|
||||
if (isset($tabTmp[0])) {
|
||||
$depot=$tabTmp[0];
|
||||
@ -818,7 +818,7 @@ class MRncs
|
||||
$tabInsert['dateDemande']=date('Ymd');
|
||||
if ($origineDemande<>'')
|
||||
$tabInsert['origineDemande']=$origineDemande;
|
||||
$this->iDb->insert('rncs_demandes', $tabInsert, false);
|
||||
$this->iDb->insert('jo.rncs_demandes', $tabInsert, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -862,7 +862,7 @@ class MRncs
|
||||
$tabInsert['dateDemande']=date('Ymd');
|
||||
if ($origineDemande<>'')
|
||||
$tabInsert['origineDemande']=$origineDemande;
|
||||
$this->iDb->insert('rncs_demandes', $tabInsert, false);
|
||||
$this->iDb->insert('jo.rncs_demandes', $tabInsert, false);
|
||||
|
||||
// Une erreur ?
|
||||
if ($this->infoIMR['validation-erreur']<>'')
|
||||
@ -879,7 +879,7 @@ class MRncs
|
||||
$siren=$siren*1;
|
||||
$tabRet=array();
|
||||
$dirs=$this->iDb->select(
|
||||
'rncs_dirigeants',
|
||||
'jo.rncs_dirigeants',
|
||||
'siren, raisonSociale, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert',
|
||||
"siren=$siren AND actif%10=1 ORDER BY fonction_code DESC", true, MYSQL_ASSOC);
|
||||
$numDir=0;
|
||||
@ -917,7 +917,7 @@ class MRncs
|
||||
}
|
||||
if ($numDir==0) {
|
||||
$dirs=$this->iDb->select(
|
||||
'rncs_entrep',
|
||||
'jo.rncs_entrep',
|
||||
"siren, raisonSociale, '' AS dirRS, IF(sexe='M', 'M', IF(sexe='F', 'MME', '')) AS civilite, nom, prenom, nomUsage AS naissance_nom, dateNaiss AS naissance_date, lieuNaiss AS naissance_lieu, 1050 AS fonction_code, 'Personne Physique' AS fonction_lib, 0 AS cinf, dateFer AS dateFin, flux, dateInsert",
|
||||
"siren=$siren", true, MYSQL_ASSOC);
|
||||
$numDir=0;
|
||||
|
@ -598,24 +598,24 @@ class MRncsFlux {
|
||||
' <ort:_27 type="010">'.$prod['Num'].'</ort:_27>'. "\n". // Numéro de produit souhaité 1 2
|
||||
' <ort:_28 type="010">'.$prod['Ver'].'</ort:_28>'. "\n". // Version du produit 3 2
|
||||
' <ort:_31 type="010">'.$prod['Presta'].'</ort:_31>'. "\n". // Code prestation (vide pour QVIT)
|
||||
' </ort:_1>'. "\n";
|
||||
' </ort:_1>'. "\n";
|
||||
if ($prod['Presta']==12004 || $prod['Presta']==12003) {
|
||||
$req.='
|
||||
<ort:_2 type="110">
|
||||
<ort:_100 type="111">
|
||||
<ort:_101 type="110">
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
<ort:_100700010 type="010">FTP</ort:_100700010>
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
<ort:_100700010 type="010">FTP</ort:_100700010>
|
||||
<ort:_100701000 type="010">NTIF</ort:_100701000>
|
||||
<ort:_120000015 type="010" />
|
||||
<ort:_120000015 type="010" />
|
||||
</ort:_101>
|
||||
</ort:_100>
|
||||
<ort:_200 type="111">
|
||||
<ort:_210 type="110">
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_103000402 type="010">'.$prod['CmdNom'].'</ort:_103000402>
|
||||
<ort:_103000403 type="010">'.$prod['CmdPages'].'</ort:_103000403>
|
||||
<ort:_190000025 type="010">'.$prod['CmdBilan'].'</ort:_190000025>
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_103000402 type="010">'.$prod['CmdNom'].'</ort:_103000402>
|
||||
<ort:_103000403 type="010">'.$prod['CmdPages'].'</ort:_103000403>
|
||||
<ort:_190000025 type="010">'.$prod['CmdBilan'].'</ort:_190000025>
|
||||
</ort:_210>
|
||||
</ort:_200>
|
||||
</ort:_2>'; //
|
||||
@ -648,7 +648,7 @@ $params=md5(serialize($prod));
|
||||
/*if ($prod['CmdNom']<>'' || $prod['CmdPages']<>'' || $prod['CmdBilan']<>'' || $prod['Millesime']<>'')
|
||||
$strOption=*/
|
||||
//AND params='$params'
|
||||
$res=$this->iDb->select('rncs_requetes', 'dateRequete, strXml, codeErreur, libErreur', "siren=$siren AND params='$params' AND (type<>'QVIT' OR (type='QVIT' AND DATEDIFF(NOW(),dateRequete)<=1)) ORDER BY dateRequete DESC");
|
||||
$res=$this->iDb->select('jo.rncs_requetes', 'dateRequete, strXml, codeErreur, libErreur', "siren=$siren AND params='$params' AND (type<>'QVIT' OR (type='QVIT' AND DATEDIFF(NOW(),dateRequete)<=1)) ORDER BY dateRequete DESC");
|
||||
//type='".$prod['Type']."' AND presta ='".$prod['Presta']."' $strOption ORDER BY dateRequete DESC");
|
||||
if (count($res)>0) {
|
||||
$tabRes=$res[0];
|
||||
@ -658,7 +658,7 @@ if (count($res)>0) {
|
||||
$this->errMsgInpi=$tabRes['libErreur'];
|
||||
$enCache=true;
|
||||
//echo 'Une requête dans le cache <br/>';
|
||||
//die();
|
||||
//die();
|
||||
} else {
|
||||
//echo 'Pas de requête dans le cache <br/>';
|
||||
//die();
|
||||
@ -712,8 +712,8 @@ if (count($res)>0) {
|
||||
'codeErreur' => $this->errNumInpi,
|
||||
'libErreur' => $this->errMsgInpi,
|
||||
);
|
||||
if (!$this->iDb->insert('rncs_requetes', $tabInsert, true))
|
||||
$this->iDb->update('rncs_requetes', $tabInsert, "siren=$siren AND params='$params'");
|
||||
if (!$this->iDb->insert('jo.rncs_requetes', $tabInsert, true))
|
||||
$this->iDb->update('jo.rncs_requetes', $tabInsert, "siren=$siren AND params='$params'");
|
||||
}
|
||||
}
|
||||
|
||||
@ -742,7 +742,7 @@ else {
|
||||
$numProduit=$matches[2]; // 52
|
||||
$verProduit=$matches[3]; // 1
|
||||
$libProduit=$matches[4]; // Comptes sociaux
|
||||
$typProduit=$matches[5]; // 2000 : Bilans sociaux
|
||||
$typProduit=$matches[5]; // 2000 : Bilans sociaux
|
||||
// 2001 : Bilans consolidés (70)
|
||||
// 2002 : Bilans de banques (71)
|
||||
// 2003 : Bilans d'assurances (72)
|
||||
@ -762,7 +762,7 @@ else {
|
||||
$numProduit=$matches[1]; // 52
|
||||
$verProduit=$matches[2]; // 1
|
||||
$libProduit=$matches[3]; // Comptes sociaux
|
||||
$typProduit=$matches[4]; // 2000 : Bilans sociaux
|
||||
$typProduit=$matches[4]; // 2000 : Bilans sociaux
|
||||
$synProduit=$matches[5]; // 109104002 : Disponibilité synchrone
|
||||
$asyProduit=$matches[6]; // 109104003 : Disponibilité asynchrone
|
||||
$nbEtab=$matches[7]; // Nombre d'établissements recensés
|
||||
|
@ -575,24 +575,24 @@ class MRncsFlux {
|
||||
' <ort:_27 type="010">'.$prod['Num'].'</ort:_27>'. "\n". // Numéro de produit souhaité 1 2
|
||||
' <ort:_28 type="010">'.$prod['Ver'].'</ort:_28>'. "\n". // Version du produit 3 2
|
||||
' <ort:_31 type="010">'.$prod['Presta'].'</ort:_31>'. "\n". // Code prestation (vide pour QVIT)
|
||||
' </ort:_1>'. "\n";
|
||||
' </ort:_1>'. "\n";
|
||||
if ($prod['Presta']==12004 || $prod['Presta']==12003) {
|
||||
$req.='
|
||||
<ort:_2 type="110">
|
||||
<ort:_100 type="111">
|
||||
<ort:_101 type="110">
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
<ort:_100700010 type="010">FTP</ort:_100700010>
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
<ort:_100700010 type="010">FTP</ort:_100700010>
|
||||
<ort:_100701000 type="010">NTIF</ort:_100701000>
|
||||
<ort:_120000015 type="010" />
|
||||
<ort:_120000015 type="010" />
|
||||
</ort:_101>
|
||||
</ort:_100>
|
||||
<ort:_200 type="111">
|
||||
<ort:_210 type="110">
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_103000402 type="010">'.$prod['CmdNom'].'</ort:_103000402>
|
||||
<ort:_103000403 type="010">'.$prod['CmdPages'].'</ort:_103000403>
|
||||
<ort:_190000025 type="010">'.$prod['CmdBilan'].'</ort:_190000025>
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_103000402 type="010">'.$prod['CmdNom'].'</ort:_103000402>
|
||||
<ort:_103000403 type="010">'.$prod['CmdPages'].'</ort:_103000403>
|
||||
<ort:_190000025 type="010">'.$prod['CmdBilan'].'</ort:_190000025>
|
||||
</ort:_210>
|
||||
</ort:_200>
|
||||
</ort:_2>'; //
|
||||
@ -635,7 +635,7 @@ if (count($res)>0) {
|
||||
$this->errMsgInpi=$tabRes['libErreur'];
|
||||
$enCache=true;
|
||||
echo 'Une requête dans le cache <br/>';
|
||||
//die();
|
||||
//die();
|
||||
} else {
|
||||
echo 'Pas de requête dans le cache <br/>';
|
||||
//die();
|
||||
@ -680,7 +680,7 @@ if (count($res)>0) {
|
||||
'codeErreur' => $this->errNumInpi,
|
||||
'libErreur' => $this->errMsgInpi,
|
||||
);
|
||||
$this->iDb->insert('rncs_requetes', $tabInsert, true);
|
||||
$this->iDb->insert('jo.rncs_requetes', $tabInsert, true);
|
||||
}
|
||||
|
||||
if ($prod['Presta']==12004)
|
||||
@ -708,7 +708,7 @@ else {
|
||||
$numProduit=$matches[2]; // 52
|
||||
$verProduit=$matches[3]; // 1
|
||||
$libProduit=$matches[4]; // Comptes sociaux
|
||||
$typProduit=$matches[5]; // 2000 : Bilans sociaux
|
||||
$typProduit=$matches[5]; // 2000 : Bilans sociaux
|
||||
// 2001 : Bilans consolidés (70)
|
||||
// 2002 : Bilans de banques (71)
|
||||
// 2003 : Bilans d'assurances (72)
|
||||
@ -728,7 +728,7 @@ else {
|
||||
$numProduit=$matches[1]; // 52
|
||||
$verProduit=$matches[2]; // 1
|
||||
$libProduit=$matches[3]; // Comptes sociaux
|
||||
$typProduit=$matches[4]; // 2000 : Bilans sociaux
|
||||
$typProduit=$matches[4]; // 2000 : Bilans sociaux
|
||||
$synProduit=$matches[5]; // 109104002 : Disponibilité synchrone
|
||||
$asyProduit=$matches[6]; // 109104003 : Disponibilité asynchrone
|
||||
$nbEtab=$matches[7]; // Nombre d'établissements recensés
|
||||
|
@ -19,7 +19,7 @@ class MRnvp
|
||||
*/
|
||||
protected function getTabDevisesInpi()
|
||||
{
|
||||
$rep=$this->iDb->select('tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select('jo.tabDevises', 'devInpi, devIso', 'devInpi>0', false, MYSQL_ASSOC);
|
||||
$tabDevises=array();
|
||||
foreach($rep as $k=>$dev)
|
||||
$tabDevises[$dev['devInpi']*1]=$dev['devIso'];
|
||||
|
@ -81,7 +81,7 @@ class classMSigVille
|
||||
$iDb=new WDB();
|
||||
$adresse=addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=addslashes($ville);
|
||||
$ret=$iDb->select( 'zonage', 'zus, zru, zfu, cucs', "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
$ret=$iDb->select( 'jo.zonage', 'zus, zru, zfu, cucs', "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
if (count($ret)>0) {
|
||||
$zones=$ret[0];
|
||||
$tabRep['ZUS']=$tabRep['ZFU']=$tabRep['ZRU']=$tabRep['CUCS']='NON';
|
||||
@ -151,7 +151,7 @@ class classMSigVille
|
||||
'adrLibVoie'=>$adrLibVoie,
|
||||
'rivoli'=>$codeRivoli,
|
||||
);
|
||||
$iDb->insert('zonage', $tabInsert);
|
||||
$iDb->insert('jo.zonage', $tabInsert);
|
||||
|
||||
/** Autres Informations de la RNVP
|
||||
**/
|
||||
@ -187,7 +187,7 @@ class classMSigVille
|
||||
//return $tabRep;
|
||||
}
|
||||
$codeInsee=substr($codeRivoli,0,5);
|
||||
$ret=$iDb->select( 'zonageInsee', 'typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin', "codeInsee='$codeInsee'",false, MYSQL_ASSOC);
|
||||
$ret=$iDb->select( 'jo.zonageInsee', 'typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin', "codeInsee='$codeInsee'",false, MYSQL_ASSOC);
|
||||
$tabRep['ZRR']=$tabRep['AFR']='NON';
|
||||
foreach ($ret as $zones)
|
||||
switch ($zones['typeZone']) {
|
||||
|
@ -73,7 +73,7 @@ class MTel
|
||||
elseif($actif==0) $strActif=" AND actif=0 ";
|
||||
|
||||
$ret=$this->iDb->select(
|
||||
'telephonie',
|
||||
'jo.telephonie',
|
||||
'siren,nic,dateProvPartenaire,typeTel,infoTel,LPAD(telephone,10,0) AS telephone,actif,partenaire,idUtilisateur,dateInsert,dateInsert*1 AS dateInsertYmd,dateConfPartenaire,partenaireConf,nbConf,idUpdate,dateUpdate,dateUpdate*1 AS dateUpdateYmd',
|
||||
"siren=$siren $strNic $strActif AND dateSuppr=0 ORDER BY typeTel ASC, nbConf DESC", false, MYSQL_ASSOC);
|
||||
if (count($ret)>0)
|
||||
@ -83,7 +83,7 @@ class MTel
|
||||
{
|
||||
if ($tabTel['typeTel']=='an8' && $tabTel['infoTel']*1>0) {
|
||||
$an8=$tabTel['infoTel']*1;
|
||||
$retTmp=$this->iDb->select('tabAn8', 'libAn8', "codAn8='$an8'", false, MYSQL_ASSOC);
|
||||
$retTmp=$this->iDb->select('jo.tabAn8', 'libAn8', "codAn8='$an8'", false, MYSQL_ASSOC);
|
||||
$infoTel=ucfirst(strtolower($retTmp[0]['libAn8']));
|
||||
} else {
|
||||
$infoTel=$tabTel['infoTel'];
|
||||
@ -167,7 +167,7 @@ class MTel
|
||||
$res['domaines']=trim(preg_replace('/ +/', ' ', preg_replace('/\r+|\n+|\s+/',' ',htm2txt(strip_tags(@getTextInHtml($body, '<div class="puce_domaine">','<strong>','</div>'))))));
|
||||
|
||||
if ($res['urlSite']<>'') {
|
||||
$this->iDb->insert('telephonie', array(
|
||||
$this->iDb->insert('jo.telephonie', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
@ -186,7 +186,7 @@ class MTel
|
||||
);
|
||||
}
|
||||
if ($res['urlLogo']<>'') {
|
||||
$this->iDb->insert('telephonie', array(
|
||||
$this->iDb->insert('jo.telephonie', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
@ -205,7 +205,7 @@ class MTel
|
||||
);
|
||||
}
|
||||
if ($res['domaines']<>'') {
|
||||
$this->iDb->insert('telephonie', array(
|
||||
$this->iDb->insert('jo.telephonie', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
@ -224,7 +224,7 @@ class MTel
|
||||
);
|
||||
}
|
||||
if ($res['urlMail']<>'') {
|
||||
$this->iDb->insert('telephonie', array(
|
||||
$this->iDb->insert('jo.telephonie', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
@ -264,7 +264,7 @@ class MTel
|
||||
'telephone'=>$tabT['telNum'],
|
||||
'actif'=>1,
|
||||
);
|
||||
$this->iDb->insert('telephonie', array(
|
||||
$this->iDb->insert('jo.telephonie', array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
'dateProvPartenaire'=>date('Ymd'),
|
||||
|
@ -113,7 +113,7 @@ class MSitesWeb {
|
||||
|
||||
function __construct(/*$siren, $accesDist=true*/) {
|
||||
$this->iInsee=new MInsee();
|
||||
$this->iDb=new WDB('jo');
|
||||
$this->iDb=new WDB();
|
||||
}
|
||||
|
||||
/** L'adresse IP est elle valide ?
|
||||
@ -332,7 +332,7 @@ Actif (consultez aussi le <b><a href="http://www.decideo.fr" class="ext" target=
|
||||
$domaine=getFileExtension(preg_replace("/\.$ext$/",'','.'.$host));
|
||||
echo "RECHERCHE DE '$nomEntrep' ($siren) : Trouvé $domaine.$ext".EOL;
|
||||
if ($ext=='fr') {
|
||||
$rep=$this->iDb->select('sitesWeb', 'siren, web', "web=$url");
|
||||
$rep=$this->iDb->select('jo.sitesWeb', 'siren, web', "web=$url");
|
||||
if (@$rep[0]['siren']*1==0) {
|
||||
$tabAfnic=$this->getInfosAfnic("$domaine.$ext");
|
||||
$siren=$tabAfnic['siren']*1;
|
||||
@ -340,7 +340,7 @@ Actif (consultez aussi le <b><a href="http://www.decideo.fr" class="ext" target=
|
||||
$tabInsert=array('siren'=>$siren,
|
||||
'web'=>$url,
|
||||
'dateInsert'=>date('YmdHis'));
|
||||
$this->iDb->insert('sitesWeb', $tabInsert);
|
||||
$this->iDb->insert('jo.sitesWeb', $tabInsert);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
6624
library/Metier/scores/Comment/Score_414_5.php
Normal file
6624
library/Metier/scores/Comment/Score_414_5.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -26,10 +26,10 @@ function getIndiscoreHisto($siren)
|
||||
WHERE siren=$siren
|
||||
GROUP BY indiScoreDate
|
||||
ORDER BY indiScoreDate DESC";
|
||||
$iDb = new WDB('jo');
|
||||
$ret=$iDb->query($query);
|
||||
$tabRet=array();
|
||||
while($ret=$iDb->fetch(MYSQL_ASSOC)) {
|
||||
$iDb = new WDB();
|
||||
$ret = $iDb->query($query);
|
||||
$tabRet = array();
|
||||
while( $ret = $iDb->fetch(MYSQL_ASSOC) ) {
|
||||
$tabRet[]=array(
|
||||
'siren' => $ret['siren'],
|
||||
'actif' => $ret['actif'],
|
||||
@ -80,10 +80,10 @@ function getIndiscoreCache($siren)
|
||||
FROM jo.scores_surveillance
|
||||
WHERE siren=$siren
|
||||
ORDER BY indiScoreDate DESC";
|
||||
$iDb = new WDB('jo');
|
||||
$ret=$iDb->query($query);
|
||||
$tabRet=array();
|
||||
while($ret=$iDb->fetch(MYSQL_ASSOC))
|
||||
$iDb = new WDB();
|
||||
$ret = $iDb->query($query);
|
||||
$tabRet = array();
|
||||
while( $ret = $iDb->fetch(MYSQL_ASSOC) )
|
||||
{
|
||||
$tabRet[] = array (
|
||||
'siren' => $ret['siren'],
|
||||
@ -132,7 +132,7 @@ function getIndiscoreCache($siren)
|
||||
function getScoreSecteur($naf5)
|
||||
{
|
||||
if (len($naf)<>5) return false;
|
||||
$tabTmp=$iDb->select( 'scores_surveillance',
|
||||
$tabTmp=$iDb->select( 'jo.scores_surveillance',
|
||||
'naf, AVG(indiScore) AS score100moy, AVG(indiScore20) AS score20moy, AVG(encours) AS encoursMoy, MAX(indiScoreDate) AS lastScore, COUNT(siren) AS nbSiren',
|
||||
"naf='$naf5' AND actif=1", false, MYSQL_ASSOC);
|
||||
if ( count($tabTmp)>0 ) {
|
||||
@ -584,7 +584,7 @@ function format($matches)
|
||||
function PROJEC($valeur, $nbAnnees)
|
||||
{
|
||||
global $tabRegX, $Y, $Yaff, $PROECCOEFF, $PROJECTAUX;
|
||||
require_once 'Metier/Scores/classMProjection.php';
|
||||
require_once 'Metier/scores/classMProjection.php';
|
||||
$projec = new Projection();
|
||||
$projec->tabRegX = $tabRegX;
|
||||
$result = $projec->calc($valeur, $nbAnnees);
|
||||
@ -944,6 +944,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
|
||||
if (strtoupper(substr($tabIdentite['AutreId'],0,1))=='W') $WALDEC=$tabIdentite['AutreId'];
|
||||
else $WALDEC='';
|
||||
|
||||
// AGE en mois
|
||||
if ($tabIdentite['DateCreaEt']>0 && $tabIdentite['DateCreaEt']<$tabIdentite['DateCreaEn'])
|
||||
$dateCrea=$tabIdentite['DateCreaEt'];
|
||||
@ -953,7 +954,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$dateCrea=str_replace('-','',$DIMMAT);
|
||||
else {
|
||||
$dateCrea=0;
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Attention 'dateCrea'",'Corriger les tests de la valeur !');
|
||||
}
|
||||
$DCREN=$dateCrea;
|
||||
$DCREN_AA=substr($dateCrea,0,4);
|
||||
@ -1119,7 +1119,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
elseif (count($tabAnnees)>1) $strAnnees='AND annee BETWEEN '.$tabAnnees[1].' AND '.$tabAnnees[0];
|
||||
else $strAnnees='AND annee='.$tabAnnees[0];
|
||||
|
||||
$tabTmp = $iDb->select('ratios_secteurs',
|
||||
$tabTmp = $iDb->select('jo.ratios_secteurs',
|
||||
'annee, naf5, naf4, id, (montant/nombre) AS ratio, montant, nombre',
|
||||
"1 $strNaf $strAnnees ORDER BY annee DESC, id ASC",
|
||||
INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
@ -1611,7 +1611,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
}
|
||||
}
|
||||
|
||||
// Annonces BODACC Poursuite de l'activité malgré la perte de plus de plus de la moitié du capital social
|
||||
// Annonces BODACC Poursuite de l'activité malgré la perte de plus de la moitié du capital social
|
||||
$tabDepotCpt=$iInsee->getAnnoncesLegales($siren, 0, array(2314,2319), false);
|
||||
if (is_array($tabDepotCpt) && count($tabDepotCpt)>0){
|
||||
foreach ($tabDepotCpt as $iDep=>$depot) {
|
||||
@ -1911,8 +1911,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$tabIdentite['DateCreaEn'],
|
||||
$tabIdentite['DateCreaEt'],
|
||||
'',
|
||||
$RECME
|
||||
$iDb;
|
||||
$RECME,
|
||||
$iDb
|
||||
);
|
||||
$noteStructure=$isolv->getSolvabilite();
|
||||
$timer['solv']=microtime(true);
|
||||
@ -2289,9 +2289,10 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$SCORECONF-=5;
|
||||
//$tabCommentaires['gen'][]=prepareString("Cette affaire personnelle à demandée son retrait du champs de diffusion commercial de la base SIRENE.");
|
||||
$PPNONDIFF=true;
|
||||
} else
|
||||
} else {
|
||||
$PPNONDIFF=false;
|
||||
|
||||
}
|
||||
|
||||
/** Entreprise en Zone Prioritaire ? **/
|
||||
$ZONEPRI=false;
|
||||
$ZONEPRIZUS=$ZONEPRIAFR=$ZONEPRICUCS=$ZONEPRIZFU=$ZONEPRIZRR=$ZONEPRIZRU='';
|
||||
@ -2443,7 +2444,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
*
|
||||
**/
|
||||
$ENQUETE='';
|
||||
$tabTmp=$iDb->select('scores_cutoff', 'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate', "siren=$siren", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$tabTmp=$iDb->select('jo.scores_cutoff', 'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate', "siren=$siren", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$timer['scores_cutoff'] = microtime(true);
|
||||
if (isset($tabTmp[0]['encours'])) {
|
||||
if($tabTmp[0]['dateUpdate']>$tabTmp[0]['dateInsert']) {
|
||||
@ -2708,10 +2709,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
} elseif ($tabIdentite['SituationJuridique']=='D'){
|
||||
$noteSolvabilite=$SCORECONF=$SCOREDIRI=0;
|
||||
$analyseConf='L\'entreprise est dissoute';
|
||||
} /*elseif ($tabIdentite['SituationJuridique']=='R'){
|
||||
$noteSolvabilite=$SCORECONF=$SCOREDIRI=0;
|
||||
$analyseConf='L\'entreprise est radiée';
|
||||
} */elseif ($tabIdentite['Actif']==0){
|
||||
} elseif ($tabIdentite['Actif']==0){
|
||||
$noteSolvabilite=$SCORECONF=$SCOREDIRI=0;
|
||||
$analyseConf='L\'entreprise n\'est pas en activité';
|
||||
} elseif ($SCORECONF>=70)
|
||||
@ -2738,7 +2736,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
|
||||
/** CA Moyen par salarié pour un secteur donné
|
||||
**/
|
||||
/*$tabTmp=$iDb->select('ratios_secteurs', 'id, naf5, annee, SUM(montant), SUM(nombre), SUM(montant)/SUM(nombre) AS moyenne', "naf5='$naf' AND id=267 AND ANNEE>(SELECT MAX(annee) FROM ratios_secteurs WHERE naf5='$naf' AND id=267)-2 GROUP BY id, naf5", true, MYSQL_ASSOC);
|
||||
/*$tabTmp=$iDb->select('jo.ratios_secteurs', 'id, naf5, annee, SUM(montant), SUM(nombre), SUM(montant)/SUM(nombre) AS moyenne', "naf5='$naf' AND id=267 AND ANNEE>(SELECT MAX(annee) FROM ratios_secteurs WHERE naf5='$naf' AND id=267)-2 GROUP BY id, naf5", true, MYSQL_ASSOC);
|
||||
$caSecteur=round($tabTmp[0]['moyenne']*1000);
|
||||
// Encours moyen secteur * nb salariés
|
||||
if ($EFFECTIF>0) $CAESTIME=$caSecteur*$EFFECTIF;
|
||||
@ -3014,19 +3012,19 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
|
||||
/** N° d'ordre de l'entreprise dans le classement des CA pour le marché de l'entreprise **/
|
||||
$caTmp = round($CABIOUES,0);
|
||||
$tabTmp = $iDb->select('etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
if (count($tabTmp) > 0) {
|
||||
$MARCHEPLACE = $tabTmp[0]['nb']*1;
|
||||
}
|
||||
$tabTmp = $iDb->select('etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp AND adr_dep='".$tabIdentite['Dept']."'", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND bilFL>=$caTmp AND adr_dep='".$tabIdentite['Dept']."'", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
if (count($tabTmp) > 0) {
|
||||
$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'], INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."' AND adr_com=".$tabIdentite['codeCommune'], INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
if (count($tabTmp) > 0) {
|
||||
$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']."'", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$tabTmp = $iDb->select('jo.etablissements_act', 'count(*) AS nb', "siege=1 AND ape_entrep='$naf' AND adr_dep='".$tabIdentite['Dept']."'", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
if (count($tabTmp) > 0) {
|
||||
$MARCHENBENT_DEP = $tabTmp[0]['nb']*1;
|
||||
}
|
||||
@ -3272,10 +3270,10 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
//if ($codeCommuneInsee>=75000 && $codeCommuneInsee<76000)
|
||||
$VILLE=$tabIdentite['Ville']; // Ville ou ville + arrondissement de l'entreprise
|
||||
$ya2ans=$ANNEEp2.'-'.date('m-d');
|
||||
$ret=$iDb->query("SELECT MIN(b.VenteMt) AS vtMin, AVG(b.VenteMt) AS vtMoy, MAX(b.VenteMt) AS vtMax, COUNT(b.id) AS vtNb
|
||||
$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
|
||||
FROM scores_ventes v
|
||||
FROM jo.scores_ventes v
|
||||
WHERE v.nafEn LIKE '$APEENT'
|
||||
AND v.codeCommune LIKE '$codeCommuneInsee'
|
||||
AND v.Bodacc_Date_Parution>='$ya2ans'
|
||||
@ -3295,7 +3293,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$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
|
||||
FROM scores_ventes v
|
||||
FROM jo.scores_ventes v
|
||||
WHERE v.nafEn LIKE '$APEENT'
|
||||
AND v.codeCommune LIKE '".$tabIdentite['Dept']."%'
|
||||
AND v.Bodacc_Date_Parution>='$ya2ans'
|
||||
@ -3311,7 +3309,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$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
|
||||
FROM scores_ventes v
|
||||
FROM jo.scores_ventes v
|
||||
WHERE v.nafEn LIKE '$APEENT'
|
||||
AND v.Bodacc_Date_Parution>='$ya2ans'
|
||||
AND v.VenteMt>1 AND v.VenteDev='EUR' $filtreCAEff
|
||||
@ -3804,7 +3802,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
|
||||
/** Historisation du score **/
|
||||
$tabTmp = $iDb->select(
|
||||
'scores_surveillance s',
|
||||
'jo.scores_surveillance s',
|
||||
"s.siren, s.actif, s.procol, s.indiScore, s.indiScore20, s.encours, s.indiScoreDate, scoreSolv, scoreConf, scoreDir, scoreZ, scoreCH, scoreAfdcc1, scoreAfdcc2, scoreAfdcc2note, scoreAltman, scoreAltmanCote, scoreCCF, situFi, infoNote, noteStruct, noteFin, tendance, nbModifs, s.dateUpdate, s.cs, s.csMoisMaj, s.csMoisFin",
|
||||
"s.siren=$siren",
|
||||
false, MYSQL_ASSOC);
|
||||
@ -3934,13 +3932,13 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
//Sauvegarde et Historisation du score
|
||||
if ( $actionHisto == 'insert' )
|
||||
{
|
||||
if (!$iDb->insert('scores_surveillance', $tabUpdate, false, true)) {
|
||||
if (!$iDb->insert('jo.scores_surveillance', $tabUpdate, false, true)) {
|
||||
debugLog('W', "Erreur lors de l'ajout du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$iDb->update('scores_surveillance', $tabUpdate, "siren=$siren", false, 0, true)) {
|
||||
if (!$iDb->update('jo.scores_surveillance', $tabUpdate, "siren=$siren", false, 0, true)) {
|
||||
debugLog('W', "Erreur lors de mise à jour du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
|
@ -968,11 +968,11 @@ function rechercheDir(&$formR, $deb, $nbRep, $max)
|
||||
d.naissance_date,
|
||||
d.naissance_lieu,
|
||||
l.libelle AS fonction_lib,
|
||||
e.id, CONCAT(e.siren,e.nic) AS siret,
|
||||
e.id, CONCAT(LPAD(e.siren,9,0),LPAD(e.nic,5,0)) AS siret,
|
||||
e.source,
|
||||
e.source_id,
|
||||
e.siren,
|
||||
e.nic,
|
||||
LPAD(e.siren,9,0) AS siren,
|
||||
LPAD(e.nic,5,0) AS nic,
|
||||
e.siege,
|
||||
e.raisonSociale,
|
||||
e.sigle,
|
||||
@ -1159,9 +1159,9 @@ function rechercheAct($formR, $deb, $nbRep, $max)
|
||||
IF(l.dateUpdate>l.dateInsert,l.dateUpdate,l.dateInsert) AS date,
|
||||
|
||||
/*Participation*/
|
||||
CONCAT(LPAD(e.siren,9,'000000000'), LPAD(e.nic,5,'00000')) AS siret,
|
||||
LPAD(par.siren,9,'000000000') AS siren,
|
||||
LPAD(e.nic,5,'00000') AS nic,
|
||||
CONCAT(LPAD(e.siren,9,0), LPAD(e.nic,5,0)) AS siret,
|
||||
LPAD(par.siren,9,0) AS siren,
|
||||
LPAD(e.nic,5,0) AS nic,
|
||||
e.siege,
|
||||
par.RS AS raisonSociale,
|
||||
/*sigle*/
|
||||
@ -1210,9 +1210,9 @@ function rechercheAct($formR, $deb, $nbRep, $max)
|
||||
IF(l.dateUpdate>l.dateInsert,l.dateUpdate,l.dateInsert) AS date,
|
||||
|
||||
/*Participation*/
|
||||
CONCAT(LPAD(e.siren,9,'000000000'), LPAD(e.nic,5,'00000')) AS siret,
|
||||
LPAD(par.siren,9,'000000000') AS siren,
|
||||
LPAD(e.nic,5,'00000') AS nic,
|
||||
CONCAT(LPAD(e.siren,9,0), LPAD(e.nic,5,0)) AS siret,
|
||||
LPAD(par.siren,9,0) AS siren,
|
||||
LPAD(e.nic,5,0) AS nic,
|
||||
e.siege,
|
||||
par.RS AS raisonSociale,
|
||||
/*sigle*/
|
||||
@ -1634,9 +1634,9 @@ function rechercheEnt(&$formR, $deb, $nbRep, $max, $sirenValide = false)
|
||||
id,
|
||||
source,
|
||||
source_id,
|
||||
CONCAT(siren,nic) AS siret,
|
||||
siren,
|
||||
nic,
|
||||
CONCAT(LPAD(siren,9,0),LPAD(nic,5,0)) AS siret,
|
||||
LPAD(siren,9,0) AS siren,
|
||||
LPAD(nic,5,0) AS nic,
|
||||
siege,
|
||||
raisonSociale,
|
||||
sigle,
|
||||
|
77
library/SdMetier/Graydon/README
Normal file
77
library/SdMetier/Graydon/README
Normal file
@ -0,0 +1,77 @@
|
||||
|
||||
Graydon WebService
|
||||
==================
|
||||
Get the report, or place an order on a company.
|
||||
|
||||
- Store report in database
|
||||
- Move the report to an history if a more recent is available
|
||||
|
||||
Identify item that can be interesting for us and our customer.
|
||||
|
||||
a CLI could assemble all items, from the differents partners Graydon, Giant, Interne in order to
|
||||
create an international database.
|
||||
|
||||
How Graydon works
|
||||
=================
|
||||
|
||||
http://localhost:9080/CompanyData_webservice/services/SOAPPort_v1_2
|
||||
|
||||
getCompanyMatchesByAll
|
||||
getCompanyMatchesByIdentifier
|
||||
getCompanyMatchesByKeyword
|
||||
getCompanyMatchesByName
|
||||
getCompanyMatchesByPostCode
|
||||
|
||||
getCompanyProducts
|
||||
getCompanyReport
|
||||
|
||||
getCompanyMatchIdentifiers
|
||||
getCompanyMatchMethods
|
||||
|
||||
getCountryAvailability
|
||||
- By cli get regurlarly the available product by country (store it in database)
|
||||
Country
|
||||
Code
|
||||
ServiceSpeed
|
||||
enum { 'Normal', 'Express', 'Superflash', 'Immediate', 'ImmediateWithUpdate', 'Unknown', 'Delayed' }
|
||||
Level
|
||||
Type
|
||||
enum { 'Database', 'Investigation', 'Unknown' }
|
||||
DaysFrom
|
||||
DaysTo
|
||||
CompanyProductIdentifier => use in placeOrder
|
||||
TypeHtml
|
||||
TypeXml => is our prefer format
|
||||
TypePdf
|
||||
TypeDoc
|
||||
|
||||
getCountryStylesheets
|
||||
|
||||
placeOrder
|
||||
checkOrders
|
||||
|
||||
getDemoCompanies
|
||||
ping
|
||||
|
||||
Store report in database
|
||||
========================
|
||||
getCompanyReport
|
||||
IN => OrderReference
|
||||
MimeType (html, xml, doc, pdf)
|
||||
OUT =>
|
||||
|
||||
|
||||
Orders
|
||||
======
|
||||
placeOrder
|
||||
IN => ClientReference
|
||||
CompanyProductIdentifier
|
||||
OUT =>
|
||||
|
||||
|
||||
|
||||
|
||||
XML Data Schema
|
||||
===============
|
||||
http://www.graydon.co.uk/GraydonXMLSchema/xsd/GraydonUKCompanySchema.xsd
|
||||
http://www.graydon.co.uk/GraydonXMLSchema/documentation/GraydonUKCompanySchema/GraydonUKCompanySchema.html
|
51
library/SdMetier/Graydon/Service.php
Normal file
51
library/SdMetier/Graydon/Service.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
class SdMetier_Graydon_Service extends Zend_Soap_Client
|
||||
{
|
||||
protected $PartnerClientId = '32790';
|
||||
protected $PartnerUserId = 'SESS38R7';
|
||||
protected $ParterPassword = 'E88MSU4p';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//Set the WSDL
|
||||
$this->_wsdl = __DIR__ . DIRECTORY_SEPARATOR . 'GraydonCompanyData.wsdl';
|
||||
|
||||
//Set options
|
||||
$options = array(
|
||||
'features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS,
|
||||
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return stdClass
|
||||
*/
|
||||
protected function _AuthenticationParameters()
|
||||
{
|
||||
$params = new stdClass();
|
||||
$params->PartnerUserId = $this->PartnerUserId;
|
||||
$params->PartnerPassword = $this->ParterPassword;
|
||||
$params->PartnerClientId = '';
|
||||
$params->SessionID = '';
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $country
|
||||
*/
|
||||
public function getCountryAvailability( $country = null )
|
||||
{
|
||||
$client = $this->getSoapClient();
|
||||
|
||||
$params = new stdClass();
|
||||
$params->Authentication_Parameters = $this->_AuthenticationParameters();
|
||||
|
||||
if ( $country !== null ) {
|
||||
$params->Country = $country;
|
||||
}
|
||||
|
||||
return $client->getCountryAvailability($params);
|
||||
}
|
||||
}
|
1705
library/SdMetier/Graydon/Wsdl/GraydonCompanyData.wsdl
Normal file
1705
library/SdMetier/Graydon/Wsdl/GraydonCompanyData.wsdl
Normal file
File diff suppressed because it is too large
Load Diff
340
library/SdMetier/Graydon/Wsdl/GraydonUKCommonTypes.xsd
Normal file
340
library/SdMetier/Graydon/Wsdl/GraydonUKCommonTypes.xsd
Normal file
@ -0,0 +1,340 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by Chris Boyce (Graydon UK Limited) -->
|
||||
<schema targetNamespace="http://xml.graydon.co.uk/GraydonUKCommonTypes" xmlns:tns="http://xml.graydon.co.uk/GraydonUKCommonTypes" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<simpleType name="CompanyTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="Associate"/>
|
||||
<enumeration value="Branch"/>
|
||||
<enumeration value="Client"/>
|
||||
<enumeration value="Enquiry"/>
|
||||
<enumeration value="Holding"/>
|
||||
<enumeration value="Known_As"/>
|
||||
<enumeration value="Lender"/>
|
||||
<enumeration value="OtherDirectorship"/>
|
||||
<enumeration value="Parent"/>
|
||||
<enumeration value="Shareholder"/>
|
||||
<enumeration value="Subject"/>
|
||||
<enumeration value="Subsidiary"/>
|
||||
<enumeration value="Trustee"/>
|
||||
<enumeration value="UltimateHolding"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="NameTypesType">
|
||||
<restriction base="string"/>
|
||||
</simpleType>
|
||||
<simpleType name="CompanyIdTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="Buyers_Number"/>
|
||||
<enumeration value="Chamber_Of_Commerce"/>
|
||||
<enumeration value="SIREN_Number"/>
|
||||
<enumeration value="SIRET_Number"/>
|
||||
<enumeration value="Unique_Company_Number"/>
|
||||
<enumeration value="National2"/>
|
||||
<enumeration value="VAT"/>
|
||||
<enumeration value="Internal"/>
|
||||
<enumeration value="National1"/>
|
||||
<enumeration value="Web_Address"/>
|
||||
<enumeration value="Fiscal_Code"/>
|
||||
<enumeration value="National_Government_Business_Identification_Number"/>
|
||||
<enumeration value="NIT"/>
|
||||
<enumeration value="RIF"/>
|
||||
<enumeration value="RUC_Number"/>
|
||||
<enumeration value="TSR"/>
|
||||
<enumeration value="Unknown"/>
|
||||
<enumeration value="Company_Registration_Number"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="CountryDialCodeType">
|
||||
<restriction base="string"/>
|
||||
</simpleType>
|
||||
<simpleType name="CountryISOCodeType">
|
||||
<restriction base="string"/>
|
||||
</simpleType>
|
||||
<simpleType name="CountryType" final="list">
|
||||
<restriction base="string">
|
||||
<minLength value="0"/>
|
||||
<maxLength value="100"/>
|
||||
<whiteSpace value="preserve"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<complexType name="AddressType">
|
||||
<sequence>
|
||||
<element name="EntireAddress" type="string" minOccurs="0" maxOccurs="1"/>
|
||||
<element name="Building" minOccurs="0" type="string"/>
|
||||
<element name="Street" minOccurs="0" type="string"/>
|
||||
<element name="Town" minOccurs="0" type="string"/>
|
||||
<element name="City" minOccurs="0" type="tns:CityType"/>
|
||||
<element name="County" minOccurs="0" type="string"/>
|
||||
<element name="PostCode" minOccurs="0" type="tns:PostCodeType"/>
|
||||
<element name="Country" type="tns:CountryType" minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
<simpleType name="FreeTextTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="Accounts"/>
|
||||
<enumeration value="Activities"/>
|
||||
<enumeration value="Additional Info"/>
|
||||
<enumeration value="Amount_Secured"/>
|
||||
<enumeration value="Amount_Satisfied"/>
|
||||
<enumeration value="Annual_Report"/>
|
||||
<enumeration value="Auditors"/>
|
||||
<enumeration value="Auditors_Qualification"/>
|
||||
<enumeration value="Augur_Score_Description"/>
|
||||
<enumeration value="Augur_Score_Explanation"/>
|
||||
<enumeration value="Brief History"/>
|
||||
<enumeration value="Capital"/>
|
||||
<enumeration value="Credit_Score_Description"/>
|
||||
<enumeration value="Credit_Score_Explanation"/>
|
||||
<enumeration value="Current Scorecard"/>
|
||||
<enumeration value="Description"/>
|
||||
<enumeration value="Document_Description"/>
|
||||
<enumeration value="Enquiry_Answer"/>
|
||||
<enumeration value="Enquiry_Question"/>
|
||||
<enumeration value="Error_Message"/>
|
||||
<enumeration value="Financial Notes"/>
|
||||
<enumeration value="Financial/commercial situation"/>
|
||||
<enumeration value="Fixed_Assets"/>
|
||||
<enumeration value="Gearing trend"/>
|
||||
<enumeration value="General Info"/>
|
||||
<enumeration value="Increase_in_CCJs_Or_Scottish_Decrees"/>
|
||||
<enumeration value="Interview"/>
|
||||
<enumeration value="Liquidity"/>
|
||||
<enumeration value="Long_Term_Liabilities"/>
|
||||
<enumeration value="Mortgage_Description"/>
|
||||
<enumeration value="Nace_disclaimer"/>
|
||||
<enumeration value="Net_Income"/>
|
||||
<enumeration value="Net_Worth"/>
|
||||
<enumeration value="No_Accounts_at_CRO"/>
|
||||
<enumeration value="No_Pre_Tax"/>
|
||||
<enumeration value="No_Pre-Tax_Profit"/>
|
||||
<enumeration value="No_Turnover"/>
|
||||
<enumeration value="Non_trading_position"/>
|
||||
<enumeration value="Note"/>
|
||||
<enumeration value="Occupation"/>
|
||||
<enumeration value="Only_Turnover"/>
|
||||
<enumeration value="Operating_Loss"/>
|
||||
<enumeration value="Operating_Profit"/>
|
||||
<enumeration value="Payment Trend"/>
|
||||
<enumeration value="Payments"/>
|
||||
<enumeration value="Position"/>
|
||||
<enumeration value="Pre_Tax"/>
|
||||
<enumeration value="Pre_Tax_Profit"/>
|
||||
<enumeration value="Premises"/>
|
||||
<enumeration value="Product_Description"/>
|
||||
<enumeration value="Product_Secondary_Warning"/>
|
||||
<enumeration value="Profit_or_Loss"/>
|
||||
<enumeration value="Property_Details"/>
|
||||
<enumeration value="Public Info"/>
|
||||
<enumeration value="Reference"/>
|
||||
<enumeration value="Registered_Objectives"/>
|
||||
<enumeration value="Serviced_by"/>
|
||||
<enumeration value="Share_Description"/>
|
||||
<enumeration value="Summary"/>
|
||||
<enumeration value="Total_Equity"/>
|
||||
<enumeration value="Trade morality"/>
|
||||
<enumeration value="Trade_Reference_Comment"/>
|
||||
<enumeration value="Trend"/>
|
||||
<enumeration value="Turnover"/>
|
||||
<enumeration value="Working_Capital"/>
|
||||
<enumeration value="Xseption"/>
|
||||
<enumeration value="Xseption Description"/>
|
||||
<enumeration value="Business trend"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="DateTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="Account_Opened"/>
|
||||
<enumeration value="Accounting_Reference"/>
|
||||
<enumeration value="Accounts"/>
|
||||
<enumeration value="Accounts_Lodged"/>
|
||||
<enumeration value="Age_of_Company"/>
|
||||
<enumeration value="Annual_Return"/>
|
||||
<enumeration value="Appointment"/>
|
||||
<enumeration value="Current"/>
|
||||
<enumeration value="Date_Created"/>
|
||||
<enumeration value="Date_Fully_Satisfied"/>
|
||||
<enumeration value="Date_of_Birth"/>
|
||||
<enumeration value="Date_of_Document"/>
|
||||
<enumeration value="Date_of_Latest_Mortgage_Created"/>
|
||||
<enumeration value="Date_of_Latest_Satisfaction"/>
|
||||
<enumeration value="Date_of_Issue"/>
|
||||
<enumeration value="Date_Registered"/>
|
||||
<enumeration value="Enquiry"/>
|
||||
<enumeration value="Expirary"/>
|
||||
<enumeration value="Filed_at_Companies_House"/>
|
||||
<enumeration value="In"/>
|
||||
<enumeration value="Incorporation"/>
|
||||
<enumeration value="Latest_Accounts"/>
|
||||
<enumeration value="Legal_Form_Since"/>
|
||||
<enumeration value="Message"/>
|
||||
<enumeration value="Out"/>
|
||||
<enumeration value="Research"/>
|
||||
<enumeration value="Resignation"/>
|
||||
<enumeration value="Settled"/>
|
||||
<enumeration value="Summary"/>
|
||||
<enumeration value="Terms_in_Days"/>
|
||||
<enumeration value="Generation"/>
|
||||
<enumeration value="Order"/>
|
||||
<enumeration value="Last database update"/>
|
||||
<enumeration value="Latest_Accounts_at_CRO"/>
|
||||
<enumeration value="Registered"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="DateFormatType">
|
||||
<restriction base="string">
|
||||
<enumeration value="CCYY"/>
|
||||
<enumeration value="CCYYMMDD"/>
|
||||
<enumeration value="DD"/>
|
||||
<enumeration value="DDMM"/>
|
||||
<enumeration value="DDMMCCYY"/>
|
||||
<enumeration value="MM"/>
|
||||
<enumeration value="MMCCYY"/>
|
||||
<enumeration value="MMDDCCYY"/>
|
||||
<enumeration value="DD/MM/CCYY"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="TimeTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="HHMMSS"/>
|
||||
<enumeration value="HHMM"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="LanguageCodesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="E"/>
|
||||
<enumeration value="F"/>
|
||||
<enumeration value="D"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="CurrencyDescriptionType">
|
||||
<restriction base="string">
|
||||
<enumeration value="Euro"/>
|
||||
<enumeration value="Japanese Yen"/>
|
||||
<enumeration value="US Dollar"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="TaxonomyTypesType">
|
||||
<restriction base="string"/>
|
||||
</simpleType>
|
||||
<simpleType name="CommunicationTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="Telephone"/>
|
||||
<enumeration value="Fax"/>
|
||||
<enumeration value="Email"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="Credit_RatingTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="Augur_Score"/>
|
||||
<enumeration value="Credit_Rating"/>
|
||||
<enumeration value="Credit_Score"/>
|
||||
<enumeration value="Historical_Credit_Rating"/>
|
||||
<enumeration value="Maximum_Credit_Guide"/>
|
||||
<enumeration value="Monthly_Credit_Guide"/>
|
||||
<enumeration value="Previous_Credit_Score"/>
|
||||
<enumeration value="Requested_Credit_Amount"/>
|
||||
<enumeration value="Risk_Category"/>
|
||||
<enumeration value="Risk_Class"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="DirectorsTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="Director"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="TitleTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="Mr"/>
|
||||
<enumeration value="Mrs"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="EmployeesTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="Employed"/>
|
||||
<enumeration value="Full_Time_Employees"/>
|
||||
<enumeration value="Head_Office_Employees"/>
|
||||
<enumeration value="Staff_Employeed"/>
|
||||
<enumeration value="Staff_Employees"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="UnitsTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="1"/>
|
||||
<enumeration value="10"/>
|
||||
<enumeration value="100"/>
|
||||
<enumeration value="1000"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="CurrencyType" final="list">
|
||||
<restriction base="string">
|
||||
<enumeration value="GBP"/>
|
||||
<enumeration value="EUR"/>
|
||||
<enumeration value="USD"/>
|
||||
<enumeration value="JYP"/>
|
||||
<enumeration value="DKK"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<simpleType name="ProductCode">
|
||||
<restriction base="int"/>
|
||||
</simpleType>
|
||||
<simpleType name="CompanyIdType">
|
||||
<restriction base="string">
|
||||
<minLength value="1"/>
|
||||
<whiteSpace value="collapse"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="CompanyNameType">
|
||||
<restriction base="string">
|
||||
<minLength value="0"/>
|
||||
<maxLength value="60"/>
|
||||
<whiteSpace value="preserve"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="CityType">
|
||||
<restriction base="string">
|
||||
<minLength value="0"/>
|
||||
<maxLength value="100"/>
|
||||
<whiteSpace value="preserve"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="PostCodeType">
|
||||
<restriction base="string">
|
||||
<minLength value="0"/>
|
||||
<maxLength value="10"/>
|
||||
<whiteSpace value="preserve"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="MimeTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="html"/>
|
||||
<enumeration value="xml"/>
|
||||
<enumeration value="pdf"/>
|
||||
<enumeration value="doc"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="CommunicationType">
|
||||
<restriction base="string"/>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="OrderReferenceType">
|
||||
<annotation>
|
||||
<documentation>Unique order reference assigned to the customer for company product ordered</documentation>
|
||||
</annotation>
|
||||
<restriction base="int">
|
||||
<whiteSpace value="collapse"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="ActivityTypesType">
|
||||
<restriction base="string">
|
||||
<enumeration value="NACE"/>
|
||||
<enumeration value="SIC"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
</schema>
|
1705
library/SdMetier/Graydon/_sample/GraydonCompanyData.wsdl
Normal file
1705
library/SdMetier/Graydon/_sample/GraydonCompanyData.wsdl
Normal file
File diff suppressed because it is too large
Load Diff
33
library/SdMetier/Graydon/_sample/Readme.txt
Normal file
33
library/SdMetier/Graydon/_sample/Readme.txt
Normal file
@ -0,0 +1,33 @@
|
||||
Graydon UK Web Services
|
||||
This document explains the PHP scripts used to communicate with the Web Service functions.
|
||||
|
||||
Run Requests:
|
||||
1) Install PHP onto the computer.
|
||||
2) Add the php root directory to the system PATH.
|
||||
3) From the command line run the php scripts passing the correct command line options.
|
||||
|
||||
Examples:
|
||||
1) php checkorders.php <username> <password> Delivered 0 " " 2008-10-02
|
||||
2) php getCompanyMatchesByKeyword.php <username> <password> "United Kingdom" Company " " " "
|
||||
3) php companyproducts.php <username> <password> "UNITED KINGDOM:National1:GR064240"
|
||||
|
||||
Php version:
|
||||
5.2.8
|
||||
|
||||
Web Service:
|
||||
requests - checkorders: Returns a list of orders that match the search criteria.
|
||||
- companyproducts: Returns a list of products for a company that match the company match identifier.
|
||||
- getCompanyMatchesByKeyword: Returns a list of Companies that match the search criteria.
|
||||
|
||||
Command Line Arguments:
|
||||
All the scripts use command line arguments, the two constant arguments for all scripts is the
|
||||
username and password. Both the username and password are used by the web service to authenticate
|
||||
the request.
|
||||
argument 1 = Username
|
||||
argument 2 = Password
|
||||
argument 3 = Function parameters
|
||||
. = Function parameters
|
||||
. = Function parameters
|
||||
. = Function parameters
|
||||
argument x = Function parameters
|
||||
|
66
library/SdMetier/Graydon/_sample/checkorders.php
Normal file
66
library/SdMetier/Graydon/_sample/checkorders.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 12 Feb 2009
|
||||
* This PHP script demonstrates how to consume a Graydon Web Service <companyproducts>.
|
||||
* The output will consist of a list of the transaction identifier, the user id, the company name
|
||||
* and a list of the product codes for that company.
|
||||
* Command line arguments
|
||||
* 1) Username
|
||||
* 2) Password
|
||||
* 3) Order State ( <Delivered>, <ReCompleted>, <Completed>, <Notified>, <Assigned>, <Initialised> )
|
||||
* 4) Order Reference
|
||||
* 5) Client Reference
|
||||
* 6) Date ( YYYY-MM-DD xsd format )
|
||||
*/
|
||||
// Create a soap client
|
||||
$client = new SoapClient("GraydonCompanyData.wsdl",array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));
|
||||
// Create the authentication parameters object
|
||||
$authentication = new StdClass();
|
||||
// Initialise the authentication parameters
|
||||
$authentication->PartnerUserId = $argv[1];
|
||||
$authentication->PartnerPassword = $argv[2];
|
||||
$authentication->PartnerClientId = '';
|
||||
$authentication->SessionID = '';
|
||||
|
||||
// Create a new request parameters object
|
||||
$request = new StdClass();
|
||||
// Initialise the parameters object
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
$request->OrderState = $argv[3];
|
||||
$request->OrderReference = $argv[4];
|
||||
$request->ClientReference = $argv[5];
|
||||
$request->DateFrom = $argv[6];
|
||||
try
|
||||
{
|
||||
// Make request to the web service
|
||||
$result = $client->checkOrders($request);
|
||||
// Print out the result
|
||||
print "\nThe Returned data: ";
|
||||
print "\n * Service Log: ";
|
||||
print "\n * Transaction Identifier - ";
|
||||
print $result->Service_Log->TransactionIdentifier;
|
||||
print "\n * Partner User Id - ";
|
||||
print $result->Service_Log->PartnerUserId;
|
||||
print "\n * Orders: ";
|
||||
// Get the orders returned from the request
|
||||
$orders = $result->CheckOrders->OrderStatus;
|
||||
$count = count($orders);
|
||||
// For each order
|
||||
for($i = 0; $i < $count; $i ++)
|
||||
{
|
||||
// Print out the order details
|
||||
print "\n *Order: ";
|
||||
print print $orders[$i]->Order->Name;
|
||||
print "\n * Order Reference - ";
|
||||
print $orders[$i]->OrderReference;
|
||||
print "\n * Order State - ";
|
||||
print $orders[$i]->OrderState;
|
||||
}
|
||||
}
|
||||
catch( SoapFault $exception )
|
||||
{
|
||||
// Print the exception
|
||||
print "\n Exception ";
|
||||
var_dump($exception->detail);
|
||||
}
|
||||
?>
|
60
library/SdMetier/Graydon/_sample/companyproducts.php
Normal file
60
library/SdMetier/Graydon/_sample/companyproducts.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 11 Feb 2009
|
||||
* This PHP script demonstrates how to consume a Graydon Web Service <companyproducts>.
|
||||
* The output will consist of a list of the transaction identifier, the user id, the company name
|
||||
* and a list of the product codes for that company.
|
||||
* Command line arguments
|
||||
* 1) Username
|
||||
* 2) Password
|
||||
* 3) Company Match Identifier
|
||||
*/
|
||||
// Create a soap client
|
||||
$client = new SoapClient("GraydonCompanyData.wsdl");
|
||||
// Create the authentication parameters object
|
||||
$authentication = new StdClass();
|
||||
// Initialise the authentication parameters
|
||||
$authentication->PartnerUserId = $argv[1];
|
||||
$authentication->PartnerPassword = $argv[2];
|
||||
$authentication->PartnerClientId = '';
|
||||
$authentication->SessionID = '';
|
||||
|
||||
// Create the company identifier object
|
||||
$identifier = $argv[3];
|
||||
|
||||
// Create the getCompanyProducts parameters object
|
||||
$parameters = new StdClass();
|
||||
// Initialise the parameters
|
||||
$parameters->Authentication_Parameters = $authentication;
|
||||
$parameters->CompanyMatchIdentifier = $identifier;
|
||||
try
|
||||
{
|
||||
// Make a request on the webservice
|
||||
$result = $client->getCompanyProducts($parameters);
|
||||
// Output the xml
|
||||
print "\nThe Returned data: ";
|
||||
print "\n * Service Log: ";
|
||||
print "\n * Transaction Identifier - ";
|
||||
print $result->Service_Log->TransactionIdentifier;
|
||||
print "\n * Partner User Id - ";
|
||||
print $result->Service_Log->PartnerUserId;
|
||||
print "\n * Company: ";
|
||||
print $result->Company->Name;
|
||||
print "\n * Products: ";
|
||||
$array = $result->Products->Product;
|
||||
$count = count($array);
|
||||
// For each Product
|
||||
for($i = 0; $i < $count; $i ++)
|
||||
{
|
||||
// Output the product name
|
||||
print "\n * Product Code - ";
|
||||
print $array[$i]->Code;
|
||||
}
|
||||
}
|
||||
catch( SoapFault $exception )
|
||||
{
|
||||
// Print the exception
|
||||
print "\n Exception ";
|
||||
var_dump($exception->detail);
|
||||
}
|
||||
?>
|
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 12 Feb 2009
|
||||
* This PHP script demonstrates how to consume a Graydon Web Service <companyproducts>.
|
||||
* The output will consist of the transaction identifier, the user id and for each company matching
|
||||
* to the keyword its name and its CompanyMatchIdentifier.
|
||||
* Command line arguments
|
||||
* 1) Username
|
||||
* 2) Password
|
||||
* 3) Country
|
||||
* 4) Keyword
|
||||
* 5) City
|
||||
* 6) PostCode
|
||||
*/
|
||||
|
||||
// Create a soap client
|
||||
$client = new SoapClient("GraydonCompanyData.wsdl");
|
||||
// Create the authentication parameters object
|
||||
$authentication = new StdClass();
|
||||
// Initialise the authentication parameters
|
||||
$authentication->PartnerUserId = $argv[1];
|
||||
$authentication->PartnerPassword = $argv[2];
|
||||
$authentication->PartnerClientId = '';
|
||||
$authentication->SessionID = '';
|
||||
|
||||
// Create a new country parameters object
|
||||
$company = new StdClass();
|
||||
// Initialise the country object
|
||||
$company->Country = $argv[3];
|
||||
$company->ClientReference = '';
|
||||
|
||||
// Create the request parameters
|
||||
$request = new StdClass();
|
||||
// Initialise the request object
|
||||
$request->Authentication_Parameters = $authentication;
|
||||
$request->CompanyMatches_Parameters = $company;
|
||||
$request->Keyword = $argv[4];
|
||||
$request->City = $argv[5];
|
||||
$request->PostCode = $argv[6];
|
||||
try
|
||||
{
|
||||
// Make a request on the web service
|
||||
$result = $client->getCompanyMatchesByKeyword($request);
|
||||
// Print out the result
|
||||
print "\nThe Returned data: ";
|
||||
print "\n * Service Log: ";
|
||||
print "\n * Transaction Identifier - ";
|
||||
print $result->Service_Log->TransactionIdentifier;
|
||||
print "\n * Partner User Id - ";
|
||||
print $result->Service_Log->PartnerUserId;
|
||||
print "\n * Companies: ";
|
||||
// Get the list of companies
|
||||
$companies = $result->CompanyMatches->Company;
|
||||
$count = count($companies);
|
||||
for($i = 0; $i < $count; $i ++)
|
||||
{
|
||||
print "\n * Company - ";
|
||||
print $companies[$i]->Name;
|
||||
print "\n * Company Match Identifier - ";
|
||||
print $companies[$i]->CompanyMatchIdentifier;
|
||||
}
|
||||
}
|
||||
catch( SoapFault $exception )
|
||||
{
|
||||
// Print the exception
|
||||
print "\n Exception ";
|
||||
var_dump($exception->detail);
|
||||
}
|
||||
?>
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Infogreffe.php';
|
||||
require_once dirname(__FILE__) . '/Service.php';
|
||||
|
||||
/**
|
||||
* Infogreffe : Document Acte
|
||||
*/
|
||||
class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
class SdMetier_Infogreffe_DocAC extends SdMetier_Infogreffe_Service
|
||||
{
|
||||
|
||||
const INT = 1000;
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Infogreffe.php';
|
||||
require_once dirname(__FILE__) . '/Service.php';
|
||||
|
||||
/**
|
||||
* Infogreffe : Document Bilan
|
||||
*/
|
||||
class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
class SdMetier_Infogreffe_DocBI extends SdMetier_Infogreffe_Service
|
||||
{
|
||||
|
||||
const INT = 1000;
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Infogreffe.php';
|
||||
require_once dirname(__FILE__) . '/Service.php';
|
||||
|
||||
/**
|
||||
* Infogreffe : Document Bilan
|
||||
* Infogreffe : Document Statut
|
||||
*/
|
||||
class Metier_Infogreffe_St extends Metier_Infogreffe
|
||||
class SdMetier_Infogreffe_DocST extends SdMetier_Infogreffe_Service
|
||||
{
|
||||
|
||||
/**
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Infogreffe provider
|
||||
*/
|
||||
class Metier_Infogreffe
|
||||
class SdMetier_Infogreffe_Service
|
||||
{
|
||||
|
||||
/**
|
18
library/SdMetier/README
Normal file
18
library/SdMetier/README
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
Scores & Decisions Business Libraries
|
||||
=====================================
|
||||
|
||||
List of libraries and description
|
||||
|
||||
Graydon
|
||||
|
||||
Infogreffe
|
||||
|
||||
Scoring
|
||||
|
||||
Search
|
||||
|
||||
Sfr
|
||||
|
||||
|
||||
|
0
library/SdMetier/Scoring/README
Normal file
0
library/SdMetier/Scoring/README
Normal file
987
library/SdMetier/Scoring/Vars.php
Normal file
987
library/SdMetier/Scoring/Vars.php
Normal file
@ -0,0 +1,987 @@
|
||||
<?php
|
||||
class SdMetier_Scoring_Vars
|
||||
{
|
||||
protected $ACTIFINSEE;
|
||||
protected $ACTIFRNCS;
|
||||
protected $ACTISURF;
|
||||
protected $ACTIVNAT;
|
||||
protected $ACTIVREG;
|
||||
protected $ADRDOM;
|
||||
protected $AGE;
|
||||
protected $ANNEEp3;
|
||||
protected $ANNEEp2;
|
||||
protected $ANNEEp1;
|
||||
protected $ANNEE;
|
||||
protected $ANNEE1;
|
||||
protected $ANNEE2;
|
||||
protected $ANNEE3;
|
||||
protected $ANNEE4;
|
||||
protected $ANNEE5;
|
||||
protected $ANNONCEADR;
|
||||
protected $ANNONCEADRDATE;
|
||||
protected $ANNONCEBOD;
|
||||
protected $ANNONCEBODA;
|
||||
protected $ANNONCEBODADATE;
|
||||
protected $ANNONCEBODB;
|
||||
protected $ANNONCEBODBDATE;
|
||||
protected $ANNONCEBODC;
|
||||
protected $ANNONCEBODCDATE;
|
||||
protected $ANNONCEBODCMANQDATE;
|
||||
protected $ANNONCEBODCMANQ_AA;
|
||||
protected $ANNONCEBODCREGUL;
|
||||
protected $ANNONCEBODDATE;
|
||||
protected $ANNONCECAC;
|
||||
protected $ANNONCECAC2;
|
||||
protected $ANNONCECAC3;
|
||||
protected $ANNONCECACDATE;
|
||||
protected $ANNONCECAP;
|
||||
protected $ANNONCECAPAUG;
|
||||
protected $ANNONCECAPAUGDATE;
|
||||
protected $ANNONCECAPAUGDIM;
|
||||
protected $ANNONCECAPAUG_AAD;
|
||||
protected $ANNONCECAPAUG_AAF;
|
||||
protected $ANNONCECAPDATE;
|
||||
protected $ANNONCECAPDIM;
|
||||
protected $ANNONCECAPDIMAUG;
|
||||
protected $ANNONCECAPDIMDATE;
|
||||
protected $ANNONCECAPDIM_AAD;
|
||||
protected $ANNONCECAPDIM_AAF;
|
||||
protected $ANNONCECAPSIG;
|
||||
protected $ANNONCECLODELAI;
|
||||
protected $ANNONCEDATE;
|
||||
protected $ANNONCEDER;
|
||||
protected $ANNONCEDERDATE;
|
||||
protected $ANNONCEDERSOURCE;
|
||||
protected $ANNONCEDERTEXTE;
|
||||
protected $ANNONCEDIR;
|
||||
protected $ANNONCEDIRDATE;
|
||||
protected $ANNONCEDISSO;
|
||||
protected $ANNONCEDISSODATE;
|
||||
protected $ANNONCEDISSONON;
|
||||
protected $ANNONCEDISSONONDATE;
|
||||
protected $ANNONCEFJUR;
|
||||
protected $ANNONCEFJURDATE;
|
||||
protected $ANNONCEFUS;
|
||||
protected $ANNONCEFUSDATE;
|
||||
protected $ANNONCEHISTDATE;
|
||||
protected $ANNONCEHOM;
|
||||
protected $ANNONCEHOMDATE;
|
||||
protected $ANNONCEINTERDIT;
|
||||
protected $ANNONCEINTERDITDATE;
|
||||
protected $ANNONCELIM;
|
||||
protected $ANNONCELJ;
|
||||
protected $ANNONCELJDATE;
|
||||
protected $ANNONCELJDELAI;
|
||||
protected $ANNONCELOC;
|
||||
protected $ANNONCELOCDATE;
|
||||
protected $ANNONCEOBJET;
|
||||
protected $ANNONCEPC;
|
||||
protected $ANNONCEPCDATE;
|
||||
protected $ANNONCEPCHISTO;
|
||||
protected $ANNONCEPC_CESDATE;
|
||||
protected $ANNONCEPC_INT1;
|
||||
protected $ANNONCEPC_INT1_TIT;
|
||||
protected $ANNONCEPC_INT2;
|
||||
protected $ANNONCEPC_INT2_TIT;
|
||||
protected $ANNONCEPC_NUM;
|
||||
protected $ANNONCEPC_OBS;
|
||||
protected $ANNONCEPLAN;
|
||||
protected $ANNONCEPLANDATE;
|
||||
protected $ANNONCEPLANDUREE;
|
||||
protected $ANNONCEPLANFINDATE;
|
||||
protected $ANNONCEPLANMODIFDATE;
|
||||
protected $ANNONCEPOURS;
|
||||
protected $ANNONCEPOURSDATE;
|
||||
protected $ANNONCEPUB;
|
||||
protected $ANNONCERECON;
|
||||
protected $ANNONCERECONDATE;
|
||||
protected $ANNONCERJ;
|
||||
protected $ANNONCERJDATE;
|
||||
protected $ANNONCESOMM;
|
||||
protected $ANNONCESOMMDATE;
|
||||
protected $ANNONCESV;
|
||||
protected $ANNONCESVDATE;
|
||||
protected $ANNONCEVC;
|
||||
protected $ANNONCEVCDATE;
|
||||
protected $ANNONCEVC_MT;
|
||||
protected $ANNONCEVC_OBJ;
|
||||
protected $APE4;
|
||||
protected $APE5;
|
||||
protected $APEAGRICPAC;
|
||||
protected $APEENT;
|
||||
protected $APEETAB;
|
||||
protected $APEINSEE;
|
||||
protected $APERNCS;
|
||||
protected $AUXILT;
|
||||
protected $AVIS3ANS;
|
||||
protected $BILAN;
|
||||
protected $BILANANNEE;
|
||||
protected $BILANANNEE1;
|
||||
protected $BILANANNEE2;
|
||||
protected $BILANANNEE3;
|
||||
protected $BILANANNEE4;
|
||||
protected $BILANANNEE5;
|
||||
protected $BILANANNEEp;
|
||||
protected $BILANANNEEp2;
|
||||
protected $BILANANNEEp3;
|
||||
protected $BILANANNEEp4;
|
||||
protected $BILANDATE;
|
||||
protected $BILANDATEp;
|
||||
protected $BILANDATEp2;
|
||||
protected $BILANDATEp3;
|
||||
protected $BILANDATEp4;
|
||||
protected $BILANDERANNEE;
|
||||
protected $BILANFACULT;
|
||||
protected $BILANFJU;
|
||||
protected $BILANMANQUE;
|
||||
protected $BILANNONDIF;
|
||||
protected $BILANVIEUX;
|
||||
protected $BILANp;
|
||||
protected $BILANp2;
|
||||
protected $BILANp3;
|
||||
protected $BILANp4;
|
||||
protected $CABILAN;
|
||||
protected $CABIOUES;
|
||||
protected $CAESTIME;
|
||||
protected $CADBAT_NB_TOT;
|
||||
protected $CADTER_NB_TOT;
|
||||
protected $CADBAT_NB_PROP;
|
||||
protected $CADTER_NB_PROP;
|
||||
protected $CADBAT_NB_NONPROP;
|
||||
protected $CADTER_NB_NONPROP;
|
||||
protected $CADBAT_SURF_CUM;
|
||||
protected $CADBAT_SURF_TOT;
|
||||
protected $CADTER_SURF_CUM;
|
||||
protected $CADTER_SURF_TOT;
|
||||
protected $CALCUL1;
|
||||
protected $CALCUL2;
|
||||
protected $CALCUL3;
|
||||
protected $CALCUL4;
|
||||
protected $CALCUL5;
|
||||
protected $CALCUL6;
|
||||
protected $CALCUL7;
|
||||
protected $CALCUL8;
|
||||
protected $CALCUL9;
|
||||
protected $CAPITAL;
|
||||
protected $CAPITAL_CREA;
|
||||
protected $CAPITAL_PRE;
|
||||
protected $CAPITAL_NBACTION;
|
||||
protected $CAPITAL_MTACTION;
|
||||
protected $CAPITAL_TYPE;
|
||||
protected $CA_COEF;
|
||||
protected $CA_TAUX;
|
||||
protected $CA_Y;
|
||||
protected $COTELIM;
|
||||
protected $COTEOK;
|
||||
protected $COTEOK_MMAA;
|
||||
protected $COTETYPEHIS;
|
||||
protected $COTETYPE_MMAA;
|
||||
protected $CSFACTO;
|
||||
protected $CSFACTO_MMAA;
|
||||
protected $DATE;
|
||||
protected $DATEp;
|
||||
protected $DEPARTEMENT;
|
||||
protected $DEPARTEMENT_DE;
|
||||
protected $DCREN;
|
||||
protected $DCREN_AA;
|
||||
protected $DEFAUT_MMAA;
|
||||
protected $DELAIPAY;
|
||||
protected $DELAIPAY_MMAA;
|
||||
protected $DELAIPAYp;
|
||||
protected $DEPSIE;
|
||||
protected $DEPSIE_DE;
|
||||
protected $DIMMAT;
|
||||
protected $DIMMAT_AA;
|
||||
protected $DIR1_AGE;
|
||||
protected $DIR1_FONC;
|
||||
protected $DIR1_NOM;
|
||||
protected $DIR1_TYPE;
|
||||
protected $DIR2_AGE;
|
||||
protected $DIR2_FONC;
|
||||
protected $DIR2_NOM;
|
||||
protected $DIR2_TYPE;
|
||||
protected $DIR_NB;
|
||||
protected $DOM_NB;
|
||||
protected $DOM_NOM;
|
||||
protected $DOM_SIREN;
|
||||
protected $EFFBILAN;
|
||||
protected $EFFECTIF;
|
||||
protected $EFFECTIF_POPU;
|
||||
protected $ELIMINE;
|
||||
protected $ENCOURSDEM;
|
||||
protected $ENCOURS; // Encours final attribué
|
||||
protected $ENCOURSCALC; // Encours calculé sans cut-off
|
||||
protected $ENQUETE;
|
||||
protected $ENQUETELIM;
|
||||
protected $ENQUETEMAXI;
|
||||
protected $ENTREP_ALT;
|
||||
protected $ETATINSEE;
|
||||
protected $ETATINSEE_MMAA;
|
||||
protected $EXPLEN;
|
||||
protected $EXPLET;
|
||||
protected $EXPORTRANG;
|
||||
protected $EXPORTRANG_ARR;
|
||||
protected $FJUR;
|
||||
protected $FJUR1;
|
||||
protected $FJUR2;
|
||||
protected $FJUR4;
|
||||
protected $FJURINSEE;
|
||||
protected $FJURPUB;
|
||||
protected $FJURRNCS;
|
||||
protected $FJUR_PRE;
|
||||
protected $FRANCHISE;
|
||||
protected $FUSIONPROJET;
|
||||
protected $FUSIONPROJET_DATE;
|
||||
protected $FUSIONPROJET_SIREN;
|
||||
protected $GERANTMAJ;
|
||||
protected $GRANDGROUPE;
|
||||
protected $HOLDING;
|
||||
protected $IMPAYELOURD_MMAA;
|
||||
protected $IMPAYE_MMAA;
|
||||
protected $IMPORTRANG;
|
||||
protected $IMPORTRANG_ARR;
|
||||
protected $INFLA;
|
||||
protected $INFLAMOY1;
|
||||
protected $INFLAMOY2;
|
||||
protected $INFLAMOY3;
|
||||
protected $INFLATION;
|
||||
protected $INFOCESSATION_MMAA;
|
||||
protected $INFOFACTO;
|
||||
protected $JOUR_DATE;
|
||||
protected $JOUR_HEURE;
|
||||
protected $LCASSUR_MMAA;
|
||||
protected $LIBARTDEPSIE;
|
||||
protected $LIEUACT;
|
||||
protected $LISTEPRODUIT;
|
||||
protected $MARCHE;
|
||||
protected $MARCHEPART;
|
||||
protected $MARCHEPARTEVOL;
|
||||
protected $MARCHEPARTp;
|
||||
protected $MARCHEPLACE;
|
||||
protected $MARCHEPLACE_DEP;
|
||||
protected $MARCHEVOL;
|
||||
protected $MARCHEVOLUMEVOL;
|
||||
protected $MARCHEp;
|
||||
protected $MARCHESAL;
|
||||
protected $MARCHESALp;
|
||||
protected $MARCHENBENT;
|
||||
protected $MARCHENBENTp;
|
||||
protected $MARCHENBENT_DEP;
|
||||
protected $MARCHENBENT_VILLE;
|
||||
protected $MARCHEPUBLIC3_NB;
|
||||
protected $MARCHEPUBLIC3_MT;
|
||||
protected $MARCHEPUBLIC3_POURC;
|
||||
protected $MARCHEPUBLICAPP3_NB; // Nombre dprotected $avis de marchés attribués par une administration sur les 3 dernières années
|
||||
protected $MARCHEPUBLIC3APP_MT; // Montant des avis de marchés attribués par une administration sur les 3 dernières années
|
||||
protected $MARCHEPUBLIC3APP_POURC; // % Par rapport au total des produits de fonctionnement
|
||||
protected $MARCHEPUBLICDER_OBJ;
|
||||
protected $MARCHEPUBLICDER_CLI;
|
||||
protected $MARCHEPUBLICDER_MT;
|
||||
protected $MARCHEPUBLICDER_DATE;
|
||||
protected $MARCHEPUBLICDERAPP_OBJ; // @todo
|
||||
protected $MARCHEPUBLICDERAPP_BEN; // Bénéficiaire
|
||||
protected $MARCHEPUBLICDERAPP_MT; // ..
|
||||
protected $MARCHEPUBLICDERAPP_DATE; // ..
|
||||
protected $MARQUENB;
|
||||
protected $MARQUENB_INT;
|
||||
protected $MARQUENB_EUR;
|
||||
protected $MARQUENB_FR;
|
||||
protected $MARQUELISTE_INT;
|
||||
protected $MARQUELISTE_EUR;
|
||||
protected $MARQUELISTE_FR;
|
||||
protected $MODEN;
|
||||
protected $MODIFBILDATE;
|
||||
protected $MODIFDERDATE;
|
||||
protected $MODIFINSEE;
|
||||
protected $MODIFINSEEDATE;
|
||||
protected $MODIFPAIDATE;
|
||||
protected $MODIFRNCS;
|
||||
protected $MODIFRNCSDATE;
|
||||
protected $MONOACT;
|
||||
protected $MONOREG;
|
||||
protected $NBBILAN;
|
||||
protected $NBBILANMANQUE;
|
||||
protected $NBBILANSEC;
|
||||
protected $NBDIRLIEN;
|
||||
protected $NBDIRSCI;
|
||||
protected $NBDIRSCIADR;
|
||||
protected $NBETEXPL;
|
||||
protected $NBFILLE;
|
||||
protected $NBINTERRO1;
|
||||
protected $NBINTERRO12;
|
||||
protected $NBINTERRO3;
|
||||
protected $NBINTERRO6;
|
||||
protected $NBNIC;
|
||||
protected $NBSOCSEC;
|
||||
protected $NBSOCSECPUB;
|
||||
protected $NBSUIVICLI;
|
||||
protected $NIC;
|
||||
protected $NICFILLE;
|
||||
protected $NICMERE;
|
||||
protected $NIVEAU;
|
||||
protected $NOMEN;
|
||||
protected $NOMFILLE;
|
||||
protected $NOMFUSION;
|
||||
protected $NOMMERE;
|
||||
protected $NOTE100;
|
||||
protected $NOTECAP20;
|
||||
protected $NOTECFI20;
|
||||
protected $NOTEDEFPRO;
|
||||
protected $NOTEDEFSEC;
|
||||
protected $NOTELED20;
|
||||
protected $NOTEMEX20;
|
||||
protected $NOTERBT20;
|
||||
protected $NOTESBRUTE;
|
||||
protected $NOTESCORE;
|
||||
protected $NOTETRES20;
|
||||
protected $ORIASCAT;
|
||||
protected $ORIASID;
|
||||
protected $ORIASID_DATE;
|
||||
protected $ORIGINE;
|
||||
protected $PLAN;
|
||||
protected $PLANMODIF;
|
||||
protected $POPULATION;
|
||||
protected $PPNONDIFF;
|
||||
protected $PRESENTINSEE;
|
||||
protected $PRESENTRNCS;
|
||||
protected $PRIVILEGES;
|
||||
protected $PRIVILEGESECU;
|
||||
protected $PRIVILEGESECU_MT;
|
||||
protected $PRIVILEGESURSSAF_MMAA;
|
||||
protected $PRIVILEGES_MMAA;
|
||||
protected $PRIVILEGETRES;
|
||||
protected $PRIVILEGETRES_MT;
|
||||
protected $PRODPART;
|
||||
protected $R;
|
||||
protected $RCAI_COEF;
|
||||
protected $RCAI_TAUX;
|
||||
protected $RCAI_Y;
|
||||
protected $RECME;
|
||||
protected $REGIMP;
|
||||
protected $RISQUEACT;
|
||||
protected $RISQUEACTBASSIN;
|
||||
protected $RISQUEACT_NB;
|
||||
protected $RISQUEANALYSE_MMAA;
|
||||
protected $RISQUEGEO;
|
||||
protected $RISQUEGEOARRETE;
|
||||
protected $RISQUEGEOARRETE_AA;
|
||||
protected $RISQUEGEOARRETE_DATE;
|
||||
protected $RISQUEGEOARRETE_EVTDATE;
|
||||
protected $RISQUEGEOARRETE_JODATE;
|
||||
protected $RISQUEGEOARRETE_NB;
|
||||
protected $RISQUEGEOARRETE_VILLE;
|
||||
protected $RISQUEGEO_NB;
|
||||
protected $RISQUEGROUPE_MMAA;
|
||||
protected $RISQUEIMPAYE_MMAA;
|
||||
protected $RJFILLE;
|
||||
protected $RJMERE;
|
||||
protected $ROUEDELARELANCE;
|
||||
protected $RPEN;
|
||||
protected $RPS_ACCORDDATE;
|
||||
protected $RPS_INFODATE;
|
||||
protected $RPS_NEGO;
|
||||
protected $RPS_PLAN;
|
||||
protected $Ra;
|
||||
protected $Rap;
|
||||
protected $Rdiff;
|
||||
protected $Revol;
|
||||
protected $Revolp;
|
||||
protected $Revolp2;
|
||||
protected $Revolp3;
|
||||
protected $Revols;
|
||||
protected $Rp;
|
||||
protected $Rp2;
|
||||
protected $Rp3;
|
||||
protected $Rp4;
|
||||
protected $Rs;
|
||||
protected $Rsp;
|
||||
protected $Rsp1;
|
||||
protected $Rsp2;
|
||||
protected $Rsp3;
|
||||
protected $SAISONAT;
|
||||
protected $SCORECONF;
|
||||
protected $SCOREDEFTAUX;
|
||||
protected $SCOREDIRI;
|
||||
protected $SIREN;
|
||||
protected $SIRENFILLE;
|
||||
protected $SIRENMERE;
|
||||
protected $SIRET;
|
||||
protected $SIRETFILLE;
|
||||
protected $SIRETMERE;
|
||||
protected $SITUACT;
|
||||
protected $SOCIETE_COTE;
|
||||
protected $SOCIETE_COTE_CAPITALISATION;
|
||||
protected $SOCIETE_COTE_COURS;
|
||||
protected $SOCIETE_COTE_COURS_DATE;
|
||||
protected $SOCIETE_COTE_COURS_MAX;
|
||||
protected $SOCIETE_COTE_COURS_MIN;
|
||||
protected $SOCIETE_COTE_ISIN;
|
||||
protected $SOCIETE_COTE_MARCHE;
|
||||
protected $SOCIETE_COTE_MARCHE_MERE;
|
||||
protected $SOCIETE_COTE_PLACE;
|
||||
protected $T;
|
||||
protected $TAUXRA;
|
||||
protected $TAUXRAMOY1;
|
||||
protected $TAUXRAMOY2;
|
||||
protected $TAUXRAMOY3;
|
||||
protected $TCAEXP;
|
||||
protected $TEMOINACT;
|
||||
protected $TEMOINACT_MAX;
|
||||
protected $TEMOINATT;
|
||||
protected $TEMOINATT_MAX;
|
||||
protected $TEMOINAVI;
|
||||
protected $TEMOINAVI_MAX;
|
||||
protected $TEMOINCAPFAIBLE;
|
||||
protected $TEMOINCAPFAIBLE_MAX;
|
||||
protected $TEMOINCLES;
|
||||
protected $TEMOINCLES_MAX;
|
||||
protected $TEMOINCONF;
|
||||
protected $TEMOINCONF_MAX;
|
||||
protected $TEMOINCYANO;
|
||||
protected $TEMOINCYANO_MAX;
|
||||
protected $TEMOINCYC;
|
||||
protected $TEMOINCYC_MAX;
|
||||
protected $TEMOINDEF;
|
||||
protected $TEMOINDEF_MAX;
|
||||
protected $TEMOINDIAG;
|
||||
protected $TEMOINDIAG_MAX;
|
||||
protected $TEMOINDIR;
|
||||
protected $TEMOINDIR_MAX;
|
||||
protected $TEMOINEXP;
|
||||
protected $TEMOINEXP_MAX;
|
||||
protected $TEMOINFAV;
|
||||
protected $TEMOINFAV_MAX;
|
||||
protected $TEMOINFIL;
|
||||
protected $TEMOINFIL_MAX;
|
||||
protected $TEMOINFIN;
|
||||
protected $TEMOINFIN_MAX;
|
||||
protected $TEMOINFLANO;
|
||||
protected $TEMOINFLANO_MAX;
|
||||
protected $TEMOINFLUX;
|
||||
protected $TEMOINFLUX_MAX;
|
||||
protected $TEMOINGRAPH;
|
||||
protected $TEMOINGRAPH_MAX;
|
||||
protected $TEMOINHIST;
|
||||
protected $TEMOINHIST_MAX;
|
||||
protected $TEMOINLOC;
|
||||
protected $TEMOINLOC_MAX;
|
||||
protected $TEMOINMAR;
|
||||
protected $TEMOINMAR_MAX;
|
||||
protected $TEMOINMARPUB;
|
||||
protected $TEMOINMARPUB_MAX;
|
||||
protected $TEMOINMOIN;
|
||||
protected $TEMOINMOIN_MAX;
|
||||
protected $TEMOINNORM;
|
||||
protected $TEMOINNORM_MAX;
|
||||
protected $TEMOINOBS;
|
||||
protected $TEMOINOBS_MAX;
|
||||
protected $TEMOINPAY;
|
||||
protected $TEMOINPAY_MAX;
|
||||
protected $TEMOINPLUS;
|
||||
protected $TEMOINPLUS_MAX;
|
||||
protected $TEMOINPROF;
|
||||
protected $TEMOINPROF_MAX;
|
||||
protected $TEMOINPROJ;
|
||||
protected $TEMOINPROJ_MAX;
|
||||
protected $TEMOINREPA;
|
||||
protected $TEMOINREPA_MAX;
|
||||
protected $TEMOINRES;
|
||||
protected $TEMOINRES_MAX;
|
||||
protected $TEMOINRIS;
|
||||
protected $TEMOINRIS_MAX;
|
||||
protected $TEMOINSTACTIF;
|
||||
protected $TEMOINSTACTIF_MAX;
|
||||
protected $TEMOINSTANO;
|
||||
protected $TEMOINSTANO_MAX;
|
||||
protected $TEMOINSTPASS;
|
||||
protected $TEMOINSTPASS_MAX;
|
||||
protected $TEMOINSTRUCT;
|
||||
protected $TEMOINSTRUCT_MAX;
|
||||
protected $TEMOINSTSYNT;
|
||||
protected $TEMOINSTSYNT_MAX;
|
||||
protected $TEMOINVUL;
|
||||
protected $TEMOINVUL_MAX;
|
||||
protected $TEMOINVALBIL;
|
||||
protected $TEMOINVALBIL_MAX;
|
||||
protected $TEMOINVALCONC;
|
||||
protected $TEMOINVALCONC_MAX;
|
||||
protected $TEMOINVALCR;
|
||||
protected $TEMOINVALCR_MAX;
|
||||
protected $TEMOINVALDIAG;
|
||||
protected $TEMOINVALDIAG_MAX;
|
||||
protected $TEMOINVALMETH;
|
||||
protected $TEMOINVALMETH_MAX;
|
||||
protected $TEMOINVALMRET;
|
||||
protected $TEMOINVALMRET_MAX;
|
||||
protected $TEMOINVALPATR;
|
||||
protected $TEMOINVALPATR_MAX;
|
||||
protected $TEMOINVALPOND;
|
||||
protected $TEMOINVALPOND_MAX;
|
||||
protected $TEMOINVALPRES;
|
||||
protected $TEMOINVALPRES_MAX;
|
||||
protected $TEMOINVALRESV;
|
||||
protected $TEMOINVALRESV_MAX;
|
||||
protected $TEMOINVALRETR;
|
||||
protected $TEMOINVALRETR_MAX;
|
||||
protected $TEMOINVALTABB;
|
||||
protected $TEMOINVALTABB_MAX;
|
||||
protected $TEMOINVALTABS;
|
||||
protected $TEMOINVALTABS_MAX;
|
||||
protected $TEMOINVALTABR;
|
||||
protected $TEMOINVALTABR_MAX;
|
||||
protected $TEMOINVALMINMAX;
|
||||
protected $TEMOINVALMINMAX_MAX;
|
||||
protected $TEMOINVALMAXMIN;
|
||||
protected $TEMOINVALMAXMIN_MAX;
|
||||
protected $TEMOINADIZES;
|
||||
protected $TEMOINADIZES_MAX;
|
||||
protected $TEMOINMRQ;
|
||||
protected $TEMOINMRQ_MAX;
|
||||
protected $TEMOINMRQLIST;
|
||||
protected $TEMOINMRQLIST_MAX;
|
||||
protected $TRIBUNAL_ACTUEL;
|
||||
protected $TRIBUNAL_CREATION;
|
||||
protected $TRIBUNAL_PROCOL;
|
||||
protected $TU;
|
||||
protected $TVAINTRA;
|
||||
protected $TVAINTRAFACULT;
|
||||
protected $TYPEMERE;
|
||||
protected $VALCOEFMINCA; //Table baremCA
|
||||
protected $VALCOEFMAXCA; // Table baremCA
|
||||
protected $VAL319_EU;
|
||||
protected $VAL320_EU;
|
||||
protected $VAL322_EU;
|
||||
protected $VAL598_EU;
|
||||
protected $VAL970_EU;
|
||||
protected $VAL971_EU;
|
||||
protected $VAL974_EU;
|
||||
protected $VAL975_EU;
|
||||
protected $VAL976_EU;
|
||||
protected $VAL977_EU;
|
||||
protected $VAL978_EU;
|
||||
protected $VAL979_EU;
|
||||
protected $VAL980_EU;
|
||||
protected $VAL981_EU;
|
||||
protected $VAL982_EU;
|
||||
protected $VAL983_EU;
|
||||
protected $VAL984_EU;
|
||||
protected $VAL985_EU;
|
||||
protected $VAL986_EU;
|
||||
protected $VAL987_EU;
|
||||
protected $VAL988_EU;
|
||||
protected $VAL989_EU;
|
||||
protected $VAL990_EU;
|
||||
protected $VAL991_EU;
|
||||
protected $VAL992_EU;
|
||||
protected $VAL993_EU;
|
||||
protected $VAL994_EU;
|
||||
protected $VAL995_EU;
|
||||
protected $VAL996_EU;
|
||||
protected $VAL997_EU;
|
||||
protected $VAL998_EU;
|
||||
protected $VAL999_EU;
|
||||
protected $VILLE;
|
||||
protected $VENTEMAX_VILLE_EU;
|
||||
protected $VENTEMAX_VILLE_MT;
|
||||
protected $VENTEMOY_VILLE_EU;
|
||||
protected $VENTEMOY_VILLE_MT;
|
||||
protected $VENTEMIN_VILLE_EU;
|
||||
protected $VENTEMIN_VILLE_MT;
|
||||
protected $VENTE_VILLE_NB;
|
||||
protected $VENTEMAX_DEP_EU;
|
||||
protected $VENTEMAX_DEP_MT;
|
||||
protected $VENTEMOY_DEP_EU;
|
||||
protected $VENTEMOY_DEP_MT;
|
||||
protected $VENTEMIN_DEP_EU;
|
||||
protected $VENTEMIN_DEP_MT;
|
||||
protected $VENTE_DEP_NB;
|
||||
protected $VENTEMAX_FRA_EU;
|
||||
protected $VENTEMAX_FRA_MT;
|
||||
protected $VENTEMOY_FRA_EU;
|
||||
protected $VENTEMOY_FRA_MT;
|
||||
protected $VENTEMIN_FRA_EU;
|
||||
protected $VENTEMIN_FRA_MT;
|
||||
protected $VENTE_FRA_NB;
|
||||
protected $VENTEMAX_MT; // A supprimer après la 4.02
|
||||
protected $VENTEMIN_MT; // A supprimer après la 4.02
|
||||
protected $VENTE_NB; // A supprimer après la 4.02
|
||||
protected $WALDEC;
|
||||
protected $Y;
|
||||
protected $ZEMET;
|
||||
protected $ZONEPRI;
|
||||
protected $ZONEPRIAFR;
|
||||
protected $ZONEPRICUCS;
|
||||
protected $ZONEPRIZFU;
|
||||
protected $ZONEPRIZRR;
|
||||
protected $ZONEPRIZRU;
|
||||
protected $ZONEPRIZUS;
|
||||
protected $nm;
|
||||
protected $nmp;
|
||||
protected $nmp2;
|
||||
protected $nmp3;
|
||||
protected $nmp4;
|
||||
protected $regR;
|
||||
protected $regRs;
|
||||
|
||||
/**
|
||||
* Tableau de conversion des communes
|
||||
* @var unknown
|
||||
*/
|
||||
protected $tabZones2Ratios = array(
|
||||
'R01a'=>'R[801]',
|
||||
'R01b'=>'Rh[801]',
|
||||
'R01c'=>'Rs[801]',
|
||||
'R02a'=>'R[802]',
|
||||
'R02b'=>'Rh[802]',
|
||||
'R02c'=>'Rs[802]',
|
||||
'R02d'=>'Rq[802]',
|
||||
'R02e'=>'Rt[802]',
|
||||
'R03a'=>'R[803]',
|
||||
'R03b'=>'Rh[803]',
|
||||
'R03c'=>'Rs[803]',
|
||||
'R03d'=>'Rq[803]',
|
||||
'R03e'=>'Rt[803]',
|
||||
'R04a'=>'R[804]',
|
||||
'R04b'=>'Rh[804]',
|
||||
'R04c'=>'Rs[804]',
|
||||
'R04d'=>'Rq[804]',
|
||||
'R04e'=>'Rt[804]',
|
||||
'R05a'=>'R[805]',
|
||||
'R05b'=>'Rh[805]',
|
||||
'R05c'=>'Rs[805]',
|
||||
'R06a'=>'R[806]',
|
||||
'R06b'=>'Rh[806]',
|
||||
'R06c'=>'Rs[806]',
|
||||
'R06d'=>'Rq[806]',
|
||||
'R06e'=>'Rt[806]',
|
||||
'R07a'=>'R[807]',
|
||||
'R07b'=>'Rh[807]',
|
||||
'R07c'=>'Rs[807]',
|
||||
'R07d'=>'Rq[807]',
|
||||
'R07e'=>'Rt[807]',
|
||||
'R08a'=>'R[808]',
|
||||
'R08b'=>'Rh[808]',
|
||||
'R08c'=>'Rs[808]',
|
||||
'R08d'=>'Rq[808]',
|
||||
'R08e'=>'Rt[808]',
|
||||
'R09a'=>'R[809]',
|
||||
'R09b'=>'Rh[809]',
|
||||
'R09c'=>'Rs[809]',
|
||||
'R09d'=>'Rq[809]',
|
||||
'R09e'=>'Rt[809]',
|
||||
'R10a'=>'R[810]',
|
||||
'R10b'=>'Rh[810]',
|
||||
'R10c'=>'Rs[810]',
|
||||
'R10d'=>'Rq[810]',
|
||||
'R10e'=>'Rt[810]',
|
||||
'R11a'=>'R[811]',
|
||||
'R11b'=>'Rh[811]',
|
||||
'R11c'=>'Rs[811]',
|
||||
'R12a'=>'R[812]',
|
||||
'R12b'=>'Rh[812]',
|
||||
'R12c'=>'Rs[812]',
|
||||
'R13a'=>'R[813]',
|
||||
'R13b'=>'Rh[813]',
|
||||
'R13c'=>'Rs[813]',
|
||||
'R13d'=>'Rq[813]',
|
||||
'R13e'=>'Rt[813]',
|
||||
'R14a'=>'R[814]',
|
||||
'R14b'=>'Rh[814]',
|
||||
'R14c'=>'Rs[814]',
|
||||
'R14d'=>'Rq[814]',
|
||||
'R14e'=>'Rt[814]',
|
||||
'R15a'=>'R[815]',
|
||||
'R15b'=>'Rh[815]',
|
||||
'R15c'=>'Rs[815]',
|
||||
'R15d'=>'Rq[815]',
|
||||
'R15e'=>'Rt[815]',
|
||||
'R16a'=>'R[816]',
|
||||
'R16b'=>'Rh[816]',
|
||||
'R16c'=>'Rs[816]',
|
||||
'R16d'=>'Rq[816]',
|
||||
'R16e'=>'Rt[816]',
|
||||
'R17a'=>'R[817]',
|
||||
'R17b'=>'Rh[817]',
|
||||
'R17c'=>'Rs[817]',
|
||||
'R18a'=>'R[818]',
|
||||
'R18b'=>'Rh[818]',
|
||||
'R18c'=>'Rs[818]',
|
||||
'R18d'=>'Rq[818]',
|
||||
'R18e'=>'Rt[818]',
|
||||
'R19a'=>'R[819]',
|
||||
'R19b'=>'Rh[819]',
|
||||
'R19c'=>'Rs[819]',
|
||||
'R19d'=>'Rq[819]',
|
||||
'R19e'=>'Rt[819]',
|
||||
'R20a'=>'R[820]',
|
||||
'R20b'=>'Rh[820]',
|
||||
'R20c'=>'Rs[820]',
|
||||
'R20d'=>'Rq[820]',
|
||||
'R20e'=>'Rt[820]',
|
||||
'R21a'=>'R[821]',
|
||||
'R21b'=>'Rh[821]',
|
||||
'R21c'=>'Rs[821]',
|
||||
'R21d'=>'Rq[821]',
|
||||
'R21e'=>'Rt[821]',
|
||||
'R22a'=>'R[822]',
|
||||
'R22b'=>'Rh[822]',
|
||||
'R22c'=>'Rs[822]',
|
||||
'R23a'=>'R[823]',
|
||||
'R23b'=>'Rh[823]',
|
||||
'R23c'=>'Rs[823]',
|
||||
'R24a'=>'R[824]',
|
||||
'R24b'=>'Rh[824]',
|
||||
'R24c'=>'Rs[824]',
|
||||
'R25a'=>'R[825]',
|
||||
'R25b'=>'Rh[825]',
|
||||
'R25c'=>'Rs[825]',
|
||||
'R26a'=>'R[826]',
|
||||
'R26b'=>'Rh[826]',
|
||||
'R26c'=>'Rs[826]',
|
||||
'R26d'=>'Rq[826]',
|
||||
'R26e'=>'Rt[826]',
|
||||
'R27a'=>'R[827]',
|
||||
'R27b'=>'Rh[827]',
|
||||
'R27c'=>'Rs[827]',
|
||||
'R27d'=>'Rq[827]',
|
||||
'R27e'=>'Rt[827]',
|
||||
'R28a'=>'R[828]',
|
||||
'R28b'=>'Rh[828]',
|
||||
'R28c'=>'Rs[828]',
|
||||
'R28d'=>'Rq[828]',
|
||||
'R28e'=>'Rt[828]',
|
||||
'R29a'=>'R[829]',
|
||||
'R29b'=>'Rh[829]',
|
||||
'R29c'=>'Rs[829]',
|
||||
'R29d'=>'Rq[829]',
|
||||
'R29e'=>'Rt[829]',
|
||||
'R30a'=>'R[830]',
|
||||
'R30b'=>'Rh[830]',
|
||||
'R30c'=>'Rs[830]',
|
||||
'R30d'=>'Rq[830]',
|
||||
'R30e'=>'Rt[830]',
|
||||
'R31a'=>'R[843]',
|
||||
'R31b'=>'Rh[843]',
|
||||
'R31c'=>'Rs[843]',
|
||||
'R31d'=>'Rq[843]',
|
||||
'R31e'=>'Rt[843]',
|
||||
'R32a'=>'R[831]',
|
||||
'R32b'=>'Rh[831]',
|
||||
'R32c'=>'Rs[831]',
|
||||
'R33a'=>'R[832]',
|
||||
'R33b'=>'Rh[832]',
|
||||
'R33c'=>'Rs[832]',
|
||||
'R33d'=>'R[845]',
|
||||
'R33e'=>'Rh[845]',
|
||||
'R33f'=>'Rs[845]',
|
||||
'R34a'=>'R[833]',
|
||||
'R34b'=>'Rh[833]',
|
||||
'R34c'=>'Rs[833]',
|
||||
'R34d'=>'R[846]',
|
||||
'R34e'=>'Rh[846]',
|
||||
'R34f'=>'Rs[846]',
|
||||
'R35a'=>'R[834]',
|
||||
'R35b'=>'Rh[834]',
|
||||
'R35c'=>'Rs[834]',
|
||||
'R35d'=>'R[847]',
|
||||
'R35e'=>'Rh[847]',
|
||||
'R35f'=>'Rs[847]',
|
||||
'R36a'=>'R[835]',
|
||||
'R36b'=>'Rh[835]',
|
||||
'R36c'=>'Rs[835]',
|
||||
'R36d'=>'R[849]',
|
||||
'R36e'=>'Rh[849]',
|
||||
'R36f'=>'Rs[849]',
|
||||
'R37a'=>'R[844]',
|
||||
'R37b'=>'Rh[844]',
|
||||
'R37c'=>'Rs[844]',
|
||||
'R37d'=>'R[848]',
|
||||
'R37e'=>'Rh[848]',
|
||||
'R37f'=>'Rs[848]',
|
||||
'R38a'=>'R[836]',
|
||||
'R38b'=>'Rh[836]',
|
||||
'R38c'=>'Rs[836]',
|
||||
'R38d'=>'Rq[836]',
|
||||
'R38e'=>'Rt[836]',
|
||||
'R39a'=>'R[837]',
|
||||
'R39b'=>'Rh[837]',
|
||||
'R39c'=>'Rs[837]',
|
||||
'R39d'=>'Rq[837]',
|
||||
'R39e'=>'Rt[837]',
|
||||
'R40a'=>'R[838]',
|
||||
'R40b'=>'Rh[838]',
|
||||
'R40c'=>'Rs[838]',
|
||||
'R40d'=>'Rq[838]',
|
||||
'R40e'=>'Rt[838]',
|
||||
'R41a'=>'R[842]',
|
||||
'R41b'=>'Rh[842]',
|
||||
'R41c'=>'Rs[842]',
|
||||
'R41d'=>'Rq[842]',
|
||||
'R41e'=>'Rt[842]',
|
||||
'R42a'=>'R[839]',
|
||||
'R42b'=>'Rh[839]',
|
||||
'R42c'=>'Rs[839]',
|
||||
'R42d'=>'Rq[839]',
|
||||
'R42e'=>'Rt[839]',
|
||||
'R43a'=>'R[840]',
|
||||
'R43b'=>'Rh[840]',
|
||||
'R43c'=>'Rs[840]',
|
||||
'R43d'=>'Rq[840]',
|
||||
'R43e'=>'Rt[840]',
|
||||
'R44a'=>'R[841]',
|
||||
'R44b'=>'Rh[841]',
|
||||
'R44c'=>'Rs[841]',
|
||||
);
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ANNEE=date('Y')*1;
|
||||
$this->ANNEEp3=$this->ANNEE-3;
|
||||
$this->ANNEEp2=$this->ANNEE-2;
|
||||
$this->ANNEEp=$this->ANNEE-1;
|
||||
$this->ANNEE1=$this->ANNEE+1;
|
||||
$this->ANNEE2=$this->ANNEE+2;
|
||||
$this->ANNEE3=$this->ANNEE+3;
|
||||
$this->ANNEE4=$this->ANNEE+4;
|
||||
$this->ANNEE5=$this->ANNEE+5;
|
||||
|
||||
$this->JOUR_DATE=date('Y-m-d');
|
||||
$this->JOUR_HEURE=date('H:i');
|
||||
|
||||
$this->MAX_TEMOINS=99;
|
||||
|
||||
// Variables modifiées directement par les commentaires
|
||||
$this->TEMOINACT=0; // positionnement de présence d'éléments de commentaires du ACTIVITE
|
||||
$this->TEMOINACT_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes ACTIVITE
|
||||
$this->TEMOINATT=0; // Positionnement de présence d'éléments de commentaires du ATTENUATION DE LA NOTE
|
||||
$this->TEMOINATT_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes ATTENUATION DE LA NOTE
|
||||
$this->TEMOINAVI=0; // Positionnement de présence d'éléments de conclusion
|
||||
$this->TEMOINAVI_MAX=$this->MAX_TEMOINS; // Nombre maxi d'élements de conclusion à afficher
|
||||
$this->TEMOINCAPFAIBLE=0; // Nombre de cas de faible capital rencontrés
|
||||
$this->TEMOINCAPFAIBLE_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes CAPITAL FAIBLE
|
||||
$this->TEMOINCLES=0; // positionnement de présence d'éléments de commentaires de CHIFFRES CLES
|
||||
$this->TEMOINCLES_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes CHIFFRES CLES
|
||||
$this->TEMOINCONF=0; // positionnement de présence d'éléments de commentaires de CONFORMITE
|
||||
$this->TEMOINCONF_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes CONFORMITE
|
||||
$this->TEMOINCYANO=0; // Positionnement d'anomalies d'éléments "CYCLES"
|
||||
$this->TEMOINCYANO_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes "CYCLES"
|
||||
$this->TEMOINCYC=0; // Positionnement de présence d'éléments "CYCLE"
|
||||
$this->TEMOINCYC_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes "CYCLE"
|
||||
$this->TEMOINDEF=0; // Nb éléments défavorables
|
||||
$this->TEMOINDEF_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes défavorables
|
||||
$this->TEMOINDIAG=0; // positionnement de présence d'éléments de commentaires de DIAGNOSTIC STRATEGIQUE
|
||||
$this->TEMOINDIAG_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes DIAGNOSTIC STRATEGIQUE
|
||||
$this->TEMOINDIR=0; // positionnement de présence d'éléments de commentaires de DIRIGEANCE
|
||||
$this->TEMOINDIR_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes DIRIGEANCE
|
||||
$this->TEMOINEXP=0; // Nb de témoins du § Exploitation (ancien § Chiffres clefs)
|
||||
$this->TEMOINEXP_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes "EXPLOITATION"
|
||||
$this->TEMOINFAV=0; // Nb éléments favorables
|
||||
$this->TEMOINFAV_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes favorables
|
||||
$this->TEMOINFIL=0; // positionnement de présence d'éléments de commentaires de FILIALES
|
||||
$this->TEMOINFIL_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes FINLIALES
|
||||
$this->TEMOINFIN=0; // positionnement de présence d'éléments de commentaires de FINANCEMENT
|
||||
$this->TEMOINFIN_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes FINANCEMENT
|
||||
$this->TEMOINFLANO=0; // positionnement d'anomalies d'éléments "FLUX"
|
||||
$this->TEMOINFLANO_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes anomalies "FLUX"
|
||||
$this->TEMOINFLUX=0; // Témoins qui contrôle le tableau des flux
|
||||
$this->TEMOINFLUX_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes tableaux de FLUX
|
||||
$this->TEMOINGRAPH=0; // positionnement de présence de GRAPHIQUES en niveau 2
|
||||
$this->TEMOINGRAPH_MAX=$this->MAX_TEMOINS; // nombre maxi de GRAPHIQUES en niveau 2
|
||||
$this->TEMOINHIST=0; // positionnement de présence d'éléments "HISTOIRE"
|
||||
$this->TEMOINHIST_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes "HISTOIRE"
|
||||
$this->TEMOINLOC=0; // positionnement de présence d'éléments "LOCALISATION"
|
||||
$this->TEMOINLOC_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes "LOCALISATION"
|
||||
$this->TEMOINMAR=0; // positionnement de présence d'éléments marché
|
||||
$this->TEMOINMAR_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes marche
|
||||
$this->TEMOINMARPUB=0; // positionnement de présence d'éléments marchés publics
|
||||
$this->TEMOINMARPUB_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes marchés publics
|
||||
$this->TEMOINMOIN=0; // positionnement de présence du tableau de synthese MOINS
|
||||
$this->TEMOINMOIN_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes les MOINS
|
||||
$this->TEMOINNORM=0; // Nb éléménts du tableau de synthèse Les Normes
|
||||
$this->TEMOINNORM_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes les NORMES
|
||||
$this->TEMOINOBS=0; // Nb observations
|
||||
$this->TEMOINOBS_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes observations
|
||||
$this->TEMOINPAY=0; // Nb messages paiements
|
||||
$this->TEMOINPAY_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes les PAIEMENTS
|
||||
$this->TEMOINPLUS=0; // Nb éléménts du tableau de synthèse Les Plus
|
||||
$this->TEMOINPLUS_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes les PLUS
|
||||
$this->TEMOINPROF=0; // positionnement de présence d'éléments de commentaires du PROFIL JURIDIQUE
|
||||
$this->TEMOINPROF_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes du PROFIL JURIDIQUE
|
||||
$this->TEMOINPROJ=0; // positionnement de présence d'éléments "PROJECTION"
|
||||
$this->TEMOINPROJ_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes "PROJECTION"
|
||||
$this->TEMOINREPA=0; // positionnement de présence d'éléments "REPARTITION VA"
|
||||
$this->TEMOINREPA_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes "REPARTITION VA"
|
||||
$this->TEMOINRES=0; // positionnement de présence de commentaires réserves
|
||||
$this->TEMOINRES_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes réserves
|
||||
$this->TEMOINRIS=0; // Nb éléménts de commentaires risques
|
||||
$this->TEMOINRIS_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes risques
|
||||
$this->TEMOINSTACTIF=0; // positionnement de présence d'éléments de commentaires des ratios de stucture bilan ACTIF
|
||||
$this->TEMOINSTACTIF_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes les STRUCTURE ACTIF
|
||||
$this->TEMOINSTANO=0; // positionnement de présence d'éléments "STRUCTURE BILAN" (ANOMALIES)
|
||||
$this->TEMOINSTANO_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes "STRUCTURE BILAN" (ANOMALIES)
|
||||
$this->TEMOINSTPASS=0; // positionnement de présence d'éléments de commentaires des ratios de stucture bilan PASSIF
|
||||
$this->TEMOINSTPASS_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes les STRUCTURE PASSIF
|
||||
$this->TEMOINSTRUCT=0; // positionnement de présence d'éléments de commentaires des ratios de stucture bilan
|
||||
$this->TEMOINSTRUCT_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes les STRUCTURE
|
||||
$this->TEMOINSTSYNT=0; // Positionnement de présence d'éléments de commentaires des ratios de stucture bilan SYNTHESE
|
||||
$this->TEMOINSTSYNT_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes les STRUCTURE SYNTHESE
|
||||
$this->TEMOINVUL=0; // positionnement de présence d'éléments de commentaires de la VULNERABILITE
|
||||
$this->TEMOINVUL_MAX=$this->MAX_TEMOINS; // Nombre maxi de lignes de la VULNERABILITE
|
||||
$this->TEMOINADIZES=0; // positionnement de présence d'éléments de commentaires du MODELE Ichak ADIZES
|
||||
$this->TEMOINADIZES_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes Ichak ADIZES
|
||||
$this->TEMOINMRQ=0; // positionnement de présence de marques déposées
|
||||
$this->TEMOINMRQ_MAX=$this->MAX_TEMOINS; // nombre maxi de commentaires marques déposées
|
||||
$this->TEMOINMRQLIST=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINMRQLIST_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
|
||||
//@todo : Commentaires
|
||||
$this->TEMOINVALBIL=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALBIL_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALCONC=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALCONC_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALCR=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALCR_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALDIAG=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALDIAG_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALMETH=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALMETH_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALMRET=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALMRET_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALPATR=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALPATR_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALPOND=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALPOND_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALPRES=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALPRES_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALRESV=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALRESV_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALRETR=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALRETR_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALTABB=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALTABB_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALTABS=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALTABS_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALTABR=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALTABR_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALMINMAX=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALMINMAX_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
$this->TEMOINVALMAXMIN=0; // positionnement de ligne de liste des marques déposées
|
||||
$this->TEMOINVALMAXMIN_MAX=$this->MAX_TEMOINS; // nombre maxi de lignes des listes des marques déposées
|
||||
|
||||
/** Zones utilisées dans les calculs **/
|
||||
$this->CALCUL1=0;
|
||||
$this->CALCUL2=0;
|
||||
$this->CALCUL3=0;
|
||||
$this->CALCUL4=0;
|
||||
$this->CALCUL5=0;
|
||||
$this->CALCUL6=0;
|
||||
$this->CALCUL7=0;
|
||||
$this->CALCUL8=0;
|
||||
$this->CALCUL9=0;
|
||||
|
||||
$this->ENQUETELIM=6; // 6 mois de validités pour une note en provenance d'une enquête
|
||||
$this->ENQUETEMAXI=90; // Score Maximum / 100 en provenance d'une enquête
|
||||
}
|
||||
|
||||
}
|
98
library/SdMetier/Search/Engine.php
Normal file
98
library/SdMetier/Search/Engine.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
class SdMetier_Search_Engine
|
||||
{
|
||||
protected $client = null;
|
||||
protected $host = null;
|
||||
protected $port = null;
|
||||
protected $timeout = 1;
|
||||
protected $offset = 0;
|
||||
protected $limit = 300;
|
||||
protected $max_matches = 1000;
|
||||
protected $query = null;
|
||||
|
||||
public function __construct($version = null)
|
||||
{
|
||||
//Load the API following the version
|
||||
if ($version == 1){
|
||||
require_once 'Vendors/sphinxapi/sphinxapi-0.9.9.php';
|
||||
} elseif ($version == 2){
|
||||
require_once 'Vendors/sphinxapi/sphinxapi-2.1.5.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function loadClient()
|
||||
{
|
||||
if ( null === $this->host ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( null === $this->port ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->client = new SphinxClient();
|
||||
$this->client->SetServer( $this->host, $this->port );
|
||||
$this->client->SetConnectTimeout( $timeout );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $value
|
||||
*/
|
||||
protected function setHost($value)
|
||||
{
|
||||
$this->host = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $value
|
||||
*/
|
||||
protected function setPort($value)
|
||||
{
|
||||
$this->port = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $value
|
||||
*/
|
||||
protected function setOffset($value)
|
||||
{
|
||||
$this->offset = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $value
|
||||
*/
|
||||
protected function setLimit($value)
|
||||
{
|
||||
$this->limit = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $value
|
||||
*/
|
||||
protected function setMaxMatches($value)
|
||||
{
|
||||
$this->max_matches = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function constructQuery($p)
|
||||
{
|
||||
$this->query = $p;
|
||||
}
|
||||
|
||||
|
||||
}
|
77
library/SdMetier/Search/README
Normal file
77
library/SdMetier/Search/README
Normal file
@ -0,0 +1,77 @@
|
||||
Objectif :
|
||||
|
||||
- Réaliser plusieurs recherches et renvoyer le meilleur résultat
|
||||
- Algorithme pour déterminer le meilleur résultat
|
||||
|
||||
|
||||
Utiliser les différents mode de recherche en supprimant des critères
|
||||
Utiliser les critères en mode texte ou en tant que filtre
|
||||
|
||||
Utilisation de SphinxQL
|
||||
|
||||
Syntaxe d'un select
|
||||
SELECT
|
||||
select_expr [, select_expr ...]
|
||||
FROM index [, index2 ...]
|
||||
[WHERE where_condition]
|
||||
[GROUP [N] BY {col_name | expr_alias} [, {col_name | expr_alias}]]
|
||||
[WITHIN GROUP ORDER BY {col_name | expr_alias} {ASC | DESC}]
|
||||
[HAVING having_condition]
|
||||
[ORDER BY {col_name | expr_alias} {ASC | DESC} [, ...]]
|
||||
[LIMIT [offset,] row_count]
|
||||
[OPTION opt_name = opt_value [, ...]]
|
||||
[FACET facet_options[ FACET facet_options][ ...]]
|
||||
|
||||
SELECT * FROM test WHERE MATCH('@title hello @body world')
|
||||
OPTION ranker=bm25, max_matches=3000,
|
||||
field_weights=(title=10, body=3), agent_query_timeout=10000
|
||||
|
||||
OPTION
|
||||
field_weights
|
||||
index_weights
|
||||
max_matches
|
||||
ranker
|
||||
|
||||
WHERE clause. This clause will map both to fulltext query and filters.
|
||||
Comparison operators (=, !=, <, >, <=, >=), IN, AND, NOT, and BETWEEN are all supported
|
||||
and map directly to filters. OR is not supported yet but will be in the future.
|
||||
MATCH('query') is supported and maps to fulltext query. Query will be interpreted
|
||||
according to full-text query language rules. There must be at most one MATCH() in the clause.
|
||||
|
||||
|
||||
|
||||
Liste des opérateurs possible dans "select_expr"
|
||||
|
||||
Retour du select
|
||||
Liste des éléments indexés hors fulltext
|
||||
|
||||
|
||||
|
||||
mysql -h0 -P9306
|
||||
SELECT *, WEIGHT() weight FROM ent, ent_phx WHERE MATCH('peugeot') ORDER BY rang DESC;
|
||||
|
||||
mysql> SHOW META;
|
||||
+---------------+---------+
|
||||
| Variable_name | Value |
|
||||
+---------------+---------+
|
||||
| total | 1000 |
|
||||
| total_found | 2451 |
|
||||
| time | 0.022 |
|
||||
| keyword[0] | peugeot |
|
||||
| docs[0] | 2451 |
|
||||
| hits[0] | 3907 |
|
||||
+---------------+---------+
|
||||
6 rows in set (0.00 sec)
|
||||
|
||||
Multi-statement queries
|
||||
SELECT follow by SHOW META
|
||||
|
||||
|
||||
|
||||
SELECT * FROM myindex
|
||||
WHERE MATCH('@(title,content) find me fast');
|
||||
|
||||
|
||||
|
||||
|
||||
|
93
library/SdMetier/Sfr/Compile.php
Normal file
93
library/SdMetier/Sfr/Compile.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
class SdMetier_Sfr_Compile
|
||||
{
|
||||
/**
|
||||
* Database adaptater
|
||||
* @var Zend_Db_Adapter_Abstract
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $version = null;
|
||||
|
||||
|
||||
protected $compileTxt = "<?php\n";
|
||||
|
||||
public function __construct($db = null)
|
||||
{
|
||||
if ( null === $db) {
|
||||
$this->db = Zend_Db_Table_Abstract::getDefaultAdapter();
|
||||
} else {
|
||||
$this->db = $db;
|
||||
}
|
||||
}
|
||||
|
||||
public function setVersion($version)
|
||||
{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
public function getRulesFromDb($type)
|
||||
{
|
||||
$version = str_replace('.','',$this->version);
|
||||
$sql = "SELECT * FROM jo.sfr_rules_".$version." AS r WHERE r.type='".$type."' ORDER BY r.ordre";
|
||||
$result = $this->db->fetchAll($sql, array(), Zend_Db::FETCH_OBJ);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getParamsFromDb($type, $codif)
|
||||
{
|
||||
$version = str_replace('.','',$this->version);
|
||||
$sql = "SELECT * FROM jo.sfr_params_".$version." AS p WHERE p.type='".$type."' AND p.codif='".$codif."' ORDER BY p.ordre";
|
||||
$result = $this->db->fetchAll($sql, array(), Zend_Db::FETCH_OBJ);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function construct($type)
|
||||
{
|
||||
$rules = $this->getRulesFromDb($type);
|
||||
if ( count($rules) > 0 ) {
|
||||
$this->compileTxt.= "return array(\n";
|
||||
$this->addRules($rules);
|
||||
$this->compileTxt.= ");\n";
|
||||
}
|
||||
|
||||
$filename = realpath(__DIR__).'/Rules'.ucfirst(strtolower($type)).'-'.$this->version.'.php';
|
||||
|
||||
file_put_contents($filename, $this->compileTxt);
|
||||
}
|
||||
|
||||
public function addRules($rules)
|
||||
{
|
||||
foreach ( $rules as $i => $rule ) {
|
||||
$this->compileTxt.= "\t".$i." => array(\n";
|
||||
$this->compileTxt.= "\t\t'name' => '".$rule->label."',\n";
|
||||
$this->compileTxt.= "\t\t'value' => '".$rule->value."',\n";
|
||||
$this->compileTxt.= "\t\t'po' => ".$rule->po.",\n";
|
||||
$this->compileTxt.= "\t\t'comment' => \"".$rule->comment."\",\n";
|
||||
$this->compileTxt.= "\t\t'params' => array(\n";
|
||||
$this->addParams($rule->type, $rule->codif);
|
||||
$this->compileTxt.= "\t\t),\n";
|
||||
$this->compileTxt.= "\t),\n";
|
||||
}
|
||||
}
|
||||
|
||||
public function addParams($type, $codif)
|
||||
{
|
||||
$params = $this->getParamsFromDb($type, $codif);
|
||||
if ( count($params) > 0 ) {
|
||||
foreach ( $params as $i => $param ) {
|
||||
if ( $param->define == '') {
|
||||
$this->compileTxt.= "\t\t\t".$i." => array( 'var' => '".$param->var."', 'type' => '".$param->cond."', 'value' => '".$param->value."'),\n";
|
||||
} else {
|
||||
$this->compileTxt.= "\t\t\t".$i." => array( 'var' => '".$param->var."', 'type' => '".$param->cond."', 'value' => '".$param->value."', 'define' => array( 'var' => '".$param->define."', 'value' => '".$param->define_value."')),\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
492
library/SdMetier/Sfr/RulesPo-1.0.php
Normal file
492
library/SdMetier/Sfr/RulesPo-1.0.php
Normal file
@ -0,0 +1,492 @@
|
||||
<?php
|
||||
return array(
|
||||
0 => array(
|
||||
'name' => 'PO-NAF-GE',
|
||||
'value' => '6000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
1 => array(
|
||||
'name' => 'PO-NAF-GE',
|
||||
'value' => '12000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
2 => array(
|
||||
'name' => 'PO-NAF-GE',
|
||||
'value' => '25000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
3 => array(
|
||||
'name' => 'PO-NAF-GE',
|
||||
'value' => '45000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
4 => array(
|
||||
'name' => 'PO-NAF-PME',
|
||||
'value' => '4600',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
5 => array(
|
||||
'name' => 'PO-NAF-PME',
|
||||
'value' => '5700',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
6 => array(
|
||||
'name' => 'PO-NAF-PME',
|
||||
'value' => '14000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
7 => array(
|
||||
'name' => 'PO-NAF-PME',
|
||||
'value' => '19000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
8 => array(
|
||||
'name' => 'PO-NAF-PME',
|
||||
'value' => '700',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
9 => array(
|
||||
'name' => 'PO-NAF-PME',
|
||||
'value' => '1000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
10 => array(
|
||||
'name' => 'PO-NAF-PME',
|
||||
'value' => '1100',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
11 => array(
|
||||
'name' => 'PO-NAF-PME',
|
||||
'value' => '2800',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabNafSFR'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
12 => array(
|
||||
'name' => 'PO-Date-GE',
|
||||
'value' => '3000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
13 => array(
|
||||
'name' => 'PO-Date-GE',
|
||||
'value' => '3000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '4'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
14 => array(
|
||||
'name' => 'PO-Date-GE',
|
||||
'value' => '3000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
15 => array(
|
||||
'name' => 'PO-Date-GE',
|
||||
'value' => '5000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
16 => array(
|
||||
'name' => 'PO-Date-GE',
|
||||
'value' => '5000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '10'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
17 => array(
|
||||
'name' => 'PO-Date-GE',
|
||||
'value' => '5000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '11'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
18 => array(
|
||||
'name' => 'PO-Date-GE',
|
||||
'value' => '10000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '12'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
19 => array(
|
||||
'name' => 'PO-Date-GE',
|
||||
'value' => '10000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '13'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
20 => array(
|
||||
'name' => 'PO-Date-GE',
|
||||
'value' => '10000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '14'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
21 => array(
|
||||
'name' => 'PO-Date-PME',
|
||||
'value' => '1500',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
22 => array(
|
||||
'name' => 'PO-Date-PME',
|
||||
'value' => '1500',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
23 => array(
|
||||
'name' => 'PO-Date-PME',
|
||||
'value' => '1500',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
24 => array(
|
||||
'name' => 'PO-Date-PME',
|
||||
'value' => '6000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
25 => array(
|
||||
'name' => 'PO-Date-PME',
|
||||
'value' => '6000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '4'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '10'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
26 => array(
|
||||
'name' => 'PO-Date-PME',
|
||||
'value' => '6000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '11'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
27 => array(
|
||||
'name' => 'PO-Date-PME',
|
||||
'value' => '9000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '12'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
28 => array(
|
||||
'name' => 'PO-Date-PME',
|
||||
'value' => '9000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '13'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
29 => array(
|
||||
'name' => 'PO-Date-PME',
|
||||
'value' => '9000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '14'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
30 => array(
|
||||
'name' => 'PO-Date-TPE',
|
||||
'value' => '500',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
31 => array(
|
||||
'name' => 'PO-Date-TPE',
|
||||
'value' => '500',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
32 => array(
|
||||
'name' => 'PO-Date-TPE',
|
||||
'value' => '500',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
33 => array(
|
||||
'name' => 'PO-Date-TPE',
|
||||
'value' => '1000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
34 => array(
|
||||
'name' => 'PO-Date-TPE',
|
||||
'value' => '1000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '4'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '10'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
35 => array(
|
||||
'name' => 'PO-Date-TPE',
|
||||
'value' => '1000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '11'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
36 => array(
|
||||
'name' => 'PO-Date-TPE',
|
||||
'value' => '1500',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '12'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
37 => array(
|
||||
'name' => 'PO-Date-TPE',
|
||||
'value' => '1500',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '13'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
38 => array(
|
||||
'name' => 'PO-Date-TPE',
|
||||
'value' => '1500',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '14'),
|
||||
2 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
39 => array(
|
||||
'name' => 'PO-STD-GE',
|
||||
'value' => '6000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
40 => array(
|
||||
'name' => 'PO-STD-GE',
|
||||
'value' => '10000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
41 => array(
|
||||
'name' => 'PO-STD-GE',
|
||||
'value' => '20000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
),
|
||||
),
|
||||
42 => array(
|
||||
'name' => 'PO-STD-PME',
|
||||
'value' => '3000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
43 => array(
|
||||
'name' => 'PO-STD-PME',
|
||||
'value' => '3700',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
44 => array(
|
||||
'name' => 'PO-STD-PME',
|
||||
'value' => '5000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
45 => array(
|
||||
'name' => 'PO-STD-PME',
|
||||
'value' => '9000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
46 => array(
|
||||
'name' => 'PO-STD-TPE',
|
||||
'value' => '500',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '6'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
47 => array(
|
||||
'name' => 'PO-STD-TPE',
|
||||
'value' => '600',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '7'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
48 => array(
|
||||
'name' => 'PO-STD-TPE',
|
||||
'value' => '1000',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '8'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
49 => array(
|
||||
'name' => 'PO-STD-TPE',
|
||||
'value' => '1300',
|
||||
'comment' => "",
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
|
||||
1 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'TPE'),
|
||||
),
|
||||
),
|
||||
);
|
168
library/SdMetier/Sfr/RulesVord-1.0.php
Normal file
168
library/SdMetier/Sfr/RulesVord-1.0.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
return array(
|
||||
0 => array(
|
||||
'name' => 'VORd-11.1',
|
||||
'value' => 'STOP',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'ContratAge', 'type' => 'EGAL', 'value' => 'UNDEFINE'),
|
||||
1 => array( 'var' => 'IR', 'type' => 'EGAL', 'value' => 'UNDEFINE'),
|
||||
),
|
||||
),
|
||||
1 => array(
|
||||
'name' => 'VORd-11.2',
|
||||
'value' => 'CONTINUE',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'ContratAge', 'type' => 'EGAL', 'value' => 'UNDEFINE'),
|
||||
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '-1', 'define' => array( 'var' => 'ContratAge', 'value' => '24')),
|
||||
),
|
||||
),
|
||||
2 => array(
|
||||
'name' => 'VORd-11.3',
|
||||
'value' => 'CONTINUE',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '-1'),
|
||||
1 => array( 'var' => 'IR', 'type' => 'EGAL', 'value' => 'UNDEFINE', 'define' => array( 'var' => 'IR', 'value' => '8')),
|
||||
),
|
||||
),
|
||||
3 => array(
|
||||
'name' => 'VORd-10.1',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Société dont la solvabilité est limitée et qui rencontre des difficultés de paiement : Faire une DEC pour tout acte éligible",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'VERT'),
|
||||
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
|
||||
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
|
||||
3 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
|
||||
4 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
|
||||
5 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
|
||||
),
|
||||
),
|
||||
4 => array(
|
||||
'name' => 'VORd-10.2',
|
||||
'value' => 'ORANGE',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'VERT'),
|
||||
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
|
||||
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
|
||||
3 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '24'),
|
||||
4 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '36'),
|
||||
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
|
||||
6 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
|
||||
),
|
||||
),
|
||||
5 => array(
|
||||
'name' => 'VORd-10.3',
|
||||
'value' => 'ORANGE',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'VERT'),
|
||||
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
|
||||
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
|
||||
3 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
|
||||
4 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '11'),
|
||||
5 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '14'),
|
||||
),
|
||||
),
|
||||
6 => array(
|
||||
'name' => 'VORd-10.4',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Société dont la solvabilité est limitée et qui rencontre des difficultés de paiement : Faire une DEC pour tout acte éligible",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
|
||||
1 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
|
||||
2 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '35'),
|
||||
),
|
||||
),
|
||||
7 => array(
|
||||
'name' => 'VORd-10.5',
|
||||
'value' => 'VERT',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
|
||||
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '2'),
|
||||
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '5'),
|
||||
3 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '36'),
|
||||
4 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '7'),
|
||||
),
|
||||
),
|
||||
8 => array(
|
||||
'name' => 'VORd-10.6',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Société dont la solvabilité est limitée et qui rencontre des difficultés de paiement : Faire une DEC pour tout acte éligible",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
|
||||
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
|
||||
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '2.1'),
|
||||
3 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '36'),
|
||||
),
|
||||
),
|
||||
9 => array(
|
||||
'name' => 'VORd-10.7',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Société dont la solvabilité est limitée et qui rencontre des difficultés de paiement : Faire une DEC pour tout acte éligible",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
|
||||
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
|
||||
2 => array( 'var' => 'ContratAge', 'type' => 'MAX', 'value' => '25'),
|
||||
3 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
|
||||
4 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
|
||||
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
|
||||
6 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '12'),
|
||||
),
|
||||
),
|
||||
10 => array(
|
||||
'name' => 'VORd-10.8',
|
||||
'value' => 'VERT',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
|
||||
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
|
||||
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
|
||||
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
|
||||
4 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '36'),
|
||||
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '11'),
|
||||
),
|
||||
),
|
||||
11 => array(
|
||||
'name' => 'VORd-10.8-2',
|
||||
'value' => 'VERT',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ORANGE'),
|
||||
1 => array( 'var' => 'EntrepRecente', 'type' => 'EGAL', 'value' => '1'),
|
||||
2 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '4.9'),
|
||||
3 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '7.1'),
|
||||
4 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '24'),
|
||||
5 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '13'),
|
||||
),
|
||||
),
|
||||
12 => array(
|
||||
'name' => 'VORd-10.9',
|
||||
'value' => 'ORANGE',
|
||||
'comment' => "Faire une DEC si dépassement de la PO proposée",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ROUGE'),
|
||||
1 => array( 'var' => 'IR', 'type' => 'MIN', 'value' => '2'),
|
||||
2 => array( 'var' => 'IR', 'type' => 'MAX', 'value' => '5'),
|
||||
3 => array( 'var' => 'ContratAge', 'type' => 'MIN', 'value' => '36'),
|
||||
4 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '3'),
|
||||
),
|
||||
),
|
||||
);
|
164
library/SdMetier/Sfr/RulesVorp-1.0.php
Normal file
164
library/SdMetier/Sfr/RulesVorp-1.0.php
Normal file
@ -0,0 +1,164 @@
|
||||
<?php
|
||||
return array(
|
||||
0 => array(
|
||||
'name' => 'VORp-1.0',
|
||||
'value' => 'DEFINE',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'IsCAC', 'type' => 'EGAL', 'value' => '1', 'define' => array( 'var' => 'TypeEntrep', 'value' => 'CAC')),
|
||||
1 => array( 'var' => 'Effectif', 'type' => 'MIN', 'value' => '499', 'define' => array( 'var' => 'TypeEntrep', 'value' => 'GE')),
|
||||
2 => array( 'var' => 'Effectif', 'type' => 'MIN', 'value' => '3', 'define' => array( 'var' => 'TypeEntrep', 'value' => 'PME')),
|
||||
3 => array( 'var' => 'Effectif', 'type' => 'MIN', 'value' => '-1', 'define' => array( 'var' => 'TypeEntrep', 'value' => 'TPE')),
|
||||
4 => array( 'var' => 'Effectif', 'type' => 'EGAL', 'value' => 'UNDEFINE', 'define' => array( 'var' => 'TypeEntrep', 'value' => 'TPE')),
|
||||
),
|
||||
),
|
||||
1 => array(
|
||||
'name' => 'VORp-2.1',
|
||||
'value' => 'VERT',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabAdminNaf', 'define' => array( 'var' => 'IsAdmin', 'value' => '1')),
|
||||
),
|
||||
),
|
||||
2 => array(
|
||||
'name' => 'VORp-2.2',
|
||||
'value' => 'VERT',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FJ', 'type' => 'LIST', 'value' => 'TabAdminFj', 'define' => array( 'var' => 'IsAdmin', 'value' => '1')),
|
||||
),
|
||||
),
|
||||
3 => array(
|
||||
'name' => 'VORp-3.1',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Société de droit étranger : faire une DEC si volonté de poursuivre l'affaire",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'NAF', 'type' => 'LIST', 'value' => 'TabEtrangerNaf', 'define' => array( 'var' => 'IsEtranger', 'value' => '1')),
|
||||
),
|
||||
),
|
||||
4 => array(
|
||||
'name' => 'VORp-3.2',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Société de droit étranger : faire une DEC si volonté de poursuivre l'affaire",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FJ', 'type' => 'LIST', 'value' => 'TabEtrangerFj', 'define' => array( 'var' => 'IsEtranger', 'value' => '1')),
|
||||
),
|
||||
),
|
||||
5 => array(
|
||||
'name' => 'VORp-4.1',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Cette société fait l'objet d'un Redressement Judiciaire : faire une DEC si volonté de poursuivre l'affaire",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '6'),
|
||||
1 => array( 'var' => 'RJ', 'type' => 'EGAL', 'value' => '1'),
|
||||
),
|
||||
),
|
||||
6 => array(
|
||||
'name' => 'VORp-4.2',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Cette société fait l'objet d'une liquidation judiciaire : pas d'entrée en relation possible",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '6'),
|
||||
1 => array( 'var' => 'LJ', 'type' => 'EGAL', 'value' => '1'),
|
||||
),
|
||||
),
|
||||
7 => array(
|
||||
'name' => 'VORp-4.3',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Cette société fait l'objet d'une Sauvegarde Judiciaire : faire une DEC si volonté de poursuivre l'affaire",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '6'),
|
||||
1 => array( 'var' => 'SV', 'type' => 'EGAL', 'value' => '1'),
|
||||
),
|
||||
),
|
||||
8 => array(
|
||||
'name' => 'VORp-4.4',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Cette entreprise n'est pas active à l'INSEE : pas d'entrée en relation possible",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '6'),
|
||||
1 => array( 'var' => 'InseeActif', 'type' => 'EGAL', 'value' => '0'),
|
||||
),
|
||||
),
|
||||
9 => array(
|
||||
'name' => 'VORp-5.0',
|
||||
'value' => 'ORANGE',
|
||||
'comment' => "Faire une DEC si dépassement de la PO proposée",
|
||||
'po' => 1,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '16'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
|
||||
2 => array( 'var' => 'InseeAge', 'type' => 'MAX', 'value' => '37', 'define' => array( 'var' => 'EntrepRecente', 'value' => '1')),
|
||||
3 => array( 'var' => 'TypeEntrep', 'type' => 'MIN', 'value' => 'PME'),
|
||||
),
|
||||
),
|
||||
10 => array(
|
||||
'name' => 'VORp-7.0',
|
||||
'value' => 'ORANGE',
|
||||
'comment' => "Cette entreprise fait l'objet d'une sauvegarde : faire une DEC si dépassement de la PO",
|
||||
'po' => 1,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'FEU', 'type' => 'EGAL', 'value' => 'ROUGE'),
|
||||
1 => array( 'var' => 'SV', 'type' => 'EGAL', 'value' => '1'),
|
||||
2 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '4'),
|
||||
),
|
||||
),
|
||||
11 => array(
|
||||
'name' => 'VORp-8.0',
|
||||
'value' => 'VERT',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'GE'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'EGAL', 'value' => '9'),
|
||||
),
|
||||
),
|
||||
12 => array(
|
||||
'name' => 'VORp-9.0',
|
||||
'value' => 'VERT',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'TypeEntrep', 'type' => 'EGAL', 'value' => 'CAC'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '5'),
|
||||
),
|
||||
),
|
||||
13 => array(
|
||||
'name' => 'VORp-6.1',
|
||||
'value' => 'ROUGE',
|
||||
'comment' => "Solvabilité et pérennité compromise : faire une DEC si volonté de poursuivre l'affaire",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '6'),
|
||||
),
|
||||
),
|
||||
14 => array(
|
||||
'name' => 'VORp-6.2',
|
||||
'value' => 'ORANGE',
|
||||
'comment' => "Faire une DEC si dépassement de la PO proposée",
|
||||
'po' => 1,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '10'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '5'),
|
||||
),
|
||||
),
|
||||
15 => array(
|
||||
'name' => 'VORp-6.3',
|
||||
'value' => 'VERT',
|
||||
'comment' => "",
|
||||
'po' => 0,
|
||||
'params' => array(
|
||||
0 => array( 'var' => 'Indiscore', 'type' => 'MAX', 'value' => '21'),
|
||||
1 => array( 'var' => 'Indiscore', 'type' => 'MIN', 'value' => '9'),
|
||||
),
|
||||
),
|
||||
);
|
1026
library/SdMetier/Sfr/Scoring.php
Normal file
1026
library/SdMetier/Sfr/Scoring.php
Normal file
File diff suppressed because it is too large
Load Diff
13
library/SdMetier/autoload_classmap.php
Normal file
13
library/SdMetier/autoload_classmap.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
// Generated by ZF's ./bin/classmap_generator.php
|
||||
return array(
|
||||
'SdMetier_Graydon_Service' => dirname(__FILE__) . '//Graydon/Service.php',
|
||||
'SdMetier_Infogreffe_DocAC' => dirname(__FILE__) . '//Infogreffe/DocAC.php',
|
||||
'SdMetier_Infogreffe_DocBI' => dirname(__FILE__) . '//Infogreffe/DocBI.php',
|
||||
'SdMetier_Infogreffe_DocST' => dirname(__FILE__) . '//Infogreffe/DocST.php',
|
||||
'SdMetier_Infogreffe_Service' => dirname(__FILE__) . '//Infogreffe/Service.php',
|
||||
'SdMetier_Scoring_Vars' => dirname(__FILE__) . '//Scoring/Vars.php',
|
||||
'SdMetier_Search_Engine' => dirname(__FILE__) . '//Search/Engine.php',
|
||||
'SdMetier_Sfr_Compile' => dirname(__FILE__) . '//Sfr/Compile.php',
|
||||
'SdMetier_Sfr_Scoring' => dirname(__FILE__) . '//Sfr/Scoring.php',
|
||||
);
|
@ -1,763 +1,48 @@
|
||||
<?
|
||||
<?php
|
||||
class WChiffes
|
||||
{
|
||||
private static $tabChiffresEnLEttres = array(
|
||||
0=>'zéro',
|
||||
1=>'un',
|
||||
2=>'deux',
|
||||
3=>'trois',
|
||||
4=>'quatre',
|
||||
5=>'cinq',
|
||||
6=>'six',
|
||||
7=>'sept',
|
||||
8=>'huit',
|
||||
9=>'neuf',
|
||||
10=>'dix',
|
||||
11=>'onze',
|
||||
12=>'douze',
|
||||
13=>'treize',
|
||||
14=>'quatorze',
|
||||
15=>'quinze',
|
||||
16=>'seize',
|
||||
17=>'dix sept',
|
||||
18=>'dix huit',
|
||||
19=>'dix neuf',
|
||||
20=>'vingt',
|
||||
21=>'vingt et un',
|
||||
22=>'vingt deux',
|
||||
23=>'vingt trois',
|
||||
24=>'vingt quatre',
|
||||
25=>'vingt cinq',
|
||||
26=>'vingt six',
|
||||
27=>'vingt sept',
|
||||
28=>'vingt huit',
|
||||
29=>'vingt neuf',
|
||||
30=>'trente',
|
||||
40=>'quarante',
|
||||
50=>'cinquante',
|
||||
60=>'soixante',
|
||||
70=>'soixante dix',
|
||||
80=>'quatre vingt',
|
||||
90=>'quatre vingt dix'
|
||||
);
|
||||
|
||||
class WChiffes {
|
||||
|
||||
private static $tabChiffresEnLEttres = array( 0=>'zéro',
|
||||
1=>'un',
|
||||
2=>'deux',
|
||||
3=>'trois',
|
||||
4=>'quatre',
|
||||
5=>'cinq',
|
||||
6=>'six',
|
||||
7=>'sept',
|
||||
8=>'huit',
|
||||
9=>'neuf',
|
||||
10=>'dix',
|
||||
11=>'onze',
|
||||
12=>'douze',
|
||||
13=>'treize',
|
||||
14=>'quatorze',
|
||||
15=>'quinze',
|
||||
16=>'seize',
|
||||
17=>'dix sept',
|
||||
18=>'dix huit',
|
||||
19=>'dix neuf',
|
||||
20=>'vingt',
|
||||
21=>'vingt et un',
|
||||
22=>'vingt deux',
|
||||
23=>'vingt trois',
|
||||
24=>'vingt quatre',
|
||||
25=>'vingt cinq',
|
||||
26=>'vingt six',
|
||||
27=>'vingt sept',
|
||||
28=>'vingt huit',
|
||||
29=>'vingt neuf',
|
||||
30=>'trente',
|
||||
40=>'quarante',
|
||||
50=>'cinquante',
|
||||
60=>'soixante',
|
||||
70=>'soixante dix',
|
||||
80=>'quatre vingt',
|
||||
90=>'quatre vingt dix');
|
||||
|
||||
public function ChiffresEnLettres($chiffre) {
|
||||
public function ChiffresEnLettres($chiffre)
|
||||
{
|
||||
return array_search($chiffre, self::$tabChiffresEnLEttres);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
define('NEL_SEPTANTE', 0x0001);
|
||||
define('NEL_HUITANTE', 0x0002);
|
||||
define('NEL_OCTANTE', 0x0004);
|
||||
define('NEL_NONANTE', 0x0008);
|
||||
define('NEL_BELGIQUE', NEL_SEPTANTE|NEL_NONANTE);
|
||||
define('NEL_VVF', NEL_SEPTANTE|NEL_HUITANTE|NEL_NONANTE);
|
||||
define('NEL_ARCHAIQUE', NEL_SEPTANTE|NEL_OCTANTE|NEL_NONANTE);
|
||||
define('NEL_SANS_MILLIARD', 0x0010);
|
||||
define('NEL_AVEC_ZILLIARD', 0x0020);
|
||||
define('NEL_TOUS_ZILLIONS', 0x0040);
|
||||
define('NEL_RECTIF_1990', 0x0100);
|
||||
define('NEL_ORDINAL', 0x0200);
|
||||
define('NEL_NIEME', 0x0400);
|
||||
|
||||
|
||||
# Le tableau associatif $NEL contient toutes les variables utilisées
|
||||
# de façon globale dans ce module. ATTENTION : ce nom est assez court,
|
||||
# et cela pourrait poser des problèmes de collision avec une autre
|
||||
# variable si plusieurs modules sont inclus dans le même programme.
|
||||
|
||||
$NEL = array(
|
||||
'1-99' => array(
|
||||
# 0-19
|
||||
'', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept',
|
||||
'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze',
|
||||
'quinze', 'seize', 'dix-sept', 'dix-huit', 'dix-neuf',
|
||||
# 20-29
|
||||
'vingt', 'vingt et un', 'vingt-deux', 'vingt-trois',
|
||||
'vingt-quatre', 'vingt-cinq', 'vingt-six',
|
||||
'vingt-sept', 'vingt-huit', 'vingt-neuf',
|
||||
# 30-39
|
||||
'trente', 'trente et un', 'trente-deux', 'trente-trois',
|
||||
'trente-quatre', 'trente-cinq', 'trente-six',
|
||||
'trente-sept', 'trente-huit', 'trente-neuf',
|
||||
# 40-49
|
||||
'quarante', 'quarante et un', 'quarante-deux', 'quarante-trois',
|
||||
'quarante-quatre', 'quarante-cinq', 'quarante-six',
|
||||
'quarante-sept', 'quarante-huit', 'quarante-neuf',
|
||||
# 50-59
|
||||
'cinquante', 'cinquante et un', 'cinquante-deux', 'cinquante-trois',
|
||||
'cinquante-quatre', 'cinquante-cinq', 'cinquante-six',
|
||||
'cinquante-sept', 'cinquante-huit', 'cinquante-neuf',
|
||||
# 60-69
|
||||
'soixante', 'soixante et un', 'soixante-deux', 'soixante-trois',
|
||||
'soixante-quatre', 'soixante-cinq', 'soixante-six',
|
||||
'soixante-sept', 'soixante-huit', 'soixante-neuf',
|
||||
# 70-79
|
||||
'septante', 'septante et un', 'septante-deux', 'septante-trois',
|
||||
'septante-quatre', 'septante-cinq', 'septante-six',
|
||||
'septante-sept', 'septante-huit', 'septante-neuf',
|
||||
# 80-89
|
||||
'huitante', 'huitante et un', 'huitante-deux', 'huitante-trois',
|
||||
'huitante-quatre', 'huitante-cinq', 'huitante-six',
|
||||
'huitante-sept', 'huitante-huit', 'huitante-neuf',
|
||||
# 90-99
|
||||
'nonante', 'nonante et un', 'nonante-deux', 'nonante-trois',
|
||||
'nonante-quatre', 'nonante-cinq', 'nonante-six',
|
||||
'nonante-sept', 'nonante-huit', 'nonante-neuf'
|
||||
),
|
||||
|
||||
'illi' => array('', 'm', 'b', 'tr', 'quatr', 'quint', 'sext'),
|
||||
'maxilli' => 0, # voir plus loin
|
||||
'de_maxillions' => '', # voir plus loin
|
||||
|
||||
'septante' => false, # valeurs possibles : (false|true)
|
||||
'huitante' => false, # valeurs possibles : (false|true|'octante')
|
||||
'nonante' => false, # valeurs possibles : (false|true)
|
||||
'zillions' => false, # valeurs possibles : (false|true)
|
||||
'zilliard' => 1, # valeurs possibles : (0|1|2)
|
||||
'rectif' => false, # valeurs possibles : (false|true)
|
||||
'ordinal' => false, # valeurs possibles : (false|true|'nieme')
|
||||
|
||||
'separateur' => ' '
|
||||
);
|
||||
|
||||
# Si le tableau $NEL['illi'] s'arrête à 'sext', alors les deux valeurs
|
||||
# suivantes sont respectivement '6' et ' de sextillions'.
|
||||
$NEL['maxilli'] = count($NEL['illi']) - 1;
|
||||
$NEL['de_maxillions'] = " de {$NEL['illi'][$NEL['maxilli']]}illions";
|
||||
|
||||
function enlettres_options($options, $separateur=NULL)
|
||||
{
|
||||
global $NEL;
|
||||
|
||||
if ($options !== NULL) {
|
||||
$NEL['septante'] = ($options & NEL_SEPTANTE) ? true : false;
|
||||
$NEL['huitante'] =
|
||||
($options & NEL_OCTANTE) ? 'octante' :
|
||||
(($options & NEL_HUITANTE) ? true : false);
|
||||
$NEL['nonante'] = ($options & NEL_NONANTE) ? true : false;
|
||||
$NEL['zillions'] = ($options & NEL_TOUS_ZILLIONS) ? true : false;
|
||||
$NEL['zilliard'] =
|
||||
($options & NEL_AVEC_ZILLIARD) ? 2 :
|
||||
(($options & NEL_SANS_MILLIARD) ? 0 : 1);
|
||||
$NEL['rectif'] = ($options & NEL_RECTIF_1990) ? true : false;
|
||||
$NEL['ordinal'] =
|
||||
($options & NEL_NIEME) ? 'nieme' :
|
||||
(($options & NEL_ORDINAL) ? true : false);
|
||||
}
|
||||
|
||||
if ($separateur !== NULL) {
|
||||
$NEL['separateur'] = $separateur;
|
||||
}
|
||||
}
|
||||
|
||||
function enlettres_par3($par3)
|
||||
{
|
||||
global $NEL;
|
||||
|
||||
if ($par3 == 0) return '';
|
||||
|
||||
$centaine = floor($par3 / 100);
|
||||
$par2 = $par3 % 100;
|
||||
$dizaine = floor($par2 / 10);
|
||||
|
||||
# On traite à part les particularités du français de référence
|
||||
# 'soixante-dix', 'quatre-vingts' et 'quatre-vingt-dix'.
|
||||
$nom_par2 = NULL;
|
||||
switch ($dizaine) {
|
||||
case 7:
|
||||
if ($NEL['septante'] === false) {
|
||||
if ($par2 == 71) $nom_par2 = 'soixante et onze';
|
||||
else $nom_par2 = 'soixante-' . $NEL['1-99'][$par2 - 60];
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
if ($NEL['huitante'] === false) {
|
||||
if ($par2 == 80) $nom_par2 = 'quatre-vingts';
|
||||
else $nom_par2 = 'quatre-vingt-' . $NEL['1-99'][$par2 - 80];
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if ($NEL['nonante'] === false) {
|
||||
$nom_par2 = 'quatre-vingt-' . $NEL['1-99'][$par2 - 80];
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ($nom_par2 === NULL) {
|
||||
$nom_par2 = $NEL['1-99'][$par2];
|
||||
if (($dizaine == 8) and ($NEL['huitante'] === 'octante')) {
|
||||
$nom_par2 = str_replace('huitante', 'octante', $nom_par2);
|
||||
}
|
||||
}
|
||||
|
||||
# Après les dizaines et les unités, il reste à voir les centaines
|
||||
switch ($centaine) {
|
||||
case 0: return $nom_par2;
|
||||
case 1: return rtrim("cent {$nom_par2}");
|
||||
}
|
||||
|
||||
# Assertion : $centaine = 2 .. 9
|
||||
$nom_centaine = $NEL['1-99'][$centaine];
|
||||
if ($par2 == 0) return "{$nom_centaine} cents";
|
||||
return "{$nom_centaine} cent {$nom_par2}";
|
||||
}
|
||||
|
||||
function enlettres_zilli($idx)
|
||||
{
|
||||
# Noms des 0ème à 9ème zillions
|
||||
static $petit = array(
|
||||
'n', 'm', 'b', 'tr', 'quatr', 'quint', 'sext', 'sept', 'oct', 'non'
|
||||
);
|
||||
# Composantes des 10ème à 999ème zillions
|
||||
static $unite = array(
|
||||
'<', 'un<', 'duo<', 'tre<sé',
|
||||
'quattuor<', 'quin<', 'se<xsé',
|
||||
'septe<mné', 'octo<', 'nove<mné'
|
||||
);
|
||||
static $dizaine = array(
|
||||
'', 'né>déci<', 'ms>viginti<', 'ns>triginta<',
|
||||
'ns>quadraginta<', 'ns>quinquaginta<', 'né>sexaginta<',
|
||||
'né>septuaginta<', 'mxs>octoginta<', 'é>nonaginta<'
|
||||
);
|
||||
static $centaine = array(
|
||||
'>', 'nxs>cent', 'né>ducent', 'ns>trécent',
|
||||
'ns>quadringent', 'ns>quingent', 'né>sescent',
|
||||
'né>septingent', 'mxs>octingent', 'é>nongent'
|
||||
);
|
||||
|
||||
# Règles d'assimilation aux préfixes latins, modifiées pour accentuer
|
||||
# un éventuel 'é' de fin de préfixe.
|
||||
# (1) Si on trouve une lettre deux fois entre < > on la garde.
|
||||
# S'il y a plusieurs lettres dans ce cas, on garde la première.
|
||||
# (2) Sinon on efface tout ce qui est entre < >.
|
||||
# (3) On remplace "treé" par "tré", "seé" par "sé", "septeé" par "septé"
|
||||
# et "noveé" par "nové".
|
||||
# (4) En cas de dizaine sans centaine, on supprime la voyelle en trop.
|
||||
# Par exemple "déciilli" devient "décilli" et "trigintailli" devient
|
||||
# "trigintilli".
|
||||
#
|
||||
# Il est à noter que ces règles PERL (en particulier la première qui
|
||||
# est la plus complexe) sont *très* fortement inspirées du programme
|
||||
# de Nicolas Graner. On pourrait même parler de plagiat s'il n'avait
|
||||
# pas été au courant que je reprenais son code.
|
||||
# Voir <http://www.graner.net/nicolas/nombres/nom.php>
|
||||
# et <http://www.graner.net/nicolas/nombres/nom-exp.php>
|
||||
#
|
||||
static $recherche = array(
|
||||
'/<[a-zé]*?([a-zé])[a-zé]*\1[a-zé]*>/', # (1)
|
||||
'/<[a-zé]*>/', # (2)
|
||||
'/eé/', # (3)
|
||||
'/[ai]illi/' # (4)
|
||||
);
|
||||
static $remplace = array(
|
||||
'\\1', # (1)
|
||||
'', # (2)
|
||||
'é', # (3)
|
||||
'illi' # (4)
|
||||
);
|
||||
|
||||
$nom = '';
|
||||
while ($idx > 0) {
|
||||
$p = $idx % 1000;
|
||||
$idx = floor($idx/1000);
|
||||
|
||||
if ($p < 10) {
|
||||
$nom = $petit[$p] . 'illi' . $nom;
|
||||
} else {
|
||||
$nom = $unite[$p % 10] . $dizaine[floor($p/10) % 10]
|
||||
. $centaine[floor($p/100)] . 'illi' . $nom;
|
||||
}
|
||||
}
|
||||
return preg_replace($recherche, $remplace, $nom);
|
||||
}
|
||||
|
||||
function enlettres_illions($idx)
|
||||
{
|
||||
global $NEL;
|
||||
|
||||
if ($idx == 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($NEL['zillions']) {
|
||||
return enlettres_zilli($idx) . 'ons';
|
||||
}
|
||||
|
||||
$suffixe = '';
|
||||
while ($idx > $NEL['maxilli']) {
|
||||
$idx -= $NEL['maxilli'];
|
||||
$suffixe .= $NEL['de_maxillions'];
|
||||
}
|
||||
return "{$NEL['illi'][$idx]}illions{$suffixe}";
|
||||
}
|
||||
|
||||
function enlettres_avec_illiards($idx)
|
||||
{
|
||||
global $NEL;
|
||||
|
||||
if ($idx == 0) return false;
|
||||
switch ($NEL['zilliard']) {
|
||||
case 0: return false;
|
||||
case 2: return true;
|
||||
}
|
||||
return ($idx == 1);
|
||||
}
|
||||
|
||||
function enlettres($nombre, $options=NULL, $separateur=NULL)
|
||||
{
|
||||
global $NEL;
|
||||
|
||||
if ($options !== NULL or $separateur !== NULL) {
|
||||
$NELsave = $NEL;
|
||||
enlettres_options($options, $separateur);
|
||||
$nom = enlettres($nombre);
|
||||
$NEL = $NELsave;
|
||||
return $nom;
|
||||
}
|
||||
|
||||
# On ne garde que les chiffres, puis on supprime les 0 du début
|
||||
$nombre = preg_replace('/[^0-9]/', '', $nombre);
|
||||
$nombre = ltrim($nombre, '0');
|
||||
|
||||
if ($nombre == '') {
|
||||
if ($NEL['ordinal'] === 'nieme') return 'zéroïème';
|
||||
else return 'zéro';
|
||||
}
|
||||
|
||||
$table_noms = array();
|
||||
for ($idx = 0; $nombre != ''; $idx++) {
|
||||
$par6 = (int)((strlen($nombre) < 6) ? $nombre : substr($nombre, -6));
|
||||
$nombre = substr($nombre, 0, -6);
|
||||
|
||||
if ($par6 == 0) continue;
|
||||
|
||||
$nom_par3_sup = enlettres_par3(floor($par6 / 1000));
|
||||
$nom_par3_inf = enlettres_par3($par6 % 1000);
|
||||
|
||||
$illions = enlettres_illions($idx);
|
||||
if (enlettres_avec_illiards($idx)) {
|
||||
if ($nom_par3_inf != '') {
|
||||
$table_noms[$illions] = $nom_par3_inf;
|
||||
}
|
||||
if ($nom_par3_sup != '') {
|
||||
$illiards = preg_replace('/illion/', 'illiard', $illions, 1);
|
||||
$table_noms[$illiards] = $nom_par3_sup;
|
||||
}
|
||||
} else {
|
||||
switch($nom_par3_sup) {
|
||||
case '':
|
||||
$nom_par6 = $nom_par3_inf;
|
||||
break;
|
||||
case 'un':
|
||||
$nom_par6 = rtrim("mille {$nom_par3_inf}");
|
||||
break;
|
||||
default:
|
||||
$nom_par3_sup = preg_replace('/(vingt|cent)s/', '\\1', $nom_par3_sup);
|
||||
$nom_par6 = rtrim("{$nom_par3_sup} mille {$nom_par3_inf}");
|
||||
break;
|
||||
}
|
||||
$table_noms[$illions] = $nom_par6;
|
||||
}
|
||||
}
|
||||
|
||||
$nom_enlettres = '';
|
||||
foreach ($table_noms as $nom => $nombre) {
|
||||
##
|
||||
# $nombre est compris entre 'un' et
|
||||
# 'neuf cent nonante-neuf mille neuf cent nonante-neuf'
|
||||
# (ou variante avec 'quatre-vingt-dix-neuf')
|
||||
##
|
||||
# $nom peut valoir '', 'millions', 'milliards', 'billions', ...
|
||||
# 'sextillions', 'sextilliards', 'millions de sextillions',
|
||||
# 'millions de sextilliards', etc.
|
||||
##
|
||||
|
||||
# Rectifications orthographiques de 1990
|
||||
if ($NEL['rectif']) {
|
||||
$nombre = str_replace(' ', '-', $nombre);
|
||||
}
|
||||
|
||||
# Nom (éventuel) et accord (éventuel) des substantifs
|
||||
$nom = rtrim("{$nombre} {$nom}");
|
||||
if ($nombre == 'un') {
|
||||
# Un seul million, milliard, etc., donc au singulier
|
||||
# noter la limite de 1 remplacement, pour ne supprimer que le premier 's'
|
||||
# dans 'billions de sextillions de sextillions'
|
||||
$nom = preg_replace('/(illion|illiard)s/', '\\1', $nom, 1);
|
||||
}
|
||||
|
||||
# Ajout d'un séparateur entre chaque partie
|
||||
if ($nom_enlettres == '') {
|
||||
$nom_enlettres = $nom;
|
||||
} else {
|
||||
$nom_enlettres = $nom . $NEL['separateur'] . $nom_enlettres;
|
||||
}
|
||||
}
|
||||
|
||||
if ($NEL['ordinal'] === false) {
|
||||
# Nombre cardinal : le traitement est fini
|
||||
return $nom_enlettres;
|
||||
}
|
||||
|
||||
# Aucun pluriel dans les ordinaux
|
||||
$nom_enlettres =
|
||||
preg_replace('/(cent|vingt|illion|illiard)s/', '\\1', $nom_enlettres);
|
||||
|
||||
if ($NEL['ordinal'] !== 'nieme') {
|
||||
# Nombre ordinal simple (sans '-ième')
|
||||
return $nom_enlettres;
|
||||
}
|
||||
|
||||
if ($nom_enlettres === 'un') {
|
||||
# Le féminin n'est pas traité ici. On fait la supposition
|
||||
# qu'il est plus facile de traiter ce cas à part plutôt
|
||||
# que de rajouter une option rien que pour ça.
|
||||
return 'premier';
|
||||
}
|
||||
|
||||
switch (substr($nom_enlettres, -1)) {
|
||||
case 'e':
|
||||
# quatre, onze à seize, trente à nonante, mille
|
||||
# exemple : quatre -> quatrième
|
||||
return substr($nom_enlettres, 0, -1) . 'ième';
|
||||
case 'f':
|
||||
# neuf -> neuvième
|
||||
return substr($nom_enlettres, 0, -1) . 'vième';
|
||||
case 'q':
|
||||
# cinq -> cinquième
|
||||
return $nom_enlettres . 'uième';
|
||||
}
|
||||
|
||||
# Tous les autres cas.
|
||||
# Exemples: deuxième, troisième, vingtième, trente et unième,
|
||||
# neuf centième, un millionième, quatre-vingt milliardième.
|
||||
return $nom_enlettres . 'ième';
|
||||
}
|
||||
|
||||
function enchiffres_petit($mot)
|
||||
{
|
||||
static $petit = array(
|
||||
# 1-16
|
||||
'un' => 1,
|
||||
'deux' => 2,
|
||||
'trois' => 3,
|
||||
'quatre' => 4,
|
||||
'cinq' => 5,
|
||||
'six' => 6,
|
||||
'sept' => 7,
|
||||
'huit' => 8,
|
||||
'neuf' => 9,
|
||||
'dix' => 10,
|
||||
'onze' => 11,
|
||||
'douze' => 12,
|
||||
'treize' => 13,
|
||||
'quatorze' => 14,
|
||||
'quinze' => 15,
|
||||
'seize' => 16,
|
||||
# 20-90
|
||||
'vingt' => 20,
|
||||
'vingts' => 20,
|
||||
'trente' => 30,
|
||||
'quarante' => 40,
|
||||
'cinquante' => 50,
|
||||
'soixante' => 60,
|
||||
'septante' => 70,
|
||||
'huitante' => 80,
|
||||
'octante' => 80,
|
||||
'nonante' => 90,
|
||||
# 100, 1000
|
||||
'cent' => 100,
|
||||
'cents' => 100,
|
||||
'mil' => 1000,
|
||||
'mille' => 1000
|
||||
);
|
||||
|
||||
if (! isset($petit[$mot]))
|
||||
return false;
|
||||
|
||||
return $petit[$mot];
|
||||
}
|
||||
|
||||
function enchiffres_zilli($mot)
|
||||
{
|
||||
# Noms des 0ème à 9ème zillions
|
||||
static $petits = array(
|
||||
'n', 'm', 'b', 'tr', 'quadr', 'quint', 'sext', 'sept', 'oct', 'non'
|
||||
);
|
||||
# Composantes des 10ème à 999ème zillions
|
||||
static $unites = array(
|
||||
'', 'un', 'duo', 'tre', 'quattuor', 'quin', 'se', 'septe', 'octo', 'nove'
|
||||
);
|
||||
static $dizaines = array(
|
||||
'', 'dec', 'vigint', 'trigint', 'quadragint',
|
||||
'quinquagint', 'sexagint', 'septuagint', 'octogint', 'nonagint'
|
||||
);
|
||||
static $centaines = array(
|
||||
'', 'cent', 'ducent', 'trecent', 'quadringent',
|
||||
'quingent', 'sescent', 'septingent', 'octingent', 'nongent'
|
||||
);
|
||||
# Expressions rationnelles pour extraire les composantes
|
||||
static $um =
|
||||
'(|un|duo|tre(?!c)|quattuor|quin|se(?!p)(?!sc)|septe|octo|nove)[mnsx]?';
|
||||
static $dm =
|
||||
'(|dec|(?:v|tr|quadr|quinqu|sex|septu|oct|non)[aio]gint)[ai]?';
|
||||
static $cm =
|
||||
'(|(?:|du|tre|ses)cent|(?:quadri|qui|septi|octi|no)ngent)';
|
||||
|
||||
$u = array_search($mot, $petits);
|
||||
if ($u !== false) {
|
||||
return '00' . $u;
|
||||
}
|
||||
|
||||
if (preg_match('/^'.$um.$dm.$cm.'$/', $mot, $resultat) < 1) {
|
||||
return false;
|
||||
}
|
||||
$u = array_search($resultat[1], $unites);
|
||||
$d = array_search($resultat[2], $dizaines);
|
||||
$c = array_search($resultat[3], $centaines);
|
||||
if ($u === false or $d === false or $c === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $c.$d.$u;
|
||||
}
|
||||
|
||||
function enchiffres_grand($mot)
|
||||
{
|
||||
# Quelques remplacements initiaux pour simplifier (les 'é' ont déjà
|
||||
# été tous transformés en 'e').
|
||||
# (1) Je supprime le 's' final de '-illions' ou '-illiards' pour ne
|
||||
# tester que '-illion' ou '-illiard'.
|
||||
# (2) Les deux orthographes étant possibles pour quadrillion ou
|
||||
# quatrillion, je teste les deux. Noter que j'aurais pu changer
|
||||
# 'quadr' en 'quatr' au lieu de l'inverse, mais alors cela aurait
|
||||
# aussi changé 'quadragintillion' en 'quatragintillion', ce qui
|
||||
# n'est pas franchement le but recherché.
|
||||
# (3) En latin, on trouve parfois 'quatuor' au lieu de 'quattuor'. De même,
|
||||
# avec google on trouve quelques 'quatuordecillions' au milieu des
|
||||
# 'quattuordecillions' (environ 1 sur 10).
|
||||
# (4) La règle de John Conway et Allan Wechsler préconisait le préfixe
|
||||
# 'quinqua' au lieu de 'quin' que j'ai choisi. Pour accepter les deux,
|
||||
# je remplace 'quinqua' par 'quin', sauf dans 'quinquaginta' (50)
|
||||
# et dans 'quinquadraginta' (45).
|
||||
static $recherche = array(
|
||||
'/s$/', # (1)
|
||||
'/quatr/', # (2)
|
||||
'/quatuor/', # (3)
|
||||
'/quinqua(?!(dra)?gint)/' # (4)
|
||||
);
|
||||
static $remplace = array(
|
||||
'', # (1)
|
||||
'quadr', # (2)
|
||||
'quattuor', # (3)
|
||||
'quin' # (4)
|
||||
);
|
||||
|
||||
$mot = preg_replace($recherche, $remplace, $mot);
|
||||
if ($mot == 'millier') return 1;
|
||||
if ($mot == 'millinillion') return 2000;
|
||||
|
||||
$prefixes = explode('illi', $mot);
|
||||
if (count($prefixes) < 2) {
|
||||
# Il faut au moins un 'illi' dans le nom
|
||||
return false;
|
||||
}
|
||||
switch (array_pop($prefixes)) {
|
||||
case 'on':
|
||||
# zillion : nombre pair de milliers
|
||||
$ard = 0;
|
||||
break;
|
||||
case 'ard':
|
||||
# zilliard : nombre impair de milliers
|
||||
$ard = 1;
|
||||
break;
|
||||
default:
|
||||
# Ce n'est ni un zillion, ni un zilliard
|
||||
return false;
|
||||
}
|
||||
|
||||
$nombre = '';
|
||||
foreach ($prefixes as $prefixe) {
|
||||
$par3 = enchiffres_zilli($prefixe);
|
||||
if ($par3 === false) return false;
|
||||
$nombre .= $par3;
|
||||
}
|
||||
if (strlen($nombre) > 3) {
|
||||
# On n'accepte que les nombres inférieurs au millinillion
|
||||
# pour limiter le temps de calcul
|
||||
return 0;
|
||||
}
|
||||
return 2*$nombre + $ard;
|
||||
}
|
||||
|
||||
class enchiffres_struct
|
||||
{
|
||||
var $valeur;
|
||||
var $discr;
|
||||
|
||||
function enchiffres_struct($mul, $val)
|
||||
{
|
||||
$this->valeur = $this->discr = $val;
|
||||
if ($mul != 0) {
|
||||
$this->valeur *= $mul;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function enchiffres_ajouter_petit(&$table_petits, $petit)
|
||||
{
|
||||
$somme = 0;
|
||||
while (($elem = array_pop($table_petits)) !== NULL) {
|
||||
if ($elem->discr > $petit) {
|
||||
array_push($table_petits, $elem);
|
||||
break;
|
||||
}
|
||||
$somme += $elem->valeur;
|
||||
}
|
||||
$elem = new enchiffres_struct($somme, $petit);
|
||||
array_push($table_petits, $elem);
|
||||
}
|
||||
|
||||
function enchiffres_somme_petits($table_petits)
|
||||
{
|
||||
$somme = 0;
|
||||
foreach ($table_petits as $elem) {
|
||||
$somme += $elem->valeur;
|
||||
}
|
||||
return $somme;
|
||||
}
|
||||
|
||||
function enchiffres_ajouter_grand(&$table_grands, $mantisse, $exposant)
|
||||
{
|
||||
while ($mantisse > 0) {
|
||||
if (isset($table_grands[$exposant])) {
|
||||
$mantisse += $table_grands[$exposant];
|
||||
}
|
||||
$table_grands[$exposant] = $mantisse % 1000;
|
||||
$mantisse = floor($mantisse / 1000);
|
||||
$exposant++;
|
||||
}
|
||||
}
|
||||
|
||||
function enchiffres($nom)
|
||||
{
|
||||
$nom = preg_replace('/[éèÉÈ]/', 'e', $nom);
|
||||
$nom = strtolower($nom);
|
||||
$table_mots = preg_split('/[^a-z]+/', $nom);
|
||||
|
||||
$table_petits = array();
|
||||
$mantisse = $exposant = 0;
|
||||
$table_grands = array();
|
||||
|
||||
foreach ($table_mots as $mot) {
|
||||
$petit = enchiffres_petit($mot);
|
||||
if ($petit !== false) {
|
||||
if ($mantisse != 0) {
|
||||
enchiffres_ajouter_grand($table_grands, $mantisse, $exposant);
|
||||
$mantisse = $exposant = 0;
|
||||
}
|
||||
enchiffres_ajouter_petit($table_petits, $petit);
|
||||
continue;
|
||||
}
|
||||
|
||||
$grand = enchiffres_grand($mot);
|
||||
if ($grand === false) {
|
||||
# Ce n'est pas un nombre
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($grand == 0) {
|
||||
# Ce nombre était trop grand (millinillion et plus) : on annule le
|
||||
# tout pour limiter le temps de calcul.
|
||||
$mantisse = 0;
|
||||
$exposant = 0;
|
||||
$table_petits = array();
|
||||
} else {
|
||||
if (count($table_petits) > 0) {
|
||||
$mantisse = enchiffres_somme_petits($table_petits);
|
||||
$exposant = 0;
|
||||
$table_petits = array();
|
||||
}
|
||||
if ($mantisse != 0) {
|
||||
$exposant += $grand;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($table_petits) > 0) {
|
||||
$mantisse = enchiffres_somme_petits($table_petits);
|
||||
$exposant = 0;
|
||||
}
|
||||
if ($mantisse != 0) {
|
||||
enchiffres_ajouter_grand($table_grands, $mantisse, $exposant);
|
||||
}
|
||||
|
||||
$nombre = "";
|
||||
for ($exposant = 0; count($table_grands) > 0; $exposant++) {
|
||||
if (isset($table_grands[$exposant])) {
|
||||
$par3 = $table_grands[$exposant];
|
||||
unset($table_grands[$exposant]);
|
||||
} else {
|
||||
$par3 = 0;
|
||||
}
|
||||
$nombre = sprintf("%03d", $par3) . $nombre;
|
||||
}
|
||||
$nombre = ltrim($nombre, '0');
|
||||
if ($nombre === '') $nombre = '0';
|
||||
return $nombre;
|
||||
}
|
||||
|
||||
function enchiffres_aerer($nombre, $blanc=' ', $virgule=',', $tranche=3)
|
||||
{
|
||||
# Si c'est un nombre à virgule, on traite séparément les deux parties
|
||||
if ($virgule !== NULL) {
|
||||
$ent_dec = preg_split("/$virgule/", $nombre);
|
||||
if (count($ent_dec) >= 2) {
|
||||
$ent = enchiffres_aerer($ent_dec[0], $blanc, NULL, $tranche);
|
||||
$dec = enchiffres_aerer($ent_dec[1], $blanc, NULL, -$tranche);
|
||||
return $ent . $virgule . $dec;
|
||||
}
|
||||
}
|
||||
|
||||
# On ne garde que les chiffres
|
||||
$nombre = preg_replace('/[^0-9]/', '', $nombre);
|
||||
|
||||
# Il est plus logique d'avoir un nombre positif pour les entiers,
|
||||
# donc négatif pour la partie décimale, mais plus pratique de
|
||||
# faire le contraire pour les substr().
|
||||
$tranche = - (int)$tranche;
|
||||
|
||||
if ($tranche == 0) {
|
||||
# on voulait juste supprimer les caractères en trop, pas en rajouter
|
||||
return $nombre;
|
||||
}
|
||||
|
||||
$nombre_aere = '';
|
||||
if ($tranche < 0) {
|
||||
# entier, ou partie entière d'un nombre décimal
|
||||
while ($nombre != '') {
|
||||
$par3 = substr($nombre, $tranche);
|
||||
$nombre = substr($nombre, 0, $tranche);
|
||||
if ($nombre_aere == '') {
|
||||
$nombre_aere = $par3;
|
||||
} else {
|
||||
$nombre_aere = $par3 . $blanc . $nombre_aere;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# partie décimale
|
||||
while ($nombre != '') {
|
||||
$par3 = substr($nombre, 0, $tranche);
|
||||
$nombre = substr($nombre, $tranche);
|
||||
if ($nombre_aere == '') {
|
||||
$nombre_aere = $par3;
|
||||
} else {
|
||||
$nombre_aere .= $blanc . $par3;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $nombre_aere;
|
||||
}
|
||||
|
||||
*/
|
||||
?>
|
||||
}
|
@ -1,64 +1,58 @@
|
||||
<?
|
||||
|
||||
include_once('chiffres.php');
|
||||
|
||||
<?php
|
||||
require_once 'framework/common/chiffres.php';
|
||||
define ('TODAY', date('Ymd'));
|
||||
|
||||
/**
|
||||
* Classe de gestion des méthodes relatives à la date et à l'heure
|
||||
*
|
||||
* <p>détail de la classe</p>
|
||||
*
|
||||
* @name nom de la classe
|
||||
* @author Nom de l'auteur <adresse@Email.dom>
|
||||
* @link
|
||||
* @copyright Prénom Nom Année
|
||||
* @version 1.0.0
|
||||
* @package Nom du package
|
||||
*/
|
||||
|
||||
class WDate {
|
||||
class WDate
|
||||
{
|
||||
private static $tabMoisEnLettres = array(
|
||||
1 => 'Janvier',
|
||||
2 => 'Février',
|
||||
3 => 'Mars',
|
||||
4 => 'Avril',
|
||||
5 => 'Mai',
|
||||
6 => 'Juin',
|
||||
7 => 'Juillet',
|
||||
8 => 'Août',
|
||||
9 => 'Septembre',
|
||||
10 => 'Octobre',
|
||||
11 => 'Novembre',
|
||||
12 => 'Décembre'
|
||||
);
|
||||
|
||||
private static $tabMoisEnLettres = array( 1=>'Janvier',
|
||||
2=>'Février',
|
||||
3=>'Mars',
|
||||
4=>'Avril',
|
||||
5=>'Mai',
|
||||
6=>'Juin',
|
||||
7=>'Juillet',
|
||||
8=>'Août',
|
||||
9=>'Septembre',
|
||||
10=>'Octobre',
|
||||
11=>'Novembre',
|
||||
12=>'Décembre');
|
||||
|
||||
/** Retourne le numéro du mois donné au format texte (janvier, mars, etc...)
|
||||
* @param string Mois en toute lettres (janvier, mars, etc...)
|
||||
* @return string Mois en Chiffe (1, 3, 12) / false en cas d'erreur
|
||||
*/
|
||||
public function getNumMois($moisEnLettres) {
|
||||
public function getNumMois($moisEnLettres)
|
||||
{
|
||||
foreach (self::$tabMoisEnLettres as $num=>$mois)
|
||||
$tabMoisSansAccents[$num]=strtr($mois, 'ééûÉÉÛ','eeueeu');
|
||||
return array_search(ucfirst(strtolower(strtr($moisEnLettres, 'ééûÉÉÛ','eeuEEU'))), $tabMoisSansAccents);
|
||||
}
|
||||
|
||||
|
||||
/** Retourne le libellé nu numéro du mois passé en paramètre
|
||||
* @param int $moisEnChiffre
|
||||
* @return string Libellé du mois / false si le mois passé en paramètre est invalide
|
||||
*/
|
||||
public function getLibelleMois($moisEnChiffre) {
|
||||
public function getLibelleMois($moisEnChiffre)
|
||||
{
|
||||
if ($moisEnChiffre>0 && $moisEnChiffre<13)
|
||||
return self::$tabMoisEnLettres[$moisEnChiffre];
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** Retourne le nombre de mois entre 2 dates au format Ymd
|
||||
**
|
||||
** @param int $dateDeb Date de début au format Ymd
|
||||
** @param int $dateFin Date de fin (ultérieur à la date de début) au format Ymd
|
||||
** @return int Nombre de mois
|
||||
**/
|
||||
function nbMoisEntre($dateDeb, $dateFin=TODAY) {
|
||||
function nbMoisEntre($dateDeb, $dateFin=TODAY)
|
||||
{
|
||||
$dDeb=explode('-', Wdate::dateT('Ymd','Y-m-d', $dateDeb));
|
||||
$dFin=explode('-', Wdate::dateT('Ymd','Y-m-d', $dateFin));
|
||||
return ($dFin[0]*12+$dFin[1])-($dDeb[0]*12+$dDeb[1]);
|
||||
@ -71,7 +65,8 @@ include_once('chiffres.php');
|
||||
* @param string Date d'entrée
|
||||
* @return string Date formatée
|
||||
*/
|
||||
public function dateT($formatIN, $formatOUT, $date) {
|
||||
public function dateT($formatIN, $formatOUT, $date)
|
||||
{
|
||||
$M='';
|
||||
switch ($formatIN) {
|
||||
case 'd M Y': $tmp=explode(' ', $date); $d=str_replace('1er', '1', $tmp[0]); $m=self::getNumMois($tmp[1]); $Y=$tmp[2]; break;
|
||||
@ -117,89 +112,89 @@ include_once('chiffres.php');
|
||||
default: return $date;
|
||||
}
|
||||
}
|
||||
|
||||
/** Calcul de la date après application de la période textuelle (deux ans, six mois, quinze jours, etc...)
|
||||
* @todo Fonction ne fonctionnant qu'avec un chiffre en un seul mot du genre dix mais pas quatre vingt dix !!!
|
||||
* @param date $dateIN au format Ymd
|
||||
* @param string $period (ex : cinq mois, six ans, un jour, 3 mois)
|
||||
* @return date
|
||||
*/
|
||||
function period2Days($dateIN, $period, $inThePast=false) {
|
||||
$dateV=self::dateT('Ymd', 'Ymd', $dateIN);
|
||||
if ($dateV<>$dateIN) return NULL;
|
||||
$d=substr($dateIN,6,2);
|
||||
$m=substr($dateIN,4,2);
|
||||
$Y=substr($dateIN,0,4);
|
||||
$period=strtolower(trim(strtr($period, "-.,", ' ')));
|
||||
if ($period=='') return NULL;
|
||||
$tabP=explode(' ', $period);
|
||||
if ($tabP[0]*1>0) $chiffre=$tabP[0]*1*1;
|
||||
else $chiffre=WChiffes::ChiffresEnLettres($tabP[0]);
|
||||
if ($inThePast) $chiffre=-1*$chiffre;
|
||||
switch (end($tabP)) {
|
||||
case 'mois': $dateOUT=date('Ymd', mktime(0, 0, 0, $m+$chiffre, $d, $Y)); break;
|
||||
case 'an':
|
||||
case 'ans': $dateOUT=date('Ymd', mktime(0, 0, 0, $m, $d, $Y+$chiffre)); break;
|
||||
case 'jour':
|
||||
case 'jours': $dateOUT=date('Ymd', mktime(0, 0, 0, $m, $d+$chiffre, $Y)); break;
|
||||
default: $dateOUT=NULL;
|
||||
}
|
||||
return $dateOUT;
|
||||
}
|
||||
|
||||
|
||||
/** le jour est il ferié
|
||||
* @param date $date Date au format SSAA-MM-JJ ou SSAAMMJJ
|
||||
* @param bool $weekend Considérer les WeekEnd comme feriés ? 1=Oui
|
||||
* @return bool
|
||||
**/
|
||||
function jourFerie($date, $weekend=false) {
|
||||
$date =str_replace('-','',strtr($date, '/.:','---'));
|
||||
$jour =self::dateT('Ymd', 'd', $date);
|
||||
$mois =self::dateT('Ymd', 'm', $date);
|
||||
$annee=self::dateT('Ymd', 'Y', $date);
|
||||
$ferie=false;
|
||||
|
||||
// Jours feriées fixes
|
||||
if($jour == 1 && $mois == 1) $ferie = true; // 1er janvier
|
||||
if($jour == 1 && $mois == 5) $ferie = true; // 1er mai
|
||||
if($jour == 8 && $mois == 5) $ferie = true; // 8 mai
|
||||
if($jour == 14 && $mois == 7) $ferie = true; // 14 juillet
|
||||
if($jour == 15 && $mois == 8) $ferie = true; // 15 aout
|
||||
if($jour == 1 && $mois == 11) $ferie = true; // 1 novembre
|
||||
if($jour == 11 && $mois == 11) $ferie = true; // 11 novembre
|
||||
if($jour == 25 && $mois == 12) $ferie = true; // 25 décembre
|
||||
/** Calcul de la date après application de la période textuelle (deux ans, six mois, quinze jours, etc...)
|
||||
* @todo Fonction ne fonctionnant qu'avec un chiffre en un seul mot du genre dix mais pas quatre vingt dix !!!
|
||||
* @param date $dateIN au format Ymd
|
||||
* @param string $period (ex : cinq mois, six ans, un jour, 3 mois)
|
||||
* @return date
|
||||
*/
|
||||
function period2Days($dateIN, $period, $inThePast=false)
|
||||
{
|
||||
$dateV=self::dateT('Ymd', 'Ymd', $dateIN);
|
||||
if ($dateV<>$dateIN) return NULL;
|
||||
$d=substr($dateIN,6,2);
|
||||
$m=substr($dateIN,4,2);
|
||||
$Y=substr($dateIN,0,4);
|
||||
$period=strtolower(trim(strtr($period, "-.,", ' ')));
|
||||
if ($period=='') return NULL;
|
||||
$tabP=explode(' ', $period);
|
||||
if ($tabP[0]*1>0) $chiffre=$tabP[0]*1*1;
|
||||
else $chiffre=WChiffes::ChiffresEnLettres($tabP[0]);
|
||||
if ($inThePast) $chiffre=-1*$chiffre;
|
||||
switch (end($tabP)) {
|
||||
case 'mois': $dateOUT=date('Ymd', mktime(0, 0, 0, $m+$chiffre, $d, $Y)); break;
|
||||
case 'an':
|
||||
case 'ans': $dateOUT=date('Ymd', mktime(0, 0, 0, $m, $d, $Y+$chiffre)); break;
|
||||
case 'jour':
|
||||
case 'jours': $dateOUT=date('Ymd', mktime(0, 0, 0, $m, $d+$chiffre, $Y)); break;
|
||||
default: $dateOUT=NULL;
|
||||
}
|
||||
return $dateOUT;
|
||||
}
|
||||
|
||||
// fêtes religieuses mobiles
|
||||
$pak = @easter_date($annee);
|
||||
$jp = date("d", $pak);
|
||||
$mp = date("m", $pak);
|
||||
if($jp == $jour && $mp == $mois){ $ferie = true;} // Pâques
|
||||
$lpk = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) +1, date("Y", $pak) );
|
||||
$jp = date("d", $lpk);
|
||||
$mp = date("m", $lpk);
|
||||
if($jp == $jour && $mp == $mois){ $ferie = true; }// Lundi de Pâques
|
||||
$asc = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 39, date("Y", $pak) );
|
||||
$jp = date("d", $asc);
|
||||
$mp = date("m", $asc);
|
||||
if($jp == $jour && $mp == $mois){ $ferie = true;}//ascension
|
||||
$pe = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 49, date("Y", $pak) );
|
||||
$jp = date("d", $pe);
|
||||
$mp = date("m", $pe);
|
||||
if($jp == $jour && $mp == $mois) {$ferie = true;}// Pentecôte
|
||||
$lp = mktime(date("H", $asc), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 50, date("Y", $pak) );
|
||||
$jp = date("d", $lp);
|
||||
$mp = date("m", $lp);
|
||||
if($jp == $jour && $mp == $mois) {$ferie = true;}// lundi Pentecôte
|
||||
|
||||
// Samedis et Dimanches
|
||||
if ($weekend) {
|
||||
$jour_sem = date('N',mktime(0,0,0, $mois, $jour, $annee));
|
||||
if($jour_sem>5) $ferie = true;
|
||||
}
|
||||
|
||||
return $ferie;
|
||||
|
||||
/** le jour est il ferié
|
||||
* @param date $date Date au format SSAA-MM-JJ ou SSAAMMJJ
|
||||
* @param bool $weekend Considérer les WeekEnd comme feriés ? 1=Oui
|
||||
* @return bool
|
||||
**/
|
||||
function jourFerie($date, $weekend=false)
|
||||
{
|
||||
$date =str_replace('-','',strtr($date, '/.:','---'));
|
||||
$jour =self::dateT('Ymd', 'd', $date);
|
||||
$mois =self::dateT('Ymd', 'm', $date);
|
||||
$annee=self::dateT('Ymd', 'Y', $date);
|
||||
$ferie=false;
|
||||
|
||||
// Jours feriées fixes
|
||||
if($jour == 1 && $mois == 1) $ferie = true; // 1er janvier
|
||||
if($jour == 1 && $mois == 5) $ferie = true; // 1er mai
|
||||
if($jour == 8 && $mois == 5) $ferie = true; // 8 mai
|
||||
if($jour == 14 && $mois == 7) $ferie = true; // 14 juillet
|
||||
if($jour == 15 && $mois == 8) $ferie = true; // 15 aout
|
||||
if($jour == 1 && $mois == 11) $ferie = true; // 1 novembre
|
||||
if($jour == 11 && $mois == 11) $ferie = true; // 11 novembre
|
||||
if($jour == 25 && $mois == 12) $ferie = true; // 25 décembre
|
||||
|
||||
// fêtes religieuses mobiles
|
||||
$pak = @easter_date($annee);
|
||||
$jp = date("d", $pak);
|
||||
$mp = date("m", $pak);
|
||||
if($jp == $jour && $mp == $mois){ $ferie = true;} // Pâques
|
||||
$lpk = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) +1, date("Y", $pak) );
|
||||
$jp = date("d", $lpk);
|
||||
$mp = date("m", $lpk);
|
||||
if($jp == $jour && $mp == $mois){ $ferie = true; }// Lundi de Pâques
|
||||
$asc = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 39, date("Y", $pak) );
|
||||
$jp = date("d", $asc);
|
||||
$mp = date("m", $asc);
|
||||
if($jp == $jour && $mp == $mois){ $ferie = true;}//ascension
|
||||
$pe = mktime(date("H", $pak), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 49, date("Y", $pak) );
|
||||
$jp = date("d", $pe);
|
||||
$mp = date("m", $pe);
|
||||
if($jp == $jour && $mp == $mois) {$ferie = true;}// Pentecôte
|
||||
$lp = mktime(date("H", $asc), date("i", $pak), date("s", $pak), date("m", $pak), date("d", $pak) + 50, date("Y", $pak) );
|
||||
$jp = date("d", $lp);
|
||||
$mp = date("m", $lp);
|
||||
if($jp == $jour && $mp == $mois) {$ferie = true;}// lundi Pentecôte
|
||||
|
||||
// Samedis et Dimanches
|
||||
if ($weekend) {
|
||||
$jour_sem = date('N',mktime(0,0,0, $mois, $jour, $annee));
|
||||
if($jour_sem>5) $ferie = true;
|
||||
}
|
||||
|
||||
return $ferie;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
335
library/framework/common/mysql.new.php
Normal file
335
library/framework/common/mysql.new.php
Normal file
@ -0,0 +1,335 @@
|
||||
<?php
|
||||
class WDB
|
||||
{
|
||||
/**
|
||||
* @var Zend_Db_Adapter_Abstract
|
||||
*/
|
||||
protected $db = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var unknown
|
||||
*/
|
||||
protected $result = null;
|
||||
|
||||
protected $errorCode = 0;
|
||||
|
||||
protected $errorMsg = '';
|
||||
|
||||
public function __construct( $db = null )
|
||||
{
|
||||
if ($db === null) {
|
||||
$this->db = Zend_Db_Table::getDefaultAdapter();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* INSERTION d'un tableau dans une table.
|
||||
* Les index doivent avoir les mêmes noms que les champs.
|
||||
* @param string Table
|
||||
* @param array Valeurs insérer
|
||||
* @return int Dernière valeur de l'auto-incrément, 1 si pas d'auto-incrément et 0 si erreur
|
||||
*/
|
||||
public function insert($table, $toAdd, $debug=false, $low_priority=false)
|
||||
{
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
$fields = implode(array_keys($toAdd), ',');
|
||||
foreach (array_values($toAdd) as $key=>$array_values)
|
||||
$tmp[$key]=checkaddslashes($array_values);
|
||||
|
||||
$values = "'".implode(array_values($tmp), "','")."'"; # better
|
||||
$values = str_replace("'NULL'", 'NULL', $values);
|
||||
|
||||
if ($low_priority) {
|
||||
$query = 'INSERT DELAYED INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
|
||||
} else {
|
||||
$query = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
|
||||
}
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query);
|
||||
$res = $this->db->lastInsertId();
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
if ( $res == 0 ) {
|
||||
return true;
|
||||
}
|
||||
return $res;
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$this->errorCode = $e->getCode();
|
||||
$this->errorMsg = $e->getMessage();
|
||||
$this->trace($query, $res, $tdeb);
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Database Update
|
||||
* @param unknown $table
|
||||
* @param unknown $update
|
||||
* @param unknown $where
|
||||
* @param string $debug
|
||||
* @param number $limit
|
||||
* @param string $low_priority
|
||||
* @return resource
|
||||
*/
|
||||
public function update($table, $update, $where, $debug=false, $limit=0, $low_priority=false)
|
||||
{
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
if ($low_priority) {
|
||||
$query='UPDATE LOW_PRIORITY '.$table.' SET ';
|
||||
} else {
|
||||
$query='UPDATE '.$table.' SET ';
|
||||
}
|
||||
$i=0;
|
||||
foreach ($update as $field => $value) {
|
||||
$query.= ' '.$field."=".$this->db->quote($value);
|
||||
$i++;
|
||||
if ($i<count($update)) {
|
||||
$query.= ',';
|
||||
}
|
||||
}
|
||||
$query = str_replace("'NULL'", 'NULL', $query);
|
||||
$query.=' WHERE '.$where;
|
||||
if ($limit>0) $query.=" LIMIT $limit";
|
||||
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query);
|
||||
$res = $stmt->rowCount();
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
if ( $res == 0 ) {
|
||||
return false;
|
||||
}
|
||||
return $res;
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$this->errorCode = $e->getCode();
|
||||
$this->errorMsg = $e->getMessage();
|
||||
$this->trace($query, $res, $tdeb);
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Database delete
|
||||
* @param unknown $table
|
||||
* @param unknown $where
|
||||
* @param string $debug
|
||||
* @param string $low_priority
|
||||
* @return resource
|
||||
*/
|
||||
public function delete($table, $where, $debug=false, $low_priority=false)
|
||||
{
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
if ($low_priority)
|
||||
$query='DELETE LOW_PRIORITY QUICK FROM `'.$table.'` WHERE '.$where.' LIMIT 1;';
|
||||
else
|
||||
$query='DELETE FROM `'.$table.'` WHERE '.$where.' LIMIT 1;';
|
||||
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query);
|
||||
$res = $this->db->lastInsertId();
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
if ( $res == 0 ) {
|
||||
$res = true;
|
||||
}
|
||||
return $res;
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$this->errorCode = $e->getCode();
|
||||
$this->errorMsg = $e->getMessage();
|
||||
$this->trace($query, $res, $tdeb);
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Database select
|
||||
* @param string $table
|
||||
* @param string $fields
|
||||
* @param string $where
|
||||
* @param string $debug
|
||||
* @param string $assoc
|
||||
* @param string $huge
|
||||
* @return boolean|multitype:multitype: |number
|
||||
*/
|
||||
public function select($table, $fields, $where, $debug=false, $assoc=MYSQL_BOTH, $huge=false)
|
||||
{
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
$query="SELECT $fields FROM $table WHERE $where;";
|
||||
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query);
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$this->errorCode = $e->getCode();
|
||||
$this->errorMsg = $e->getMessage();
|
||||
$this->trace($query);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !$huge ) {
|
||||
switch($assoc) {
|
||||
case MYSQL_NUM:
|
||||
$mode = Zend_Db::FETCH_NUM;
|
||||
break;
|
||||
case MYSQL_ASSOC:
|
||||
$mode = Zend_Db::FETCH_ASSOC;
|
||||
break;
|
||||
case MYSQL_BOTH:
|
||||
$mode = Zend_Db::FETCH_BOTH;
|
||||
break;
|
||||
}
|
||||
$tab = $stmt->fetchAll($mode);
|
||||
if ($debug) $this->trace($query, sizeof($tab), $tdeb);
|
||||
return $tab;
|
||||
} else {
|
||||
$nbRows = $stmt->rowCount();
|
||||
if ($debug) $this->trace($query, $nbRows, $tdeb);
|
||||
return $nbRows;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $assoc
|
||||
* @return multitype:
|
||||
*/
|
||||
public function fetch($assoc=MYSQL_BOTH)
|
||||
{
|
||||
switch($assoc) {
|
||||
case MYSQL_NUM:
|
||||
$mode = Zend_Db::FETCH_NUM;
|
||||
break;
|
||||
case MYSQL_ASSOC:
|
||||
$mode = Zend_Db::FETCH_ASSOC;
|
||||
break;
|
||||
case MYSQL_BOTH:
|
||||
$mode = Zend_Db::FETCH_BOTH;
|
||||
break;
|
||||
}
|
||||
return $this->result->fetch($mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trace
|
||||
* @param string $query
|
||||
* @param string $error
|
||||
* @param int $tdeb
|
||||
*/
|
||||
public function trace($query, $res='', $tdeb = null)
|
||||
{
|
||||
if ( $tdeb === null) {
|
||||
$duree = substr(''.microtime_float()-$tdeb, 0, 5);
|
||||
} else {
|
||||
$duree = 'N/D';
|
||||
}
|
||||
file_put_contents(LOG_PATH . '/mysql.log', date('Y-m-d H:i:s') ." - ".$query." - ".$this->errorCode.":".$this->errorMsg." - ".$duree."\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exécute la requête passé en paramètre
|
||||
*/
|
||||
public function query($query, $debug=false)
|
||||
{
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query);
|
||||
$this->result = $stmt;
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$this->errorCode = $e->getCode();
|
||||
$this->errorMsg = $e->getMessage();
|
||||
$this->trace($query);
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->result->fetchAll(Zend_Db::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
/** Retourne le libellé de la dernière erreur **/
|
||||
public function getLastErrorMsg()
|
||||
{
|
||||
return $this->errorMsg;
|
||||
}
|
||||
/**
|
||||
* Retourne le numéro de la dernière erreur
|
||||
*/
|
||||
public function getLastErrorNum()
|
||||
{
|
||||
return $this->errorCode;
|
||||
}
|
||||
|
||||
/** Retourne le libellé et le numéro de la dernière erreur **/
|
||||
public function getLastError()
|
||||
{
|
||||
return $this->errorMsg.' ('.$this->errorCode.')';
|
||||
}
|
||||
|
||||
/** Retourne le nombre de lignes modifiées par la dernière requête **/
|
||||
public function getAffectedRows()
|
||||
{
|
||||
return $this->result->rowCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Génère le fichier CSV pour la requete SQL
|
||||
*
|
||||
* @param string $query
|
||||
* @param string $fileCsv
|
||||
* @return bool
|
||||
*/
|
||||
public function exportCSV($query, $fileCsv, $sep=',', $eol=EOL)
|
||||
{
|
||||
$i = 0;
|
||||
$fp = fopen($fileCsv, 'w');
|
||||
if (!$fp) return false;
|
||||
|
||||
$res = $this->query($query);
|
||||
$nbLignes = mysql_num_rows($res);
|
||||
while ($ligne=$this->fetch(MYSQL_ASSOC)) {
|
||||
//Header
|
||||
if ($i==0) {
|
||||
$nbCols = count($ligne);
|
||||
$fields = array();
|
||||
$header = array();
|
||||
foreach ($ligne as $libCol=>$col) {
|
||||
$header[] = $libCol;
|
||||
$fields[] = $col;
|
||||
}
|
||||
fputcsv($fp, $header, $sep, '"');
|
||||
fputcsv($fp, $fields, $sep, '"');
|
||||
}
|
||||
//Content
|
||||
else {
|
||||
$fields = array();
|
||||
foreach ($ligne as $libCol=>$col) {
|
||||
$fields[] = $col;
|
||||
}
|
||||
fputcsv($fp, $fields, $sep, '"');
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
fclose($fp);
|
||||
return $nbLignes;
|
||||
}
|
||||
}
|
||||
?>
|
228
library/framework/common/mysql.old.php
Normal file
228
library/framework/common/mysql.old.php
Normal file
@ -0,0 +1,228 @@
|
||||
<?php
|
||||
class WDB
|
||||
{
|
||||
private $host;
|
||||
private $database;
|
||||
private $user;
|
||||
private $password;
|
||||
private $con_id; // Connection ID with MySQL
|
||||
private $result;
|
||||
|
||||
public function __construct($database='', $host='', $user='', $password='')
|
||||
{
|
||||
if ($host=='') $this->host=MYSQL_HOST;
|
||||
else $this->host=$host;
|
||||
if ($user=='') $this->user=MYSQL_USER;
|
||||
else $this->user=$user;
|
||||
if ($password=='') $this->password=MYSQL_PASS;
|
||||
else $this->password=$password;
|
||||
if ($database=='') $this->database=MYSQL_DEFAULT_DB;
|
||||
else $this->database=$database;
|
||||
|
||||
$this->con_id = mysql_pconnect($this->host, $this->user, $this->password);
|
||||
if (!($this->con_id === false)) {
|
||||
if (mysql_select_db($this->database, $this->con_id) === false) {
|
||||
echo date('Y/m/d - H:i:s') ." - ERREUR ".mysql_errno()." : Connection à la base de données impossible !".EOL;
|
||||
echo date ('Y/m/d - H:i:s'). mysql_error();
|
||||
die();
|
||||
}
|
||||
}
|
||||
return mysql_query("SET NAMES 'utf8';", $this->con_id);
|
||||
}
|
||||
|
||||
public function setCharSet($charSet) {
|
||||
return (mysql_query("SET CHARACTER SET $charSet;", $this->con_id));
|
||||
}
|
||||
|
||||
private function setDB() {
|
||||
return (mysql_query("USE $this->database;", $this->con_id));
|
||||
}
|
||||
|
||||
/** INSERTION d'un tableau dans une table.
|
||||
** Les index doivent avoir les mêmes noms que les champs.
|
||||
** @param string Table
|
||||
** @param array Valeurs insérer
|
||||
** @return int Dernière valeur de l'auto-incrément, 1 si pas d'auto-incrément et 0 si erreur
|
||||
**/
|
||||
public function insert($table, $toAdd, $debug=false, $low_priority=false)
|
||||
{
|
||||
$fields = implode(array_keys($toAdd), '`,`');
|
||||
foreach (array_values($toAdd) as $key=>$array_values)
|
||||
$tmp[$key]=checkaddslashes($array_values);
|
||||
|
||||
$values = "'".implode(array_values($tmp), "','")."'"; # better
|
||||
$values = str_replace("'NULL'", 'NULL', $values);
|
||||
|
||||
if ($low_priority)
|
||||
$query = 'INSERT DELAYED INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
|
||||
else
|
||||
$query = 'INSERT INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
|
||||
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
$res = mysql_query($query, $this->con_id);
|
||||
if ($res!==false)
|
||||
{
|
||||
if (mysql_insert_id()>0)
|
||||
$res=mysql_insert_id();
|
||||
else
|
||||
$res=true;
|
||||
}
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function update($table, $update, $where, $debug=false, $limit=0, $low_priority=false)
|
||||
{
|
||||
$fields = array_keys($update);
|
||||
$values = array_values($update);
|
||||
$i=0;
|
||||
if ($low_priority)
|
||||
$query='UPDATE LOW_PRIORITY `'.$table.'` SET ';
|
||||
else
|
||||
$query='UPDATE `'.$table.'` SET ';
|
||||
while(isset($fields[$i])){
|
||||
if($i>0) { $query.=', '; }
|
||||
$query.=' `'.$fields[$i]."`='".checkaddslashes($values[$i])."'";
|
||||
$i++;
|
||||
}
|
||||
$query = str_replace("'NULL'", 'NULL', $query);
|
||||
$query.=' WHERE '.$where;
|
||||
if ($limit>0) $query.=" LIMIT $limit";
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
$res=mysql_query($query, $this->con_id);
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function delete($table, $where, $debug=false, $low_priority=false)
|
||||
{
|
||||
if ($low_priority)
|
||||
$query='DELETE LOW_PRIORITY QUICK FROM `'.$table.'` WHERE '.$where.' LIMIT 1;';
|
||||
else
|
||||
$query='DELETE FROM `'.$table.'` WHERE '.$where.' LIMIT 1;';
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
$res=mysql_query($query, $this->con_id);
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function select($table, $fields, $where, $debug=false, $assoc=MYSQL_BOTH, $huge=false) {
|
||||
if (mysql_select_db($this->database, $this->con_id) === false) {
|
||||
echo date('Y/m/d - H:i:s') ." - ERREUR ".mysql_errno()." : Connection à la base de données impossible !".EOL;
|
||||
echo date ('Y/m/d - H:i:s'). mysql_error();
|
||||
die();
|
||||
}
|
||||
$query="SELECT $fields FROM $table WHERE $where;";
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
$this->result=mysql_query($query, $this->con_id);// or die(mysql_error());
|
||||
if (mysql_errno()) {
|
||||
$fpErr=fopen(LOG_PATH.'/sqlerror.log','a');
|
||||
fwrite($fpErr, date('YmdHis'). ' - '.$query .EOL);
|
||||
fwrite($fpErr, date('YmdHis'). ' - '.mysql_errno() .' - '. mysql_error().EOL);
|
||||
return false;
|
||||
}
|
||||
// echo ;
|
||||
if (!$huge) {
|
||||
$tab=array();
|
||||
while ($ligne = mysql_fetch_array($this->result, $assoc))
|
||||
$tab[]=$ligne;
|
||||
|
||||
if ($debug) $this->trace($query, sizeof($tab), $tdeb);
|
||||
return $tab;
|
||||
} else {
|
||||
$nbRows=mysql_num_rows($this->result);
|
||||
if ($debug) $this->trace($query, $nbRows, $tdeb);
|
||||
return $nbRows;
|
||||
}
|
||||
}
|
||||
|
||||
public function fetch($assoc=MYSQL_BOTH) {
|
||||
return mysql_fetch_array($this->result, $assoc);
|
||||
}
|
||||
|
||||
public function trace($query, $res='', $tdeb=-1) {
|
||||
if (!$fp=fopen(LOG_PATH.'/mysql_insert.log', 'a'))
|
||||
return false;
|
||||
$errnum=mysql_errno($this->con_id);
|
||||
if ($tdeb>-1) $duree=substr(''.microtime_float()-$tdeb, 0, 5);
|
||||
else $duree='N/D';
|
||||
if (!fwrite($fp, date('Y/m/d - H:i:s') ." - $errnum - $res - $duree - $query\n"))
|
||||
return false;
|
||||
if (!fclose($fp))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Exécute la requête passé en paramètre **/
|
||||
public function query($query, $debug=false)
|
||||
{
|
||||
$this->result=mysql_query($query, $this->con_id);
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
/** Retourne le nombre de records de la dernière requête de sélection **
|
||||
public function getNumRows() {
|
||||
return mysql_num_rows($this->con_id);
|
||||
}
|
||||
*/
|
||||
/** Retourne le libellé de la dernière erreur **/
|
||||
public function getLastErrorMsg() {
|
||||
return mysql_error($this->con_id);
|
||||
}
|
||||
/** Retourne le numéro de la dernière erreur **/
|
||||
public function getLastErrorNum()
|
||||
{
|
||||
return mysql_errno($this->con_id);
|
||||
}
|
||||
|
||||
/** Retourne le libellé et le numéro de la dernière erreur **/
|
||||
public function getLastError()
|
||||
{
|
||||
return mysql_error($this->con_id).' ('.mysql_errno($this->con_id).')';
|
||||
}
|
||||
|
||||
/** Retourne le nombre de lignes modifiées par la dernière requête **/
|
||||
public function getAffectedRows()
|
||||
{
|
||||
return mysql_affected_rows($this->con_id);
|
||||
}
|
||||
|
||||
/** Génère le fichier CSV pour la requete SQL
|
||||
**
|
||||
** @param string $query
|
||||
** @param string $fileCsv
|
||||
** @return bool
|
||||
*/
|
||||
public function exportCSV($query, $fileCsv, $sep=',', $eol=EOL) {
|
||||
$i=$c=0;
|
||||
$fp = fopen($fileCsv, 'w');
|
||||
if (!$fp) return false;
|
||||
|
||||
$res=$this->query($query);
|
||||
$nbLignes=mysql_num_rows($res);
|
||||
|
||||
while ($ligne=$this->fetch(MYSQL_ASSOC)) {
|
||||
if ($i==0) {
|
||||
$nbCols=count($ligne);
|
||||
foreach ($ligne as $libCol=>$col) {
|
||||
$c++;
|
||||
if ($c<$nbCols) fwrite($fp, str_replace($sep,' ', $libCol).$sep);
|
||||
else fwrite($fp, str_replace($sep,' ', $libCol));
|
||||
}
|
||||
fwrite($fp, $eol);
|
||||
}
|
||||
$c=0;
|
||||
foreach ($ligne as $libCol=>$col) {
|
||||
$c++;
|
||||
if ($c<$nbCols) fwrite($fp, str_replace($sep,' ', $col).$sep);
|
||||
else fwrite($fp, str_replace($sep,' ', $col));
|
||||
}
|
||||
fwrite($fp, $eol);
|
||||
$i++;
|
||||
}
|
||||
fclose($fp);
|
||||
return $nbLignes;//$this->getAffectedRows();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -16,47 +16,10 @@ class WDB
|
||||
|
||||
protected $errorMsg = '';
|
||||
|
||||
public function __construct( $database = null, $host = null, $user = null, $password = null )
|
||||
public function __construct( $db = null )
|
||||
{
|
||||
if ( $database === null ) {
|
||||
$database = 'jo';
|
||||
}
|
||||
|
||||
if ( $host === null ) {
|
||||
$c = Zend_Registry::get('config');
|
||||
$config = new Zend_Config(array(
|
||||
'adapter' => $c->profil->db->metier->adapter,
|
||||
'params' => array(
|
||||
'host' => $c->profil->db->metier->params->host,
|
||||
'username'=> $c->profil->db->metier->params->username,
|
||||
'password'=> $c->profil->db->metier->params->password,
|
||||
'dbname'=> $database,
|
||||
'driver_options' => array(
|
||||
MYSQLI_INIT_COMMAND => "SET NAMES utf8",
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
} else {
|
||||
$config = new Zend_Config(array(
|
||||
'adapter' => 'mysqli',
|
||||
'params' => array(
|
||||
'host' => $host,
|
||||
'username'=> $user,
|
||||
'password'=> $password,
|
||||
'dbname'=> $database,
|
||||
'driver_options' => array(
|
||||
MYSQLI_INIT_COMMAND => "SET NAMES utf8",
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
try {
|
||||
$this->db = Zend_Db::factory($config);
|
||||
} catch ( Exception $e ) {
|
||||
file_put_contents('debug.log', $e->getMessage()."\n", FILE_APPEND);
|
||||
exit;
|
||||
if ($db === null) {
|
||||
$this->db = Zend_Db_Table::getDefaultAdapter();
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,40 +32,43 @@ class WDB
|
||||
*/
|
||||
public function insert($table, $toAdd, $debug=false, $low_priority=false)
|
||||
{
|
||||
$fields = implode(array_keys($toAdd), '`,`');
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
$fields = implode(array_keys($toAdd), ',');
|
||||
foreach (array_values($toAdd) as $key=>$array_values)
|
||||
$tmp[$key]=checkaddslashes($array_values);
|
||||
|
||||
$values = "'".implode(array_values($tmp), "','")."'"; # better
|
||||
$values = str_replace("'NULL'", 'NULL', $values);
|
||||
|
||||
if ($low_priority)
|
||||
$query = 'INSERT DELAYED INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
|
||||
else
|
||||
$query = 'INSERT INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
|
||||
|
||||
if ($low_priority) {
|
||||
$query = 'INSERT DELAYED INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
|
||||
} else {
|
||||
$query = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
|
||||
}
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query, $debug);
|
||||
$stmt = $this->db->query($query);
|
||||
$res = $this->db->lastInsertId();
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
if ( $res == 0 ) {
|
||||
$res = true;
|
||||
return true;
|
||||
}
|
||||
return $res;
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$this->errorCode = $e->getCode();
|
||||
$this->errorMsg = $e->getMessage();
|
||||
|
||||
$res = false;
|
||||
$this->trace($query, $res, $tdeb);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
|
||||
return $res;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Database Update
|
||||
* @param unknown $table
|
||||
* @param unknown $update
|
||||
* @param unknown $where
|
||||
@ -113,17 +79,21 @@ class WDB
|
||||
*/
|
||||
public function update($table, $update, $where, $debug=false, $limit=0, $low_priority=false)
|
||||
{
|
||||
$fields = array_keys($update);
|
||||
$values = array_values($update);
|
||||
$i=0;
|
||||
if ($low_priority)
|
||||
$query='UPDATE LOW_PRIORITY `'.$table.'` SET ';
|
||||
else
|
||||
$query='UPDATE `'.$table.'` SET ';
|
||||
while(isset($fields[$i])){
|
||||
if($i>0) { $query.=', '; }
|
||||
$query.=' '.$fields[$i]."='".$this->db->quote($values[$i])."'";
|
||||
$i++;
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
if ($low_priority) {
|
||||
$query='UPDATE LOW_PRIORITY '.$table.' SET ';
|
||||
} else {
|
||||
$query='UPDATE '.$table.' SET ';
|
||||
}
|
||||
$i=0;
|
||||
foreach ($update as $field => $value) {
|
||||
$query.= ' '.$field."=".$this->db->quote($value);
|
||||
$i++;
|
||||
if ($i<count($update)) {
|
||||
$query.= ',';
|
||||
}
|
||||
}
|
||||
$query = str_replace("'NULL'", 'NULL', $query);
|
||||
$query.=' WHERE '.$where;
|
||||
@ -132,25 +102,25 @@ class WDB
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query, $debug);
|
||||
$res = $this->db->lastInsertId();
|
||||
$stmt = $this->db->query($query);
|
||||
$res = $stmt->rowCount();
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
if ( $res == 0 ) {
|
||||
$res = true;
|
||||
return false;
|
||||
}
|
||||
return $res;
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$this->errorCode = $e->getCode();
|
||||
$this->errorMsg = $e->getMessage();
|
||||
|
||||
$res = false;
|
||||
$this->trace($query, $res, $tdeb);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
|
||||
return $res;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Database delete
|
||||
* @param unknown $table
|
||||
* @param unknown $where
|
||||
* @param string $debug
|
||||
@ -159,6 +129,9 @@ class WDB
|
||||
*/
|
||||
public function delete($table, $where, $debug=false, $low_priority=false)
|
||||
{
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
if ($low_priority)
|
||||
$query='DELETE LOW_PRIORITY QUICK FROM `'.$table.'` WHERE '.$where.' LIMIT 1;';
|
||||
else
|
||||
@ -167,25 +140,25 @@ class WDB
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query, $debug);
|
||||
$stmt = $this->db->query($query);
|
||||
$res = $this->db->lastInsertId();
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
if ( $res == 0 ) {
|
||||
$res = true;
|
||||
}
|
||||
return $res;
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$this->errorCode = $e->getCode();
|
||||
$this->errorMsg = $e->getMessage();
|
||||
|
||||
$res = false;
|
||||
$this->trace($query, $res, $tdeb);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($debug) $this->trace($query, $res, $tdeb);
|
||||
|
||||
return $res;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Database select
|
||||
* @param string $table
|
||||
* @param string $fields
|
||||
* @param string $where
|
||||
@ -196,6 +169,9 @@ class WDB
|
||||
*/
|
||||
public function select($table, $fields, $where, $debug=false, $assoc=MYSQL_BOTH, $huge=false)
|
||||
{
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
$query="SELECT $fields FROM $table WHERE $where;";
|
||||
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
@ -205,7 +181,7 @@ class WDB
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$this->errorCode = $e->getCode();
|
||||
$this->errorMsg = $e->getMessage();
|
||||
file_put_contents(LOG_PATH.'/sqlerror.log', date('YmdHis')." - ".$query."\n".$e->getCode().':'. $e->getMessage());
|
||||
$this->trace($query);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -260,13 +236,12 @@ class WDB
|
||||
*/
|
||||
public function trace($query, $res='', $tdeb = null)
|
||||
{
|
||||
|
||||
if ( $tdeb === null) {
|
||||
$duree = substr(''.microtime_float()-$tdeb, 0, 5);
|
||||
} else {
|
||||
$duree = 'N/D';
|
||||
}
|
||||
file_put_contents(LOG_PATH . '/mysql_debug.log', date('Y/m/d - H:i:s') ." - ".$this->errorCode.":".$this->errorMsg." - $duree - $query\n", FILE_APPEND);
|
||||
file_put_contents(LOG_PATH . '/mysql.log', date('Y-m-d H:i:s') ." - ".$query." - ".$this->errorCode.":".$this->errorMsg." - ".$duree."\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -274,17 +249,20 @@ class WDB
|
||||
*/
|
||||
public function query($query, $debug=false)
|
||||
{
|
||||
try {
|
||||
$this->errorCode = 0;
|
||||
$this->errorMsg = '';
|
||||
|
||||
try {
|
||||
$stmt = $this->db->query($query);
|
||||
$this->result = $stmt;
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
$this->errorCode = $e->getCode();
|
||||
$this->errorMsg = $e->getMessage();
|
||||
|
||||
$this->trace($query);
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->result;
|
||||
return $this->result->fetchAll(Zend_Db::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
/** Retourne le libellé de la dernière erreur **/
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
define ('BEFORE', 0);
|
||||
define ('AFTER', 1);
|
||||
@ -6,42 +6,46 @@ define ('BOTH', 2);
|
||||
define ('ALIGN_LEFT', 0);
|
||||
define ('ALIGN_RIGHT', 1);
|
||||
|
||||
/**
|
||||
* Initialisation d'une chaîne de caractère
|
||||
* @param string $chaine
|
||||
* Chaîne de caractère initiale
|
||||
* @param int $taille
|
||||
* Taille de la chaîne de caractère à initialiser
|
||||
* @param string $caractere_pour_combler
|
||||
* Caractère à utiliser pour combler la chaîne de caractère (espace par défaut)
|
||||
* @param string $align
|
||||
* Aligner la chaîne de caractère à droite (right) ou à gauche (left, par défaut)
|
||||
* @return string
|
||||
*/
|
||||
function initstr($chaine, $taille, $caractere_pour_combler=' ', $align=ALIGN_LEFT)
|
||||
{
|
||||
if (strlen($chaine) >= $taille) {
|
||||
return substr($chaine, 0, $taille);
|
||||
}
|
||||
|
||||
/**Initialisation d'une chaîne de caractère
|
||||
*
|
||||
* @param string $chaine Chaîne de caractère initiale
|
||||
* @param int $taille Taille de la chaîne de caractère à initialiser
|
||||
* @param string $caractere_pour_combler Caractère à utiliser pour combler la chaîne de caractère (espace par défaut)
|
||||
* @param string $align Aligner la chaîne de caractère à droite (right) ou à gauche (left, par défaut)
|
||||
* @return string
|
||||
*/
|
||||
function initstr($chaine, $taille, $caractere_pour_combler=' ', $align=ALIGN_LEFT) {
|
||||
if ($align==ALIGN_RIGHT) {
|
||||
$str2='';
|
||||
for ($i=0;$i<($taille-strlen($chaine));$i++)
|
||||
$str2.=$caractere_pour_combler;
|
||||
$str=$str2.$chaine;
|
||||
} else {
|
||||
if (strlen($chaine)>=$taille)
|
||||
return substr($chaine,0,$taille);
|
||||
$str=$chaine;
|
||||
for ($i=strlen($chaine);$i<$taille;$i++)
|
||||
$str = $str . $caractere_pour_combler;
|
||||
}
|
||||
return $str;
|
||||
if ($align == ALIGN_RIGHT) {
|
||||
return str_pad($chaine ,$taille, $caractere_pour_combler, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
|
||||
if ($align == ALIGN_LEFT) {
|
||||
return str_pad($chaine, $taille, $caractere_pour_combler, STR_PAD_RIGHT);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajout d'anti-slashs s'il y a lieu en vu d'une insertion en BDD
|
||||
*
|
||||
* @param string $str Chaine de caractère
|
||||
* @return unknown
|
||||
*/
|
||||
|
||||
|
||||
function checkaddslashes($str){
|
||||
return addslashes(preg_replace('/\\[^nrt\']/i', '\\', $str));
|
||||
}
|
||||
|
||||
|
||||
function checkaddslashes2($str){
|
||||
if(strpos(str_replace("\'",''," $str"),"'")!=false)
|
||||
return addslashes($str);
|
||||
@ -56,7 +60,7 @@ define ('ALIGN_RIGHT', 1);
|
||||
$strWithAccent = trim($strWithAccent , "-");
|
||||
return $strWithAccent;
|
||||
}
|
||||
|
||||
|
||||
//function SRSaufVoyelle ($strIn, $mot1, $mot2) {
|
||||
function str_replace_except_voy($mot1, $mot2, $strIn, $rule=0) {
|
||||
$Voyelle=array('a','e','i','o','u','y', '1', '2', '3', '4');
|
||||
@ -64,18 +68,18 @@ define ('ALIGN_RIGHT', 1);
|
||||
if (strpos($mot2,$mot1)===false)
|
||||
{
|
||||
//foreach ($Voyelle as $k => $voy)
|
||||
$posMot1=strpos($strIn, $mot1);
|
||||
$posMot1=strpos($strIn, $mot1);
|
||||
while ($posMot1!==false) {
|
||||
$lettreAV=$strIn[$posMot1-1];
|
||||
$lettreAP=$strIn[$posMot1+strlen($mot1)];
|
||||
//echo "Lettre AV=$lettreAV<br/>";
|
||||
//echo "Lettre AP=$lettreAP<br/>";
|
||||
if ( ( $rule==0 && !in_array($lettreAV, $Voyelle) ) ||
|
||||
if ( ( $rule==0 && !in_array($lettreAV, $Voyelle) ) ||
|
||||
( $rule==1 && !in_array($lettreAP, $Voyelle) ) ||
|
||||
( $rule==2 && !in_array($lettreAV, $Voyelle) && !in_array($lettreAP, $Voyelle) ))
|
||||
$strIn=substr($strIn,0,$posMot1) . $mot2 . substr($strIn,$posMot1+strlen($mot1),strlen($strIn));
|
||||
//echo "Le Mot devient : $strIn<br/>";
|
||||
$posMot1=strpos($strIn, $mot1, $posMot1+strlen($mot1));
|
||||
$posMot1=strpos($strIn, $mot1, $posMot1+strlen($mot1));
|
||||
}
|
||||
return $strIn;
|
||||
}
|
||||
@ -93,7 +97,7 @@ define ('ALIGN_RIGHT', 1);
|
||||
$tabSonAIO=array('aino', 'eino', 'aimo', 'eimo');
|
||||
$tabSonAIU=array('ainu', 'einu', 'aimu', 'eimu');
|
||||
$tabCarPhon=array('1', '2', '3', '4', '5', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'n', 'o', 'r', 's', 't', 'u', 'w', 'x', 'y', 'z');
|
||||
|
||||
|
||||
/** On traite tout en minuscule **/
|
||||
$strIn=strtolower($strIn);
|
||||
/** On remplace les 'Y' par des 'I' **/
|
||||
@ -136,7 +140,7 @@ define ('ALIGN_RIGHT', 1);
|
||||
$strIn=str_replace_except_voy('em', '1', $strIn, BEFORE);
|
||||
$strIn=str_replace_except_voy('in', '4', $strIn, BEFORE);
|
||||
/** Remplacement du son 'SCH' **/
|
||||
$strIn=str_replace('sch', '5', $strIn);
|
||||
$strIn=str_replace('sch', '5', $strIn);
|
||||
/** Remplacement du 'S' sauf si voyelle ou son (1 à 4) avant ou après **/
|
||||
$strIn=str_replace_except_voy('in', '4', $strIn, BOTH);
|
||||
/** Remplacement de groupe de 2 lettres diverses **/
|
||||
@ -208,15 +212,15 @@ define ('ALIGN_RIGHT', 1);
|
||||
}
|
||||
}
|
||||
print_r($tabCarPhon);
|
||||
|
||||
|
||||
/** Couversion en flottant **/
|
||||
$result=0.0;
|
||||
for ($j=10; $j>0; $j--)
|
||||
$result+=$sout[$j]*pow($j-1,10);
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CLASS soundex2
|
||||
* soundex2 French version
|
||||
@ -267,8 +271,8 @@ class csoundex2 {
|
||||
'KN' => 'NN',
|
||||
'PF' => 'FF',
|
||||
'PH' => 'FF',
|
||||
'SCH' => 'SSS'
|
||||
);
|
||||
'SCH' => 'SSS'
|
||||
);
|
||||
|
||||
/**
|
||||
* endings replacement array
|
||||
@ -278,7 +282,7 @@ class csoundex2 {
|
||||
'T',
|
||||
'D',
|
||||
'S'
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* public function build
|
||||
@ -411,7 +415,7 @@ class csoundex2 {
|
||||
|
||||
function soundex2($str) {
|
||||
$soundex2 = new csoundex2();
|
||||
|
||||
|
||||
$soundex2 -> build ($str);
|
||||
return $soundex2 -> sString;
|
||||
}
|
||||
|
@ -135,8 +135,6 @@
|
||||
$str = utf8_decode($str);
|
||||
$str = strtr($str,$tabReplace);
|
||||
return utf8_encode($str);
|
||||
//require_once 'i18n/cleanchar.php';
|
||||
//return fixEncoding($str);
|
||||
}
|
||||
|
||||
|
||||
|
@ -284,6 +284,7 @@ Zend_Registry::set('config', $config);
|
||||
try {
|
||||
$db = Zend_Db::factory($config->resources->db);
|
||||
$dbJo = Zend_Db::factory($config->profil->db->jo);
|
||||
Zend_Db_Table::setDefaultAdapter($dbJo);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
@ -1444,8 +1445,10 @@ function privilegeData($siren, $nic, $values = false)
|
||||
$iDb = new WDB('sdv1');
|
||||
$sql = "SELECT count(*) AS nbPriv FROM ge_cs2 WHERE cs = 'P' AND dateFin >= NOW() AND dateSuppr=0 AND siren='$siren';";
|
||||
$ret = $iDb->query($sql);
|
||||
if ($ret['nbPriv']>0) {
|
||||
$return = 'Oui';
|
||||
if (count($ret) > 0) {
|
||||
if ($ret[0]['nbPriv']>0) {
|
||||
$return = 'Oui';
|
||||
}
|
||||
}
|
||||
}
|
||||
$tabData['privilege'] = $return;
|
||||
|
Loading…
Reference in New Issue
Block a user