issue #0001704 : Suppression et Modification

This commit is contained in:
Michael RICOIS 2014-03-20 16:40:32 +00:00
parent 645f0ae563
commit 2a2ace9fc5
4 changed files with 50 additions and 43 deletions

View File

@ -2505,14 +2505,14 @@ class SaisieController extends Zend_Controller_Action
}
$this->view->assign('output', $output);
}
/**
* Ajouter, modifier ou supprimer des dirigeants oppérationnels
*/
public function diropcontrolAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$mode = $request->getParam('mode');
$type = $request->getParam('type', 'lien');
@ -2529,7 +2529,7 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('fonction', json_decode($fonction));
break;
case 'edit':
$fonction = $ws->getCatalogFctDir();
$infos = $ws->getDirigeantsOp($siren, $id);
@ -2549,23 +2549,23 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('siren', $siren);
$this->view->assign('nic', $nic);
}
/**
* Sauvegarder les modifications des dirigeants oppérationnels
*/
public function diropsaveAction()
{
$this->_helper->layout()->disableLayout();
$params = $this->getRequest()->getParams();
$message = '';
$newDate = '0000-00-00';
if (trim($params['naiss_date']) != '') {
$date = new Zend_Date($params['naiss_date'], 'dd/MM/yyyy');
$newDate = $date->toString('yyyy-MM-dd');
}
$infos = array(
'siren' => $params['siren'],
'nic' => $params['nic'],
@ -2580,7 +2580,7 @@ class SaisieController extends Zend_Controller_Action
'fax' => $params['fax'],
'email' => $params['email']
);
$ws = new WsScores();
$result = $ws->setDirigeantsOp(json_encode($infos), $params['mode'], $params['type'], $params['id']);
@ -2593,7 +2593,7 @@ class SaisieController extends Zend_Controller_Action
} else if ($params['mode'] == 'del') {
$message = $this->view->translate('Suppression');
}
if (intval($result)!=0) {
$message = $message.' '.$this->view->translate('a été réussi!');
} else {
@ -2605,13 +2605,13 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('message', $message);
}
public function diropsearchAction()
{
$this->_helper->layout()->disableLayout();
$query = $this->getRequest()->getParam('query', null);
$param = array('query'=>$query);
$output = array();
@ -2629,35 +2629,39 @@ class SaisieController extends Zend_Controller_Action
}
}
}
$this->view->assign('output', $output);
}
/**
/**
* Edit contact information
*/
public function contactAction()
{
$request = $this->getRequest();
if ( $request->isXmlHttpRequest() ) {
$this->_helper->layout()->disableLayout();
$this->_helper->layout()->disableLayout();
$id = $request->getParam('id');
$this->view->assign('id', $id);
if ( $request->isPost() ) {
$this->view->assign('post', true);
$params = $request->getParams();
$message = '';
$mode = $request->getParam('mode');
if( $mode == 'delete' ) {
$ws = new WsScores();
$result = $ws->setSaisieContactEt('', '', '', '', $id, true);
$result = $ws->setSaisieContactEt($params['siret'], '', '', '', $id, true);
if ( is_string($result) ) {
$this->view->assign('msg', $result);
}
} else {
$params = $request->getParams();
// check values
$paramlist = array(
'siret' => 'SIRET',
@ -2692,9 +2696,10 @@ class SaisieController extends Zend_Controller_Action
$mode = $request->getParam('mode');
$this->view->assign('mode', $mode);
$id = $request->getParam('id');
$siret = $request->getParam('siret');
$this->view->assign('siret', $siret);
if ($mode=='delete') {
if ( $mode=='delete' ) {
$this->view->assign('mode', 'delete');
@ -2703,46 +2708,44 @@ class SaisieController extends Zend_Controller_Action
if ( $id !== null ) {
$ws = new WsScores();
$result = $ws->getSaisieContactEt($id);
$data = json_decode($result);
$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);
if ($data->typeTel=='tel' || $data->typeTel=='fax' ) {
$this->view->assign('value', str_pad($data->telephone,10,'0',STR_PAD_LEFT));
$this->view->assign('info', $data->infoTel);
$data = json_decode($result, true);
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']);
if ($data['typeTel']=='tel' || $data['typeTel']=='fax' ) {
$this->view->assign('value', str_pad($data['telephone'],10,'0',STR_PAD_LEFT));
$this->view->assign('info', $data['infoTel']);
} 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->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->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->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');
$this->view->assign('siret', $siret);
}
$this->view->telinfo = array(

View File

@ -114,8 +114,8 @@ if ($item->deleted) {
<?php if( $this->edition ) {?>
<div style="float:right;">
<a class="dialog" title="Modifier le contact" href="<?=$this->url(array('controller'=>'saisie','action'=>'contact','mode'=>'edit','id'=>$item->id), null, true)?>"><img src="/themes/default/images/interfaces/editer.png" /></a>
<a class="dialog" title="Supprimer le contact" href="<?=$this->url(array('controller'=>'saisie','action'=>'contact','mode'=>'delete','id'=>$item->id), null, true)?>"><img src="/themes/default/images/interfaces/supprimer.png" /></a>
<a class="dialog" title="Modifier le contact" href="<?=$this->url(array('controller'=>'saisie','action'=>'contact', 'siret'=>$this->siret, 'mode'=>'edit','id'=>$item->id), null, true)?>"><img src="/themes/default/images/interfaces/editer.png" /></a>
<a class="dialog" title="Supprimer le contact" href="<?=$this->url(array('controller'=>'saisie','action'=>'contact', 'siret'=>$this->siret, 'mode'=>'delete','id'=>$item->id), null, true)?>"><img src="/themes/default/images/interfaces/supprimer.png" /></a>
</div>
<?php }?>
</td>

View File

@ -7,8 +7,9 @@
<?php }?>
<script>
var windowhref = window.location.href;
$('#dialog').dialog({ buttons: [
{ text: "Fermer", click: function() { $(this).dialog("close"); } }
{ text: "Fermer", click: function() { $(this).dialog("close"); window.location.href=windowhref; } }
] });
</script>
@ -19,7 +20,9 @@
<p>Supprimer l'élément id=<?=$this->id?> ?</p>
<form name="contact" action="<?=$this->url(array('controller'=>'saisie','action'=>'contact'),null,true)?>" method="post">
<input type="hidden" name="mode" value="delete" />
<input type="hidden" name="id" value="<?=$this->id?>"/>
<input type="hidden" name="siret" value="<?=$this->siret?>"/>
</form>
<?php } else {?>

View File

@ -128,6 +128,7 @@ class WsScores
$params->type = $type;
$params->value = $value;
$params->info = $info;
$params->delete = $delete;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setContactEt($params);
@ -2568,7 +2569,7 @@ class WsScores
return false;
}
}
/**
* setDirigeantsOp
* @param array $infos
@ -2594,7 +2595,7 @@ class WsScores
}
}
}
/**
* searchDirigeantsOp
* @param string $query