update from merge develop de webservice

This commit is contained in:
benoitpotier 2017-03-31 15:12:30 +02:00
parent 3b6a8ec2f6
commit 0b5d5b4685
2 changed files with 22 additions and 11 deletions

View File

@ -117,17 +117,17 @@ class Metier_Liens_Base
->where('l.idPar = :id')->setParameter('id', $id)
->orderBy('l.PDetention', 'DESC');
// Actif / Inactif
if (null !== $actif) {
if (false === $actif) {
$qb->andWhere('l.actif = 0');
} else {
$qb->andWhere('l.actif = 1');
}
// Actif / Inactif
if (null !== $actif) {
if (false === $actif) {
$qb->andWhere('l.actif = 0');
} else {
$qb->andWhere('l.actif = 1');
}
}
// Don't display deleted - anomaly
$qb->andWhere("l.dateSuppr = '0000-00-00 00:00:00'");
// Don't display deleted - anomaly
$qb->andWhere("l.dateSuppr = '0000-00-00 00:00:00'");
$stmt = $qb->execute();
$liens = $stmt->fetchAll(\PDO::FETCH_OBJ);
} catch (\Doctrine\DBAL\DBALException $e) {

View File

@ -349,7 +349,7 @@ class Metier_Partenaires_MBilans
* Nombre de bilans maximums retournés
* @return array
*/
public function listeBilans($accesPartenaire = false, $nbMaxBilans = 0)
public function listeBilans($accesPartenaire = false, $nbMaxBilans = 0, $idClient = 0)
{
$dateDerDepot = 0;
$tabRet = $tabRet2 = $tabRet3 = $tabRet = array();
@ -358,12 +358,21 @@ class Metier_Partenaires_MBilans
if ($this->companyEvenDateStop !== null) {
$where.= " AND dateExercice<'".$this->companyEvenDateStop."'";
}
// --- Si c'est un client qui consulte, alors il ne peut voir que ses bilans confidentiels ou tous les bilans publiques.
// --- 0 : consultation de l'application (calcul du score ...)
// --- 1 : consultation d'un membre de scores et décisions
// --- 147 : consultation d'un opérateur de l'arménie
if ($idClient > 1 && $idClient != 147) {
$where.= " AND (confidentiel_client = ".$idClient." OR confidentiel = 0)";
}
$where.= " ORDER BY dateExercice DESC, CASE typeBilan WHEN 'N' THEN 1 WHEN 'S' THEN 2 ELSE 3 END";
if ($nbMaxBilans > 0) {
$where.= " LIMIT 0, $nbMaxBilans";
}
$fields = "typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine, dateInsert, partenaire";
$fields = "typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine, dateInsert, partenaire, confidentiel, confidentiel_client";
$listeNb = 0;
try {
$listeSql = "SELECT $fields FROM jo.bilans WHERE $where";
@ -391,6 +400,8 @@ class Metier_Partenaires_MBilans
'dureeExercicePre' => $bil['dureeExercicePre'],
'monnaie' => $bil['monnaieOrigine'],
'source' => $bil['partenaire'],
'confidentiel' => $bil['confidentiel'],
'confidentielClient' => $bil['confidentiel_client'],
);
$tabTri[''.$bil['dateExercice'].'-'.$bil['typeBilan']] = $bil['typeBilan'].$millesime;
}