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 * Nombre de bilans maximums retournés
* @return array * @return array
*/ */
public function listeBilans($accesPartenaire = false, $nbMaxBilans = 0) public function listeBilans($accesPartenaire = false, $nbMaxBilans = 0, $idClient = 0)
{ {
$dateDerDepot = 0; $dateDerDepot = 0;
$tabRet = $tabRet2 = $tabRet3 = $tabRet = array(); $tabRet = $tabRet2 = $tabRet3 = $tabRet = array();
@ -358,12 +358,21 @@ class Metier_Partenaires_MBilans
if ($this->companyEvenDateStop !== null) { if ($this->companyEvenDateStop !== null) {
$where.= " AND dateExercice<'".$this->companyEvenDateStop."'"; $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"; $where.= " ORDER BY dateExercice DESC, CASE typeBilan WHEN 'N' THEN 1 WHEN 'S' THEN 2 ELSE 3 END";
if ($nbMaxBilans > 0) { if ($nbMaxBilans > 0) {
$where.= " LIMIT 0, $nbMaxBilans"; $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; $listeNb = 0;
try { try {
$listeSql = "SELECT $fields FROM jo.bilans WHERE $where"; $listeSql = "SELECT $fields FROM jo.bilans WHERE $where";
@ -391,6 +400,8 @@ class Metier_Partenaires_MBilans
'dureeExercicePre' => $bil['dureeExercicePre'], 'dureeExercicePre' => $bil['dureeExercicePre'],
'monnaie' => $bil['monnaieOrigine'], 'monnaie' => $bil['monnaieOrigine'],
'source' => $bil['partenaire'], 'source' => $bil['partenaire'],
'confidentiel' => $bil['confidentiel'],
'confidentielClient' => $bil['confidentiel_client'],
); );
$tabTri[''.$bil['dateExercice'].'-'.$bil['typeBilan']] = $bil['typeBilan'].$millesime; $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', if(!in_array($key, array('SIREN', 'DATE_FRAICHE_BILAN',
'DATE_CLOTURE', 'DATE_CLOTURE_PRE', 'DUREE_MOIS', 'DATE_CLOTURE', 'DATE_CLOTURE_PRE', 'DUREE_MOIS',
'DUREE_MOIS_PRE', 'MONNAIE', 'CONSOLIDE', 'MONNAIE_ORI', 'DUREE_MOIS_PRE', 'MONNAIE', 'CONSOLIDE', 'MONNAIE_ORI',
'MONNAIE_LIV_UNITE', 'SOURCE', 'devise'))){ 'MONNAIE_LIV_UNITE', 'SOURCE', 'devise', 'TOP_CONFIDENTIEL'))){
$resultPoste = new BilanPoste(); $resultPoste = new BilanPoste();
$resultPoste->id = $key; $resultPoste->id = $key;
$resultPoste->val = $value; $resultPoste->val = $value;

File diff suppressed because it is too large Load Diff

View File

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

View File

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