Issue #0001652: Suppersion de Cut-off

This commit is contained in:
Aram HARUTYUNYAN 2013-07-30 08:46:17 +00:00
parent e4be2c6e06
commit c0408f945e
4 changed files with 45 additions and 55 deletions

View File

@ -2301,12 +2301,12 @@ class SaisieController extends Zend_Controller_Action
$request = $this->getRequest();
$siren = $request->getParam('siren');
$refresh = 0;
$message = '';
if ( $request->isXmlHttpRequest() ) {
$this->_helper->layout()->disableLayout();
if ( $request->isPost() ) {
$params = $request->getParams();
$message = '';
$params = $request->getParams();
// check values one more time
$paramlist = array(
'siren' => 'Siren',
@ -2327,12 +2327,17 @@ class SaisieController extends Zend_Controller_Action
// end checking values
if ($message == '') {
$message = $ws->setScoreCutoff($params['siren'], $params['encours']*1000, $params['scoreSolv'], $params['scoreDir'], $params['scoreConf'], $params['remarque']);
$message = $ws->setScoreCutoff($params['siren'], $params['encours']*1000, $params['scoreSolv'], $params['scoreDir'], $params['scoreConf'], $params['remarque'], $params['delete']);
if (is_int($message)){
$message = "Cut-off mis à jour.";
$refresh = 1;
}
}
if ($message == '' && $params['delete'] == 1) {
$message = "Cut-off est supprimé. Aucun Cut-off est défini, merci de remplir toutes les valeurs";
$refresh = 1;
}
}
} else {
$this->view->assign('name', "Définir un Cut-off");
@ -2341,11 +2346,9 @@ class SaisieController extends Zend_Controller_Action
$getcutoff = json_decode($ws->getScoreCutoff($siren), true);
if(!$getcutoff) {
if ($request->getParam('delmessage', NULL)){
$message = $request->getParam('delmessage', NULL)."Aucun Cut-off est défini, merci de remplir toutes les valeurs";
$refresh = 1;
} else {
if ($message == '') {
$message = "Aucun Cut-off est défini, merci de remplir toutes les valeurs";
$refresh = 0;
}
$getcutoff = array(
@ -2366,26 +2369,4 @@ class SaisieController extends Zend_Controller_Action
$this->view->assign('message', $message);
$this->view->assign('refresh', $refresh);
}
/**
* Supprimer Cut-off
*/
public function scorecutoffdelAction()
{
$ws = new WsScores();
$message = '';
$request = $this->getRequest();
$siren = $request->getParam('siren');
if ( $request->isXmlHttpRequest() ) {
$this->_helper->layout()->disableLayout();
if ( $request->isPost() && isset($siren)) {
$message = $ws->delScoreCutoff($siren);
if ($message){
$message = "Cut-off est supprimé. ";
}
}
}
$this->_redirect('/saisie/scorecutoff/siren/'.$siren.'/delmessage/'.$message);
}
}

View File

@ -81,6 +81,7 @@ $wdate = new WDate();
<div style="margin-top:5em">
<form>
<input type="hidden" name="siren" value="<?=$this->siren?>">
<input type="hidden" name="delete" value="0">
<div>
<label>Encours</label>
@ -117,8 +118,6 @@ foreach($select as $item => $val) {
</form>
</div>
<div id="confirm" title="Confirmation de suppression">Supprimer Cut-off ?</div>
<div class="loading"><center><img style="padding-top:25%" src="/themes/default/images/giant/19-1.gif" /></center></div>
<script type="text/javascript" src="/themes/default/scripts/scorecutoff.js" />

View File

@ -279,9 +279,10 @@ class WsScores
* @param int $scoreDir
* @param int $scoreConf
* @param string $remarque
* @param boolean delete
* @return boolean
*/
public function setScoreCutoff($siren, $encours, $scoreSolv, $scoreDir, $scoreConf, $remarque)
public function setScoreCutoff($siren, $encours, $scoreSolv, $scoreDir, $scoreConf, $remarque, $delete)
{
$infos = array(
'siren' => $siren,
@ -293,6 +294,7 @@ class WsScores
);
$params = new stdClass();
$params->infos = json_encode($infos);
$params->delete = $delete;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setScoreCutoff($params);

View File

@ -32,24 +32,6 @@ $('[required]').blur(function(){
validate();
});
$("#confirm").dialog({
autoOpen: false,
modal: true,
buttons : {
"Oui" : function() {
var siren = $('[name=siren]').serialize();
$(this).dialog("close");
loading();
$.post('/saisie/scorecutoffdel', siren, function(data) {
$('#dialog').html(data);
});
},
"Non" : function() {
$(this).dialog("close");
}
}
});
$('#dialog').dialog({ buttons: [
{ text: "Valider", click: function() {
var values = $(this).find('form').serialize();
@ -60,9 +42,35 @@ $('#dialog').dialog({ buttons: [
});
}
}},
{ text: "Supprimer",
click: function() {
$("#confirm").dialog("open");
{ text: "Supprimer", click: function() {
if (validate()) {
$('<div></div>').html('<div style="line-height:25px;">Supprimer Cut-off ?</div><div style="font-size:10px; color:#999;">Toutes les valeurs seront effacées.</div>')
.dialog({
modal: true,
title: 'Confirmation de suppression',
zIndex: 10000,
autoOpen: true,
width: '250',
resizable: false,
buttons: {
Oui: function () {
$('#dialog [name=delete]').val('1');
var values = $('#dialog').find('form').serialize();
$(this).dialog("close");
loading();
$.post('/saisie/scorecutoff', values, function(data) {
$('#dialog').html(data);
});
},
Non: function () {
$(this).dialog("close");
}
},
close: function (event, ui) {
$(this).remove();
}
});
}
}},
{ text: "Fermer", click: function() {
if($(".message p").attr('id')==1) {
@ -75,8 +83,8 @@ $('#dialog').dialog({ buttons: [
] });
if($('#dateInsert').text()!='') {
$(".ui-dialog-buttonpane button:contains('Supprimer')").hide(); // change to show() when webservice will be ready
$(".ui-dialog-buttonpane button:contains('Supprimer')").show();
}
else {
$(".ui-dialog-buttonpane button:contains('Supprimer')").hide();
}
}