Issue #0001777:
This commit is contained in:
parent
3527a3439a
commit
cd1e37bbdf
@ -2137,6 +2137,47 @@ 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) {
|
||||
$id = $item->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $request->isPost() ) {
|
||||
if ($id == null) {
|
||||
$message = 'Fiche n\'est pas trouvée';
|
||||
} else {
|
||||
$checkLiens = $ws->getLiensById($id);
|
||||
if ($checkLiens->actionnaires->item || $checkLiens->participations->item || $checkLiens->directions->item) {
|
||||
$message = 'Presence des liens';
|
||||
} else {
|
||||
$result = $ws->setLienRef(json_encode($infos), $id);
|
||||
$message = ($result == 1)?'Fiche supprimée':'Erreur de suppression';
|
||||
}
|
||||
Zend_Registry::get('firebug')->info($checkLiens->participations->item);
|
||||
$this->view->assign('message', $message);
|
||||
}
|
||||
} else {
|
||||
$this->view->assign('id', $id);
|
||||
}
|
||||
}
|
||||
|
||||
public function scorecutoffAction()
|
||||
{
|
||||
|
@ -86,13 +86,19 @@
|
||||
<?php
|
||||
if ($this->siren) {
|
||||
$href = $this->url(array('controller'=>'saisie', 'action'=>'lienfiche', 'siren'=>$this->siren),null,true);
|
||||
$hrefSuppr = $this->url(array('controller'=>'saisie', 'action'=>'liendelete', 'siren'=>$this->siren),null,true);
|
||||
} else {
|
||||
$href = $this->url(array('controller'=>'saisie', 'action'=>'lienfiche', 'idFiche'=>$this->lienref),null,true);
|
||||
$hrefSuppr = $this->url(array('controller'=>'saisie', 'action'=>'liendelete', 'idFiche'=>$this->lienref),null,true);
|
||||
}
|
||||
?>
|
||||
<a class="dialog" title="Edition fiche" href="<?=$href?>">
|
||||
Editer la fiche
|
||||
</a>
|
||||
|
||||
<?php if($this->edition) {?>
|
||||
<a class="confirm" title="Fiche suppression" href="<?=$hrefSuppr; ?>">Supprimer la fiche</a>
|
||||
<?php }?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
@ -335,6 +341,26 @@ $('a.dialog').on('click', function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$( "a.confirm" ).on('click', function(e){
|
||||
e.preventDefault();
|
||||
var href = $(this).attr('href');
|
||||
var dialogOpts = {
|
||||
bgiframe: true,
|
||||
resizable: false,
|
||||
title: $(this).attr('title'),
|
||||
height: 140,
|
||||
modal: true,
|
||||
open: function(event, ui) {
|
||||
$(this).html('Chargement...');
|
||||
$(this).load(href);
|
||||
},
|
||||
buttons: { "Fermer": function() { $(this).dialog("close"); }},
|
||||
close: function() { $('#confirm').remove(); }
|
||||
};
|
||||
$('<div id="confirm"></div>').dialog(dialogOpts);
|
||||
return false;
|
||||
});
|
||||
<?php }?>
|
||||
</script>
|
||||
<?php }?>
|
26
application/views/default/scripts/saisie/liendelete.phtml
Normal file
26
application/views/default/scripts/saisie/liendelete.phtml
Normal file
@ -0,0 +1,26 @@
|
||||
<?php if (!$this->message) {?>
|
||||
<div id='message'>Supprimer la fiche?</div>
|
||||
<script>
|
||||
$('#confirm').dialog({ buttons: [
|
||||
{ text: "Oui", click: function() {
|
||||
$('div#message').text('Suppression en process...');
|
||||
$(".ui-dialog-buttonpane button").hide();
|
||||
$(".ui-dialog-buttonpane button:contains('Fermer')").show();
|
||||
$(".ui-dialog-buttonpane button").button("option", "disabled", true);
|
||||
$.post('/saisie/liendelete', {idFiche: '<?=$this->id ?>'}, function(data) {
|
||||
$('div#message').html(data);
|
||||
$(".ui-dialog-buttonpane button").button("option", "disabled", false);
|
||||
});
|
||||
}},
|
||||
{ text: "Non", click: function() { $(this).dialog('close'); }},
|
||||
{ text: "Fermer", click: function() {
|
||||
$(this).dialog('close');
|
||||
//window.location = '/recherche/entreprise';
|
||||
}}
|
||||
] });
|
||||
|
||||
$(".ui-dialog-buttonpane button:contains('Fermer')").hide();
|
||||
</script>
|
||||
<?php } else { ?>
|
||||
<div id='message'><?=$this->message ?></div>
|
||||
<?php }?>
|
Loading…
Reference in New Issue
Block a user