From ed53d33b7ef124f30bb6ffeda9c917c4d8217350 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Wed, 8 Mar 2017 16:17:07 +0100 Subject: [PATCH] Gestion de l'affichage des bilans confidentiel --- .../default/controllers/FinanceController.php | 61 +++++++++++-------- .../default/scripts/finance/banque.phtml | 19 +++--- .../default/scripts/finance/liasse.phtml | 20 ++++-- library/Scores/Ws/Client/Entreprise.php | 8 +++ 4 files changed, 67 insertions(+), 41 deletions(-) diff --git a/application/modules/default/controllers/FinanceController.php b/application/modules/default/controllers/FinanceController.php index e2f1ec73d..c4d6ef931 100644 --- a/application/modules/default/controllers/FinanceController.php +++ b/application/modules/default/controllers/FinanceController.php @@ -941,8 +941,6 @@ class FinanceController extends Zend_Controller_Action $request = $this->getRequest(); $unite = $request->getParam('unit','K'); $entreprise = new Scores_Session_Entreprise($this->siret, $this->id); - $ws = new WsScores(); - // Récupération de la date $dateAndType = $request->getParam('date', $defaultTypeBilan.$defaultDateExercice); @@ -953,38 +951,51 @@ class FinanceController extends Zend_Controller_Action $date = substr($dateAndType, 1); // Récupération des postes du bilan - $infos = $ws->getBilan(substr($this->siret, 0, 9), $date, $type, true); - if ($infos === false) $this->forward('soap', 'error'); + try { + $ws = new Scores_Ws_Client('entreprise', '0.8'); + $params = new stdClass(); + $params->siren = substr($this->siret, 0, 9); + $params->millesime = $date; + $params->typeBilan = $type; + $params->ref = ''; + $infos = $ws->getBilan($params); - // Formatage de la liasse - $infoLiasse = new Scores_Finance_Liasse($infos, $unite); - $this->view->assign('dateCloture', $infoLiasse->getInfo('dateCloture')); - $this->view->assign('dateCloturePre', $infoLiasse->getInfo('dateCloturePre')); + // Error + if ($infos === false) { + $this->forward('soap', 'error'); + } - $date = new Zend_Date($infoLiasse->getInfo('dateCloture'), 'yyyyMMdd'); - $this->view->assign('dateClotureD', $date->toString('dd/MM/yyyy')); + // Formatage de la liasse + $infoLiasse = new Scores_Finance_Liasse($infos, $unite); + $this->view->assign('dateCloture', $infoLiasse->getInfo('dateCloture')); + $this->view->assign('dateCloturePre', $infoLiasse->getInfo('dateCloturePre')); - $dateCloturePre = $infoLiasse->getInfo('dateCloturePre'); - if ( $dateCloturePre == '' ) { - $this->view->assign('dateCloturePreD', '-'); - } else { - $date = new Zend_Date($dateCloturePre, 'yyyyMMdd'); - $this->view->assign('dateCloturePreD', $date->toString('dd/MM/yyyy')); + $date = new Zend_Date($infoLiasse->getInfo('dateCloture'), 'yyyyMMdd'); + $this->view->assign('dateClotureD', $date->toString('dd/MM/yyyy')); + + $dateCloturePre = $infoLiasse->getInfo('dateCloturePre'); + if ($dateCloturePre == '') { + $this->view->assign('dateCloturePreD', '-'); + } else { + $date = new Zend_Date($dateCloturePre, 'yyyyMMdd'); + $this->view->assign('dateCloturePreD', $date->toString('dd/MM/yyyy')); + } + + $this->view->assign('dureesMois', $infoLiasse->getInfo('dureeMois')); + $this->view->assign('dureesMoisPre', $infoLiasse->getInfo('dureeMoisPre')); + + $this->view->assign('date', $date); + $this->view->assign('champType', $type); + $this->view->assign('liasse', $infoLiasse->getPostes()); + $this->view->assign('ancres', $ancres[$type]); + } catch (Exception $e) { + $this->view->msg = $e->getMessage(); } - $this->view->assign('dureesMois', $infoLiasse->getInfo('dureeMois')); - $this->view->assign('dureesMoisPre', $infoLiasse->getInfo('dureeMoisPre')); - - $this->view->assign('date', $date); - $this->view->assign('champType', $type); - $this->view->assign('liasse', $infoLiasse->getPostes()); - $this->view->assign('ancres', $ancres[$type]); - //Gestion export de la liasse au format XLS if ( $user->checkPerm('liassexls') & in_array($type,array('C', 'N', 'S')) ) { $this->view->assign('exportxls', true); } - } $this->view->assign('id', $id); diff --git a/application/modules/default/views/default/scripts/finance/banque.phtml b/application/modules/default/views/default/scripts/finance/banque.phtml index 09f34882f..c522021a1 100644 --- a/application/modules/default/views/default/scripts/finance/banque.phtml +++ b/application/modules/default/views/default/scripts/finance/banque.phtml @@ -17,15 +17,14 @@

Liste des relations bancaires

- AutrePage) && $this->edition) {?> -
- - Ajouter une autre relation bancaire -
- - - +AutrePage) && $this->edition) {?> +
+ + Ajouter une autre relation bancaire +
+ + + banques)>0) { ?> @@ -88,7 +87,7 @@ $('a.dialog').on('click', function(){ Quitter: function() { $(this).dialog('close'); } }, close: function() { $('#dialog').remove(); } - }; + }; $('
').dialog(dialogOpts); return false; } diff --git a/application/modules/default/views/default/scripts/finance/liasse.phtml b/application/modules/default/views/default/scripts/finance/liasse.phtml index 6b9fa9ab1..fd08e5419 100644 --- a/application/modules/default/views/default/scripts/finance/liasse.phtml +++ b/application/modules/default/views/default/scripts/finance/liasse.phtml @@ -51,6 +51,12 @@
+msg) {?> +

+msg?> +

+ + champType) { case 'N' : $name = 'Réel Normal'; break; @@ -64,12 +70,12 @@ switch ($this->champType) {
Valeurs exprimées en - - + +
@@ -132,5 +138,7 @@ Valeurs exprimées en + + render('cgu.phtml', $this->cgu);?> \ No newline at end of file diff --git a/library/Scores/Ws/Client/Entreprise.php b/library/Scores/Ws/Client/Entreprise.php index d2644efc3..eba5dfba3 100644 --- a/library/Scores/Ws/Client/Entreprise.php +++ b/library/Scores/Ws/Client/Entreprise.php @@ -1,5 +1,13 @@ array( + 'getBilan' => array( + 'cache' => true, + 'errorMsg' => array('MSG'), + 'debug' => true, + 'log' => 'mail', + ), + ), '0.9' => array( 'getGreffeAffaireList' => array( 'debug' => true,