issue #0001704 : Enregistrement des contacts (au SIRET)

This commit is contained in:
Michael RICOIS 2014-03-19 07:26:31 +00:00
parent 92187e0ec3
commit 4da392a3cf
3 changed files with 90 additions and 41 deletions

View File

@ -47,7 +47,7 @@ class SaisieController extends Zend_Controller_Action
array( "triId"=>"1790", "triCode"=>"CAYENL", "triNom"=>"Chambre Détachée de la Cour d'Appel de Fort de France à Cayenne", "triCP"=>"97300" ),
array( "triId"=>"1798", "triCode"=>"AGENL", "triNom"=>"Cour d'Appel d'Agen", "triCP"=>"47916" ),
);
protected $codVoie = array(
'ABE' => "Abbaye",
'AGL' => "Agglomération",
@ -2337,20 +2337,20 @@ class SaisieController extends Zend_Controller_Action
}
}
public function liendeleteAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$id = $request->getParam('idFiche', null);
$infos = array ('delete' => '1');
$ws = new WsScores();
if ($id===null) {
$siren = $request->getParam('siren');
$result = $ws->searchLienRef($siren, 'siren');
if (count($result->item)>0) {
foreach ($result->item as $item) {
@ -2359,7 +2359,7 @@ class SaisieController extends Zend_Controller_Action
}
}
}
if ( $request->isPost() ) {
if ($id == null) {
$message = 'Fiche n\'est pas trouvée';
@ -2485,11 +2485,11 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('output', $output);
}
public function codvoieAction()
{
$this->_helper->layout()->disableLayout();
$codvoie = $this->getRequest()->getParam('codvoie', null);
$output = array();
@ -2644,13 +2644,22 @@ class SaisieController extends Zend_Controller_Action
$message = '';
$mode = $request->getParam('mode');
if( in_array($mode, array('create', 'edit')) ) {
if( $mode == 'delete' ) {
$ws = new WsScores();
$result = $ws->setSaisieContactEt('', '', '', '', $id, true);
if ( is_string($result) ) {
$this->view->assign('msg', $result);
}
} else {
$params = $request->getParams();
// check values
$paramlist = array(
'siret' => 'SIRET',
'type' => 'Type',
'value' => 'Valeur',
'siret' => 'SIRET',
'type' => 'Type',
'value' => 'Valeur',
);
foreach ($paramlist as $item => $val) {
@ -2663,7 +2672,7 @@ class SaisieController extends Zend_Controller_Action
if ($message == '') {
//setContactEt
$ws = new WsScores();
$result = $ws->setSaisieContactEt($siret, $type, $value, $info);
$result = $ws->setSaisieContactEt($params['siret'], $params['type'], $params['value'], $params['info']);
if ( is_string($result) ) {
$this->view->assign('msg', $result);
@ -2673,19 +2682,13 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('msg', $message);
}
} else {
$ws = new WsScores();
$result = $ws->delSaisieContactEt($id);
if ( is_string($result) ) {
$this->view->assign('msg', $result);
}
}
} else {
$mode = $request->getParam('mode');
$this->view->assign('mode', $mode);
$id = $request->getParam('id');
if ($mode=='delete') {
@ -2698,7 +2701,6 @@ class SaisieController extends Zend_Controller_Action
$ws = new WsScores();
$result = $ws->getSaisieContactEt($id);
$data = json_decode($result);
Zend_Registry::get('firebug')->info($data);
$this->view->assign('id', $data->id);
$this->view->assign('siret', str_pad($data->siren,9,'0',STR_PAD_LEFT).str_pad($data->nic,5,'0',STR_PAD_LEFT));
$this->view->assign('type', $data->typeTel);
@ -2708,6 +2710,32 @@ class SaisieController extends Zend_Controller_Action
} else {
$this->view->assign('value', $data->infoTel);
}
$tabChange = array();
if ( $data->idUtilisateur != 0 ) {
$change = new stdClass();
$change->UserId = $data->idUtilisateur;
$change->UserName = $data->idUtilisateurName;
$change->Date = $data->dateInsert;
$change->Type = 'add';
$tabChange[] = $change;
}
if ( $data->idUpdate != 0 ) {
$change = new stdClass();
$change->UserId = $data->idUpdate;
$change->UserName = $data->idUpdateName;
$change->Date = $data->dateUpdate;
$change->Type = 'edit';
$tabChange[] = $change;
}
if ( $data->idSuppr != 0 ) {
$change = new stdClass();
$change->UserId = $data->idSuppr;
$change->UserName = $data->idSupprName;
$change->Date = $data->dateSuppr;
$change->Type = 'del';
$tabChange[] = $change;
}
$this->view->Modif = $tabChange;
} else {
$siret = $request->getParam('siret');

View File

@ -24,7 +24,38 @@
<?php } else {?>
<?php if ( count($this->Modif)>0 ) {?>
<?php foreach ( $this->Modif as $item ) {?>
<p>
<?php
switch ($item->type) {
case 'add':
$date = new Zend_Date($item->dateInsert, 'yyyy-MM-dd');
?>
Création le <?=$date->toString('dd/MM/yyyy')?> par <?$item->idUtilisateurName?>.
<?php
break;
case 'edit':
$date = new Zend_Date($item->dateUpdate, 'yyyy-MM-dd');
?>
Modification le <?=$date->toString('dd/MM/yyyy')?> par <?$item->idUpdateName?>.
<?php
break;
case 'del':
$date = new Zend_Date($item->dateSuppr, 'yyyy-MM-dd');
?>
Suppression le <?=$date->toString('dd/MM/yyyy')?> par <?$item->idSupprName?>.
<?php
break;
}
?>
</p>
<?php }?>
<?php }?>
<form name="contact" action="<?=$this->url(array('controller'=>'saisie','action'=>'contact'),null,true)?>" method="post">
<input type="hidden" name="mode" value="<?=$this->mode?>"/>
<?php if ($this->id) {?>
<input type="hidden" name="id" value="<?=$this->id?>"/>
<?php }?>
@ -40,7 +71,7 @@
</div>
<div>
<label>Valeur</label>
<input type="text" name="" value="<?=$this->value?>">
<input type="text" name="value" value="<?=$this->value?>">
</div>
<p>
Téléphone france saisit sans séparateur, maximum 10 chiffres (format: XXXXXXXXXX)

View File

@ -120,28 +120,18 @@ class WsScores
}
}
public function delSaisieContactEt($id)
public function setSaisieContactEt($siret, $type, $value, $info, $id=null, $delete=false)
{
$params = new stdClass();
$params->id = $id;
$params->siret = $siret;
$params->type = $type;
$params->value = $value;
$params->info = $info;
$client = $this->loadClient('saisie');
try {
$reponse = $client->delContactEt($params);
return $reponse->delContactEtResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;
}
}
public function setSaisieContactEt($siret, $type, $value, $info, $id=null)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('saisie');
try {
$reponse = $client->getContactEt($params);
return $reponse->getContactEtResult;
$reponse = $client->setContactEt($params);
return $reponse->setContactEtResult;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
return $fault->faultstring;