Remove use of WDate static

This commit is contained in:
Michael RICOIS 2013-09-05 08:29:01 +00:00
parent 20395552e5
commit af451f02d6

View File

@ -178,7 +178,8 @@ class MBilans {
public $dernierExerciceDeposeLe=0; public $dernierExerciceDeposeLe=0;
// public $rncs; // public $rncs;
public $igreffe; public $igreffe;
private $tabBS2BN=array('AH'=>'010', private $tabBS2BN=array(
'AH'=>'010',
'AI'=>'012', 'AI'=>'012',
'AI1'=>'013', 'AI1'=>'013',
'AJ'=>'014', 'AJ'=>'014',
@ -291,32 +292,45 @@ class MBilans {
$this->igreffe=new MGreffes(); $this->igreffe=new MGreffes();
} }
function __destruct() {} /**
* Liste les bilans disponibles au format numérique (et non PDF image) pour une entreprise
* @param boolean $accesPartenaire
* Accès autorisé aux partenaires distant si le bilan est absenr
* @param number $nbMaxBilans
* Nombre de bilans maximums retournés
* @return array
*/
function listeBilans($accesPartenaire=false, $nbMaxBilans=0)
{
$classWDate = new WDate();
$dateDerDepot = 0;
$tabRet = $tabRet3 = array();
/** Liste les bilans disponibles au format numérique (et non PDF image) pour une entreprise
**
** @param $accesPartenaire bool Accès autorisé aux partenaires distant si le bilan est absenr
** @param $nbMaxBilans int Nombre de bilans maximums retournés
**/
function listeBilans($accesPartenaire=false, $nbMaxBilans=0) {
$iDb2=new WDB();
if ($nbMaxBilans>0) $limit="LIMIT 0, $nbMaxBilans"; if ($nbMaxBilans>0) $limit="LIMIT 0, $nbMaxBilans";
else $limit=''; else $limit='';
$iDb2=new WDB();
$ret=$iDb2->select( 'bilans', $ret=$iDb2->select( 'bilans',
'typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine, dateInsert, partenaire', 'typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine, dateInsert, partenaire',
"siren='$this->siren' ORDER BY dateExercice DESC $limit",false, MYSQL_ASSOC); "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)); //@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren en base", print_r($ret, true));
$tabRet=array();
$iDb=new WDB('jo'); $iDb = new WDB('jo');
$ret2=$iDb->select( 'bodacc_detail', $ret2=$iDb->select( 'bodacc_detail',
'Bodacc_Date_Parution, dateEffet, typeEven', 'Bodacc_Date_Parution, dateEffet, typeEven',
"siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC",false, MYSQL_ASSOC); "siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC",false, MYSQL_ASSOC);
$dateDerDepot=WDate::dateT('Y-m-d','Ymd',@$ret2[0]['dateEffet'])*1; if ( count($ret2)>0 ) {
$dateDerExercice=$ret[0]['dateExercice']*1; $dateDerDepot=$classWDate->dateT('Y-m-d','Ymd',$ret2[0]['dateEffet'])*1;
if ($dateDerDepot<>0) { if ($dateDerDepot<>0) {
$this->dernierExerciceDepose = WDate::dateT('Y-m-d','d/m/Y',@$ret2[0]['dateEffet']); $this->dernierExerciceDepose = $classWDate->dateT('Y-m-d','d/m/Y',$ret2[0]['dateEffet']);
$this->dernierExerciceDeposeLe = WDate::dateT('Y-m-d','d/m/Y',@$ret2[0]['Bodacc_Date_Parution']); $this->dernierExerciceDeposeLe = $classWDate->dateT('Y-m-d','d/m/Y',$ret2[0]['Bodacc_Date_Parution']);
} }
}
if ($accesPartenaire) if ($accesPartenaire)
$tabRet=$tabRet2=$this->igreffe->getListeBilans($this->siren); $tabRet=$tabRet2=$this->igreffe->getListeBilans($this->siren);
else else
@ -353,32 +367,37 @@ class MBilans {
} }
$tabTri=array(); $tabTri=array();
if ( count($tabRet)>0 ) {
foreach ($tabRet as $millesime=>$bil) { foreach ($tabRet as $millesime=>$bil) {
$typeBilan=substr($millesime,0,1); $typeBilan = substr($millesime,0,1);
$dateExercice=WDate::dateT('d/m/Y','Ymd',substr($millesime,1,10)); $dateExercice = $classWDate->dateT('d/m/Y','Ymd',substr($millesime,1,10));
$tabTri[''.$dateExercice.'-'.$typeBilan]=$millesime; $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)); }
//@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) { foreach ($ret as $i=>$bil) {
$millesime=WDate::dateT('Ymd','d/m/Y',$bil['dateExercice']); $millesime=$classWDate->dateT('Ymd','d/m/Y',$bil['dateExercice']);
$tabRet[''.$bil['typeBilan'].$millesime]=array( $tabRet[''.$bil['typeBilan'].$millesime] = array(
'dateProvPartenaire'=>$bil['dateProvPartenaire'], 'dateProvPartenaire' => $bil['dateProvPartenaire'],
'dateInsert' =>strtr($bil['dateInsert'], 'dateInsert' => strtr($bil['dateInsert'], array(' '=>'',':'=>'','-'=>'')),
array(' '=>'',':'=>'','-'=>'')), 'typeBilan' => $bil['typeBilan'], // NEW
'typeBilan' =>$bil['typeBilan'], // NEW 'dureeExercice' => $bil['dureeExercice'],// NEW
'dureeExercice' =>$bil['dureeExercice'],// NEW 'dateExercice' => $bil['dateExercice'],
'dateExercice' =>$bil['dateExercice'], 'millesime' => substr($bil['dateExercice'],0,4),
'millesime' =>substr($bil['dateExercice'],0,4), 'dateExercicePre' => $bil['dateExercicePre'],
'dateExercicePre' =>$bil['dateExercicePre'], 'dureeExercicePre' => $bil['dureeExercicePre'],
'dureeExercicePre' =>$bil['dureeExercicePre'], 'monnaie' => $bil['monnaieOrigine'],
'monnaie' =>$bil['monnaieOrigine'], 'source' => $bil['partenaire'],
'source' =>$bil['partenaire'],
); );
$tabTri[''.$bil['dateExercice'].'-'.$bil['typeBilan']]=$bil['typeBilan'].$millesime; $tabTri[''.$bil['dateExercice'].'-'.$bil['typeBilan']]=$bil['typeBilan'].$millesime;
} }
krsort($tabTri); krsort($tabTri);
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren avant le tri", print_r($tabTri, true)); //@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=''; $refPre='';
$strInfos=''; $strInfos='';
@ -411,6 +430,7 @@ class MBilans {
$tabRet3[''.$typeMillesime]=$tabRet[''.$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)); //@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "listeBilans sur $this->siren après le tri / retour", print_r($tabRet3, true));
}
return $tabRet3; return $tabRet3;
} }
@ -424,7 +444,9 @@ class MBilans {
**/ **/
function getBilan($millesime='', $typeBilan='N', $refPart=0, $accesPartenaire=false) function getBilan($millesime='', $typeBilan='N', $refPart=0, $accesPartenaire=false)
{ {
$millesimeDB=WDate::dateT('d/m/Y','Ymd',$millesime); $classWDate = new WDate();
$millesimeDB=$classWDate->dateT('d/m/Y','Ymd',$millesime);
$iDb2=new WDB(); $iDb2=new WDB();
if ($accesPartenaire) if ($accesPartenaire)
// On ne veut pas de bilans "Téléchargés" directement sur Internet // On ne veut pas de bilans "Téléchargés" directement sur Internet
@ -458,8 +480,8 @@ class MBilans {
$tabInsert=array( $tabInsert=array(
'siren' =>$this->siren, 'siren' =>$this->siren,
'dateProvPartenaire'=>$tabBilan['DATE_FRAICHE_BILAN'], 'dateProvPartenaire'=>$tabBilan['DATE_FRAICHE_BILAN'],
'dateExercice' =>WDate::dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE']), 'dateExercice' =>$classWDate->dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE']),
'dateExercicePre' =>WDate::dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE_PRE']), 'dateExercicePre' =>$classWDate->dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE_PRE']),
'dureeExercice' =>$tabBilan['DUREE_MOIS'], 'dureeExercice' =>$tabBilan['DUREE_MOIS'],
'dureeExercicePre' =>$tabBilan['DUREE_MOIS_PRE'], 'dureeExercicePre' =>$tabBilan['DUREE_MOIS_PRE'],
'monnaie' =>$tabBilan['MONNAIE'], 'monnaie' =>$tabBilan['MONNAIE'],