Merge branch 'bilanconfidentiel' into 'develop'

Bilanconfidentiel

See merge request !1
This commit is contained in:
potier 2017-03-29 08:22:55 +00:00
commit 66ecfde615
5 changed files with 664 additions and 641 deletions

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;
}

View File

@ -3335,7 +3335,7 @@ class Entreprise extends Scores_Ws_Server
if(!in_array($key, array('SIREN', 'DATE_FRAICHE_BILAN',
'DATE_CLOTURE', 'DATE_CLOTURE_PRE', 'DUREE_MOIS',
'DUREE_MOIS_PRE', 'MONNAIE', 'CONSOLIDE', 'MONNAIE_ORI',
'MONNAIE_LIV_UNITE', 'SOURCE', 'devise'))){
'MONNAIE_LIV_UNITE', 'SOURCE', 'devise', 'TOP_CONFIDENTIEL'))){
$resultPoste = new BilanPoste();
$resultPoste->id = $key;
$resultPoste->val = $value;

File diff suppressed because it is too large Load Diff

View File

@ -269,10 +269,10 @@ class Identite
*/
public $NbEtab;
/**
* Numéro isin
* @var string
*/
/**
* Numéro isin
* @var string
*/
public $Isin;
/**
@ -2366,6 +2366,11 @@ class ListeBilans
* @var int
*/
public $source;
/** Confidentialité du bilan (1 si confidentiel, 0 sinon)
* @var int
*/
public $confidentiel;
}
class SetSurveillanceReturn
@ -2550,6 +2555,11 @@ class Bilan
*/
public $SOURCE;
/** Bilan confidentiel ou non
* @var string
*/
public $TOP_CONFIDENTIEL;
/** Tableau de postes du bilan dans le formalisme associé au Type de bilan
* @var BilanPoste[]
*/

View File

