Librairie Metier : Simple update
This commit is contained in:
parent
dcc67dc4f8
commit
74b7f5cf05
@ -280,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('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
|
||||
@ -292,38 +310,18 @@ class MBilans
|
||||
{
|
||||
$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',
|
||||
$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']);
|
||||
}
|
||||
}
|
||||
"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();
|
||||
}
|
||||
|
||||
$tabTri = array();
|
||||
@ -336,7 +334,6 @@ class MBilans
|
||||
}
|
||||
}
|
||||
|
||||
//@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']);
|
||||
@ -356,11 +353,8 @@ class MBilans
|
||||
}
|
||||
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;
|
||||
$refPre='';
|
||||
$strInfos='';
|
||||
foreach ($tabTri as $tmp => $typeMillesime) {
|
||||
$exercice = substr($tmp,0,8);
|
||||
$type = substr($tmp,9,1);
|
||||
@ -368,13 +362,11 @@ class MBilans
|
||||
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;
|
||||
@ -384,12 +376,10 @@ class MBilans
|
||||
}
|
||||
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)
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
return $tabRet3;
|
||||
@ -417,26 +407,23 @@ 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',
|
||||
'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)
|
||||
{
|
||||
|
||||
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)
|
||||
{
|
||||
@ -481,7 +468,10 @@ class MBilans
|
||||
$bilan = $ret[0];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
if (count($ret) > 0) {
|
||||
$bilan = $ret[0];
|
||||
}
|
||||
|
||||
|
@ -77,9 +77,9 @@ class WDB
|
||||
$values = str_replace("'NULL'", 'NULL', $values);
|
||||
|
||||
if ($low_priority)
|
||||
$query = 'INSERT DELAYED INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
|
||||
$query = 'INSERT DELAYED INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
|
||||
else
|
||||
$query = 'INSERT INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
|
||||
$query = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');';
|
||||
|
||||
if ($debug) $tdeb=microtime_float();
|
||||
|
||||
@ -117,12 +117,12 @@ class WDB
|
||||
$values = array_values($update);
|
||||
$i=0;
|
||||
if ($low_priority)
|
||||
$query='UPDATE LOW_PRIORITY `'.$table.'` SET ';
|
||||
$query='UPDATE LOW_PRIORITY '.$table.' SET ';
|
||||
else
|
||||
$query='UPDATE `'.$table.'` SET ';
|
||||
$query='UPDATE '.$table.' SET ';
|
||||
while(isset($fields[$i])){
|
||||
if($i>0) { $query.=', '; }
|
||||
$query.=' '.$fields[$i]."='".$this->db->quote($values[$i])."'";
|
||||
$query.=' '.$fields[$i]."=".$this->db->quote($values[$i]);
|
||||
$i++;
|
||||
}
|
||||
$query = str_replace("'NULL'", 'NULL', $query);
|
||||
|
Loading…
x
Reference in New Issue
Block a user