Libraries Update

This commit is contained in:
Michael RICOIS 2015-07-10 08:42:07 +00:00
parent f447dcaadc
commit 33dc9f0d74
9 changed files with 344 additions and 294 deletions

View File

@ -740,4 +740,8 @@ return array(
'000Z' => "00Z", '000Z' => "00Z",
'526D' => "526D", '526D' => "526D",
'8121' => "8121", '8121' => "8121",
'7904' => "7904",
'745A' => "745A",
'702A' => "702A",
'702C' => "702C",
); );

View File

@ -1484,4 +1484,8 @@ return array(
'000Z' => "", '000Z' => "",
'526D' => "", '526D' => "",
'8121' => "", '8121' => "",
'7904' => "",
'745A' => "",
'702A' => "",
'702C' => "",
); );

View File

@ -4226,6 +4226,9 @@ class MInsee
$where.=" AND e.ROLE IN('".implode("','",$tabCodRol)."') "; $where.=" AND e.ROLE IN('".implode("','",$tabCodRol)."') ";
} }
} }
else {
return false;
}
} }
// --- Type annonce // --- Type annonce
@ -4255,6 +4258,9 @@ class MInsee
$where.= implode(' OR ',$tabTmp); $where.= implode(' OR ',$tabTmp);
$where.= ')'; $where.= ')';
} }
else {
return false;
}
} }
return $where; return $where;
@ -4286,7 +4292,7 @@ class MInsee
foreach ($tabEven as $even) { foreach ($tabEven as $even) {
if ( intval($even)!=0 ) { if ( intval($even)!=0 ) {
if ( ($this->dureePlan==0 || $this->dureePlan==120) && in_array($even, $evenDetect) ) { if ( ($this->dureePlan==0 || $this->dureePlan==120) && in_array($even, $evenDetect) ) {
file_put_contents('plan.log', "MATCH DUREE PLAN : ", FILE_APPEND); //file_put_contents('plan.log', "MATCH DUREE PLAN : ", FILE_APPEND);
// --- Lecture dureePlan dans annonce // --- Lecture dureePlan dans annonce
$this->debutPlan = str_replace('-','',$annonce['dateJugement']); // SSAAMMJJ $this->debutPlan = str_replace('-','',$annonce['dateJugement']); // SSAAMMJJ
if ( preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uisu', $annonce['annonce'], $matches) ) { if ( preg_match('/dur.e(?:.*)plan(?:.*)(\d+)\s+ans?/Uisu', $annonce['annonce'], $matches) ) {
@ -4690,7 +4696,7 @@ class MInsee
if ($idAnnonce != 0) { if ($idAnnonce != 0) {
// --- Annonce // --- Annonce
if (substr($idAnnonce,0,2) == '0.') { if (substr($idAnnonce,0,2) == '0.') {
$idAnnonce == substr($idAnnonce,2); $idAnnonce = substr($idAnnonce,2);
$sqlAnnonceWhere = "a.id=$idAnnonce"; $sqlAnnonceWhere = "a.id=$idAnnonce";
$sqlAnnonceWhere.= " AND a.tribunal=t.triCode AND a.dateSuppr=0"; $sqlAnnonceWhere.= " AND a.tribunal=t.triCode AND a.dateSuppr=0";
$sqlAnnonceWhere.= " GROUP BY a.siren, a.dateJugement, a.typeEven ORDER BY a.dateJugement DESC"; $sqlAnnonceWhere.= " GROUP BY a.siren, a.dateJugement, a.typeEven ORDER BY a.dateJugement DESC";
@ -4725,16 +4731,21 @@ class MInsee
$sqlBodacc = $this->getAnnoncesLegalesBodacc()." WHERE ".$sqlBodaccWhere; $sqlBodacc = $this->getAnnoncesLegalesBodacc()." WHERE ".$sqlBodaccWhere;
// --- Where Histo // --- Where Histo
$sqlHistoRubrique = $this->getAnnoncesLegalesRubrique('histo', $rubrique);
if ($sqlHistoRubrique !== false) {
$sqlHistoWhere = "e.E1GSIR=$siren"; $sqlHistoWhere = "e.E1GSIR=$siren";
$sqlHistoWhere.= $this->getAnnoncesLegalesRubrique('histo', $rubrique); $sqlHistoWhere.= $sqlHistoRubrique;
$sqlHistoWhere.= " AND e.ANBASE=x.annonceNum AND e.DATE BETWEEN 19890101 AND 20041231"; $sqlHistoWhere.= " AND e.ANBASE=x.annonceNum AND e.DATE BETWEEN 19890101 AND 20041231";
/*$sqlHistoWhere.= " AND e.E1GSIR=e.SIREN";*/ /*$sqlHistoWhere.= " AND e.E1GSIR=e.SIREN";*/
$sqlHistoWhere.= " GROUP BY e.ANBASE ORDER BY e.DATE DESC"; $sqlHistoWhere.= " GROUP BY e.ANBASE ORDER BY e.DATE DESC";
$sqlHisto = $this->getAnnoncesLegalesHisto()." WHERE ".$sqlHistoWhere; $sqlHisto = $this->getAnnoncesLegalesHisto()." WHERE ".$sqlHistoWhere;
}
// --- Where Annonce // --- Where Annonce
$sqlAnnonceRubrique = $this->getAnnoncesLegalesRubrique('annonce', $rubrique);
if ($sqlAnnonceRubrique !== false) {
$sqlAnnonceWhere = "a.siren=$siren"; $sqlAnnonceWhere = "a.siren=$siren";
$sqlAnnonceWhere.= $this->getAnnoncesLegalesRubrique('annonce', $rubrique); $sqlAnnonceWhere.= $sqlAnnonceRubrique;
$sqlAnnonceWhere.= " AND a.tribunal=t.triCode AND a.dateSuppr=0"; $sqlAnnonceWhere.= " AND a.tribunal=t.triCode AND a.dateSuppr=0";
if ($visualisation === true) { if ($visualisation === true) {
// --- Ne pas afficher les annonces si la procédure à plus de 4 mois // --- Ne pas afficher les annonces si la procédure à plus de 4 mois
@ -4742,9 +4753,17 @@ class MInsee
} }
$sqlAnnonceWhere.= " GROUP BY a.siren, a.dateJugement, a.typeEven ORDER BY a.dateJugement DESC"; $sqlAnnonceWhere.= " GROUP BY a.siren, a.dateJugement, a.typeEven ORDER BY a.dateJugement DESC";
$sqlAnnonce = $this->getAnnoncesLegalesAnnonce()." WHERE ".$sqlAnnonceWhere; $sqlAnnonce = $this->getAnnoncesLegalesAnnonce()." WHERE ".$sqlAnnonceWhere;
}
// --- SQL Union // --- SQL Union
$sql = "SELECT * FROM ( (".$sqlBodacc.") UNION ALL (".$sqlHisto.") UNION ALL (".$sqlAnnonce.") ) results ORDER BY unionDate DESC"; $sql = "SELECT * FROM ( (".$sqlBodacc.") ";
if (!empty($sqlHisto)) {
$sql.= "UNION ALL (".$sqlHisto.") ";
}
if (!empty($sqlAnnonce)) {
$sql.= "UNION ALL (".$sqlAnnonce.") ";
}
$sql.= ") results ORDER BY unionDate DESC";
} }
$annonceResult = $this->iDb->query($sql); $annonceResult = $this->iDb->query($sql);
@ -5329,16 +5348,21 @@ class MInsee
$mBalo = new MBalo(); $mBalo = new MBalo();
$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); $bodacc = $this->iDb->select('jo.balo',
// $RP=mysql_select('balo', " ", "Societe_Rcs='$rcs' "); "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);
$k=0; $k=0;
if (count($bodacc) > 0) { if (count($bodacc) > 0) {
foreach ($bodacc as $k => $ann) { foreach ($bodacc as $k => $ann) {
$tabRetEven = array(); $tabRetEven = array();
$tabRetEven[]=array('CodeEven'=>$mBalo->getLibEven($ann['Categorie']), $tabRetEven[] = array(
'LibEven'=> $ann['Categorie']); 'CodeEven' => $mBalo->getLibEven($ann['Categorie']),
'LibEven' => $ann['Categorie']
);
$tabRet[$k]=array( 'id'=>$ann['Num_Affaire'].'.'.$ann['Num_Parution'], $tabRet[$k]=array(
'id'=>$ann['Num_Affaire'].'.'.$ann['Num_Parution'],
'BodaccCode'=>'BALO', 'BodaccCode'=>'BALO',
'BodaccNum'=>$ann['Num_Parution'], 'BodaccNum'=>$ann['Num_Parution'],
'NumAnnonce'=>$ann['Num_Affaire'], 'NumAnnonce'=>$ann['Num_Affaire'],
@ -5352,8 +5376,12 @@ class MInsee
'evenements'=>$tabRetEven, 'evenements'=>$tabRetEven,
'Lien_Annonce_Pdf'=>basename($ann['Url_Annonce_Pdf']), 'Lien_Annonce_Pdf'=>basename($ann['Url_Annonce_Pdf']),
); );
if ($idAnnonce<>0) $tabRet[$k]['texteAnnonce']=strtr( preg_replace('/<html.*<body.*>/Uis', '', if ($idAnnonce<>0)
preg_replace('/( class=".*")/ie', ' ', $ann['Annonce_Html'])), array('&nbsp;'=>' ', '</html>'=>'', '</body>'=>'')); $tabRet[$k]['texteAnnonce'] = strtr(
preg_replace('/<html.*<body.*>/Uis', '',
preg_replace('/( class=".*")/ie', ' ', $ann['Annonce_Html'])),
array('&nbsp;'=>' ', '</html>'=>'', '</body>'=>'')
);
} }
} }
return $tabRet; return $tabRet;
@ -5364,9 +5392,10 @@ class MInsee
* @param string $siren * @param string $siren
* @return int * @return int
*/ */
function getAnnoncesBaloCount($siren) public function getAnnoncesBaloCount($siren)
{ {
$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); $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; $nb = 0;
if (count($bodacc)>0) { if (count($bodacc)>0) {
$nb = $bodacc[0]['nb']; $nb = $bodacc[0]['nb'];
@ -5383,13 +5412,9 @@ class MInsee
* @param int $lignes * @param int $lignes
* @return Ambigous <string, multitype:multitype:string unknown multitype:multitype:string multitype:string NULL multitype:string unknown Ambigous <string, unknown> multitype:multitype:string Ambigous <number, unknown> , unknown> * @return Ambigous <string, multitype:multitype:string unknown multitype:multitype:string multitype:string NULL multitype:string unknown Ambigous <string, unknown> multitype:multitype:string Ambigous <number, unknown> , unknown>
*/ */
function getAnnoncesBoamp($siren, $idAnnonce='', $type=array('A', 'M'), $offset=0, $lignes=100) public function getAnnoncesBoamp($siren, $idAnnonce='', $type=array('A', 'M'), $offset=0, $lignes=100)
{ {
$siren=$siren*1; $siren = intval($siren);
if ($siren<001000000) $siren='000'.$siren;
elseif ($siren<010000000) $siren='00'.$siren;
elseif ($siren<100000000) $siren='0'.$siren;
$strIdAnn = ''; $strIdAnn = '';
$idA = 0; $idA = 0;
@ -5397,57 +5422,58 @@ class MInsee
$mBoamp = new MBoamp(); $mBoamp = new MBoamp();
// --- Recherche dans les avis d'attribution
if ( is_string($type) && $type=='A' || is_array($type) && in_array('A',$type) ) { if ( is_string($type) && $type=='A' || is_array($type) && in_array('A',$type) ) {
/** Recherche dans les avis d'attribution **/ if ($idAnnonce != '') {
if ($idAnnonce<>'') {
$tmp = explode('.', $idAnnonce); $tmp = explode('.', $idAnnonce);
$idA = $tmp[1]; $idA = $tmp[1];
//if (strlen($tmp[0])==9 && is_numeric($tmp[0])) $rcs=$tmp[0];
if ($tmp[0]=='A') $strIdAnn=" AND l.id='$idA' "; if ($tmp[0]=='A') $strIdAnn=" AND l.id='$idA' ";
elseif ($tmp[0]=='O') $strIdAnn=""; elseif ($tmp[0]=='O') $strIdAnn="";
} }
$bodacc = $this->iDb->select( $bodacc = $this->iDb->select('jo.boamp_lots l, jo.boamp b, jo.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.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 "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);
);
$k = 0; $k = 0;
if (count($bodacc)>0) { if (count($bodacc)>0) {
foreach ($bodacc as $k => $ann) { foreach ($bodacc as $k => $ann) {
$tabRetEven=array(); $tabRetEven=array();
/*montantTxt, l.montant, l.montantAnMin, , l.trancheCond, l.trancheFerme, l.dateAttrib*/
if ($ann['nom']<>'') $strMontant=' "'.strtoupper($ann['raisonSociale']).'"'; if ($ann['nom']<>'') $strMontant=' "'.strtoupper($ann['raisonSociale']).'"';
if ($ann['montant']*1>0) $strMontant.=' ('.number_format($ann['montant'], 2, ',', ' ').' EUR)'; if ($ann['montant']*1>0) $strMontant.=' ('.number_format($ann['montant'], 2, ',', ' ').' EUR)';
elseif ($ann['montantTxt']<>'') $strMontant.=' ('.$ann['montantTxt'].')'; elseif ($ann['montantTxt']<>'') $strMontant.=' ('.$ann['montantTxt'].')';
elseif ($ann['montantAnMin']<>'' && $ann['montantAnMax']) elseif ($ann['montantAnMin']<>'' && $ann['montantAnMax'])
$strMontant.=' ('.$ann['montantAnMin'].' à '. $strMontant.=' ('.$ann['montantAnMin'].' à '.$ann['montantAnMax'].')';
$ann['montantAnMax'].')';
elseif ($ann['trancheCond']<>'' && $ann['trancheFerme']) elseif ($ann['trancheCond']<>'' && $ann['trancheFerme'])
$strMontant.=' ('.$ann['trancheCond'].' / '. $strMontant.=' ('.$ann['trancheCond'].' / '.$ann['trancheFerme'].')';
$ann['trancheFerme'].')';
else $strMontant.=''; else $strMontant.='';
$tabRetEven[]=array('CodeEven'=>$mBoamp->getCodEvenSd($ann['Boamp_Rubrique']),
'LibEven'=>$mBoamp->getLibEvenBoamp($ann['Boamp_Rubrique'], $ann['Boamp_Rubrique_Lib']).$strMontant); $tabRetEven[] = array(
'CodeEven' => $mBoamp->getCodEvenSd($ann['Boamp_Rubrique']),
'LibEven' => $mBoamp->getLibEvenBoamp($ann['Boamp_Rubrique'],$ann['Boamp_Rubrique_Lib']).$strMontant
);
// Axxx pour lot attribué ou Oxxx pour Organisation // Axxx pour lot attribué ou Oxxx pour Organisation
if ($ann['Num_AnnoncePre']<>0) $numAnn=$ann['Num_AnnoncePre'].'-'.$ann['Num_Annonce']; if ($ann['Num_AnnoncePre']<>0) $numAnn=$ann['Num_AnnoncePre'].'-'.$ann['Num_Annonce'];
else $numAnn=$ann['Num_Annonce']; else $numAnn=$ann['Num_Annonce'];
if ($ann['Boamp_Code']=='MAPA') if ($ann['Boamp_Code']=='MAPA') {
$lienMapa='http://www.boamp.fr/index.php?action=avis&num_parution=MAPA&num_annonce='.$ann['Num_AnnoncePre'].'-'.$ann['Num_Annonce'].'&total=500&_s=0&indice=0';//&affichage_avis=officiel'; $lienMapa = 'http://www.boamp.fr/index.php?action=avis&num_parution=MAPA&num_annonce='.
else { $ann['Num_AnnoncePre'].'-'.$ann['Num_Annonce'].'&total=500&_s=0&indice=0';
} else {
$lettre = substr($ann['Boamp_Code'],-1); $lettre = substr($ann['Boamp_Code'],-1);
$annee = $ann['Boamp_Annee_Parution']; $annee = $ann['Boamp_Annee_Parution'];
$num = sprintf("%04d",$ann['Boamp_Num']); $num = sprintf("%04d",$ann['Boamp_Num']);
$numPar = $lettre.$annee.$num; $numPar = $lettre.$annee.$num;
$lienMapa='http://www.boamp.fr/index.php?action=avis&num_parution='.$numPar.'&num_annonce='.$ann['Num_Annonce'].'&total=500&_s=0&indice=0'; $lienMapa = 'http://www.boamp.fr/index.php?action=avis&num_parution='.
$numPar.'&num_annonce='.$ann['Num_Annonce'].'&total=500&_s=0&indice=0';
} }
$infosComp=''; $infosComp='';
$objetMarche=trim($ann['objet'].' '.$ann['objetAutre'].' '.$ann['autres']); $objetMarche=trim($ann['objet'].' '.$ann['objetAutre'].' '.$ann['autres']);
//titre, titreMarche, typeObjetMarche //titre, titreMarche, typeObjetMarche
$tabRet[$k]=array( 'id'=>'A.'.$ann['id'], $tabRet[$k] = array(
'id'=>'A.'.$ann['id'],
'BodaccCode'=>$ann['Boamp_Code'], 'BodaccCode'=>$ann['Boamp_Code'],
'BodaccNum'=>$ann['Boamp_Num'], 'BodaccNum'=>$ann['Boamp_Num'],
'NumAnnonce'=>$numAnn, 'NumAnnonce'=>$numAnn,
@ -5466,12 +5492,12 @@ class MInsee
'Lien_Annonce_Html'=>$lienMapa, // Non géré 'Lien_Annonce_Html'=>$lienMapa, // Non géré
); );
if ($idA<>0) if ($idA<>0) {
if ($ann['Boamp_Code']=='MAPA') if ($ann['Boamp_Code']=='MAPA') {
$tabRet[$k]['texteAnnonce'] = $ann['annonce']; $tabRet[$k]['texteAnnonce'] = $ann['annonce'];
else } else {
$tabRet[$k]['texteAnnonce']= $tabRet[$k]['texteAnnonce'] = strtr(
strtr( preg_replace('/<html.*<body.*>/Uis', '', preg_replace('/<html.*<body.*>/Uis', '',
preg_replace('/<p\s+.*>/Uis', '', preg_replace('/<p\s+.*>/Uis', '',
preg_replace('/( class=".*")/ie', ' ', $ann['annonce']))), preg_replace('/( class=".*")/ie', ' ', $ann['annonce']))),
array('&nbsp;'=>' ', '</html>'=>'', '</body>'=>'', '</p>'=>'<br/>') array('&nbsp;'=>' ', '</html>'=>'', '</body>'=>'', '</p>'=>'<br/>')
@ -5479,23 +5505,22 @@ class MInsee
} }
} }
} }
}
}
// --- Recherche dans les avis de marchés
if ( is_string($type) && $type=='M' || is_array($type) && in_array('M',$type) ) { if ( is_string($type) && $type=='M' || is_array($type) && in_array('M',$type) ) {
// Recherche dans les avis de marchés
if ($idAnnonce<>'') { if ($idAnnonce<>'') {
$tmp = explode('.', $idAnnonce); $tmp = explode('.', $idAnnonce);
$idA = $tmp[1]; $idA = $tmp[1];
//if (strlen($tmp[0])==9 && is_numeric($tmp[0])) $rcs=$tmp[0];
if ($tmp[0]=='A') $strIdAnn=" AND d.id='$idA' "; if ($tmp[0]=='A') $strIdAnn=" AND d.id='$idA' ";
elseif ($tmp[0]=='O') $strIdAnn=""; elseif ($tmp[0]=='O') $strIdAnn="";
} }
$bodacc=$this->iDb->select( $bodacc = $this->iDb->select('jo.boamp b, jo.boamp_detail d',
'boamp b, boamp_detail d',
"d.id, d.Boamp_Code, d.Boamp_Rubrique, b.Boamp_Rubrique_Lib, b.typeAnnonce, d.Boamp_Date_Parution, b.Boamp_Num, b.Boamp_Annee_Parution, b.Num_AnnoncePre, b.Num_Annonce, b.Boamp_Dept, b.annonce, titre AS description, d.raisonSociale, d.estimValeur AS montantTxt, d.estimValeurMin AS montantAnMin, d.estimValeurMax AS montantAnMax, objet, cpv_obj, cpv_comp, d.dateInsert", "d.id, d.Boamp_Code, d.Boamp_Rubrique, b.Boamp_Rubrique_Lib, b.typeAnnonce, d.Boamp_Date_Parution, b.Boamp_Num, b.Boamp_Annee_Parution, b.Num_AnnoncePre, b.Num_Annonce, b.Boamp_Dept, b.annonce, titre AS description, d.raisonSociale, d.estimValeur AS montantTxt, d.estimValeurMin AS montantAnMin, d.estimValeurMax AS montantAnMax, objet, cpv_obj, cpv_comp, d.dateInsert",
"d.siren='$siren' AND d.id=b.id $strIdAnn GROUP BY b.id ORDER BY d.Boamp_Date_Parution DESC", "d.siren=$siren AND d.id=b.id $strIdAnn GROUP BY b.id ORDER BY d.Boamp_Date_Parution DESC", false, MYSQL_ASSOC);
false, MYSQL_ASSOC
);
if (count($bodacc)>0) { if (count($bodacc)>0) {
foreach ($bodacc as $k => $ann) { foreach ($bodacc as $k => $ann) {
@ -5519,24 +5544,25 @@ class MInsee
$rub=='96' || // Annulation - Rectificatif - Sans suite - Infructueux $rub=='96' || // Annulation - Rectificatif - Sans suite - Infructueux
$rub=='977' // Annulation - Rectificatif / Avis en cas de transparence ex ante volontaire $rub=='977' // Annulation - Rectificatif / Avis en cas de transparence ex ante volontaire
) { ) {
$tabTmp=$this->iDb->select( 'boamp_lots l', $tabTmp = $this->iDb->select('jo.boamp_lots l',
"l.id, l.idAnn, l.Boamp_Code, l.Boamp_Rubrique, l.Boamp_Date_Parution, l.num, l.`desc` AS description, l.nom, l.montantTxt, l.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.id, l.idAnn, l.Boamp_Code, l.Boamp_Rubrique, l.Boamp_Date_Parution, l.num, l.desc AS description, l.nom, l.montantTxt, l.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.idAnn=$id", false, MYSQL_ASSOC); "l.idAnn=$id", false, MYSQL_ASSOC);
foreach ($tabTmp as $k2=>$ann2) { foreach ($tabTmp as $k2=>$ann2) {
if ($ann2['nom']<>'') $strMontant.=' "'.strtoupper($ann2['nom']).'"'; if ($ann2['nom']<>'') $strMontant.=' "'.strtoupper($ann2['nom']).'"';
if ($ann2['montant']*1>0) $strMontant.=' ('.number_format($ann2['montant'], 2, ',', ' ').' EUR)'; if ($ann2['montant']*1>0) $strMontant.=' ('.number_format($ann2['montant'], 2, ',', ' ').' EUR)';
elseif ($ann2['montantTxt']<>'') $strMontant.=' ('.$ann2['montantTxt'].')'; elseif ($ann2['montantTxt']<>'') $strMontant.=' ('.$ann2['montantTxt'].')';
elseif ($ann2['montantAnMin']<>'' && $ann2['montantAnMax']) elseif ($ann2['montantAnMin']<>'' && $ann2['montantAnMax'])
$strMontant.=' ('.$ann2['montantAnMin'].' à '. $strMontant.=' ('.$ann2['montantAnMin'].' à '.$ann2['montantAnMax'].')';
$ann2['montantAnMax'].')';
elseif ($ann2['trancheCond']<>'' && $ann2['trancheFerme']) elseif ($ann2['trancheCond']<>'' && $ann2['trancheFerme'])
$strMontant.=' ('.$ann['trancheCond'].' / '. $strMontant.=' ('.$ann['trancheCond'].' / '.$ann['trancheFerme'].')';
$ann['trancheFerme'].')';
else $strMontant.=''; else $strMontant.='';
} }
} }
$tabRetEven[]=array('CodeEven'=>$mBoamp->getCodEvenSd($ann['Boamp_Rubrique']), $tabRetEven[] = array(
'LibEven'=>$mBoamp->getLibEvenBoamp($ann['Boamp_Rubrique'], $ann['Boamp_Rubrique_Lib']).$strMontant); 'CodeEven' => $mBoamp->getCodEvenSd($ann['Boamp_Rubrique']),
'LibEven' => $mBoamp->getLibEvenBoamp($ann['Boamp_Rubrique'], $ann['Boamp_Rubrique_Lib']).$strMontant
);
// Axxx pour lot attribué ou Oxxx pour Organisation // Axxx pour lot attribué ou Oxxx pour Organisation
if ($ann['Num_AnnoncePre']<>0) $numAnn=$ann['Num_AnnoncePre'].'-'.$ann['Num_Annonce']; if ($ann['Num_AnnoncePre']<>0) $numAnn=$ann['Num_AnnoncePre'].'-'.$ann['Num_Annonce'];
else $numAnn=$ann['Num_Annonce']; else $numAnn=$ann['Num_Annonce'];
@ -5550,7 +5576,8 @@ class MInsee
$lienMapa='http://www.boamp.fr/index.php?action=avis&num_parution='.$numPar.'&num_annonce='.$ann['Num_Annonce'].'&total=500&_s=0&indice=0'; $lienMapa='http://www.boamp.fr/index.php?action=avis&num_parution='.$numPar.'&num_annonce='.$ann['Num_Annonce'].'&total=500&_s=0&indice=0';
} }
$infosComp=''; $infosComp='';
$tabRet[$k]=array( 'id'=>'O.'.$id, $tabRet[$k] = array(
'id'=>'O.'.$id,
'BodaccCode'=>$ann['Boamp_Code'], 'BodaccCode'=>$ann['Boamp_Code'],
'BodaccNum'=>$ann['Boamp_Num'], 'BodaccNum'=>$ann['Boamp_Num'],
'NumAnnonce'=>$numAnn, 'NumAnnonce'=>$numAnn,
@ -5566,12 +5593,12 @@ class MInsee
'Lien_Annonce_Html'=>$lienMapa, // Non géré 'Lien_Annonce_Html'=>$lienMapa, // Non géré
); );
if ($idA<>0) if ($idA<>0) {
if ($ann['Boamp_Code']=='MAPA') if ($ann['Boamp_Code']=='MAPA') {
$tabRet[$k]['texteAnnonce'] = $ann['annonce']; $tabRet[$k]['texteAnnonce'] = $ann['annonce'];
else } else {
$tabRet[$k]['texteAnnonce']= $tabRet[$k]['texteAnnonce'] = strtr(
strtr( preg_replace('/<html.*<body.*>/Uis', '', preg_replace('/<html.*<body.*>/Uis', '',
preg_replace('/<p\s+.*>/Uis', '', preg_replace('/<p\s+.*>/Uis', '',
preg_replace('/( class=".*")/ie', ' ', $ann['annonce']))), preg_replace('/( class=".*")/ie', ' ', $ann['annonce']))),
array('&nbsp;'=>' ', '</html>'=>'', '</body>'=>'', '</p>'=>'<br/>') array('&nbsp;'=>' ', '</html>'=>'', '</body>'=>'', '</p>'=>'<br/>')
@ -5579,6 +5606,8 @@ class MInsee
} }
} }
} }
}
}
debugLog('I', "getAnnoncesBoamp(siren=$siren, idAnnonce=$idAnnonce, $idA)", __LINE__, __FILE__, __FUNCTION__, __CLASS__); debugLog('I', "getAnnoncesBoamp(siren=$siren, idAnnonce=$idAnnonce, $idA)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
return $tabRet; return $tabRet;
} }
@ -5592,29 +5621,34 @@ class MInsee
{ {
$bodaccA = array(); $bodaccA = array();
$bodaccM = array(); $bodaccM = array();
// --- Recherche dans les avis d'attribution
if ( $type=='' || $type=='A' ) { if ( $type=='' || $type=='A' ) {
$bodaccA = $this->iDb->select('jo.boamp_lots l, jo.boamp b, jo.boamp_detail d', "l.id",
/** Recherche dans les avis d'attribution **/ "l.siren=$siren AND l.idAnn=b.id AND l.idAnn=d.id GROUP BY b.id ORDER BY l.Boamp_Date_Parution",
$bodaccA=$this->iDb->select( false, MYSQL_ASSOC);
'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
);
} }
// --- Recherche dans les avis de marchés
if ( $type=='' || $type=='M') { if ( $type=='' || $type=='M') {
/** Recherche dans les avis de marchés **/
$bodaccM = $this->iDb->select('jo.boamp b, jo.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", "d.siren=$siren AND d.id=b.id GROUP BY b.id ORDER BY d.Boamp_Date_Parution DESC",
false, MYSQL_ASSOC false, MYSQL_ASSOC);
);
} }
$nb = count($bodaccA) + count($bodaccM); $nb = count($bodaccA) + count($bodaccM);
return $nb; return $nb;
} }
function getAnnoncesAsso($siren, $idAnnonce=0, $offset=0, $lignes=100) /**
*
* @param unknown $siren
* @param number $idAnnonce
* @param number $offset
* @param number $lignes
*/
public function getAnnoncesAsso($siren, $idAnnonce=0, $offset=0, $lignes=100)
{ {
debugLog('I', "Début getAnnoncesAsso(siren=$siren, idAnnonce=$idAnnonce)", __LINE__, __FILE__, __FUNCTION__, __CLASS__); debugLog('I', "Début getAnnoncesAsso(siren=$siren, idAnnonce=$idAnnonce)", __LINE__, __FILE__, __FUNCTION__, __CLASS__);

View File

@ -301,7 +301,7 @@ class MBilans
/** /**
* Liste les bilans disponibles au format numérique (et non PDF image) pour une entreprise * Liste les bilans disponibles au format numérique (et non PDF image) pour une entreprise
* @param boolean $accesPartenaire * @param boolean $accesPartenaire
* Accès autorisé aux partenaires distant si le bilan est absenr * Accès autorisé aux partenaires distant si le bilan est absent
* @param number $nbMaxBilans * @param number $nbMaxBilans
* Nombre de bilans maximums retournés * Nombre de bilans maximums retournés
* @return array * @return array

View File

@ -1,8 +1,8 @@
<? <?php
require_once 'framework/common/curl.php'; require_once 'framework/common/curl.php';
class MBilans { class MBilans
{
private $body = ''; private $body = '';
private $header = ''; private $header = '';
private $codeRetour = 0; private $codeRetour = 0;

View File

@ -64,7 +64,7 @@ class Scores_Ws_Server
'91.121.157.194', //Extranet - ns359466 '91.121.157.194', //Extranet - ns359466
'78.31.45.206', //SDSL RAMBOUILLET '78.31.45.206', //SDSL RAMBOUILLET
'127.0.0.1', '127.0.0.1',
'192.168.33.1', '192.168.33.10',
); );
protected $listProxyIp = array( protected $listProxyIp = array(
@ -765,16 +765,19 @@ class Scores_Ws_Server
} elseif ($ip != '127.0.0.1') { } elseif ($ip != '127.0.0.1') {
// For customized version, check user is in the good service // --- For customized version, check user is in the good service
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php'; $clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
$wsClients = array(); $wsClients = array();
foreach( $clients as $section => $params ){ foreach( $clients as $section => $params ){
if ($params['actif']) { if ($params['actif']) {
$wsClients[$params['idClient']] = $section; if (count($params['idClient']) > 0) {
foreach ($params['idClient'] as $idClient) {
$wsClients[$idClient] = $section;
} }
} }
if ( array_key_exists($userInfos->idClient, $wsClients) }
&& ( $this->serviceClient === false }
if ( array_key_exists($userInfos->idClient, $wsClients) && ( $this->serviceClient === false
|| strtolower($this->serviceClientName) != $wsClients[$userInfos->idClient] ) ){ || strtolower($this->serviceClientName) != $wsClients[$userInfos->idClient] ) ){
return '0901'; return '0901';
} }
@ -797,9 +800,12 @@ class Scores_Ws_Server
* Get an array of IP and IP range * Get an array of IP and IP range
* 192.168.3.5-192.68.3.10;192.168.3.*;192.168.3.10 * 192.168.3.5-192.68.3.10;192.168.3.*;192.168.3.10
*/ */
if ( !empty($userInfos->filtre_ip) && !in_array($ip, $this->listApplicationIp) ) {
if ( !in_array($ip, $this->listApplicationIp) ) {
if ( !empty($userInfos->filtre_ip) ) {
$filtreIp = explode(';', trim($userInfos->filtre_ip, ';')); $filtreIp = explode(';', trim($userInfos->filtre_ip, ';'));
if ( count($filtreIp)>0 ) { if ( count($filtreIp)>0 ) {
// Extranet // Extranet
if ( substr($password,0,7)=='iponly:' ) { if ( substr($password,0,7)=='iponly:' ) {
$ipToValidate = substr($password,7); $ipToValidate = substr($password,7);
@ -808,6 +814,7 @@ class Scores_Ws_Server
else { else {
$ipToValidate = $ip; $ipToValidate = $ip;
} }
//Validation //Validation
$overallIpValidate = false; $overallIpValidate = false;
foreach ( $filtreIp as $filtre ) { foreach ( $filtreIp as $filtre ) {
@ -831,12 +838,14 @@ class Scores_Ws_Server
break; break;
} }
} }
// Exit with error // Exit with error
if ( $overallIpValidate === false ) { if ( $overallIpValidate === false ) {
return '0904'; return '0904';
} }
} }
} }
}
// Check password with database informations // Check password with database informations
if ( $userInfos->password == $password //password sent in clear if ( $userInfos->password == $password //password sent in clear

View File

@ -451,7 +451,6 @@ class SdMetier_Sfr_Scoring
} }
$classInsee = new MInsee(); $classInsee = new MInsee();
$classInsee->AnnoncesInMemory = true;
//Values are already define ? //Values are already define ?
if ( $this->ValDateCalculIndiscore === null ) { if ( $this->ValDateCalculIndiscore === null ) {
@ -614,8 +613,8 @@ class SdMetier_Sfr_Scoring
if ($this->debug) file_put_contents('sfr.log', "ValInseeAge = ".$this->ValInseeAge."\n", FILE_APPEND); if ($this->debug) file_put_contents('sfr.log', "ValInseeAge = ".$this->ValInseeAge."\n", FILE_APPEND);
//Vérification validité du score //Vérification validité du score
$dateUpdate = new Zend_Date(substr($this->ValDateUpdate,0,10), 'yyyy-MM-dd');
$dateNow = new Zend_Date(); $dateNow = new Zend_Date();
$dateUpdate = new Zend_Date(substr($this->ValDateUpdate,0,10), 'yyyy-MM-dd');
$diffUpdate = $dateNow->sub($dateUpdate); $diffUpdate = $dateNow->sub($dateUpdate);
$measureUpdate = new Zend_Measure_Time($diffUpdate->toValue(), Zend_Measure_Time::SECOND); $measureUpdate = new Zend_Measure_Time($diffUpdate->toValue(), Zend_Measure_Time::SECOND);
$measureUpdate->convertTo(Zend_Measure_Time::MONTH); $measureUpdate->convertTo(Zend_Measure_Time::MONTH);

View File

@ -121,8 +121,8 @@ class WDB
/** /**
* Database delete * Database delete
* @param unknown $table * @param string $table
* @param unknown $where * @param string $where
* @param string $debug * @param string $debug
* @param string $low_priority * @param string $low_priority
* @return resource * @return resource
@ -133,9 +133,9 @@ class WDB
$this->errorMsg = ''; $this->errorMsg = '';
if ($low_priority) if ($low_priority)
$query='DELETE LOW_PRIORITY QUICK FROM '.$table.' WHERE '.$where.' LIMIT 1;'; $query='DELETE LOW_PRIORITY QUICK FROM '.$table.' WHERE '.$where.';';
else else
$query='DELETE FROM '.$table.' WHERE '.$where.' LIMIT 1;'; $query='DELETE FROM '.$table.' WHERE '.$where.';';
if ($debug) $tdeb=microtime_float(); if ($debug) $tdeb=microtime_float();

View File

@ -121,8 +121,8 @@ class WDB
/** /**
* Database delete * Database delete
* @param unknown $table * @param string $table
* @param unknown $where * @param string $where
* @param string $debug * @param string $debug
* @param string $low_priority * @param string $low_priority
* @return resource * @return resource
@ -133,9 +133,9 @@ class WDB
$this->errorMsg = ''; $this->errorMsg = '';
if ($low_priority) if ($low_priority)
$query='DELETE LOW_PRIORITY QUICK FROM '.$table.' WHERE '.$where.' LIMIT 1;'; $query='DELETE LOW_PRIORITY QUICK FROM '.$table.' WHERE '.$where.';';
else else
$query='DELETE FROM '.$table.' WHERE '.$where.' LIMIT 1;'; $query='DELETE FROM '.$table.' WHERE '.$where.';';
if ($debug) $tdeb=microtime_float(); if ($debug) $tdeb=microtime_float();