@ -73,16 +73,16 @@ class Saisie extends Scores_Ws_Server
$tabScores = $tabInfos['score'];
//Valider le code Isin
if (strlen(trim($tabIdentite['isin']))) {
$iBourse = new Metier_Partenaires_MBourse();
if (!$iBourse->isIsin($tabIdentite['isin'])) {
$error->errnum = 1;
if (strlen(trim($tabIdentite['isin']))) {
$iBourse = new Metier_Partenaires_MBourse();
if (!$iBourse->isIsin($tabIdentite['isin'])) {
$error->errnum = 1;
$error->errmsg = 'Code Isin incorrect.';
$output = new SetInfosEntrepReturn();
$output->error = $error;
$output->result = $result;
return $output;
}
return $output;
}
}
// Mise à jour de l'identité
@ -1257,21 +1257,21 @@ class Saisie extends Scores_Ws_Server
break;
}
$iInsee = new Metier_Insee_MInsee();
$iInsee = new Metier_Insee_MInsee();
$entrep = $iInsee->getIdentiteLight($siren, $nic);
if ( empty($entrep['id']) || intval($entrep['id'])==0 ) {
$this->sendError('1020');
}
$data = array(
'siren' => $siren,
'nic' => $nic,
'dateProvPartenaire'=> date('Y').date('m').date('d'),
'typeTel' => $type,
'infoTel' => $info,
'telephone' => $value,
'actif' => 1,
'partenaire' => 175,
$data = array(
'siren' => $siren,
'nic' => $nic,
'dateProvPartenaire'=> date('Y').date('m').date('d'),
'typeTel' => $type,
'infoTel' => $info,
'telephone' => $value,
'actif' => 1,
'partenaire' => 175,
);
if ( $id === null ) {
@ -1393,9 +1393,9 @@ class Saisie extends Scores_Ws_Server
{
$this->authenticate();
// --- Control input value
if ( strlen($siren)!=9 ) {
$this->sendError('1010');
// --- Control input value
if ( strlen($siren)!=9 ) {
$this->sendError('1010');
}
$tabPostes = array();
@ -1407,8 +1407,8 @@ class Saisie extends Scores_Ws_Server
if (!preg_match('/[0-9]{8}/', $data->dateCloture)) {
throw new SoapFault('MSG', "Erreur Date de cloture");
}
if ($data->dateCloturePre != 'AAAAMMJJ' && !preg_match('/[0-9]{8}/', $data->dateCloturePre)) {
throw new SoapFault('MSG', "Erreur Date de cloture précédente");
if ($data->dateCloturePre != 'AAAAMMJJ' && !preg_match('/[0-9]{8}/', $data->dateCloturePre)) {
throw new SoapFault('MSG', "Erreur Date de cloture précédente");
}
if ($data->dateCloturePre == 'AAAAMMJJ') {
$data->dateCloturePre = 0;
@ -1450,21 +1450,21 @@ class Saisie extends Scores_Ws_Server
}
// --- Insertion dans la bdd
else {
try {
$bilansM = new Application_Model_JoBilans();
$sql = $bilansM->select()
->where('siren=?', $siren)
->where('dateExercice=?', $cloture)
->where('typeBilan=?', $type);
->where('typeBilan=?', $type);
$row = $bilansM->fetchRow($sql);
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient!=1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage());
}
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient!=1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage());
}
}
$postesDiff = array();
@ -1485,7 +1485,7 @@ class Saisie extends Scores_Ws_Server
'unite' => $data->unite,
'postes' => $data->postes,
'partenaire' => 1,
'confidentiel' => 0,
'confidentiel' => 0,
'dateInsert' => date('YmdHis'),
);
@ -1532,7 +1532,7 @@ class Saisie extends Scores_Ws_Server
'unite' => $data->unite,
'postes' => $data->postes,
'partenaire' => 1,
'confidentiel' => 0,
'confidentiel' => 0,
'dateInsert' => date('YmdHis'),
);
@ -1555,7 +1555,7 @@ class Saisie extends Scores_Ws_Server
// --- Save user
$userM = new Application_Model_JoBilansUser();
try {
try {
$userM->insert(array(
'idUtilisateur' => $this->User->id,
'login' => $this->User->login,
@ -1564,13 +1564,13 @@ class Saisie extends Scores_Ws_Server
'typeBilan' => $data->typeBilan,
'dateAction' => date('YmdHis'),
'postesDiff' => implode(';', $postesDiff),
));
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient!=1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage());
}
));
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient!=1) {
throw new SoapFault('ERR', "Application error");
} else {
throw new SoapFault('ERR', $e->getMessage());
}
}
return $id;
@ -1749,8 +1749,8 @@ class Saisie extends Scores_Ws_Server
if (strlen(trim($dataRef['isin']))) {
$iBourse = new Metier_Partenaires_MBourse();
if (!$iBourse->isIsin($dataRef['isin'])) {
throw new SoapFault('ERR', 'Code Isin incorrect.');
if (!$iBourse->isIsin($dataRef['isin'])) {
throw new SoapFault('ERR', 'Code Isin incorrect.');
}
}
@ -2345,20 +2345,20 @@ class Saisie extends Scores_Ws_Server
}
if ($result) return true;
}
//Move active participations if TUP and Fusion selected
elseif ($action=='tupfusion')
{
try {
$result = $lienM->update(array('idAct'=>$id, 'idUpdate'=>$this->User->id),
"idAct=$idLien AND actif=1 AND dateSuppr='0000-00-00 00:00:00'");
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
}
if ($result) return true;
//Move active participations if TUP and Fusion selected
elseif ($action=='tupfusion')
{
try {
$result = $lienM->update(array('idAct'=>$id, 'idUpdate'=>$this->User->id),
"idAct=$idLien AND actif=1 AND dateSuppr='0000-00-00 00:00:00'");
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
}
if ($result) return true;
}
return false;
@ -2593,7 +2593,7 @@ class Saisie extends Scores_Ws_Server
}
return $result;
case 'edit':
case 'edit':
$tabRet['idUpdate'] = $userId;
try {
$result = $dirOp->update($tabRet, $where);