From 1ad8fa272f65b8d1881c8a0695cf6479fddc2716 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Tue, 23 Oct 2012 15:28:17 +0000 Subject: [PATCH] issue #0001372 : Modify interface because data structure has changed --- application/configs/webservices.ini | 10 +- application/controllers/SaisieController.php | 224 +++++++++++------- .../default/scripts/identite/liens.phtml | 17 +- .../default/scripts/saisie/countryid.phtml | 1 + .../views/default/scripts/saisie/lien.phtml | 107 ++++----- .../default/scripts/saisie/lienetranger.phtml | 46 +++- .../default/scripts/saisie/lienfiche.phtml | 39 ++- .../views/default/scripts/saisie/lienpp.phtml | 2 +- .../default/scripts/saisie/liensave.phtml | 2 +- library/Scores/WsScores.php | 21 +- 10 files changed, 280 insertions(+), 189 deletions(-) create mode 100644 application/views/default/scripts/saisie/countryid.phtml diff --git a/application/configs/webservices.ini b/application/configs/webservices.ini index 8132f05f7..9de25719c 100644 --- a/application/configs/webservices.ini +++ b/application/configs/webservices.ini @@ -1,5 +1,5 @@ [local] -webservices.interne.wsdl = "http://webservice-2.4.sd.dev/interne/v0.4?wsdl-auto" +webservices.interne.wsdl = "http://webservice-2.4.sd.dev/interne/v0.5?wsdl-auto" webservices.interne.options.soap_version = SOAP_1_2 webservices.entreprise.wsdl = "http://webservice-2.4.sd.dev/entreprise/v0.8?wsdl-auto" webservices.entreprise.options.soap_version = SOAP_1_2 @@ -11,7 +11,7 @@ webservices.pieces.wsdl = "http://webservice-2.4.sd.dev/pieces/v0.1?wsdl-auto" webservices.pieces.options.soap_version = SOAP_1_2 [sdsrvdev01] -webservices.interne.wsdl = "http://webservice-2.4.sd.lan/interne/v0.4?wsdl-auto" +webservices.interne.wsdl = "http://webservice-2.4.sd.lan/interne/v0.5?wsdl-auto" webservices.interne.options.soap_version = SOAP_1_2 webservices.entreprise.wsdl = "http://webservice-2.4.sd.lan/entreprise/v0.8?wsdl-auto" webservices.entreprise.options.soap_version = SOAP_1_2 @@ -23,7 +23,7 @@ webservices.pieces.wsdl = "http://webservice-2.4.sd.lan/pieces/v0.1?wsdl-auto" webservices.pieces.options.soap_version = SOAP_1_2 [sd-25137] -webservices.interne.wsdl = "http://wse.scores-decisions.com:8081/interne/v0.4?wsdl" +webservices.interne.wsdl = "http://wse.scores-decisions.com:8081/interne/v0.5?wsdl" webservices.interne.options.soap_version = SOAP_1_2 webservices.entreprise.wsdl = "http://wse.scores-decisions.com:8081/entreprise/v0.7?wsdl" webservices.entreprise.options.soap_version = SOAP_1_2 @@ -35,7 +35,7 @@ webservices.pieces.wsdl = "http://wse.scores-decisions.com:8081/pieces/v0.1?wsdl webservices.pieces.options.soap_version = SOAP_1_2 [celeste] -webservices.interne.wsdl = "http://wse.scores-decisions.com:8081/interne/v0.4?wsdl" +webservices.interne.wsdl = "http://wse.scores-decisions.com:8081/interne/v0.5?wsdl" webservices.interne.options.soap_version = SOAP_1_2 webservices.entreprise.wsdl = "http://wse.scores-decisions.com:8081/entreprise/v0.7?wsdl" webservices.entreprise.options.soap_version = SOAP_1_2 @@ -47,7 +47,7 @@ webservices.pieces.wsdl = "http://wse.scores-decisions.com:8081/pieces/v0.1?wsdl webservices.pieces.options.soap_version = SOAP_1_2 [celeste-staging] -webservices.interne.wsdl = "http://wsrec.scores-decisions.com:8000/interne/v0.4?wsdl" +webservices.interne.wsdl = "http://wsrec.scores-decisions.com:8000/interne/v0.5?wsdl" webservices.interne.options.soap_version = SOAP_1_2 webservices.entreprise.wsdl = "http://wsrec.scores-decisions.com:8000/entreprise/v0.7?wsdl" webservices.entreprise.options.soap_version = SOAP_1_2 diff --git a/application/controllers/SaisieController.php b/application/controllers/SaisieController.php index 7b3554bda..acce418dd 100644 --- a/application/controllers/SaisieController.php +++ b/application/controllers/SaisieController.php @@ -1487,50 +1487,100 @@ class SaisieController extends Zend_Controller_Action $siren = $request->getParam('siren'); $mode = $request->getParam('mode'); $type = $request->getParam('type'); + $idLien = $request->getParam('idLien', null); $session = new SessionEntreprise($siren); $rs = $session->getRaisonSociale(); - //Création de la première référence lien - $ws = new WsScores(); - - $infos = array( - 'siren' => $siren, - 'actif' => 1, - 'PpPm' => 'PM', - 'RS' => $rs, - 'civilite' => '', - 'nom' => '', - 'prenom' => '', - 'naissance_nom' => '', - 'naissance_date' => '', - 'naissance_dept_pays' => '', - 'naissance_lieu' => '', - 'nat' => '', - 'adresse_num' => '', - 'adresse_btq' => '', - 'adresse_codvoie' => '', - 'adresse_libvoie' => '', - 'adresse_comp' => '', - 'adresse_cp' => '', - 'adresse_ville' => '', - 'adresse_pays' => '', - 'refDoc' => '', - 'dateSaisie' => date('YmdHis'), - 'capital' => '', - 'deviseCapital' => 'EUR', - 'nbActions' => '', - 'idLoc1Type' => '', - 'idLoc1Num' => '', - 'idLoc2Type' => '', - 'idLoc2Num' => '', - 'idLoc3Type' => '', - 'idLoc3Num' => '', + $detention = array( + '+' => 'Major.', + '-' => 'Minor.', + 'C' => 'Contrôle', + 'S' => 'Solde', + 'F' => 'Fusion', + 'P' => 'Projet de fusion', ); + $this->view->assign('detention', $detention); - $idNewLien = $ws->setLienRef(json_encode($infos)); - if (is_int($idNewLien)) { - $this->view->assign('id1', $idNewLien); + + $ws = new WsScores(); + //Mode = delete + /* + id du lien pour récupérer les informations + - rs1, siren1, rs2, siren2 + */ + if ($mode == 'delete') { + + + } + //Mode = edit / add + /* + id du lien pour récupérer les informations + - siren, rs actuel + - Liste des documents de référence + - Liste des types d'identifiant par pays sdv1.tabIdLocal + */ + elseif ($mode == 'edit') { + + $result = $ws->getSaisieLien($idLien); + $infos = json_decode($result, true); + + Zend_Registry::get('firebug')->info($infos); + + if ($type=='actionnaire') { + $this->view->assign('id1', $infos['idPar']); + $this->view->assign('id2', $infos['idAct']); + } elseif (type=='participation') { + $this->view->assign('id2', $infos['idPar']); + $this->view->assign('id1', $infos['idAct']); + } + + $this->view->assign('PDetention', $infos['PDetention']); + $this->view->assign('Pvote', $infos['Pvote']); + $this->view->assign('MajMin', $infos['MajMin']); + + } else { + + //Création de la première référence lien + $infos = array( + 'siren' => $siren, + 'actif' => 1, + 'PpPm' => 'PM', + 'RS' => $rs, + 'civilite' => '', + 'nom' => '', + 'prenom' => '', + 'naissance_nom' => '', + 'naissance_date' => '', + 'naissance_dept_pays' => '', + 'naissance_lieu' => '', + 'nat' => '', + 'adresse_num' => '', + 'adresse_btq' => '', + 'adresse_codvoie' => '', + 'adresse_libvoie' => '', + 'adresse_comp' => '', + 'adresse_cp' => '', + 'adresse_ville' => '', + 'adresse_pays' => '', + 'refDoc' => '', + 'dateSaisie' => date('YmdHis'), + 'capital' => '', + 'deviseCapital' => 'EUR', + 'nbActions' => '', + 'idLoc1Type' => '', + 'idLoc1Num' => '', + 'idLoc2Type' => '', + 'idLoc2Num' => '', + 'idLoc3Type' => '', + 'idLoc3Num' => '', + ); + + $idNewLien = $ws->setLienRef(json_encode($infos)); + if (is_int($idNewLien)) { + $this->view->assign('id1', $idNewLien); + } + } //Affichage @@ -1538,28 +1588,8 @@ class SaisieController extends Zend_Controller_Action $this->view->assign('siren', $siren); $this->view->assign('mode', $mode); $this->view->assign('type', $type); - - $idLien = $request->getParam('id', null); $this->view->assign('idLien', $idLien); - - - //Mode = delete - /* - id du lien pour récupérer les informations - - rs1, siren1, rs2, siren2 - - */ - - //Mode = edit / add - /* - id du lien pour récupérer les informations - - siren, rs actuel - - Liste des documents de référence - - Liste des types d'identifiant par pays sdv1.tabIdLocal - */ - - } public function liensearchAction() @@ -1589,7 +1619,7 @@ class SaisieController extends Zend_Controller_Action public function lienetrangerAction() { $this->_helper->layout()->disableLayout(); - ksort($this->selectPays); + asort($this->selectPays); $this->view->assign('countries', $this->selectPays); } @@ -1607,8 +1637,6 @@ class SaisieController extends Zend_Controller_Action { $this->_helper->layout()->disableLayout(); $params = $this->getRequest()->getParams(); - - Zend_Registry::get('firebug')->info($params); //Construct reference informations @@ -1623,7 +1651,7 @@ class SaisieController extends Zend_Controller_Action $params['civilite'] = ''; $params['nom'] = ''; $params['prenom'] = ''; - $params['naissance_nom'] = ''; + $params['nom_usage'] = ''; $params['naissance_date'] = ''; $params['naissance_dept_pays'] = ''; $params['naissance_lieu'] = ''; @@ -1642,7 +1670,7 @@ class SaisieController extends Zend_Controller_Action $params['civilite'] = ''; $params['nom'] = ''; $params['prenom'] = ''; - $params['naissance_nom'] = ''; + $params['nom_usage'] = ''; $params['naissance_date'] = ''; $params['naissance_dept_pays'] = ''; $params['naissance_lieu'] = ''; @@ -1657,23 +1685,24 @@ class SaisieController extends Zend_Controller_Action 'civilite' => $params['civilite'], 'nom' => $params['nom'], 'prenom' => $params['prenom'], - 'naissance_nom' => $params['naissance_nom'], + 'nom_usage' => $params['nom_usage'], 'naissance_date' => $params['naissance_date'], 'naissance_dept_pays' => $params['naissance_dept_pays'], 'naissance_lieu' => $params['naissance_lieu'], 'nat' => $params['nat'], - 'adresse_num' => $params['adresse_num'], - 'adresse_btq' => $params['adresse_btq'], - 'adresse_codvoie' => $params['adresse_codvoie'], - 'adresse_libvoie' => $params['adresse_libvoie'], - 'adresse_comp' => $params['adresse_comp'], - 'adresse_cp' => $params['adresse_cp'], - 'adresse_ville' => $params['adresse_ville'], - 'adresse_pays' => $params['adresse_pays'], - 'refDoc' => $params['refDoc'], + 'adresse_num' => empty($params['adresse_num']) ? '' : $params['adresse_num'], + 'adresse_btq' => empty($params['adresse_btq']) ? '' : $params['adresse_btq'], + 'adresse_codvoie' => empty($params['adresse_codvoie']) ? '' : $params['adresse_codvoie'], + 'adresse_libvoie' => empty($params['adresse_libvoie']) ? '' : $params['adresse_libvoie'], + 'adresse_comp' => empty($params['adresse_comp']) ? '' : $params['adresse_comp'], + 'adresse_cp' => empty($params['adresse_cp']) ? '' : $params['adresse_cp'], + 'adresse_ville' => empty($params['adresse_ville']) ? '' : $params['adresse_ville'], + 'adresse_pays' => empty($params['adresse_pays']) ? '' : $params['adresse_pays'], + 'refDoc' => empty($params['refDoc']) ? '' : $params['refDoc'], 'dateSaisie' => date('YmdHis'), 'capital' => $params['capital'], 'deviseCapital' => 'EUR', + 'dateCapital' => empty($params['dateCapital']) ? '' : WDate::dateT('d/m/Y', 'Ymd', $params['dateCapital']), 'nbActions' => $params['nbActions'], 'idLoc1Type' => $params['idLoc1Type'], 'idLoc1Num' => $params['idLoc1Num'], @@ -1681,8 +1710,16 @@ class SaisieController extends Zend_Controller_Action 'idLoc2Num' => $params['idLoc2Num'], 'idLoc3Type' => $params['idLoc3Type'], 'idLoc3Num' => $params['idLoc3Num'], + 'bilMillesime' => $params['bilMillesime'], + 'bilDev' => 'EUR', + 'bilFL' => $params['bilFL'], + 'bilHN' => $params['bilHN'], + 'bilFPr' => $params['bilFPr'], + 'bilEE' => $params['bilEE'], ); + Zend_Registry::get('firebug')->info($params); + $ws = new WsScores(); $idNewLien = $ws->setLienRef(json_encode($infos), $params['idLien']); @@ -1704,27 +1741,44 @@ class SaisieController extends Zend_Controller_Action $params = $this->getRequest()->getParams(); + if ($params['type']=='actionnaire') { + $idAct = $params['id2']; + $idPar = $params['id1']; + } elseif ($params['type']=='participation') { + $idPar = $params['id2']; + $idAct = $params['id1']; + } + $infos = array( - 'id1' => '', - 'id2' => '', - 'actif' => 1, - 'ActionPart' => $params['ActionPart'], - 'Pmin' => '', - 'Pmax' => '', - 'MajMin' => '', - 'id2' => '', - 'dateLien' => '', - 'dateInsert' => '', + 'idAct' => $idAct, + 'PDetention' => $params['PDetention'], + 'Pvote' => $params['Pvote'], + 'MajMin' => $params['MajMin'], + 'idPar' => $idPar, + 'dateEffetLien' => empty($params['dateEffetLien']) ? date('Ymd') : $params['dateEffetLien'], + 'docRef' => empty($params['docRef']) ? '' : $params['docRef'], + 'dateDocRef' => empty($params['dateDocRef']) ? '' : $params['dateDocRef'], ); + Zend_Registry::get('firebug')->info($infos); + $ws = new WsScores(); - //$idNewLien = $ws->setLien(json_encode($infos), $params['idLien']); + $idNewLien = $ws->setLien(json_encode($infos), $params['idLien']); if (is_int($idNewLien)){ $this->view->assign('result', array('id'=>$idNewLien, 'error'=>'')); } else { $this->view->assign('result', array('id'=>0, 'error'=>$idNewLien)); } - + } + + public function countryidAction() + { + $this->_helper->layout()->disableLayout(); + $request = $this->getRequest(); + $code = $request->getParam('code'); + $ws = new WsScores(); + $result = $ws->getCountryId($code); + $this->view->assign('identifiant', $result->item); } } \ No newline at end of file diff --git a/application/views/default/scripts/identite/liens.phtml b/application/views/default/scripts/identite/liens.phtml index f25d43765..75e0e015d 100644 --- a/application/views/default/scripts/identite/liens.phtml +++ b/application/views/default/scripts/identite/liens.phtml @@ -75,13 +75,13 @@ edition) {?> - - + + - - + + @@ -150,8 +150,13 @@ $('a.dialog').on('click', function(){ if ($('input[name=id1]').length>0 || $('input[name=id2]').length>0) { var form = $('form[name=lien]'); $.post(form.attr('action'), form.serialize(), function(data){ - - }); + if(data.error==''){ + //Remove button + $('form[name=lien]').replaceWith('Lien créé id = '+data.id+''); + } else { + $('form[name=lien]').replaceWith(data.error); + } + }, 'json').error(function(){ alert('Unknow error'); }); } else { alert("Quelque chose manque !"); } diff --git a/application/views/default/scripts/saisie/countryid.phtml b/application/views/default/scripts/saisie/countryid.phtml new file mode 100644 index 000000000..39a58eb3b --- /dev/null +++ b/application/views/default/scripts/saisie/countryid.phtml @@ -0,0 +1 @@ +identifiant); diff --git a/application/views/default/scripts/saisie/lien.phtml b/application/views/default/scripts/saisie/lien.phtml index 8de4b1fc0..3e6c2617b 100644 --- a/application/views/default/scripts/saisie/lien.phtml +++ b/application/views/default/scripts/saisie/lien.phtml @@ -26,20 +26,12 @@ div#etranger { display:none; } .ui-widget-content a {color:blue; text-decoration:underline;} -
- - - type=='actionnaire') {?> - mode == 'add' ) { ?> - + mode == 'add' ) {?>
Saisie d'un actionnaire pour la société rs?> (siren?>)
render('saisie/lienfiche.phtml')?> - - - - mode == 'edit') {?> + mode == 'edit') {?>
Modification d'un actionnaire pour la société rs?> (siren?>)
@@ -48,33 +40,31 @@ div#etranger { display:none; }
+ + + + + mode=='edit' || $this->mode=='delete') {?> +
- +
- (JJ/MM/AAAAA) + (JJ/MM/AAAAA)
-
- -
- (JJ/MM/AAAAA) -
-
- -
+
- % + %
- Major. - Minor. +
- % -
-
- -
- -
- -
-
- -
- -
- euros + %
- + + type=='participation') {?> @@ -141,10 +121,11 @@ div#etranger { display:none; } mode == 'add' ) { ?>
Saisie d'une participation pour la société rs?> (siren?>)
- render('saisie/lienfiche.phtml')?> - + + + mode=='edit' || $this->mode=='delete') {?> mode == 'edit') {?>
Modification d'une participation pour la société rs?> (siren?>)
@@ -156,49 +137,45 @@ div#etranger { display:none; } - + mode=='add' || $this->mode=='edit') {?> +
+ + +
Liens - +
- % + %
- Major. - Minor. +
- % -
-
- -
- -
- -
-
- -
- -
- euros + %
+
+
@@ -209,4 +186,4 @@ Erreur. - + diff --git a/application/views/default/scripts/saisie/lienetranger.phtml b/application/views/default/scripts/saisie/lienetranger.phtml index 10f3a9120..1c43dfbc8 100644 --- a/application/views/default/scripts/saisie/lienetranger.phtml +++ b/application/views/default/scripts/saisie/lienetranger.phtml @@ -1,8 +1,8 @@
- + countries as $code => $lib) {?> @@ -10,14 +10,7 @@
-
- -
- [+] -
-
- - +
@@ -39,14 +32,41 @@
- +
- +
- \ No newline at end of file + \ No newline at end of file diff --git a/application/views/default/scripts/saisie/lienfiche.phtml b/application/views/default/scripts/saisie/lienfiche.phtml index 9d9e597f3..fd437a7ae 100644 --- a/application/views/default/scripts/saisie/lienfiche.phtml +++ b/application/views/default/scripts/saisie/lienfiche.phtml @@ -19,7 +19,7 @@ @@ -39,21 +39,21 @@
- euros, en date du + euros, en date du
- action(s) de euros nominale + action(s), en date du
- en date du +
@@ -66,28 +66,28 @@
- euros + euros
- euros + euros
- euros + euros
- euros + euros
@@ -112,16 +112,18 @@ $('input.autocomplete').autocomplete({ ); }, select: function(event, ui) { - $('div#searchFiche').replaceWith('Fiche sélectionné id = '+ui.item.value+'.'); + $('form[name=lien]').prepend(''); + $('div#searchFiche').replaceWith('Fiche créée id = '+ui.item.value+''); } }); $('form[name=saveLienRef]').submit(function(e){ + e.preventDefault(); var form = $(this); $.post(form.attr('action'), form.serialize(), function(data){ - alert(data.id); if(data.error==''){ - $('div#searchFiche').replaceWith('Fiche créée id = '+data.id+''); + $('form[name=lien]').prepend(''); + $('div#searchFiche').replaceWith('Fiche créée id = '+data.id+''); } else { $('div#searchFiche').replaceWith(data.error); } @@ -146,6 +148,21 @@ $('a.lienRef').click(function(e){ $('div#lienRef').load(url); }); + +$('a#infors').click(function(e){ + e.preventDefault(); + alert('OK'); + var siren = $('form[name=saveLienRef] input[name=siren]').val(); + if(siren.length==9) { + $.post('/dashboard/rs', {siren: siren }, function success(data) { + $('form[name=saveLienRef] input[name=nom]').val(data); + }); + } else { + alert('Siren faux!'); + return false; + } +}); +
\ No newline at end of file diff --git a/application/views/default/scripts/saisie/lienpp.phtml b/application/views/default/scripts/saisie/lienpp.phtml index c636f23f0..af3d9bba5 100644 --- a/application/views/default/scripts/saisie/lienpp.phtml +++ b/application/views/default/scripts/saisie/lienpp.phtml @@ -3,7 +3,7 @@
- +
diff --git a/application/views/default/scripts/saisie/liensave.phtml b/application/views/default/scripts/saisie/liensave.phtml index b3d9bbc7f..46634d4fd 100644 --- a/application/views/default/scripts/saisie/liensave.phtml +++ b/application/views/default/scripts/saisie/liensave.phtml @@ -1 +1 @@ -result)?> diff --git a/library/Scores/WsScores.php b/library/Scores/WsScores.php index 37bc692f7..74195d651 100644 --- a/library/Scores/WsScores.php +++ b/library/Scores/WsScores.php @@ -138,7 +138,25 @@ class WsScores return false; } } - + } + + public function getSaisieLien($id) + { + $params = new stdClass(); + $params->id = $id; + $client = $this->loadClient('saisie'); + try { + $reponse = $client->getLien($params); + return $reponse->getLienResult; + } catch (SoapFault $fault) { + Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring); + if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){ + return $fault->faultstring; + } else { + $this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse()); + return false; + } + } } public function setLien($infos, $id = null) @@ -159,7 +177,6 @@ class WsScores return false; } } - } public function setLienRef($infos, $id = null)