issue #0001923 : Editer la fiche + remplissage des informations lors de la création

This commit is contained in:
Michael RICOIS 2014-04-09 13:10:57 +00:00
parent 70e18b8422
commit 38fd737a3f

View File

@ -1653,11 +1653,13 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('id1', $lienRef);
} else {
//Création de la première référence lien
$result = $ws->getIdentiteLight($siren);
//Compute informations
$infos = array(
'siren' => $siren,
'siren' => $result->Siren,
'actif' => 1,
'PpPm' => 'PM',
'RS' => $rs,
'RS' => $result->Nom,
'civilite' => '',
'nom' => '',
'prenom' => '',
@ -1666,17 +1668,17 @@ class SaisieController extends Zend_Controller_Action
'naissance_dept_pays' => '',
'naissance_lieu' => '',
'nat' => '',
'adresse_num' => '',
'adresse_btq' => '',
'adresse_codvoie' => '',
'adresse_libvoie' => '',
'adresse_num' => $result->AdresseNum,
'adresse_btq' => $result->AdresseBtq,
'adresse_codvoie' => $result->AdresseVoie,
'adresse_libvoie' => $result->AdresseRue,
'adresse_comp' => '',
'adresse_cp' => '',
'adresse_ville' => '',
'adresse_pays' => '',
'adresse_cp' => $result->CP,
'adresse_ville' => $result->Ville,
'adresse_pays' => 'FRA',
'dateSaisie' => date('YmdHis'),
'capital' => '',
'deviseCapital' => 'EUR',
'capital' => $result->CapitalDev,
'deviseCapital' => $result->CapitalDev,
'nbActions' => '',
'idLoc1Type' => '',
'idLoc1Num' => '',
@ -1687,7 +1689,7 @@ class SaisieController extends Zend_Controller_Action
);
$idNewLien = $ws->setLienRef(json_encode($infos));
Zend_Registry::get('firebug')->info('idNewLien:'.$idNewLien);
if (is_int($idNewLien)) {
if ( is_int($idNewLien) ) {
$this->view->assign('id1', $idNewLien);
}
}
@ -2242,7 +2244,7 @@ class SaisieController extends Zend_Controller_Action
$ws = new WsScores();
if ($id===null) {
if ( $id===null ) {
$siren = $request->getParam('siren');
$result = $ws->searchLienRef($siren, 'siren');
if (count($result->item)>0) {
@ -2253,44 +2255,57 @@ class SaisieController extends Zend_Controller_Action
}
}
$this->view->assign('edit', $id);
if ( $id!==null ) {
$this->view->assign('currencies', $this->currencies);
$this->view->assign('countries', $this->countries);
$this->view->assign('edit', $id);
$result = $ws->getSaisieLienRef($id);
$items = json_decode($result, true);
$this->view->assign('currencies', $this->currencies);
$this->view->assign('countries', $this->countries);
//Get country code
if ($items->adresse_pays!='FRA') {
$result = $ws->getCountryId($items['adresse_pays']);
$this->view->assign('identifiant', $result->item);
}
$result = $ws->getSaisieLienRef($id);
Zend_Registry::get('firebug')->info($items);
if ( $result!==false ) {
if (count($items)>0) {
foreach( $items as $key => $val ) {
switch ($key) {
case 'dateCapital':
case 'dateNbActions':
case 'naissance_date':
if (!empty($val) && $val!='0000-00-00') {
$date = new Zend_Date($val, 'yyyy-MM-dd');
$this->view->assign($key, $date->toString('dd/MM/yyyy'));
}
break;
default:
$this->view->assign($key, $val);
break;
}
}
}
$items = json_decode($result, true);
if ( $items!==null ) {
Zend_Registry::get('firebug')->info('getSaisieLienRef id='.$id);
Zend_Registry::get('firebug')->info($items);
//Get country code
if ($items->adresse_pays!='FRA') {
$result = $ws->getCountryId($items['adresse_pays']);
$this->view->assign('identifiant', $result->item);
}
Zend_Registry::get('firebug')->info($items);
if (count($items)>0) {
foreach( $items as $key => $val ) {
switch ($key) {
case 'dateCapital':
case 'dateNbActions':
case 'naissance_date':
if (!empty($val) && $val!='0000-00-00') {
$date = new Zend_Date($val, 'yyyy-MM-dd');
$this->view->assign($key, $date->toString('dd/MM/yyyy'));
}
break;
default:
$this->view->assign($key, $val);
break;
}
}
}
if ($items['PpPm']=='PM') {
$this->view->assign('nom', $items['RS']);
} else {
$this->view->assign('nom', $items['nom']);
}
}
}
if ($items['PpPm']=='PM') {
$this->view->assign('nom', $items['RS']);
} else {
$this->view->assign('nom', $items['nom']);
}
}
@ -2640,9 +2655,9 @@ class SaisieController extends Zend_Controller_Action
$result = $ws->setDirigeantsOp(json_encode($infos), $params['mode'], $params['id']);
if ($result>0) {
$message = $message.' '.$this->view->translate('a été réussi!');
$message = $message.' '.$this->view->translate('a été réussi!');
} else if ($result===0) {
$message = $message.' '.$this->view->translate('n\'a pas été réussi!');
$message = $message.' '.$this->view->translate('n\'a pas été réussi!');
} else {
$message = $result;
}